faq:troubleshooting-could-not-instantiate-mail-function
This version is outdated by a newer approved version.DiffThis version (2014/02/27 09:56) is a draft.
Approvals: 0/1

This is an old revision of the document!


Troubleshooting "Could not instantiate mail function"

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”.

Two most common causes of this error message are - server settings - phpmailer libraries 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 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:

1.

 <? $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');?> 

2.

 <?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 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 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. Check the email you have set for “recepient@example.com”.

If you don't receive testing email php mail script is not working.

  1. Check whether phpmailer library is installed/enabled/configured
  2. Check whether php mail() function is installed/enabled/configured

Best way to check this, is to contact your hosting provider.

If you receive testing email, php mail script is working on your server.

faq/troubleshooting-could-not-instantiate-mail-function.1393494975.txt.gz · Last modified: 2015/09/15 09:10 (external edit)