On Thu, Dec 05, 2013 at 04:45:48PM +0100, Troels Hansen wrote: > canonical_maps = regexp:/etc/postfix/recipientmap > > and recipientmap contains the following: > /^(.*)_(.*)@domain\.dk$/ ${1}.${2}@domain.com > > This works, however it should only be done from mails originating > from the broken system, ex 10.11.12.13
Example IPv4 addresses should taken from 192.0.2.0/24 > I have struggled with this for some time, but cannot find a way > to accomplish this? If you can configure the broken system to talk to a different SMTP service than all other clients (different IP, different port, or both), then you can enable the rewrite in question there. You can use either http://www.postfix.org/postconf.5.html#smtpd_command_filter or http://www.postfix.org/postconf.5.html#cleanup_service_name to implement rewriting differently in a particular master.cf smtpd(8) service. If you can't use a different input, you can configure a different output, via: http://www.postfix.org/postconf.5.html#sender_dependent_default_transport_maps or an access table FILTER action: http://www.postfix.org/access.5.html then on the output side, in a custom master.cf smtp(8) transport override: http://www.postfix.org/postconf.5.html#smtp_generic_maps forcing all mail into an SMTP delivery agent via a FILTER action prevents local mail delivery. If the broken machine sends mail to recipients that need to be delivered locally, and you can't identify it by a particular envelope sender address, the FILTER approach requires more care (a 127.0.0.1 nexthop with a re-injection port different than 25, and an SMTP listener there to handle the mail after rewriting). -- Viktor.