I'm trying to set up my postfix server to alter the sender address of outgoing e-mails for one specific recipient domain (example.com) -- otherwise I'd just configure
smtp_generic_maps in main.cf and be done with it.
From what I understand, for this sort of configuration, there is a need to set up an extra transport that handles the traffic I want to get mangled.
So far I've set up an extra smtp transport:
smtp unix - - - - - smtp drewrite unix - - - - - smtp -o smtp_generic_maps=hash:/etc/postfix/rewrite_domain
The problem is that amavis is also configured to run on that server, and it seems to hinder the address rewriting in some way I honestly can't wrap my head around.
The curious thing is that when I bypass the transport and set the
main.cf to overwrite the sender address for all recipients; the address gets rewritten OK.
This led me to believe that perhaps the transport is not set up correctly; but postfix logs show that it is in fact being used (and when I did manage to bork it earlier I got deferred messages in the queue).
The only way I've been able to get this working was to disable amavis globally.