sendmailSearch this book
Previous: 8.8 Things to TryChapter 9Next: 9.2 The RHS Triple

9. Rule Set 0

Introducing Rule Set 0
The RHS Triple
Testing Rule Set 0
The error Delivery Agent
Things to Try

The function of rule set 0 is to decide which mail delivery agent will handle delivery for a particular recipient address. Figure 9.1 shows how rule set 0 relates to the other rule sets.

Figure 9.1: The flow of addresses for rule set 0

Figure 9.1

Rule set 0 is called once for each recipient of a mail message. Rule set 0 determines a triple for each address. The triple is composed of three parts: the symbolic name of the mail delivery agent, the name of the user to whom the mail is addressed, and the name of the host to which the mail will be sent. We'll expand on these soon and cover the other rule sets in later chapters.

9.1 Introducing Rule Set 0

Recall that one goal of the file is to cause sendmail to forward all mail to a central hub machine for processing. To lay the groundwork for this, we designed the hub delivery agent in Chapter 6, The Mail Hub and Delivery Agents, and declared it like this:

# Delivery agent definition to forward mail to hub
Mhub,   P=[IPC], S=0, R=0, F=mDFMuXa, T=DNS/RFC822/SMTP, A=IPC $h

As this goal implies, we don't want to design any fancy rules for rewriting the recipient's address, we simply want to send it to the hub as is.

The rule set that we show below does just that. It may look complicated, but recall that its one rule is basically just an if-then statement:

R$+     $#hub $@${REMOTE} $:$1          forward to hub

The first line (the S0) declares the start of rule set 0. The R line in this example is the first of many possible rules that will form rule set 0.

You saw the LHS of this rule in the preceding chapter. The $+ wildcard operator is used to match one or more tokens in the workspace. Essentially, this LHS will match anything in the workspace but will fail to match an empty workspace.

Previous: 8.8 Things to TrysendmailNext: 9.2 The RHS Triple
8.8 Things to TryBook Index9.2 The RHS Triple