Previous Table of Contents Next


Table 1-10 shows the contents of the /etc/mail directory.

Table 1-10 Contents of the /etc/mail Directory

Name Type Description
mail.rc File Default settings for the mailtool user agent
aliases File Mail-forwarding information
aliases.dir File Binary form of mail-forwarding information (created by running newaliases)
aliases.pag File Binary form of mail-forwarding information (created by running newaliases)
mailx.rc File Default settings for the mailx user agent
main.cf File Sample configuration file for main systems
sendmail.cf File Configuration file for mail routing
sendmail.hf File Help file used by the SMTP HELP command
sendmail.pid File File containing the /usr/lib/sendmail -b -q1h command
sendmail.st File The sendmail statistics file (If this file is present, sendmail logs the amount of traffic through each mailer.)
sendmailvars File Table that stores macro and class definitions for lookup from sendmail.cf
sendmailvars.org_dir Table NIS+ version of sendmailvars table
subsidiary.cf*File Sample configuration file for subsidiary systems


*Revised in this edition. Note that the subsidiary.cf file used to be named sendmail.subsidiary.cf.

Table 1-11 shows the contents of the /usr/lib directory.

Table 1-11 Contents of the /usr/lib Directory

Name Type Description
newaliases*File Command that creates the binary form of the aliases file
sendmail File The routing program, also known as the mail transport agent


*The newaliases command used to be located in the /etc/mail directory.

Spooling directories for delivered mail are located in the /var/mail directory, as shown in Table 1-12. Mail that has not been delivered is stored in the /var/spool/mqueue directory.

Table 1-12 Contents of the /var/mail Directory

Name Type Description
mailbox1 File Mailboxes for delivered mail
mailbox2 File Mailboxes for delivered mail
mailbox3 File Mailboxes for delivered mail

How the Mail Service Works

Figure 1-8 shows how sendmail interacts with the other programs in the mail system. The user interacts with a mail-generating and mail-sending program known as a user agent. When the mail is submitted, the user agent calls sendmail, which routes the message to the correct mailer(s).


Figure 1-8  How the mail service works.

How sendmail Works

The sendmail program receives a message from a program such as mailx, mailtool, or dtmail, edits the message header as required by the destination mailer, and calls appropriate mailers to do delivery or queuing for network transmission.


NOTE:  The sendmail program never edits or changes the body of a message. Any changes that it makes to interpret email addresses are made only in the header of the message.

Argument Processing and Address Parsing

When sendmail processes a message, it collects recipient names (either from the command line or from the SMTP protocol) and generates two files. One is an envelope that contains a list of recipients and information about delivery. The other file contains the header and the body of the message. The sendmail program expands aliases, including mailing lists, and validates as much as possible the remote recipient; sendmail checks syntax and verifies local recipients. Detailed checking of host names is deferred until delivery. As local recipients are verified, messages are forwarded to them.

After parsing the recipient lists, sendmail appends each name to both the envelope and the header of the message. When a name is aliased or forwarded, it retains the old name in the list and sets a flag to tell the delivery phase to ignore this recipient. The lists are kept free from duplicates, preventing "alias loops" and duplicate messages delivered to the same recipient, which can occur if a recipient is in two different alias groups.


NOTE:  Users may receive duplicate copies of the same message when alias lists contain email addresses for the same person (who is using different syntax). The sendmail program cannot always match the duplicate email addresses.

Message Collection

The sendmail program then collects the message. The message has a header at the beginning. The header and the body of the message must be separated by a blank line. The only formatting requirement imposed on the message body is that its lines of text must be no greater than 1,024 bytes. The sendmail program stores the header in memory and stores the body of the message in a temporary file. To simplify the program interface, the message is collected even if no names are valid--in which case the message is returned with an error.


NOTE:  Until now, sendmail could not transmit binary data as part of mail messages. With the advent of multimedia mailtool, users can now transmit binary data. It must, however, be encoded by a user agent. Sendmail does not do any automatic encoding of binary data. Refer to the documentation for Mail Tool or dtmail for information on how to encode and decode electronic mail messages.


Previous Table of Contents Next