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 the semantics are not well defined in many places). Blank lines and lines beginning with a pound sign (#) are ignored.
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 like M, R, L, G, and V that are already used by sendmail. Lowercase letters and special symbols are used internally.
You can define macros in two ways:
Use D to assign the value directly specified.
Use L to assignsx the value looked up in the sendmailvars database (either the NIS+ sendmailvars table or /etc/mail/sendmailvars file). The L command is classified as a Sun uncommitted interface.
The syntax for D macro definitions is:
DXval |
where X is a letter defining the macro and val is the value it should have. No spaces are allowed. You can insert macros in most places using the escape sequence $X.
Here are examples of D macro definitions from the configuration file:
DRmailhost Dmeng.acme.com |
The variable R is set to contain the value mailhost and the internal variable m is set to contain the value eng.acme.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. For example, ecd.east.acme.com becomes east.acme.com. An even more flexible way to define the mail domain name is to use an L macro definition, as shown in the following example.
The syntax for an L macro definition is:
LXsearch-key |
where X is the name of the macro and search-key is looked up in the sendmailvars database. The value found in the entry located by the search key is assigned to X.
Here is an example of an internal L macro definition from the configuration file:
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 appears as follows:
maildomain eng.acme.com |
the value of m becomes eng.acme.com.
sendmail uses the sendmailvars entry in the /etc/nsswitch.conf file to determine the order in which to search the name space and /etc/mail/sendmailvars file.
You can define classes of words to match the left-hand side of address-rewriting rules. For example, you might create a class of all local names for this site so that you can eliminate attempts to send mail to yourself.
You can give classes names from the set of uppercase letters. Lowercase letters and special characters are reserved for system use.
You can define classes in three ways:
Use C to assign the values directly specified.
Use F to read in the values from another file or from another command.
Use G to assign the values looked up in the sendmailvars database (either the NIS+ sendmailvars table or /etc/mail/sendmailvars file). The G command is classified as a Sun uncommitted interface.
Table 3-6 shows the syntaxes of the different forms of class definition.
Table 3-6 Syntax of Class Definitions in the Configuration File
Rule |
Description |
---|---|
CX word1 word2 |
Class X to match any of the named words |
FX fi1e [pattern] |
Reads words from file into class X |
FX | command |
Reads output from command into class X |
GXsearch_key |
Reads search_key from the sendmailvars database and assigns it to Class X |
The first form simply assigns the named words to match the class X. This example assigns the names monet and ucbmonet to class H:
CHmonet ucbmonet |
The second form reads words from the file into the class X, for example, FC /.rhosts. The pattern argument to the FC class 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 appears as follows:
uucp-list sunmoon hugo comic |
the value of V becomes sunmoon hugo comic.
sendmail uses the sendmailvars entry in the /etc/nsswitch.conf file to determine the order in which to search the name space and /etc/mail/sendmailvars file.
You could split class definitions among multiple lines. For example, the following:
CHmonet ucbmonet |
is equivalent to:
CHmonet CHucbmonet |
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 value |
This sets option c 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 "Configuration Options to sendmail" for the list of options.
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 that error messages are not returned. The default precedence is 0 (zero). For example:
Pfirst-class=0 Pspecial-delivery=100 Pjunk=-100 |
This configuration line has been deleted. It will be accepted but will be ignored.
The H line defines the format of the header lines. The syntax of this line is:
H[c ?c mflagsc ?]c hnamec :c htemplate |
Continuation lines in this specification are inserted directly into the outgoing message. The htemplate is macro-expanded before it is inserted into the message. If the expansion is empty, the header line is not included. If the mflags (surrounded by question marks) are specified, at least one of the specified flags must be stated in the mailer definition before this header can be automatically output. If one of these headers is in the input, it is directed to the output regardless of these flags.