解决sendmail发送邮件失败一例

之前发送mail一直好好的,直到有一天修改了hostname之后,突然发现不能发送mail了,报错信息大概如下:

Jul  2 16:59:16 74 sendmail[6830]: My unqualified host name (yejr) unknown; sleeping for retry
Jul  2 17:00:16 74 sendmail[6830]: unable to qualify my own domain name (yejr) -- using short name

Jul  2 17:00:16 74 sendmail[6830]: m6290G1s006830: from=root, size=475, class=0, nrcpts=1, msgid=<200807020900.m6290G1s006830@yejr>, relay=root@localhost
Jul  2 17:00:26 74 sendmail[6830]: m6290G1s006830: to=hyman@sohu-inc.com, ctladdr=root (0/0), delay=00:00:10, xdelay=00:00:10, mailer=relay, pri=30475, relay=[192.168.0.1] [192.168.0.1], dsn=5.5.4, stat=Service unavailable
Jul  2 17:00:26 74 sendmail[6830]: m6290G1s006830: m6290G1t006830: DSN: Service unavailable
Jul  2 17:00:36 74 sendmail[6830]: m6290G1t006830: to=root, delay=00:00:10, xdelay=00:00:10, mailer=relay, pri=31499, relay=[192.168.0.1] [192.168.0.1], dsn=5.0.0, stat=Service unavailable
Jul  2 17:00:36 74 sendmail[6830]: m6290G1t006830: m6290G1u006830: return to sender: Service unavailable
Jul  2 17:00:46 74 sendmail[6830]: m6290G1u006830: to=postmaster, delay=00:00:10, xdelay=00:00:10, mailer=relay, pri=32523, relay=[192.168.0.1] [192.168.0.1], dsn=5.0.0, stat=Service unavailable
Jul  2 17:00:46 74 sendmail[6830]: m6290G1t006830: Losing ./qfm6290G1t006830: savemail panic
Jul  2 17:00:46 74 sendmail[6830]: m6290G1t006830: SYSERR(root): savemail: cannot save rejected email anywhere

google了一下, 大概知道怎么回事了,因为sendmail在解析hostname时出现问题,因此做了如下简单修改:
打开 /etc/hosts , 修改其中本机的 hostname 定义,格式如下

#ip_address host.domainname shortname
#192.168.0.84   yejr
192.168.0.84    yejr.yejr.com    yejr

就可以正常使用了 :)

相关文章: Linux 下命令行发邮件

评论

哈哈!你改hostname的话

要修改三个地方
/etc/hosts

127.0.0.1 yejr.mysql.com localhost.localdomian localhost

/etc/sysconfig/network
中的HOSTNAME=yejr.mysql.com
在command 模式下设置
hostname yejr.mysql.com

然后重新启动sendmail服务

哈哈!你改hostname的话

要修改三个地方
/etc/hosts

127.0.0.1 yejr.mysql.com localhost.localdomian localhost

/etc/sysconfig/network
中的HOSTNAME=yejr.mysql.com
在command 模式下设置
hostname yejr.mysql.com

然后重新启动sendmail服务

那是修改本机hostname并使之永久生效,我只需要sendmail能识别到其中一就够了,所以不需要改这么多地方

MySQL方案、培训、支持