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:


example.com    drewrite:


smtp         unix  -       -       -       -       -       smtp
drewrite     unix  -       -       -       -       -       smtp 
    -o smtp_generic_maps=hash:/etc/postfix/rewrite_domain


info@example.com     info@mydomain.com

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 smtp_generic_maps in 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.

  • I can't see your error messages and therefor can't see the problem. Have you read this postfix.org/ADDRESS_REWRITING_README.html ?? – mailq Jun 30 '12 at 19:40
  • Yes, I did read the whole thing. There are no error messages, the whole smtp_generic_maps clause is just silently ignored, probably because the mail gets processed by amavis sooner than rewriting is done. I did enable verbose logging for this, but didn't see anything out of the ordinary. Still, disabling amavis solves this problem (and causes a bunch of others, I'm sure), so I'm fairly sure that rewriting is set up correctly. I still didn't consult amavis mailing list, to that might turn something up. – lubomir.brindza Jul 1 '12 at 8:45
  • 1
    Try disabling avamis only for drewrite – sanmai Oct 9 '14 at 6:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.