How to Postfix smtp relay
Published October 10, 2024 · Updated July 19, 2026 · Guides & Tutorials
Postfix is the workhorse behind most Linux email, and configuring it to relay through an authenticated SMTP host is the reliable way to make sure your server's mail actually arrives. Here is a focused guide to a Postfix SMTP relay setup.
Key relay directives
relayhost = [smtp-host]:587- where all outbound mail is sent.smtp_sasl_auth_enable = yes- turn on authentication.smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd- your credentials.smtp_tls_security_level = encrypt- force TLS.
Apply and test
Run postmap /etc/postfix/sasl_passwd, secure it with chmod 600, reload Postfix, and send a test. If mail still fails, check the maillog - authentication and TLS errors show up there clearly.
mynetworks to trusted hosts and keep the SASL password file readable only by root.A dedicated SMTP built for volume
Dedicated IP, unlimited sending, and automatic SPF/DKIM/DMARC - the throughput a business mailbox is not built for. From $39.99/mo.
Frequently asked questions
How do I set up a Postfix SMTP relay?
Set relayhost to your SMTP host on port 587, enable SASL auth and TLS, run postmap on the password file, secure it, and reload Postfix.
Why is my Postfix relay failing?
Usually authentication or TLS - check the maillog. Confirm your credentials, port 587, and smtp_tls_security_level = encrypt.