Topic: Contact Page email problem (1.5)
Could not instantiate mail function.
That's the error I get when using the new functionality in 1.5.
What do I have to do to fix this?
https://mark-friedman.com
Thanks
You are not logged in. Please login or register.
Showkase Support Forum → Showkase Support → Contact Page email problem (1.5)
Could not instantiate mail function.
That's the error I get when using the new functionality in 1.5.
What do I have to do to fix this?
https://mark-friedman.com
Thanks
I've hidden the page since I can't fix it without help, but I wonder if anyone else is having (or had) a similar problem and how you resolved it.
The contact form requires PHP mail support on the server (noted in the Version History for v1.4.0).
It sounds like this is not currently available on your hosting account.
Please check with your web host to make sure that PHP mail is enabled.
This should hopefully solve your problem.
Please take a look at my contact page (mark-friedman.com/contact/) and see if I'm missing something.
The server is running php 5.4 with mail support.
Is there something I ed to add in .htaccess?
Thank you
I see the problem you have with your Contact Page.
The problem still looks to be related to PHP mail support on your web server.
Is there something I ed to add in .htaccess?
You should not need to add anything to your .htaccess file for the mail functionality to work but there could potentially be an entry already in your .htaccess file which is somehow preventing the mail functionality from working.
You could try temporarily removing your .htaccess file completely to see if this make a difference.
Showkase uses PHPMailer to send contact form emails.
If you Google "PHPMailer Could not instantiate mail function", you'll find a lot of pages and suggestions. The problem could be one of many.
It might be an idea to run PHPMailer in debug mode to see if it produces a more detailed error message.
Open the showkase/admin/plugins/contact/master/contactcore/class.phpmailer.php file in a plain text editor and change line 316 from:
public $SMTPDebug = 0;
... to:
public $SMTPDebug = 2;
Also, remove the @ characters (before 'mail') from line 629:
$result = @mail($to, $subject, $body, $header);
... and line 631:
$result = @mail($to, $subject, $body, $header);
Hopefully this will generate a more detailed error message and point us in the right direction.
Please note that the line numbers above refer to the current version of Showkase (v1.6.1).
Hi Steven,
I'm running v1.6.1 (Showkase).
I did not republish the page (should I have done so?) as this script is not part of the theme.
I made the above changes and got the same error on-screen.
There are no entries in the error logs.
While making those changes, I noticed the script has a debug mode. Do you have any experience with that? If so, could you walk e through the needed modifications?
If not, what should I do next?
Thanks
I did not republish the page (should I have done so?) as this script is not part of the theme.
Yes, you'll need to republish your site after making the modifications. Sorry for not mentioning it before.
When you publish the site, Showkase will copy the contact form files from the 'master' folder into the '_viewers' folder (which is used in the live site).
Hopefully using PHPMailer in debug mode and without suppressing errors will result in a more detailed message which will help to determine the exact cause of the problem.
Now the click on send does nothing - and no entry in the log.
What do you suggest now?
I found another log file in contactcore:
[16-Jun-2016 13:00:52 America/Denver] PHP Warning: Module 'http' already loaded in Unknown on line 0
[16-Jun-2016 13:00:52 America/Denver] PHP Warning: Module 'magickwand' already loaded in Unknown on line 0
[16-Jun-2016 13:00:52 America/Denver] PHP Warning: Module 'mailparse' already loaded in Unknown on line 0
[16-Jun-2016 13:00:52 America/Denver] PHP Warning: Module 'OAuth' already loaded in Unknown on line 0
[16-Jun-2016 13:03:39 America/Denver] PHP Warning: Module 'http' already loaded in Unknown on line 0
[16-Jun-2016 13:03:39 America/Denver] PHP Warning: Module 'magickwand' already loaded in Unknown on line 0
[16-Jun-2016 13:03:39 America/Denver] PHP Warning: Module 'mailparse' already loaded in Unknown on line 0
[16-Jun-2016 13:03:39 America/Denver] PHP Warning: Module 'OAuth' already loaded in Unknown on line 0
I'm sorry to hear that running PHPMailer in debug more produced less error output than before.
Have you checked with your web host to ensure that PHP mail is enabled and set up correctly on your hosting account? If so, what did they say?
If you have not yet contacted them, please ask them why PHP mail does not seem to work on your hosting account. They may be able to tell you right away exactly what the problem is.
I'd be happy to investigate further myself but I'd really need access to your web server.
If you are agreeable to this, please let me know and I'll send you an email address where you can forward your FTP details to me.
Thank you.
Let's give it a try. Please send your email to mark@mark-friedman.com
[Communication continued via email.]
Thanks for your help, Steven.
It appears there's a bug in the code that doesn't recognize mark@mark-friedman.com as a valid "from" address, but foo@gmail.com - which doesn't exist - IS a valid "From address."
Are you referring to the 'Email to' field in the admin section?
I'm not exactly sure why the contact form (PHPMailer) would fail to send emails to your own email address.
I used a couple of different (valid) email addresses when I was testing the functionality out on your server (a Gmail address and a Hotmail address) and emails from the contact form were sent to both addresses successfully.
At least we're making some progress and now know that your email address seems to be the cause of the problem.
I don't know if it will help but this forum thread seems to describe your problem:
http://stackoverflow.com/questions/2901 … l-function
Also, the PHPMailer troubleshooting section for the "Could not instantiate mail function." error message might help.
https://github.com/PHPMailer/PHPMailer/ … l-function
You could maybe try the 3rd suggestion in the link above and try using sendmail by opening the 'showkase/admin/plugins/contact/master/contactcore/contact.php' file in a plain text editor and changing line 21 from:
$mailer->isMail();
... to:
$mailer->isSendmail();
The path to the sendmail binary in your 'php.ini' file looks to be OK (the regular default sendmail path) so you should not need to explicitly set it.
Be sure to republish your site after making this modification.
I'm not sure if it will work but it might be worth a try.
Please note that the line number above refers to the current version of Showkase (v1.6.1).
Better - new error message: Could not execute: /usr/sbin/sendmail -t -i
Try setting your sendmail_path (in your 'php.ini file) to just '/usr/sbin/sendmail'(without the -t -i switches) to see if this makes a difference.
Maybe your web host could shed a little more light on the "Could not execute: /usr/sbin/sendmail -t -i" error message.
Otherwise, try using SMTP instead.
Open the 'showkase/admin/plugins/contact/master/contactcore/contact.php' file in a plain text editor and change line 21 from:
$mailer->isMail();
... to:
$mailer->isSMTP(); // Use SMTP
$mailer->SMTPDebug = 2; // Enable SMTP class debug output mode - can be 0, 1, 2, 3 or 4
$mailer->SMTPAuth = true; // Use SMTP authentication - can be true or false
$mailer->SMTPSecure = ''; // Secure connection prefix - can be '', 'ssl' or 'tls'
$mailer->Host = 'smtp.example.com'; // Set SMTP host
$mailer->Port = 25; // Set SMTP port
$mailer->Username = 'username'; // Set SMTP username
$mailer->Password = 'password'; // Set SMTP password
You will need to fill in your own unique SMTP details (as noted in the comments within the code).
You might also need to ensure that the 'From' address is a valid email address on your domain.
Try changing line 91 from:
$mailer->setFrom('mailer'.strstr($siteEmail, '@'), $userName);
... to:
$mailer->setFrom('your@email.address', $userName);
I hope this helps.
Showkase Support Forum → Showkase Support → Contact Page email problem (1.5)
Powered by PunBB, supported by Informer Technologies, Inc.