Postfix is a Mail Transfer Agent (MTA). It is designed to be drop-in replacement for the less secure sendmail and is to be preferred when sendmail is specified. I install it on all my Linux boxes in order to receive security alerts and other important system messages via local mail.
Before installing postifx, insure the box has been given a fully qualified domain name.
Install postfix using your distribution’s package manager.
Once installed, edit /etc/postfix/aliases as root and change the line root: postfix to root: USER, substituting the username of who is to receive local mail. If you do not want to be bothered by system messages, you can alternatively set it to “root” and they will be silently discarded. I don’t recommend this, however.
Start the postifx service: as root, service postfix start. Confirm that the service is configured to start on boot.
Local mail is now working. To view system messages, your options are:
- The command line tool mailx is unintuitive but is ubiquitous, lightweight, and works out of the box.
- Configure your mail client to receive them, which is my preferred option. Not all mail clients can directly read system mail (e.g. Evolution can; Opera Mail can’t). If your mail client can’t, then a workaround is to set up a local POP or IMAP mail server to expose the system mail to your mail client.
TODO: Document how to generate a system mail message for testing. Presumably sending yourself a message from mailx is good enough.
TODO: Isn’t postfix overkill for local mail? When installing smartmontools on LMDE, heirloom-mailx was a dependency but neither postfix nor any other MTA was, or even suggested.
Postfix meets my needs, but Exim, Qmail, and Masqmail all have their fans. Sendmail does too, but authorities consider it insecure.
For the particular objective considered here — receiving local system mail — Nullmailer might be a good option, forwarding local system mail to your normal mailbox off the local box.
Another good description of the same task