Date Tags postfix

It’s actually pretty easy. On the client side you need to specify your hostname, your origin and the relay host. For example:

myhostname = dev.localnet.xen
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
#mydestination = dev.localnet.xen, dev, localhost
relayhost = [mail.localnet.xen]
mynetworks = 127.0.0.0/8

Mydestination must not be set otherwise mail will be delivered locally. Server side you need first rewrite the from field of every email coming from the satellite host. This is necessary in my case as I’m using a local domain that is unknown to the relay host and that will cause a rejection with “unknown domain”. Secondly you would need to rewrite the To field of the email to deliver it either locally of send it somewhere else.

in brief:

mydestination = dev.localnet.xen
[...]
canonical_maps = regexp:/etc/postfix/canonical.regex
virtual_alias_maps = hash:/etc/postfix/virtual

Mydestination is to accept the email from the satellite host, the canonical_maps is to rewrite the From and the virtual_maps are to rewrite the To field.

For the canonical maps I use a regexp to match all my satellite hosts at once and rewrite them to $user-$host@example.net . For example:

/^(.*)@(.*)\.localnet\.xen$/ $(1)-$(2)@example.net