Methods to configure Sendmail as a client where all or most e-mail goes to a remote Simple Mail Transport Protocol (SMTP) server. This documentation assumes Sendmail 8.12 or higher; older versions do not have Mail Submission Agent (MSA) support, configured via the submit.cf file. Clients splitting delivery between the local system and other hosts will need to run a localhost only SMTP daemon.
The Sendmail overview diagram illustrates where the MSA fits into E-mail flow.
Three different client configurations. The no daemon option consumes the least resources, though requires crond to schedule a periodic queue run. The clientmqueue daemon option runs a daemon that drains the queue, requiring no crond runs. This option opens no network ports. The final option runs a daemon bound to the loopback interface, which allows submission of e-mail to 127.0.0.1:25 in addition to the sendmail interface.
Set a remote server for the msp FEATURE in the submit.mc configuration file, then rebuild submit.cf. Use a periodic script run under cron(8) to clean out /var/spool/clientmqueue. Message will pile up in the clientmqueue directory if the remote server is ever unavailable.
FEATURE(`msp', `mail.example.org')dnl
$ sudo crontab -l | grep sendmail
# sendmail clientmqueue runner
*/30 * * * * /usr/sbin/sendmail -L sm-msp-queue -Ac -q
This setup is well suited to systems that already use a crontab(5) job to call the queue run, such as OpenBSD.
Masquerading and other basic configuration can be done in submit.cf; more complex configuration will require a SMTP daemon.
Set a remote server for msp as above, but run a daemon to periodically clean out clientmqueue instead of using a periodic script. Easier to setup on systems like RedHat Linux, where minimal configuration is required to start up the queue runner after submit.cf has been rebuilt.
# cat /etc/sysconfig/sendmail
DAEMON=no
QUEUE=29m
# chkconfig sendmail on
# service sendmail start
Accept e-mail only on the localhost interface (via 127.0.0.1 or ::1) from local programs. This configuration is possible using my Sendmail domain-client configuration, and suits programs that can only send e-mail via SMTP.
For laptops or other systems not connected to the network, use the deferred delivery mode, and disable queue runs by default. Then only run the queue(s) should a network connection be available.
Set the confDELIVERY_MODE definition in sendmail.mc, and ensure the sendmail daemon runs without the -q option.
define(`confDELIVERY_MODE', `deferred')dnl
The confDELIVERY_MODE definition must appear below the msp feature.
FEATURE(`msp', `mail.example.org')dnl
define(`confDELIVERY_MODE', `deferred')dnl
To run the queue(s), use one or both of the following, depending on whether a localhost only daemon is being used or not. The first flushes the default mail queue (/var/spool/mqueue used by sendmail.cf), and the second /var/spool/clientmqueue (configured via submit.cf).
# sendmail -q
# sendmail -Ac -q
To check whether any e-mail is stuck in the clientmqueue directory, use mailq(1) as follows.
# mailq -Ac