Web linux-server.50webs.com

Linux Mail Server

The Rewriting Rules Section:

The Rewriting Rules section defines the rules used to parse e-mail addresses from user mail programs and rewrite them into the format required by the mail delivery programs. Rewrite rules match the input address against a pattern, and if a match is found, rewrite the address into a new format using the rules defined in the command.

The left side of a rewrite rule contains a pattern defined by macro and literal values and by special symbols. The right side of a rewrite rule defines the template used to rewrite addresses that match the pattern. The template is also defined with literals, macro values, and special symbols. Literals are simply literal string values. Macros are the macro and class values defined in the Local Info section of the sendmail.cf file. The special symbols vary, depending on whether they are used in the left-side pattern or the right-side template. Table 1 lists the pattern matching symbols and Table 2 lists the template symbols.

Table 1:

Symbols Meaning
$@ Match exactly zero tokens.
$* Match zero or more tokens.
$- Match exactly one token.
$+ Match one or more tokens.
$x Match all tokens in macro variable x.
$=x Match any token in class variable x.
$~x Match any token not in class variable x.
Table 2:

Symbol Purpose
$n Insert the value from indefinite token n.
$: Terminate this rewrite rule.
$@ Terminate the entire ruleset.
$>name Call the ruleset identified as name.
$[hostname$] Convert hostname to DNS canonical form.
$(database-spec$) Get the value from a database.

Rewrite rules divide e-mail addresses into tokens for processing. A token is a string of characters delimited by an operator defined in the OperatorChars option. The operators also count as tokens. Based on this, the address kathy@parrot contains three tokens: the string kathy, the operator @, and the string parrot.

.