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 user@here.us.edu
/parse user@foo
/parse foo!user
/parse user
Each line begins with a special V8.7 rule-testing command.
[1]
The first line causes the tests that follow to parse the address
as an envelope sender (instead of the default envelope recipient).
The /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.
(The /parse command is described in Section 38.5.5, "Parse an Address with /parse".)
The
way to test the client.cf file using this list looks
like this:
% ./sendmail -Cclient.cf -bt < list | grep ^mailer
Here, 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 user@here.us.edu
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
agent (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.
[2]
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
/parse:
[3]
% ./sendmail -Cclient.cf -bt
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> /tryflags es
> /try hub user
rewrite: 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 = user@mail.us.edu
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 Hubset
(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.