Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

phpmailer() error question (still) 1

Status
Not open for further replies.

BobMCT

IS-IT--Management
Sep 11, 2000
756
US
There have been several questions posted about this error trying to be phpmailer running but no definitive answers. Perhaps some php guru can better explain the resolve for we neophytes???

I am using phpmailer to generate email notices to a remote smtp server. I am receiving the message "Mailer Error: Language string failed to load: recipients_failed" and I've done and tried the recommended things without resolve.

This is using PHP 4.3.10 on a SuSE 9.3 Pro server.

Also, wide searches on google and google:groups aren't turning up much help either. Can anyone please shed some insight on this to allow several of us to correct and move forward?

Thanks,
 
Here's the snippet (almost verbatim from the docs):

$mail=new PHPMailer();
$mail->IsSMTP();
$mail->From="Admin@xxxxx.com";
$mail->FromName="Administrator";
$mail->Subject="xxxxxxxxx - as requested";
$mail->Host="mail.xxxxxxxx.com";
$mail->Mailer="smtp";
$mailmsg ="Hello ".$_fname.",\n\n";
$mailmsg.="The login information you requested is as follows:\n\n";
$mailmsg.="username:\t".$_userid."\n";
$mailmsg.="password:\t".$_passwd."\n\n";
$mailmsg.="Please store this information in a safe place and for security purposes\n";
$mailmsg.="we recommend that you change your password as soon as possible.\n\n";
$mailmsg.="Administrator, xxxxxxxx\n";
$mail->Body=$mailmsg;
$mail->AddAddress($_eMail);
/* Now SEND the requested email message */
if (!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo . "<br />";
}
$mail->ClearAddresses();
$mail->ClearAttachments();

Obviously the domain info has been substituted with the xxx's.
I've tried several available smtp remote mail servers which all end with the same error. I've also tried various destination email addresses - same error message.

SO... I'm sort of "stumped!"
 
Well, seeing how there is an error detection block immediately following the $mail->Send instruction, perhaps that would be when/where the error occurs!!!

Here is that section:

/* Now SEND the requested email message */
if (!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo . "<br />";
}


While NOT a permanent error handling routine, it is intended to provide immediate output of the error message for debugging purposes.

Does this answer your question?
 
Well, seeing how there is an error detection block immediately following the $mail->Send instruction, perhaps that would be when/where the error occurs!!!
So are you telling me that in your PHP installation, the only place in which scripts report errors is in an error-detection block? How nice for you -- my PHP scripts can generate errors anywhere.

Now you do want to quit being irritating and flippant and get some help, or do you want to continue being irritating and flippant and figure it out on your own?

Are you saying that the error output you described happened at the output line in your if-statement and that the error is definately not a PHP-generated error?

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
The error you're getting seems to be generated by the Lang() method of the PHPMail class, which is used for internationalizing the error messages generated by the class. The exact test of the error message was that the error-string array designated by "recipients_failed" was not found.

The only place in which the string "recipients_failed" is in line 500 of class.phpmailer.php, which seems to be dealing with bad message recipients.

I guess I'm back to my "what's in $_eMail?" question.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
I have a feeling its a bug in the class definition. The class' SetLanguage() method sets the language for all error messages, but I see nowhere in the class where that function might be automatically called.

As a workaround, you might try changing:

$mail=new PHPMailer();

to read:

$mail=new PHPMailer();
$mail->SetLanguage('en');

And see if the behavior of your script changes.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
sleipnir214/TANSTAAFL:

I certainly didn't mean to be snooty ('cause I'm not). Just some techie with a problem that I've been wrestling with pulling at strings trying to get some guidance. And I appreciate the suggestions you have so kindly provided. Thank you.

What you recommended (the SetLanguage) made sense, but I certainly did not see any references to it in any of the docs on this class that I have available. I inserted the line you recommended (actually cut and pasted it) and retried the program and received the same error message:
Mailer Error: Language string failed to load: recipients_failed xxx@yyy.com

If I try to send email with TB1.0.x using the same remote SMTP mail server to the same recipient, it goes OK. I also use that same mail server to send email notices generated by a perl program so I know it works reliably.

I am not a PHP expert, but I'm trying to learn as best I can. And with help from people like you, I know I will.

Thanks again for your responses. I'll have to keep searching.

Bob
 
This is using PHP 4.3.10 on a SuSE 9.3 Pro server.
 
Okay, I think I have it. It's the SetLanguage() method.

There is a second, optional, parameter to the method, which is a path to the directory where the language files reside. In order to get a good error message, I had to change the default path to match my system (/usr/local/lib/languages).

That changed on my system the error to read:

Mailer Error: SMTP Error: The following recipients failed: xxxxxxxx@yyyyyy.com


On my system, I only get that error when the send fails, as in when the recipient doesn't exist.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
You posted earlier:

end email with TB1.0.x using the same remote SMTP mail server to the same recipient

What is TB1.0.x?
Could this be a problem with something like SMTP authentication or restricted senders on the SMTP server?

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Sleipner;

I want to thank you for your help. I don't understand why there is no mention of the language issue in ANY of the docs or searches but your research pointed me to an SMTP error. That error directed me to search to logs of the remote smtp server which is where I found the cause of the error (truncated authentication). Once corrected it works well.

2-3 days wasted because of a seriously misleading error message. No way to promote productivity.

Thank again. Perhaps I will mention this to the phpmailer() group on sourceforge.

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top