Following on from my previous postfix post, this configuration details how to rewrite the domain for addresses sent to the mail server for sending onwards.
The main entries to go in
# The domains that the server will accept mail for relay_domains = $myhostname, hash:/etc/postfix/relay_domains # The rewrite mapping for each domain canonical_maps = hash:/etc/postfix/canonical
relay_domains details all the domains that the server will accept mail for, including ones that are to be rewritten. A sample entry is as follows:
and a sample entry of the
detailing that mail to
example1.com will be rewritten to
As usual, the two files need to be converted to their db counterparts:
$ postmap relay_domains $ postmap canonical
Restart postfix for the changes to take place.
Credit where credit is due: https://www.oostergo.net/node/89