Postfix Address Rewriting
Address rewriting is at the heart of the Postfix mail system.
Postfix rewrites addresses for many different purposes. Some are
merely cosmetic, and some are necessary to deliver correctly
formatted mail to the correct destination. Examples of
address rewriting in Postfix are:
-
Transform an incomplete address into a complete address.
For example, transform "username" into "[email protected]", or
transform "username@hostname" into "[email protected]".
-
Replace an address by an equivalent address. For example,
replace "[email protected]" by "[email protected]"
when sending mail, and do the reverse transformation when receiving
mail.
-
Replace an internal address by an external address. For
example, replace "[email protected]" by "[email protected]"
when sending mail from a home computer to the Internet.
-
Replace an address by multiple addresses. For example,
replace the address of an alias by the addresses listed under that
alias.
-
Determine how and where to deliver mail for a specific
address. For example, deliver mail for "[email protected]" with
the
smtp(8) delivery agent, to the hosts that are listed in the
DNS as the mail servers for the domain "example.com".
Although Postfix currently has no address rewriting language,
it can do surprisingly powerful address manipulation via table
lookup. Postfix typically uses lookup tables with fixed strings
to map one address to one or multiple addresses, and typically uses
regular expressions to map multiple addresses to one or multiple
addresses. Fixed-string lookup tables may be in the form of local
files, or in the form of NIS, LDAP or SQL databases. The
DATABASE_README document gives an introduction to Postfix lookup
tables.
Topics covered in this document: