home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


sendmail

sendmailSearch this book
Previous: 37.5 Reference in Numerical Order Chapter 38 Next: 38.2 Configuration Lines
 

38. Rule-Set Testing with -bt

The sendmail program offers a mode of operation (called rule testing mode) that allows you to observe the flow of addresses through rule sets. The -bt command-line switch causes sendmail to run in rule-testing mode. This mode is interactive. You enter rule set numbers, addresses, and other commands, and sendmail processes them and prints the results. The -bt switch's chief use is in testing changes in the configuration file. It is also useful for learning how rules and rule sets work.

38.1 Overview

The following command runs sendmail in rule-testing mode:

% 

/usr/lib/sendmail -bt

At first, the output produced by this command line prompts you like this:

ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
>

The "ruleset 3" statement says that, beginning with V8 (and IDA) sendmail , rule set 3 is no longer automatically called when rule sets are listed at the prompt. We cover this new property in detail in Section 38.6.2, "The Address" .

Prior to V8 sendmail , rule-testing mode could be used only to test addresses. But beginning with V8.7 sendmail new functions have been added. To see a summary of those functions, enter a ? character followed by a RETURN at the > prompt. The output, which we reproduce below, lists and gives a brief description of each function. Note that the numbers to the right refer to the sections in this chapter and are not a part of sendmail 's output.

> 

?


Help for test mode:
?                :this help message.
.Dmvalue         :define macro `m' to `value'.                          
<- 
Section 38.2.1, "Define a Macro with .D"


.Ccvalue         :add `value' to class `c'.                             
<- 
Section 38.2.2, "Add to a Class with .C"


=Sruleset        :dump the contents of the indicated ruleset.           
<- 
Section 38.4.1, "Show Rules in a Rule Set with =S"


=M               :display the known mailers.                            
<- 
Section 38.4.2, "Show Delivery Agents with =M"


-ddebug-spec     :equivalent to the command-line -d debug flag.
$m               :print the value of macro $m.                          
<- 
Section 38.3.1, "Dump a Defined Macro with $"


$=c              :print the contents of class $=c.                      
<- 
Section 38.3.2, "Dump a Class Macro with $="


/mx host         :returns the MX records for `host'.                    
<- 
Section 38.5.2, "Look Up MX Records with /mx"


/parse address   :parse address, returning the value of crackaddr, and  
<- 
Section 38.5.5, "Parse an Address with /parse"


                  the parsed address (same as -bv).
/try mailer addr :rewrite address into the form it will have when       
<- 
Section 38.5.6, "Try a Delivery Agent with /try"


                  presented to the indicated mailer.
/tryflags flags  :set flags used by parsing.  The flags can be `H' for  
<- 
Section 38.5.4, "Select Whom to /parse or /try with /tryflags"


                  Header or `E' for Envelope, and `S' for Sender or `R'
                  for Recipient.  These can be combined, `HR' sets
                  flags for header recipients.
/canon hostname  :try to canonify hostname.                             
<- 
Section 38.5.1, "Canonify a Host with /canon"


/map mapname key :look up `key' in the indicated `mapname'.             
<- 
Section 38.5.3, "Look up a Database Item with /map"


rules addr       :run the indicated address through the named rules.    
<- 
Section 38.6, "Process-Specified Addresses"


                  Rules can be a comma separated list of rules.
End of HELP info
>

This help output is contained in the sendmail.hf file, the location of which is defined by the HelpFile ( H ) option (see Section 34.8.28, HelpFile (H) ). If that option is not defined or if the file that is specified in it does not exist, you will get the following error message instead of help:

Sendmail 8.8.4 - HELP not implemented

Help for rule-testing mode requires that the help file both exist and contain lines that begin with:

-bt

If you installed a new sendmail but did not install the new help file (thus causing the old file to be used), you may see this error:

HELP topic "-bt" unknown

The solution here is to upgrade your sendmail.hf file to the newest version.

Note that each of the functions listed in the help output will also produce a usage message if it is executed with no arguments. Consider the /try function, for example:

> 

/try


Usage: /try mailer address
>

This parallels the syntax shown in the help output above. These miniusage messages can effectively replace the sendmail.hf file in case it is missing.

Finally note that, although address testing was not listed in the help output for V8.7 sendmail , it still existed. We will cover it in Section 38.6 .


Previous: 37.5 Reference in Numerical Order sendmail Next: 38.2 Configuration Lines
37.5 Reference in Numerical Order Book Index 38.2 Configuration Lines