Mailer error could not instantiate mail function

I'm using the mail() basic example modified slightly for my user id and I'm getting the error "Mailer Error: Could not instantiate mail function" if I use the mail function - mail($to, $

I’m using the mail() basic example modified slightly for my user id and I’m getting the error «Mailer Error: Could not instantiate mail function»

if I use the mail function —

mail($to, $subject, $message, $headers);

it works fine, though I’m having trouble sending HTML, which is why I’m trying PHPMailer.

this is the code:

<?php
require_once('../class.phpmailer.php');

    $mail             = new PHPMailer(); // defaults to using php "mail()"
    $body             = file_get_contents('contents.html');
    $body             = eregi_replace("[]",'',$body);
        print ($body ); // to verify that I got the html
    $mail->AddReplyTo("reply@example.com","my name");
    $mail->SetFrom('from@example.com', 'my name');
    $address = "to@example.com";
    $mail->AddAddress($address, "her name");
    $mail->Subject    = "PHPMailer Test Subject via mail(), basic";
    $mail->AltBody    = "To view the message, please use an HTML compatible email viewer!";
    $mail->MsgHTML($body);
    $mail->AddAttachment("images/phpmailer.gif");      // attachment
    $mail->AddAttachment("images/phpmailer_mini.gif"); // attachment

    if(!$mail->Send()) {
        echo "Mailer Error: " . $mail->ErrorInfo;
    } else {
        echo "Message sent!";
    }
?>

Stephen Ostermiller's user avatar

asked Aug 18, 2009 at 23:20

sdfor's user avatar

3

Try using SMTP to send email:-

$mail->IsSMTP();
$mail->Host = "smtp.example.com";

// optional
// used only when SMTP requires authentication  
$mail->SMTPAuth = true;
$mail->Username = 'smtp_username';
$mail->Password = 'smtp_password';

answered Aug 22, 2011 at 8:55

Mukesh Chapagain's user avatar

Mukesh ChapagainMukesh Chapagain

24.6k15 gold badges115 silver badges119 bronze badges

4

Your code looks good, did you forget to install PostFix on your server?

sudo apt-get install postfix

It worked for me ;)

Cheers

Andrew's user avatar

Andrew

17.8k12 gold badges102 silver badges112 bronze badges

answered Feb 6, 2018 at 13:22

Irwuin's user avatar

IrwuinIrwuin

4933 silver badges9 bronze badges

2

This worked for me

$mail->SetFrom("from@domain.co","my name", 0); //notice the third parameter

answered Feb 27, 2016 at 20:52

Matías Cánepa's user avatar

Matías CánepaMatías Cánepa

5,5754 gold badges56 silver badges94 bronze badges

2

$mail->AddAddress($address, "her name");

should be changed to

$mail->AddAddress($address);

This worked for my case..

answered Aug 31, 2011 at 12:09

Avinash's user avatar

AvinashAvinash

6,00415 gold badges59 silver badges93 bronze badges

5

You need to make sure that your from address is a valid email account setup on that server.

answered Jun 19, 2010 at 7:31

D.F.'s user avatar

D.F.D.F.

1851 silver badge6 bronze badges

0

If you are sending file attachments and your code works for small attachments but fails for large attachments:

If you get the error «Could not instantiate mail function» error when you try to send large emails and your PHP error log contains the message «Cannot send message: Too big» then your mail transfer agent (sendmail, postfix, exim, etc) is refusing to deliver these emails.

The solution is to configure the MTA to allow larger attachments. But this is not always possible. The alternate solution is to use SMTP. You will need access to a SMTP server (and login credentials if your SMTP server requires authentication):

$mail             = new PHPMailer();
$mail->IsSMTP();                           // telling the class to use SMTP
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->Host       = "mail.example.com";    // set the SMTP server
$mail->Port       = 26;                    // set the SMTP port
$mail->Username   = "johndoe@example.com"; // SMTP account username
$mail->Password   = "********";            // SMTP account password

PHPMailer defaults to using PHP mail() function which uses settings from php.ini which normally defaults to use sendmail (or something similar). In the above example we override the default behavior.

answered Aug 26, 2015 at 21:15

Salman A's user avatar

Salman ASalman A

255k81 gold badges426 silver badges515 bronze badges

The PHPMailer help docs on this specific error helped to get me on the right path.

What we found is that php.ini did not have the sendmail_path defined, so I added that with sendmail_path = /usr/sbin/sendmail -t -i;

answered May 4, 2017 at 1:24

Matt Pope's user avatar

Matt PopeMatt Pope

1672 silver badges11 bronze badges

1

In my case, it was the attachment size limit that causes the issue. Check and increase the size limit of mail worked for me.

answered Oct 31, 2018 at 17:59

fiskcn's user avatar

1

Seems in my case it was just SERVER REJECTION. Please check your mail server log / smtp connection accessibility.

answered Nov 10, 2016 at 10:32

Alex's user avatar

AlexAlex

1,2571 gold badge15 silver badges12 bronze badges

I had this issue, and after doing some debugging, and searching I realized that the SERVER (Godaddy) can have issues.

I recommend you contact your Web hosting Provider and talk to them about Quota Restrictions on the mail function (They do this to prevent people doing spam bots or mass emailing (spam) ).

They may be able to advise you of their limits, and if you’re exceeding them. You can also possibly upgrade limit by going to private server.

After talking with GoDaddy for 15 minutes the tech support was able to resolve this within 20 minutes.

This helped me out a lot, and I wanted to share it so if someone else comes across this they can try this method if all fails, or before they try anything else.

answered Jan 21, 2017 at 7:47

kray's user avatar

kraykray

1,4802 gold badges18 silver badges36 bronze badges

An old thread, but it may help someone like me. I resolved the issue by setting up SMTP server value to a legitimate value in PHP.ini

answered Jun 6, 2013 at 0:38

Atif.SQL's user avatar

I had this issue as well. My solution was to disable selinux. I tried allowing 2 different http settings in selinux (something like httpd_allow_email and http_can_connect) and that didn’t work, so I just disabled it completely and it started working.

answered Dec 30, 2014 at 19:53

iAndy's user avatar

iAndyiAndy

113 bronze badges

I was having this issue while sending files with regional characters in their names like: VęryRęgióńął file - name.pdf.

The solution was to clear filename before attaching it to the email.

answered Aug 20, 2016 at 19:20

jmarceli's user avatar

jmarcelijmarceli

18.5k6 gold badges67 silver badges66 bronze badges

Check if sendmail is enabled, mostly if your server is provided by another company.

answered Oct 5, 2017 at 13:43

Gianluca Demarinis's user avatar

For what it’s worth I had this issue and had to go into cPanel where I saw the error message

«Attention! Please register your email IDs used in non-smtp mails through cpanel plugin. Unregistered email IDs will not be allowed in non-smtp emails sent through scripts. Go to Mail section and find «Registered Mail IDs» plugin in paper_lantern theme.»

Registering the emails in cPanel (Register Mail IDs) and waiting 10 mins got mine to work.

Hope that helps someone.

answered Jun 21, 2018 at 10:19

MomasVII's user avatar

MomasVIIMomasVII

4,3403 gold badges31 silver badges47 bronze badges

A lot of people often overlook the best/right way to call phpmailer and to put these:

require_once('../class.phpmailer.php');

or, something like this from the composer installation:

use PHPMailerPHPMailerPHPMailer;
use PHPMailerPHPMailerException;
require_once "../../vendor/autoload.php";

on TOP of the page before calling or including anything else. That causes the «Could not instantiate mail function»-error by most folks.

Best solution: put all mail handling in a different file to have it as clean as possible. And always use SMTP.
If that is not working, check your DNS if your allowed to send mail.

answered Dec 24, 2021 at 22:20

KJS's user avatar

KJSKJS

1,1561 gold badge12 silver badges28 bronze badges

My config: IIS + php7.4

I had the same issue as @Salman-A, where small attachments were emailed but large were causing the page to error out.
I have increased file and attachments limits in php.ini, but this has made no difference.

Then I found a configuration in IIS(6.0), and increased file limits in there.
iis config image

Also here is my mail.php:

use PHPMailerPHPMailerPHPMailer;
use PHPMailerPHPMailerException;
require '../_PHPMailer-master/src/Exception.php';
require '../_PHPMailer-master/src/PHPMailer.php';

try{
    $email = new PHPMailer(true);
    $email->SetFrom('internal@example.com', 'optional name');
    $email->isHTML(true);
    $email->Subject   = 'my subject';
    $email->Body      = $emailContent;
    $email->AddAddress( $eml_to );
    $email->AddAttachment( $file_to_attach );
    $email->Send();
  }catch(phpmailerException $e){echo $e->errorMessage();}

future.

Stephen Ostermiller's user avatar

answered Sep 8, 2020 at 14:39

michal's user avatar

michalmichal

3274 silver badges15 bronze badges

We nee to change the values of ‘SMTP’ in php.ini file
php.ini file is located into

EasyPHP-DevServer-14.1VC11binariesphpphp_runningversionphp.ini

answered Oct 24, 2014 at 5:48

user3595601's user avatar

Are you stuck with “PHPMailer could not instantiate mail function”?

PHPMailer helps to send emails safely and easily from a web server. However, it often errors out due to misconfigurations of the mail() function, absence of local mail server and so on.

At Bobcares, we often receive requests to fix this error as part of our Server Management Services.

Today, let’s have a deep look at this error and see how our Support Engineers fix PHPMailer easily.

Why does PHPMailer could not instantiate mail function occurs?

As we all know, PHPMailer is a popular code for sending email from PHP. And, many open-source projects like WordPress, Drupal, etc use them.

PHPMailer validates email addresses automatically and protects against header injection attacks.

Developers often prefer sending mail from their code. And, mail() is the only PHP function that supports this.

But, sometimes the incorrect PHP installation fails to call the mail() function correctly. This will cause mail function errors.

Similarly, in some cases, the absence of a local mail server will also cause this error.

How to fix “PHPMailer could not instantiate mail function”?

So far we have discussed the error in detail. Now, let’s have a look at some of its top fixes.

There are alternative ways to resolve this error easily.

1. Using SMTP to send the email

As we have already said, if the PHP installation is not configured to call the mail() function correctly, it will cause the error.

So, in such cases, it is better to use isSMTP() and send the email directly using SMTP.

This is faster, safer and easier to debug than using mail(). This will resolve the error easily.

2. Install a local mail server

The PHP mail() function usually sends the mail via a local mail server.

So, using SMTP will not resolve the error if a mail server is not set up on the localhost.

Therefore, it is necessary to install a local mail server. For instance, we can install PostFix to the server using the below command.

sudo apt-get install postfix

3. Other Solutions

The PHP mail() function works with the Sendmail binary on Linux, BSD, and macOS platforms.

So, it is important to ensure that the sendmail_path points at the Sendmail binary, which is usually /usr/sbin/sendmail in php.ini.

Similarly, sometimes when we try to send large emails, it returns “Could not instantiate mail function” error along with  “Cannot send message: Too big” message in the PHP error log.

This means the mail transfer agent is refusing to deliver these emails.

So, we need to configure the MTA to allow larger attachments to resolve the error.

[Still facing difficulty to fix PHPMailer error?- We’ll help you.]

Conclusion

In short, PHPMailer could not instantiate mail function occurs due to misconfigurations of the mail() function, absence of local mail server and so on. In today’s writeup, we discussed this error in detail and saw some of the major fixes by our Support Engineers.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = «owonCMyG5nEQ0aD71QM»;

В этой статье мы рассмотрим проблемы, возникающие с отправкой почты на CMS Joomla.

Наиболее часто встречаются ошибки вида «Could not instantiate mail function.» и «Не удалось вызвать функцию mail», также бывают случаи, когда никакой ошибки не отображается, тем не менее письма не приходят на почту. На всех этих случаях мы остановимся подробнее далее, если у вас возникают проблемы с отправкой почты по протоколу SMTP, то вам будет полезна эта статья.

Ошибки, описанные выше, могут быть вызваны рядом причин. В этой статье я попытался систематизировать информацию по проблемам с отправкой писем на Joomla и их решениям.

1. Вы настраиваете модуль обратный связи, отправку почты и тп на локальном сервере.

На локальных серверах вроде Denver или WAMP по умолчанию стоят заглушки, которые препятствуют отправке писем. Как правило, после переноса сайта на хостинг эти проблемы пропадут.

2. Вы получаете письма на yandex или mail почту.

Эти почтовые службы с большим подозрением относятся к получаемым сообщениям. Если, например, ваш сайт висит на одном IP c рассыльщиками спама, велика вероятность, что и вы попадете в список подозрительных отправителей и будете получать сообщения в папку спам либо с большой задержкой либо сообщения в принципе не будут доходить. Как можно решить эту проблему? Ниже мои советы от простого к сложному.

2а. Если письмо нашлось в спаме, просто добавьте адрес с которого оно пришло в адресную книгу, после этого письма начнут приходить в основные папки.

2б. Настройте отправку через SMTP. Это можно сделать буквально за 5 минут, инструкцию можно найти здесь. На мой взгляд самый простой и надежный способ.

2в. Если отправка через SMTP вам не подходит, можно попробовать создать ящик на вашем хостинге, он будет выглядеть примерно так название_ящика@ваш_домен.ru и добавить его в поле email-сайта на вкладке сервер. Почтовый сервер будет видеть в исходящих почту с вашим доменом и траст письма повысится. Сделать это можно в панели администратора, «System->Global configuration» («Система->Общие настройки»). В этом разделе открыть вкладку Server (Сервер) и в правом нижнем углу найти настройки отправления почты.

options

2г. Настройте spf. Spf это верификация вашего домена, настраивается на хостинге за пару минут при наличие инструкции. Так как я не знаю ваш хостинг, то инструкцию вам придется найти самостоятельно, обычно достаточно набрать в поиске что-то вроде «spf beget» (бегет это мой хостинг) и открыть первую ссылку. Перед гуглением можно попробовать посмотреть здесь, там размещены настройки для кучи популярных хостингов.

2д. Настроить DKIM. DKIM это цифровая подпись, настраивается тоже по инструкции хостинга, но в отличие от spf услуга может быть платной. Перед приобретением рекомендую вам связаться со своим хостером и уточнить возможные причины не прихода писем.

3. Проблемы с PHP Mailer.

Довольно распространенный случай. В Joomla предусмотрено 3 механизма отправки писем: PHP Mail, Sendmail и SMTP. По-умолчанию используется первый и с ним зачастую бывают проблемы. Ниже я предлагаю несколько путей решения проблемы.

2a. Самый простой способ решить проблему, это изменить способ отправки на Sendmail. Для этого в панели администратора надо перейти в «System->Global configuration» («Система->Общие настройки»), где открыть вкладку Server (Сервер). Справа внизу вы увидите настройки почты, в поле «Mailer» («Способ отправки») в выпадающем списке надо выбрать «Sendmail». Можно также поменять способ отправки на SMTP, как это сделать читайте здесь.

Joomla не отправляются письма

3б. Также можно попробовать починить PHP Mailer вручную . Для этого надо найти и открыть файл:»корень сайта/libraries/phpmailer/phpmailer.php» или «корень сайта/libraries/vendor/phpmailer/phpmailer/class.phpmailer.php» для поздних версий джумлы. Далее найти строчку:

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

Вероятный номер строки 707 или 1161. И дописать под ней:

$params = ‘ ‘;

Ваш код теперь выглядит так:

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

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

} else {

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

$params = ‘ ‘;

}

Или в случае более поздней версии заменить искомую строку:

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

Меняется на:
$params = sprintf(‘-f%s’);

4. Проблемы с хостингом.

Возможно вы используете бесплатный тариф, на котором закрыта отправка писем или он включает этот функционал по требования. Как бы то ни было, вам нужно написать в службу поддержки и объяснить проблему.

Joomla — хороший движок, но не идеальный. Даже на таком удобном конструкторе могут выскакивать весьма неудобные проблемы. К примеру, в CMS Joomla выскакивает белый экран при входе в админку. Либо возникают ошибки в результате активации человекопонятных ссылок в настройках.

Но одна из самых распространенных и непонятных для многих вебмастеров ошибка — это «сould not instantiate mail function».

Такое случается, когда вам не удалось вызвать функцию отправления электронного письма при помощи движка Joomla. Рассмотрим возможные причины возникновения ошибки и методы ее решения.

135

Почему не удалось вызвать функцию отправки на имейл в Joomla

Итак, попробуем определить причину появления навязчивого сообщения «сould not instantiate mail function» и почему не удалось вызвать функцию в разных ситуациях.

Первая причина, почему выскочила надпись «сould not instantiate mail function» при попытки отправить письмо на имейл — это ваш хостинг, а точнее ваш локальный сервер. Часто вебмастера перед тем, как что-то устанавливать на сайт или перед его публикацией, проводят эксперименты вдали от сети Интернет — у себя на компьютере на созданном виртуальном сервере. Если вы сейчас редактируете содержимое сайта именно при помощи локального сервера, то функцию не удалось вызвать по очень простой причине — у вас на компьютере нет куда отправлять имейл. То есть у вас нет сервера для отправки электронных писем. И неважно какой именно локальный хост вы используете, WAMP или Денвер — вы все равно не сможете отправлять с него электронные письма.

Порой надпись «сould not instantiate mail function» появляется, но не при каждом отправлении письма. К примеру, когда вы делаете рассылки своим подписчикам и из тысячи человек 20 не получают письма, так как не удалось вызвать эту функцию в Joomla. В таком случае объяснение простое — они ввели неправильный адрес электронной почты, когда подписывались на вашу рассылку. Решить такую проблему невозможно — придется удалить невнимательных подписчиков.

joomla-3.0-smtp-mail-settings

Иногда Joomla выдает надпись «сould not instantiate mail function» из-за того, что вы ввели в данных отправки какие-то специальные символы, которые сервер не воспринимает. Особенно часто эту случается в тех случаях, когда вы создаете скрипт рассылки и указываете в нем имя пользователя с какими-то особыми знаками. Если это так, то чтобы удалось вызвать функцию отправки электронного письма в Joomla, вам необходимо нажать пункт Yes возле графы Adds Names, чтобы сервис добавлял имена в письма и воспринимал специальные символы.

Еще одна причина, по которой вместо отчета об отправке сообщений вы увидите «сould not instantiate mail function» — это недействительный донорский адрес имейл. Дело в том, что даже если сообщения отправляет ваш сервер, они не придут получателю, если не будет указан отправитель. Возможно, вы указали неверный имейл отправителя, ведь эта почта должна быть зарегистрирована на вашем доменном имени.

Если все перечисленные причины не подходят для вашего случая, то попытайтесь разведать обстановку у хостинг-провайдера. Очень часто на хостинге ставят ограничения для различных услуг. Таким образом они завлекают клиентов покупать пакеты подороже. Есть вероятность, что не удалось вызвать функцию отправки сообщений в Joomla как раз из-за подобных ограничений. В частности, хостинг-провайдер мог поставить максимальный предел количества отправленных сообщений за час. Если это так, то вам остается немного подождать, чтобы отправить очередную партию электронных писем, либо приобрести пакет подороже, чтобы снять установленное ограничение.

Существуют и другие причины, из-за чего вылетает сообщение «сould not instantiate mail function» на сайте с движком Joomla. И вполне вероятно, что причины эти снова кроются в ограничениях вашего хостинга. Вам стоит заранее разведать допустимые параметры электронных сообщений для отправки, чтобы потом не возникало проблем. К примеру, некоторые хостинги априори отказывают отправлять сообщения, если в них закреплены какие-то файлы. Возможно, таким образом они пытаются избежать прецедентов спам-рассылок, а с другой стороны — не хотят отправлять слишком большие массивы информации, нагружая тем самым сервера. В любом случае вам нужно разведать обстановку в технической службе поддержки, а потом искать пути решения.

server-settings-image

И последняя причина, по которой надпись «сould not instantiate mail function» не дает вам отправить электронные письма — это ошибки в поле «Тема» при отправке. Вы должны знать, какие лимиты длины «Темы» установлены на сервере. Превышение лимита — это однозначный отказ к отправке. Да и не стоит делать рассылку с громоздкими заголовками — это не эффективно. С другой стороны, вы могли использовать в пункте «Тема» какие-то запрещенные символы. В любом случае вам поможет поддержка!

Moderator: General Support Moderators

X-Bumble

Joomla! Explorer
Joomla! Explorer
Posts: 449
Joined: Sat Feb 02, 2008 12:39 pm
Location: England
Contact:

Could not instantiate mail function

Hi All,

I have just created a new Super Administrator via the back-end in Joomla 1.5.1.

It has created the user OK, but an error popped above which reads;

! Could not instantiate mail function.

Could anyone please help me with what this means and what I need to do to rectify it?

Many thanks.



X-Bumble

Joomla! Explorer
Joomla! Explorer
Posts: 449
Joined: Sat Feb 02, 2008 12:39 pm
Location: England
Contact:

Re: Could not instantiate mail function

Post

by X-Bumble » Wed Mar 05, 2008 10:49 am

Hmmm,

I changed it to Sendmail and now get:

PHPMAILER_EXECUTE/usr/sbin/sendmail

Is this something I need to bring up with my hosting company?


igrimpe

Joomla! Enthusiast
Joomla! Enthusiast
Posts: 234
Joined: Wed Feb 20, 2008 8:59 am

Re: Could not instantiate mail function

Post

by igrimpe » Wed Mar 05, 2008 11:27 am

/usr/sbin/sendmail is the correct path to sendmail (though this is more or less standard on any linux) ?
«from» email is a valid email account on that server (dunno if this is needed, but it won’t hurt) ?


X-Bumble

Joomla! Explorer
Joomla! Explorer
Posts: 449
Joined: Sat Feb 02, 2008 12:39 pm
Location: England
Contact:

Re: Could not instantiate mail function

Post

by X-Bumble » Wed Mar 05, 2008 11:34 am

I’ve fixed it by using the SMTP option instead.

Cheers for the help, it set me off in the right direcion. :)


KThackston

Joomla! Enthusiast
Joomla! Enthusiast
Posts: 108
Joined: Sat Sep 06, 2008 11:31 pm

Re: Could not instantiate mail function

Post

by KThackston » Sun Sep 07, 2008 5:27 pm

I’ve tried setting it to all 3 options and I get mostly the same errors.

PHPMAILER_EXECUTE/usr/sbin/sendmail when set to sendmail
or
Could not instantiate mail function. when set to PHPMail
or
PHPMAILER_RECIPIENTS_FAILED when set to SMTP

in all instances my settings are:
Mail from [email protected]
From Name MyName
Sendmail Path /usr/sbin/sendmail
SMTP Authentication YES
etc.

any thoughts?


User avatar

smithveg

Joomla! Enthusiast
Joomla! Enthusiast
Posts: 232
Joined: Thu Jun 29, 2006 7:27 am
Contact:

Re: Could not instantiate mail function

Post

by smithveg » Tue Feb 03, 2009 6:46 am

I’ve the same problem here.
The joomla is running in windows server. Neither an options work.

Same error i get as, KThackston. Any helps?


KThackston

Joomla! Enthusiast
Joomla! Enthusiast
Posts: 108
Joined: Sat Sep 06, 2008 11:31 pm

Re: Could not instantiate mail function

Post

by KThackston » Sat Feb 14, 2009 11:16 pm

I’m getting this error from the Contact Us page:

[email protected]

I’ve triple checked my settings. I use Joomla for another site on the same server and I do not have any issues at all. I’ve checked to make sure my input is all correct, but I keep getting these errors.

can anyone help here?


X-Bumble

Joomla! Explorer
Joomla! Explorer
Posts: 449
Joined: Sat Feb 02, 2008 12:39 pm
Location: England
Contact:

Re: Could not instantiate mail function

Post

by X-Bumble » Sun Feb 15, 2009 10:57 am

If you go to the forum search area and type

PHPMAILER_RECIPIENTS_FAILED

As the keywords, you’ll get loads of suggestions as to how to fix this. :)


User avatar

smithveg

Joomla! Enthusiast
Joomla! Enthusiast
Posts: 232
Joined: Thu Jun 29, 2006 7:27 am
Contact:

Re: Could not instantiate mail function

Post

by smithveg » Mon Feb 16, 2009 4:35 pm

Finally i solve this problem by the method of SMTP.

I create a dummy email for example, [email protected] with a password.
After that i configure this email account and the password into Joomla! admin configuration page.

Then, Go back to the contact page. And input my real email for example, [email protected].

Go the the front-end make a test mail. It worked!


webone

Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Tue Sep 23, 2008 5:16 am

Re: Could not instantiate mail function

Post

by webone » Wed Mar 11, 2009 3:11 am

Try using SMTP and leaving the authentication off.


mainstwebguy

Joomla! Enthusiast
Joomla! Enthusiast
Posts: 118
Joined: Fri Aug 29, 2008 11:40 am
Location: Michigan
Contact:

Re: Could not instantiate mail function

Post

by mainstwebguy » Wed Jun 10, 2009 5:17 pm

Hello All,

I am also getting the «Could not instantiate mail funciton» message when trying to register a new user in the back end. The user will be created, but that error msg appears at the top and no email is being sent to the new user. I tried registering the new user from the front-end and the user will be created, no message appears, but the email never arrives.

I’ve tried following the advice here (http://forum.joomla.org/viewtopic.php?f=199&t=170266) but was unable to get the SMTP or sendmail to work either. (producing errors).

I would like to focus on getting the PHP mail() working because i know my server can use that function (i host a website that uses the mail() function for contact forms and it works fine).

I am running a fresh install of Joomla 1.5.11 with no extensions installed.
My webserver is IIS 6 (unfortunately; i know joomla is happier on apache, but the powers that be won’t switch)
I’m running php5 and don’t have any other problems sending mail with the php function.

I did notice on the phpmailer.php file that the FromName and From email address variables were set to Root and [email protected] respectively. Is this a correct setting or should i update them?

thanks in advance all!
J


287d

Joomla! Enthusiast
Joomla! Enthusiast
Posts: 182
Joined: Mon Jan 05, 2009 4:09 am

Re: Could not instantiate mail function

Post

by 287d » Wed Oct 14, 2009 5:24 am

Hi I am having the same issues even though everything was fine upto yesterday.

KThackston wrote:

PHPMAILER_EXECUTE/usr/sbin/sendmail when set to sendmail
or
Could not instantiate mail function. when set to PHPMail

After going mad trying to figure this out I realised that it is occurring after sending out a newsletter via acajoom.
Could this be a block by the host for number of emails sent?

Thanks in advance.


i_am_christine

Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Thu Dec 03, 2009 6:40 am

Re: Could not instantiate mail function

Post

by i_am_christine » Thu Dec 03, 2009 6:47 am

i’m pretty much new to joomla. i’m trying to have the email working on my local server, is that possible? what configuration should i use?
this is how im currently configured

Mailer : php mail function
Mail from: [email protected]
Sendmail Path: /usr/sbin/sendmail
SMTP Authentication: No
SMTP Security: none
SMTP Port : 25

i have tried some of the configurations above, but none of them work. i must have missed something.
big thanks :) this is going to be cool birthday gift..hehe..my birthday is on the 23th..thanks again


zvezda

Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Fri Jan 19, 2007 7:07 pm

Re: Could not instantiate mail function

Post

by zvezda » Thu Jan 21, 2010 10:13 am

Hey,
you should use same e-mail address in contacts as is you domain.com, than [email protected] and it works. At least with me.

cheers


visicom

Joomla! Apprentice
Joomla! Apprentice
Posts: 21
Joined: Tue Jan 12, 2010 2:17 pm

Re: Could not instantiate mail function

Post

by visicom » Thu Jan 21, 2010 2:06 pm

this is lame — no luck at all sending out email messages via smtp using joomla 1.5.

PHPMAILER_RECIPIENTS_FAILED


Tiadrin

Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Tue Jan 26, 2010 11:26 am

Re: Could not instantiate mail function

Post

by Tiadrin » Tue Jan 26, 2010 12:42 pm

Hey all,
im in quite a pinch here…
this is my situation.

im running on a localhost and for the site im making i need to get the mailserver working.

my current mail settings are

Mailer: PHP Mail Function
Mail from: [email protected] (note that the email does not yet excist due to the site being under devolopment, if there is some temporary solution, please tell me)
From name: sitename
Sendmail Path: /usr/sbin/sendmail (note, i cant actually find this path anywhere on my machine)
SMTP Authencation: no
SMTP Security: none
SMTP Port: 25
SMTP Username: root
SMTP password: joomla
SMTP host: localhost

this gives me the error:
Could not instantiate mail function.

none of the settings in the thread worked so far, can someone please help me?

im running on Windows7 using XAMPP and have command line 5 for MySQL server.

i really need this to get to work, many thanks in advance ^^


DutchPeer

Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Tue Jan 26, 2010 9:41 pm

Re: Could not instantiate mail function

Post

by DutchPeer » Tue Jan 26, 2010 9:48 pm

Hi people,

Actually, I haven’t got a clue on what this is all about. That is …

I tried to build up a form (jforms) about a month ago on one of my test-sites (subdomain in a hostin-environment). Encountered 0 problems, absolutely NONE. All email-sending was very much OK.

Now, on another subdomain, today, I got this message that has been mentioned above before: cannot instantiate …

Checked all settings on both the WORKING and the NOT WORKING site, but I cannot find ANY difference. Both are subdomains of the same domain, and one works, the other doesn’t.

The stupid thing is, filling the form, you can give your emailaddress. That’s the one that DOES get the message that all’s been sent … Very inconvenient.


DutchPeer

Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Tue Jan 26, 2010 9:41 pm

Re: Could not instantiate mail function

Post

by DutchPeer » Thu Jan 28, 2010 8:02 pm

Found out something more …

I am running on 1 hosting env. with 2 subdomains. 1 works (all mail sent) other doesn’t (only the one entering the form gets a confirmation, admin gest 0).

Dug into phpmailer.php and found out that $to is EMPTY when it builds up the email message wit @mail function. Replaced that with a FIXED emailaddres: works without any problem!

Don’t know what to do next, reported this as a possible bug.


hfhs72

Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Thu Aug 17, 2006 12:16 pm

Re: Could not instantiate mail function

Post

by hfhs72 » Fri Jan 29, 2010 9:19 pm

I have the same exact problem on a brand new install of 1.5.15. I’ve tried all 3 mail settings with the same results. It will send the copy email but not the «TO» email. Also, I am not getting a confirmation «Your mail has been sent» pop up message. Just blank boxes after pressing the Send button.


Jahmaica

Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Tue Feb 16, 2010 6:29 pm

Re: Could not instantiate mail function

Post

by Jahmaica » Tue Feb 16, 2010 6:31 pm

thanks a lot! i have set my global config mail settings to SMPT Server and it works now!


DutchPeer

Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Tue Jan 26, 2010 9:41 pm

Re: Could not instantiate mail function

Post

by DutchPeer » Tue Mar 02, 2010 8:07 pm

Back on the surface again. Posted the issue as abug. look for «Mail function(s) do not work».


iGalin

Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Fri Mar 12, 2010 7:54 am

Re: Could not instantiate mail function

Post

by iGalin » Mon Apr 26, 2010 9:10 pm

hello everyone,
I had the same problem as everyone else. here is my solution:
1. if you use hosting from BlueHost/HostMonster/FastDomain then go to «Email Delivery Route» under Mail section.
2. enter email that you have problem with and hit «Show Route»
3.1 if it shows «virtual_aliases via virtual_aliases router forced address failure» then go to step 4,
3.2. if it shows «mxi_mailproxy via AAA.BBB.CCC.DDD» then probably problem somewhere else and currently can’t offer suggestion there but still send me PM, I ll look into it.
4. Now what happens is server thinks that if he «owns» domain then MX records should be there too which in fact are not there. So go to «MX Entry» in CPanel under Mail section again.
5. Choose domain/add-on w/problem and add/edit MX Records.
I edited this way since I’m using google apps for email but website is on HostMonster:
Priority Destination Actions
10 aspmx.l.google.com Edit Delete
20 alt2.aspmx.l.google.com Edit Delete
6. Then go back to «Mail Delivery Route» and check if now it’s OK and then try on website.

Hope it helps.


DutchPeer

Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Tue Jan 26, 2010 9:41 pm

Re: Could not instantiate mail function

Post

by DutchPeer » Tue Apr 27, 2010 4:12 pm

I think your post more or less confirms my faint idea that this issue is related to running on either a subdomain or «straight from the root» of the site. The issue disappeared as I moved the site to its final destination, where it was placed in the root of course, of the selected domain.

Cheers

Peer


User avatar

holdenburg

Joomla! Apprentice
Joomla! Apprentice
Posts: 48
Joined: Sat Dec 10, 2005 11:56 pm
Location: West Palm Beach, Florida
Contact:

Re: Could not instantiate mail function

Post

by holdenburg » Tue Jul 06, 2010 6:17 pm

iGalin wrote:hello everyone,
I had the same problem as everyone else. here is my solution:
1. if you use hosting from BlueHost/HostMonster/FastDomain then go to «Email Delivery Route» under Mail section.
2. enter email that you have problem with and hit «Show Route»
3.1 if it shows «virtual_aliases via virtual_aliases router forced address failure» then go to step 4,
3.2. if it shows «mxi_mailproxy via AAA.BBB.CCC.DDD» then probably problem somewhere else and currently can’t offer suggestion there but still send me PM, I ll look into it.
4. Now what happens is server thinks that if he «owns» domain then MX records should be there too which in fact are not there. So go to «MX Entry» in CPanel under Mail section again.
5. Choose domain/add-on w/problem and add/edit MX Records.
I edited this way since I’m using google apps for email but website is on HostMonster:
Priority Destination Actions
10 aspmx.l.google.com Edit Delete
20 alt2.aspmx.l.google.com Edit Delete
6. Then go back to «Mail Delivery Route» and check if now it’s OK and then try on website.

Hope it helps.

Trying to follow this and I am on Bluehost. I went to C-Panel and opened the MX Records icon. Not seeing step 5 or I am not understanding. This makes sense about editing the Mx record but I don’t use G-Mail/Google — just trying to figure out what changed as PHP Mail worked up until awhile ago. I did change to legacy mode — wondering if this afected anything…
Still not working…


User avatar

holdenburg

Joomla! Apprentice
Joomla! Apprentice
Posts: 48
Joined: Sat Dec 10, 2005 11:56 pm
Location: West Palm Beach, Florida
Contact:

Re: Could not instantiate mail function

Post

by holdenburg » Tue Jul 06, 2010 6:23 pm

DutchPeer wrote:Found out something more …

I am running on 1 hosting env. with 2 subdomains. 1 works (all mail sent) other doesn’t (only the one entering the form gets a confirmation, admin gest 0).

Dug into phpmailer.php and found out that $to is EMPTY when it builds up the email message wit @mail function. Replaced that with a FIXED emailaddres: works without any problem!

Don’t know what to do next, reported this as a possible bug.

DP…

Will try editing the phpmailer.php
I am assuming you have the setting set on MailPHP function and this is a sub-domain?

thx..

H.


User avatar

bettsaj

Joomla! Apprentice
Joomla! Apprentice
Posts: 38
Joined: Fri Feb 13, 2009 10:17 am

Re: Could not instantiate mail function

Post

by bettsaj » Thu Jul 08, 2010 3:12 pm

I’m having the same issue, however my set up is a little different.

i’m running Joomla on my own web server. The machine is a Windows 2003 server loaded with EasyPHP, that is Apache, PHP & MySQL. Microsoft IIS is uninstalled.

Joomla works fine apart from the mail issue. Set the mail function to mailPHP and I get the dreaded «Could not instantiate mail function» error essage. When I set it to SMTP and enter my email hosts details it works when entering a new user from the backend, but fails on the contacts form with the «PHPMAILER_RECIPIENTS_FAILED» error.

Any ideas chaps what may be the cure for this horrid issue. It would appear that the contacts form is trying to use the mailPHP function by default even though it’s been changed in the Global configurations page…. Anyway of changing this to the SMTP method?


User avatar

holdenburg

Joomla! Apprentice
Joomla! Apprentice
Posts: 48
Joined: Sat Dec 10, 2005 11:56 pm
Location: West Palm Beach, Florida
Contact:

Re: Could not instantiate mail function

Post

by holdenburg » Fri Jul 09, 2010 4:17 am

UPDATE

I wanted to let everyone know I was finally able to setup and get the the smtp function working…

After further investigation I can tell everyone that if you have users in your DB and their email addresses are bad you have to single out these users and either correct their addresses or remove them. It is a show stopper using SMTP. I don’t understand why but if you use Mass Mail and SMTP function you have to have all good email addresses.

Also, it appears that by importing a user DB table this can cause some issues. There was an Admin email address that SMTP started also failing on after I corrected the bad user email addresses and I resetup this email address in C-Panel and the SMTP function started working.

There was mention of this in earlier threads but it is difficult to define. Once you realize this and add the user hopefully this will get the smtp mail engine going again. It sounds simple about adding the same users in C-panel but in this case SMTP was looking for an address that did not exist. I am thinking it may have had something to do with importing tables from my previous DB? I don’t know how else to explain this on new clean installs. I did import content and user DB so I still don’t know how this address suddenly was a requirement. It was an older admin email address I used to use yet when looking at the addresses in the user db I did not grasp this issue.

Good luck…

H.


joom newbie

Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Thu Feb 03, 2011 12:29 pm

Re: Could not instantiate mail function

Post

by joom newbie » Thu Feb 03, 2011 1:25 pm

Hi everyone… im desperately in need of some help! :(

I have created a Joomla website and using a wampserver so it is hosted locally. However, I do intend in changing over to a hosting provider..but just taking one technical challenge at a time!! :'(

Ok so I have spent literally WEEKS trying find out how to configure the mail settings correctly, to no avail.

If I change to Mailer: PHP I get the following error:
Could not instantiate mail function
Could not instantiate mail function

IF i Change to Mailer: Sendmail I get this error:
PHPMAILER_EXECUTE/usr/sbin/sendmail

and if I Change to Mailer: SMTP Server, I get the following error:
SMTP Error! Could not connect to SMTP host.
SMTP Error! Could not connect to SMTP host.

At the end of each of these errors, the following message is also displayed:
Message
Your account has been created and an activation link has been sent to the e-mail address you entered. Note that you must activate the account by clicking on the activation link when you get the e-mail before you can login.

I havent a clue what to do.. But im so frustrated that Im tempted to just scrap joomla…even though I have actually put months of work into it!!

I dont have a great understanding of joomla in general, but I have read forums and websites till im blue in the face!

PLEASE Someone help me!!!! I will be eternally grateful (yes that much!)


Kalaiyappan

Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Fri Jun 03, 2011 2:34 am

Re: Could not instantiate mail function

Post

by Kalaiyappan » Tue Jun 28, 2011 6:16 am

Hi,
Initially i had a problem of PHPMAILER_EXECUTE usr/sbin/sendmail on using PHP MAIL FUnction, i then solved it by changing it to SMTP SERVER.I came to know this seeing this forum,so thanks to all who helped me in knowing this info.

NOW I am trying to send mails from mass mail,as well as lyftenbloggie component to users.When i click send I am getting a notification that mails are sent in both lyftenbloggie and mass mail but, surprisingly i have not received any mails in the inbox.Please help.My server settings were

MailFunction: SMTP Server
Sendmailpath: /usr/sbin/sendmail
SMTP port: 25
SMTP username and Password is empty
SMTP host: localhost.

I thought that username and password and HOST would be required and i gave those attributes after which i get these error messages in global configuration

JFTP::login: Unable to login
JClientHelper::setCredentialsFromRequest failed

could anyone please help me in this so that i can send mails from the site and eliminate the error messages??? :(

I find that conversations held here are very old,i do have a belief that someone will reply to my new post as i am newbee in joomla.Kindly help. ??? ???



Return to “Administration 1.5”


Jump to

  • Joomla! Announcements
  • ↳   Announcements
  • ↳   Announcements Discussions
  • Joomla! 4.x — Ask Support Questions Here
  • ↳   General Questions/New to Joomla! 4.x
  • ↳   Installation Joomla! 4.x
  • ↳   Administration Joomla! 4.x
  • ↳   Migrating and Upgrading to Joomla! 4.x
  • ↳   Extensions for Joomla! 4.x
  • ↳   Security in Joomla! 4.x
  • ↳   Templates for Joomla! 4.x
  • ↳   Search Engine Optimization (Joomla! SEO) in Joomla! 4.x
  • ↳   Language — Joomla! 4.x
  • ↳   Performance — Joomla! 4.x
  • ↳   Joomla! 4.x Coding
  • Joomla! 3.x — Ask Support Questions Here
  • ↳   General Questions/New to Joomla! 3.x
  • ↳   Installation Joomla! 3.x
  • ↳   Joomla! 3.x on IIS webserver
  • ↳   Administration Joomla! 3.x
  • ↳   Access Control List (ACL) in Joomla! 3.x
  • ↳   Migrating and Upgrading to Joomla! 3.x
  • ↳   Security in Joomla! 3.x
  • ↳   Extensions for Joomla! 3.x
  • ↳   Templates for Joomla! 3.x
  • ↳   Search Engine Optimization (Joomla! SEO) in Joomla! 3.x
  • ↳   Language — Joomla! 3.x
  • ↳   Performance — Joomla! 3.x
  • ↳   Joomla! 3.x Coding
  • Joomla! Versions which are End of Life
  • ↳   Joomla! 2.5 — End of Life 31 Dec 2014
  • ↳   General Questions/New to Joomla! 2.5
  • ↳   Installation Joomla! 2.5
  • ↳   Joomla! 2.5 on IIS webserver
  • ↳   Administration Joomla! 2.5
  • ↳   Access Control List (ACL) in Joomla! 2.5
  • ↳   Migrating and Upgrading to Joomla! 2.5
  • ↳   Security in Joomla! 2.5
  • ↳   Extensions for Joomla! 2.5
  • ↳   Templates for Joomla! 2.5
  • ↳   Search Engine Optimization (Joomla! SEO) in Joomla! 2.5
  • ↳   Language — Joomla! 2.5
  • ↳   Performance — Joomla! 2.5
  • ↳   Joomla! 1.5 — End of Life Sep 2012
  • ↳   General Questions/New to Joomla! 1.5
  • ↳   Installation 1.5
  • ↳   Joomla! 1.5 on IIS webserver
  • ↳   Administration 1.5
  • ↳   Migrating and Upgrading to Joomla! 1.5
  • ↳   Security in Joomla! 1.5
  • ↳   Extensions for Joomla! 1.5
  • ↳   Templates for Joomla! 1.5
  • ↳   Search Engine Optimization (Joomla! SEO) in Joomla! 1.5
  • ↳   Language — Joomla! 1.5
  • ↳   Performance — Joomla! 1.5
  • ↳   Joomla! 1.0 — End of Life 22 July 2009
  • ↳   Installation — 1.0.x
  • ↳   Upgrading — 1.0.x
  • ↳   Security — 1.0.x
  • ↳   3rd Party/Non Joomla! Security Issues
  • ↳   Administration — 1.0.x
  • ↳   Extensions — 1.0.x
  • ↳   Components
  • ↳   Modules
  • ↳   Plugins/Mambots
  • ↳   WYSIWYG Editors — 1.0.x
  • ↳   Integration & Bridges — 1.0.x
  • ↳   phpbb — Joomla! Integration
  • ↳   Templates & CSS — 1.0.x
  • ↳   Language — 1.0.x
  • ↳   Joom!Fish and Multilingual Sites
  • ↳   Performance — 1.0.x
  • ↳   General Questions — 1.0.x
  • Joomla! International Language Support
  • ↳   International Zone
  • ↳   Arabic Forum
  • ↳   تنبيهات هامة
  • ↳   الدروس
  • ↳   4.x جوملا!
  • ↳   جوملا! 1.6/1.7
  • ↳   الأسئلة الشائعة
  • ↳   التثبيت و الترقية
  • ↳   الحماية — و تحسين السرعة والأداء
  • ↳   لوحة التحكم
  • ↳   الإضافات البرمجية
  • ↳   تعريب جوملا! و الإضافات البرمجية
  • ↳   القوالب و التصميم
  • ↳   صداقة محركات البحث
  • ↳   القسم العام
  • ↳   1.5 !جوملا
  • ↳   الأسئلة الشائعة
  • ↳   التثبيت و الترقية
  • ↳   الحماية — و تحسين السرعة والأداء
  • ↳   لوحة التحكم
  • ↳   الإضافات البرمجية
  • ↳   تعريب جوملا! و الإضافات البرمجية
  • ↳   القوالب و التصميم
  • ↳   صداقة محركات البحث
  • ↳   القسم العام
  • ↳   جوملا! 1.0
  • ↳   الأسئلة الشائـعة
  • ↳   التثبيت
  • ↳   لوحة التحكم
  • ↳   الإضافات البرمجية
  • ↳   الإضافات المعرّبة
  • ↳   القوالب و التصميم
  • ↳   الحماية — تحسين السرعة والأداء — صداقة محركات البحث
  • ↳   القسم العام
  • ↳   القسم العام
  • ↳   !عرض موقعك بجوملا
  • ↳   الأرشيف
  • ↳   Bengali Forum
  • ↳   Bosnian Forum
  • ↳   Joomla! 1.5
  • ↳   Instalacija i prvi koraci
  • ↳   Ekstenzije
  • ↳   Templejti
  • ↳   Moduli
  • ↳   Prevodi i dokumentacija
  • ↳   Joomla! 1.7 / Joomla! 1.6
  • ↳   Catalan Forum
  • ↳   Notícies
  • ↳   Temes sobre l’administració
  • ↳   Temes sobre la traducció
  • ↳   Components, mòduls i joombots
  • ↳   Temes de disseny
  • ↳   Webs realitzades amb Joomla!
  • ↳   Offtopics
  • ↳   Chinese Forum
  • ↳   Croatian Forum
  • ↳   Danish Forum
  • ↳   Meddelelser
  • ↳   Joomla! 4.x
  • ↳   Joomla! 3.x (Anbefalet til nye installationer. Nyeste funktionalitet)
  • ↳   Installation, backup, opdatering og flytning — Godt igang
  • ↳   Administration — Generel brug
  • ↳   Komponenter, Moduler og Plugins
  • ↳   Template, CSS og Design
  • ↳   Nethandel, betaling m.m.
  • ↳   Ældre versioner (disse vedligeholdes ikke længere fra officiel side)
  • ↳   Joomla! 2.5 (Supporteres indtil 31. dec. 2014)
  • ↳   Installation, backup, opdatering og flytning — Godt igang
  • ↳   Administration — Generel brug
  • ↳   Komponenter, Moduler og Plugins
  • ↳   Template, CSS og Design
  • ↳   Nethandel, betaling m.m.
  • ↳   Joomla 1.5 (Tidligere langtidssupporteret version indtil sep. 2012)
  • ↳   Installation, backup, opdatering og flytning — Godt igang
  • ↳   Administration — Generel brug
  • ↳   Komponenter, Moduler og Plugins
  • ↳   Template, CSS og Design
  • ↳   Nethandel, betaling m.m.
  • ↳   Joomla 1.0 (Udgået version, der blev afløst af 1.5 i 2008)
  • ↳   Installation, backup, opdatering og flytning — Godt igang
  • ↳   Administration — Generel brug
  • ↳   Komponenter, Moduler og Mambots
  • ↳   Template, CSS og Design
  • ↳   Nethandel, betaling m.m.
  • ↳   Oversættelser (lokalisering)
  • ↳   Joomla brugergrupper i Danmark
  • ↳   JUG Kolding
  • ↳   JUG København
  • ↳   JUG Odense
  • ↳   JUG Århus
  • ↳   JUG Sorø
  • ↳   Kommerciel (betalt) hjælp ønskes
  • ↳   SEO
  • ↳   FAQ — Dokumentation og vejledninger
  • ↳   Vis dit websted
  • ↳   Afviste ‘Vis dit websted’ indlæg
  • ↳   Diverse (Off topic)
  • ↳   Dutch Forum
  • ↳   Aankondigingen
  • ↳   Algemene vragen
  • ↳   Joomla! 4.x
  • ↳   Joomla! 3.x
  • ↳   Installatie 3.x
  • ↳   Extensies 3.x
  • ↳   Templates 3.x
  • ↳   Joomla! 2.5
  • ↳   Installatie 2.5
  • ↳   Componenten 2.5
  • ↳   Modules 2.5
  • ↳   Plugins 2.5
  • ↳   Templates 2.5
  • ↳   Joomla! 1.5
  • ↳   Installatie
  • ↳   Componenten
  • ↳   Modules
  • ↳   Plugins
  • ↳   Templates
  • ↳   Joomla! 1.0
  • ↳   Installatie 1.0.x
  • ↳   Componenten 1.0.x
  • ↳   Modules 1.0.x
  • ↳   Mambots 1.0.x
  • ↳   Templates 1.0.x
  • ↳   Vertalingen
  • ↳   Offtopic
  • ↳   Show jouw website
  • ↳   Filipino Forum
  • ↳   International Support Center
  • ↳   Pinoy General Discussion & Archives
  • ↳   Site Showcase
  • ↳   Events
  • ↳   Design Tips and Tricks
  • ↳   Tsismis Zone
  • ↳   Pinoy Translation Zone
  • ↳   Pinoy Forum Archives
  • ↳   Joomla! Philippines Local Forum www.joomla.org.ph
  • ↳   Finnish Forum
  • ↳   French Forum
  • ↳   Les annonces!
  • ↳   Le bistrot!
  • ↳   L’expo!
  • ↳   J! 4.x — L’atelier!
  • ↳   J! 3.x — L’atelier!
  • ↳   3.x — Questions générales, nouvel utilisateur
  • ↳   3.x — Installation, migration et mise à jour
  • ↳   3.x — Sécurité et performances
  • ↳   3.x — Extensions tierce partie
  • ↳   3.x — Templates et design
  • ↳   3.x — Développement
  • ↳   3.x — Ressources
  • ↳   J! 2.5.x — L’atelier!
  • ↳   2.5 — Questions générales
  • ↳   2.5 — Installation, migration et mise à jour
  • ↳   2.5 — Sécurité et performances
  • ↳   2.5 — Extensions tierce partie
  • ↳   2.5 — Templates et design
  • ↳   2.5 — Développement
  • ↳   2.5 — Ressources
  • ↳   J! 1.5.x — L’atelier!
  • ↳   1.5 — Questions générales
  • ↳   1.5 — Installation, migration et mise à jour
  • ↳   1.5 — Sécurité et performances
  • ↳   1.5 — Extensions tierce partie
  • ↳   1.5 — Templates et design
  • ↳   1.5 — Développement
  • ↳   1.5 — Ressources
  • ↳   J! 1.0.x — L’atelier!
  • ↳   1.0 — Questions générales
  • ↳   1.0 — Installation et mise à jour
  • ↳   1.0 — Sécurité
  • ↳   1.0 — Extensions tierce partie
  • ↳   1.0 — Templates et design
  • ↳   1.0 — Développement
  • ↳   1.0 — Ressources
  • ↳   Besoin d’un professionel ?
  • ↳   Extensions Open Source pour Joomla!
  • ↳   German Forum
  • ↳   Ankündigungen
  • ↳   Joomla! 4.x
  • ↳   Joomla! 3.x
  • ↳   Allgemeine Fragen
  • ↳   Installation und erste Schritte
  • ↳   Komponenten, Module, Plugins
  • ↳   Template, CSS und Designfragen
  • ↳   Entwicklerforum
  • ↳   Zeige Deine Webseite
  • ↳   Joomla! 2.5
  • ↳   Allgemeine Fragen
  • ↳   Installation und erste Schritte
  • ↳   Komponenten, Module, Plugins
  • ↳   Template, CSS und Designfragen
  • ↳   Entwicklerforum
  • ↳   Zeige Deine Webseite
  • ↳   Joomla! 1.5
  • ↳   Allgemeine Fragen
  • ↳   Installation und erste Schritte
  • ↳   Komponenten, Module, Plugins
  • ↳   Template, CSS und Designfragen
  • ↳   Entwicklerforum
  • ↳   Zeige Deine Webseite
  • ↳   Professioneller Service
  • ↳   Sonstiges (Offtopic)
  • ↳   Archiv
  • ↳   Joomla! 1.0
  • ↳   Allgemeine Fragen 1.0.x
  • ↳   Installation und erste Schritte 1.0.x
  • ↳   Komponenten, Module, Mambots 1.0.x
  • ↳   Template, CSS und Designfragen 1.0.x
  • ↳   Entwicklerforum 1.0.x
  • ↳   Zeige Deine Webseite 1.0.x
  • ↳   Greek Forum
  • ↳   Joomla! 4.x
  • ↳   Joomla! 3.x
  • ↳   Joomla! 2.5.x
  • ↳   Joomla! 1.5.x
  • ↳   Joomla! 1.0.x
  • ↳   Hebrew Forum
  • ↳   Indic Languages Forum
  • ↳   Indonesian Forum
  • ↳   FAQ
  • ↳   Bantuan
  • ↳   Komponen
  • ↳   Modul
  • ↳   Template
  • ↳   Diskusi
  • ↳   Italian Forum
  • ↳   Guide
  • ↳   Traduzioni
  • ↳   Componenti — Moduli — Plugins
  • ↳   Template — Grafica
  • ↳   Notizie
  • ↳   Prodotti Open Source per Joomla!
  • ↳   Richieste professionali
  • ↳   Joomla! 4.x
  • ↳   Joomla! 3.x
  • ↳   Joomla! 2.5.x
  • ↳   Joomla! 1.x
  • ↳   Latvian Forum
  • ↳   Lithuanian Forum
  • ↳   Joomla! 4.x
  • ↳   Joomla! 1.5
  • ↳   Joomla! 1.7 / Joomla! 1.6
  • ↳   Joomla! 1.0
  • ↳   Vertimai ir Kalba
  • ↳   Malaysian Forum
  • ↳   Solved
  • ↳   Norwegian Forum
  • ↳   Informasjon
  • ↳   Arkiverte annonseringer
  • ↳   FAQ — Ofte spurte spørsmål
  • ↳   Arkiv
  • ↳   Joomla! 4.x
  • ↳   Joomla! 3.x
  • ↳   Administrasjon/installasjon
  • ↳   Migrering/Oppdatering
  • ↳   Template, CSS og design
  • ↳   Komponenter/moduler/programutvidelser
  • ↳   Sikkerhet
  • ↳   Generelt
  • ↳   Netthandel, betaling m.m.
  • ↳   VirtueMart
  • ↳   Andre nettbutikkløsninger
  • ↳   Generelt
  • ↳   Oversettelser
  • ↳   Fremvisning av sider (Show off)
  • ↳   Avviste fremvisninger
  • ↳   Diverse (off topic)
  • ↳   Kommersiell hjelp ønskes
  • ↳   Eldre versjoner av Joomla!
  • ↳   Joomla! 1.0
  • ↳   Administrasjon/installasjon
  • ↳   Template, CSS og design
  • ↳   Komponenter/moduler/mambots
  • ↳   Sikkerhet
  • ↳   Generelt
  • ↳   Joomla! 1.5
  • ↳   Administrasjon/installasjon
  • ↳   Migrering/Oppdatering
  • ↳   Template, CSS og design
  • ↳   Komponenter/moduler/programutvidelser
  • ↳   Sikkerhet
  • ↳   Generelt
  • ↳   Joomla! 2.5
  • ↳   Administrasjon/installasjon
  • ↳   Migrering/Oppdatering
  • ↳   Template, CSS og design
  • ↳   Komponenter/moduler/programutvidelser
  • ↳   Sikkerhet
  • ↳   Generelt
  • ↳   Persian Forum
  • ↳   قالب ها
  • ↳   مدیریت
  • ↳   سوالهای عمومی
  • ↳   نصب
  • ↳   مامبوت ها
  • ↳   ماژولها
  • ↳   کامپوننت ها
  • ↳   Polish Forum
  • ↳   Instalacja i aktualizacja
  • ↳   Administracja
  • ↳   Komponenty, moduły, wtyczki
  • ↳   Szablony
  • ↳   Paczta i Podziwiajta
  • ↳   Modyfikacje i własne rozwiązania
  • ↳   Tłumaczenia
  • ↳   FAQ
  • ↳   Tips&Tricks
  • ↳   Dokumentacja
  • ↳   Profesjonalne usługi
  • ↳   Portuguese Forum
  • ↳   Componentes, módulos e mambots
  • ↳   Programação e desenvolvimento
  • ↳   Segurança
  • ↳   Sites dos usuários
  • ↳   Off-topic
  • ↳   Tradução
  • ↳   Templates
  • ↳   Romanian Forum
  • ↳   Traduceri
  • ↳   Russian Forum
  • ↳   Объявления по Joomla!
  • ↳   Безопасность Joomla!
  • ↳   Joomla 4.x — Задайте здесь свой вопрос по поддержке
  • ↳   Joomla 3.x — Задайте здесь свой вопрос по поддержке
  • ↳   Общие вопросы/Новичок в Joomla! 3.x
  • ↳   Установка Joomla! 3.x
  • ↳   Миграция и переход на Joomla! 3.x
  • ↳   Расширения для Joomla! 3.x
  • ↳   Многоязычные веб-сайты на Joomla 3.x
  • ↳   Joomla 2.5 — Задайте здесь свой вопрос по поддержке
  • ↳   Общие вопросы/Новичок в Joomla! 2.5
  • ↳   Установка Joomla! 2.5
  • ↳   Расширения для Joomla! 2.5
  • ↳   Русский язык Joomla! 2.5
  • ↳   Serbian/Montenegrin Forum
  • ↳   Tehnička pitanja
  • ↳   Instalacija i početnička pitanja
  • ↳   Šabloni
  • ↳   Prevod i dokumentacija
  • ↳   Ćaskanje
  • ↳   Bezbednost
  • ↳   Joomla! dodaci
  • ↳   Pravna pitanja
  • ↳   Arhiva
  • ↳   Joomla! Događaji i Zajednica
  • ↳   Izlog (spisak) sajtova radjenih u Joomla! CMS-u
  • ↳   Profesionalne usluge
  • ↳   Slovak Forum
  • ↳   Spanish Forum
  • ↳   Joomla! 4.x
  • ↳   Joomla! 3.x
  • ↳   Migración y actualización a Joomla 3.x
  • ↳   Versiones de Joomla! obsoletas
  • ↳   Joomla! 2.5
  • ↳   Joomla! 1.5
  • ↳   Extensiones
  • ↳   Plantillas (templates) y diseño
  • ↳   Idioma y traducciones
  • ↳   SEO para Joomla!
  • ↳   Seguridad y rendimiento
  • ↳   Productos de Código Abierto para Joomla!
  • ↳   Servicios profesionales
  • ↳   Salón de la comunidad Ñ
  • ↳   Swedish Forum
  • ↳   Meddelanden
  • ↳   Forum Joomla! 4.x
  • ↳   Forum Joomla! 3.x
  • ↳   Allmänna frågor
  • ↳   Användning och administration
  • ↳   Installation, backup och säkerhet
  • ↳   Komponenter, moduler och plugin
  • ↳   Mallar (templates) och design
  • ↳   Äldre versioner
  • ↳   Forum Joomla! 1.0
  • ↳   Allmänna frågor
  • ↳   Användning och administration
  • ↳   Installation, backup och säkerhet
  • ↳   Komponenter, moduler och Mambots
  • ↳   Mallar (templates) och design
  • ↳   Forum Joomla! 1.7 / Joomla! 1.6
  • ↳   Allmänna frågor
  • ↳   Användning och administration
  • ↳   Installation, backup och säkerhet
  • ↳   Komponenter, moduler och plugin
  • ↳   Mallar (templates) och design
  • ↳   Forum Joomla! 1.5
  • ↳   Allmänna frågor
  • ↳   Användning och administration
  • ↳   Installation, backup och säkerhet
  • ↳   Komponenter, moduler och plugin
  • ↳   Mallar (templates) och design
  • ↳   Forum Joomla! 2.5
  • ↳   Allmänna frågor
  • ↳   Användning och administration
  • ↳   Installation, backup och säkerhet
  • ↳   Komponenter, moduler och plugin
  • ↳   Mallar (templates) och design
  • ↳   Översättning
  • ↳   Webbplatser gjorda i Joomla
  • ↳   Webbplatser J! 3.x
  • ↳   Webbplatser J! 2.5
  • ↳   Webbplatser Joomla! 1.7 / Joomla! 1.6
  • ↳   Webbplatser J! 1.5
  • ↳   Webbplatser J! 1.0
  • ↳   Kommersiell hjälp önskas
  • ↳   Diverse (off topic)
  • ↳   Tamil Forum
  • ↳   Thai Forum
  • ↳   โชว์เว็บไซต์ของคุณที่สร้างด้วยจูมล่า
  • ↳   เคล็ดลับการใช้งานส่วนต่างๆ เกี่ยวกับจ&#
  • ↳   คอมโพเน้นท์ โมดูล ปลักอิน ต่างๆ ที่ติดตั
  • ↳   อับเดดข่าวสารเกี่ยวกับจูมล่าลายไทย
  • ↳   Turkish Forum
  • ↳   Duyurular
  • ↳   Dersler
  • ↳   Genel Sorular
  • ↳   Bileşen, Modül, Bot
  • ↳   Eklenti Haberleri
  • ↳   Temalar
  • ↳   Vietnamese Forum
  • ↳   Gặp gỡ và giao lưu
  • ↳   Joomla Tiếng Việt
  • ↳   Cài đặt — Cấu hình
  • ↳   Thành phần mở rộng cho Joomla!
  • ↳   Hỏi đáp Joomla! 3.x
  • ↳   Hỏi đáp Joomla! 2.5
  • ↳   Hỗ trợ kỹ thuật
  • ↳   Bài viết cũ
  • ↳   Thiết kế Template
  • ↳   Joomla! 1.5
  • ↳   Hỏi đáp Joomla! 4.x
  • ↳   Welsh Forum
  • Other Forums
  • ↳   Open Source Products for Joomla!
  • ↳   The Lounge
  • ↳   Forum Post Assistant (FPA)
  • Joomla! Development Forums
  • Joomla! Official Sites & Infrastructure
  • ↳   docs.joomla.org — Feedback/Information
  • ↳   extensions.joomla.org — Feedback/Information
  • ↳   joomla.com — Feedback/Information
  • ↳   Sites & Infrastructure — Feedback/Information
  • ↳   Archived Boards — All boards closed
  • ↳   Design and Accessibility — Archived
  • ↳   Quality and Testing — Locked and Archived
  • ↳   Joomla! 1.0.x_Q&T
  • ↳   Q&T 1.0.x Resolved
  • ↳   Known Issues
  • ↳   Superseded Issues
  • ↳   Archive
  • ↳   Q&T 1.0.x Resolved — Archived
  • ↳   Known Issues — Archive
  • ↳   Superseded Issues — Archive
  • ↳   Joomla! 3.x Bug Reporting
  • ↳   Third Party Testing for Joomla! 1.5
  • ↳   Q&T 1.5.x Resolved
  • ↳   Joomla! 1.5 BETA
  • ↳   Joomla! 1.5 BETA 2
  • ↳   Reaction to the ‘Letter to the community’
  • ↳   Reaction to New Project Name
  • ↳   Logo Competition
  • ↳   Humor, Fun and Games
  • ↳   Libraries
  • ↳   patTemplate
  • ↳   com_connector — Multi Joomla Bridge
  • ↳   CiviCRM Support
  • ↳   CiviCRM Installation Issues
  • ↳   FAQ Archive
  • ↳   FAQ Discussion Board
  • ↳   3rd Party Extensions FAQ
  • ↳   FAQs not moved
  • ↳   3rd Party/Non Joomla! Security FAQ
  • ↳   Joomla! Coding 101
  • ↳   Joombie Tools of the Trade
  • ↳   Joombie Coding Q/A
  • ↳   Joombie Think Tank
  • ↳   Joombie Developer Lab
  • ↳   Joomla Forge — Archived
  • ↳   Non-Profit Organizations and Joomla!
  • ↳   Schools and Universities
  • ↳   Bangsamoro Forum
  • ↳   Joomla! 1.5 Template Contest
  • ↳   SMF — Simplemachines.org Forum
  • ↳   GPL Discussion
  • ↳   Security Announcements — Old
  • ↳   Tips & Tricks — Moving
  • ↳   Submit Your Suggested Tips & Tricks to Docs.joomla.org now please.
  • ↳   Google Summer of Code and GHOP
  • ↳   Google Summer of Code 2008
  • ↳   Proposed projects
  • ↳   Student area
  • ↳   Past Google Summer of Code Editions
  • ↳   Google’s Highly Open Participation Contest
  • ↳   Documentation
  • ↳   Suggestions, Modifications, and Corrections
  • ↳   Archive
  • ↳   1.5 Archive
  • ↳   Suggestions, Modifications & Corrections
  • ↳   Submit
  • ↳   Feedback and Suggestions
  • ↳   Applications for participation in the Development Workgroup
  • ↳   Development
  • ↳   1.5 Site Showcase — Archived
  • ↳   1.0 x Site Showcase — Archived.
  • ↳   Feature Requests — White Papers — Archived
  • ↳   Under Review — Archived
  • ↳   Accepted — Archived
  • ↳   Not Accepted — Archived
  • ↳   Wishlists and Feature Requests — Archive
  • ↳   Wishlist Archives — Archived
  • ↳   Spanish Forum — Archive
  • ↳   Papelera
  • ↳   Tutoriales
  • ↳   General
  • ↳   Salón de la Joomlaesfera hispanohablante
  • ↳   Danish Forum — Archive
  • ↳   Diskussion af Meddelelser + Sikkerhedsmeddelelser + FAQ
  • ↳   Shop.Joomla.org
  • ↳   Joomla! 1.6 RC Support [closed]
  • ↳   Joomla! 1.0 Coding
  • ↳   Core Hacks and Patches
  • ↳   Joomla! 2.5 Beta Support
  • ↳   People.joomla.org — Feedback/Information
  • ↳   Joomla! 1.5 Bug Reporting
  • ↳   Joomla! 1.5 Coding
  • ↳   Joomla! 3 Beta Support
  • ↳   Trending Topics
  • ↳   Help wanted in the community
  • ↳   templates.joomla.org — Feedback/Information
  • ↳   Certification
  • ↳   Albanian Forum
  • ↳   Azeri Forum
  • ↳   Urdu Forum
  • ↳   Basque Forum
  • ↳   Itzulpenaren inguruan
  • ↳   Laguntza teknikoa
  • ↳   Belarusian Forum
  • ↳   Maltese Forum
  • ↳   Hungarian Forum
  • ↳   Slovenian Forum
  • ↳   Japanese Forum
  • ↳   Khmer Forum
  • ↳   ពិពណ៌​ស្ថាន​បណ្ដាញ​ជុំឡា
  • ↳   ជុំឡា​ខ្មែរ​មូលដ្ឋានីយកម្ម
  • ↳   Community Blog Discussions
  • ↳   JoomlaCode.org
  • ↳   Joomla! Marketing and PR Team
  • ↳   resources.joomla.org — Feedback/Information
  • ↳   Training.Joomla.org
  • ↳   OpenSourceMatters.org
  • ↳   magazine.joomla.org — Feedback/Information
  • ↳   Site Showcase
  • ↳   Joomla! 4 Related
  • ↳   Joomla! Events
  • ↳   Joomla! Ideas Forum
  • ↳   Registered Joomla! User Groups
  • ↳   Joomla! 2.5 Coding
  • ↳   Joomla! 2.5 Bug Reporting
  • ↳   User eXperience (UX)
  • ↳   Joomla! Working Groups
  • ↳   Translations

joomla-3-email-errors

If your Joomla server does not support the php mail() function and Joomla attempts to send an email (such as a new user registration email), any of the following message may appear:

  • Could not instantiate mail function.
  • The mail() function has been disabled and the mail cannot be sent.
  • Registration failed: An error was encountered while sending the registration email. A message has been sent to the administrator of this site.

Not all servers support the php mail function, and if your Joomla hosting provider does not, you’re still in luck. To prevent the above error and to setup Joomla to be able to send email successfully, we have to adjust Joomla’s email settings. Besides the php mail function, Joomla 3.0 can use Sendmail or SMTP. In this tutorial, we are going to walk you through the steps for setting up SMTP with Joomla 3.0

Configuring Joomla 3.0 to send emails using SMTP:

  1. Configure your sending email account

    When emailing using SMTP, we are also going to setup SMTP Authentication. What this means is that we are going to setup Joomla to log into the server using a username and password, and then send email as that user. SMTP Authentication is much like using Microsoft Outlook or Mozilla Thunderbird: you enter your email settings, a password, and then you can use that email account.

    Creating email accounts is not the same on each hosting provider. If you use InMotion Hosting or use cPanel, click here to learn how to create an email address. Otherwise, you should contact your hosting provider for more help with setting up a new email account.

    Be sure to keep track of the email account and password that you use. In our testing, we created [email protected].

  2. Log into your Joomla 3.0 admin dashboard
  3. In the left menu, click the Global Configuration link
  4. In the tabs at the top of the page, click the Server tab
  5. In the right column, find the Mail Settings. Update the settings as we describe below, and then click the Save button in the top left of the page.
    Mailer Select SMTP
    From Email Enter the email address you created in step 1 above. In our testing, we entered [email protected]
    From Name Enter your name or the name of your website. In our testing, we entered Best Website Ever
    SendMail path Generally you can leave this setting alone
    SMTP Authentication Set SMTP Authentication to Yes
    SMTP Security If you want to send email, you may need to contact your hosting provider for the necessary settings. In our testing, set Security to SSL.
    SMTP Port As we are using SSL (see the setting above), we are setting the port to 465. Again, you may need to contact your joomla host for the correct settings.
    SMTP Username Enter the username of the email address you created in step 1.
    SMTP Password Enter the password of the email address you created in step 1.
    SMTP Host Most often, your STMP Host will be localhost. If you have any doubts, be sure you contact your joomla hosting provider for clarification.

    You can see in the screenshot below how the settings looked when we saved them in Joomla 3.0. We then signed up as a new user within our Joomla 3.0 website, and you can see how some of the SMTP settings we configured (such as From email and From Name) show up in our email client.

    SMTP Settings Within Joomla 3.0 An email sent by Joomla with our new SMTP Settings
    joomla-3.0-smtp-mail-settings email-sent-to-yahoo


Joomla’s contact forms use a third-party software called PHPMailer which can be found in libraries/phpmailer/phpmailer.php.

In most hosting environments this works fine, but on some special installations, namely servers which use mini_sendmail instead of sendmail, all contact forms (and other components which need to send e-mails) won’t work.

The following error is shown when trying to send an e-mail with a contact form in Joomla (tested with 2.5.6):

Could not instantiate mail function. (in English)

Mail-Funktion konnte nicht initialisiert werden! (in German)

To debug it, it was necessary to use a standalone PHPMailer script (without Joomla). Fortunately, PHPMailer comes with some handy examples. In my case I re-used test_mail_basic.php.

But as soon as I launched test_mail_basic.php in the browser, this similar error message showed up (which is the same error message also shown in Joomla):

Mailer Error: Could not instantiate mail function.

After a lot of debugging I came across the params which are set in the file class.phpmailer.php:

  protected function MailSend($header, $body) {

    $toArr = array();

    foreach($this->to as $t) {

      $toArr[] = $this->AddrFormat($t);

    }

    $to = implode(‘, ‘, $toArr);

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

      $params = «-oi «;

    } else {

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

    }

And this is actually the big problem: The parameters (-oi / -oi -f) are added at the end of the @mail() command but this would only work if the sendmail binary (declared in php.ini under sendmail_path) is actually sendmail, and not anything else. mini_sendmail does not know how to handle these parameters and will therefore fail, causing PHPMailer to throw the «instantiate» error.

The following workaround allows to use PHPMailer with mini_sendmail. Just comment-out the $params definitions in the source code:

  protected function MailSend($header, $body) {

    $toArr = array();

    foreach($this->to as $t) {

      $toArr[] = $this->AddrFormat($t);

    }

    $to = implode(‘, ‘, $toArr);

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

      //$params = «-oi «;

    } else {

      //$params = sprintf(«-oi -f %s», $this->Sender);

    }

As soon as these lines were commented-out, the mail was sent and the following output confirmed it: Message sent!

As of the current version 2.5.6, Joomla is using PHPMailer in version 5.2.1. I’ll report the bug and hopefully there will be a patch.

Once a patch has been released, I hope that the Joomla developers will then rapidly include the newer PHPMailer version in a new Joomla-release.

Update August 2nd 2012: The ‘mini_sendmail bug’ has been fixed in the current trunk version of phpmailer. I can confirm it’s working. It’s now up to the Joomla people to include a newer phpmailer version.

Add a comment

Show form to leave a comment

Comments (newest first)

No comments yet.

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:

  1. Server settings

  2. 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:

 <? $headers = 'From:[email protected]'; mail('[email protected]', 'Test email using PHP', 'This is a test email message', $headers, '[email protected]');?> 
 <?php $to = '[email protected]'; $subject = 'Test email using PHP'; $message = 'This is a test email message'; $headers = 'From: [email protected]' . "rn" . 'Reply-To: [email protected]' . "rn" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers, '[email protected]'); ?> 

Where

  • [email protected] — same sender’s email but with “-f” at the begining.

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 “[email protected]”.

If you don’t receive testing email, contact your hosting provider and check:

  1. whether phpmailer library is installed/enabled/configured on your server.

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

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.

Понравилась статья? Поделить с друзьями:
  • Make error 127 что это
  • Mail system configuration error
  • Make error 127 linux
  • Make a region selection first как исправить
  • Make 1 build conf error 2