Diagnose the failure of sending emails in Linux SendMail.
In Linux, Sendmail often fails to send emails due to configuration problems. The following describes some cases of failed or abnormal sending of emails.
Case 1:When sendmail is tested on the new server to send an email, it is found that the email is not successfully sent. Check the/var/log/maillog file and find the following error (Notice: replace hostname, email address, and other information with 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
This problem occurs because the oracle account does not have the permission to access/var/spool/mqueue. You need to grant related permissions as follows:
Chmod 755/var/spool/mqueue
Case 2:View the var/log/maillog file and find the following error:
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
This problem occurs because the dns server is incorrectly set and the nameserver value under/etc/resolv. conf needs to be modified.
Case 3:Check/var/log/maillog and find the following information. The mail status is Sent (stat = Sent), but the mail is still not received.
[Root @ DB-Server mail] # tail/var/log/maillog
Dec 18 11:15:01 nbolnx01 sendmail [25312]: sBI3F18J025312: from = <oracle@xxxx.xxxx>, 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 = <oracle@xxxx.xxxx>, 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)
Check mailq, as shown below. A large number of emails are found in the queue waiting for sending.
[Root @ DB-Server mail] # mailq
........................................ .........................
........................................ .........................
........................................ .........................
SBD2j1tq000440 214 Sat Dec 13 <oracle@xxxx.xxxx>
(Host map: lookup (xxxx.com): deferred)
Konglb@xxxx.com
SBD301x9000637 214 Sat Dec 13 <oracle@xxxx.xxxx>
(Host map: lookup (xxxx.com): deferred)
Konglb@xxxx.xxxx
Total requests: 120
[Root @ nbolnx01 mail] #
The error "host map: lookup (domain): deferred" is displayed, which means the email sending is delayed. You need to modify the configuration file/etc/mail/sendmail. cf. Find the line # O ResolverOptions = + AAONLY, uncomment the line, and restart the sendmail service to solve the problem.
[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]
References:
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