Joomla doesn’t send messages. Could not instantiate mail function.

In this topic, we will consider common problems with Joomla mail sending.

The most frequent error is  “Could not instantiate mail function.”, also sometimes you don’t get any errors, but messages do not come anyway. Below you will find solutions for these problems, but if you are using SMTP protocol, check this article.

1. Maybe you are configuring the contact us form on the local server. Some local servers like Denver or WAMP don’t send messages by default. After moving your site to the hosting, the problem with mailing will disappear.

2. Messages from your site look suspicious for mail services.

2a. Check the spam folder and mark emails from the site as “Not spam”, also add sender mail to the address book.

2b. If you don’t find the email in the spam folder, сonfigure sending via SMTP. You can do it in 5 minutes by following instructions. I guess it’s the most simple and trustworthy way.

2c. If you don’t want to use SMTP, create a domain email address (like sender@joomly.net). Open «System->Global configuration» in the top menu, choose tab Server, find “Mail Settings” options and type a new email address in “From email” field. It will increase your site trust level.

2d. Configure SPF or DKIM on your web server.

3.  Problems with PHP Mailer. Joomla has 3 different mailers: PHP Mail, Sendmail, and SMTP. By default is using PHP Mail, below we will tell you how to fix the problem with him.

3a. The most simple way is to change mailer to the Sendmail. Open «System->Global configuration» in the top menu and choose tab Server. Find “Mail Settings” and choose in the “Mailer” drop down “Sendmail” option. Also, you can choose SMTP, read how to use and configure this protocol here.

Joomla doesn't send messages

3b. You can try to fix PHP Mailer. Open :”root/libraries/phpmailer/phpmailer.php” or  “root/libraries/vendor/phpmailer/phpmailer/class.phpmailer.php” for the late versions of Joomla.

Code:
$params = sprintf(‘-f%s’, $this->Sender);

Change to:
$params = sprintf(‘-f%s’);

Or for the earlier versions find:

$params = sprintf(‘-oi -f %s’, $this->Sender);

Probably 707 or 1161 string number. And add below:

$params = ‘ ‘;

Now your code looks like:

if (empty($this->Sender)) {

$params = ‘-oi -f %s';

} else {

$params = sprintf(‘-oi -f %s’, $this->Sender);

$params = ‘ ‘;

}

4. If this methods doesn’t help, maybe the problem is in your hoster. Probably you are using free plan, with blocked or opt-in mailing. Anyway you should write to the hosting support with your problem.

 

Leave a Reply