我有一台 centos 服务器,正在尝试为 mailx 配置它。我已使用以下方式安装了 mailx
yum install mailx
一切似乎都已正确安装。我现在正尝试使用以下内容发送测试电子邮件...
echo 'this is a test'| sendmail -s test_email [email protected]
一切看起来都正确,但是从未收到任何电子邮件,在检查 /var/log/maillog 的日志时我看到了这一点......
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: [email protected], 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=<[email protected]>, 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
我现在尝试向已确认的电子邮件帐户发送电子邮件[电子邮件保护],没有收到电子邮件,我在日志中看到了这一点......
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: [email protected], 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=<[email protected]>, 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
奇怪的是,通过这个电子邮件地址,我在终端收到以下消息
You have new mail in /var/spool/mail/root
答案1
我不清楚你做错了什么。
relay=mx1.hotmail.com. [65.55.37.104], dsn=5.1.1, stat=User unknown
表明您的本地 sendmail 正在正确尝试连接到 hotmail 的主 MX,正确尝试发送电子邮件,并正确报告 hotmail 由于用户未知而拒绝接受该邮件。
要么 hotmail 说的是实话,而您确实试图向无效地址发送邮件(在驳斥此假设之前请谨慎),要么它在撒谎。如果它在撒谎,通常的原因是它认为您是垃圾邮件发送者,并决定以 SMTP 允许的最有效方式拒绝接受您的电子邮件。如果您得出结论,这就是正在发生的事情,那么您的问题就完全变成了“我如何提高发送服务器的声誉”,这是一个完全不同的问题,答案要长得多。
编辑:从您下面发送的测试中,我看到本地日志显示:
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]
我注意到您已将 sendmail 配置为非全局解析主机名,并且显然是不合格的主机名,因此当它向其他邮件服务器宣布自己时,它会使用无法解析的主机名 ( mysite
)。也就是说当然为什么我的邮件服务器拒绝了您的测试,这可能也是其他人拒绝的原因;HELO 中的无效主机名是垃圾邮件发送者的标准特征。因此,修复此问题,您的邮件可能会开始送达。