The Configuration File

Contents:
Overall Syntax
Comments
Comments
Continuation Lines
The V Configuration Command
Pitfalls

The sendmail configuration file is usually called sendmail.cf. It provides all the central information that controls the sendmail program's behavior. Among the key pieces of information provided are the following:

The location of the sendmail.cf file is compiled into sendmail. It is usually found in one of the directories /etc, /usr/lib, or /etc/mail. If you are compiling sendmail, you may specify the location of that file yourself by defining _PATH_SENDMAILCF in your Makefile (see PATH...). V8.7 recommends that the sendmail.cf file be located in /etc for consistency. [1] Some vendors, however, prefer other locations. We recommend that one of the standard locations be used unless you have a compelling reason to do otherwise. Nonstandard locations may, for example, make operating system upgrades difficult if you need to revert to prior or vendor versions of sendmail.

[1] Scripts that may be distributed in the future will need the location of the sendmail.cf file to locate other files. If you move the sendmail.cf from its recommended standard location, you will have to modify all such scripts before they can be used.

The configuration file is read and parsed by sendmail every time it starts up. Because sendmail is run every time electronic mail is sent, its configuration file is designed to be easy for sendmail to parse rather than easy for humans to read.

Overall Syntax

The sendmail.cf file is line-oriented, with one configuration command per line. Each configuration command consists of a single letter [2] that must begin a line. Each letter is followed by other information as required by the purpose of the particular command.

[2] A quick bit of history: Initially, there was almost nothing in the configuration file except R rules (and there was only one rule set). Eric recalls adding M and O fairly quickly. Commands such as K and V came quite late.

In addition to commands, the configuration file may also have lines that begin with a # to form a comment line or with a tab or space character to form a continuation line. A list of all legal characters that may begin a line in the configuration file is shown in Table 27.1.

sendmail.cf Configuration Commands
Command Version Description
# "Comments" All comment line, ignored
space "Continuation Lines" All Continue the previous line
tab All Continue the previous line
C "Class Configuration Commands" All Define a class macro
D "Configuration File Definitions" All Define a macro
E "The E Configuration Command" and above Environment for agents
F All Define a class macro from a file or a pipe
H "The H Configuration Command" All Define a header
K "The K Configuration Command" and above Create a keyed map entry
M "Configuration File Syntax" All Define a mail delivery agent
O "Configuration-File Options" All Define an option
P "Precedence" All Define delivery priorities
R "Overview" All Define a transformation rule
S "The S Configuration Command" All Declare a rule-set start
T "Declare trusted users (not V8.1 through V8.6)" All Declare trusted users (ignored V8.1-V8.6)
V "The V Configuration Command" and above Version of configuration file

Most configuration commands are so complex that each requires a chapter or two of its own. A few, however, are simple. Now we will describe the simple ones: comments, continuation lines, and the V (version) command.