Processing the Command Line

The sendmail program’s ability to perform different tasks necessitates that the command line be processed in steps.

First

The command line is prescanned to set its -d debugging switch. That switch allows you to watch all the steps taken by sendmail prior to processing the rest of the command-line switches.

Second

Internal sendmail macros are given their starting values, then the command line’s argv[0] (the name used to run sendmail) is processed. That name can determine the sendmail program’s mode of operation.

Third

The command-line switches are processed. Although the configuration file is read after the command line is processed, options in the command line (with -o and -O) still supersede those in the configuration file.

Fourth

The configuration file is read.

Fifth

If sendmail is running in a mode that allows it to verify or deliver to recipients, the remainder of the command line is processed to extract the recipient list.

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.

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.

Initialize the environment

The environment variables that are given to sendmail ...

Get Sendmail, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.