PHP Mailer Could not load language file and Email Body Empty

5.8k Views Asked by At

Hi I am working with PHP mailer , Without doing any code changes when i send an email Now , the Email Body is empty . I debug the code and found in the mailer object that

[ErrorInfo] => Could not load language file

Then I checked the class.phpmailer.php function SetLanguage from that file the path is

mailer/language/phpmailer.lang-en.php

in My project the language file is in

/var/www/html/my_project/include/mailer/language/phpmailer.lang-en.php

So I don't know why PHP mailer cannot identify the file . Do i need the absolute path .

I haven't done any changes recently and suddenly this error appeared and now the Email Body is empty . The email is going but nothing in the body . Can this be a mail server problem ? I am not sure what to do because i haven't done any changes.

2

There are 2 best solutions below

2
On

You can fix this by manually include the path to laguage folder

$mail = new PHPMailer();
$mail->SetLanguage("en", 'includes/phpMailer/language/');
2
On

This error has not been set for years. You must be using a very old version of PHPMailer - get the latest from github.