How to Postfix relay smtp
Published October 12, 2024 · Updated July 22, 2026 · Guides & Tutorials
Postfix is the most popular mail server on Linux, and one of its most useful roles is as a relay — a "null client" that hands all outbound mail to a trusted smart host instead of delivering it itself. This is the reliable way to make a server's email actually arrive. Here is how to configure a Postfix relay.
Why run Postfix as a relay
A server sending mail directly usually fails: no reputation, filtered ports, blocked IPs. Configuring Postfix to relay through an authenticated smart host gives every application on the box trusted, authenticated delivery through one clean IP.
Postfix relay configuration
- In
/etc/postfix/main.cf, setrelayhost = [smtp-host]:587. - Enable SASL:
smtp_sasl_auth_enable = yesand pointsmtp_sasl_password_mapsat your credentials file. - Enable TLS:
smtp_tls_security_level = encrypt. - Run
postmapon the password file, thensystemctl reload postfix. - Test with
echo | mail -s test [email protected].
chmod 600 your SASL password file and restrict which local networks can inject mail (mynetworks). An unrestricted Postfix is an open relay waiting to be abused.Relay Postfix through a dedicated SMTP
Dedicated IP, port 587, and SPF/DKIM/DMARC ready — the trusted smart host for your Postfix relay. From $39.99/mo.
Frequently asked questions
How do I configure Postfix as a relay?
Set relayhost to your smart host on port 587, enable SASL authentication and TLS, run postmap on the password file, and reload Postfix.
What is a Postfix null client?
A Postfix setup that sends all outbound mail to a smart host and accepts no local delivery — ideal for app servers that only need to send.
What smart host should Postfix use?
A dedicated SMTP with its own IP and full authentication, so your relayed mail is trusted and delivered.