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. On the future project list is a configuration-file compiler.

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. Expansions of the form $& x are performed at run time using a somewhat less general algorithm. This for 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[14]. For example, $[ftp$] might become ftp.CS.Berkeley.EDU and $[[128.32.130.2]$] would become vangogh.CS.Berkeley.EDU. Sendmail recognizes it's numeric IP address without calling the name server and replaces it with it's 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 can only be used at the beginning of the right hand side; it can be only be preceded by $@ or $:.

The $# syntax should only be used in ruleset zero or a subroutine of ruleset zero. It causes evaluation of the ruleset to terminate immediately, and signals to sendmail that the address has completely resolved. The complete syntax 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[15]. The mailer must be a single word, but the host and user may be multi-part. If the mailer is the builtin 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 five rewriting sets that have specific semantics. Four 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, user} 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.

check_relay

The check_relay ruleset is called after a connection is accepted. 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_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.

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; this looks the name up in DNS to find alternate delivery sites.

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

[128.32.149.78]
This causes direct conversion of the numeric value to a TCP/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}. 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 text2 otherwise. The else ( $|) clause may be omitted.

Lower case macro names are reserved to have special semantics, used to pass information in or out of sendmail, and special characters are reserved to provide conditionals, etc. Upper case names (that is, $A through $Z) are specifically reserved for configuration file authors.

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[16], 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., HAA12345.
$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.
${bodytype}
The message body type (7BIT or 8BITMIME), as determined from the envelope.
${client_addr}
The IP address of the SMTP client. Defined in the SMTP server only.
${client_name}
The host name of the SMTP client. Defined in the SMTP server only.
${client_port}
The port number of the SMTP client. Defined in the SMTP server only.
${envid}
The envelope id passed to sendmail as part of the envelope.
${opMode}
The current operation mode (from the -b flag).

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.[17] 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[18].

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 do 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
The first form defines the class c to match any of the named words. It is permissible to split them among multiple lines; for example, the two forms:
CHmonet ucbmonet
and
CHmonet
CHucbmonet
are equivalent. The ``F'' form reads the elements of the class c from the named file.

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.

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
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
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 The MTS type information (used for error messages)
Only the first character of the field name is checked.

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 1651, 1652, and 1653). 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.
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.
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 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 option is not required (i.e., if this option is omitted the transmission will still operate successfully, although perhaps not as efficiently as possible).
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.
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 behaviour 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.
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 user id to always be set to that user and group (instead of leaving it as root).
u
Upper case should be preserved in user names for this mailer.
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. 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.
0
Don't look up MX records for hosts sent via SMTP.
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.
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.

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 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=lsD, A=sh -c $u
M*file*, P=/dev/null, F=lsDFMPEu, A=FILE
M*include*, P=/dev/null, F=su, A=INCLUDE

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.

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 home 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 is the user and group to run as in all circumstances. 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.

H -- Define Header

The format of the header lines that sendmail inserts into the message are defined by