100% Inbox Delivery

HomeBlog › How to Linux smtp relay

How to Linux smtp relay

Published October 20, 2024 · Updated July 18, 2026 · Guides & Tutorials

On a Linux server, sending email reliably usually means configuring a relay — pointing your system's mail through an authenticated SMTP smart host instead of trying to deliver directly. Direct delivery from a Linux box tends to land in spam or get blocked outright. Here is how to set up a Linux SMTP relay the dependable way.

Why relay instead of sending directly

A fresh Linux server has no sending reputation, its IP may be on a shared or blocked range, and port 25 is often filtered. Relaying through an authenticated SMTP smart host solves all three: you inherit a trusted IP, proper authentication, and a port that is not blocked.

How to configure a relay with Postfix

  1. Install Postfix (the most common Linux mail agent).
  2. In /etc/postfix/main.cf, set relayhost = [your-smtp-host]:587.
  3. Enable SASL authentication and point it at a credentials file with your SMTP username and password.
  4. Turn on TLS so the connection is encrypted.
  5. Reload Postfix and send a test with sendmail or mail.
Secure the credentials: Keep your SASL password file readable only by root (chmod 600), and never expose the relay to the public internet as an open relay. Restrict who can send through it.
Related reading: have 2 domains on one host · open a google business email account · free email tools
A smart host that delivers

Point your Linux server at a dedicated SMTP

Dedicated IP, port 587, and SPF/DKIM/DMARC ready — the reliable smart host your Postfix relay needs. From $39.99/mo.

How our SMTP works →See plans

Frequently asked questions

How do I set up an SMTP relay on Linux?

Install Postfix, set relayhost to your SMTP smart host on port 587, enable SASL authentication and TLS, then reload and test.

Why not send email directly from Linux?

Fresh servers lack reputation, may sit on blocked IP ranges, and port 25 is often filtered. Relaying through an authenticated smart host is far more reliable.

What smart host should I use?

A dedicated SMTP with its own IP and full authentication — it gives your Linux relay trusted delivery and no daily caps.