29.6 Rule Set 0The job of rule set 0 is to select a delivery agent for each recipient. It is called once for each recipient and must rewrite each into a special form called a triple . A triple is simply three pieces of information: the symbolic name of the delivery agent, the host part of the address, and the user part of the address. Each part is indicated in the RHS by a special prefix operator, as shown in Table 29.2 .
The triple is formed by rewriting with the RHS. It looks like this:
$#
The delivery agent selection must be the first of the three. In addition to
specifying the delivery agent,
All three parts of the triple must be present in the RHS. The only
exception is the
Not all rules in rule set 0 are specifically used to select a delivery
agent. It may be necessary, for example, to canonicalize an address
with If an address passes through rule set 0 without selecting a delivery agent, the following error message is produced, and the mail message bounces:
buildaddr: no mailer in parsed address Therefore it is important to design a rule set 0 that selects a delivery agent for every legitimate address. If a triple is missing the user part, the following error is produced:
buildaddr: no user
If the delivery agent that is selected is one for which there is no
corresponding
buildaddr: unknown mailer bad delivery agent name here
29.6.1 Further Processing: $:user
The user part of the triple is intended for use in the command line
of the delivery agent and in the RCPT command in an SMTP connection.
For either use, that address is rewritten by rule set 2, the
The rewritten result is stored for use when
a delivery agent's Figure 29.5: The flow of $:user through rule sets
The rewritten result is also given to a remote site during
the exchange of mail using the SMTP protocol. The local machine
tells the remote machine the name of the recipient by saying
29.6.2 Selecting S= and R=
When it selects a delivery agent, rule set 0 also selects
the rules that will be used in rewriting sender
and recipient addresses. A sender address is rewritten by
the rule set specified by the
We won't cover individual 29.6.3 Delivering to Local RecipientTypically, some early rules in rule set 0 are intended to detect addresses that should be delivered locally. A rule that accomplishes that end might look like this:
R$+ <@ $w> $#local $:$1 local address
Here, the
At some sites, the local host can be known by any of several
names. A rule to handle such hosts would begin with a class
declaration that adds those names to the class
Cw font-server fax printer3 R$+ <@ $=w> $#local $:$1 local address
The class On central mail server machines, rule set 0 may also have to match from a list of hosts for which the central server is an MX recipient machine (see Section 19.6.26, FEATURE(use-cw-file) ). 29.6.4 Forwarding to a Knowledgeable Host
After handling mail destined for the local host, rule set 0
generally looks for addresses that require a knowledgeable
host to forward messages on the local host's behalf.
In the following rule,
R$* <@ $+.BITNET> $* $#smtp $@$B $:$1<@$2.BITNET>$3 user@host.BITNET
The tag 29.6.5 Handling UUCP LocallyHosts sometimes deliver mail to a few UUCP connections locally and forward to other UUCP connections through a knowledgeable host. The rules that handle this situation often make use of another class:
R$* <@ $=V.UUCP> $#uucp $@$2 $:$1 user@localuucp R$* <@ $+.UUCP> $#smtp $@$Y $:$1<@$2.UUCP> kick upstairs
Here, the class 29.6.6 Forwarding over the NetworkNext, rule set 0 typically sees whether it can send the mail message over the network. In the following example we assume that the local host is connected to an IP network:
# deal with other remote names R$* <@ $*> $* $#smtp $@$2 $:$1<@$2>$3 user@host.domain
Remember that we have already screened out and handled
delivery to the local host, and therefore the focused host
(in the
The focus is kept in the user portion of the RHS triple. Remember
that the user portion will be rewritten by rule sets 2, 29.6.7 Handling Leftover Local AddressesWhatever is left after all preceding rules in rule set 0 have selected delivery agents is probably a local address. Here, we check for a username without a host part:
R$+ $#local $:$1 regular local names Notice that the user part is not focused; it is unfocused because there is no host part on lone local usernames. |
|