Rulesets:
Individual rewrite rules are grouped together in rulesets, so that related rewrite rules can be referenced by a single name or number. The S command marks the beginning of a ruleset; and identifies it with a name, number, or both. Therefore, the command S4 marks the beginning of ruleset 4, SLocal_check_mail marks the beginning of the Local_check_mail ruleset, and Scanonify=3 defines the beginning of the canonify ruleset, which is also known as ruleset 3.
Five rulesets are called directly by sendmail to handle normal mail processing:
- Ruleset canonify, also known as ruleset 3, is called first to prepare all addresses for processing by the other rulesets.
- Ruleset parse, also known as ruleset 0, is applied to the mail delivery address to convert it to the (mailer, host, user) triple, which contains the name of the mailer that will deliver the mail, the recipient hostname, and the recipient username.
- Ruleset sender, also known as ruleset 1, is applied to all sender addresses.
- Ruleset recipient, also known as ruleset 2, is applied to all recipient addresses.
- Ruleset final, also known as ruleset 4, is called last to convert all addresses from internal address formats into external address formats.
There are three basic types of addresses: delivery addresses, sender addresses, and recipient addresses. A recipient address and a delivery address sound like the same thing, but there is a difference. As the mailing list alias illustrated, there can be many recipients for a piece of mail, but mail is delivered to only one person at a time. The recipient address of the one person to which the current piece of mail is being delivered is the delivery address. Different rulesets are used to process the different types of addresses.
The figure below shows the rulesets that handle each address type. The S and R symbols in Figure 5.1 represent rulesets that have names, just like the other rulesets, but the specific rulesets used are identified by the S and R fields of the mailer definition. Each mailer specifies its own S and R rulesets to process sender and recipient addresses in a manner required by the mailer.