October 21, 2010

"DSN: Service unavailable" when relaying email through Red Hat Linux

Problem:

I wrote a simple JSP that relays mail off of the same server the code is hosted on. The /var/log/maillog file showed the following error:

Oct 21 19:41:17 oradev sendmail[7681]: o9LNpH03007681: from=<automatedemail@car.somefakedomain.org>, size=385, class=0, nrcpts=1, msgid=<15307386.1287705077663.JavaMail.root@oradev.com>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Oct 21 19:41:19 oradev sendmail[7683]: o9LNpH03007681: to=<test@ipnweb.org>, delay=00:00:02, xdelay=00:00:02, mailer=esmtp, pri=120385, relay=aspmx.l.google.com. [74.125.93.27], dsn=5.0.0, stat=Service unavailable
Oct 21 19:41:19 oradev sendmail[7683]: o9LNpH03007681: o9LNpJ03007683: DSN: Service unavailable
Even though the 'to' email address is valid, the 'from' email address was intentionally spoofed (i.e., the 'from' address is not a real address).

Resolution:

1. Make sure that the domain name of the 'from' email address is a valid mail server, otherwise it might be rejected.

Obviously make sure that your DNS is configured correctly and that both the 'to' and 'from' servers are accessible.

Rerunning the scenario now works, and /var/log/maillog shows:
Oct 21 19:50:50 oradev sendmail[7678]: o9LNoouZ007678: from=<automatedemail@somerealdomain.org>, size=375, class=0, nrcpts=1, msgid=<1269514.1287705050212.JavaMail.root@oradev.com>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Oct 21 19:50:51 oradev sendmail[7680]: o9LNoouZ007678: to=<test@ipnweb.org&gt;, delay=00:00:01, xdelay=00:00:01, mailer=esmtp, pri=120375, relay=alt1.aspmx.l.google.com. [209.85.227.27], dsn=2.0.0, stat=Sent (OK 1287705051 u36si4103378weq.17)
Applicable Versions:

Red Hat AS 4 Update 4

No comments:

Post a Comment