Phpmailer Language string failed to load

I have seen many posts from people who have installed phpmailer in the hopes of improving their mail capabilities on their site only to be confounded by the language string error –

Phpmailer Language string failed to load

Having just resolved the problem myself, I thought I would just document my remedy in the hopes that it will save someone else some time.

One solution I found in my search was altering the include path using a statement like –

set_include_path(get_include_path() . PATH_SEPARATOR . "/path_to_class/class/phpmailer");

But this change did not correct the problem for me. I looked further into the phpmailer documentation and found the SetLanguage method. I added the following lines to my code and the problem was resolved.

$lang_path = "/path_to_class_directory/class/phpmailer/language/"; 
$lang_type = "en"; 
$mail->SetLanguage($lang_type, $lang_path);

Leave a Reply