Postfix domain rewriting with canonical maps

In some cases you want to rewrite all email for a specific domain to another domains. For example all incoming email for example.org should be rewritten to example.com. Postfix uses canonical maps to rewrite domains or mail addresses. Insert the following line to the /etc/postfix/main.cf:

canonical_maps = hash:/etc/postfix/canonical

Create the file /etc/postfix/canonical and add the following line:

@example.org   @example.com

Create the hash map of the canonical file by:

$ postmap /etc/postfix/canonical

Reload Postfix to active the changes.

$ /etc/init.d/postfix reload

All emails send to milo@example.org will now be displayed as milo@example.com in the TO field of the mail client. It's still necessary to have the address milo@example.com as a local or virtual alias. This is not necessary for the address milo@example.org. But the domain example.org should be listed in the mydestination or virtual_domain option, otherwise Postfix will block all incoming emails for this domain. | In some cases you want to rewrite all email for a specific domain to another domains. For example all incoming email for example.org should be rewritten to example.com. Postfix uses canonical maps to rewrite domains or mail addresses. Insert the following line to the /etc/postfix/main.cf:

canonical_maps = hash:/etc/postfix/canonical

Create the file /etc/postfix/canonical and add the following line:

@example.org   @example.com

Create the hash map of the canonical file by:

$ postmap /etc/postfix/canonical