|Running and troubleshooting sendmail
|Test a new sendmail configuration file before deploying it.
Running Troubleshooting sendmail
sendmail program is usually started at boot time and runs as a daemon process. The command line for starting
/usr/sbin/sendmail -bd -q15m
-bd option means
sendmail should run as a daemon, while
-q15m means that
sendmail will try to deliver email from its queue every 15 minutes. Specifying
-q1h means every hour. Other time specifications are possible, and described on the
sendmail man page.
After installing a new sendmail.cf file, you should test it for problems before deploying it. First, kill the
daemon. Then, use
argument to use an alternate configuration file:
/usr/sbin/sendmail -bd -q15m -C /testfiles/sendmail.cf
sendmail program reports on its activities in a log file. Which log file
sendmail reports to depends on the configuration of the system log, but /var/log/maillog is very common. More detailed information about what
sendmail is doing may be obtained with the
-X options. The
-X argument has
sendmail create a text file that captures all output. For example:
/usr/sbin/sendmail -bd -X/tmp/sendmail.out
This output tells
to capture all sendmail operation in the file /tmp/sendmail.out. The
option turns out debugging output. Generally, you will want to use the
, you can specify a flag to limit output. Each flag has a number and a level. The
flag, for example, sets flag 0 at level 1, which allows you to search for host names. Generally, you do not need to specify a level higher than 9, because you would get too much information. The higher the flag, the more information you will get. The flag value always is specified first.
If you specify
you will get flag 32, not level 32.
Examples and alternatives
The following command allows you to test for flag 32, which gathers all SMTP information:
/usr/sbin/sendmail -bd -d32 -X/tmp/sendmail.out
As you test
sendmail, you can use the
tail command to read the file /tmp/sendmail.out you specified above. For
tail -f /tmp/sendmail.out will let you view output to the file as
sendmail generates it.
-v option to run
sendmail in verify mode. This option has
sendmail execute without actually sending
Sendmail Configuration - Exercise