Linux sendmail发送邮件失败诊断案例(一)

在新服务器上测试sendmail发送邮件时,发现邮件发送不成功,检查日志文件发现如下错误(Notice:由于涉及公司服务器,邮箱等,故下面hostname、邮箱地址等信息使用xxx代替)

tail -40  /var/log/maillog

May 15 09:43:38 xxxxx sendmail[9182]: s4F1hcQe009182: from=root, size=58269, class=0, nrcpts=1, msgid=<201405150143.s4F1hcQe009182@xxxx>, relay=root@localhost

May 15 09:43:38 xxxxx sendmail[9182]: s4F1hcQe009182: to=konglb@xxxx, delay=00:00:00, mailer=esmtp, pri=88269, dsn=4.4.3, stat=queued

May 15 09:43:58 xxxxx sendmail[9186]: NOQUEUE: SYSERR(oracle): can not chdir(/var/spool/mqueue/): Permission denied

出现这个问题,是因为原来是(/var/spool/mqueue/)的权限配置不正确,sendmail没有权限访问这个目录,执行下面命令即可解决。

chmod 755 /var/spool/mqueue

image

此时再去测试时,发现如下错误,邮件状态一直为queued ,错误信息如下所示:


May 15 10:21:41 xxxxx sendmail[9850]: s4F2LfrT009850: to=<konglb@xxxx>, delay=00:00:00, mailer=esmtp, pri=37549, dsn=4.4.3, stat=queued

出现这个问题是因为dns server不正确设置导致,需要修改配置文件/etc/resolv.conf 下的nameserver值。

-----------------------------------------------------------------------------------------------分割线   2018-06-27-------------------------------------------------------------------------------------

最近又遇到了这个案例, 起因是因为系统管理员迁移了SMTP服务器,IP地址保持不变,但是SMPT服务器名改了,而配置文件 /etc/mail/sendmail.cf中DS使用的是mailhost

# vi /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
10.xxx.xxx.xxx  servername mailhost

而由于没有修改/etc/hosts下面的配置(使用旧的服务器名称),结果出现了上面错误现象。 其实上面所叙说的关于/var/spool/mqueue的权限是错误的。本质原因就是因为配置错误导致!

 

原文地址:https://www.cnblogs.com/kerrycode/p/3729941.html