sendmail

sendmailSearch this book
Previous: 4.4 Things to TryChapter 5Next: 5.2 The Minimal File
 

5. The sendmail.cf File

Contents:
Overview
The Minimal File
A Quick Tour
Things to Try

The lines of text in a sendmail.cf file have been described by some as resembling modem noise and by others as resembling Mr. Dithers swearing in the comic strip Blondie.

R$+@$=W     <- sendmail.cf file
{$/{{.+     <- modem noise
!@#!@@!     <- Mr. Dithers swearing

Constructs like the following can certainly be intimidating to the newcomer:

R$+@$=W         $@$1@$H         user@thishost -> user@hub
R$=W!$+         $@$2@$H         thishost!user -> user@hub
R@$=W:$+        $@@$H:$2        @thishost:something
R$+%$=W         $@$>3$1@$2      user%thishost

But think back to your early days of C programming. Did you feel any more comfortable with an expression like this?

#define getc(p)  (-(p)->_cnt>=0? ((int)*(p)->_ptr++):_filbuf(p))

Like any new language, learning the language that is used in the sendmail.cf file requires time and practice. In the chapters that follow, we introduce that language, but first we present an overview of the sendmail.cf file.

5.1 Overview

The sendmail.cf file is read and parsed by sendmail every time sendmail starts. It contains information that is necessary for sendmail to run. It lists the locations of important files and specifies the default permissions for those files. It contains options that modify sendmail's behavior. Most important, it contains rules and rule sets for rewriting addresses.

The sendmail.cf configuration file is line-oriented. A configuration command, composed of a single letter, begins each line:

V7                  <-  good
 V7                 <-  bad, does not begin a line
V7 Fw/etc/mxhosts   <-  bad, two commands on one line
Fw/etc/mxhosts      <-  good

Each configuration command is followed by parameters that are specific to it. For example, the V command is followed by a number, whereas the F command is followed by the letter w, then the full pathname of a file. The complete list of configuration commands [1] is shown in Table 5.1.

[1] Note that other versions of sendmail, such as Sun or IDA, may have more, fewer, or different commands. We don't document those other versions in this book.

Table 5.1: The sendmail.cf File's Configuration Commands
CommandDescription
VDefine configuration file version (beginning with V8.6)
MDefine a mail delivery agent
DDefine a macro
RDefine a rewriting rule
SDeclare a rule-set start
CDefine a class macro
FDefine a class macro from a file or a pipe
ODefine an option
HDefine a header
PDefine delivery priorities
TDeclare trusted users (ignored in V8.1, back in V8.7)
KDeclare a keyed database (beginning with V8.1)
EDefine an environment variable (beginning with V8.7)
LInclude extended load average support (contributed software, not covered)

Some commands, such as V should appear only once in your sendmail.cf file. Others, such as R, may appear often.

Blank lines and lines that begin with the # character are considered comments and are ignored. A line that begins with either a tab or a space character is a continuation of the preceding line:

# a comment
V7
     /Berkeley  <- continuation of V line above
  -^
 tab

Note that anything other than a command, a blank line, a space, a tab, or a # character causes an error. If the sendmail program finds such a character, it prints the following warning, ignores that line, and continues to read the configuration file:

sendmail.cf: line 15: unknown control line "v6"

Here, sendmail found a line in its sendmail.cf file that began with the letter v. Since a lowercase v is not a legal command, sendmail printed a warning. The line number in the warning is that of the line in the sendmail.cf file that began with the illegal character.

An example of each kind of command is illustrated in the following sections. They are actual commands that you will see described throughout this tutorial. Don't be concerned if you don't understand the details at this time. All that is now mysterious will eventually become clear.


Previous: 4.4 Things to TrysendmailNext: 5.2 The Minimal File
4.4 Things to TryBook Index5.2 The Minimal File