Simple way to get mail off the system – nullmailer and nail

nullmailer

Nullmail provides a sendmail implementation that forwards the mails though a smtp-server.  You have to set up some basic information in nullmailer’s config files. Which address to send from, which domain to use if only a username is provided and the smtp server through which to do the actual sending.

mignon@hades nullmailer % sudo tail -n+1 *
==> adminaddr <==
root@eleusis.se

==> defaultdomain <==
eleusis.se

==> me <==
eleusis.se

==> remotes <==
smtp.eleusis.se smtp auth-login user=******@eleusis.se pass=******** port=587 starttls
nail

Some existing scripts / software doesn’t invoke sendmail directly to send mail but expects the mail command to be present on the system (mdadm, smartd…). For those we can simply install the nail which will provide minimal mail and mailx commands and will with an empty configuration file send via nullmailers sendmail just like we want.

One could actually use nail exclusively as it also has support for sending via an smtp server directly. But other packages had dependencies on virtual/mta (Gentoo) that pulled in nullmailer (unless other mta installed) anyways.