The rewrite rules appear in the upper-half of the IMTA configuration file, imta.cnf (see the sample configuration file in the following section, "Configuration File Format"). Each rule in the configuration file appears on a single line. Comments, but not blank lines, are allowed between the rules. The rewrite rules end with a blank line, after which the channel definitions follow.
Rewrite rules consist of two parts: a pattern followed by an equivalence string or "template." The two parts must be separated by spaces, although spaces are not allowed within the parts, themselves. The template specifies a username, any applicable options, a host/domain specification, and the name of a system attached to an existing IMTA channel (the routing system), to which messages to this address are sent. The structure for rewriting rules is:
pattern controls [userTemplate]%[domainTemplate] @[routingSystem] controls
The following table describes the parts of the rewriting rule structure:
pattern
The rule applies if the pattern is a substring of the domain part of the address. An asterisk (*) can be used as wild card character.
controls
The applicability of a rule can be limited using these control sequences. Control sequences may be located either before the user template or after the routing system. The selection criteria are described in TABLE 3-5. They include:
Envelope or header addresses
direction (To or From)
destination channel of the message Or, the following contexts:
Addresses in messages directed to a specified or unspecified channel [ userTemplate ]
Specifies how the user part of the address is rewritten. The template may be built using substitution sequences to represent certain parts of the original address or the results of a database lookup. The substitution sequences are replaced with what they represent in order to construct the rewritten address. See TABLE 3-3.
%
Separator used between userTemplate and domainTemplate (see preceding structure sample).
[ domainTemplate ]
Specifies how the domain part of the address is rewritten. Like the userTemplate, the domainTemplate may be built using substitution sequences.
@
Separator used between domainTemplate and routingSystem (see preceding structure sample).
[ routingSystem ]
Specifies the destination channel's routing system. Every channel is associated with a string (the routingSystem).
Refer to the section, "Template Substitutions" for additional information about rewrite rule structures and concepts.