Technical article 109776

How can I test changes made to my sendmail.cf file?

OpenServer 5.0.0OpenServer 5.0.2OpenServer 5.0.4OpenServer 5.0.5

Written · Last revised

Problem

I have made changes to my sendmail.cf file, and I want to test them before installing the new configuration. How can I do this?

Cause

When adding new rules to the sendmail.cf file, it is a good idea to see how addresses are filtered through the new rules before allowing the system's sendmail daemon to use the new configuration file.

Solution

Follow these steps:

1. When you make changes to the /usr/lib/sendmail.cf file, save it under a different name, for example, "new.cf".

2. Take note of the rule sets that you have modified.  Try making
changes to one rule set at a time, testing each change before making
the next.

3. After saving the updated cf file to "/usr/lib/new.cf", change to the /usr/lib directory:

# cd /usr/lib
And run sendmail with the -bt option which causes it to run in
address-testing mode.  Use the -C option to specify a configuration
file other than sendmail.cf:
# ./sendmail -Cnew.cf -bt
You will see a > prompt.  sendmail is waiting for you to type a
rule set (or rule sets) and address.  It will then show you how
the rule sets rewrite the address.  For example, you might type:
> 3,0  joe@acme.com
And sendmail might return the following:
rewrite: ruleset   3   input: joe @ acme . com
rewrite: ruleset  96   input: joe < @ acme . com >
rewrite: ruleset  96 returns: joe < @ acme . com . >
rewrite: ruleset   3 returns: joe < @ acme . com . >
rewrite: ruleset   0   input: joe < @ acme . com . >
rewrite: ruleset  98   input: joe < @ acme . com . >
rewrite: ruleset  98 returns: joe < @ acme . com . >
rewrite: ruleset  95   input: < > joe < @ acme . com . >
rewrite: ruleset  95 returns: joe < @ acme . com . >
rewrite: ruleset   0 returns: $# smtp $@ acme.com.$:joe<@acme.com.>

The final line shows that the mail will be delivered via smtp to the mail exchanger for the domain acme.com with a recipient address of joe@acme.com.

4. To see more detail within each rule set, use the -d21.12 option
when you run sendmail.  The -d21.12 debug switch tells sendmail to
print each rule as it is processed.

See also

_sendmail_ 2nd Edition, Bryan Costales and Eric Allman, O'Reilly and Associates, 1997, chapters 8-15

From the Xinuos technical article database, record 109776. Reproduced with permission. The original is at www.sco.com/ta/109776, which is reachable but blocked from search engines. Xinuos marks this article against a retired product line. That refers to the product’s lifecycle, not to whether the advice still works — plenty of it still applies to running systems.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.