On 10/21/2013 3:53 PM, btb wrote: > i have a scenario in which certain email is sent using envelope > senders that contain host names that are known only on the local > lan/network, and unknown on the internet. most mail expressing that > characteristic stays local, but occasionally, some is legitimately > destined for the public internet. to that end, with such mail, i'd > like to change the sender domain part to @example.com, but only if > the recipient domain part does not end in example.com [both the > sender and recipient domain part may be @example.com, > @foo.example.com, @bar.foo.example.com, etc]. > > what is the right method for doing this? given > ADDRESS_REWRITING_README, it seem to possibly be a fit for either > masquerade_domains or smtp_generic_maps, but i'm not certain, and > i'm not sure how to apply selectively. > > -ben
smtp_generic_maps will do that nicely. Add the rewriting on the "smtp" outgoing transport in master.cf to limit rewriting to non-local recipient domains only. #master.cf # find the existing "smtp unix ... smtp" transport and add to it: -o smtp_generic_maps=regexp:/etc/postfix/generic.regexp # generic.regexp /^(.*)@some\.fantasy\.invalid$/ $1...@example.com -- Noel Jones