Language string failed to load: instantiate

Hi Guys

Anybody had this error with phpmailer

“Language string failed to load: instantiate”

I have no idea what to do :confused:

Any help would be much appreciated

Cheers

Have a look at:
http://www.phpwcms.de/forum/viewtopic.php?p=61632#61632
http://www.experts-exchange.com/Web/Web_Languages/PHP/Q_21451918.html (scroll to the bottom of the page)
and
http://www.google.com/search?client=opera&rls=en&q=%22Language+string+failed+to+load:+instantiate"&sourceid=opera&ie=utf-8&oe=utf-8

I had found this page while previously search for my problem but i did not use PHP mailer later:

Many people are experiencing errors with the PHPMailer class but they are extremely difficult to track down because its language files aren’t properly included. No proper error messages are printed from PHPMailer because of this.

A sample error is:
“Mailer Error: Language string failed to load: instantiate”

The reason is because while class.phplistmailer is instantiated in /admin, its parent class (class.phpmailer) is instantiated in /admin/phpmailer, so PHPMailer ends up looking for its language files in /admin/language, which of course does not exist.

This is a VERY trivial fix. Simply add the following to line 24 of /admin/class.phplistmailer.php:

parent::SetLanguage(‘en’,‘phpmailer/language/’);

By passing in that optional second parameter, we allow PHPMailer to finds its language files, which is ABOSULUTELY VITAL to tracking down and solving problems with sending mail.

I have made this change and tested it on my own 2.10.2 install and it works great. I can now see the errors PHPMailer is encountering. I don’t have the time to get a CVS account, but can someone patch and test this and please check it in if it works for you! Thanks.

Hi guys

Thanks for your responses, I also found these solutions but none seem to work?

Question: If I enable SMTP on IIS can phpmailer use this to send mail?

Thanks again

This is very strange, I’ve tested my mail server with the mail() function and it seems to be ok and the phpmailer script works fine from another site I have hosted on the same server???

Problem solved :slight_smile:

Although I’m still quite confused as to what exactly was causing the error???

I changed the recipient email address to my own and the class seems to work fine!! So I thought maybe the original recipient email was duff, but, I tested and it seemed to work??

The original recipient email was a distribution list would this have caused the problem???

Any way, I now use the original email and my own as the recipients and this seems to do the trick!!

This was the line causing the error.

function MailSend($header, $body) {
    $to = "";
    for($i = 0; $i < count($this->to); $i++)
    {
        if($i != 0) { $to .= ", "; }
        $to .= $this->to[$i][0];
    }

    if ($this->Sender != "" && strlen(ini_get("safe_mode"))< 1)
    {
        $old_from = ini_get("sendmail_from");
        ini_set("sendmail_from", $this->Sender);
        $params = sprintf("-oi -f %s", $this->Sender);
        $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, 
                    $header, $params);
    }
    else
        [B]$rt = @mail($to, $this->EncodeHeader($this->Subject), $body, $header);[/B]

    if (isset($old_from))
        ini_set("sendmail_from", $old_from);

    if(!$rt)
    {
        $this->SetError($this->Lang("instantiate"));
        return false;
    }

    return true;
}

I hope this helps anybody who has the same problem

Regards

Crabby