Should a fleet of application servers deliver outbound mail directly to recipients' MX hosts or through a central smart host, and what does each choice cost?
answer
- who owns the queue and retries
- port 25 egress and reverse DNS
- one reputation instead of many
- a dependency that must be redundant
- in-house relay versus outside service
basics
~20 sUsually through a smart host: one relay owns queuing, retries, signing, rate limits and sending reputation, and application servers need no port 25 egress. The cost is a critical dependency that must be redundant and must never relay for strangers.
solid answer
~50 sA **smart host** is an administratively configured relay that sits between your senders and the recipients' MX hosts (the term RFC 8461 uses). With **direct delivery**, every application server does its own MX lookups, holds its own queue and retries, needs outbound port 25 (which many networks block, as RFC 6409 notes), needs matching forward and reverse DNS, and builds a sending reputation per address that your sender-policy records must authorise. With a smart host, applications hand off quickly (in Postfix, `relayhost = [relay1.example.com]:587`, where the brackets turn off MX lookup), and one place handles queuing, signing, rate limits, logs and reputation. The costs are a dependency that needs at least two relays and local queuing on each sender, a relay policy that must not trust whole subnets, and, if the relay is an outside service, shared reputation and content visibility. Volume, compliance and whether transactional and bulk mail need separate reputations decide the rest.
code
ini · 8 lines# Postfix main.cf on an application server
# hand everything to two smart hosts; brackets skip MX lookup
relayhost = [relay1.example.com]:587, [relay2.example.com]:587
# accept mail only from local processes, keep a local queue
inet_interfaces = loopback-only
mynetworks_style = host
# authenticate to the relays (details: submission auth)
smtp_sasl_auth_enable = yesgo deeper
Know the term: a smart host is a relay you configure your servers to hand all outbound mail to, instead of each server delivering to recipients' MX hosts itself.
Explain what moves to the smart host: MX lookups, queue and retry, port 25 egress, reverse DNS and signing. Show the Postfix relayhost setting with brackets that skip MX lookup.
Make the relay path survive failure: two or more relays, local queues on senders, monitored queue depth, and a relay policy that authenticates applications instead of trusting a subnet.
Own the trade: direct delivery, in-house smart hosts or an outside relay service, weighed on reputation isolation, data handling, operating cost and failure blast radius, and write the decision down.
## Two designs An organisation with many application servers, such as web front ends, batch jobs and monitoring, has to choose how their mail leaves. - **Direct delivery.** Each server runs a full MTA that looks up the recipient domain's MX records, connects to the exchanges on port 25, and queues and retries on its own. - **Smart host.** Each server hands every message to one or more designated relays. RFC 8461 defines a smart host as "an administratively configured intermediate SMTP relay, which is different from the message recipient's server as determined from DNS". Only the relays talk to the outside world. | Concern | Direct delivery | Through a smart host | |---|---|---| | Outbound port 25 | Needed from every server | Needed only from the relays | | Forward and reverse DNS | Must be right for every sending address | Must be right for the relays only | | Queue and retry | Spread across the fleet | Concentrated on the relays | | Reputation | One per server address, often thin | One small set of addresses to build and watch | | Signing, TLS policy, rate limits | Configured on every server | Configured once | | Failure blast radius | One server's mail | Every server's mail, unless the relays are redundant | | Visibility | Logs scattered across hosts | One log stream to search | ## What a smart host centralises - **Egress.** RFC 6409 notes that many sites prohibit outbound traffic on port 25 and funnel submissions through submission servers. With a smart host, only the relays need port 25 open. - **Identity work.** Reverse DNS, sender-policy records and signing keys are maintained for a few relay addresses instead of every host. The record details are covered with SPF and DKIM. - **Reputation.** Receivers judge sending addresses. A few busy, well-run relay addresses build a steadier reputation than dozens of servers that each send a handful of messages. - **Policy and evidence.** Rate limits, per-application quotas, TLS requirements and a single searchable log live in one place, and the `Received` entries show one consistent hop. ## What it costs - **A critical dependency.** If the relay is down, nobody sends. Run at least two. Postfix 3.5 and later accepts several `relayhost` destinations and tries them in order, and `smtp_fallback_relay` can take over on temporary failures. - **Local buffering.** An application that speaks SMTP to the relay synchronously stalls when the relay is slow. A local MTA bound to loopback, with its own queue, keeps the application fast and holds mail through a relay outage. - **The relay's own relay policy.** The smart host must relay only for your senders. Trusting a whole subnet by IP means any compromised host in it can send. Authenticating each application makes senders identifiable and revocable. The mechanics are covered with submission authentication. - **Capacity.** Every message now crosses the relays, so their queue disks, connection limits and DNS lookups have to be sized for the whole fleet. ## In-house relay or an outside relay service The same choice repeats one level up: run the smart hosts yourself, or hand mail to an outside relay service. - **In-house** keeps content and logs inside your boundary and gives you full control of addresses and policy. It also leaves you to build reputation, handle bounces and abuse reports, and keep the relays patched. - **An outside service** brings established sending addresses and operations staff. It also means its other customers can affect the reputation you share, it sees every message you send, its limits and outages become yours, and it has to be authorised in your sender-policy and signing records. Many organisations split traffic: transactional mail such as password resets through one path with its own addresses, and bulk marketing through another, so that complaints about one stream do not delay the other. ## A way to decide 1. **Count the senders and the volume.** One server sending a few alerts can deliver directly. A fleet should not. 2. **Check the network.** If outbound port 25 is blocked or restricted where the applications run, the decision is already made. 3. **List the controls you must enforce.** Signing, TLS policy, quotas and retention are far easier on two relays than on fifty hosts. 4. **Decide on reputation separation.** Do transactional and bulk mail need separate addresses or separate relays? 5. **Decide where content may go.** Data-handling rules may forbid an outside relay for some mail. 6. **Design for failure.** Two or more relays, local queues on senders, and monitoring of queue depth on both sides. There is no single right answer. A small estate can run direct delivery well, while a large one rarely can. What a lead owns is writing the choice down, along with who maintains the relay policy and the addresses.
- Why does Postfix's relayhost value usually put the smart host's name in square brackets?Without brackets, Postfix treats the name as a domain and looks up its MX records. With `[relay1.example.com]`, it turns off MX lookup and connects to that host's own addresses. For a smart host you want the named machine, not whatever MX records a domain of that name might publish.
- How do you keep the smart host itself from becoming an open relay?Grant relay only to your senders: authenticated clients, or a short list of exact host addresses. Refuse every other client for outside domains. Keep the relay off the public MX set, test from outside after each change, and watch per-sender volume so that a compromised application stands out quickly.
- A smart host is just another name for the domain's inbound MX.
- One relay is enough; mail will simply wait if it goes down.
- Trusting the whole application subnet by IP is as safe as authentication.
- Direct delivery from every server gives better reputation through more addresses.
- An outside relay service removes the need for sender-policy records.