sendmail.cf - Contains the sendmail configuration file
data
/var/adm/sendmail/sendmail.cf
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 latter is available on the
Documentation CD-ROM.
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
Defining Syntax Version (V Control Line) [Toc] [Back]
To specify the syntax version used by the sendmail.cf configuration
file, use Vn[/vendorcode], where n is an integer
specifying the syntax version. If n is omitted, the
original level 0 is assumed. An optional vendor code can
follow the level. The files supplied use "V2/DIGITAL" to
specify the syntax version.
Tru64 UNIX provides tools to help you create a reasonable
sendmail.cf file. See the mailconfig(8) and the
mailsetup(8) reference pages for further information.
Defining Rules and Rule Sets (R Control Line and S Control
Line)
Most of the sendmail.cf file consists of rules (R Control
lines) and rule sets. A rule set is a group of rules,
prefixed by an S control line. For example, S3 is rule set
3, while S99 is referred to as rule set 99.
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.
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: Defines a macro and assigns a value to it.
If a second DMacroValue defines the same macro, the second
definition replaces the first definition. The macro can be
a single character or a word in braces {}. For single
character macros, you must use only uppercase letters.
Similarly, for longer macros, the first character must be
an uppercase letter. Single character macros that are
lower case letters or special symbols are reserved for use
by sendmail, as are words beginning with a lower case letter
or punctuation character. 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.
Defining Message Precedence (P Control Line) [Toc] [Back]
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) [Toc] [Back]
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. Alternatively,
these IDs could have been defined using only one T control
line: Troot daemon uucp network
Defining Message Headings (H Control Line) [Toc] [Back]
H control lines define the format of Header lines. If the
format of a header line is defined by an H control line,
sendmail will reformat the header according to this format.
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 (mailqueue
ID of the message) and a ; (semicolon). Displays
the current date.
Defining a Mailer (M Control Line) [Toc] [Back]
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) [Toc] [Back]
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).
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. The mailer
defined in this mailer-definition control line
needs a Date: or Resent-Date: header line. The
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. This 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. The 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). The mailer in the mailer-definition
control line needs a From: or Resent-From: header
line. This header is optional depending on the
mailer (M control lines) selected to handle this
message. Preserves uppercase letters in hostnames
for the mailer in the mailer-definition control
line. The 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. The mailer in the mailer-definition
control line is local; final delivery will be
performed. The L flag enforces SMTP line lengths.
The mailer in the mailer-definition control line
can be sent to multiple users on the same host in
one transaction. The $u macro contains the recipient's
username. When a $u macro occurs in the
String part of the mailer-definition, (for example
A=mail -r $g -d $u) and the m flag is set, $u is
expanded to become a list of all the recipients.
The mailer in the mailer-definition control line
needs a Message-Id header. This header is optional
depending on the mailer (M control lines) selected
to handle this message. The mailer in the mailerdefinition
control line needs a Return-Path: header
line. This header is optional depending on the
mailer (M control lines) selected to handle this
message. The mailer in the mailer-definition control
line needs a Full-name: header. This header is
optional depending on the mailer (M control lines)
selected to handle this message. For versions prior
to Version 8, this flag also enables the MULT
option required by the mail11v3 program to handle
multiple recipients.
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) [Toc] [Back]
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
Defining a Map (K Key File Declaration) [Toc] [Back]
You can define a special map function with the following
line: Kmapname mapclass arguments
The fields in the definition have the following purposes:
Indicates the handle of this map, which is referenced in
the rewriting rules Indicates the type of the map (for
example, dbm, ldapx, text, etc. These are compiled into
sendmail.) Contains one or more arguments depending on
the type of the map (for example, a single argument naming
the file that contains the map)
Once defined, map functions are called with the following
syntax: $(mapname key $@ arguments $: default $)
The $@ arguments and $: default fields are optional, and
the $@ arguments field can appear more than once.
Sendmail passes the specified key and arguments to the
appropriate mapping function. If the function returns a
value, the value replaces the input. If the function does
not return a value, and a default is specified, the
default replaces the input. Otherwise, the input remains
unchanged.
For example, the following rule looks up the UUCP name in
a (user-defined) UUCP map: R$-!$+ $: $(uucp $1 $@
$2 $: %1 @ %0 .UUCP $)
If the name is not found, sendmail turns it into the form.
The map database might contain records like the following:
research %1@%0.ATT.COM
Commands: mailconfig(8), mailsetup(8), mail_manual_setup(7), sendmail.m4(8), sendmail(8)
sendmail.cf(4)
[ Back ] |