GMail SMTP to send mail, receiving error (4.7.0), but mail is sent!

By : Sabya

I am using GMail SMTP server to send mails. And PHPMailer as the mail sending script.

I have received this error (I log all SMTP errors, that is whenever, PHPMailer::Send fails): -

SMTP Error: Data not accepted.<p>SMTP server error: 4.7.0 Temporary System Problem.  Try again later (WS)

But the mails is actually sent. (This I know by matching the timestamp of sent mails, and the timestamp in the log.)

How is it possible? What does that error mean?

UPDATE: I think I was not clear in my question. Let me rephrase it: -

I am not worried if a mail is lost after PHPMailer is able to send it to GMail SMTP. But I am worried that PHPMailer has returned error, but the mail was sent. Is it possible?

By : Sabya


I think that SMTP does not guarantee delivery anyway. It is a store-and-forward mechanism. That is why some emails can go missing (for e.g. if a relay crashed while in the midst of relaying the message).

If you are depending on email for important functions, you may want to enforce some sort of feed-back mechanism (maybe via a response). Then, if a response is not received within a certain time frame, you try it again.

UPDATE: It is most certainly possible. All you need is a mail server that sends you an error code instead. It may send an error code for a variety of reasons, too many to list. I suggested the above method because, you should never take server responses on trust alone, especially if it does not any sort of atomicity/acidity.

By : sybreon

This video can help you solving your question :)
By: admin