On Fri, Nov 18, 2011 at 07:56:07AM +0100, Claudio Kuenzler wrote:

> Take a look at this: http://www.postfix.org/ADDRESS_REWRITING_README.html
> There are a lot of examples and you'll find what you're looking for.

Yes, the document is a good place to start.

> If you want to change the domain for incoming and outgoing e-mails you can
> do this with canonical_maps.

No, this advice is probably not wise.

> The table/file you define after the parameter can contain the complete
> domain name (as wildcard) or full e-mail address which you want to rewrite:
> 
> canonical_map:
> @abc.net             @abc.org                   <- for all e-mail addresses
> of abc.net
> ma...@abc.net      ma...@abc.org          <- only single e-mail address

Wildcard canonical mappings break recipient validation and are strongly
discouraged.

> If you only want to apply the rules for
> incoming mails, use recipient_canonical_maps or for outgoing mails
> sender_canonical_maps.

This is really quite wrong, as sender_canonical_maps applies to the
"From:" and envelope sender addresses regardless of whether the message
is incoming or outgoing.

Likewise "recipient_canonical_maps" applies to the "To:/Cc:" and
envelope recipient addresses regardless of whether the message is
incoming or outgoing.

Finally, it is almost always wrong to apply different rewriting
rules to "From:" vs. "To:/Cc:" headers. Rather there is a normal
form for headers one to present to the outside world, and sometimes
a different form for internal consumption.

Therefore, rewriting of all headers should as necessary depend on
the destination, and so must happen in the delivery agent, via
"smtp_generic_maps". One can use different smtp delivery agent
instances for inbound vs. outbound delivery.

Wildcard rewrites in smtp_generic_maps happen long after recipient
validation, and pose no issues.

-- 
        Viktor.

Reply via email to