When sendmail rewrites addresses, it applies its rule sets in a specific sequence. The sequence differs for sender and recipient addresses, with a third branch used to select delivery agents. Figure 19-1 shows a map of the different paths taken by each kind of address. Those paths show how addresses flow through rule sets.
Both sender and recipient addresses are first input into the canonify rule set 3. Then each takes a different path through the rule sets based on its type. Recipient addresses take the dashed path, whereas sender addresses take the solid path. But before those paths can be taken, sendmail needs to select a delivery agent (the dotted path) to get rule-set numbers for the R= and S= of each path.
To select a delivery agent, sendmail rewrites the recipient address with the canonify and parse rule sets (the dotted path). The parse rule set 0 selects a delivery agent that is appropriate for the recipient. That delivery agent supplies rule-set values for the S= and R= in the corresponding sender (solid) and recipient (dashed) paths.
After a delivery agent has been selected, the sender address is processed (see Figure 19-2). As was mentioned earlier, it is first input into the canonify rule set 3. Then it flows through rule set 1 (if that rule set is declared), then the S= rule set as determined by the delivery agent. Finally, it flows through the final rule set 4, which returns the rewritten address. This rewritten sender address appears in the header and envelope of the mail message. Note that all addresses are eventually rewritten by the final rule set 4. In general, the final rule set 4 undoes any special rewriting that the canonify rule set 3 did.
Finally, the recipient address also needs to be rewritten for inclusion in the header and envelope of mail messages (see Figure 19-3). Recall that the recipient address was already used once to select the delivery agent. The recipient address is used as input to the canonify rule set 3, as are all addresses. The recipient address then flows through rule set 2 (if it is declared), then through the R= rule set selected by the delivery agent, and finally through the final rule set 4.
The flow of rules through rule sets (as is shown in Figure 19-1) is appropriate for all versions of sendmail. Some versions, such as V8, enhance these rules with others, but all those enhancements begin with this basic set.
V8 sendmail allows envelope addresses to be rewritten separately from header addresses. This separation takes place in the delivery agent R= and S= specific rule sets, as illustrated in Figure 19-4.
The method that is used to split rewriting looks like this:
R=eset/hset beginning with V8 S=eset/hset beginning with V8
The envelope-specific rule set is the one to the left of the slash and is represented by a solid line. The header-specific rule set is to the right of the slash (R=eset/hset) and is represented by a dashed line. See R= for a complete description of this process.