I have a Postfix server setup which works fine most of the time but between 100 - 200 mails gets deferred every day with the following errors:
status=deferred (lost connection with alt1.gmail-smtp-in.l.google.com[74.125.142.27] while sending RCPT TO)
status=deferred (lost connection with mta6.am0.yahoodns.net[66.196.118.34] while sending message body)
That's around 10 % of all outgoing mails. Incoming mails works fine and all outgoing to domains on the local server works fine as well.
While troubleshooting, I found a certain mail that gmail keeps on bouncing, but if I compose a new mail to the exact same recipient google accepts it without any issues:
Mail that bounces:
Sep 3 13:08:04 mail postfix/smtp[2623]: 72A66184148: to=<[email protected]>, relay=aspmx.l.google.com[173.194.79.27]:25, delay=2.5, delays=0.01/0/0.83/1.7, dsn=5.7.1, status=bounced (host aspmx.l.google.com[173.194.79.27] said: 554 5.7.1 9.9.9 (in reply to end of DATA command))
Mail that gets delivered:
Sep 3 13:10:08 mail postfix/smtp[24005]: 38C47184147: to=<[email protected]>, relay=aspmx.l.google.com[173.194.79.27]:25, delay=3.3, delays=0/0.01/0.82/2.5, dsn=2.0.0, status=sent (250 2.0.0 OK 1378199356 hk5si14476075pac.241 - gsmtp)
If I forward the same mail that bounced to another domain on the local server it goes through fine.
But Yahoo bounces it with the following error:
host mta5.am0.yahoodns.net[66.196.118.240] said: 554 5.7.1 9.9.9 (in reply to end of DATA command)
The size of both the emails are more or less same(less than 100KB) so that's not the issue here.
There is no firewall infront of the server. All DNS settings are correct, reverse DNS is setup properly and as I said, it's just certain mails that doesn't go through.
I spoke to the ISP and confirmed the MTU settings are okay.
Any suggestions?
Update I manage a second mail server at a remote location and tried sending the mail that bounces to the remote domain. I ran tcpdump on the receiving end to see what is happening. While sending the mail that is bouncing, the server is sending RSET after it sends RCPT TO.
16:17:23.249320 IP mail.mydomain.com.47556 > mail.myremotemailserver.com.smtp: P 74:126(52) ack 228 win 123 [email protected]...^.B2...}.....-B........{....... t...y...RCPT TO: ORCPT=
16:17:23.614527 IP mail.mydomain.com.47556 > mail.myremotemailserver.com.smtp: P 126:132(6) ack 242 win 123 E..:[email protected]^.B2...}.....-B........{....... t..vy...RSET
However, when I compose a new mail it sends DATA after RCPT to which is expected and the mail goes through fine:
16:19:20.911123 IP mail.mydomain.com.43064 > mail.myremotemailserver.com.smtp: P 73:125(52) ack 228 win 123 [email protected].*_^.B2...}.8..;&J.`..4...{P@..... t...y...RCPT TO: ORCPT=
16:19:21.297598 IP mail.mydomain.com.43064 > mail.myremotemailserver.com.smtp: P 125:131(6) ack 242 win 123 E..:[email protected].*.^.B2...}.8..;&K.`..B...{t5..... t..ay...DATA
Doesn't make much sense to me..
554 5.7.1 9.9.9
== "Message refused by Heuristic check" (aka, "stop spamming us")