Postfix: The Default Mail Transfer Agent
Postfix is almost certainly already installed on your server, and the question is which of its two very different jobs you want.
Two completely different deployments
A full mail server receiving mail for a domain. That means Postfix for SMTP plus Dovecot for IMAP, DKIM signing, spam filtering, and the whole apparatus. Our self-hosted email post covers why this is genuinely difficult, and Mailcow or Mail-in-a-Box orchestrate it for you.
A send-only relay so cron, monitoring and applications can send mail through an existing provider. This is what most people actually need, and it is twenty minutes of configuration.
Confusing the two is the single most common mistake in this area.
The relay configuration
# /etc/postfix/main.cf
myhostname = server.example.com
relayhost = [smtp.example.com]:587
inet_interfaces = loopback-only
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_security_level = encrypt
inet_interfaces = loopback-only is the security-critical line. It stops Postfix listening for incoming connections, which is what you want on a send-only host. Without it you have a mail server on the internet, and an open relay is worse than no mail at all.
Our sending mail guide covers this configuration in full, including the canonical maps that rewrite root@localdomain into a deliverable address, which is the usual reason a relay setup fails after the credentials are right.
Postfix or msmtp
For send-only, msmtp is smaller: one config file, no daemon, no listening socket at all.
Postfix’s advantage is queueing. If the relay is unreachable, Postfix holds the message and retries; msmtp fails and the mail is gone. For backup reports and alerts that is a real difference.
mailq
postqueue -f
tail -f /var/log/mail.log
Why it has the reputation it does
Postfix is genuinely well engineered: a set of small, separately privileged processes rather than one monolith, which is why its security record is excellent for software of its age and exposure.
The configuration is large because mail is large, and postconf -n showing only your non-default settings is the way to read someone else’s.
Operational caution
Route root’s mail somewhere you read it. A great deal of software mails root by default, and root@yourhostname is deliverable nowhere.
echo 'root: you@example.com' | sudo tee -a /etc/aliases && sudo newaliases
License
Postfix is released under the IBM Public License 1.0 and the Eclipse Public License 2.0.