THE WHOLE SCOOP ON THE CONFIGURATION FILE

This section describes the configuration file in detail.

There is one point that should be made clear immediately: the syntax of the configuration file is designed to be reasonably easy to parse, since this is done every time sendmail starts up, rather than easy for a human to read or write. The configuration file should be generated via the method described in cf/README, it should not be edited directly unless someone is familiar with the internals of the syntax described here and it is not possible to achieve the desired result via the default method.

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 sharp symbol (`#') are comments.

R and S -- Rewriting Rules

The core of address parsing are the rewriting rules. These are an ordered production system. Sendmail scans through the set of rewriting rules looking for a match on the left hand side (LHS) of the rule. When a rule matches, the address is replaced by the right hand side (RHS) of the rule.

There are several sets of rewriting rules. Some of the rewriting sets are used internally and must have specific semantics. Other rewriting sets do not have specifically assigned semantics, and may be referenced by the mailer definitions or by other rewriting sets.

The syntax of these two commands are:

S n
Sets the current ruleset being collected to n. If you begin a ruleset more than once it appends to the old definition.
R lhs rhs comments
The fields must be separated by at least one tab character; there may be embedded spaces in the fields. The lhs is a pattern that is applied to the input. If it matches, the input is rewritten to the rhs. The comments are ignored.

Macro expansions of the form $ x are performed when the configuration file is read. A literal $ can be included using $$. Expansions of the form $& x are performed at run time using a somewhat less general algorithm. This is intended only for referencing internally defined macros such as $h that are changed at runtime.

The left hand side

The left hand side of rewriting rules contains a pattern. Normal words are simply matched directly. Metasyntax is introduced using a dollar sign. The metasymbols are:


$* Match zero or more tokens
$+ Match one or more tokens
$- Match exactly one token
$=x Match any phrase in class x
$~x Match any word not in class x
If any of these match, they are assigned to the symbol $ n for replacement on the right hand side, where n is the index in the LHS. For example, if the LHS:
$-:$+
is applied to the input:
UCBARPA:eric
the rule will match, and the values passed to the RHS will be:

$1 UCBARPA
$2 eric

Additionally, the LHS can include $@ to match zero tokens. This is not bound to a $ n on the RHS, and is normally only used when it stands alone in order to match the null input.

The right hand side

When the left hand side of a rewriting rule matches, the input is deleted and replaced by the right hand side. Tokens are copied directly from the RHS unless they begin with a dollar sign. Metasymbols are:


$n Substitute indefinite token n from LHS
$[name$] Canonicalize name
$(map key $@arguments $:default $)
Generalized keyed mapping function
$>n "Call" ruleset n
$#mailer Resolve to mailer
$@host Specify host
$:user Specify user

The $ n syntax substitutes the corresponding value from a $+, $-, $*, $=, or $~ match on the LHS. It may be used anywhere.

A host name enclosed between $[ and $] is looked up in the host database(s) and replaced by the canonical name[16]. For example, $[ftp$] might become ftp.CS.Berkeley.EDU and $[[128.32.130.2]$] would become vangogh.CS.Berkeley.EDU. Sendmail recognizes its numeric IP address without calling the name server and replaces it with its canonical name.

The $( ... $) syntax is a more general form of lookup; it uses a named map instead of an implicit map. If no lookup is found, the indicated default is inserted; if no default is specified and no lookup matches, the value is left unchanged. The arguments are passed to the map for possible use.

The $> n syntax causes the remainder of the line to be substituted as usual and then passed as the argument to ruleset n. The final value of ruleset n then becomes the substitution for this rule. The $> syntax expands everything after the ruleset name to the end of the replacement string and then passes that as the initial input to the ruleset. Recursive calls are allowed. For example,

$>0 $>3 $1
expands $1, passes that to ruleset 3, and then passes the result of ruleset 3 to ruleset 0.

The $# syntax should only be used in ruleset zero, a subroutine of ruleset zero, or rulesets that return decisions (e.g., check_rcpt). It causes evaluation of the ruleset to terminate immediately, and signals to sendmail that the address has completely resolved. The complete syntax for ruleset 0 is:

$#mailer $@host $:user
This specifies the {mailer, host, user} 3-tuple necessary to direct the mailer. If the mailer is local the host part may be omitted[17]. The mailer must be a single word, but the host and user may be multi-part. If the mailer is the built-in IPC mailer, the host may be a colon-separated list of hosts that are searched in order for the first working address (exactly like MX records). The user is later rewritten by the mailer-specific envelope rewriting set and assigned to the $u macro. As a special case, if the mailer specified has the F=@ flag specified and the first character of the $: value is @, the @ is stripped off, and a flag is set in the address descriptor that causes sendmail to not do ruleset 5 processing.

Normally, a rule that matches is retried, that is, the rule loops until it fails. A RHS may also be preceded by a $@ or a $: to change this behavior. A $@ prefix causes the ruleset to return with the remainder of the RHS as the value. A $: prefix causes the rule to terminate immediately, but the ruleset to continue; this can be used to avoid continued application of a rule. The prefix is stripped before continuing.

The $@ and $: prefixes may precede a $> spec; for example:


R$+ $: $>7 $1
matches anything, passes that to ruleset seven, and continues; the $: is necessary to avoid an infinite loop.

Substitution occurs in the order described, that is, parameters from the LHS are substituted, hostnames are canonicalized, subroutines are called, and finally $#, $@, and $: are processed.

Semantics of rewriting rule sets

There are six rewriting sets that have specific semantics. Five of these are related as depicted by figure 1.




                    +---+
                 -->| 0 |-->resolved address
                /   +---+
               /            +---+   +---+
              /        ---->| 1 |-->| S |--
       +---+ / +---+  /     +---+   +---+  \    +---+
addr-->| 3 |-->| D |--                      --->| 4 |-->msg
       +---+   +---+  \     +---+   +---+  /    +---+
                        --->| 2 |-->| R |--
                            +---+   +---+

see ASCII picture above


Figure 1 -- Rewriting set semantics

D -- sender domain addition
S -- mailer-specific sender rewriting
R -- mailer-specific recipient rewriting



Ruleset three should turn the address into canonical form. This form should have the basic syntax:

local-part@host-domain-spec
Ruleset three is applied by sendmail before doing anything with any address.

If no @ sign is specified, then the host-domain-spec may be appended (box D in Figure 1) from the sender address (if the C flag is set in the mailer definition corresponding to the sending mailer).

Ruleset zero is applied after ruleset three to addresses that are going to actually specify recipients. It must resolve to a {mailer, host, address} triple. The mailer must be defined in the mailer definitions from the configuration file. The host is defined into the $h macro for use in the argv expansion of the specified mailer.

Rulesets one and two are applied to all sender and recipient addresses respectively. They are applied before any specification in the mailer definition. They must never resolve.

Ruleset four is applied to all addresses in the message. It is typically used to translate internal to external form.

In addition, ruleset 5 is applied to all local addresses (specifically, those that resolve to a mailer with the `F=5' flag set) that do not have aliases. This allows a last minute hook for local names.

Ruleset hooks

A few extra rulesets are defined as hooks that can be defined to get special features. They are all named rulesets. The check_* forms all give accept/reject status; falling off the end or returning normally is an accept, and resolving to $#error is a reject. Many of these can also resolve to the special mailer name $#discard; this accepts the message as though it were successful but then discards it without delivery. Note, this mailer cannot be chosen as a mailer in ruleset 0. Note also that all check_* rulesets have to deal with temporary failures, especially for map lookups, themselves, i.e., they should return a temporary error code or at least they should make a proper decision in those cases.

check_relay

The check_relay ruleset is called after a connection is accepted by the daemon. It is not called when sendmail is started using the -bs option. It is passed

client.host.name $| client.host.address
where $| is a metacharacter separating the two parts. This ruleset can reject connections from various locations.

check_mail

The check_mail ruleset is passed the user name parameter of the SMTP MAIL command. It can accept or reject the address.

check_rcpt

The check_rcpt ruleset is passed the user name parameter of the SMTP RCPT command. It can accept or reject the address.

check_data

The check_data ruleset is called after the SMTP DATA command, its parameter is the number of recipients. It can accept or reject the command.

check_compat

The check_compat ruleset is passed

sender-address $| recipient-address
where $| is a metacharacter separating the addresses. It can accept or reject mail transfer between these two addresses much like the checkcompat() function.

check_eoh

The check_eoh ruleset is passed

number-of-headers $| size-of-headers
where $| is a metacharacter separating the numbers. These numbers can be used for size comparisons with the arith map. The ruleset is triggered after all of the headers have been read. It can be used to correlate information gathered from those headers using the macro storage map. One possible use is to check for a missing header. For example:

Kstorage macro
HMessage-Id: $>CheckMessageId


SCheckMessageId
# Record the presence of the header
R$* $: $(storage {MessageIdCheck} $@ OK $) $1
R< $+ @ $+ > $@ OK
R$* $#error $: 553 Header Error


Scheck_eoh
# Check the macro
R$* $: < $&{MessageIdCheck} >
# Clear the macro for the next message
R$* $: $(storage {MessageIdCheck} $) $1
# Has a Message-Id: header
R< $+ > $@ OK
# Allow missing Message-Id: from local mail
R$* $: < $&{client_name} >
R< > $@ OK
R< $=w > $@ OK
# Otherwise, reject the mail
R$* $#error $: 553 Header Error

Keep in mind the Message-Id: header is not a required header and is not a guaranteed spam indicator. This ruleset is an example and should probably not be used in production.

check_etrn

The check_etrn ruleset is passed the parameter of the SMTP ETRN command. It can accept or reject the command.

check_expn

The check_expn ruleset is passed the user name parameter of the SMTP EXPN command. It can accept or reject the address.

check_vrfy

The check_vrfy ruleset is passed the user name parameter of the SMTP VRFY command. It can accept or reject the command.

trust_auth

The trust_auth ruleset is passed the AUTH= parameter of the SMTP MAIL command. It is used to determine whether this value should be trusted. In order to make this decision, the ruleset may make use of the various ${auth_*} macros. If the ruleset does resolve to the error mailer the AUTH= parameter is not trusted and hence not passed on to the next relay.

tls_client

The tls_client ruleset is called when sendmail acts as server, after a STARTTLS command has been issued, and from check_mail. The parameter is the value of ${verify} and STARTTLS or MAIL, respectively. If the ruleset does resolve to the error mailer, the appropriate error code is returned to the client.

tls_server

The tls_server ruleset is called when sendmail acts as client after a STARTTLS command (should) have been issued. The parameter is the value of ${verify}. If the ruleset does resolve to the error mailer, the connection is aborted (treated as non-deliverable with a permanent or temporary error).

tls_rcpt

The tls_rcpt ruleset is called each time before a RCPT TO command is sent. The parameter is the current recipient. If the ruleset does resolve to the error mailer, the RCPT TO command is suppressed (treated as non-deliverable with a permanent or temporary error). This ruleset allows to require encryption or verification of the recipient's MTA even if the mail is somehow redirected to another host. For example, sending mail to luke@endmail.org may get redirected to a host named death.star and hence the tls_server ruleset won't apply. By introducing per recipient restrictions such attacks (e.g., via DNS spoofing) can be made impossible. See cf/README how this ruleset can be used.

srv_features

The srv_features ruleset is called when a client connects to sendmail. This ruleset should return $# followed by a list of options (single characters delimited by white space). If the return value starts with anything else it is silently ignored. Generally upper case characters turn off a feature while lower case characters turn it on. The option `S' causes the server not to offer STARTTLS. This is useful to interact with MTAs/MUAs that have broken STARTTLS implementations by simply not offering it. `V' turns off the request for a client certificate during the TLS handshake. Option `A' and `P' suppress SMTP AUTH and PIPELINING, respectively. The ruleset may return `$#temp' to indicate that there is a temporary problem determining the correct features, e.g., if a map is unavailable. In that case, the SMTP server issues a temporary failure and does not accept email.

try_tls

The try_tls ruleset is called when sendmail connects to another MTA. If the ruleset does resolve to the error mailer, sendmail does not try STARTTLS even if it is offered. This is useful to interact with MTAs that have broken STARTTLS implementations by simply not using it.

authinfo

The authinfo ruleset is called when sendmail tries to authenticate to another MTA. It should return $# followed by a list of tokens that are used for SMTP AUTH. If the return value starts with anything else it is silently ignored. Each token is a tagged string of the form: "TDstring" (including the quotes), where


T Tag which describes the item
D Delimiter: ':' simple text follows
'=' string is base64 encoded
string Value of the item
Valid values for the tag are:

U user (authorization) id
I authentication id
P password
R realm
M list of mechanisms delimited by spaces
If this ruleset is defined, the option DefaultAuthInfo is ignored (even if the ruleset does not return a ``useful'' result).

queuegroup

The queuegroup ruleset is used to map an address to a queue group name. It should return $# followed by the name of a queue group. If the return value starts with anything else it is silently ignored. See the section about Queue Groups and Queue Directories for further information.

IPC mailers

Some special processing occurs if the ruleset zero resolves to an IPC mailer (that is, a mailer that has [IPC] listed as the Path in the M configuration line. The host name passed after $@ has MX expansion performed if not delivering via a named socket; this looks the name up in DNS to find alternate delivery sites.

The host name can also be provided as a dotted quad or an IPv6 address in square brackets; for example:

[128.32.149.78]
or
[IPv6:2002:c0a8:51d2::23f4]
This causes direct conversion of the numeric value to an IP host address.

The host name passed in after the $@ may also be a colon-separated list of hosts. Each is separately MX expanded and the results are concatenated to make (essentially) one long MX list. The intent here is to create fake MX records that are not published in DNS for private internal networks.

As a final special case, the host name can be passed in as a text string in square brackets:

[ucbvax.berkeley.edu]
This form avoids the MX mapping. N.B.: This is intended only for situations where you have a network firewall or other host that will do special processing for all your mail, so that your MX record points to a gateway machine; this machine could then do direct delivery to machines within your local domain. Use of this feature directly violates RFC 1123 section 5.3.5: it should not be used lightly.

D -- Define Macro

Macros are named with a single character or with a word in {braces}. The names ``x'' and ``{x}'' denote the same macro for every single character ``x''. Single character names may be selected from the entire ASCII set, but user-defined macros should be selected from the set of upper case letters only. Lower case letters and special symbols are used internally. Long names beginning with a lower case letter or a punctuation character are reserved for use by sendmail, so user-defined long macro names should begin with an upper case letter.

The syntax for macro definitions is:

D xval
where x is the name of the macro (which may be a single character or a word in braces) and val is the value it should have. There should be no spaces given that do not actually belong in the macro value.

Macros are interpolated using the construct $ x, where x is the name of the macro to be interpolated. This interpolation is done when the configuration file is read, except in M lines. The special construct $& x can be used in R lines to get deferred interpolation.

Conditionals can be specified using the syntax:

$?x text1 $| text2 $.
This interpolates text1 if the macro $x is set and non-null, and text2 otherwise. The else ( $|) clause may be omitted.

The following macros are defined and/or used internally by sendmail for interpolation into argv's for mailers or for other contexts. The ones marked * are information passed into sendmail[18], the ones marked are information passed both in and out of sendmail, and the unmarked macros are passed out of sendmail but are not otherwise used internally. These macros are:

$a
The origination date in RFC 822 format. This is extracted from the Date: line.
$b
The current date in RFC 822 format.
$c
The hop count. This is a count of the number of Received: lines plus the value of the -h command line flag.
$d
The current date in UNIX (ctime) format.
$e*
(Obsolete; use SmtpGreetingMessage option instead.) The SMTP entry message. This is printed out when SMTP starts up. The first word must be the $j macro as specified by RFC821. Defaults to $j Sendmail $v ready at $b. Commonly redefined to include the configuration version number, e.g., $j Sendmail $v/$Z ready at $b
$f
The envelope sender (from) address.
$g
The sender address relative to the recipient. For example, if $f is foo, $g will be host!foo, foo@host.domain, or whatever is appropriate for the receiving mailer.
$h
The recipient host. This is set in ruleset 0 from the $@ field of a parsed address.
$i
The queue id, e.g., f344MXxp018717.
$j
The "official" domain name for this site. This is fully qualified if the full qualification can be found. It must be redefined to be the fully qualified domain name if your system is not configured so that information can find it automatically.
$k
The UUCP node name (from the uname system call).
$l*
(Obsolete; use UnixFromLine option instead.) The format of the UNIX from line. Unless you have changed the UNIX mailbox format, you should not change the default, which is From $g $d.
$m
The domain part of the gethostname return value. Under normal circumstances, $j is equivalent to $w.$m.
$n*
The name of the daemon (for error messages). Defaults to MAILER-DAEMON.
$o*
(Obsolete: use OperatorChars option instead.) The set of "operators" in addresses. A list of characters which will be considered tokens and which will separate tokens when doing parsing. For example, if @ were in the $o macro, then the input a@b would be scanned as three tokens: a, @, and b. Defaults to .:@[], which is the minimum set necessary to do RFC 822 parsing; a richer set of operators is .:%@!/[], which adds support for UUCP, the %-hack, and X.400 addresses.
$p
Sendmail's process id.
$q*
Default format of sender address. The $q macro specifies how an address should appear in a message when it is defaulted. Defaults to <$g>. It is commonly redefined to be $?x$x <$g>$|$g$. or $g$?x ($x)$., corresponding to the following two formats:
Eric Allman <eric@CS.Berkeley.EDU>
eric@CS.Berkeley.EDU (Eric Allman)
Sendmail properly quotes names that have special characters if the first form is used.
$r
Protocol used to receive the message. Set from the -p command line flag or by the SMTP server code.
$s
Sender's host name. Set from the -p command line flag or by the SMTP server code.
$t
A numeric representation of the current time.
$u
The recipient user.
$v
The version number of the sendmail binary.
$w
The hostname of this site. This is the root name of this host (but see below for caveats).
$x
The full name of the sender.
$z
The home directory of the recipient.
$_
The validated sender address.
${addr_type}
The type of the address which is currently being rewritten. This macro contains up to three characters, the first is either `e' or `h' for envelope/header address, the second is a space, and the third is either `s' or `r' for sender/recipient address. Notice: for header addresses no distinction is currently made between sender and recipient addresses, i.e., the macro contains only `h'.
${auth_authen}
The client's authentication credentials as determined by authentication (only set if successful). The format depends on the mechanism used, it might be just `user', or `user@realm', or something similar (SMTP AUTH only).
${auth_author}
The authorization identity, i.e. the AUTH= parameter of the SMTP MAIL command if supplied.
${auth_type}
The mechanism used for SMTP authentication (only set if successful).
${auth_ssf}
The keylength (in bits) of the symmetric encryption algorithm used for the security layer of a SASL mechanism.
${bodytype}
The message body type (7BIT or 8BITMIME), as determined from the envelope.
${cert_issuer}
The DN (distinguished name) of the CA (certificate authority) that signed the presented certificate (the cert issuer) (STARTTLS only).
${cert_md5}
The MD5 hash of the presented certificate (STARTTLS only).
${cert_subject}
The DN of the presented certificate (called the cert subject) (STARTTLS only).
${cipher}
The cipher suite used for the connection, e.g., EDH-DSS-DES-CBC3-SHA, EDH-RSA-DES-CBC-SHA, DES-CBC-MD5, DES-CBC3-SHA (STARTTLS only).
${cipher_bits}
The keylength (in bits) of the symmetric encryption algorithm used for a TLS connection.
${client_addr}
The IP address of the SMTP client. IPv6 addresses are tagged with "IPv6:" before the address. Defined in the SMTP server only.
${client_name}
The host name of the SMTP client. This may be the client's bracketed IP address in the form [ nnn.nnn.nnn.nnn ] for IPv4 and [ IPv6:nnnn:...:nnnn ] for IPv6 if the client's IP address is not resolvable, or if it is resolvable but the IP address of the resolved hostname doesn't match the original IP address. Defined in the SMTP server only. See also ${client_resolve}.
${client_port}
The port number of the SMTP client. Defined in the SMTP server only.
${client_resolve}
Holds the result of the resolve call for ${client_name}. Possible values are:

OK resolved successfully
FAIL permanent lookup failure
FORGED forward lookup doesn't match reverse lookup
TEMP temporary lookup failure
Defined in the SMTP server only.
${cn_issuer}
The CN (common name) of the CA that signed the presented certificate (STARTTLS only).
${cn_subject}
The CN (common name) of the presented certificate (STARTTLS only).
${currHeader}
Header value as quoted string (possibly truncated to MAXNAME). This macro is only available in header check rulesets.
${daemon_addr}
The IP address the daemon is listening on for connections.
${daemon_family}
The network family if the daemon is accepting network connections. Possible values include inet, inet6, iso, ns, x.25
${daemon_flags}
The flags for the daemon as specified by the Modifier= part of DaemonPortOptions whereby the flags are separated from each other by spaces, and upper case flags are doubled. That is, Modifier=Ea will be represented as "EE a" in ${daemon_flags}, which is required for testing the flags in rulesets.
${daemon_info}
Some information about a daemon as a text string. For example, SMTP+queueing@00:30:00.
${daemon_name}
The name of the daemon from DaemonPortOptions Name= suboption. If this suboption is not set, "Daemon#", where # is the daemon number, is used.
${daemon_port}
The port the daemon is accepting connection on. Unless DaemonPortOptions is set, this will most likely be 25.
${deliveryMode}
The current delivery mode sendmail is using. It is initially set to the value of the DeliveryMode option.
${envid}
The envelope id parameter (ENVID=) passed to sendmail as part of the envelope.
${hdrlen}
The length of the header value which is stored in ${currHeader} (before possible truncation). If this value is greater than or equal to MAXNAME the header has been truncated.
${hdr_name}
The name of the header field for which the current header check ruleset has been called. This is useful for a default header check ruleset to get the name of the header; the macro is only available in header check rulesets.
${if_addr}
The IP address of the interface of an incoming connection unless it is in the loopback net. IPv6 addresses are tagged with "IPv6:" before the address.
${if_addr_out}
The IP address of the interface of an outgoing connection unless it is in the loopback net. IPv6 addresses are tagged with "IPv6:" before the address.
${if_family}
The IP family of the interface of an incoming connection unless it is in the loopback net.
${if_family_out}
The IP family of the interface of an outgoing connection unless it is in the loopback net.
${if_name}
The hostname associated with the interface of an incoming connection. This macro can be used for SmtpGreetingMessage and HReceived for virtual hosting. For example:
O SmtpGreetingMessage=$?{if_name}${if_name}$|$j$. MTA
${if_name_out}
The name of the interface of an outgoing connection.
${mail_addr}
The address part of the resolved triple of the address given for the SMTP MAIL command. Defined in the SMTP server only.
${mail_host}
The host from the resolved triple of the address given for the SMTP MAIL command. Defined in the SMTP server only.
${mail_mailer}
The mailer from the resolved triple of the address given for the SMTP MAIL command. Defined in the SMTP server only.
${msg_size}
The value of the SIZE= parameter, i.e., usually the size of the message (in an ESMTP dialogue), before the message has been collected, thereafter the message size as computed by sendmail (and can be used in check_compat).
${nrcpts}
The number of validated recipients for a single message. Note: since recipient validation happens after check_rcpt has been called, the value in this ruleset is one less than what might be expected.
${ntries}
The number of delivery attempts.
${opMode}
The current operation mode (from the -b flag).
${queue_interval}
The queue run interval given by the -q flag. For example, -q30m would set ${queue_interval} to 00:30:00.
${rcpt_addr}
The address part of the resolved triple of the address given for the SMTP RCPT command. Defined in the SMTP server only after a RCPT command.
${rcpt_host}
The host from the resolved triple of the address given for the SMTP RCPT command. Defined in the SMTP server only after a RCPT command.
${rcpt_mailer}
The mailer from the resolved triple of the address given for the SMTP RCPT command. Defined in the SMTP server only after a RCPT command.
${server_addr}
The address of the server of the current outgoing SMTP connection. For LMTP delivery the macro is set to the name of the mailer.
${server_name}
The name of the server of the current outgoing SMTP or LMTP connection.
${tls_version}
The TLS/SSL version used for the connection, e.g., TLSv1, SSLv3, SSLv2; defined after STARTTLS has been used.
${verify}
The result of the verification of the presented cert; only defined after STARTTLS has been used. Possible values are:

OK verification succeeded.
NO no cert presented.
NOT no cert requested.
FAIL cert presented but could not be verified,
e.g., the signing CA is missing.
NONE STARTTLS has not been performed.
TEMP temporary error occurred.
PROTOCOL some protocol error occurred.
SOFTWARE STARTTLS handshake failed,
which is a fatal error for this session,
the e-mail will be queued.

There are three types of dates that can be used. The $a and $b macros are in RFC 822 format; $a is the time as extracted from the Date: line of the message (if there was one), and $b is the current date and time (used for postmarks). If no Date: line is found in the incoming message, $a is set to the current time also. The $d macro is equivalent to the $b macro in UNIX (ctime) format.

The macros $w, $j, and $m are set to the identity of this host. Sendmail tries to find the fully qualified name of the host if at all possible; it does this by calling gethostname(2) to get the current hostname and then passing that to gethostbyname(3) which is supposed to return the canonical version of that host name.[19] Assuming this is successful, $j is set to the fully qualified name and $m is set to the domain part of the name (everything after the first dot). The $w macro is set to the first word (everything before the first dot) if you have a level 5 or higher configuration file; otherwise, it is set to the same value as $j. If the canonification is not successful, it is imperative that the config file set $j to the fully qualified domain name[20].

The $f macro is the id of the sender as originally determined; when mailing to a specific host the $g macro is set to the address of the sender relative to the recipient. For example, if I send to bollard@matisse.CS.Berkeley.EDU from the machine vangogh.CS.Berkeley.EDU the $f macro will be eric and the $g macro will be eric@vangogh.CS.Berkeley.EDU.

The $x macro is set to the full name of the sender. This can be determined in several ways. It can be passed as flag to sendmail. It can be defined in the NAME environment variable. The third choice is the value of the Full-Name: line in the header if it exists, and the fourth choice is the comment field of a From: line. If all of these fail, and if the message is being originated locally, the full name is looked up in the /etc/passwd file.

When sending, the $h, $u, and $z macros get set to the host, user, and home directory (if local) of the recipient. The first two are set from the $@ and $: part of the rewriting rules, respectively.

The $p and $t macros are used to create unique strings (e.g., for the Message-Id: field). The $i macro is set to the queue id on this host; if put into the timestamp line it can be extremely useful for tracking messages. The $v macro is set to be the version number of sendmail; this is normally put in timestamps and has been proven extremely useful for debugging.

The $c field is set to the hop count, i.e., the number of times this message has been processed. This can be determined by the -h flag on the command line or by counting the timestamps in the message.

The $r and $s fields are set to the protocol used to communicate with sendmail and the sending hostname. They can be set together using the -p command line flag or separately using the -M or -oM flags.

The $_ is set to a validated sender host name. If the sender is running an RFC 1413 compliant IDENT server and the receiver has the IDENT protocol turned on, it will include the user name on that host.

The ${client_name}, ${client_addr}, and ${client_port} macros are set to the name, address, and port number of the SMTP client who is invoking sendmail as a server. These can be used in the check_* rulesets (using the $& deferred evaluation form, of course!).

C and F -- Define Classes

Classes of phrases may be defined to match on the left hand side of rewriting rules, where a phrase is a sequence of characters that does not contain space characters. For example a class of all local names for this site might be created so that attempts to send to oneself can be eliminated. These can either be defined directly in the configuration file or read in from another file. Classes are named as a single letter or a word in {braces}. Class names beginning with lower case letters and special characters are reserved for system use. Classes defined in config files may be given names from the set of upper case letters for short names or beginning with an upper case letter for long names.

The syntax is:

C cphrase1 phrase2...
F cfile
F c|program
F c[mapkey]@mapclass:mapspec
The first form defines the class c to match any of the named words. If phrase1 or phrase2 is another class, e.g., $=S, the contents of class S are added to class c. It is permissible to split them among multiple lines; for example, the two forms:
CHmonet ucbmonet
and
CHmonet
CHucbmonet
are equivalent. The ``F'' forms read the elements of the class c from the named file, program, or map specification. Each element should be listed on a separate line. To specify an optional file, use ``-o'' between the class name and the file name, e.g.,
Fc -o /path/to/file
If the file can't be used, sendmail will not complain but silently ignore it. The map form should be an optional map key, an at sign, and a map class followed by the specification for that map. Examples include:
F{VirtHosts}@ldap:-k (&(objectClass=virtHosts)(host=*)) -v host
F{MyClass}foo@hash:/etc/mail/classes
will fill the class $={VirtHosts} from an LDAP map lookup and $={MyClass} from a hash database map lookup of the foo. There is also a built-in schema that can be accessed by only specifying:
F{
ClassName}@LDAP
This will tell sendmail to use the default schema:
-k (&(objectClass=sendmailMTAClass)
(sendmailMTAClassName=
ClassName) (|(sendmailMTACluster=${sendmailMTACluster})
(sendmailMTAHost=$j)))
-v sendmailMTAClassValue
Note that the lookup is only done when sendmail is initially started.

Elements of classes can be accessed in rules using $= or $~. The $~ (match entries not in class) only matches a single word; multi-word entries in the class are ignored in this context.

Some classes have internal meaning to sendmail:

$=e
contains the Content-Transfer-Encodings that can be 8->7 bit encoded. It is predefined to contain 7bit, 8bit, and binary.
$=k
set to be the same as $k, that is, the UUCP node name.
$=m
set to the set of domains by which this host is known, initially just $m.
$=n
can be set to the set of MIME body types that can never be eight to seven bit encoded. It defaults to multipart/signed. Message types message/* and multipart/* are never encoded directly. Multipart messages are always handled recursively. The handling of message/* messages are controlled by class $=s.
$=q
A set of Content-Types that will never be encoded as base64 (if they have to be encoded, they will be encoded as quoted-printable). It can have primary types (e.g., text) or full types (such as text/plain). The class is initialized to have text/plain only.
$=s
contains the set of subtypes of message that can be treated recursively. By default it contains only rfc822. Other message/* types cannot be 8->7 bit encoded. If a message containing eight bit data is sent to a seven bit host, and that message cannot be encoded into seven bits, it will be stripped to 7 bits.
$=t
set to the set of trusted users by the T configuration line. If you want to read trusted users from a file, use Ft /file/name.
$=w
set to be the set of all names this host is known by. This can be used to match local hostnames.
$={persistentMacros}
set to the macros would should be saved across queue runs. Care should be taken when adding macro names to this class.

Sendmail can be compiled to allow a scanf(3) string on the F line. This lets you do simplistic parsing of text files. For example, to read all the user names in your system /etc/passwd file into a class, use

FL/etc/passwd %[^:]
which reads every line up to the first colon.

M -- Define Mailer

Programs and interfaces to mailers are defined in this line. The format is:

M name, { field= value}*
where name is the name of the mailer (used internally only) and the field=name pairs define attributes of the mailer. Fields are:

Path The pathname of the mailer
Flags Special flags for this mailer
Sender Rewriting set(s) for sender addresses
Recipient Rewriting set(s) for recipient addresses
recipients Maximum number of recipients per connection
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
maxmessages The maximum message deliveries per connection
Linelimit The maximum line length in the message body
Directory The working directory for the mailer
Userid The default user and group id to run as
Nice The nice(2) increment for the mailer
Charset The default character set for 8-bit characters
Type Type information for DSN diagnostics
Wait The maximum time to wait for the mailer
Queuegroup The default queue group for the mailer
/ The root directory for the mailer
Only the first character of the field name is checked (it's case-sensitive).

The following flags may be set in the mailer description. Any other flags may be used freely to conditionally assign headers to messages destined for particular mailers. Flags marked with * are not interpreted by the sendmail binary; these are the conventionally used to correlate to the flags portion of the H line. Flags marked with apply to the mailers for the sender address rather than the usual recipient mailers.

a
Run Extended SMTP (ESMTP) protocol (defined in RFCs 1869, 1652, and 1870). This flag defaults on if the SMTP greeting message includes the word ESMTP.
A
Look up the user part of the address in the alias database. Normally this is only set for local mailers.
b
Force a blank line on the end of a message. This is intended to work around some stupid versions of /bin/mail that require a blank line, but do not provide it themselves. It would not normally be used on network mail.
c
Do not include comments in addresses. This should only be used if you have to work around a remote mailer that gets confused by comments. This strips addresses of the form Phrase <address> or address (Comment) down to just address.
C
If mail is received from a mailer with this flag set, any addresses in the header that do not have an at sign ( @) after being rewritten by ruleset three will have the @domain clause from the sender envelope address tacked on. This allows mail with headers of the form:
From: usera@hosta
To: userb@hostb, userc
to be rewritten as:
From: usera@hosta
To: userb@hostb, userc@hosta
automatically. However, it doesn't really work reliably.
d
Do not include angle brackets around route-address syntax addresses. This is useful on mailers that are going to pass addresses to a shell that might interpret angle brackets as I/O redirection. However, it does not protect against other shell metacharacters. Therefore, passing addresses to a shell should not be considered secure.
D*
This mailer wants a Date: header line.
e
This mailer is expensive to connect to, so try to avoid connecting normally; any necessary connection will occur during a queue run. See also option HoldExpensive.
E
Escape lines beginning with From in the message with a `>' sign.
f
The mailer wants a -f from flag, but only if this is a network forward operation (i.e., the mailer will give an error if the executing user does not have special permissions).
F*
This mailer wants a From: header line.
g
Normally, sendmail sends internally generated email (e.g., error messages) using the null return address as required by RFC 1123. However, some mailers don't accept a null return address. If necessary, you can set the g flag to prevent sendmail from obeying the standards; error messages will be sent as from the MAILER-DAEMON (actually, the value of the $n macro).
h
Upper case should be preserved in host names (the $@ portion of the mailer triplet resolved from ruleset 0) for this mailer.
i
Do User Database rewriting on envelope sender address.
I
This mailer will be speaking SMTP to another sendmail -- as such it can use special protocol features. This flag should not be used except for debugging purposes because it uses VERB as SMTP command.
j
Do User Database rewriting on recipients as well as senders.
k
Normally when sendmail connects to a host via SMTP, it checks to make sure that this isn't accidently the same host name as might happen if sendmail is misconfigured or if a long-haul network interface is set in loopback mode. This flag disables the loopback check. It should only be used under very unusual circumstances.
K
Currently unimplemented. Reserved for chunking.
l
This mailer is local (i.e., final delivery will be performed).
L
Limit the line lengths as specified in RFC821. This deprecated option should be replaced by the L= mail declaration. For historic reasons, the L flag also sets the 7 flag.
m
This mailer can send to multiple users on the same host in one transaction. When a $u macro occurs in the argv part of the mailer definition, that field will be repeated as necessary for all qualifying users. Removing this flag can defeat duplicate supression on a remote site as each recipient is sent in a separate transaction.
M*
This mailer wants a Message-Id: header line.
n
Do not insert a UNIX-style From line on the front of the message.
o
Always run as the owner of the recipient mailbox. Normally sendmail runs as the sender for locally generated mail or as daemon (actually, the user specified in the u option) when delivering network mail. The normal behavior is required by most local mailers, which will not allow the envelope sender address to be set unless the mailer is running as daemon. This flag is ignored if the S flag is set.
p
Use the route-addr style reverse-path in the SMTP MAIL FROM: command rather than just the return address; although this is required in RFC821 section 3.1, many hosts do not process reverse-paths properly. Reverse-paths are officially discouraged by RFC 1123.
P*
This mailer wants a Return-Path: line.
q
When an address that resolves to this mailer is verified (SMTP VRFY command), generate 250 responses instead of 252 responses. This will imply that the address is local.
r
Same as f, but sends a -r flag.
R
Open SMTP connections from a secure port. Secure ports aren't (secure, that is) except on UNIX machines, so it is unclear that this adds anything. sendmail must be running as root to be able to use this flag.
s
Strip quote characters (" and \e) off of the address before calling the mailer.
S
Don't reset the userid before calling the mailer. This would be used in a secure environment where sendmail ran as root. This could be used to avoid forged addresses. If the U= field is also specified, this flag causes the effective user id to be set to that user.
u
Upper case should be preserved in user names for this mailer. Standards require preservation of case in the local part of addresses, except for those address for which your system accepts responsibility.
U
This mailer wants UUCP-style From lines with the ugly remote from <host> on the end.
w
The user must have a valid account on this machine, i.e., getpwnam must succeed. If not, the mail is bounced. See also the MailBoxDatabase option. This is required to get .forward capability.
x*
This mailer wants a Full-Name: header line.
X
This mailer want to use the hidden dot algorithm as specified in RFC821; basically, any line beginning with a dot will have an extra dot prepended (to be stripped at the other end). This insures that lines in the message containing a dot will not terminate the message prematurely.
z
Run Local Mail Transfer Protocol (LMTP) between sendmail and the local mailer. This is a variant on SMTP defined in RFC 2033 that is specifically designed for delivery to a local mailbox.
Z
Apply DialDelay (if set) to this mailer.
0
Don't look up MX records for hosts sent via SMTP.
1
Don't send null characters ('\ ') to this mailer.
2
Don't use ESMTP even if offered; this is useful for broken systems that offer ESMTP but fail on EHLO (without recovering when HELO is tried next).
3
Extend the list of characters converted to =XX notation when converting to Quoted-Printable to include those that don't map cleanly between ASCII and EBCDIC. Useful if you have IBM mainframes on site.
5
If no aliases are found for this address, pass the address through ruleset 5 for possible alternate resolution. This is intended to forward the mail to an alternate delivery spot.
6
Strip headers to seven bits.
7
Strip all output to seven bits. This is the default if the L flag is set. Note that clearing this option is not sufficient to get full eight bit data passed through sendmail. If the 7 option is set, this is essentially always set, since the eighth bit was stripped on input. Note that this option will only impact messages that didn't have 8->7 bit MIME conversions performed.
8
If set, it is acceptable to send eight bit data to this mailer; the usual attempt to do 8->7 bit MIME conversions will be bypassed.
9
If set, do limited 7->8 bit MIME conversions. These conversions are limited to text/plain data.
:
Check addresses to see if they begin :include:; if they do, convert them to the *include* mailer.
|
Check addresses to see if they begin with a `|'; if they do, convert them to the prog mailer.
/
Check addresses to see if they begin with a `/'; if they do, convert them to the *file* mailer.
@
Look up addresses in the user database.
%
Do not attempt delivery on initial recipient of a message or on queue runs unless the queued message is selected using one of the -qI/-qR/-qS queue run modifiers or an ETRN request.

Configuration files prior to level 6 assume the `A', `w', `5', `:', `|', `/', and `@' options on the mailer named local.

The mailer with the special name error can be used to generate a user error. The (optional) host field is an exit status to be returned, and the user field is a message to be printed. The exit status may be numeric or one of the values USAGE, NOUSER, NOHOST, UNAVAILABLE, SOFTWARE, TEMPFAIL, PROTOCOL, or CONFIG to return the corresponding EX_ exit code, or an enhanced error code as described in RFC 1893, Enhanced Mail System Status Codes. For example, the entry:

$#error $@ NOHOST $: Host unknown in this domain
on the RHS of a rule will cause the specified error to be generated and the Host unknown exit status to be returned if the LHS matches. This mailer is only functional in rulesets 0, 5, or one of the check_* rulesets.

The mailer with the special name discard causes any mail sent to it to be discarded but otherwise treated as though it were successfully delivered. This mailer cannot be used in ruleset 0, only in the various address checking rulesets.

The mailer named local must be defined in every configuration file. This is used to deliver local mail, and is treated specially in several ways. Additionally, three other mailers named prog, *file*, and *include* may be defined to tune the delivery of messages to programs, files, and :include: lists respectively. They default to:

Mprog, P=/bin/sh, F=lsoDq9, T=DNS/RFC822/X-Unix, A=sh -c $u
M*file*, P=[FILE], F=lsDFMPEouq9, T=DNS/RFC822/X-Unix, A=FILE $u
M*include*, P=/dev/null, F=su, A=INCLUDE $u

Builtin pathnames are [FILE] and [IPC], the former is used for delivery to files, the latter for delivery via interprocess communication. For mailers that use [IPC] as pathname the argument vector must start with TCP or FILE for delivery via a TCP or a Unix domain socket.

If the argument vector does not contain $u then sendmail will speak SMTP (or LMTP if the mailer flag z is specified) to the mailer.

If no Eol field is defined, then the default is "\\r\\n" for SMTP mailers and "\\n" of others.

The Sender and Recipient rewriting sets may either be a simple ruleset id or may be two ids separated by a slash; if so, the first rewriting set is applied to envelope addresses and the second is applied to headers. Setting any value to zero disables corresponding mailer-specific rewriting.

The Directory is actually a colon-separated path of directories to try. For example, the definition D=$z:/ first tries to execute in the recipient's home directory; if that is not available, it tries to execute in the root of the filesystem. This is intended to be used only on the prog mailer, since some shells (such as csh) refuse to execute if they cannot read the current directory. Since the queue directory is not normally readable by unprivileged users csh scripts as recipients can fail.

The Userid specifies the default user and group id to run as, overriding the DefaultUser option (q.v.). If the S mailer flag is also specified, this user and group will be set as the effective uid and gid for the process. This may be given as user:group to set both the user and group id; either may be an integer or a symbolic name to be looked up in the passwd and group files respectively. If only a symbolic user name is specified, the group id in the passwd file for that user is used as the group id.

The Charset field is used when converting a message to MIME; this is the character set used in the Content-Type: header. If this is not set, the DefaultCharset option is used, and if that is not set, the value unknown-8bit is used. WARNING: this field applies to the sender's mailer, not the recipient's mailer. For example, if the envelope sender address lists an address on the local network and the recipient is on an external network, the character set will be set from the Charset= field for the local network mailer, not that of the external network mailer.

The Type= field sets the type information used in MIME error messages as defined by RFC 1894. It is actually three values separated by slashes: the MTA-type (that is, the description of how hosts are named), the address type (the description of e-mail addresses), and the diagnostic type (the description of error diagnostic codes). Each of these must be a registered value or begin with X-. The default is dns/rfc822/smtp.

The m= field specifies the maximum number of messages to attempt to deliver on a single SMTP or LMTP connection. The default is infinite.

The r= field specifies the maximum number of recipients to attempt to deliver in a single envelope. It defaults to 100.

The /= field specifies a new root directory for the mailer. The path is macro expanded and then passed to the chroot system call. The root directory is changed before the Directory field is consulted or the uid is changed.

The Wait= field specifies the maximum time to wait for the mailer to return after sending all data to it. This applies to mailers that have been forked by sendmail.

The Queuegroup= field specifies the default queue group in which received mail should be queued. This can be overridden by other means as explained in section ``Queue Groups and Queue Directories''.

H -- Define Header

The format of the header lines that sendmail inserts into the message are defined by the H line. The syntax of this line is one of the following:

H hname : htemplate
H[ ? mflags ? ] hname : htemplate
H[ ?$ {macro} ? ] hname : htemplate
Continuation lines in this spec are reflected directly into the outgoing message. The htemplate is macro-expanded before insertion into the message. If the mflags (surrounded by question marks) are specified, at least one of the specified flags must be stated in the mailer definition for this header to be automatically output. If a ${macro} (surrounded by question marks) is specified, the header will be automatically output if the macro is set. The macro may be set using any of the normal methods, including using the macro storage map in a ruleset. If one of these headers is in the input it is reflected to the output regardless of these flags or macros. Notice: If a ${macro} is used to set a header, then it is useful to add that macro to class $={persistentMacros} which consists of the macros that should be saved across queue runs.

Some headers have special semantics that will be described later.

A secondary syntax allows validation of headers as they are being read. To enable validation, use:


H
Header
: $>
Ruleset
H
Header
: $>+
Ruleset
The indicated Ruleset is called for the specified Header, and can return $#error to reject the message or $#discard to discard the message (as with the other check_* rulesets). The ruleset receives the header field-body as argument, i.e., not the header field-name; see also ${hdr_name} and ${currHeader}. The header is treated as a structured field, that is, text in parentheses is deleted before processing, unless the second form $>+ is used. Note: only one ruleset can be associated with a header; sendmail will silently ignore multiple entries.

For example, the configuration lines:

HMessage-Id: $>CheckMessageId


SCheckMessageId
R< $+ @ $+ > $@ OK
R$* $#error $: Illegal Message-Id header

would refuse any message that had a Message-Id: header of any of the following forms:
Message-Id: <>
Message-Id: some text
Message-Id: <legal text@domain> extra crud
A default ruleset that is called for headers which don't have a specific ruleset defined for them can be specified by:

H
*
: $>
Ruleset
or

H
*
: $>+
Ruleset

O -- Set Option

There are a number of global options that can be set from a configuration file. Options are represented by full words; some are also representable as single characters for back compatibility. The syntax of this line is:

O option = value
This sets option option to be value. Note that there must be a space between the letter `O' and the name of the option. An older version is:
O ovalue
where the option o is a single character. 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.

All filenames used in options should be absolute paths, i.e., starting with '/'. Relative filenames most likely cause surprises during operation (unless otherwise noted).

The options supported (with the old, one character names in brackets) are:

AliasFile=spec, spec, ...
[A] Specify possible alias file(s). Each spec should be in the format `` class : info'' where class : is optional and defaults to ``implicit''. Note that info is required for all classes except ldap. For the ldap class, if info is not specified, a default info value is used as follows:
-k (&(objectClass=sendmailMTAAliasObject)
(sendmailMTAAliasName=aliases)
(|(sendmailMTACluster=${sendmailMTACluster})
(sendmailMTAHost=$j))
(sendmailMTAKey=%0))
-v sendmailMTAAliasValue
Depending on how sendmail is compiled, valid classes are implicit (search through a compiled-in list of alias file types, for back compatibility), hash (if NEWDB is specified), btree (if NEWDB is specified), dbm (if NDBM is specified), stab (internal symbol table -- not normally used unless you have no other database lookup), sequence (use a sequence of maps previously declared), ldap (if LDAPMAP is specified), or nis (if NIS is specified). If a list of specs are provided, sendmail searches them in order.
AliasWait=timeout
[a] If set, wait up to timeout (units default to minutes) for an @:@ entry to exist in the alias database before starting up. If it does not appear in the timeout interval issue a warning.
AllowBogusHELO
[no short name] If set, allow HELO SMTP commands that don't include a host name. Setting this violates RFC 1123 section 5.2.5, but is necessary to interoperate with several SMTP clients. If there is a value, it is still checked for legitimacy.
AuthMaxBits=N
[no short name] Limit the maximum encryption strength for the security layer in SMTP AUTH (SASL). Default is essentially unlimited. This allows to turn off additional encryption in SASL if STARTTLS is already encrypting the communication, because the existing encryption strength is taken into account when choosing an algorithm for the security layer. For example, if STARTTLS is used and the symmetric cipher is 3DES, then the the keylength (in bits) is 168. Hence setting AuthMaxBits to 168 will disable any encryption in SASL.
AuthMechanisms
[no short name] List of authentication mechanisms for AUTH (separated by spaces). The advertised list of authentication mechanisms will be the intersection of this list and the list of available mechanisms as determined by the Cyrus SASL library. If STARTTLS is active, EXTERNAL will be added to this list. In that case, the value of {cert_subject} is used as authentication id.
AuthOptions
[no short name] List of options for SMTP AUTH consisting of single characters with intervening white space or commas.

A Use the AUTH= parameter for the MAIL FROM
command only when authentication succeeded.
a protection from active (non-dictionary) attacks
during authentication exchange.
c require mechanisms which pass client credentials,
and allow mechanisms which can pass credentials
to do so.
d don't permit mechanisms susceptible to passive
dictionary attack.
f require forward secrecy between sessions
(breaking one won't help break next).
p don't permit mechanisms susceptible to simple
passive attack (e.g., PLAIN, LOGIN).
y don't permit mechanisms that allow anonymous login.
The first option applies to sendmail as a client, the others to a server. Example:
O AuthOptions=p,y
would disallow ANONYMOUS as AUTH mechanism and would allow PLAIN only if a security layer (e.g., provided by STARTTLS) is already active. The options 'a', 'c', 'd', 'f', 'p', and 'y' refer to properties of the selected SASL mechanisms. Explanations of these properties can be found in the Cyrus SASL documentation.
BadRcptThrottle=N
[no short name] If set and more than the specified number of recipients in a single SMTP envelope are rejected, sleep for one second after each rejected RCPT command.
BlankSub=c
[B] Set the blank substitution character to c. Unquoted spaces in addresses are replaced by this character. Defaults to space (i.e., no change is made).
CACERTPath
[no short name] Path to directory with certificates of CAs. This directory directory must contain the hashes of each CA certificate as filenames (or as links to them).
CACERTFile
[no short name] File containing one or more CA certificates; see section about STARTTLS for more information.
CheckAliases
[n] Validate the RHS of aliases when rebuilding the alias database.
CheckpointInterval=N
[C] Checkpoints the queue every N (default 10) addresses sent. If your system crashes during delivery to a large list, this prevents retransmission to any but the last N recipients.
ClassFactor=fact
[z] The indicated factor is multiplied by the message class (determined by the Precedence: field in the user header and the P lines in the configuration file) and subtracted from the priority. Thus, messages with a higher Priority: will be favored. Defaults to 1800.
ClientCertFile
[no short name] File containing the certificate of the client, i.e., this certificate is used when sendmail acts as client (for STARTTLS).
ClientKeyFile
[no short name] File containing the private key belonging to the client certificate (for STARTTLS if sendmail runs as client).
ClientPortOptions=options
[O] Set client SMTP options. The options are key=value pairs separated by commas. Known keys are:

Port Name/number of source port for connection (defaults to any free port)
Addr Address mask (defaults INADDR_ANY)
Family Address family (defaults to INET)
SndBufSize Size of TCP send buffer
RcvBufSize Size of TCP receive buffer
Modifier Options (flags) for the daemon
The Address mask may be a numeric address in dot notation or a network name. Modifier can be the following character:

h use name of interface for HELO command
A don't use AUTH when sending e-mail
S don't use STARTTLS when sending e-mail
If ``h'' is set, the name corresponding to the outgoing interface address (whether chosen via the Connection parameter or the default) is used for the HELO/EHLO command. However, the name must not start with a square bracket and it must contain at least one dot. This is a simple test whether the name is not an IP address (in square brackets) but a qualified hostname. Note that multiple ClientPortOptions settings are allowed in order to give settings for each protocol family (e.g., one for Family=inet and one for Family=inet6). A restriction placed on one family only affects outgoing connections on that particular family.
ColonOkInAddr
[no short name] If set, colons are acceptable in e-mail addresses (e.g., host:user). If not set, colons indicate the beginning of a RFC 822 group construct ( groupname: member1, member2, ... memberN;). Doubled colons are always acceptable ( nodename::user) and proper route-addr nesting is understood ( <@relay:user@host>). Furthermore, this option defaults on if the configuration version level is less than 6 (for back compatibility). However, it must be off for full compatibility with RFC 822.
ConnectionCacheSize=N
[k] The maximum number of open connections that will be cached at a time. The default is one. This delays closing the current connection until either this invocation of sendmail needs to connect to another host or it terminates. Setting it to zero defaults to the old behavior, that is, connections are closed immediately. Since this consumes file descriptors, the connection cache should be kept small: 4 is probably a practical maximum.
ConnectionCacheTimeout=timeout
[K] The maximum amount of time a cached connection will be permitted to idle without activity. If this time is exceeded, the connection is immediately closed. This value should be small (on the order of ten minutes). Before sendmail uses a cached connection, it always sends a RSET command to check the connection; if this fails, it reopens the connection. This keeps your end from failing if the other end times out. The point of this option is to be a good network neighbor and avoid using up excessive resources on the other end. The default is five minutes.
ConnectOnlyTo=address
[no short name] This can be used to override the connection address (for testing purposes).
ConnectionRateThrottle=N
[no short name] If set to a positive value, allow no more than N incoming connections in a one second period per daemon. This is intended to flatten out peaks and allow the load average checking to cut in. Defaults to zero (no limits).
ControlSocketName=name
[no short name] Name of the control socket for daemon management. A running sendmail daemon can be controlled through this named socket. Available commands are: help, restart, shutdown, and status. The status command returns the current number of daemon children, the maximum number of daemon children, the free disk space (in blocks) of the queue directory, and the load average of the machine expressed as an integer. If not set, no control socket will be available. Solaris and pre-4.4BSD kernel users should see the note in sendmail/README .
DHParameters
File with DH parameters for STARTTLS. This is only required if a ciphersuite containing DSA/DH is used. This is only for people with a good knowledge of TLS, all others can ignore this option.
DaemonPortOptions=options
[O] Set server SMTP options. Each instance of DaemonPortOptions leads to an additional incoming socket. The options are key=value pairs. Known keys are:

Name User-definable name for the daemon (defaults to "Daemon#")
Port Name/number of listening port (defaults to "smtp")
Addr Address mask (defaults INADDR_ANY)
Family Address family (defaults to INET)
Listen Size of listen queue (defaults to 10)
Modifier Options (flags) for the daemon
SndBufSize Size of TCP send buffer
RcvBufSize Size of TCP receive buffer
The Name field is used for error messages and logging. The Address mask may be a numeric address in dot notation or a network name. The Family key defaults to INET (IPv4). IPv6 users who wish to also accept IPv6 connections should add additional Family=inet6 DaemonPortOptions lines. Modifier can be a sequence (without any delimiters) of the following characters:

a always require authentication
b bind to interface through which mail has been received
c perform hostname canonification (.cf)
f require fully qualified hostname (.cf)
u allow unqualified addresses (.cf)
A disable AUTH (overrides 'a' modifier)
C don't perform hostname canonification
E disallow ETRN (see RFC 2476)
O optional; if opening the socket fails ignore it
S don't offer STARTTLS
That is, one way to specify a message submission agent (MSA) that always requires authentication is:
O DaemonPortOptions=Name=MSA, Port=587, M=Ea
The modifiers that are marked with "(.cf)" have only effect in the standard configuration file, in which they are available via ${daemon_flags}. Notice: Do not use the ``a'' modifier on a public accessible MTA! It should only be used for a MSA that is accessed by authorized users for initial mail submission. Users must authenticate to use a MSA which has this option turned on. The flags ``c'' and ``C'' can change the default for hostname canonification in the sendmail.cf file. See the relevant documentation for FEATURE(nocanonify). The modifier ``f'' disallows addresses of the form user@host unless they are submitted directly. The flag ``u'' allows unqualified sender addresses, i.e., those without @host. ``b'' forces sendmail to bind to the interface through which the e-mail has been received for the outgoing connection. WARNING: Use ``b'' only if outgoing mail can be routed through the incoming connection's interface to its destination. No attempt is made to catch problems due to a misconfiguration of this parameter, use it only for virtual hosting where each virtual interface can connect to every possible location. This will also override possible settings via ClientPortOptions. Note, sendmail will listen on a new socket for each occurence of the DaemonPortOptions option in a configuration file. The modifier ``O'' causes sendmail to ignore a socket if it can't be opened. This applies to failures from the socket(2) and bind(2) calls.
DefaultAuthInfo
[no short name] Filename that contains default authentication information for outgoing connections. This file must contain the user id, the authorization id, the password (plain text), the realm and the list of mechanisms to use on separate lines and must be readable by root (or the trusted user) only. If no realm is specified, $j is used. If no mechanisms are specified, the list given by AuthMechanisms is used. Notice: this option is deprecated and will be removed in future versions. Moreover, it doesn't work for the MSP since it can't read the file (the file must not be group/world-readable otherwise sendmail will complain). Use the authinfo ruleset instead which provides more control over the usage of the data anyway.
DefaultCharSet=charset
[no short name] When a message that has 8-bit characters but is not in MIME format is converted to MIME (see the EightBitMode option) a character set must be included in the Content-Type: header. This character set is normally set from the Charset= field of the mailer descriptor. If that is not set, the value of this option is used. If this option is not set, the value unknown-8bit is used.
DataFileBufferSize=threshold
[no short name] Set the threshold, in bytes, before a memory-based queue data file becomes disk-based. The default is 4096 bytes.
DeadLetterDrop=file
[no short name] Defines the location of the system-wide dead.letter file, formerly hardcoded to /usr/tmp/dead.letter. If this option is not set (the default), sendmail will not attempt to save to a system-wide dead.letter file in the event it cannot bounce the mail to the user or postmaster. Instead, it will rename the qf file as it has in the past when the dead.letter file could not be opened.
DefaultUser=user:group
[u] Set the default userid for mailers to user:group. If group is omitted and user is a user name (as opposed to a numeric user id) the default group listed in the /etc/passwd file for that user is used as the default group. Both user and group may be numeric. Mailers without the S flag in the mailer definition will run as this user. Defaults to 1:1. The value can also be given as a symbolic user name.[21]
DelayLA=LA
[no short name] When the system load average exceeds LA, sendmail will sleep for one second on most SMTP commands and before accepting connections.
DeliverByMin=time
[0] Set minimum time for Deliver By SMTP Service Extension (RFC 2852). If 0, no time is listed, if less than 0, the extension is not offered, if greater than 0, it is listed as minimum time for the EHLO keyword DELIVERBY.
DeliveryMode=x
[d] Deliver in mode x. Legal modes are:

i Deliver interactively (synchronously)
b Deliver in background (asynchronously)
q Just queue the message (deliver during queue run)
d Defer delivery and all map lookups (deliver during queue run)
Defaults to ``b'' if no option is specified, ``i'' if it is specified but given no argument (i.e., ``Od'' is equivalent to ``Odi''). The -v command line flag sets this to i.
DialDelay=sleeptime
[no short name] Dial-on-demand network connections can see timeouts if a connection is opened before the call is set up. If this is set to an interval and a connection times out on the first connection being attempted sendmail will sleep for this amount of time and try again. This should give your system time to establish the connection to your service provider. Units default to seconds, so DialDelay=5 uses a five second delay. Defaults to zero (no retry). This delay only applies to mailers which have the Z flag set.
DirectSubmissionModifiers=modifiers
Defines ${daemon_flags} for direct (command line) submissions. If not set, ${daemon_flags} is either "CC f" if the option -G is used or "c u" otherwise.
DontBlameSendmail=option,option,...
[no short name] In order to avoid possible cracking attempts caused by world- and group-writable files and directories, sendmail does paranoid checking when opening most of its support files. If for some reason you absolutely must run with, for example, a group-writable /etc directory, then you will have to turn off this checking (at the cost of making your system more vulnerable to attack). The possible arguments have been described earlier. The details of these flags are described above. Use of this option is not recommended.
DontExpandCnames
[no short name] The standards say that all host addresses used in a mail message must be fully canonical. For example, if your host is named Cruft.Foo.ORG and also has an alias of FTP.Foo.ORG, the former name must be used at all times. This is enforced during host name canonification ($[ ... $] lookups). If this option is set, the protocols are ignored and the wrong thing is done. However, the IETF is moving toward changing this standard, so the behavior may become acceptable. Please note that hosts downstream may still rewrite the address to be the true canonical name however.
DontInitGroups
[no short name] If set, sendmail will avoid using the initgroups(3) call. If you are running NIS, this causes a sequential scan of the groups.byname map, which can cause your NIS server to be badly overloaded in a large domain. The cost of this is that the only group found for users will be their primary group (the one in the password file), which will make file access permissions somewhat more restrictive. Has no effect on systems that don't have group lists.
DontProbeInterfaces
[no short name] Sendmail normally finds the names of all interfaces active on your machine when it starts up and adds their name to the $=w class of known host aliases. If you have a large number of virtual interfaces or if your DNS inverse lookups are slow this can be time consuming. This option turns off that probing. However, you will need to be certain to include all variant names in the $=w class by some other mechanism. If set to loopback, loopback interfaces (e.g., lo0) will not be probed.
DontPruneRoutes
[R] Normally, sendmail tries to eliminate any unnecessary explicit routes when sending an error message (as discussed in RFC 1123 § 5.2.6). For example, when sending an error message to
<@known1,@known2,@known3:user@unknown>
sendmail will strip off the @known1,@known2 in order to make the route as direct as possible. However, if the R option is set, this will be disabled, and the mail will be sent to the first address in the route, even if later addresses are known. This may be useful if you are caught behind a firewall.
DoubleBounceAddress=error-address
[no short name] If an error occurs when sending an error message, send the error report (termed a double bounce because it is an error bounce that occurs when trying to send another error bounce) to the indicated address. The address is macro expanded at the time of delivery. If not set, defaults to postmaster. If set to an empty string, double bounces are dropped.
EightBitMode=action
[8] Set handling of eight-bit data. There are two kinds of eight-bit data: that declared as such using the BODY=8BITMIME ESMTP declaration or the -B8BITMIME command line flag, and undeclared 8-bit data, that is, input that just happens to be eight bits. There are three basic operations that can happen: undeclared 8-bit data can be automatically converted to 8BITMIME, undeclared 8-bit data can be passed as-is without conversion to MIME (``just send 8''), and declared 8-bit data can be converted to 7-bits for transmission to a non-8BITMIME mailer. The possible actions are:

ErrorHeader=file-or-message
[E] Prepend error messages with the indicated message. If it begins with a slash, it is assumed to be the pathname of a file containing a message (this is the recommended setting). Otherwise, it is a literal message. The error file might contain the name, email address, and/or phone number of a local postmaster who could provide assistance to end users. If the option is missing or null, or if it names a file which does not exist or which is not readable, no message is printed.
ErrorMode=x
[e] Dispose of errors using mode x. The values for x are:
p Print error messages (default)
q No messages, just give exit status
m Mail back errors
w Write back errors (mail if user not logged in)
e Mail back errors and give zero exit stat always
FallbackMXhost=fallbackhost
[V] If specified, the fallbackhost acts like a very low priority MX on every host. MX records will be looked up for this host, unless the name is surrounded by square brackets. This is intended to be used by sites with poor network connectivity. Messages which are undeliverable due to temporary address failures (e.g., DNS failure) also go to the FallbackMX host.
FastSplit
[no short name] If set to a value greater than zero (the default is one), it suppresses the MX lookups on addresses when they are initially sorted, i.e., for the first delivery attempt. This usually results in faster envelope splitting unless the MX records are readily available in a local DNS cache. To enforce initial sorting based on MX records set FastSplit to zero. If the mail is submitted directly from the command line, then the value also limits the number of processes to deliver the envelopes; if more envelopes are created they are only queued up and must be taken care of by a queue run. Since the default submission method is via SMTP (either from a MUA or via the MSP), the value of FastSplit is seldom used to limit the number of processes to deliver the envelopes.
ForkEachJob
[Y] If set, deliver each job that is run from the queue in a separate process.
ForwardPath=path
[J] Set the path for searching for users' .forward files. The default is $z/.forward. Some sites that use the automounter may prefer to change this to /var/forward/$u to search a file with the same name as the user in a system directory. It can also be set to a sequence of paths separated by colons; sendmail stops at the first file it can successfully and safely open. For example, /var/forward/$u:$z/.forward will search first in /var/forward/ username and then in ~username/.forward (but only if the first file does not exist).
HelpFile=file
[H] Specify the help file for SMTP. If no file name is specified, "helpfile" is used.
HoldExpensive
[c] If an outgoing mailer is marked as being expensive, don't connect immediately. This requires that queueing be compiled in, since it will depend on a queue run process to actually send the mail.
HostsFile=path
[no short name] The path to the hosts database, normally /etc/hosts. This option is only consulted when sendmail is canonifying addresses, and then only when files is in the hosts service switch entry. In particular, this file is never used when looking up host addresses; that is under the control of the system gethostbyname(3) routine.
HostStatusDirectory=path
[no short name] The location of the long term host status information. When set, information about the status of hosts (e.g., host down or not accepting connections) will be shared between all sendmail processes; normally, this information is only held within a single queue run. This option requires a connection cache of at least 1 to function. If the option begins with a leading `/', it is an absolute pathname; otherwise, it is relative to the mail queue directory. A suggested value for sites desiring persistent host status is .hoststat (i.e., a subdirectory of the queue directory).
IgnoreDots
[i] Ignore dots in incoming messages. This is always disabled (that is, dots are always accepted) when reading SMTP mail.
InputMailFilters=name,name,...
A comma separated list of filters which determines which filters (see the "X -- Mail Filter (Milter) Definitions" section) and the invocation sequence are contacted for incoming SMTP messages. If none are set, no filters will be contacted.
LDAPDefaultSpec=spec
[no short name] Sets a default map specification for LDAP maps. The value should only contain LDAP specific settings such as -h host -p port -d bindDN. The settings will be used for all LDAP maps unless the individual map specification overrides a setting. This option should be set before any LDAP maps are defined.
LogLevel=n
[L] Set the log level to n. Defaults to 9.
Mxvalue
[no long version] Set the macro x to value. This is intended only for use from the command line. The -M flag is preferred.
MailboxDatabase
[no short name] Type of lookup to find information about local mailboxes, defaults to ``pw'' which uses getpwnam. Other types can be introduced by adding them to the source code, see libsm/mbdb.c for details.
UseMSP
[no short name] Use as mail submission program, i.e., allow group writable queue files if the group is the same as that of a set-group-ID sendmail binary. See the file sendmail/SECURITY in the distribution tarball.
MatchGECOS
[G] Allow fuzzy matching on the GECOS field. If this flag is set, and the usual user name lookups fail (that is, there is no alias with this name and a getpwnam fails), sequentially search the password file for a matching entry in the GECOS field. This also requires that MATCHGECOS be turned on during compilation. This option is not recommended.
MaxAliasRecursion=N
[no short name] The maximum depth of alias recursion (default: 10).
MaxDaemonChildren=N
[no short name] If set, sendmail will refuse connections when it has more than N children processing incoming mail or automatic queue runs. This does not limit the number of outgoing connections. If not set, there is no limit to the number of children -- that is, the system load averaging controls this.
MaxHeadersLength=N
[no short name] The maximum length of the sum of all headers. This can be used to prevent a denial of service attack. The default is no limit.
MaxHopCount=N
[h] The maximum hop count. Messages that have been processed more than N times are assumed to be in a loop and are rejected. Defaults to 25.
MaxMessageSize=N
[no short name] Specify the maximum message size to be advertised in the ESMTP EHLO response. Messages larger than this will be rejected.
MaxMimeHeaderLength=N[/M]
[no short name] Sets the maximum length of certain MIME header field values to N characters. These MIME header fields are determined by being a member of class {checkMIMETextHeaders}, which currently contains only the header Content-Description. For some of these headers which take parameters, the maximum length of each parameter is set to M if specified. If /M is not specified, one half of N will be used. By default, these values are 0, meaning no checks are done.
MaxQueueChildren=N
[no short name] When set, this limits the number of concurrent queue runner processes to N. This helps to control the amount of system resources used when processing the queue. When there are multiple queue groups defined and the total number of queue runners for these queue groups would exceed MaxQueueChildren then the queue groups will not all run concurrently. That is, some portion of the queue groups will run concurrently such that MaxQueueChildren will not be exceeded, while the remaining queue groups will be run later (in round robin order). See also MaxRunnersPerQueue and the section Queue Group Declaration.
MaxQueueRunSize=N
[no short name] The maximum number of jobs that will be processed in a single queue run. If not set, there is no limit on the size. If you have very large queues or a very short queue run interval this could be unstable. However, since the first N jobs in queue directory order are run (rather than the N highest priority jobs) this should be set as high as possible to avoid losing jobs that happen to fall late in the queue directory.
MaxRecipientsPerMessage=N
[no short name] The maximum number of recipients that will be accepted per message in an SMTP transaction. Note: setting this too low can interfere with sending mail from MUAs that use SMTP for initial submission. If not set, there is no limit on the number of recipients per envelope.
MaxRunnersPerQueue=N
[no short name] This sets the default maximum number of queue runners for queue groups. Up to N queue runners will work in parallel on a queue group's messages. This is useful where the processing of a message in the queue might delay the processing of subsequent messages. Such a delay may be the result of non-erroneous situations such as a low bandwidth connection. May be overridden on a per queue group basis by setting the Runners option; see the section Queue Group Declaration. The default is 1 when not set.
MeToo
[m] Send to me too, even if I am in an alias expansion. This option is deprecated and will be removed from a future version.
Milter
[no short name] This option has several sub(sub)options. The names of the suboptions are separated by dots. At the first level the following options are available:

LogLevel Log level for input mail filter actions, defaults to LogLevel.
macros Specifies list of macro to transmit to filters.
See list below.
The ``macros'' option has the following suboptions which specify the list of macro to transmit to milters after a certain event occurred.

connect After session connection start
helo After HELO command
envfrom After MAIL FROM command
envrcpt After RCPT TO command
By default the lists of macros are empty. Example:
O Milter.LogLevel=12
O Milter.macros.connect=j, _, {daemon_name}
MinFreeBlocks=N
[b] Insist on at least N blocks free on the filesystem that holds the queue files before accepting email via SMTP. If there is insufficient space sendmail gives a 452 response to the MAIL command. This invites the sender to try again later.
MinQueueAge=age
[no short name] Don't process any queued jobs that have been in the queue less than the indicated time interval. This is intended to allow you to get responsiveness by processing the queue fairly frequently without thrashing your system by trying jobs too often. The default units are minutes.
MustQuoteChars=s
[no short name] Sets the list of characters that must be quoted if used in a full name that is in the phrase part of a ``phrase <address>'' syntax. The default is ``'.''. The characters ``@,;:\e()[]'' are always added to this list.
NiceQueueRun
[no short name] The priority of queue runners (nice(3)).
NoRecipientAction
[no short name] The action to take when you receive a message that has no valid recipient headers (To:, Cc:, Bcc:, or Apparently-To: -- the last included for back compatibility with old sendmails). It can be None to pass the message on unmodified, which violates the protocol, Add-To to add a To: header with any recipients it can find in the envelope (which might expose Bcc: recipients), Add-Apparently-To to add an Apparently-To: header (this is only for back-compatibility and is officially deprecated), Add-To-Undisclosed to add a header To: undisclosed-recipients:; to make the header legal without disclosing anything, or Add-Bcc to add an empty Bcc: header.
OldStyleHeaders
[o] Assume that the headers may be in old format, i.e., spaces delimit names. This actually turns on an adaptive algorithm: if any recipient address contains a comma, parenthesis, or angle bracket, it will be assumed that commas already exist. If this flag is not on, only commas delimit names. Headers are always output with commas between the names. Defaults to off.
OperatorChars=charlist
[$o macro] The list of characters that are considered to be operators, that is, characters that delimit tokens. All operator characters are tokens by themselves; sequences of non-operator characters are also tokens. White space characters separate tokens but are not tokens themselves -- for example, AAA.BBB has three tokens, but AAA BBB has two. If not set, OperatorChars defaults to .:@[]; additionally, the characters ()<>,; are always operators. Note that OperatorChars must be set in the configuration file before any rulesets.
PidFile=filename
[no short name] Filename of the pid file. (default is _PATH_SENDMAILPID). The filename is macro-expanded before it is opened.
PostmasterCopy=postmaster
[P] If set, copies of error messages will be sent to the named postmaster. Only the header of the failed message is sent. Errors resulting from messages with a negative precedence will not be sent. Since most errors are user problems, this is probably not a good idea on large sites, and arguably contains all sorts of privacy violations, but it seems to be popular with certain operating systems vendors. The address is macro expanded at the time of delivery. Defaults to no postmaster copies.
PrivacyOptions=opt,opt,...
[p] Set the privacy options. ``Privacy'' is really a misnomer; many of these are just a way of insisting on stricter adherence to the SMTP protocol. The options can be selected from:

public Allow open access
needmailhelo Insist on HELO or EHLO command before MAIL
needexpnhelo Insist on HELO or EHLO command before EXPN
noexpn Disallow EXPN entirely, implies noverb.
needvrfyhelo Insist on HELO or EHLO command before VRFY
novrfy Disallow VRFY entirely
noetrn Disallow ETRN entirely
noverb Disallow VERB entirely
restrictmailq Restrict mailq command
restrictqrun Restrict -q command line flag
restrictexpand Restrict -bv and -v command line flags
noreceipts Don't return success DSNs[22]
nobodyreturn Don't return the body of a message with DSNs
goaway Disallow essentially all SMTP status queries
authwarnings Put X-Authentication-Warning: headers in messages
and log warnings
The goaway pseudo-flag sets all flags except noreceipts, restrictmailq, restrictqrun, restrictexpand, noetrn, and nobodyreturn. If mailq is restricted, only people in the same group as the queue directory can print the queue. If queue runs are restricted, only root and the owner of the queue directory can run the queue. The restrictexpand pseudo-flag instructs sendmail to drop privileges when the -bv option is given by users who are neither root nor the TrustedUser so users cannot read private aliases, forwards, or :include: files. It will add the NonRootSafeAddr to the DontBlameSendmail option to prevent misleading unsafe address warnings. It also overrides the -v (verbose) command line option to prevent information leakage. Authentication Warnings add warnings about various conditions that may indicate attempts to spoof the mail system, such as using a non-standard queue directory.
ProcessTitlePrefix=string
[no short name] Prefix the process title shown on 'ps' listings with string. The string will be macro processed.
QueueDirectory=dir
[Q] The QueueDirectory option serves two purposes. First, it specifies the directory or set of directories that comprise the default queue group. Second, it specifies the directory D which is the ancestor of all queue directories, and which sendmail uses as its current working directory. When sendmail dumps core, it leaves its core files in D. There are two cases. If dir ends with an asterisk (eg, /var/spool/mqueue/q*), then all of the directories or symbolic links to directories beginning with `q' in /var/spool/mqueue will be used as queue directories of the default queue group, and /var/spool/mqueue will be used as the working directory D. Otherwise, dir must name a directory (usually /var/spool/mqueue): the default queue group consists of the single queue directory dir, and the working directory D is set to dir. To define additional groups of queue directories, use the configuration file `Q' command. Do not change the queue directory structure while sendmail is running.
QueueFactor=factor
[q] Use factor as the multiplier in the map function to decide when to just queue up jobs rather than run them. This value is divided by the difference between the current load average and the load average limit ( QueueLA option) to determine the maximum message priority that will be sent. Defaults to 600000.
QueueLA=LA
[x] When the system load average exceeds LA and the QueueFactor ( q) option divided by the difference in the current load average and the QueueLA option plus one is less than the priority of the message, just queue messages (i.e., don't try to send them). Defaults to 8 multiplied by the number of processors online on the system (if that can be determined).
QueueFileMode=mode
[no short name] Default permissions for queue files (octal). If not set, sendmail uses 0600 unless its real and effective uid are different in which case it uses 0644.
QueueSortOrder=algorithm
[no short name] Sets the algorithm used for sorting the queue. Only the first character of the value is used. Legal values are host (to order by the name of the first host name of the first recipient), filename (to order by the name of the queue file name), time (to order by the submission/creation time), random (to order randomly), modification (to order by the modification time of the qf file (older entries first)), and priority (to order by message priority). Host ordering makes better use of the connection cache, but may tend to process low priority messages that go to a single host over high priority messages that go to several hosts; it probably shouldn't be used on slow network links. Filename and modification time ordering saves the overhead of reading all of the queued items before starting the queue run. Creation (submission) time ordering is almost always a bad idea, since it allows large, bulk mail to go out before smaller, personal mail, but may have applicability on some hosts with very fast connections. Random is useful if several queue runners are started by hand which try to drain the same queue since odds are they will be working on different parts of the queue at the same time. Priority ordering is the default.
QueueTimeout=timeout
[T] A synonym for Timeout.queuereturn. Use that form instead of the QueueTimeout form.
RandFile
[no short name] Name of file containing random data or the name of the UNIX socket if EGD is used. A (required) prefix "egd:" or "file:" specifies the type. STARTTLS requires this filename if the compile flag HASURANDOMDEV is not set (see sendmail/README).
ResolverOptions=options
[I] Set resolver options. Values can be set using + flag and cleared using - flag; the flags can be debug, aaonly, usevc, primary, igntc, recurse, defnames, stayopen, use_inet6, or dnsrch. The string HasWildcardMX (without a + or -) can be specified to turn off matching against MX records when doing name canonifications. The string WorkAroundBrokenAAAA (without a + or -) can be specified to work around some broken nameservers which return SERVFAIL (a temporary failure) on T_AAAA (IPv6) lookups. N.B. Prior to 8.7, this option indicated that the name server be responding in order to accept addresses. This has been replaced by checking to see if the dns method is listed in the service switch entry for the hosts service.
RrtImpliesDsn
[R] If this option is set, a Return-Receipt-To: header causes the request of a DSN, which is sent to the envelope sender as required by RFC1891, not to the address given in the header.
RunAsUser=user
[no short name] The user parameter may be a user name (looked up in /etc/passwd) or a numeric user id; either form can have :group attached (where group can be numeric or symbolic). If set to a non-zero (non-root) value, sendmail will change to this user id shortly after startup[23]. This avoids a certain class of security problems. However, this means that all .forward and :include: files must be readable by the indicated user and all files to be written must be writable by user Also, all file and program deliveries will be marked unsafe unless the option DontBlameSendmail=NonRootSafeAddr is set, in which case the delivery will be done as user. It is also incompatible with the SafeFileEnvironment option. In other words, it may not actually add much to security on an average system, and may in fact detract from security (because other file permissions must be loosened). However, it should be useful on firewalls and other places where users don't have accounts and the aliases file is well constrained.
RecipientFactor=fact
[y] The indicated factor is added to the priority (thus lowering the priority of the job) for each recipient, i.e., this value penalizes jobs with large numbers of recipients. Defaults to 30000.
RefuseLA=LA
[X] When the system load average exceeds LA, refuse incoming SMTP connections. Defaults to 12 multiplied by the number of processors online on the system (if that can be determined).
RetryFactor=fact
[Z] The factor is added to the priority every time a job is processed. Thus, each time a job is processed, its priority will be decreased by the indicated value. In most environments this should be positive, since hosts that are down are all too often down for a long time. Defaults to 90000.
SafeFileEnvironment=dir
[no short name] If this option is set, sendmail will do a chroot(2) call into the indicated directory before doing any file writes. If the file name specified by the user begins with dir, that partial path name will be stripped off before writing, so (for example) if the SafeFileEnvironment variable is set to /safe then aliases of /safe/logs/file and /logs/file actually indicate the same file. Additionally, if this option is set, sendmail refuses to deliver to symbolic links.
SaveFromLine
[f] Save UNIX-style From lines at the front of headers. Normally they are assumed redundant and discarded.
SharedMemoryKey
[no short name] Key to use for shared memory segment; if not set (or 0), shared memory will not be used. Requires support for shared memory to be compiled into sendmail. If this option is set, sendmail can share some data between different instances. For example, the number of entries in a queue directory or the available space in a file system. This allows for more efficient program execution, since only one process needs to update the data instead of each individual process gathering the data each time it is required.
SendMimeErrors
[j] If set, send error messages in MIME format (see RFC2045 and RFC1344 for details). If disabled, sendmail will not return the DSN keyword in response to an EHLO and will not do Delivery Status Notification processing as described in RFC1891.
ServerCertFile
[no short name] File containing the certificate of the server, i.e., this certificate is used when sendmail acts as server (used for STARTTLS).
ServerKeyFile
[no short name] File containing the private key belonging to the server certificate (used for STARTTLS).
ServiceSwitchFile=filename
[no short name] If your host operating system has a service switch abstraction (e.g., /etc/nsswitch.conf on Solaris or /etc/svc.conf on Ultrix and DEC OSF/1) that service will be consulted and this option is ignored. Otherwise, this is the name of a file that provides the list of methods used to implement particular services. The syntax is a series of lines, each of which is a sequence of words. The first word is the service name, and following words are service types. The services that sendmail consults directly are aliases and hosts. Service types can be dns, nis, nisplus, or files (with the caveat that the appropriate support must be compiled in before the service can be referenced). If ServiceSwitchFile is not specified, it defaults to /etc/mail/service.switch. If that file does not exist, the default switch is:
aliases files
hosts dns nis files
The default file is /etc/mail/service.switch.
SevenBitInput
[7] Strip input to seven bits for compatibility with old systems. This shouldn't be necessary.
SingleLineFromHeader
[no short name] If set, From: lines that have embedded newlines are unwrapped onto one line. This is to get around a botch in Lotus Notes that apparently cannot understand legally wrapped RFC822 headers.
SingleThreadDelivery
[no short name] If set, a client machine will never try to open two SMTP connections to a single server machine at the same time, even in different processes. That is, if another sendmail is already talking to some host a new sendmail will not open another connection. This property is of mixed value; although this reduces the load on the other machine, it can cause mail to be delayed (for example, if one sendmail is delivering a huge message, other sendmails won't be able to send even small messages). Also, it requires another file descriptor (for the lock file) per connection, so you may have to reduce the ConnectionCacheSize option to avoid running out of per-process file descriptors. Requires the HostStatusDirectory option.
SmtpGreetingMessage=message
[$e macro] The message printed when the SMTP server starts up. Defaults to $j Sendmail $v ready at $b.
StatusFile=file
[S] Log summary statistics in the named file. If no file name is specified, "statistics" is used. If not set, no summary statistics are saved. This file does not grow in size. It can be printed using the mailstats(8) program.
SuperSafe
[s] This option can be set to True, False, or Interactive. If set to True, sendmail will be super-safe when running things, i.e., always instantiate the queue file, even if you are going to attempt immediate delivery. Sendmail always instantiates the queue file before returning control to the client under any circumstances. This should really always be set to True. The Interactive value has been introduced in 8.12 and can be used together with DeliveryMode=i. It skips some synchronization calls which are effectively doubled in the code execution path for this mode.
TLSSrvOptions
[no short name] List of options for SMTP STARTTLS for the server consisting of single characters with intervening white space or commas. The flag ``v'' disables client verification, and hence it is not possible to use a client certificate for relaying. Currently there are no other flags available.
TempFileMode=mode
[F] The file mode for transcript files, files to which sendmail delivers directly, and files in the HostStatusDirectory. It is interpreted in octal by default. Defaults to 0600.
Timeout.type=timeout
[r; subsumes old T option as well] Set timeout values. For more information, see section
TimeZoneSpec=tzinfo
[t] Set the local time zone info to tzinfo -- for example, PST8PDT. Actually, if this is not set, the TZ environment variable is cleared (so the system default is used); if set but null, the user's TZ variable is used, and if set and non-null the TZ variable is set to this value.
TrustedUser=user
[no short name] The user parameter may be a user name (looked up in /etc/passwd) or a numeric user id. Trusted user for file ownership and starting the daemon. If set, generated alias databases and the control socket (if configured) will automatically be owned by this user.
TryNullMXList
[w] If this system is the best (that is, lowest preference) MX for a given host, its configuration rules should normally detect this situation and treat that condition specially by forwarding the mail to a UUCP feed, treating it as local, or whatever. However, in some cases (such as Internet firewalls) you may want to try to connect directly to that host as though it had no MX records at all. Setting this option causes sendmail to try this. The downside is that errors in your configuration are likely to be diagnosed as host unknown or message timed out instead of something more meaningful. This option is disrecommended.
UnixFromLine=fromline
[$l macro] Defines the format used when sendmail must add a UNIX-style From_ line (that is, a line beginning From<space>user). Defaults to From $g $d. Don't change this unless your system uses a different UNIX mailbox format (very unlikely).
UnsafeGroupWrites
[no short name] If set (default), :include: and .forward files that are group writable are considered unsafe, that is, they cannot reference programs or write directly to files. World writable :include: and .forward files are always unsafe. Note: use DontBlameSendmail instead; this option is deprecated.
UseErrorsTo
[l] If there is an Errors-To: header, send error messages to the addresses listed there. They normally go to the envelope sender. Use of this option causes sendmail to violate RFC 1123. This option is disrecommended and deprecated.
UserDatabaseSpec=udbspec
[U] The user database specification.
Verbose
[v] Run in verbose mode. If this is set, sendmail adjusts options HoldExpensive (old c) and DeliveryMode (old d) so that all mail is delivered completely in a single job so that you can see the entire delivery process. Option Verbose should never be set in the configuration file; it is intended for command line use only.
XscriptFileBufferSize=threshold
[no short name] Set the threshold, in bytes, before a memory-based queue transcript file becomes disk-based. The default is 4096 bytes.

All options can be specified on the command line using the -O or -o flag, but most will cause sendmail to relinquish its set-user-ID permissions. The options that will not cause this are SevenBitInput [7], EightBitMode [8], MinFreeBlocks [b], CheckpointInterval [C], DeliveryMode [d], ErrorMode [e], IgnoreDots [i], SendMimeErrors [j], LogLevel [L], MeToo [m], OldStyleHeaders [o], PrivacyOptions [p], SuperSafe [s], Verbose [v], QueueSortOrder, MinQueueAge, DefaultCharSet, Dial Delay, NoRecipientAction, ColonOkInAddr, MaxQueueRunSize, SingleLineFromHeader, and AllowBogusHELO. Actually, PrivacyOptions [p] given on the command line are added to those already specified in the sendmail.cf file, i.e., they can't be reset. Also, M (define macro) when defining the r or s macros is also considered safe.

P -- Precedence Definitions

Values for the Precedence: field may be defined 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 if an error occurs during processing the body of the message will not be returned; this is expected to be used for bulk mail such as through mailing lists. The default precedence is zero. For example, our list of precedences is:
Pfirst-class=0
Pspecial-delivery=100
Plist=-30
Pbulk=-60
Pjunk=-100
People writing mailing list exploders are encouraged to use Precedence: list. Older versions of sendmail (which discarded all error returns for negative precedences) didn't recognize this name, giving it a default precedence of zero. This allows list maintainers to see error returns on both old and new versions of sendmail.

V -- Configuration Version Level

To provide compatibility with old configuration files, the V line has been added to define some very basic semantics of the configuration file. These are not intended to be long term supports; rather, they describe compatibility features which will probably be removed in future releases.

N.B.: these version levels have nothing to do with the version number on the files. For example, as of this writing version 10 config files (specifically, 8.10) used version level 9 configurations.

Old configuration files are defined as version level one. Version level two files make the following changes:

  1. Host name canonification ($[ ... $]) appends a dot if the name is recognized; this gives the config file a way of finding out if anything matched. (Actually, this just initializes the host map with the -a. flag -- you can reset it to anything you prefer by declaring the map explicitly.)
  2. Default host name extension is consistent throughout processing; version level one configurations turned off domain extension (that is, adding the local domain name) during certain points in processing. Version level two configurations are expected to include a trailing dot to indicate that the name is already canonical.
  3. Local names that are not aliases are passed through a new distinguished ruleset five; this can be used to append a local relay. This behavior can be prevented by resolving the local name with an initial `@'. That is, something that resolves to a local mailer and a user name of vikki will be passed through ruleset five, but a user name of @vikki will have the `@' stripped, will not be passed through ruleset five, but will otherwise be treated the same as the prior example. The expectation is that this might be used to implement a policy where mail sent to vikki was handled by a central hub, but mail sent to vikki@localhost was delivered directly.

Version level three files allow # initiated comments on all lines. Exceptions are backslash escaped # marks and the $# syntax.

Version level four configurations are completely equivalent to level three for historical reasons.

Version level five configuration files change the default definition of $w to be just the first component of the hostname.

Version level six configuration files change many of the local processing options (such as aliasing and matching the beginning of the address for `|' characters) to be mailer flags; this allows fine-grained control over the special local processing. Level six configuration files may also use long option names. The ColonOkInAddr option (to allow colons in the local-part of addresses) defaults on for lower numbered configuration files; the configuration file requires some additional intelligence to properly handle the RFC 822 group construct.

Version level seven configuration files used new option names to replace old macros ( $e became SmtpGreetingMessage, $l became UnixFromLine, and $o became OperatorChars. Also, prior to version seven, the F=q flag (use 250 instead of 252 return value for SMTP VRFY commands) was assumed.

Version level eight configuration files allow $# on the left hand side of ruleset lines.

Version level nine configuration files allow parentheses in rulesets, i.e. they are not treated as comments and hence removed.

Version level ten configuration files allow queue group definitions.

The V line may have an optional / vendor to indicate that this configuration file uses modifications specific to a particular vendor[24]. You may use /Berkeley to emphasize that this configuration file uses the Berkeley dialect of sendmail.

K -- Key File Declaration

Special maps can be defined using the line:

Kmapname mapclass arguments
The mapname is the handle by which this map is referenced in the rewriting rules. The mapclass is the name of a type of map; these are compiled in to sendmail. The arguments are interpreted depending on the class; typically, there would be a single argument naming the file containing the map.

Maps are referenced using the syntax:

$( map key $@ arguments $: default $)
where either or both of the arguments or default portion may be omitted. The $@ arguments may appear more than once. The indicated key and arguments are passed to the appropriate mapping function. If it returns a value, it replaces the input. If it does not return a value and the default is specified, the default replaces the input. Otherwise, the input is unchanged.

The arguments are passed to the map for arbitrary use. Most map classes can interpolate these arguments into their values using the syntax %n (where n is a digit) to indicate the corresponding argument. Argument %0 indicates the database key. For example, the rule


R$- ! $+ $: $(uucp $1 $@ $2 $: %1 @ %0 . UUCP $)
Looks up the UUCP name in a (user defined) UUCP map; if not found it turns it into .UUCP form. The database might contain records like:
decvax %1@%0.DEC.COM
research %1@%0.ATT.COM
Note that default clauses never do this mapping.

The built-in map with both name and class host is the host name canonicalization lookup. Thus, the syntax:

$(host hostname$)
is equivalent to:
$[hostname$]

There are many defined classes.

dbm
Database lookups using the ndbm(3) library. Sendmail must be compiled with NDBM defined.
btree
Database lookups using the btree interface to the Berkeley DB library. Sendmail must be compiled with NEWDB defined.
hash
Database lookups using the hash interface to the Berkeley DB library. Sendmail must be compiled with NEWDB defined.
nis
NIS lookups. Sendmail must be compiled with NIS defined.
nisplus
NIS+ lookups. Sendmail must be compiled with NISPLUS defined. The argument is the name of the table to use for lookups, and the -k and -v flags may be used to set the key and value columns respectively.
hesiod
Hesiod lookups. Sendmail must be compiled with HESIOD defined.
ldap
LDAP X500 directory lookups. Sendmail must be compiled with LDAPMAP defined. The map supports most of the standard arguments and most of the command line arguments of the ldapsearch program. Note that, by default, if a single query matches multiple values, only the first value will be returned unless the -z (value separator) map flag is set. Also, the -1 map flag will treat a multiple value return as if there were no matches.
netinfo
NeXT NetInfo lookups. Sendmail must be compiled with NETINFO defined.
text
Text file lookups. The format of the text file is defined by the -k (key field number), -v (value field number), and -z (field delimiter) flags.
ph
PH query map. Contributed and supported by Mark Roth, roth@uiuc.edu. For more information, consult the web site http://www-dev.cso.uiuc.edu/sendmail/.
nsd
nsd map for IRIX 6.5 and later. Contributed and supported by Bob Mende of SGI, mende@sgi.com.
stab
Internal symbol table lookups. Used internally for aliasing.
implicit
Really should be called alias -- this is used to get the default lookups for alias files, and is the default if no class is specified for alias files.
user
Looks up users using getpwnam(3). The -v flag can be used to specify the name of the field to return (although this is normally used only to check the existence of a user).
host
Canonifies host domain names. Given a host name it calls the name server to find the canonical name for that host.
bestmx
Returns the best MX record for a host name given as the key. The current machine is always preferred -- that is, if the current machine is one of the hosts listed as a lowest-preference MX record, then it will be guaranteed to be returned. This can be used to find out if this machine is the target for an MX record, and mail can be accepted on that basis. If the -z flag is given, then all MX names are returned, separated by the given delimiter.
dns
This map requires the option -R to specify the DNS resource record type to lookup. The following types are supported: A, AAAA, AFSDB, CNAME, MX, NS, PTR, SRV, and TXT. A map lookup will return only one record. Hence for some types, e.g., MX records, the return value might be a random element of the list due to randomizing in the DNS resolver.
sequence
The arguments on the `K' line are a list of maps; the resulting map searches the argument maps in order until it finds a match for the indicated key. For example, if the key definition is:
Kmap1 ...
Kmap2 ...
Kseqmap sequence map1 map2
then a lookup against seqmap first does a lookup in map1. If that is found, it returns immediately. Otherwise, the same key is used for map2.
syslog
the key is logged via syslogd(8). The lookup returns the empty string.
switch
Much like the sequence map except that the order of maps is determined by the service switch. The argument is the name of the service to be looked up; the values from the service switch are appended to the map name to create new map names. For example, consider the key definition:
Kali switch aliases
together with the service switch entry:
aliases nis files
This causes a query against the map ali to search maps named ali.nis and ali.files in that order.
dequote
Strip double quotes (") from a name. It does not strip backslashes, and will not strip quotes if the resulting string would contain unscannable syntax (that is, basic errors like unbalanced angle brackets; more sophisticated errors such as unknown hosts are not checked). The intent is for use when trying to accept mail from systems such as DECnet that routinely quote odd syntax such as
"49ers::ubell"
A typical usage is probably something like:
Kdequote dequote


...


R$- $: $(dequote $1 $)
R$- $+ $: $>3 $1 $2

Care must be taken to prevent unexpected results; for example,
"|someprogram < input > output"
will have quotes stripped, but the result is probably not what you had in mind. Fortunately these cases are rare.
regex
The map definition on the K line contains a regular expression. Any key input is compared to that expression using the POSIX regular expressions routines regcomp(), regerr(), and regexec(). Refer to the documentation for those routines for more information about the regular expression matching. No rewriting of the key is done if the -m flag is used. Without it, the key is discarded or if -s if used, it is substituted by the substring matches, delimited by $| or the string specified with the the -d flag. The flags available for the map are

-n not
-f case sensitive
-b basic regular expressions (default is extended)
-s substring match
-d set the delimiter used for -s
-a append string to key
-m match only, do not replace/discard value
-D perform no lookup in deferred delivery mode.
The -s flag can include an optional parameter which can be used to select the substrings in the result of the lookup. For example,
-s1,3,4
Notes: to match a $ in a string, \\$$ must be used. If the pattern contains spaces, they must be replaced with the blank substitution character, unless it is space itself.
program
The arguments on the K line are the pathname to a program and any initial parameters to be passed. When the map is called, the key is added to the initial parameters and the program is invoked as the default user/group id. The first line of standard output is returned as the value of the lookup. This has many potential security problems, and has terrible performance; it should be used only when absolutely necessary.
macro
Set or clear a macro value. To set a macro, pass the value as the first argument in the map lookup. To clear a macro, do not pass an argument in the map lookup. The map always returns the empty string. Example of typical usage include:
Kstorage macro


...


# set macro ${MyMacro} to the ruleset match
R$+ $: $(storage {MyMacro} $@ $1 $) $1
# set macro ${MyMacro} to an empty string
R$* $: $(storage {MyMacro} $@ $) $1
# clear macro ${MyMacro}
R$- $: $(storage {MyMacro} $) $1

arith
Perform simple arithmetic operations. The operation is given as key, currently +, -, *, /, %, |, & (bitwise OR, AND), l (for less than), and = are supported. The two operands are given as arguments. The lookup returns the result of the computation, i.e. TRUE or FALSE for comparisons, integer values otherwise. All options which are possible for maps are ignored. A simple example is:
Kcomp arith


...


Scheck_etrn
R$* $: $(comp l $@ $&{load_avg} $@ 7 $) $1
RFALSE $# error ...

Most of these accept as arguments the same optional flags and a filename (or a mapname for NIS; the filename is the root of the database path, so that .db or some other extension appropriate for the database type will be added to get the actual database name). Known flags are:

-o
Indicates that this map is optional -- that is, if it cannot be opened, no error is produced, and sendmail will behave as if the map existed but was empty.
-N, -O
If neither -N or -O are specified, sendmail uses an adaptive algorithm to decide whether or not to look for null bytes on the end of keys. It starts by trying both; if it finds any key with a null byte it never tries again without a null byte and vice versa. If -N is specified it never tries without a null byte and if -O is specified it never tries with a null byte. Setting one of these can speed matches but are never necessary. If both -N and -O are specified, sendmail will never try any matches at all -- that is, everything will appear to fail.
-ax
Append the string x on successful matches. For example, the default host map appends a dot on successful matches.
-Tx
Append the string x on temporary failures. For example, x would be appended if a DNS lookup returned server failed or an NIS lookup could not locate a server. See also the -t flag.
-f
Do not fold upper to lower case before looking up the key.
-m
Match only (without replacing the value). If you only care about the existence of a key and not the value (as you might when searching the NIS map hosts.byname for example), this flag prevents the map from substituting the value. However, The -a argument is still appended on a match, and the default is still taken if the match fails.
-kkeycol
The key column name (for NIS+) or number (for text lookups). For LDAP maps this is an LDAP filter string in which %s is replaced with the literal contents of the lookup key and %0 is replaced with the LDAP escaped contents of the lookup key according to RFC2254.
-vvalcol
The value column name (for NIS+) or number (for text lookups). For LDAP maps this is the name of one or more attributes to be returned; multiple attributes can be separated by commas. If not specified, all attributes found in the match will be returned.
-zdelim
The column delimiter (for text lookups). It can be a single character or one of the special strings \en or \et to indicate newline or tab respectively. If omitted entirely, the column separator is any sequence of white space. For LDAP maps this is the separator character to combine multiple values into a single return string. If not set, the LDAP lookup will only return the first match found.
-t
Normally, when a map attempts to do a lookup and the server fails (e.g., sendmail couldn't contact any name server; this is not the same as an entry not being found in the map), the message being processed is queued for future processing. The -t flag turns off this behavior, letting the temporary failure (server down) act as though it were a permanent failure (entry not found). It is particularly useful for DNS lookups, where someone else's misconfigured name server can cause problems on your machine. However, care must be taken to ensure that you don't bounce mail that would be resolved correctly if you tried again. A common strategy is to forward such mail to another, possibly better connected, mail server.
-D
Perform no lookup in deferred delivery mode. This flag is set by default for the host map.
"-Sspacesub
The character to use to replace space characters after a successful map lookup (esp. useful for regex and syslog maps).
"-sspacesub
For the dequote map only, the character to use to replace space characters after a successful dequote.
-q
Don't dequote the key before lookup.
"-Llevel
For the syslog map only, it specifies the level to use for the syslog call.
-A
When rebuilding an alias file, the -A flag causes duplicate entries in the text version to be merged. For example, two entries:
list: user1, user2
list: user3
would be treated as though it were the single entry
list: user1, user2, user3
in the presence of the -A flag.

Some additional flags are available for the host and dns maps:

-d
delay: specify the resolver's retransmission time interval (in seconds).
-r
retry: specify the number of times to retransmit a resolver query.

The following additional flags are present in the ldap map only:

-R
Do not auto chase referrals. sendmail must be compiled with -DLDAP_REFERRALS to use this flag.
-n
Retrieve attribute names only.
-Vsep
Retrieve both attributes name and value(s), separated by sep.
-rderef
Set the alias dereference option to one of never, always, search, or find.
-sscope
Set search scope to one of base, one (one level), or sub (subtree).
-hhost
LDAP server hostname. Some LDAP libraries allow you to specify multiple, space-separated hosts for redundancy. In addition, each of the hosts listed can be followed by a colon and a port number to override the default LDAP port.
-bbase
LDAP search base.
-pport
LDAP service port.
-ltimelimit
Time limit for LDAP queries.
-Zsizelimit
Size (number of matches) limit for LDAP queries.
-ddistinguished_name
The distinguished name to use to login to the LDAP server.
-Mmethod
The method to authenticate to the LDAP server. Should be one of LDAP_AUTH_NONE, LDAP_AUTH_SIMPLE, or LDAP_AUTH_KRBV4.
-Ppasswordfile
The file containing the secret key for the LDAP_AUTH_SIMPLE authentication method or the name of the Kerberos ticket file for LDAP_AUTH_KRBV4.
-1
Force LDAP searches to only succeed if a single match is found. If multiple values are found, the search is treated as if no match was found.

The dbm map appends the strings .pag and .dir to the given filename; the hash and btree maps append .db. For example, the map specification

Kuucp dbm -o -N /etc/mail/uucpmap
specifies an optional map named uucp of class dbm; it always has null bytes at the end of every string, and the data is located in /etc/mail/uucpmap.{dir,pag}.

The program makemap(8) can be used to build any of the three database-oriented maps. It takes the following flags:

-f
Do not fold upper to lower case in the map.
-N
Include null bytes in keys.
-o
Append to an existing (old) file.
-r
Allow replacement of existing keys; normally, re-inserting an existing key is an error.
-v
Print what is happening.

The sendmail daemon does not have to be restarted to read the new maps as long as you change them in place; file locking is used so that the maps won't be read while they are being updated.

New classes can be added in the routine setupmaps in file conf.c.

Q -- Queue Group Declaration

In addition to the option QueueDirectory, queue groups can be declared that define a (group of) queue directories under a common name. The syntax is as follows:

Q name {, field= value}+
where name is the symbolic name of the queue group under which it can be referenced in various places and the field=name pairs define attributes of the queue group. Fields are:

Flags
Flags for this queue group.
Nice
The nice(2) increment for the queue group.
Interval
The time between two queue runs.
Path
The queue directory of the group (required).
Runners
The number of parallel runners processing the queue.
Jobs
The maximum number of jobs (messages delivered) per queue run.
recipients
The maximum number of recipients per envelope. Envelopes with more than this number of recipients will be split into multiple envelopes in the same queue directory. The default value 0 means no limit.

Only the first character of the field name is checked.

By default, a queue group named mqueue is defined that uses the value of the QueueDirectory option as path. Notice: all paths that are used for queue groups must be subdirectories of QueueDirectory. Since they can be symbolic links, this isn't a real restriction, If QueueDirectory uses a wildcard, then the directory one level up is considered the ``base'' directory which all other queue directories must share. Please make sure that the queue directories do not overlap, e.g., do not specify

O QueueDirectory=/var/spool/mqueue/*
Qone, P=/var/spool/mqueue/dir1
Qtwo, P=/var/spool/mqueue/dir2
because this also includes dir1 and dir2 in the default queue group. However,
O QueueDirectory=/var/spool/mqueue/main*
Qone, P=/var/spool/mqueue/dir
Qtwo, P=/var/spool/mqueue/other*
is a valid queue group specification.

Options listed in the ``Flags'' field can be used to modify the behavior of a queue group. The ``f'' flag must be set if multiple queue runners are supposed to work on the entries in a queue group. Otherwise sendmail will work on the entries strictly sequentially.

The ``Interval'' field sets the time between queue runs. If no queue group specific interval is set, then the parameter of the -q option from the command line is used.

To control the overall number of concurrently active queue runners the option MaxQueueChildren can be set. This limits the number of processes used for running the queues to MaxQueueChildren, though at any one time fewer processes may be active as a result of queue options, completed queue runs, system load, etc.

The maximum number of queue runners for an individual queue group can be controlled via the Runners option. If set to 0, entries in the queue will not be processed, which is useful to ``quarantine'' queue files. The number of runners per queue group may also be set with the option MaxRunnersPerQueue, which applies to queue groups that have no individual limit. That is, the default value for Runners is MaxRunnersPerQueue if set, otherwise 1.

The field Jobs describes the maximum number of jobs (messages delivered) per queue run, which is the queue group specific value of MaxQueueRunSize.

Notice: queue groups should be declared after all queue related options have been set because queue groups take their defaults from those options. If an option is set after a queue group declaration, the values of options in the queue group are set to the defaults of sendmail unless explicitly set in the declaration.

Each envelope is assigned to a queue group based on the algorithm described in section ``Queue Groups and Queue Directories''.

X -- Mail Filter (Milter) Definitions

The sendmail Mail Filter API (Milter) is designed to allow third-party programs access to mail messages as they are being processed in order to filter meta-information and content. They are declared in the configuration file as:

X name {, field= value}*
where name is the name of the filter (used internally only) and the field=name pairs define attributes of the filter. Also see the documentation for the InputMailFilters option for more information.

Fields are:


Socket The socket specification
Flags Special flags for this filter
Timeouts Timeouts for this filter
Only the first character of the field name is checked (it's case-sensitive).

The socket specification is one of the following forms:

S= inet : port @ host
S= inet6 : port @ host
S= local : path
The first two describe an IPv4 or IPv6 socket listening on a certain port at a given host or IP address. The final form describes a named socket on the filesystem at the given path.

The following flags may be set in the filter description.

R
Reject connection if filter unavailable.
T
Temporary fail connection if filter unavailable.

The timeouts can be set using the four fields inside of the T= equate:

C
Timeout for connecting to a filter. If set to 0, the system's connect() timeout will be used.
S
Timeout for sending information from the MTA to a filter.
R
Timeout for reading reply from the filter.
E
Overall timeout between sending end-of-message to filter and waiting for the final acknowledgment.

Note the separator between each timeout field is a ';'. The default values (if not set) are: T=C:5m;S:10s;R:10s;E:5m where s is seconds and m is minutes.

Examples:

Xfilter1, S=local:/var/run/f1.sock, F=R
Xfilter2, S=inet6:999@localhost, F=T, T=S:1s;R:1s;E:5m
Xfilter3, S=inet:3333@localhost, T=C:2m

The User Database

The user database is deprecated in favor of ``virtusertable'' and ``genericstable'' as explained in the file cf/README. If you have a version of sendmail with the user database package compiled in, the handling of sender and recipient addresses is modified.

The location of this database is controlled with the UserDatabaseSpec option.

Structure of the user database

The database is a sorted (BTree-based) structure. User records are stored with the key:

user-name:field-name
The sorted database format ensures that user records are clustered together. Meta-information is always stored with a leading colon.

Field names define both the syntax and semantics of the value. Defined fields include:

maildrop
The delivery address for this user. There may be multiple values of this record. In particular, mailing lists will have one maildrop record for each user on the list.
mailname
The outgoing mailname for this user. For each outgoing name, there should be an appropriate maildrop record for that name to allow return mail. See also :default:mailname.
mailsender
Changes any mail sent to this address to have the indicated envelope sender. This is intended for mailing lists, and will normally be the name of an appropriate -request address. It is very similar to the owner- list syntax in the alias file.
fullname
The full name of the user.
office-address
The office address for this user.
office-phone
The office phone number for this user.
office-fax
The office FAX number for this user.
home-address
The home address for this user.
home-phone
The home phone number for this user.
home-fax
The home FAX number for this user.
project
A (short) description of the project this person is affiliated with. In the University this is often just the name of their graduate advisor.
plan
A pointer to a file from which plan information can be gathered.

As of this writing, only a few of these fields are actually being used by sendmail: maildrop and mailname. A finger program that uses the other fields is planned.

User database semantics

When the rewriting rules submit an address to the local mailer, the user name is passed through the alias file. If no alias is found (or if the alias points back to the same address), the name (with :maildrop appended) is then used as a key in the user database. If no match occurs (or if the maildrop points at the same address), forwarding is tried.

If the first token of the user name returned by ruleset 0 is an @ sign, the user database lookup is skipped. The intent is that the user database will act as a set of defaults for a cluster (in our case, the Computer Science Division); mail sent to a specific machine should ignore these defaults.

When mail is sent, the name of the sending user is looked up in the database. If that user has a mailname record, the value of that record is used as their outgoing name. For example, I might have a record:

eric:mailname Eric.Allman@CS.Berkeley.EDU
This would cause my outgoing mail to be sent as Eric.Allman.

If a maildrop is found for the user, but no corresponding mailname record exists, the record :default:mailname is consulted. If present, this is the name of a host to override the local host. For example, in our case we would set it to CS.Berkeley.EDU. The effect is that anyone known in the database gets their outgoing mail stamped as user@CS.Berkeley.EDU, but people not listed in the database use the local hostname.

"Creating

[25]"

The user database is built from a text file using the makemap utility (in the distribution in the makemap subdirectory). The text file is a series of lines corresponding to userdb records; each line has a key and a value separated by white space. The key is always in the format described above -- for example:

eric:maildrop
This file is normally installed in a system directory; for example, it might be called /etc/mail/userdb. To make the database version of the map, run the program:
makemap btree /etc/mail/userdb < /etc/mail/userdb
Then create a config file that uses this. For example, using the V8 M4 configuration, include the following line in your .mc file:
define(`confUSERDB_SPEC', /etc/mail/userdb.db)


[Contents] [Previous] [Next]
This document was translated by troff2html v0.21 on October 10, 2001.


Claus Aßmann Please send comments to: <ca at sendmail.org>