giovedì 4 agosto 2011

Rewriting addresses in Postfix with regular expressions

Today my employer asked me to look into Postfix. We should take an address like root@some.obscure.host.local.lan and make it into root.some.obscure.host@domain.tld.

Looking at the (good) documentation from Postfix, I managed to get a solution. You should change in /etc/postfix/main.cf:

canonical_maps = regexp:/etc/postfix/rewrite

and the /etc/postfix/rewrite file will contain:

/^(.*)@(.*)\.local\.lan$/     ${1}.${2}@domain.tld

Nessun commento:

Posta un commento