home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

sendmail

sendmailSearch this book
Previous: IV. Reference Chapter 27 Next: 27.2 Comments
 

27. The Configuration File

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.

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
Command Version Description
# Section 27.2, "Comments" All A comment line, ignored
space Section 27.4, "Continuation Lines" All Continue the previous line
tab Section 27.4 All Continue the previous line
C Section 32.1, "Class Configuration Commands" All Define a class macro
D Section 31.3, "Configuration File Definitions" All Define a macro
E Section 22.2.1, "The E Configuration Command" 8.7 and above Environment for agents
F Section 32.1 All Define a class macro from a file or a pipe
H Section 35.1, "The H Configuration Command" All Define a header
K Section 33.3, "The K Configuration Command" V8.1 and above Create a keyed map entry
M Section 30.1, "Configuration File Syntax" All Define a mail delivery agent
O Section 34.2, "Configuration-File Options" All Define an option
P Section 35.8, "Precedence" All Define delivery priorities
R Section 28.1, "Overview" All Define a transformation rule
S Section 29.1, "The S Configuration Command" All Declare a rule-set start
T Section 22.8.1.1, "Declare trusted users (not V8.1 through V8.6)" All Declare trusted users (ignored V8.1-V8.6)
V Section 27.5, "The V Configuration Command" V8.1 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. In this chapter we will describe the simple ones: comments, continuation lines, and the V (version) command.











??????????????@Mail.ru