大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。
Jetbrains全系列IDE稳定放心使用
Linux SendMail发送邮件失败诊断案例,sendmail发送邮件
Linux上Sendmail经常由于一些配置问题,导致邮件发送失败,下面整理、收集了一些邮件发送失败、异常的案例。
案例1:在新服务器上测试sendmail发送邮件时,发现邮件发送不成功,检查/var/log/maillog日志文件发现如下错误(Notice:hostname、邮箱地址等信息使用xxx代替)
tail /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
出现这个问题,是因为oracle账号没有权限访问/var/spool/mqueue,需要授予相关权限,如下所示:
chmod 755 /var/spool/mqueue
案例2:查看var/log/maillog日志文件发现如下错误
May 15 10:21:41 xxxxx sendmail[9850]: s4F2LfrT009850: to=, delay=00:00:00, mailer=esmtp, pri=37549, dsn=4.4.3, stat=queued
出现这个问题是因为dns server不正确设置导致,需要修改/etc/resolv.conf 下的nameserver值。
案例3:检查/var/log/maillog发现如下信息,邮件状态为Sent(stat=Sent),但是依然没有收到邮件。
[root@DB-Server mail]# tail /var/log/maillog
Dec 18 11:15:01 nbolnx01 sendmail[25312]: sBI3F18J025312: from=, size=607, class=0, nrcpts=1, msgid=<201412180315.sBI3F12b025302@nbolnx01.xxxx.xxxx>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Dec 18 11:15:01 nbolnx01 sendmail[25302]: sBI3F12b025302: to=oracle, ctladdr=oracle (502/502), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30290, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (sBI3F18J025312 Message accepted for delivery)
Dec 18 11:15:01 nbolnx01 sendmail[25327]: sBI3F1mw025327: from=, size=599, class=0, nrcpts=1, msgid=<201412180315.sBI3F1Ba025321@xxxx.xxxx>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Dec 18 11:15:01 nbolnx01 sendmail[25321]: sBI3F1Ba025321: to=oracle, ctladdr=oracle (502/502), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30282, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (sBI3F1mw025327 Message accepted for delivery)
检查mailq,如下所示,发现大量邮件处于等待发送的队列
[root@DB-Server mail]# mailq
………………………………………………………..
………………………………………………………..
………………………………………………………..
sBD2j1tq000440 214 Sat Dec 13 10:45
(host map: lookup (xxxx.com): deferred)
konglb@xxxx.com
sBD301x9000637 214 Sat Dec 13 11:00
(host map: lookup (xxxx.com): deferred)
konglb@xxxx.xxxx
Total requests: 120
[root@nbolnx01 mail]#
出現了”host map: lookup (domain): deferred”错误,意味着邮件的发送被延迟了。需要通过修改配置文件/etc/mail/sendmail.cf。找到 #O ResolverOptions=+AAONLY 这一行信息后将注释取消掉,然后重启sendmail服务即可解决问题。
[root@DB-Server ~]# service sendmail stop
Shutting down sm-client: [ OK ]
Shutting down sendmail: [ OK ]
[root@DB-Server ~]# service sendmail start
Starting sendmail: [ OK ]
Starting sm-client: [ OK ]
参考资料:
http://www.51osos.com/a/Linux_CentOS_RedHat/Linuxjichu/2010/1001/107.html
http://www.cnblogs.com/AloneSword/archive/2013/07/20/3203050.html
http://blog.chinaunix.net/uid-11888131-id-2804023.html
http://fanli7.net/a/caozuoxitong/OS/20120703/180401.html
http://blog.csdn.net/kindy1022/article/details/7639096
http://www.dengb.com/Linuxjc/928972.htmlwww.dengb.comtruehttp://www.dengb.com/Linuxjc/928972.htmlTechArticleLinux SendMail发送邮件失败诊断案例,sendmail发送邮件 Linux上Sendmail经常由于一些配置问题,导致邮件发送失败,下面整理、收集了一些邮件发…
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/179913.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...