sendmail.cf(4) — File Formats
OSF
NAME
sendmail.cf - Contains the sendmail configuration file data
SYNOPSIS
/var/adm/sendmail/sendmail.cf
DESCRIPTION
The sendmail.cf file contains configuration information for the sendmail daemon. Use the sendmail -bz command after changing any information in the sendmail.cf file. The sendmail -bz command builds a configuration file that the sendmail daemon can read.
The sendmail.cf configuration file consists of a series of control lines, each of which begins with a single character that defines how the rest of the line is used. Lines beginning with a space or a tab are continuation lines. Blank lines and lines beginning with a # (number sign) are comments. The control line can be used for the following functions:
•Defining macros and classes for use within the configuration file
•Defining message precedence for mail delivery
•Defining administrative IDs to override the sender’s address
•Defining message headings
•Defining the mail daemon to use
•Setting options used by the sendmail command
You can edit the sendmail.cf configuration file with any text editor.
The configuration file entries consist of lines, each of which begins with a single-character command and an operand. Continue entries onto multiple lines by placing white space at the beginning of each subsequent line. The # (number sign) indicates that the following line is a comment line.
Defining Macros and Classes (D Control Line and C Control Line)
Macros and classes in the sendmail.cf configuration file are interpreted by the sendmail daemon. A macro is a symbol that represents a value or string, for example, or an Internet address. A macro is defined by a D control line in the sendmail.cf file. Macros are not expanded until the sendmail daemon loads the rule sets when it starts up. The sendmail.cf file contains system-defined macros and required macros that you must define.
A class is a symbol that represents a set of one or more words, for example, or a filename. Classes are used in pattern matching when the sendmail daemon is parsing addresses. You can create a class using a list or you can create a class using a file.
The following letters introduce configuration-file control lines that define macros and classes to set up the sendmail daemon:
DMacroValue
Defines a macro and assigns a value to it. If a second DMacroValue defines the same symbol, the second definition replaces the first definition. The symbol must be a single character selected from the ASCII set. Use uppercase letters for macros and classes that you define. Lowercase letters and special symbols are macros and classes defined by the daemon.
CClass String
Defines Class to be a class and assigns a word or group of words (String) to it. If a second CClass String defines the same symbol, the String from the second definition is added to the String from the first definition. No words are deleted from the class definition. Class specifiers may be any of the uppercase letters from the ASCII character set. Lowercase letters and special characters are reserved for system use.
F Class FileName [Format]
Defines symbol Class to be a class and assigns a word or group of words listed in a separate file to the symbol. You can specify an optional scanf format specifier. Class specifiers may be any of the uppercase letters from the ASCII character set. Lowercase letters and special characters are reserved for system use.
To use a macro or class in a control line, put a $ (dollar sign) before its name. For example, if the name of the macro is x, use $x when using that macro in a control line. Without the preceding $, the daemon interprets x as only the letter "x". The format for specifying conditional expressions is as follows:
$?Macro Text1 $| Text2 $.
In this format, the symbols have the following meaning:
$?If.
MacroThe macro being tested.
Text1The pattern to be used if $x is defined.
$|Else. (This symbol is not required.)
Text2The pattern to be used if $Macro is not defined.
$.Specifies the end of the conditional expression.
Do not use any of the characters defined as tokens (by the required macro o) when defining a word in a class. The sendmail daemon may not be able to read the definition correctly.
Defining Message Precedence (P Control Line)
The sendmail.cf configuration file also contains lines to define mail-queue precedence for messages that contain a Precedence: field. Normally, you do not need to change the values in the default sendmail.cf configuration file.
The name defined and the numerical value assigned are based on the needs of the network. Higher numbers have higher priority; numbers less than 0 (zero) indicate that error messages will not be returned to the sender of these messages. The precedence value is 0 (zero) for any precedence name not defined in this file. For example, the configuration file may contain the following entries:
Pfirst-class=0
Pspecial-delivery=100
Pbulk=-60
Pjunk=-100
These entries set special-delivery as the highest priority message and junk as the lowest priority.
Defining Administrative IDs (T Control Line)
Administrative IDs can override the sender address using the -f flag to the sendmail command. The sendmail.cf configuration file defines these IDs with the T control line. For example, the configuration file may contain the following entries:
Troot
Tdaemon
Tuucp
These entries define IDs root, daemon, and uucp as administrative IDs for the sendmail command.
These IDs could have been defined using only one T control line:
Troot daemon uucp network
Defining Message Headings (H Control Line)
The sendmail daemon expects mail to have the following parts in the following order:
1.An operating system From line (defined by the five characters: F, r, o, m, and space)
2.Mail header lines that begin with a keyword followed by a colon, such as From: or To:
3.An empty line
4.The body of the message
The sendmail daemon detects the operating system From line by checking the first five characters of the first line. After that, header lines are processed. When it detects a line that does not begin with a keyword followed by a colon, it ends header line processing. If an empty line occurs at that point, it is ignored.
Mailer flags or the mailer itself determine if an operating system From: line is generated. Other header lines are present (or not) depending on those defined in the sendmail configuration file, those specified by mailer flags, and those present in incoming mail.
Note that the binmail daemon generates a From: line on all local deliveries. The sendmail mailer flags do not allow you to alter this.
Lines in the configuration file that begin with a capital letter H define the format of the headers used in messages. The format of the H control line line is as follows:
H[?MailerFlags?]FieldName: Content
In this format, the variable parameters have the following meaning:
MailerFlagsThis field is optional. If you supply it, surround it with ? (question marks). This field contains mailer flags that determine whether this H line is used. If the mailer being used requires the information specified by the mailer flag, then this H control line is included when formatting the heading. Otherwise, this H control line is ignored.
FieldNameThis field contains the text that is displayed as the name of the field in the heading information. The actual text used is a matter of choice. Some typical field names include From:, To:, and Rcvd From:.
ContentThis field defines the information that is displayed following the field name. It usually uses a sendmail macro to specify the information.
The following example lines are from a typical sendmail.cf file:
H?P?Return-Path: <$g>
This line defines a field called Return-Path: that displays the contents of the $g macro (sender address relative to the receiver). The ?P? portion indicates that this line is only used if the mailer uses the P flag (the mailer requires a Return-Path line).
HReceived: $?sfrom $s $.by $j ($v/$Z)
id $i; $b
This line defines a field called Received. This field displays the following information:
$?sfrom $s $.
If an s macro is defined (sender’s hostname), displays the text from followed by the content of the $s macro.
by $jDisplays the text by followed by the content of the $j macro (official name for this site).
( $v/$Z)Displays the version of the sendmail daemon ($v) and the version of the sendmail.cf file ($Z) set off by parentheses and separated by a slash.
id $i;Displays the text id followed by the content of the $i macro (mail-queue ID of the message) and a ; (semicolon).
$bDisplays the current date.
Defining a Mailer (M Control Line)
A mailer is a daemon that delivers mail either locally or over some type of network to another system. Use control lines that begin with the letter M to define the characteristics of a mailer daemon that interfaces with sendmail.
Note that defining a mail daemon entry (mailer) in the sendmail.cf configuration file does not ensure that it will be used. You must also define rewrite rules to ensure the address format resolves to that mailer.
The format of a mailer definition control line is as follows:
M=MailerName,
P=Path,
F=Flags,
S=Integers,E=EndOfLine,
A=String,
M=Limit
The following paragraphs and examples describe the parameters for the mailer definition.
Specifying a Mailer Name (MMailerName)
Each mailer must have an internal name. The name can be any string that you choose, except that the names local and prog are reserved for the mailers for local delivery and delivery to daemons. You must provide definitions for these two mailers in the sendmail.cf configuration file if they are not already there (the default configuration file contains these definitions). To define the mailer name, put the name immediately after the M in the mailer-definition control line:
MMailerName
For example, the following segment introduces the definition line for a mailer called lan:
Mlan
Defining the Path to the Mailer Daemon (P=Path)
Specify the location of the mailer daemon with the P field in the mailer definition. This field has the format:
P=Path
The Path defines the full pathname of the mailer daemon on the local system. If the mailer daemon is the sendmail daemon version of Simple Mail Transfer Protocol (SMTP) (daemon), use the string [IPC] as the path. For example, the following two mailer-definition fragments define a local mailer at /usr/bin/mail and another mailer that is the sendmail daemon implementation of SMTP:
Mlocal, P=/usr/bin/mail,
Mlan, P=[IPC],
Specifying Mailer Flags (F=Flags)
Mailer flags provide further information to the sendmail daemon about the mailer daemon being described. Specify mailer flags with the F field in the mailer-definition. This field has the format:
F=Flags
This field defines the meaning for the flags that the sendmail daemon recognizes. For example, the following mailer-definition fragment uses the -rlsm flags to indicate that the mailer requires a -r flag, delivers locally, needs quotation marks stripped from addresses, and can deliver to more than one user at a time:
Mlocal, P=/usr/bin/mail, F=rlsm,
Flags available for the F=Flags field are as follows:
CIf this flag is set, this mailer inspects the address of any incoming mail that it processes for the presence of an @ (at sign). If it finds an @, it saves the @ and the remainder of the address to be used when rewriting addresses in header lines in the message (when mail is forwarded to any mailer). The receiving mailer adds the saved portion of the address to any address that does not contain an @, after the address has been processed by rule set 3 (this processing does not depend upon a mailer flag; it always occurs). Do not use this flag for general operation, since it does not interpret complex, route-based addresses properly.
DThe mailer defined in this mailer-definition control line needs a Date: or Resent-Date: header line.
eThe mailer defined in this mailer-definition control line is expensive to connect to. If the C configuration option is set, mail for this mailer is always placed in the queue.
EThis flag causes the mailer in the definition control line to allow lines beginning with the exact six characters >, F, r, o, m, and space to appear in the text of a message. Normally From: lines are treated as header lines. The E flag allows operating system From: lines (or any other text lines beginning with those six characters) to appear in the body of the message without being interpreted as the start of a new message.
fThe mailer in the mailer-definition control line needs a -f flag. The flag is inserted into the call for the mailer followed by the expansion of the $g macro (sender’s address relative to the receiver).
FThe mailer in the mailer-definition control line needs a From: or Resent-From: header line.
hPreserves uppercase letters in hostnames for the mailer in the mailer-definition control line.
IThe mailer in the mailer-definition control line uses Simple Mail Transfer Protocol (SMTP) to communicate with another SMTP server that is part of the sendmail daemon. When communicating with another sendmail daemon, the mailer can use features that are not part of the standard SMTP protocol. This option is not required, but causes the transmission to operate more efficiently than without the option.
lThe mailer in the mailer-definition control line is local; final delivery will be performed.
LThe L flag enforces SMTP line lengths.
mThe mailer in the mailer-definition control line can be sent to multiple users on the same host in one transaction. When a $u macro occurs in the String part of the mailer-definition, that field will le.
OQ/usr/spool/mqueue
Sets the mail-queue directory option variable Q to a directory (/usr/spool/mqueue) that defines where the mail log is to be kept.
OA/var/adm/sendmail/aliases
Sets the option variable A to the full pathname of the aliases file (/var/adm/sendmail/aliases).
Setting Delivery Mode (OdValue)
The sendmail daemon can operate in several delivery modes. The default configuration file sets the delivery mode to b. However, you can change the delivery mode with the OdValue option in the configuration file. These modes specify how quickly mail will be delivered. Legal values include the following:
iDeliver interactively.
bDeliver in background. (This is the default.)
qQueue the message and deliver during queue run.
Time-Out Option (OrNumber and OTNumber)
The sendmail daemon can time out when reading standard input or when reading from a remote SMTP server. The default configuration file sets this value to 5 minutes. This value should be correct for most situations. However, if you need to change the time-out value, change the r option in the configuration file. The r option has the format:
OrNumber
In this format, Number is the number of minutes that the sendmail daemon should wait until timing out.
After sitting in the queue for a few days, a message times out. The sendmail daemon notifies the sender of the message that it could not be sent. The time out is typically set to 3 days. Set this time out with the T option in the sendmail.cf configuration file:
OTNumber
In this format, Number is the number of days the sendmail daemon leaves the message in the queue before timing out the message.
Operational Logging Level Option (OLNumber)
The OL option specifies the log level to be used when the sendmail daemon is running.
The format of the line to change the operational logging level is:
OLNumber
Following is a list of valid levels (Number) and the activities that they represent (each number includes the activities of all numbers of lesser value and adds the activity that it represents):
0No logging.
1Major problems only.
2Message collections and failed deliveries.
3Successful deliveries.
4Messages being deferred (due to a host being down, and so on).
5Placing messages in the queue (normal event).
6Unusual but benign incidents (trying to process a locked file, and so on).
9Log internal queue ID to external message ID mappings. This can be useful for tracing a message as it travels among several hosts.
12Several messages that are of interest when debugging.
16Verbose information regarding the queue.
The default level is OL9.
Message Queue Options (OOption[Value])
Three options adjust the way the sendmail daemon handles the message queue. To use this control line in the sendmail.cf configuration file, use the format:
OOption[Value]
The following Options values are allowed:
cCauses sendmail to queue messages for that mailer daemon without sending them if an outgoing mailer is marked as expensive to use. The queue can be run when costs are lower or when the queue is large enough to send the message efficiently.
QDirectorySets the directory in which to queue messages. The directory will be created if it does not exist.
sEnqueues before delivery, even when in immediate delivery mode.
YThe sendmail daemon delivers each message in the mail queue from a separate process. This option is not required; it can increase system overhead in the OSF/1 environment.
Mail Statistics File Option (OOption[Value])
One option for the O control line changes the mail statistics file. Use the format:
OOption[Value]
The following option is allowed:
SFileSets the mail statistics file to File. Statistics are only collected if the file exists. This file must be created by the user. The recommended path for this is /var/adm/sendmail/sendmail.st. Statistics can be printed out using /usr/sbin/mailstats.
Returned Mail Option (OPAddress)
PAddressIdentifies the person who is to receive a copy of all returned mail.
Alias Options (OOption[Value])
AFileUses the named File as the alias file.
mIf the sender uses an alias, and that sender is a member of the group named by the alias, then also send to the sender.
Header Options (OOption[Value])
fSaves From: lines at the front of messages. These lines are normally discarded. Causes all other headers to be regarded as part of the message body.
oIndicates that this message can have old style headers. Without this option, the message has new style headers (commas instead of spaces between addresses). If this option is set, an adaptive algorithm correctly determines the header format in most cases.
Verbose Mode Option (Ov)
vRuns in verbose mode.
SMPT Helpfile Option (HFileName)
HFileNameSpecifies the name of the SMTP help file.
ID Options (OOptionNumber)
The following options allow you to set group and user IDs for specific mailers. Use the format:
OOptionNumber
The following options are available to set group and user IDs:
gNumberSets the default group ID to the value specified by Number. The sendmail daemon uses this ID when it calls mailers.
uNumberSets the default user ID to the value specified by Number. The sendmail daemon uses this ID when it calls mailers.
Character Interpretation Options (OOption[Value])
The sendmail daemon interprets certain characters as having a special function. Use the format:
OOption[Value]
You can set the interpretations with the following options:
BCharacterSets the blank substitution character to the character specified in the c parameter. The sendmail daemon replaces unquoted spaces in addresses with Character. The supplied configuration file uses the . (dot) for Character.
iDoes not interpret a . (dot) on a line by itself as a message terminator. Removes the excess dot inserted by a remote mailer at the beginning of a line if mail is received through SMTP. In addition, if receiving mail through SMTP, any dot at the front of a line followed by another dot is removed. This is the opposite of the action performed by the X mailer flag.
Rewrite Rules Options (OOption[Value])
The following two options allow you to alter the sendmail daemon’s use of rewrite rules. Use the format:
OOption[Value]
The following options are available to the sendmail daemon for rewrite rules:
-nValidates the right-hand side of alias rewrite rules when the sendmail daemon performs the newaliases function.
-IIndicate that sendmail should use the Internet domain name server if it can.
Error Processing Modes Option (OeValue)
The following options set the error-processing mode. Use the format:
OeValue
-eValueSets error processing to mode Value. Valid modes are:
-eMails the error message to the user’s mailbox, but always exits with a 0 (zero) exit status (normal return).
-mMails the error message to the user’s mailbox.
-pDisplays the error message on the terminal (default).
-qDiscards the error message and returns the exit status only.
Host Network Name Option (ONNetworkName)
Sets the name of your host network with an option in the O control line in the sendmail.cf file.
-NNetworkName
Sets the name of the host network to NetworkName. The sendmail daemon compares the argument of an SMTP HELLO command to HostName.NetworkName (value of HostName comes from the kernel). If these values do not match, it adds the HostName.NetworkName string to the Received: line in the message so that messages can be traced accurately.
Macro Definition Option (OMacroValue)
You can use the O control line to define a macro. Use the following option to do so:
-MMacro Value
Defines Macro to have Value. This option is normally used only from the sendmail daemon command line.
Configuration File Revision Level Option (DZNumber)
The configuration file revision level macro, Z, helps you track changes that you make to the sendmail configuration file. Each time that you make a change to the sendmail configuration file, you should also change the value of this macro. Choose any format for the number that you define. For example, if the sendmail configuration file is at level 3.1, the following entry appears in the sendmail configuration file:
DZ3.1
A text string can also be used for this macro:
DZversion_one
RELATED INFORMATION
Commands: sendmail(8)