Show Rules in a Rule Set with =S

The =S rule-testing command causes sendmail to show all the rules of a rule set. The form of this command looks like this:

=Sruleset

Optional whitespace can separate the ruleset from the S. The ruleset can be a number or a symbolic name (Rule Set Names on page 684):

=S0                    ← a number
=SMyrule               ← a name

Note that, although sendmail macros can be used in defining rule sets (Macros in Rule Set Names on page 686), they cannot be used with the =S command:

> =S$X
invalid ruleset name: "$X"
Undefined ruleset $X
>

One use for the =S command is to determine why a rule set is not behaving as expected. Consider a rule set named LocalizeSender that is intended to rewrite all sending addresses so that the local host’s name makes the message appear as though it came from the mail hub machine. Suppose that, when testing, you send an address through that rule but it comes out unchanged:

> LocalizeSender bob@localhost
LocalizeSender     input: bob @ localhost
LocalizeSender   returns: bob @ localhost
>

Puzzled, you look at the actual rule with the =S rule-testing command:

> =SLocalizeSender
R$* < @ $=w > $*                $@ $1 < @ mailhub . our . domain > $3
>

Aha! The rule set named LocalizeSender[144] expects the host part of the address to be surrounded by angle brackets! Knowing this, you run the address through the rule again, this time using angle brackets, and it succeeds:

>  LocalizeSender bob<@localhost > LocalizeSender input: bob < @ localhost > LocalizeSender returns: bob < @ mailhub . our ...

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.