You Old Fool
You Old Fool

Reputation: 22950

PHPMailer / SMTP Error but mail is still delivered

Lately I've been logging messages from PHPMailer for failed outgoing emails which are being sent via SMTP through a Google Apps account. The property $mail->ErrorInfo returns:

SMTP Error: data not accepted.SMTP server error: DATA END command failed

Oddly, when I check the sent mail box on the Google Apps account, these messages are still being successfully received and delivered. And there isn't any discernable consistency to the errors - looks like maybe 3% of the outgoing mail.

I am using PHPMailer-5.2.16. There is nothing special in particular about the messages that fail and I can resend them in an identical way with success.

The mail function configures everything, then attempts to send the message and logs failures like this:

if (!$mail->send()) {
    file_put_contents('mail.log', date('c') . ' ' . $mail->ErrorInfo . PHP_EOL, FILE_APPEND);
}

Can anyone think of a reason why I would experience an intermittent error result like this while the messages are still being delivered?

Upvotes: 1

Views: 159

Answers (1)

Adern Nerk
Adern Nerk

Reputation: 330

Possibly answered here phpmailer-the-following-smtp-error-data-not-accepted

Also, Set $mail->SMTPDebug = 2; and see what it says. It may be something like that you're exceeding maximum message size.

for more info go to https://github.com/PHPMailer/PHPMailer/issues/654.

Upvotes: 1

Related Questions