In this post, we are going to discuss the Sendmail Configuration and Troubleshoot method, as this Sendmail service very much necessary for every system admin. This is one of the most reliable simple mail system in UNIX. Mail service will run as two-mode, either 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 the Configuration files.
|Mail Configuration files||Descriptions|
|/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/clientmqueue||Contains 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/mqueue||sendmail.cf runs the main queue, /var/spool/mqueue.|
|/etc/mail/aliases||Configuration file of Mailbox aliases|
|/etc/default/sendmail||Sendmail Configuration file where we can set our required variables|
Send Mail Daemons
To check what deamons are run by sendmail, use below command:
# 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 #
-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.
Let’s send a test email.
# mailx -s "test messages from geeksearch" email@example.com this is the test messages from geeksearch EOT #
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 geeksearch sendmail: [ID 801593 mail.info] rACHWsxK016004: firstname.lastname@example.org, 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) #
Check mail relay server in /etc/mail/submit.cf:
# grep DS /etc/mail/submit.cf DSmailhost # Return-Receipt-To: header implies DSN request # DHParameters (only required if DSA/DH is used) #
if you do 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:
# 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. #