Application of rewrite rules to addresses

This section presents a discussion of the operation of domain rewriting rules: how an address is parsed and then transformed via rewrite rules. This section touches briefly on the syntax of rewrite rules as such syntax relates to example addresses, but for full details on rewrite  rule syntax, see  Rewrite rule patterns and tags and Rewrite rule templates.

There are four steps in the application of the domain rewriting rules to a given address:



 The first host or domain specification is extracted from the   address. (Note that an address may specify more than one host or domain   name as is the case with the address jdoe%host1@domain.com.) 

 After extracting the first host or domain name specification, the   rewrite rules are    scanned for a   matching rewrite rule. That is, a   search is conducted for a rewrite rule whose pattern portion matches    the extracted host/domain name. 

 Once a matching rewrite rule is found, the address is rewritten   according to the  template portion of that rule. The template also   specifies the name of a routing system to which messages to this    address should be routed.8 

 The routing system name  is then compared with the host names    associated with each channel. If a match is found, then the message is   enqueued to that channel; otherwise, the    rewriting process is    considered to have failed. If the matching channel is the local   channel, then some additional rewriting of the address may occur. 



These four steps are described in detail in the following subsections. There are also special template formats which allow for variations in these four steps.

Note 8The term "routing system"         can be misleading. It does not necessarily mean the name of a system         through which the message will be routed but rather is a host name,          possibly fictitious, associated with a specific channel.

See also:
 * Rewriting: extraction of the first host or domain specification
 * Rewriting: scanning for a domain match
 * Rewriting: applying the rewrite rule template
 * Rewriting: finishing the rewriting process
 * Rewriting: rewrite rule failure
 * Syntax checks after rewriting
 * Rewriting: domain literals
 * Rewrite rules