Thursday, 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

1 comment:

Anonymous said...

well i have the same problem and emails sometimes get sent and sometimes not:

in /var/log/messges
i am geeting:
Code:
16:54:47 srvmon-Bellakt sm-mta[17248]: pA3Dsifc017248: to=, ctladdr= (0/0), delay=00:00:03, xdelay=00:00:03, mailer=esmtp, pri=30322, relay=mx2.activeby.net. [109.237.213.144], dsn=2.0.0, stat=Sent (OK id=1RLxkj-0002dF-6r)
Nov 3 16:54:47 srvmon-Bellakt sendmail[17237]: pA3DseMv017237: to=monitoring@mydomain.by, ctladdr=root (0/0), delay=00:00:07, xdelay=00:00:03, mailer=relay, pri=30005, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (pA3Dsifc017248 Message accepted for delivery)

when it gets sent
and when it fails to be sent i get:
Code:
Nov 3 17:17:20 srvmon-Bellakt sm-mta[32754]: pA3EHG4E032754: to=, ctladdr= (0/0), delay=00:00:04, xdelay=00:00:04, mailer=esmtp, pri=30364, relay=mx2.activeby.net. [109.237.213.144], dsn=5.0.0, stat=Service unavailable