Global
The line names a recipient domain (or a domain pattern) for which the node accepts mail regardless of the sender’s address. The directive is repeated — one line per domain.
The manual describes the default as “local domains”: what the node already considers its own, including names declared with host-name.
This is an acceptance mechanism, not a sending one. The manual says directly: the line is useful mainly where the node handles inbound mail and passes it on. If the node only sends, there is no need to list domains at all — always-allow-relaying does the job there.
To list several domains at once, domain-macro is convenient: the list name is substituted into a template like yahoo.$topLevel.
The other half: an open domain is open to everyone. By taking on a domain, the node commits to accepting mail for any address in it from anyone — and becomes a point to which anything can be sent, as long as the recipient is in that domain.
The difference is substantial. An open domain accepts mail for any address in it; a pattern rule accepts only for the addresses that match the pattern. For a node that handles service inbound mail and nothing else, the second is more precise.
What to set. Not everyone needs the line, and not always:
| Value | When |
|---|---|
| do not write it | the node only sends — the most common case |
| a specific domain | the node accepts inbound mail for this domain and passes it on |
| a pattern via a macro | there are many domains and they are similar |
If you need only a few service addresses — complaints, bounces, role addresses — relay-address is more precise: it opens an address, not the whole domain.
# the node accepts inbound mail for this domain and passes it on relay-domain example.comrelay-domain some.other.domain
what people get wrong and how it ends2 mistakes▶
§ 2.3
our experience
3 relations
domain-macroGlobalLets you list several domains in one line by substituting the list name. § 3.3.1.54.2host-nameGlobalThe node accepts its declared name as its own domain — exactly like one declared with this directive. § 3.3.1.35
Who is allowed to submit mail and for whom to accept itThe second question: not who submits to us, but for whose addresses we accept mail. § 2.3relay-addressGlobalThe neighboring way to solve the same task: there a whole domain is opened, here an individual address or pattern. § 3.3.1.54.3
grep -n 'relay-domain\|host-name' /etc/pmta/config printf 'HELO test\r\nMAIL FROM:<a@example.com>\r\nRCPT TO:<anyone@your.domain>\r\nQUIT\r\n' | nc <node-address> 25
3 articles
◇Who is allowed to submit mail and for whom to accept itOut of the box, the node accepts submission only from the machine itself; two different questions — “who can send through us” and “for whose addresses we accept mail” — are answered by different directives.◇Two inbound report processors and what to do with themBounces by message and complaints are parsed by two identically structured blocks; each has its own address list and its own pair of decisions about the message’s fate.◇Address lists — named and unnamedA list of addresses, domains, patterns or hashes; a named one is attached by directives such as suppression, an unnamed one lives inside an inbound mail processor.