The sendmail.cf file contains configuration information for the sendmail daemon. For further information on sendmail, see the sendmail(8) reference page, the sendmail book by O'Reilly & Associates, or the Sendmail Installation and Operation Guide. The guide is located at the following URL: http://uwsg.ucs.indiana.edu/usail/mail/op/op.html
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 Defining the syntax version used within the configuration file Defining rules and rule sets Setting options used by the sendmail command
Tru64 UNIX provides tools to help you create a reasonable sendmail.cf file. See the mailconfig.8X and the mailsetup.8 reference pages for further information.
While a rule set must start with an S control line, there is no obvious "end-of-ruleset" marker. All rules following an S control line are considered to be part of that rule until either a new S control line, or the end of the file are encountered.
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: 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. 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. 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. The macro being tested. The pattern to be used if $x is defined. Else. (This symbol is not required.) The 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.
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.
These entries define IDs root, daemon, and uucp as administrative IDs for the sendmail command. Alternatively, these IDs could have been defined using only one T control line: Troot daemon uucp network
The sendmail command allows the user to configure whether a header is optional or not depending on the mailer (M control lines) selected to handle this message. If the selected mailer has the MailerFlag defined in its F= section, then the header is added. For instance, most mailers have the F=D flag set; this enables the Date: header to be included in the message.
The format of the H control line is as follows: H[?MailerFlags?]FieldName: format
In this format, the variable parameters have the following meaning: This 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. This 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:. This field defines the information that is displayed following the field name. It usually uses a sendmail macro to specify the information.
The sendmail command does not do any special processing for the header mailer flags; their use is purely by convention. See the section on Specifying Mailer Flags for more detail.
The following is a list of parts that the sendmail daemon expects mail to have. Note that these parts must appear in the same order as listed here. An operating system From line (defined by the five characters: F, r, o, m, and space) Mail header lines that begin with a keyword followed by a colon, such as From: or To: An empty line 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.
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: If an s macro is defined (sender's hostname), displays the text from followed by the content of the $s macro. Displays the text by followed by the content of the $j macro (official name for this site). 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. Displays the text id followed by the content of the $i macro (mail-queue ID of the message) and a ; (semicolon). Displays the current date.
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: If 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).
Define Sender Rewriting Rules (S=Envelope/Header)
Define Recipient Rewriting Rules (R=Envelope/Header)
After a mailer has been selected by the S0 ruleset, sendmail performs additional processing on the addresses. Sender addresses are processed by the rule(s) specified by the S= section, while recipient addresses are processed by the rule(s) specified by the R= section.
The sendmail program allows you to specify either a single rule (for example, S=14), or split rewriting rules. (For example, S=14/24). If split rules are specified, envelope addresses are processed by the first rule (for example, 14), while header addresses are processed by the later rule (for example, 24).
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
Commands: mailconfig(8X), mailsetup(8), mail_manual_setup(7), sendmail.m4(8), sendmail(8) delim off