Rule Set 2

All recipient addresses are rewritten by rule set 2 and the R= of delivery agents. But in almost all configuration files, rule set 2 is unused because no processing is needed:

# Recipient processing: none needed
S2

But note that rule set 2 can be used to debug rules.[265] Consider the following rule in rule set 2 (that requires V8.9 and above sendmail to work):

R $# $+ $: $+     $:$2    Strip delivery agent and host when debugging

Recall that the parse rule set 0 returns a triple. When testing an address, rule set 2 can be called following the parse rule set 0 to simulate the rewriting of the user portion of the parse rule set 0. Here the LHS matches only a triple, so normal recipient addresses are unaffected. The user part that is returned by the RHS can then be used to test individual R= rules of delivery agents. (Another technique is to use the /try command in -bt rule-testing mode; see Try a Delivery Agent with /try on page 313.)

See LOCAL_RULE_2 (LOCAL_RULE_1 and LOCAL_RULE_2 mc macros on page 596) for a way to add rules to rule set 2.

[265] * This is a truly bogus example. We are really stretching to find a use for rule set 2. There is no reason to do this debugging in rule set 2 because rule set 99 would work just as well. According to Eric, “I can think of no good reason to use S2 today.”

Get sendmail, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.