phpmailer/SMTP error messages

phpmailer/SMTP error messages

Posted by: msherwoo
Posted on: 2009-10-11 17:35:00

I use phpmailer within some scripts to send mail. I use authenticated STMP mode. It works great.

Here's the problem: I don't get error messages from bounced addresses or from exceeding quota (although I NEVER do that). phpmailer has it's debug mode, but that's only for errors from phpmailer and not from the SMTP server, as far as I know. I have sent mail to some bogus addresses and I get no error messages anywhere.

So, is there a way to get error messages when I send mail using phpmailer via STMP?

Thanks,

Mike

Re: phpmailer/SMTP error messages

Posted by: sXi
Posted on: 2009-10-11 18:37:00

I'd think you should receive error messages at the $mail->From address.

Failing that, check the $mail->AddReplyTo address.




How To Install PHP.INI / ionCube on DreamHost

Re: phpmailer/SMTP error messages

Posted by: Atropos7
Posted on: 2009-10-11 19:58:00

Helps to read about SMTP.

Messages are placed in envelopes when transferred from server to server. Thus if there is a problem handling the message (failure notices, bounces etc) it is reported to the "return address" called the envelope-sender. This means the envelope-sender doesn't necessarily appear anywhere in the headers of the message when it was first submitted at all.

The envelope sender and recipient are specified separately from the message headers. With SMTP, the server is told what the sender is using the "MAIL FROM" command. And when submitted using the sendmail interface the sender is specified using the -f parameter.

And the property of PHPMailer is aptly called $Sender.



Customer since 2000 cool openvein.org

Re: phpmailer/SMTP error messages

Posted by: msherwoo
Posted on: 2009-10-12 06:45:00

Thanks. All works.

Re: phpmailer/SMTP error messages

Posted by: sXi
Posted on: 2009-10-12 10:26:00

In reply to:

Helps to read about SMTP.


PHPMailer uses the $mail->From var for "Sender" out of the box. I just tried it sans-Sender and all errors are sent to the From address. Did you get different results when you tried it?




How To Install PHP.INI / ionCube on DreamHost

Re: phpmailer/SMTP error messages

Posted by: Atropos7
Posted on: 2009-10-12 12:03:00

You're right, in 5.0.2 this is their code:

  $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
if(!$this->smtp->Mail($smtp_from)) {
throw new phpmailerException($this->Lang('from_failed') . $smtp_from, self::STOP_CRITICAL);
}

So one might want to see if they can pass an invalid From address and a valid Sender address.

Customer since 2000 cool openvein.org

Re: phpmailer/SMTP error messages

Posted by: sXi
Posted on: 2009-10-12 13:06:00

It will report to $Sender if set in the class, as expected.

Users who whack in a non-existent alias like the good old "no-reply@domain.com" would get caught with zero feedback. Tripped myself up in the past doing that.. because nothing *ever* goes wrong.. Not EVER! Right? wink




How To Install PHP.INI / ionCube on DreamHost

Tags: smtp errormailsmtp servererror messagesphpmailerquotascripts