linux mail发送邮件stat=sent却没有收到邮件

今天尝试着想要在linux终端上直接用mail命令(e.g: mail -s "hello" xxx@163.com)给我163.com的邮箱发邮件时,163.com邮箱根本收不到,但是总是可以在/var/mail/root下面找到我刚才发的邮件,其实这是因为发送失败了,从而被sendmail回退了邮件回来。
要想看失败原因, check /var/log/maillog:
Aug 1 18:41:40 localhost sendmail[5279]: o71Afeih005279: from=root, size=220, class=0, nrcpts=1, msgid=<201008011041.o71Afeih005279@localhost.localdomain>, relay=root@localhost
Aug 1 18:41:42 localhost sendmail[5281]: o71Afekr005281: from=<root@localhost.localdomain>, size=480, class=0, nrcpts=1, msgid=<201008011041.o71Afeih005279@localhost.localdomain>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Aug 1 18:41:42 localhost sendmail[5279]: o71Afeih005279: to=favorite214@139.com, ctladdr=root (0/0), delay=00:00:02, xdelay=00:00:02, mailer=relay, pri=30220, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (o71Afekr005281 Message accepted for delivery)
Aug 1 18:41:44 localhost sendmail[5283]: o71Afekr005281: to=<favorite214@139.com>, ctladdr=<root@localhost.localdomain> (0/0), delay=00:00:03, xdelay=00:00:02, mailer=esmtp, pri=120480, relay=mx.139.com. [221.176.6.96], dsn=5.0.0, stat=Service unavailable
Aug 1 18:41:44 localhost sendmail[5283]: o71Afekr005281: o71Afikr005283: DSN: Service unavailable
Aug 1 18:41:44 localhost sendmail[5283]: o71Afikr005283: to=<root@localhost.localdomain>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31717, dsn=2.0.0, stat=Sent

后来在google上找了很多,最后终于找到原因了:
I fixed the problem by changing the hostname of my server. Apparently "localhost.localdomain" will get rejected automatically by a lot of mail servers. As soon as I changed my hostname to "extra.idahostatesman.com" (a domain that is hosted on the server), everything just worked and I had no more problems sending e-mail.

可以用hostanme 命令临时修改主机名,hostname aa.com; 还是失败了

Aug 1 19:11:33 localhost sendmail[5579]: o71BBVB9005579: from=root, size=221, class=0, nrcpts=1, msgid=<201008011111.o71BBVB9005579@aa.com>, relay=root@localhost
Aug 1 19:11:35 localhost sendmail[5580]: o71BBX3b005580: from=<root@aa.com>, size=436, class=0, nrcpts=1, msgid=<201008011111.o71BBVB9005579@aa.com>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Aug 1 19:11:35 localhost sendmail[5579]: o71BBVB9005579: to=favorite214@139.com, ctladdr=root (0/0), delay=00:00:04, xdelay=00:00:02, mailer=relay, pri=30221, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (o71BBX3b005580 Message accepted for delivery)
Aug 1 19:11:39 localhost sendmail[5582]: o71BBX3b005580: to=<favorite214@139.com>, delay=00:00:04, xdelay=00:00:04, mailer=esmtp, pri=120436, relay=mx.139.com. [221.176.6.96], dsn=4.0.0, stat=Deferred: 450 Requested action not taken:cmmx01, AS0QrJA75wiRVlVMWIvlAA--.3152S2, dynamic, reputation, zen.spamhaus.org, please try again

切记:修改完hostname以后需要重启sendmail 服务,重启服务后,一切ok.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值