phpmailer/SMTP error messages

software development

#1

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


#2

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

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

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost


#3

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


#4

Thanks. All works.


#5

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?

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost


#6

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


#7

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:

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost