Tuesday, 12 November 2013

In this post we are going to discuses about Sendmail Configuration and Troubleshoot method, as this sendmail service very much necessary for every system admin. This is the one of the most reliable simple mail system in UNIX. Mail service will run as two mode, either is Mail-Submission Mode or Daemon Mode. We used to add only Mail Relay on the mail configuration files. Let we can see the details of Configuration files.

Mail Configuration filesDescriptions
/etc/mail              Contains all mail service configuration files
/etc/mail/submit.cf    Configuration file of mail when its running Mail-submission program mode. Doesn't required root privillage
/var/spool/clientmqueueContains messages that were not delivered to the sendmail daemon
/etc/mail/sendmail.cf  Configuration file of mail when its running daemon mode. Required root privillage
/var/spool/mqueuesendmail.cf runs the main queue, /var/spool/mqueue.
/etc/mail/aliasesConfiguration file of Mailbox aliases
/etc/default/sendmailSendmail Configuration file where we can set our required variables
Send Mail Daemons
[root@unixrock ~]# ps -ef|grep -i sendmail|grep -v grep
    root 11209  7451   0   Nov 06 ?           0:16 /usr/lib/sendmail -bl -q15m
   smmsp 11208  7451   0   Nov 06 ?           0:02 /usr/lib/sendmail -Ac -q15m
[root@unixrock ~]#
  • -bd option is intended to set the daemon to listen on port 25 and dequeue every 15m with -q15m
  • -Ac Uses submit.cf even if  the  operation  mode does  not  indicate  an initial mail submission.
How to confirm whether mail service is working fine after checking the sendmail process.
[root@unixrock ~]# mailx -s "test messages from unixrock" rajkumar.surendran@unixrock.com
this is the test messages from unixrock
EOT
[root@unixrock ~]#
If you not get this test mail on your inbox, please check the following. Check /var/adm/messages which relay host is pointing to. Below output shows that mail has delivered through mailhost relay server.
Nov 12 12:32:54 unixrock sendmail[16004]: [ID 801593 mail.info] rACHWsxK016004: to=rajkumar.surendran@unixrock.com, ctladdr=root (0/0),xdelay=00:00:00, mailer=relay, pri=30142, relay=mailhost [10.223.255.45], dsn=2.0.0, stat=Sent (rACHWsK12571 Message accepted for delivery)
[root@unixrock ~]#
Check mail relay server in /etc/mail/submit.cf
[root@unixrock ~]# grep DS /etc/mail/submit.cf
DSmailhost
# Return-Receipt-To: header implies DSN request
# DHParameters (only required if DSA/DH is used)
[root@unixrock ~]#
if you not find the relay server in /etc/mail/submit.cf, then we have to add the appropriate mailrelay server according to your environments. Check whether mail port (port 25) is listening
[root@unixrock ~]# telnet mailhost 25
Trying 10.223.255.45...
Connected to mailhost.
Escape character is '^]'.
220 mailout.cwshs.com ESMTP Sendmail 8.11.6/8.11.6; Tue, 12 Nov 2013 13:41:31 -0500
^]
telnet> quit
Connection to mailhost closed.
[root@unixrock ~]#
Thanks for reading this post, if you have any doubt please comment, i will respond you at earliest possible.