Next | Prev | Up | Top | Contents | Index

The Syntax

The configuration file is a series of lines, each of which begins with a character that defines the semantics for the rest of the line. A line beginning with a space or a tab is a continuation line (although the semantics are not well defined in many places). A blank line or a line beginning with the number symbol (#) is a comment.


Rewriting Rules--The S and R Commands

The rewriting rules are the core of address parsing. These rules form an ordered production system. During parsing, sendmail scans the set of rewriting rules, looking for a match on the left-hand side (ls) of the rule. When a rule matches, the address is replaced by the right-hand side (rhs) of the rule.

The rewriting rules are grouped into sets of one or more rules. Each set has an integer identifier called a rule set number. Each rule set acts like a subroutine: When the set is called, each rule is scanned in sequence until all rules have been scanned or until the rule set returns to the caller.

Some rule sets are used internally and have specific semantics. Others do not have specifically assigned semantics and can be referenced by mailer definitions or by other rule sets.

Each rule set begins with an S command, with the syntax

Sn

where n is the rule set identifier, an integer between 0 and 99. If the same rule set identifier is used more than once in a configuration file, the last definition is the one used.

Each line within the rule set begins with an R command and defines a rewrite rule. R commands have the syntax

Rlhs rhs [comments]

where the following conditions exist:


Define Macro--The D Command

The D command names a macro and defines its content. A macro name is a single ASCII character. sendmail defines several internal macros of its own. To avoid conflicts, use uppercase letters for all user-defined macros. Lowercase letters and special characters are reserved for system use. (A list of sendmail's internally defined macros appears under the topic "Special Macros and Conditionals".)

The Define Macro command takes one of the following forms:

DxValue

Dx|shell_command [arguments]

where x is the name of the macro. The first form defines the macro to contain Value. The second form defines the macro as the first line seen on stdout of the specified shell command. The vertical bar must immediately follow the macro identifier; no white space is permitted. The remainder of the line is interpreted as arguments to the shell command.

Macros can be interpolated in most places by means of the escape sequence $x.

Caution: sendmail does not honor comments on macro definition lines. For example, the following line defines the D macro as "foo.com # my domain name": DDfoo.com # my domain name


Define Classes--The C and F Commands

The C command defines classes of words to match on the left-hand side of rewriting rules, where a "word" is a sequence of characters. A class name is a single uppercase letter. A class might define a site's local names and be used to eliminate attempts to send to oneself. Classes can be defined either directly in the configuration file or by being read in from a pipe or other file. The sequence cannot contain characters used as "operators" in addresses. (Operators are defined with the $o macro.)

The C command takes one of the following forms:

CX word1 [word2 ...]

CX $x [$y ...]

where X is the class name. The first form defines the class to match any of the named words. The second form reads the elements of the class from the expansion of the listed macros. The macros to be expanded must be leftmost in each token. Only one macro can be expanded per token. Any remainder in a token following a macro expansion is added as a separate token.

The F command defines a file from which to read the elements of a class, and takes either of the following forms:

FX file [format]

FX|shell_command [arguments]

The first form reads the elements of the class from the named file. If an optional format argument is present, it is passed as the control string to an sscanf() call and applied to each input line read from the named file, thus:

sscanf(const char *line, const char *format, char *new-element);

There must be no white space to the left of the filename.

The second form reads the elements of the class from stdout of the specified shell command. The entire contents of the line are taken to be a shell command followed by its arguments.

It is permissible to split class definitions across multiple lines. For example, these two forms are equivalent:

CHmonet picasso
and

CHmonet
CHpicasso
It is also permissible to define a class using both C and F commands. For example, the following commands define class H containing monet, picasso, the expansion of the $w macro, and all strings from the file /var/tmp/foofile appearing before the first number symbol (#) on each line:

CHmonet picasso $w
FH/var/tmp/foofile %[^#]

Caution: sendmail does not honor comments that are not respected on class definition lines. For example, the following command defines the D class as containing "foo.com," "bar.com," "#," "my," "local," and "domains":

CD foo.com bar.com # my local domains


Define Mailer--The M Command

The M command defines programs and interfaces to mailers. The format is as follows:

Mname, {field=value}*

where name is the name of the mailer (used internally only) and the field=value pairs define attributes of the mailer. The asterisk (*) indicates that the preceding bracketed structure may be repeated 0 or more times. That is, there may be multiple field=value pairs. The following list defines valid field names:

Path

The pathname of the mailer.

Flags

Special flags for this mailer; see "Flags, Options, and Files" for a list of special flags.

Sender

A rewriting set for sender addresses.

Recipient

A rewriting set for recipient addresses.

Argv

An argument vector to pass to this mailer.

Eol

The end-of-line string for this mailer.

Maxsize

The maximum message length to this mailer.
Only the first character of the field name is checked.


Define Header-The H Command

The H command defines the format of header lines that sendmail inserts into a message. The command format is as follows:

H[?mflags?]hname: htemplate

Continuation lines for an H command line appear in the outgoing message. sendmail macro-expands the htemplate before inserting it into the message. If mflags (which must be surrounded by question marks) appear in the command line, at least one of the specified flags must also appear in the mailer definition or the header will not appear in the message. However, if a header appears in the input message, the header also appears in the output, regardless of these flags.

Some headers have special semantics, which are described in "The Semantics".


Set Option--The O Command

Several sendmail options can be set by a command line in the configuration file. Each option is identified by a single character.

The format of the O command line is as follows:

Oo value

The command sets option o to value. Depending on the option, value is a string; an integer; a Boolean (with legal values "t," "T," "f," or "F" and a default of TRUE); or a time interval.

The K command is a new command available in IRIX sendmail. This command defines (K)eyed databases that are accessible by means of the lookup operators. See "Define Keyed Files--The K Command" for a complete description of the K command.


Define Trusted Users--The T Command

Trusted users are permitted to override the sender address by using the -f flag. Typically, trusted users are limited to root, uucp, and network. On some systems it may be convenient to include other users. For example, there may be a separate uucp login for each host. Note, though, that the concept of trusted users in sendmail bears no relation to Trusted IRIX/B, or to the concept of trusted (secure) operating systems in general.

The format of the T command is as follows:

Tuser1 user2...

A configuration file can contain multiple T lines.


Define Precedence--The P Command

The P command defines values for the Precedence field. The format of the command line is as follows:

Pname=num

When sendmail matches the value in a message's Precedence field with the name in a P command line, sendmail sets the message's class to num. A higher number indicates a higher precedence. Negative numbers indicate that error messages will not be returned to the sender. The default precedence is zero. For example, a list of precedences might be

Pfirst-class=0

Pspecial-delivery=100

Pjunk=-100


Define Keyed Files--The K Command

The K command defines a symbolic name for accessing a database. The format of the command line is as follows:

Kname type file

The name value is the name used to specify the database in a lookup command. The type defines the type of database file, which can be one of the following:

dbm

Support for the ndbm(3) library.

nis

Support for NIS (YP) maps. NIS+ is not supported in this version.

host

Support for DNS lookups.

dequote

A "pseudo-map" (that is, one that does not have any external data) that allows a configuration file to break apart a quoted string in the address. This is primarily useful for DECnet addresses, which often have quoted addresses that need to be unwrapped on gateways.
The file value specifies the filename of the database to be searched.


Next | Prev | Up | Top | Contents | Index