sendmail, 4th Edition
| The sendmail program's ability to perform different tasks necessitates that the command line be processed in steps.
15.4.1 First: Prescanning the Command Line
When sendmail begins to run, it performs a preliminary scan of its command-line arguments. It does this because some actions need to be performed before the configuration file is read. The -d command-line switch is processed during the prescanning phase. 15.4.2 Second: Processing Prior to the Switches
After the command-line switches are prescanned, but before they are processed in full, sendmail performs two important internal tasks. 15.4.2.1 Initialize the environment
The environment variables that are given to sendmail when it is first run are ignored. When running delivery agents , sendmail provides a small, customized environment. See Section 10.2 for a detailed discussion of this step. 15.4.2.2 Initialize sendmail macros
Certain sendmail macros are next declared and assigned values. The $w macro ($w), $j macro ($v), and $=w class macro ($=w) are given values that identify the current host. The $m macro ($m) is given a value that is the local domain name. The $k macro ($k) and the $=k class ($=k) are also given values at this time. The $v macro ($v) is assigned a value that is the current version of the sendmail program. The $b macro ($b) is given the current date and time as its value. 15.4.3 Third: Processing Switches
Command-line switches are processed by sendmail as they appear in the command line, from left to right. The processing of switches ends when an argument is found that lacks a leading - character, or, beginning with V8, when a -- argument is found. 15.4.4 Fourth: Reading the Configuration File
The fact that the configuration file is read after the command-line switches are processed can lead to some confusion. Some, but not all, command-line switches can overwrite some configuration file commands. Because there is no general rule, we describe the behavior of each item (such as macros and options) in a chapter dedicated to each. 15.4.5 Fifth: Collecting Recipients
The final step sendmail undertakes in processing its command line is gathering the list of recipients. Each recipient (or list of recipients if more than one is contained in a single command-line argument) is fully processed for delivery, and any error messages are printed before delivery is actually undertaken. If sendmail is running in a mode that doesn't require recipients, any list of recipients in the command line is silently ignored. |