In this chapter and the next, we tie up a few loose ends to install a client.cf file as the system configuration file.
Clearly, you won't want to install the client.cf file as the real sendmail.cf file until you've made sure it works properly. One of the better ways to test a new configuration file is to create a file of addresses for which you already know the correct outcome, then feed the contents of that file to sendmail in rule-testing mode:
/tryflags es /parse user@here /parse email@example.com /parse user@foo /parse foo!user /parse user
Each line begins with a special V8.7 rule-testing command.
The first line causes the tests that follow to parse the address
as an envelope sender (instead of the default envelope recipient).
/parse command causes each address to be rewritten
by rule sets 3 and 0 to select a delivery agent
and then by rule set 4 to clean up afterward.
The addresses listed that are humbly few but will suffice for
the needs of the client.cf file. No matter the form
of the address, each should be forwarded to the hub as is.
/parse command is described in Section 38.5.5, "Parse an Address with /parse".)
 The same thing can be done in earlier versions, but with some difficulty. See a sample script in Section 38.8, "Batch Rule-Set Testing".
The way to test the client.cf file using this list looks like this:
./sendmail -Cclient.cf -bt <
| grep ^mailer
list is the name of the file containing the
above list of rule tests and addresses. The output shows
that each will be passed as is to the hub:
mailer hub, host mailhost, user user@here mailer hub, host mailhost, user firstname.lastname@example.org mailer hub, host mailhost, user user@foo mailer hub, host mailhost, user here!user mailer hub, host mailhost, user user
Notice that mail to these addresses will be delivered by using the hub delivery
mailer). Also notice that each will be forwarded to
the hub machine (
mailhost) for delivery. Finally, note
that the user part will be the original address.
 This is the triple that we described in Section 9.2, "The RHS Triple", in which the RHS of rule set 0 returned the
$@, and the
But why was the lone username in the last line not rewritten
to appear as though it was coming from the hub? Recall that
sender rewriting is done in the
Hubset rule set.
That rule set is called only by the
S= of the
delivery agent. To see
Hubset rewriting, you need to
run sendmail again, but this time use
/try instead of
 Under old versions of sendmail you must specify the rule sets by hand, for example,
./sendmail -Cclient.cf -btADDRESS TEST MODE (ruleset 3 NOT automatically invoked) Enter <ruleset> <address> >
/try hub userrewrite: ruleset 3 input: user rewrite: ruleset 3 returns: user rewrite: ruleset 1 input: user rewrite: ruleset 1 returns: user rewrite: ruleset 199 input: user rewrite: ruleset 199 returns: user @ mail . us . edu rewrite: ruleset 4 input: user @ mail . us . edu rewrite: ruleset 4 returns: user @ mail . us . edu Rcode = 0, addr = email@example.com
Here, sendmail rewrites the lone username first
with rule set 3 (all addresses start with rule set 3), and then
with rule set 1 (all sender addresses pass through rule set 1).
The address is then rewritten by rule set
(which prints as 199 because it is a symbolic rule-set name).
As intended, a lone sender name has
the address of the hub machine appended to it.
(The rest of this
/try output is described in Section 38.5.6, "Try a Delivery Agent with /try".)
Further testing would be suggested if the output varied in unexpected ways. It might be necessary to run sendmail in rule-testing mode by hand, testing each rule and sequence of rules individually to find any mistakes in the client.cf file. If the client.cf file tests okay, you are now almost ready to install it as the official sendmail.cf file.