swatisonee Posted January 23, 2007 Share Posted January 23, 2007 I have been using the foll. code since 2005. since this morning, i am unable to send emails using php mailer as i get the foll. error :[code]Mailer Error: Language string failed to load: instantiateMessage could not be sent.[/code]I havent changed the code at all so i cannot imagine why there should be a problem with the language string. Would be grateful if anyone could pl let me know what sudden error i should be checking for ?Thanks. Swati[code]// the posted variables are not listed here<?require("class.phpmailer.php");$mail = new PHPMailer();$mail->IsMail(); $mail->From = "[email protected]";$mail->FromName = "acd";if ($d == "on"){ $mail->AddAddress("[email protected]"); // add it }$attach = "./email_general/".$_FILES['userfile']['name'];$mail->AddAttachment($attach); $mail->IsHTML(true); // set email format to HTML$mail->Subject = "Email submitted by (".$myrow["firstname"]." ".$myrow["lastname"].") on ".$local." ." ;$mail->Body = nl2br(wordwrap($com2, 75)) . "<br</font><br><p><font color=blue><font size=3><font face=Times New Roman><br>File attached: ".$_FILES["userfile"]["name"];if(!$mail->Send()){ echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit;}echo "Emails sent successfully.";@unlink($attach);?> [/code] Quote Link to comment https://forums.phpfreaks.com/topic/35341-solved-sudden-php-mailer-error/ Share on other sites More sharing options...
bqallover Posted January 23, 2007 Share Posted January 23, 2007 It seems this has come up before, just as enigmatically. See [url=http://mantis.tincan.co.uk/view.php?id=5385]http://mantis.tincan.co.uk/view.php?id=5385[/url] for more information, and view the related bug [url=http://mantis.tincan.co.uk/view.php?id=4756]http://mantis.tincan.co.uk/view.php?id=4756[/url] for a possible fix. Quote Link to comment https://forums.phpfreaks.com/topic/35341-solved-sudden-php-mailer-error/#findComment-167027 Share on other sites More sharing options...
swatisonee Posted January 23, 2007 Author Share Posted January 23, 2007 i did see that but it for a phplistmailer.php whereas i have class.phpmailer.php. FWIW, i added it as under [code]class PHPMailer{parent::SetLanguage('en','phpmailer/language/');[/code]in the code (line 24 was blank in my code)but the page went blank !Anything else i could be trying - have been searching online but i cannot find anything else apart from this mantis thing. Quote Link to comment https://forums.phpfreaks.com/topic/35341-solved-sudden-php-mailer-error/#findComment-167031 Share on other sites More sharing options...
bqallover Posted January 23, 2007 Share Posted January 23, 2007 OK, I've been looking at the class.phpmailer.php code and all I can suggest is checking the location of your "phpmailer.lang-*.php" files. It appears to look for them in the 'language/' subdirectory, though mine are in the PHPMailer root directory. You could try manually changing the line at class.phpmailer.php (596, in my file)giving it a correct $lang_path. Still, if you haven't changed anything, I have to shrug my shoulders and suggest contacting your host, to see if they have.Sorry! Quote Link to comment https://forums.phpfreaks.com/topic/35341-solved-sudden-php-mailer-error/#findComment-167037 Share on other sites More sharing options...
swatisonee Posted January 23, 2007 Author Share Posted January 23, 2007 Hi,Thanks for writing back .This is the part that deals with language. Problem is i cannot seem to find any lang path defined anywhere ! Any ideas ?I just wrote to my host as well to see if there were any updates/patches yesterday - not yet heard from them though.[code] /** * Sets the language for all class error messages. Returns false * if it cannot load the language file. The default language type * is English. * @param string $lang_type Type of language (e.g. Portuguese: "br") * @param string $lang_path Path to the language file directory * @access public * @return bool */ function SetLanguage($lang_type, $lang_path = "language/") { if(file_exists($lang_path.'phpmailer.lang-'.$lang_type.'.php')) include($lang_path.'phpmailer.lang-'.$lang_type.'.php'); else if(file_exists($lang_path.'phpmailer.lang-en.php')) include($lang_path.'phpmailer.lang-en.php'); else { $this->SetError("Could not load language file"); return false; } $this->language = $PHPMAILER_LANG; return true; } [/code] Quote Link to comment https://forums.phpfreaks.com/topic/35341-solved-sudden-php-mailer-error/#findComment-167042 Share on other sites More sharing options...
bqallover Posted January 23, 2007 Share Posted January 23, 2007 The default path is set as "language/" in the function parameter on the line below.[code] function SetLanguage($lang_type, $lang_path = "language/") {[/code]Bear in mind though that this will be relative to the directory containing class.phpmailer.php, so if your language files are in the same directory as class.phpmailer.php, you should set this to "./".Another suggestion might be to reinstall the latest phpmailer files on your site. As before though, I'm not sure how much help this will be, but if the problems discussed on the mantis site have been resolved and patched then it *might* help. Quote Link to comment https://forums.phpfreaks.com/topic/35341-solved-sudden-php-mailer-error/#findComment-167048 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.