Previous Table of Contents Next


Configuration File Syntax

The configuration file is organized as a series of lines, each of which begins with a single character defining the semantics for the rest of the line. Lines beginning with a space or a Tab are continuation lines (although in many places the semantics are not well defined). Blank lines and lines beginning with a pound sign (#) are comments.

D and L (Define Macro)

Macros are named with a single character. Although a macro can be defined with any character from the complete ASCII set, use only uppercase letters for macros that you define. However, do not use characters such as M, R, L, G, and V, which are already used in the default sendmail.cf file. Lowercase letters and special symbols are used internally. You can define macros in two ways:

  D assigns the value directly specified.
  L assigns the value looked up in the sendmailvars database (either the NIS+ table or the /etc/mail/sendmailvars file). The L command is classified as an uncommitted interface.

The syntax for D macro definitions is

DXval

in which X is the name of the macro and val is the value it should have. Spaces are not allowed. Macros can be inserted in most places using the escape sequence $X.

An example of D macro definitions from the configuration file follows:

DRmailhost
DmEng.Sun.COM

The variable R is set to contain the value mailhost and the internal variable m is set to contain the value Eng.Sun.COM.

The m macro defines the mail domain. If it is not defined, the name service domain name is used with the first component stripped off. For example, Ecd.East.Sun.COM becomes East.Sun.COM.

The syntax for an L macro definition, which is an even more flexible way to define the mail domain name, is

LXsearch_key

in which X is the name of the macro and search_key is searched in the sendmailvars database. The value found in the entry located by the search key is assigned to X.

An example of an internal L macro definition from the configuration file follows:

Lmmaildomain

The variable m is set to the value found in the sendmailvars database using maildomain as the search key. If the entry in the sendmailvars database looks like this example:

maildomain    Eng.Sun.COM

the value of m becomes Eng.Sun.COM.


NOTE:  The sendmail program uses the sendmailvars entry in the /etc/nsswitch.conf file to determine the order in which it searches the NIS+ database and the /etc/mail/ sendmailvars database.

C, F, and G (Define Classes)

You can define classes of words to match on the left side of rewriting rules. For example, you might create a class of all local names for this site so that you can eliminate attempts to send to yourself.

Classes may be named from the set of uppercase letters. Lowercase letters and special characters are reserved for system use. You can define classes in three ways:

  C assigns the value(s) specified directly.
  F reads in the value(s) from another file or from another command.
  G assigns the value(s) looked up in the sendmailvars database (either the NIS+ database or the /etc/mail/sendmailvars file). The G command is classified as an uncommitted interface.

The syntax of the different forms of class definition is

CC word1 word2
FC file
FC| command
GCsearch_key

The first form defines the class C to match any of the named words. The second form reads words from the file into the class C, for example, FC /.rhosts. The format is used with scanf to read from the file; otherwise, the first word from each line is used. The third form executes the given command and reads the elements of the class from standard output of the command. For example,

FC|awk'{print $2}'/etc/hosts

The fourth form reads the elements of the class from the entry in the sendmailvars database pointed to by the search key. For example,

GVuucp-list

gets the definition of class V from the uucp-list entry in the sendmailvars database.If the entry in the sendmailvars database looks like this:

uucp-list           castle oak cinderella

the value of V becomes castle oak cinderella.


NOTE:  The sendmail program uses the sendmailvars entry in the /etc/nsswitch.conf file to determine the order in which it searches the NIS+ database and the /etc/mail/sendmailvars database.

You can split class definitions among multiple lines. For example,

CHmonet ucbmonet

is equivalent to

CHmonet
CHucbmonet

O (Set Option)

You can set several options (not to be confused with mailer flags or command-line arguments) from a configuration file. Options are also represented by single characters. The syntax of this line is

OC ovalue

Option C is set to value. Depending on the option, value may be a string, an integer, a boolean (with legal values t, T, f, or F--the default is true), or a time interval. See the section "Configuration Options" later in this chapter for the list of options.

P (Precedence Definitions)

You can define values for the Precedence: field using the P control line. The syntax of this field is

Pname=num

When the name is found in a Precedence: field, the message class is set to num. Higher numbers mean higher precedence. Numbers less than zero have the special property in which error messages are not returned. The default precedence is zero. For example,

Pfirst-class=0
Pspecial-delivery=100
Pjunk=-100

T (Define Trusted Users)

Trusted users are those users who are permitted to override the sender name using the -f flag. These users typically are root, uucp, daemon, and network. For some sites, it may be convenient to extend this list to include other users, perhaps to support a separate uucp login for each host. The syntax of this line is

T user . . .

You can use more than one line to define trusted users.


Previous Table of Contents Next