Why can't phpmailer instantiate the mail function?
I'm running phpmailer on my Linode, and I am running into the following error:
Mailer Error: Could not instantiate mail function
How can I get around this error? Below are my configurations:
$mailer->Host = 'smtp.$HOST.com';
$mailer->SMTPAuth = true;
$mailer->Username = '$USERNAME';
$mailer->Password = '$PASSWORD';
$mailer->SMTPSecure = 'tls';
$mailer->Port = 587;
$mailer->SMTPDebug = 4;
1 Reply
So there can be a few reasons phpmailer is giving you this error. I did a little bit of digging on this, and I found one of the most common issues is that smtp is not explicitly defined in your configuration. One way you can do this is by adding the following line to the top of that configuration you shared:
$mail->IsSMTP();
Alternatively, it could be you do not have a mail server properly configured. If you have not done so, I would highly recommend reviewing our guide on using Dovecot, Postfix, and MySQL to set up a mail server.
I hope this helps get you pointed in the right direction. Feel free to respond to this post if you continue to see issues.