Could not instantiate mail function error

Need help with the Administration of your Joomla! 3.x site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
dcaldessa
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Fri May 06, 2016 4:06 pm

Could not instantiate mail function error

Post by dcaldessa » Fri May 06, 2016 4:20 pm

hello

I am working on my joomla 3.5 site, when I use the registration forum i get the following errors .

Notice
Could not instantiate mail function.
×
Warning
An error was encountered while sending activation notification email

when registering a new user. The funny thing is that I am getting the activation email and able to activate the account through the email but I keep getting these errors.

also when I try to use sendmail I can send a test email but still get errors during registration. Tried smtp as well but was unable to send test mails through my provider.

Since im getting the activation email through phpmailer i know it is working again just keep getting the above errors.

Any Ideas to what is going on ?

thanks

dcaldessa

itoctopus
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4025
Joined: Mon Nov 25, 2013 4:35 pm
Location: Montreal, Canada
Contact:

Re: Could not instantiate mail function error

Post by itoctopus » Fri May 06, 2016 4:50 pm

The fact that the email is sent is very odd - since the above means that the mailPassthru returned false (and in turn, the mail function returned false).

The way we would debug this issue is the following: We open the file libraries/vendor/phpmailer/phpmailer/class.phpmailer.php . In the function "mailPassthru", we remove the @ sign in front of the mail function and then test the functionality. We should then probably see what the issue is.
http://www.itoctopus.com - Joomla consulting at its finest
https://twitter.com/itoctopus - Follow us on Twitter

dcaldessa
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Fri May 06, 2016 4:06 pm

Re: Could not instantiate mail function error

Post by dcaldessa » Fri May 06, 2016 5:44 pm

I tried doing as you stated above.

private function mailPassthru($to, $subject, $body, $header, $params)
{
//Check overloading of mail function to avoid double-encoding
if (ini_get('mbstring.func_overload') & 1) {
$subject = $this->secureHeader($subject);
} else {
$subject = $this->encodeHeader($this->secureHeader($subject));
}
if (ini_get('safe_mode') || !($this->UseSendmailOptions)) {
$result = mail($to, $subject, $body, $header);
} else {
$result = mail($to, $subject, $body, $header, $params);
}
return $result;
}

I believe it is just like this removing the @ sign in front of both mail functions. I tested the registration again and still got the same result.

The user is registered and the email is sent for activation but still get the same errors above the registration form.

any other tips would be appreciated

thanks
dcaldessa

itoctopus
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4025
Joined: Mon Nov 25, 2013 4:35 pm
Location: Montreal, Canada
Contact:

Re: Could not instantiate mail function error

Post by itoctopus » Fri May 06, 2016 6:55 pm

Before " return $result;" can you add the following 4 lines:

Code: Select all

echo('----printing $result ---<br />');
var_dump($result);
echo('----end printing $result ---<br />');
die();
And post here what you see there? (Note: please revert back the changes immediately to the original file once you are finished debugging).
http://www.itoctopus.com - Joomla consulting at its finest
https://twitter.com/itoctopus - Follow us on Twitter

dcaldessa
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Fri May 06, 2016 4:06 pm

Re: Could not instantiate mail function error

Post by dcaldessa » Fri May 06, 2016 7:04 pm

itoctopus

I did the above instructions and the result was this

----printing $result ---
bool(true) ----end printing $result ---


whats next ?

thanks

dcaldessa.

dcaldessa
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Fri May 06, 2016 4:06 pm

Re: Could not instantiate mail function error

Post by dcaldessa » Sat May 07, 2016 2:12 pm

I could not figure out what was going on so i just reinstalled joomla now issue is resolved
thanks for your help

dcaldessa


Locked

Return to “Administration Joomla! 3.x”