Previous Table of Contents Next


CHAPTER 4
Customizing sendmail Configuration Files

Overview of sendmail Functions
How sendmail Is Implemented
Introducing Arguments to sendmail
Tuning Configuration Parameters
The Configuration File
Command-Line Arguments
Configuration Options
Mailer Flags

THE SENDMAIL PROGRAM IS A MAIL-TRANSPORT AGENT AND MESSAGE ROUTER THAT USES A configuration file to provide aliasing and forwarding, automatic routing to network gateways, and flexible configuration. The Solaris environment supplies the standard configuration files that most sites can use. Chapter 3, "Setting Up and Administering Mail Services," explains how to set up an electronic mail system using the standard configuration files. This chapter explains how to customize sendmail configuration files if you need to tailor them to fit your site's needs.

Sections in this chapter describe the following subjects:

  Command-line arguments to sendmail.
  sendmail parameters that you can alter.
  In-depth information on the configuration file. This section provides information for those sites that need to write their own configuration file.
  Brief explanations of several lesser-used features of sendmail.

The sendmail program can accept domain-based naming, as well as arbitrary (older) name syntaxes — resolving ambiguities using heuristics that you specify. The sendmail program can also convert messages between a pair of disparate naming schemes.

Certain special cases can be handled by ad hoc techniques, such as when providing network names that appear local to hosts on other networks. For example, user@host is left-to-right syntax, and host!user is right-to-left syntax.

Overview of sendmail Functions

The sendmail program is a message router that calls administrator-selected mailer programs to deliver messages. It collects a message from a program such as mail, edits the header of the message as required by the destination mailer, and calls appropriate mailers to do delivery or queueing for network transmission. When mailing to a file, however, sendmail delivers directly. New mailers, which increase heterogeneity and convenience, can be added at minimal cost.

Interfaces to the Outside World

The sendmail program can communicate with the outside world in three ways:

  Using the conventional argument vector/exit status
  Using pairs of pipes
  Using SMTP over a TCP connection

Argument Vector/Exit Status

The standard way to communicate with a process is using the argument vector (command name and arguments). The argument vector sends a list of recipients, and the message body is sent on the standard input. If problems occur, anything that the mailer prints is collected and returned to the sender. After the message is sent, the exit status from the mailer is collected, and a diagnostic is printed, if appropriate.

SMTP over Pipes

The SMTP protocol can be used to run an interactive lock-step interface with the mailer. A subprocess is still created, but no recipient names are passed to the mailer from the argument list. Instead, the names are passed one at a time in commands sent to the standard input of the processes. Anything appearing on the standard output must be a standard SMTP reply code.

SMTP over a TCP Connection

This technique is similar to SMTP over pipes, except that it uses a TCP connection. SMTP over a TCP connection is normally used to connect to a sendmail process on another system. This method is exceptionally flexible because the mailer need not reside on the same machine.

How the sendmail Program Works

The following sections describe in detail how the sendmail program works. When a sender wants to send a message, the program issues a request to sendmail using one of the three methods previously described. The sendmail program then goes through these steps, which are described in detail in the following sections:

1.  Arguments are processed and then the address is parsed.
2.  The message is collected.
3.  The message is delivered.
4.  If instructions are received from the mailer, the message is queued for retransmission.
5.  If errors occur during processing, the message is returned to the sender.

Argument Processing and Address Parsing

If sendmail is called by using the argument vector or is connected to via a pipe, the arguments are first scanned and option specifications are processed. Recipient names are then collected, either from the command line or from the SMTP command, and a list of recipients is created. Aliases are expanded at this step, including mailing lists. As much validation as possible of the remote recipient is done at this step: Syntax is checked and local recipients are verified, but detailed checking of host names is deferred until delivery. Forwarding is also performed as the local recipients are verified.

The sendmail program appends each name to the recipient list after parsing. When a name is aliased or forwarded, the old name is retained in the list and then a flag is set that tells the delivery phase to ignore this recipient. This list is kept free from duplicates, thus preventing alias loops and duplicate messages from being delivered to the same recipient, as might occur when a person is in two groups.


NOTE:  Users may receive duplicate copies of the same message when alias lists contain email addresses for the same person using different syntaxes. The sendmail program cannot always identify the email addresses as duplicates of one another.

Message Collection

The sendmail program then collects the message, which has a header at the beginning. The message body does not need to be formatted in any special way except that it must be composed of lines of text. (In other words, binary data is not allowed.) The header is stored in memory, and then the body of the message is saved in a temporary file.

To simplify the program interface, the message is collected even if no names were valid. The message subsequently is returned with an error.


Previous Table of Contents Next