Previous Table of Contents Next


Semantics of Mailer Descriptions

Each mailer has an internal name. It can be arbitrary, except that the names local and prog must be defined first and second, respectively. Ruleset 0 resolves names to this mailer name (and a host and a username).

Give the pathname of the mailer in the P field. If this mailer will be accessed via a TCP connection, use the string [TCP] instead.

Define the mailer flags in the F field. Specify an f or an r flag to pass the name of the sender as -f or -r flags, respectively. These flags are passed only if they were passed to sendmail, so that mailers that give errors under some circumstances can be placated. If the mailer is not picky, you can just specify -f$g in the argv template. If the mailer must be called as root and if sendmail is running setuid to root, use the S flag; it will not reset the user ID before calling the mailer. If this mailer is local (that is, will perform final delivery rather than another network hop), use the flag. Quote characters (backslashes and double quotes) can be stripped from names if the s flag is specified; if it is not specified, they are passed through. If the mailer is capable of sending to more than one user on the same host in a single transaction, the m flag should be used. If this flag is on, the argv template containing $u is repeated for each unique user on a given host. The e flag marks the mailer as being "expensive," and then sendmail defers connection until a queue run. Note that the c configuration option must also be set.

The C flag is an unusual case. It applies to the mailer that the message is received from, rather than the mailer being sent to. If this flag is set, the domain specification of the sender (that is, the @host.domain part) is saved and is appended to any names in the message that do not already contain a domain specification. For example, a message of the form

From: eric@ucbarpa
To: wnj@monet, mckusick

is modified to

From: eric@ucbarpa
To: wnj@monet, mckusick@ucbarpa

if and only if the C flag is defined in the mailer corresponding to eric@ucbarpa.

The S and R fields in the mailer description are rewriting sets specific to a mailer and must be applied to sender and recipient names, respectively. These are applied after the sending domain is appended and the general rewriting set (ruleset 1 or 2) is applied, but before the output rewrite (ruleset 4) is applied. A typical use is to append the current domain to names that do not already have a domain. For example, a header of the form

From: eric@host

might be changed to be

From: eric@host.Podunk.EDU

or

From: ucbvax!eric

depending on the domain it is being shipped to. These sets can also be used to perform special-purpose output rewriting in cooperation with ruleset 4. The E field defines the string to use as an end-of-line indication.

A string containing return and newline is the default if you are using TCP; otherwise a newline indicates end of line. You can use the printf backslash escapes (\r, \n, \f, \b).

Use the A field to specify an argument vector template. It may have embedded spaces. The template is expanded by a macro before being passed to the mailer. Useful macros include $h (the host name resolved by ruleset 0) and $u (the username or names resolved). If there is no argument with a $u macro in it, sendmail uses SMTP to communicate with the mailer. If the pathname for this mailer is [TCP], use the argument vector

TCP $h [ port ]

in which port is the optional port number to connect to.

If an L field exists, it specifies the maximum length of the $u macro passed to the mailer. To make UUCP mail more efficient, the L field can be used with the m flag to send multiple recipients with one call to the mailer, while avoiding mailer limitations on argument length. Even if that recipient exceeds the L= limit, $u always expands to at least one recipient.

For example, the specification

Mlocal, P=/bin/mail, F=flsSDFMmnP, S=10, R=20, A=mail -d $u
Mether,  P=[TCP],   F=msDFMuCX,  S=11, R=21, A=TCP $h

names a mailer to do local delivery and a mailer for ethernet delivery. The first mailer is called local and is located in the file /bin/mail. It takes the -f flag, performs local delivery, strips quotes from names, and delivers multiple users at once. It applies ruleset 10 to sender names in the message and applies ruleset 20 to recipient names. The argument vector to send to a message is the word mail, the letter -d, and words containing the name of the receiving user. If the -r or -f flag is inserted, it is between mail and -d.

The second mailer is called ether. It is connected via TCP and can handle multiple users at once. It defers connections and appends any domain from the sender name to any receiver name without a domain. Sender names are processed by ruleset 11 and recipient names by ruleset 21. Messages passed through this mailer have a 100,000-byte limit.

Building a New Configuration File

Building a configuration file from scratch is a complex task. Fortunately, you can accommodate almost every situation by changing an existing file. In any case, it is critical that you understand what it is that you are trying to do and come up with a policy statement for the delivery of mail. The following sections explain the purpose of a configuration file and provide some ideas for what your policy might be.

Domains and Policies

RFC 1006 describes domain-based naming. RFC 822 touches on this issue as well. Essentially, each host is given a name that is a right-to-left dot-qualified pseudopath from a distinguished root. The elements of the path are organizational entities, not physical networks.

RFC 822 and 976 specify how certain sorts of addresses are parsed. You can configure sendmail to either follow or ignore these rules.


Previous Table of Contents Next