Knowledge base

<rewrite-list>

Rules for rewriting the return address and the From header
Who the message presents itself as — and where the bounce returns

The block gathers rules for substituting two different things. mail-from changes the envelope return address — the one the bounce returns to and the one SPF checks. from-domain changes the domain in the From header — the one the recipient sees in the mail program.

These are different addresses, and confusing them is costly. The envelope is invisible to the recipient and serves delivery; the header is visible and serves trust. A rule written in the wrong line changes something other than intended.

The list is attached to a source. The manual says plainly: to use it, you must name it in a <source> block. References from <virtual-mta> and <virtual-mta-pool> also exist, but attaching it to a source is the main path: the message passes through the list at reception, before the sending address is chosen.

Example configuration
# envelope — to your own bounce domain, From header — to the visible domain
<rewrite-list abc>
    mail-from *@shop.example.com  bounce@bounce.shop.example.com
    from-domain *.port25.com      bouncedomain.com
</rewrite-list>

<source 0/0>
    rewrite-list abc
</source>
The first line sends bounces to your own handler, the second changes what the recipient will see. Attaching it in <source> is the form the manual itself shows.
yellow — — directive names, blue — blocks. They are highlighted the same way in the text of the card.