Sendmail Failing to Send to Local Domain

I’ve run into this issue a couple of times now so I’m assuming others are as well.  Servers set up on Amazon EC2 with default sendmail configuration seem to get the following error in their /var/log/maillog:

12 Sep 19 19:48:26 DOMAIN sendmail[31192]: q8JJmQQV031192: ... User unknown
13 Sep 19 19:48:26 DOMAIN sendmail[31191]: q8JJmQ0D031191: to=orders@DOMAIN.com, ctladdr=DOMAIN.com (504/502), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30695, relay=[127.0.0.1] [127.0.0.1], dsn=5.1.1, stat=User unknow
14 Sep 19 19:48:26 DOMAIN sendmail[31192]: q8JJmQQV031192: from=, size=695, class=0, nrcpts=0, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
15 Sep 19 19:48:26 DOMAIN sendmail[31191]: q8JJmQ0D031191: q8JJmQ0E031191: DSN: User unknown
16 Sep 19 19:48:26 DOMAIN sendmail[31192]: q8JJmQQX031192: from=<>, size=2616, class=0, nrcpts=1, msgid=, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
17 Sep 19 19:48:26 DOMAIN sendmail[31191]: q8JJmQ0E031191: to=DOMAIN.com, delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=31719, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (q8JJmQQX031192 Message accepted for delivery)
20 Sep 19 19:48:26 DOMAIN sendmail[31193]: q8JJmQQX031192: to=, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=32817, dsn=2.0.0, stat=Sent
21 Sep 19 19:49:36 DOMAIN sendmail[31200]: q8JJnaxi031200: from=DOMAIN.com, size=698, class=0, nrcpts=1, msgid=, relay=DOMAIN.com@localhost

The solution that I have found to work is to modify /etc/mail/sendmail.mc and add the following to the very end:

define(`MAIL_HUB', `DOMAIN.com.')dnl
define(`LOCAL_RELAY', `DOMAIN.com.')dnl

Be sure to replace DOMAIN with your local domain.

Notice: The above define code entries start with a ` and end with a ‘.  Make sure you copy+paste the above as it is, and modify the domain as it’s not the standard begin with a ` and end with a `.

After doing so, you’ll need to install sendmail-cf and run a reconfiguration with the following:

cd /etc/mail/
yum install sendmail-cf
/etc/mail/make

Lastly, restart sendmail:

service sendmail restart

4 thoughts on “Sendmail Failing to Send to Local Domain

  1. Hi Beshoy – just wanted to say thanks for this article. I was getting the ‘unknown user’ issue on my linux VM due to the same email routing problem. I read a LOT of forum posts on the issue, but it was your information that actually worked.

    Thanks again!

Leave a Reply

Your email address will not be published. Required fields are marked *