home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


sendmailSearch this book
Previous: 9.2 The RHS Triple Chapter 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:

in rule set 0

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
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 :

  • Rule set 0 is one of the few rule sets that may use $# to return the symbolic name of a delivery agent. [2] If any other rule set returns a $# , the $# can cause unpredictable errors.

    [2] Rule set 5 can also return a $# .

  • $@ and $: in rule set 0, when following $# , have different meanings than they do in all the other rule sets. They are even different from the way they are in rule set 0 itself when they don't follow $# . We'll expand on this concept in the next chapter.