[Chapter 9] 9.3 Testing Rule Set 0

sendmail

sendmailSearch this book
Previous: 9.2 The RHS TripleChapter 9
Rule Set 0
Next: 9.4 The error Delivery Agent
 

9.3 Testing Rule Set 0

To see that what we describe is actually what happens, take a moment to add rule set 0 to the end of your client.cf file:

S0 # select delivery agent                                          <- new
R$+     $#hub $@${REMOTE} $:$1          forward to hub              <- new

Now run sendmail in rule-testing mode and give it the address boss@acme:

% ./sendmail -Cclient.cf -bt
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> 0 boss@acme
rewrite: ruleset  0   input: boss @ acme
rewrite: ruleset  0 returns: $# hub $@ mailhost $: boss @ acme

The change to the workspace caused by rule set 0 is exactly as predicted:

$# hub $@ mailhost $: boss @ acme

Components from the workspace triple are used by sendmail to define macros used by delivery agents. For example, the text after $@ is copied into the h macro. Similarly, the username appearing after $: is copied into the u macro:

                                                          from $@ in rule set 0
                                                               -v
Mhub,   P=[IPC], S=0, R=0, F=mDFMuXa, T=DNS/RFC822/SMTP, A=IPC $h
Mlocal, P=/bin/mail, F=lsDFMAw5:/|@rmn, S=0, R=0, A=mail -d $u
                                                            -^
                                              from $: in rule set 0

Rule set 0 is different from the other rule sets in several important ways. We'll begin explaining the other rule sets in the next chapter. For now, just be aware that there are a few exceptions to rules in sendmail:


Previous: 9.2 The RHS TriplesendmailNext: 9.4 The error Delivery Agent
9.2 The RHS TripleBook Index9.4 The error Delivery Agent