Centos : mailx not sending emails

centosemail

I have a centos server which I am trying to configure for mailx. I have installed mailx using

yum install mailx

All seems to have installed correctly. I am now attempting to send a test email using the following…

echo 'this is a test'| sendmail -s test_email myemailaddress@hotmail.com

All looks correct but no email is ever recieved, on checking the logs at /var/log/maillog i see this…

Dec 30 14:46:57 myserver sendmail[9503]: rBUEkuwh009503: from=root, size=0, class=0, nrcpts=2, msgid=<201312301446.rBUEkuwh009503@myserver>, relay=root@localhost
Dec 30 14:46:57 myserver sendmail[9512]: rBUEkuhk009506: to=<root@myserver>, delay=00:00:01, xdelay=00:00:01, mailer=local, pri=32952, dsn=2.0.0, stat=Sent
Dec 30 14:46:57 myserver sendmail[9514]: rBUEkveo009514: <test_email@myserver>... User unknown
Dec 30 14:46:57 myserver sendmail[9503]: rBUEkuwh009503: to=test_email, ctladdr=root (0/0), delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=60000, relay=[127.0.0.1] [127.0.0.1], dsn=5.1.1, stat=User unknown
Dec 30 14:46:57 myserver sendmail[9514]: rBUEkveo009514: from=<root@myserver>, size=227, class=0, nrcpts=1, msgid=<201312301446.rBUEkuwh009503@myserver>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Dec 30 14:46:57 myserver sendmail[9503]: rBUEkuwh009503: to=myemailaddress@hotmail.com, ctladdr=root (0/0), delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=60000, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (rBUEkveo009514 Message accepted for delivery)
Dec 30 14:46:57 myserver sendmail[9503]: rBUEkuwh009503: rBUEkuwi009503: DSN: User unknown
Dec 30 14:46:57 myserver sendmail[9514]: rBUEkveq009514: from=<>, size=1709, class=0, nrcpts=1, msgid=<201312301446.rBUEkuwi009503@myserver>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Dec 30 14:46:57 myserver sendmail[9503]: rBUEkuwi009503: to=root, delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=31024, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (rBUEkveq009514 Message accepted for delivery)
Dec 30 14:46:57 myserver sendmail[9517]: rBUEkveq009514: to=<root@myserver>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31868, dsn=2.0.0, stat=Sent
Dec 30 14:46:57 myserver sendmail[9516]: rBUEkveo009514: to=<myemailaddress@hotmail.com>, ctladdr=<root@myserver> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=120227, relay=mx1.hotmail.com. [65.55.37.104], dsn=5.1.1, stat=User unknown
Dec 30 14:46:58 myserver sendmail[9516]: rBUEkveo009514: rBUEkweo009516: DSN: User unknown
Dec 30 14:46:58 myserver sendmail[9516]: rBUEkweo009516: to=<root@myserver>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31413, dsn=2.0.0, stat=Sent

I have now tried sending an email to a confirmed email account testemailaccount@hushmail.com, no email arrives and I see this in the logs…

Dec 30 16:21:32 myserver sendmail[29502]: rBUGLWxP029502: from=root, size=15, class=0, nrcpts=2, msgid=<201312301621.rBUGLWxP029502@myserver>, relay=root@localhost
Dec 30 16:21:32 myserver sendmail[29503]: rBUGLWGS029503: <test_email@myserver>... User unknown
Dec 30 16:21:32 myserver sendmail[29502]: rBUGLWxP029502: to=test_email, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=60015, relay=[127.0.0.1] [127.0.0.1], dsn=5.1.1, stat=User unknown
Dec 30 16:21:32 myserver sendmail[29503]: rBUGLWGS029503: from=<root@myserver>, size=242, class=0, nrcpts=1, msgid=<201312301621.rBUGLWxP029502@myserver>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Dec 30 16:21:32 myserver sendmail[29502]: rBUGLWxP029502: to=mailtestaccount@hushmail.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=60015, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (rBUGLWGS029503 Message accepted for delivery)
Dec 30 16:21:32 myserver sendmail[29502]: rBUGLWxP029502: rBUGLWxQ029502: DSN: User unknown
Dec 30 16:21:33 myserver sendmail[29503]: rBUGLWGU029503: from=<>, size=1724, class=0, nrcpts=1, msgid=<201312301621.rBUGLWxQ029502@myserver>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Dec 30 16:21:33 myserver sendmail[29502]: rBUGLWxQ029502: to=root, delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=31039, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (rBUGLWGU029503 Message accepted for delivery)
Dec 30 16:21:33 myserver sendmail[29506]: rBUGLWGU029503: to=<root@myserver>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31883, dsn=2.0.0, stat=Sent
Dec 30 16:21:34 myserver sendmail[29505]: STARTTLS=client, relay=mx9.hushmail.com., version=TLSv1/SSLv3, verify=FAIL, cipher=DHE-RSA-AES256-SHA, bits=256/256
Dec 30 16:21:34 myserver sendmail[29505]: rBUGLWGS029503: to=<mailtestaccount@hushmail.com>, ctladdr=<root@myserver> (0/0), delay=00:00:02, xdelay=00:00:02, mailer=esmtp, pri=120242, relay=mx9.hushmail.com. [65.39.178.143], dsn=5.0.0, stat=Service unavailable
Dec 30 16:21:34 myserver sendmail[29505]: rBUGLWGS029503: rBUGLYGS029505: DSN: Service unavailable
Dec 30 16:21:34 myserver sendmail[29505]: rBUGLYGS029505: to=<root@myserver>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31428, dsn=2.0.0, stat=Sent

Strangely with this email address I get the following message in terminal

You have new mail in /var/spool/mail/root

Best Answer

It's not clear to me that you're doing anything wrong. The line

relay=mx1.hotmail.com. [65.55.37.104], dsn=5.1.1, stat=User unknown

suggests that your local sendmail is correctly trying to connect to hotmail's primary MX, correctly trying to deliver the email, and correctly reporting that hotmail's refusing to accept it on the basis that the user is unknown.

Either hotmail's telling the truth, and you really are trying to send to an invalid address (be careful before dismissing this hypothesis), or it's lying. If it's lying, the usual reason is that it thinks you're a spammer, and it's decided to refuse to accept email from you in the most efficient way that SMTP allows. If you conclude this is what's happening, then your question has changed completely into "how do I improve my sending server's reputation", and that is a whole different question with much longer answers.

Edit: from the test you sent below, I see local logs that say:

Dec 30 16:40:45 lory sendmail[25598]: NOQUEUE: connect from [217.147.85.xx]
Dec 30 16:40:45 lory sendmail[25598]: STARTTLS=server, relay=[217.147.85.xx], version=TLSv1/SSLv3, verify=NO, cipher=DHE-RSA-AES256-SHA, bits=256/256
Dec 30 16:40:45 lory sendmail[25598]: rBUGejti025598: ruleset=check_mail, arg1=<root@mysite>, relay=[217.147.85.xx], reject=553 5.1.8 <root@mysite>... Domain of sender address root@misite does not exist
Dec 30 16:40:45 lory sendmail[25598]: rBUGejti025598: from=<root@mysite>, size=496, class=0, nrcpts=0, proto=ESMTP, daemon=MTA-v6, relay=[217.147.85.xx]

I note that you have configured your sendmail with a non-globally-resolving hostname, and apparently an unqualified one at that, so that when it announces itself to a fellow mailserver, it does so with a hostname that can't be resolved (mysite). That is certainly why my mail server refused your test, and it's probably why others are doing so, too; invalid hostnames in HELO are a standard signature of a spammer. So fix that and you might start to get mail delivered.

Related Topic