Using smtp_generic_maps to rewrite domain/address for outgoing mails in Postfix/Zimbra

Greetings to everyone.

Sometimes, you think it’s so easy to use generic table in Postfix like this to rewrite mail address/domain for outgoing mails.

It must be really easy, of course, with only Postfix. However, if you do that with the Postfix running inside a Zimbra server, you should do more work if you would not like to get undeliverable reports when sending/receiving mails from/to mapped email addresses. This is so simple but it waste me hours to find out. Hope this will help to save your time.

All you need to do is add “smtp_generic_maps=” to the amavis service options in

smtp-amavis unix - - n - 10 smtp
-o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes
-o disable_dns_lookups=yes
-o max_use=20
-o smtp_generic_maps=

This stops the outgoing generic map from being applied when the mail gets reinjected into Postfix. Thats’ all.