Rewrite rule templates

Once a host/domain specification  matches a rewrite rule, it is  rewritten using the template part (right hand side) of the rule. The template specifies three things:



 a new username for the address, 

 a new host/domain specification for the address, and 

 the name of a system attached to an existing MTA channel (the   "routing system") to which messages to this address should    actually be sent. 



There are several general formats for rewrite rule templates, which will be discussed in Rewrite rule template formats, depending upon whether an address is merely being changed or whether source routing should be explicitly specified (or even added to the address). Various substitutions  and control sequences are available to further fine-tune the application of rewrite rules.

Note that the character case in templates is preserved. This is necessary when using rewrite rules to provide an interface to a mail system such as UUCP which is sensitive to character case. Substitution sequences  like $U and $D that substitute material extracted from addresses also preserve the original case of characters. (Special Rewrite case control substitutions may be used when it is desirable to alter case, rather than preserve it.)

See also:
 * Rewriting: scanning for a domain match
 * Rewrite rule template formats
 * Rewrite rule template substitutions and control sequences
 * Rewrite case control substitutions
 * Rewrite rules