I am working on sending some emails and PHPMailer have been working perfectly on my test server.
Now, after i moved it to the production server, none of my mails will fire and i am getting a
Mailer Error: Language string failed to load: instantiate.
I have been googling and toiling with phpmailer to see what seems to be the problem and from what i gathered, i was not able to make a regular php mail() request (this is the var that needs to return true for the error to stop.
I am working on sending some emails and PHPMailer have been working perfectly on my test server.
try {
$mail->SMTPDebug = 0; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = $mail_user_name; // SMTP username
$mail->Password = $mail_user_password; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
//Recipients
$mail->setFrom($customerservice_email, $customerservice_name);
$mail->addAddress('[email protected]'); // reciever email address
// $mail->addAddress('[email protected]'); // Add a recipient
// $mail->addAddress($to);
$mail->SetLanguage('en');
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = $subject;
$mail->MsgHTML($message);
if($mail->send()){
return true;
}
return false;
}
catch (Exception $e) {
print_r($e);die;
return false;
}
Anyone have anything to help me out with? It is getting extremly frustration at this point.
CodePudding user response:
As always, read the docs. Literally the first thing it tells you is to make sure you're running the latest version, which you're not doing. That "language string" error message was removed from PHPMailer many years ago. Upgrade and the problem will go away.
You may well still have a problem after that, but whatever it is, it will probably be covered in the same troubleshooting guide.