O'Reilly logo

Sendmail, 3rd Edition by Bryan Costales

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Add Debugging for Detail

In rule-testing mode the -d command (Section 16.1) can be used to turn debugging output on and off. Prior to V8.7 sendmail, the -d could be specified only on the command line. Beginning with V8.7 sendmail, the -d can also be specified in rule-testing mode. We illustrate the latter technique here.

Debugging output can reveal in great detail how individual rules are being handled. A debugging category and level of 21.12 (-d21.1), for example, causes sendmail to print the LHS of each rule as it is tried. To illustrate, consider the following (highly simplified) configuration-file rule set:

V10
STest
R @                  $#local $:$n                 handle <> form
R $* < @ $+ > $*     $#$M $@$R $:$1<@$2>$3        user@some.where
R $+                 $#local $:$1                 local names

Normal output that is produced when a rule set name and an address are entered at the > prompt looks like this:

> Test george
Test               input: george
Test             returns: $# local $: george

But if we turn on debugging using the -d rule-testing command:

> -d21.12

the output that is produced when the same rule set number and address are entered is more verbose than it was before:

>  Test george
Test               input: george
-----trying rule: @
----- rule fails
-----trying rule: $* < @ $+ > $*
----- rule fails
-----trying rule: $+
-----rule matches: $# local $: $1
rewritten as: $# local $: george
Test             returns: $# local $: george

Observe that the first rule in the Test rule set (the lone @) does not match george in the workspace. Therefore, that rule fails and is skipped. Then the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required