extsmail masquerades as the standard UNIX sendmail
program, reading messages, and piping them to user-defined commands until
sending succeeds. It is particularly useful if you want to send email via
commands that assume a fault-free network, for example via
msmtp (to an external SMTP server) or
ssh
(to a server running a full sendmail
-compatible
MTA). extsmail is not a full SMTP server. It doesn’t need root
privileges. It can run as a daemon, or as a batch job (e.g. via
cron
). It is designed to have sensible defaults, and configuring it
is a quick, one-off job.
Latest release: extsmail-2.8 (2023-03-22)
Fix bug where a child’s stderr could be only partly read.
Fix bug where stderr could be closed twice.
Repository (issues, PRs, etc.)
Documentation:
Man pages:
If you don’t like reading manuals, most per-user configurations of extsmail can be accommodated with the following commands:
$ ./configure $ make $ make install $ mkdir -m 700 -p ~/.extsmail/spool_dir $ echo spool_dir = \"~/.extsmail/spool_dir\" > ~/.extsmail/conf
If you want to send e-mail to another machine via ssh
, you then
need to create the file ~/.extsmail/externals
and put in the
following configuration:
group { external mymachine { sendmail = "/usr/bin/ssh -q -C -l user mymachine.net /usr/sbin/sendmail -t" } }
where mymachine
is a human-friendly name given to an
external (it does not effect processing), and user
is your
username on the remote machine mymachine.net
.
If instead you want to use msmtp, your
~/.extsmail/externals
file will look as follows:
group { external mymachine { sendmail = "/usr/local/bin/msmtp -a myaccount" } }
where mymachine
is a human-friendly name given to an
external (it does not effect processing), and myaccount
is
the msmtp account you want to send mail as.
You can then run extsmaild
either as a batch mode process (e.g.
from cron) or, generally better, as a daemon, started from a start-up script
(e.g. ~/.xsession
):
extsmaild -m daemon
You then need to configure whatever programs you’re using to send mail to use extsmail instead of
your normal sendmail binary. extsmaild
will use syslog
for logging (typically logging into /var/log/maillog
).
And with that you’re done. If you want to do something more complex you’ll need to read the detailed instructions ( extsmail comes with complete man page documentation), but the above works perfectly well for the majority of cases.
extsmail is a C application. It should be trivially portable to any POSIX compliant operating system. It can be installed as follows:
$ ./configure $ make $ make install
Please note that if, and only if, you are building from the git repository you will first need to execute make -f Makefile.bootstrap
to build the configure
script.
extsmail
was originally created by Laurence Tratt. Olivier Girondel
has been a major contributor since v1.8.