1

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?

  • 1
    Perhaps your network connection to gmail isn't reliable? @Adern's advice is good. Aside from that, you're using an old, buggy, and vulnerable version of PHPMailer – [Get the latest](https://github.com/PHPMailer/PHPMailer). – Synchro Feb 02 '18 at 17:22
  • Thanks - I considered that but the fact that the mail is being delivered indicates that everything is going fine. Well mostly fine. And yes, good advice. I will update. – But those new buttons though.. Feb 02 '18 at 17:28

1 Answers1

1

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.

Adern Nerk
  • 332
  • 3
  • 13
  • Also, i was searching for a solution on web for your problem and i got a point it was this error may occur because of invalid email addresses . see here https://help.zoho.com/portal/community/topic/smtp-error-data-end-command-failed-553-relaying-disallowed-smtp-error-data-not-accepted-mailer-error-smtp-error-data-not-accepted – Adern Nerk Feb 02 '18 at 17:10
  • 1
    Thanks Adern - If I could consistently reproduce the issue it would be a breeze to debug. It's nothing to do with the message - as I said it's a regular message and it will succeed on subsequent attempts so that also rules out invalid address or really anything to do with the message itself. I've gone ahead and upgraded, increased my timeout and done a bit more verbose error logging. just have to wait and see at this point – But those new buttons though.. Feb 02 '18 at 18:26