Mail Administration Guide

sendmail Functions

The sendmail program is a message router that calls administrator-defined mailer programs to deliver messages. It collects a message from a program, like 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. You can add new mailers at minimum cost.

sendmail Interfaces

The sendmail program communicates with the outside world in three ways:

Argument Vector/Exit Status

The standard way to communicate with a process is by 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 is printed by the mailer 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

You can use the SMTP protocol to run an interactive lock-step interface with the mailer. A subprocess is still created, but no recipient names are passed to the mailer through the argument list. Instead, they are passed one at a time in commands sent to the processes' standard input. 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.