See also the example Sendmail configurations for mail server, proxy, and other roles. Consult Sendmail Client Configuration to configure Sendmail to send all local e-mail to a remote Simple Mail Transport Protocol (SMTP) server. Example permissions for sendmail 8.12 and up.
E-Mail Flow
The following image shows a general outline of the flow of e-mail through Sendmail, configuration files and queue directories, and logging. The image is explained below.
- E-mail from the Internet will usually arrive via the SMTP at Transmission Control Protocol (TCP) port 25 on a mail server. This incoming e-mail is handled by sendmail run as a daemon via the -bd option, using the /etc/mail/sendmail.cf configuration file.
- E-mail from a system will either be delivered to sendmail via standard input, or via SMTP to a daemon. Some programs such as mail or mutt will only support the sendmail interface, while others like Mozilla only SMTP, and still others both, like pine, or mutt with patches. If in doubt, consult the configuration of the client in question, or use process debugging tools.
- Some vendors supply a sendmail.mc, and others freebsd.mc or nothing to rebuild sendmail.cf from. Vendors may also change the locations of various files: Sendmail may appear as /usr/lib/sendmail or /usr/sbin/sendmail (or both). Run Sendmail as follows to show important file locations:
- Logs from sendmail are issued to syslogd via syslog(3); usually, the destination of these logs is controlled via the standard /etc/syslog.conf configuration file. Some systems will use different daemons to handle syslog(3), such as syslog-ng. More information on logging is available.
E-mail passing through this daemon may be saved under the /var/spool/mqueue directory before being delivered elsewhere: to another system, or a Local Delivery Agent (LDA) such as procmail. Use mailq to list the contents of this default queue directory, and sendmail -q to force a queue run.
$ sudo mailq
/var/spool/mqueue/df (1 request)
-----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient-------
i99I41HC004652 58 Sat Oct 9 11:04 <postmaster@example.org>
<postmaster@example.org>
Total requests: 1
$ sudo /usr/sbin/sendmail -q
Sendmail does not handle local mail delivery. Instead, a LDA handles saving the messages, usually somewhere under /var/mail or /var/spool/mail. Look for Mlocal in sendmail.cf to see what LDA a system uses:
$ grep ^Mlocal /etc/mail/sendmail.cf
Mlocal, P=/usr/local/bin/procmail, F=lsDFMAw5:/|@qSPfhn9,↵
S=EnvFromL/HdrFromL, R=EnvToL/HdrToL,
In Sendmail 8.12 and higher, local e-mail to sendmail is handled by the Mail Submission Agent (MSA), which is configured via the submit.cf file. The MSA will attempt to deliver e-mail via port 25 or 587 (Submission). To configure this destination, set the msp FEATURE in submit.mc and rebuild submit.cf.
$ grep msp /etc/mail/submit.mc
FEATURE(`msp', `[127.0.0.1]')dnl
E-mail passing through the MSA may be saved under the /var/spool/clientmqueue directory. Use mailq -Ac to list the contents of this default queue directory, and sendmail -q -Ac to force a queue run.
$ /usr/sbin/sendmail -d0.13 </dev/null | grep file
Conf file: /etc/mail/submit.cf (default for MSP)
Conf file: /etc/mail/sendmail.cf (default for MTA)
Pid file: /var/run/sendmail.pid (default)
Conf file: /etc/mail/submit.cf (selected)
Pid file: /var/spool/clientmqueue/sm-client.pid (selected)
Documentation & Links
- CipherList Support - why and how to alter the CipherList feature for Transport Layer Security (TLS) support.
- Sendmail Client Configuration - how to configure Sendmail as a simple client.
- Compiling Sendmail with TinyCDB - TinyCDB is a fast public domain database similar to Berkeley DB.
- Discard all e-mail configuration for Sendmail.
- Relaying with TLS in Sendmail - how I configure my Mac OS X laptop to do roaming TLS encrypted mail relaying through my dedicated mail server.
- Ruleset examples and tips.
- Sendmail on Mac OS X - configuration and administration on Mac OS X.
- Sendmail and SMTP AUTH on Mac OS X - how to setup SASLv2 on Mac OS X 10.2.
- SMTP AUTH and STARTTLS - old presentation on the SMTP AUTH and STARTTLS e-mail protocols in Sendmail.
- Tips and pointers.
Related Pages
- Sendmail Configurations - stock configurations for various roles (client, proxy, server).
- Using Clam AntiVirus with MIMEDefang - what I use to keep Microsoft malware at bay.
- Clam AntiVirus Milter Setup and Debugging.
- Milter Date - sanity check on mail message dates to eliminate spam.