Sometimes it becomes too difficult to troubleshoot sendmail problems. Here are some of the most commonly faced sendmail issues.
Sendmail Configuration files
/etc/mail/sendmail.cf | Defines environment for sendmail |
/etc/mail/submit.cf | Defines environment for MSP (Mail submission program) |
Sendmail Daemons
Solaris 9 uses 2 queue paradigm and thus there are 2 sendmail daemons
/usr/lib/sendmail -Ac -q15m /usr/lib/sendmail -bd -q15m
In Solaris 8 and below, there is 1 queue and 1 daemon
/usr/lib/sendmail -bd -q15m
Check SMTP server connection
Sendmail uses port 25 to connect to the SMTP server. Make sure that the system is able to telnet to the SMTP server on port 25. Sometimes a firewall may block the port 25. and thus failing the sendmail. Telnet to the SMTP server on port 25 confirms this as shown below :
# telnet SMTP_server 25 Trying 192.168.2.20... telnet: Unable to connect to remote host: Connection refused
Try verbose delivery
The -v option when used with mailx, shows every step in the mail delivery. Many of the times it shows the step at which the problem is.
# mailx -v -s "test subject" john@example.com < /dev/null
Sending email in debugging mode
To make sure the sendmail can send mails, we can use the debugging mode of sending a mail. For this telnet the SMTP server on port 25 :
# telnet geeklabmail.example.com 25 Trying 0.0.0.0... Connected to 0. Escape character is '^]'. 220 geeklabmail ESMTP Sendmail 8.14.4+Sun/8.14.4; Sun, 12 Jan 2014 15:50:48 +0530 (IST)
Type help to list all the available commands :
help 214-2.0.0 This is sendmail version 8.14.4+Sun 214-2.0.0 Topics: 214-2.0.0 HELO EHLO MAIL RCPT DATA 214-2.0.0 RSET NOOP QUIT HELP VRFY 214-2.0.0 EXPN VERB ETRN DSN STARTTLS 214-2.0.0 For more info use "HELP [topic]". 214-2.0.0 To report bugs in the implementation contact Sun Microsystems 214-2.0.0 Technical Support. 214-2.0.0 For local information send email to Postmaster at your site. 214 2.0.0 End of HELP info
Follow the below commands (in bold) to send the email step-by-step :
helo john@example.com 250 john@example.com Hello john@example.com [xx.xx.xx.xx], pleased to meet you mail from:geek@example.com 250 2.1.0 geek@example.com... Sender ok rcpt to:john@example.com 250 2.1.5 john@example.com... Recipient ok data 354 Enter mail, end with "." on a line by itself subject: This is a test message to:john@john.com Test message. End the message by "." on next line. . 250 2.0.0 m3L9aH0W018247 Message accepted for delivery quit 221 2.0.0 geeklabmail.example.com closing connection
Verify the sendmail processes are running
The first step in sendmail troubleshooting should be verifying that the sendmail daemons are running.
For Solaris 9 and above :
# ps -ef |grep sendmail root 516 1 0 Mar 19 ? 1:16 /usr/lib/sendmail -bd-q15m smmsp 515 1 0 Mar 19 ? 0:04 /usr/lib/sendmail -Ac -q15m
# /usr/ucb/ps -auxwww | grep sendmail root 6043 0.1 0.1 1280 968 console S 18:18:03 0:00 grep sendmail root 516 0.0 0.2 8240 2648 ? S Mar 19 1:16 sendmail:accepting connections smmsp 515 0.0 0.1 8240 2216 ? S Mar 19 0:03 sendmail:Queue runner@00:15:00 for /var/spool/clientmqueue
For Solaris 8 and below :
# ps -ef | grep send root 271 1 0 Mar 10 ? 0:01 /usr/lib/sendmail -bd -q15m
# /usr/ucb/ps -auxwww | grep sendmail root 271 0.0 0.3 4288 1512 ? S Mar 10 0:00 sendmail:accepting connections
Starting Sendmail daemon
In case the sendmail daemon is not running, start it using below commands :
For Solaris 9 and below:
# /etc/init.d/sendmail start
For Solaris 10 and above :
# svcadm enable svc:/network/smtp:sendmail # svcadm enable svc:/network/sendmail-client
Check for the /var/log/syslog audit log file for the messages related to start of sendmail daemon to confirm.
Verify that all configuration files are present
Make surre that all the configuration files are presenr under the sendmail configuration directory. Especially the file sendmail.cf and submit.cf
# ls -lairt /etc/mail total 364 4721 -rw-r--r-- 1 root bin 163 Jan 22 2005 Mail.rc 89143 -r--r--r-- 1 root bin 39953 Sep 3 2009 local.cf 89137 -rw-r--r-- 1 root bin 5512 Aug 6 2010 helpfile 2335 -rw-r--r-- 1 root bin 1839 Jun 28 2011 mailx.rc 89147 -rw-r--r-- 1 root bin 5 Jun 28 2011 trusted-users 89145 -r--r--r-- 1 root bin 40559 Jun 28 2011 submit.cf 89144 -r--r--r-- 1 root bin 40118 Jun 28 2011 sendmail.cf 89146 -rw-r--r-- 1 root bin 0 Jun 28 2011 local-host-names 89142 -rw-r--r-- 1 root bin 1423 Jun 28 2011 aliases 89134 lrwxrwxrwx 1 root root 11 Dec 6 10:46 main.cf -> sendmail.cf 89135 lrwxrwxrwx 1 root root 8 Dec 6 10:46 sendmail.hf -> helpfile 89136 lrwxrwxrwx 1 root root 11 Dec 6 10:46 subsidiary.cf -> sendmail.cf 71233 drwxr-xr-x 9 root mail 512 Dec 6 10:46 cf 1875 drwxr-xr-x 3 root mail 512 Dec 6 10:59 . 91727 -rw-r----- 1 root smmsp 40960 Dec 6 10:59 aliases.db 75 drwxr-xr-x 88 root sys 4608 Jan 11 20:37 ..
Verify correct entry of Mailgateway in sendmail.cf
In Solaris 9 and above :
# grep DS sendmail.cf DS # grep Fallback sendmail.cf O FallbackSmartHost=mailhost$?m.$m$.
In Solaris 8 and below :
# grep DS sendmail.cf DSmailhost$?m.$m$
Route local messages to the localhost port 25.
Make sure the local messages are routed to the localhost port 25.
# grep MTAHost submit.cf D{MTAHost}[127.0.0.1] # grep DS submit.cf DS
Any changes to the configuration files, requires the refresh the sendmail service.
Wrong permissions
If any of the sendmail configuration file has a wrong permission, the sendmail daemon would not work properly. There is a script that comes bundled with sendmail to verify the permissions of the sendmail related files in /etc/mail directory. To be able to run the script stop the sednmail daemon and then run the script :
# /usr/lib/mail/sh/check-permissions
The above script does not check all the sendmail files like user /var/spool/mqueue etc. In order to check permissions of all files use the command :
# /usr/lib/sendmail -bv -d44.5 -v john@example.com
Other important files that should have proper permissions are :
# ls -ild /var/spool/mqueue 71249 drwxr-x--- 2 root bin 512 Dec 6 10:46 /var/spool/mqueue
# ls -ild /var/spool/clientmqueue/ 71248 drwxrwx--- 2 smmsp smmsp 512 Dec 6 10:59 /var/spool/clientmqueue/
The sendmail command with -d44.5 switch also verifies the mqueue and clientmqueue permissions.
Contact support
In case of any of the above troubleshooting doesn’t help, log a support case with Oracle and provide support team with below data.
1. Explorer
Run the explorer command with options to collect data about zones, syslog files and smf logs :
# /opt/SUNWexplo/bin/explorer -w default,localzones,smfextended,syslogs
2. Sendmail configuration files
# cd /etc/mail # tar cvf /tmp/mail.tar . # compress /tmp/mail.tar
3. Sendmail version
Provide sendmail version, compile options and system identity :
# /usr/lib/sendmail -d0.4 < /dev/null
4. Test mail
Send the output of a test mail command :
# /usr/bin/mailx -s "test message" -v john@example.com < /dev/null