sendmailSearch this book
Previous: 8.3 Rule SetsChapter 8
Addresses and Rules
Next: 8.5 The Workspace

8.4 Rules

Each rule set may contain zero or more individual rules. Rules begin with the R configuration command, and each rule is composed of three parts:

Rlhs      rhs       comment

The first line, the S0, declares the start of rule set 0. All the lines following the S line and beginning with R belong to that rule set. A new rule set begins when another S line with a different number appears. [6]

[6] If another S line appears with the same number, sendmail will print a warning. Prior to V8.7, the second definition wiped out the first. Beginning with V8.7, the second rule set's rules are appended to the rules of the first.

Each R line is a separate rule in the series of rules that form a rule set. In the files of major mail-handling sites, a given rule set can have a huge number of rules. But our hypothetical rule set 0 will have only one rule and hence only one line that begins with an R:

Rlhs      rhs       optional comment
            -^         -^
            tab        tab

Each rule has three distinct parts, each divided from the others by one or more tab characters. You can use space characters inside each part, but you must use tabs to separate the parts.

The leftmost part of the rule is called the LHS, for left-hand side. The middle part is called the RHS, for right-hand side. These form the rule. A comment may optionally follow the RHS and (if present) must be separated from the RHS by one or more tab characters.

The LHS and RHS form an if-then pair. If the LHS evaluates to true, the RHS is evaluated. If the LHS evaluates to false, sendmail skips to the next rule in the rule set (if there is one):

 if true ->         do this
 -v         -v
Rlhs         rhs
otherwise, go to next rule

Previous: 8.3 Rule SetssendmailNext: 8.5 The Workspace
8.3 Rule SetsBook Index8.5 The Workspace