[Chapter 27] The Configuration File

sendmail

sendmailSearch this book
Previous: IV. ReferenceChapter 27Next: 27.2 Comments
 

27. The Configuration File

Contents:
Overall Syntax
Comments
V8 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 Section 18.8.34, 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.

27.1 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.

Table 27.1: sendmail.cf Configuration Commands
CommandVersionDescription
#Section 27.2, "Comments"AllA comment line, ignored
spaceSection 27.4, "Continuation Lines"AllContinue the previous line
tabSection 27.4AllContinue the previous line
CSection 32.1, "Class Configuration Commands"AllDefine a class macro
DSection 31.3, "Configuration File Definitions"AllDefine a macro
ESection 22.2.1, "The E Configuration Command"8.7 and aboveEnvironment for agents
FSection 32.1AllDefine a class macro from a file or a pipe
HSection 35.1, "The H Configuration Command"AllDefine a header
KSection 33.3, "The K Configuration Command"V8.1 and aboveCreate a keyed map entry
MSection 30.1, "Configuration File Syntax"AllDefine a mail delivery agent
OSection 34.2, "Configuration-File Options"AllDefine an option
PSection 35.8, "Precedence"AllDefine delivery priorities
RSection 28.1, "Overview"AllDefine a transformation rule
SSection 29.1, "The S Configuration Command"AllDeclare a rule-set start
TSection 22.8.1.1, "Declare trusted users (not V8.1 through V8.6)"AllDeclare trusted users (ignored V8.1-V8.6)
VSection 27.5, "The V Configuration Command"V8.1 and aboveVersion of configuration file

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


Previous: IV. ReferencesendmailNext: 27.2 Comments
IV. ReferenceBook Index27.2 Comments