faq:troubleshooting-could-not-instantiate-mail-function

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
faq:troubleshooting-could-not-instantiate-mail-function [2014/02/27 10:33]
Alia
faq:troubleshooting-could-not-instantiate-mail-function [2014/02/27 11:18] (current)
Line 1: Line 1:
 ====== Troubleshooting "Could not instantiate mail function"​ ====== ====== Troubleshooting "Could not instantiate mail function"​ ======
  
-Full error message: ​+Full error message: ​ 
 <code php> <code php>
 OW Debug - Exception OW Debug - Exception
 Message: Could not instantiate mail function. Message: Could not instantiate mail function.
-File: /var/​www/​friendly/​data/​www/​friendly.ru/​ow_libraries/​php_mailer/​class.phpmailer.php+File: /mysitename/​ow_libraries/​php_mailer/​class.phpmailer.php
 Line: 595 Line: 595
 Trace: Trace:
Line 23: Line 23:
 Human readable explanation of the error message: phpMailer library ​ tried to send a message using the php mail() function and the php mail() function returned "​false"​ result. Human readable explanation of the error message: phpMailer library ​ tried to send a message using the php mail() function and the php mail() function returned "​false"​ result.
  
-Two most common causes of this error message are +Two most common causes of this error message are: 
-  - server ​settings +  - Server ​settings 
-  - phpmailer ​library used within Oxwall. +  - Phpmailer ​library used within Oxwall.
-  - other possible causes+
  
 ===== Checking Server Settings =====  ===== Checking Server Settings ===== 
  
-Since mail functions are part of the PHP's core, first of all make sure that PHP was configured/​compiled correctly on your server to send emails. Run following test to see whether php mail script is working. ​+Since mail functions are part of the PHP's core, first of all make sure that PHP was configured/​compiled correctly on your server to send emails. Run following test to check this: 
  
 Create a file called testing_mail.php in /​public_html/​ directory on your server. ​ Create a file called testing_mail.php in /​public_html/​ directory on your server. ​
Line 38: Line 37:
  
 <code php> <?php $to = '​recepient@example.com';​ $subject = 'Test email using PHP'; $message = 'This is a test email message';​ $headers = 'From: any_sender_email@example.com'​ . "​\r\n"​ . '​Reply-To:​ webmaster@example.com'​ . "​\r\n"​ . '​X-Mailer:​ PHP/' . phpversion();​ mail($to, $subject, $message, $headers, '​-fany_sender_email@example.com'​);​ ?> </​code>​ <code php> <?php $to = '​recepient@example.com';​ $subject = 'Test email using PHP'; $message = 'This is a test email message';​ $headers = 'From: any_sender_email@example.com'​ . "​\r\n"​ . '​Reply-To:​ webmaster@example.com'​ . "​\r\n"​ . '​X-Mailer:​ PHP/' . phpversion();​ mail($to, $subject, $message, $headers, '​-fany_sender_email@example.com'​);​ ?> </​code>​
- 
 Where  Where 
   * any_sender_email@example.com - your sender'​s email   * any_sender_email@example.com - your sender'​s email
Line 44: Line 42:
   * recepient@example.com - your recipient'​s email. ​   * recepient@example.com - your recipient'​s email. ​
  
-Make sure to replace those values ​in the testing_mail.php ​by existing email addresses.+Make sure to replace those values by existing email addresses.
  
 Run created file by opening www.yoursitename.com/​testing_mail.php in any browser. You should see blank page. Run created file by opening www.yoursitename.com/​testing_mail.php in any browser. You should see blank page.
  
-In case if Oxwall itself is installed in /​public_html directory, you will see "Page Not Found" message. This happens because Oxwall'​s .htaccess is blocking this page. Add following line into Oxwall'​s .htaccess right before //"​RewriteCond %{REQUEST_URI} !^/​index\.php"//​ to solve this issue: ​+In case if Oxwall itself is installed in /​public_htmldirectory, you will see "Page Not Found" message. This happens because Oxwall'​s .htaccess is blocking this page. Add following line into Oxwall'​s .htaccess right before //"​RewriteCond %{REQUEST_URI} !^/​index\.php"//​ to solve this issue: ​
  
 <code php> RewriteCond %{REQUEST_URI} !/​testing_mail\.php </​code>​ <code php> RewriteCond %{REQUEST_URI} !/​testing_mail\.php </​code>​
Line 55: Line 53:
 Check the email you have set for "​recepient@example.com"​. ​ Check the email you have set for "​recepient@example.com"​. ​
  
-If you don't receive testing email php mail script is not working+If you don't receive testing email, contact your hosting provider and check
  
-  - Check whether phpmailer library is installed/​enabled/​configured +  - whether phpmailer library is installed/​enabled/​configured ​on your server. 
-  - Check whether php mail() function is installed/​enabled/​configured.  +  - whether php mail() function is installed/​enabled/​configured ​on your server.
-        Best way to check this, is to contact ​your hosting provider.+
  
-If you receive testing email, php mail script is working on your server. In this case, "Could not instantiate mail function"​ is most likely to be caused by php mailer libraries used in Oxwall.+If you receive testing email, php mail script is working on your server. In this case, "Could not instantiate mail function"​ is most likely to be caused by php mailer libraries used in Oxwall ​itself.
  
 ===== Phpmailer libraries used within Oxwall =====  ===== Phpmailer libraries used within Oxwall ===== 
  
-If your have tried all the steps listed above and have contacted your host and you are still getting "Could not Instantiate Mail Function"​ then may be phpmailer libraries Oxwall ​uses are not compatible with your server'​s configuration. ​+If you have tried all the steps listed above and are still getting "Could not Instantiate Mail Function"​ then phpmailer libraries ​used in Oxwall ​might not be compatible with your server'​s configuration. ​
  
-Open ow_libraries/​php_mailer/​class.phpmailer.php and find line #571.+Open ow_libraries/​php_mailer/​class.phpmailer.php and find line #571:
  
 <code php> $params = sprintf("​-oi -f %s", $this->​Sender);​ </​code>​ <code php> $params = sprintf("​-oi -f %s", $this->​Sender);​ </​code>​
Line 79: Line 76:
 If you don't see error message and receive the email, then leave the fix you have just applied. ​ If you don't see error message and receive the email, then leave the fix you have just applied. ​
  
-Explanation of the fix: Most of the server ​accept "​sprintf("​-oi -f %s", $this->​Sender " parameter. In your case, your server rejected it and returned "​false"​ result. To solve this Oxwall needs to update phpmailer libraries used within the script. This will be done in one of the upcoming ​updates. Until then, leave the fix you have just applied and wait for the new update. ​+Explanation of the fix: Most of the servers ​accept "​sprintf("​-oi -f %s", $this->​Sender " parameter. In your case, your server rejected it and returned "​false"​ result. To solve this Oxwall needs to update phpmailer libraries used within the script. This will be done in one of the upcoming ​builds. Until then, leave the fix you have just applied and wait for the new update. ​
  
faq/troubleshooting-could-not-instantiate-mail-function.1393497216.txt.gz · Last modified: 2015/09/15 09:10 (external edit)