This begins the declaration of the rules that form rule set
number 0. Rule sets are numbered starting from 0.
Sets 0 through 5
are internally defined by sendmail
to have very specific purposes, as shown in
We'll expand on them throughout the rest of the tutorial.
Rule-set definitions may appear in any order in
the configuration file. For example, rule set
S5 may be defined first,
S2 and then
S7. The rule sets
are gathered when the sendmail.cf file is read and are then sorted
internally by sendmail.
 Beginning with V8.7, rule sets may have symbolic names too. We show this in Chapter 11, Rule Sets 1 and S=.
 Other rule sets may be used by future versions of sendmail, so avoid using rule sets 6 through 9.
|0||Resolve a mail delivery agent|
|1||Process sender address|
|2||Process recipient address|
|3||Preprocess all addresses|
|4||Postprocess all addresses|
|5||Rewrite unaliased local users|
The client.cf file contains no rule-set definitions yet. To observe the effect of nonexistent rules, rerun sendmail on that file:
./sendmail -Cclient.cf -btADDRESS TEST MODE (ruleset 3 NOT automatically invoked) Enter <ruleset> <address> >
-bt command-line switch
causes sendmail to run in address-testing mode.
In this mode, sendmail waits for you to type a rule set and
It then shows you how the rule set rewrites
> prompt, you can now enter an address by specifying
a rule-set number, then a space, and then a mail address:
 V8.7's rule-testing mode can do much more (see Section 38.1, "Overview").
0 email@example.com: ruleset 0 input: gw @ wash . dc . gov rewrite: ruleset 0 returns: gw @ wash . dc . gov >
The rule set specified is 0, but you can specify any number.
rewrite: word that begins each line of address-testing mode
output is there simply to distinguish rewriting lines when they are
mixed with other kinds of debugging output. The
means that sendmail placed the address into the workspace
(more about this soon).
returns shows the result after the rule set has
rewritten that address on the basis of its rules.
The address that is fed to sendmail,
is first split into parts (tokens) based on two sets of
separating characters. Both are defined internally.
One can be changed in your configuration file;
the other cannot:
.:@ you can change these ()<>,;\"\r\n you cannot change these
The two sets are combined into one, and the result is used to
separate the various parts of email addresses. The
address firstname.lastname@example.org is divided into seven tokens because
@ and dot are both in the list of separation characters.
rewrite: ruleset 0 input: gw @ wash . dc . gov rewrite: ruleset 0 returns: gw @ wash . dc . gov
input: line shows seven tokens passed to rule
set 0. The
returns: line shows, since there is no rule set
0, that the undefined - pty) rule set returns those tokens unchanged.
If a rule set is undefined, the result is the same as if it were defined but had no rules associated with it. It is like a C language subroutine that contains nothing but a return statement. It does nothing and produces no errors.