Wietse Venema: > Jaroslaw Rafa: > > Hello, > > I want to do sender address rewriting on outgoing mail similar to what > > sender_canonical_maps does, but only for mail that is sent to one > > particular domain (for example gmail.com). If the mail has no recipients in > > that domain, rewriting should not be done. > > In master.cf, configure a dedicated SMTP delivery agent with a > "-o smtp_generic_maps=maptype:mapname" override. > > Use transport_maps to select that delivery agent for deliveries to > the domain that needs address rewriting. > > This rewrites {envelope, header} {sender, recipient} addresses. > > See also: https://www.postfix.org/SOHO_README.html#fantasy for > the primary use case of smtp_generic_maps.
Note that the address mapping can be done with static strings (hash:, lmdb:) or with regular expressions if that is more convenient, or a mix of both. ... smtp -o { smtp_generic_maps = map1, map2, ...} Wietse