I want to rewrite all sender addresses @example.com to newsender@example.org (to one static outgoing address) but I also want to have the original address added as the reply-to
. I can do either individually with the generic file and header_checks files respectively but as the generic file seems to be used first, I lose the original sender. Did I miss something from postfix rewrite documentation?
It would be OK if the envelope sender had something like original+mydomain.com@newsenderdom.com as long as From:
header is newsender@newsenderdom.com. Any ideas?
If there is an easy solution in Qmail then that would also be an option!
Best Answer
After many hours searching and several posts (here and elsewhere) saying it isn't possible without a milter or with instructions that didn't work for me (like above), success!
At least with my testing on my setup, you cannot use smtp_generic_maps because that seems to be executed before other checks/rewrites. If you use sender_canonical_maps, however, then that seems to get executed after checks like header_checks. So, you can simply have the following in
main.cf
:Contents of files
/etc/postfix/sender_canonical_maps:
/etc/postfix/header_checks:
And run
postmap /etc/postfix/sender_canonical_maps
Restart postfix
service postfix restart
And you're away laughing :-). This adds the expected Reply-to: whateverwasthere@example.com header and changes both the envelope & header from to user@example.org.