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 all the other files that sendmail needs to access and the location of all the directories in which sendmail needs to create and remove files.
The definitions that sendmail uses in rewriting addresses. Some of those definitions can come from files, which are also specified.
The mail header lines that sendmail should modify, pass through, and/or augment.
The rules and sets of rules that sendmail uses for transforming mail addresses (and aliases for those addresses) into usable information, such as which delivery agent to use and the correct form of the address to use with that delivery agent.
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.
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 addingM
andO
fairly quickly. Commands such asK
andV
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.
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.