Previous Table of Contents Next


Header Declarations

Header declarations inform sendmail of the format of known header lines. Knowledge of a few header lines is built into sendmail, such as the From: and Date: lines.

Most configured headers are automatically inserted in the outgoing message if they don't exist in the incoming message. Certain headers are suppressed by some mailers.

Mailer Declarations

Mailer declarations specify the internal name of the mailer, some flags associated with the mailer, and an argument vector used on the call. This vector is expanded by a macro before use.

Name-Rewriting Rules

Name-rewriting rules are the heart of name parsing in sendmail. They are an ordered list of pattern-replacement rules, which are then applied to each name. In particular, ruleset 0 determines which mailer to use. The name is rewritten until it is either rewritten into a special canonical form — for example, a {mailer, host, user} triplet, such as {ddn, isi.edu, postel}, representing the name "postel@isi.edu" — or until it falls off the end. When a pattern matches, the rule is reapplied until it fails.

The configuration file also supports the editing of names into different formats. For example, a name of the form

ucsfcgl!tef

might be mapped into

tef@ucsfcgl.UUCP

to conform to the internal syntax. Translations can also be performed in the other direction for particular mailers.

Option Setting

Several options can be set from the configuration file. These options include the pathnames of various support files, timeouts, default modes, and so on.

Introducing Arguments to sendmail

The complete list of arguments to sendmail is described in detail in the sections "Command-Line Arguments" and "Configuration Options" later in the chapter. Arguments used to set the queue interval, daemon mode, and debugging flags, as well as for using an alternative configuration file, are described in the following sections.

Queue Interval

The -q flag defines how often sendmail runs the queue. If you run in mode b (the default) or i, you can set a relatively long time interval, because it is only used when a host that was down comes back up. If, however, you run in mode q, set a relatively short time, because the q flag defines the maximum amount of time that a message may sit in the queue. Typically, queue time is set between 15 minutes (-q15m) and one hour (-q1h).

Daemon Mode

If you allow incoming mail over a TCP connection, make sure a daemon is running. Set the -bd flag in your /etc/rc3.d/S88sendmail file.

You can combine the -bd flag and the -q flag in one call. In this example, the daemon is specified along with a queue interval of 30 minutes:

# /usr/lib/sendmail -bd -q30m

An Alternative Configuration File

You can specify an alternative configuration file by using the -C flag. For example,

# /usr/lib/sendmail -Ctest.cf

uses the configuration file test.cf instead of the default /etc/mail/sendmail.cf. If you do not define a value for the -C flag, it uses the sendmail.cf file in the current directory.

Tuning Configuration Parameters

You can tune several configuration parameters, depending on the requirements of your site. Most of these parameters are set using an option in the configuration file. For example, the line OT3d sets option T to the value 3d (three days).

Time Values

All time intervals use a syntax of numbers and letters. For example, 10m is 10 minutes, and 2h30m is two and a half hours. The full set of time symbols is shown in Table 4-1.

>
Table 4-1 Time Syntax Options

Code Description
s seconds
m minutes
h hours
d days
w weeks

Queue Interval

The argument to the -q flag specifies how often sendmail runs the queue. It is usually set between 15 minutes (-q15m) and one hour (-q1h).

Read Timeouts

The Or option in the configuration file sets the read timeout. The default read timeout is Or15m. The sendmail program may time out when reading the standard input or when reading from a remote SMTP server. If your site has problems with read timeouts, set the read timeout to a larger value, such as one hour (Or1h), to reduce the chance of several idle daemons accumulating on your system.

Message Timeouts

The OT option in the configuration file sets the message timeout. The default message timeout is three days (OT3d). To inform the sender that a message cannot be delivered, it should be returned after sitting in the queue for a few days.

You can flush messages that have been hanging for a short period by running the queue with a short message timeout. For example,

#/usr/lib/sendmail -oT1d -q

runs the queue and flushes anything that is one day old or older.

Delivery Mode

The Od option in the configuration file sets the delivery mode. The default delivery mode is Odbackground. Delivery modes, shown in Table 4-2, specify how quickly mail is delivered.

Table 4-2 Delivery Mode Options

Code Description
i Deliver interactively (synchronously)
b Deliver in background (asynchronously)
q Queue only (do not deliver)

There are trade-offs. Mode i passes the maximum amount of information to the sender, but is hardly ever necessary. Mode q puts the minimum load on your machine, but means that delivery may be delayed for up to the queue interval. Mode b, the default, is probably a good compromise.


Previous Table of Contents Next