This is an old revision of the document!
Full error message:
OW Debug - Exception Message: Could not instantiate mail function. File: /var/www/friendly/data/www/friendly.ru/ow_libraries/php_mailer/class.phpmailer.php Line: 595 Trace: #0 /mysitename/ow_libraries/php_mailer/class.phpmailer.php(519): PHPMailer->MailSend('Date: Thu, 20 F...', '--b1_c6a1ad9638...') #1 /mysitename/ow_system_plugins/base/bol/mail_service.php(274): PHPMailer->Send() #2 /mysitename/ow_core/mailer.php(97): BOL_MailService->send(Object(BASE_CLASS_Mail)) #3 /mysitename/ow_system_plugins/base/bol/user_service.php(1378): OW_Mailer->send(Object(BASE_CLASS_Mail)) #4 /mysitename/ow_system_plugins/base/controllers/user.php(68): BOL_UserService->processResetForm(Array) #5 [internal function]: function name here #6 /mysitename/ow_core/request_handler.php(266): ReflectionMethod->invokeArgs(Object(BASE_CTRL_User), Array) #7 /mysitename/ow_core/application.php(330): OW_RequestHandler->dispatch() #8 /mysitename/index.php(65): OW_Application->handleRequest() #9 {main}
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
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.
Create a file called testing_mail.php in /public_html/ directory on your server. Add one of the following codes into this file:
<? $headers = 'From:any_sender_email@example.com'; mail('recepient@example.com', 'Test email using PHP', 'This is a test email message', $headers, '-fany_sender_email@example.com');?>
<?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'); ?>
Where
Make sure to replace those values in the testing_mail.php by existing email addresses.
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:
RewriteCond %{REQUEST_URI} !/testing_mail\.php
Open www.yoursitename.com/testing_mail.php again. You should now see a blank page. Check the email you have set for “recepient@example.com”.
If you don't receive testing email php mail script is not working:
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 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.
Open ow_libraries/php_mailer/class.phpmailer.php and find, find line #571.
$params = sprintf("-oi -f %s", $this->Sender);
Replace this code by:
$params = null; //sprintf("-oi -f %s", $this->Sender);
Once changes are made try to reproduce “Message: Could not instantiate mail function” error.For example, you can try and reset your password.
If you don't see error message and receive the email, then leave the fix you have just applied.