Postfix: Modify sender address based on recipient
Posted
by
PJ P
on Server Fault
See other posts from Server Fault
or by PJ P
Published on 2012-12-13T21:30:36Z
Indexed on
2012/12/13
23:05 UTC
Read the original article
Hit count: 321
We have a Postfix server that receives mail from our application servers. Senders are in the form [email protected] (where host.fqdn can vary, depending on source server) and recipients can be internal or external users.
Messages going to external users should have the sender changed to [email protected]. I have tried using canonical maps, but since that is handled by the cleanup daemon, before any transport decisions are made, it would affect all sender addresses.
I have also tried creating a custom smtp transport with generic mappings and configuring transport_maps to use that custom smtp transport for external domains. However, generic mappings affect both sender and recipient addresses.
Lastly, I've tried the following:
- Create a custom smtpd daemon that specifies sender canonical maps and a unique transport table.
- Send all externally addressed mail to that custom daemon. Ideally, sender canonical maps would transform the sender address and the unique transport table would relay messages to the internet.
However, evidently, only one transport table can be used per Postfix instance.
I want to avoid creating an entirely new Postfix instance to accommodate this rewriting. Any suggestions? (and thanks in advance)
© Server Fault or respective owner