====== Troubleshooting "Could not instantiate mail function" ====== Full error message: OW Debug - Exception Message: Could not instantiate mail function. File: /mysitename/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: - Server settings - Phpmailer library used within Oxwall. ===== 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 check this: Create a file called testing_mail.php in /public_html/ directory on your server. Add **one** of the following codes into this file: Where * any_sender_email@example.com - your sender's email * -fany_sender_email@example.com - same sender's email but with "-f" at the begining. * recepient@example.com - your recipient's email. 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. 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, contact your hosting provider and check: - whether phpmailer library is installed/enabled/configured on your server. - whether php mail() function is installed/enabled/configured on your server. 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 ===== 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: $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, try to reset your password. 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 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.