Previous Table of Contents Next

Mail services are provided by a combination of these programs that interact, as shown by the simplified diagram in Figure 1-6.

Figure 1-6  How mail programs interact.

Users send messages using programs such as /bin/mailx or mailtool. See the manual pages for information about these programs.

The message is collected by the program that was used to generate it and is passed to the sendmail daemon. The sendmail daemon parses (divides into identifiable segments) the addresses in the message, using information from the configuration file /etc/mail/ to determine network name syntax, aliasing, forwarding information, and network topology. Using this information, sendmail determines the route a message must take to get to a recipient.

The sendmail daemon passes the message to the appropriate system. The /bin/mail program on the local system delivers the mail to the mailbox in the /var/mail/username directory of the recipient of the message.

The user is notified that mail has arrived and retrieves it using /bin/mail, /bin/mailx, mailtool, dtmail, or a similar program.

The sendmail Program

SunOS 5.x system software uses sendmail as a mail router. The sendmail program is responsible for receiving and delivering electronic mail messages. It is an interface between mail-reading programs such as mail, mailx, mailtool, dtmail, and mail-transport programs such as uucp. The sendmail program performs the following functions:

  Controls email messages that users send
  Understands the recipients' addresses
  Chooses an appropriate delivery program
  Rewrites the addresses in a format that the delivery agent understands
  Reformats the mail headers as required
  Passes the transformed message to the delivery agent for delivery

Figure 1-7 shows how sendmail uses aliases. Programs that read mail, such as /usr/bin/mailx, can have aliases of their own, which are expanded before the message reaches sendmail.

Figure 1-7  How sendmail uses aliases.

As system administrator, you should choose a policy for updating aliases and forwarding mail messages. You might set up an aliases mailbox as a place for users to send requests for mail forwarding and changes to their default mail alias. If your system uses NIS or NIS+, you can administer forwarding rather than forcing users to manage it themselves. A common mistake users make is to put a .forward file in the home directory of Host A that forwards mail to user@host-b. When the mail gets to Host B, sendmail looks up the user in the NIS or NIS+ aliases and sends the message back to user@host-a, resulting in a loop and more bounced mail.

The sendmail Configuration File (

A configuration file controls the way that sendmail performs its functions. The configuration file determines the choice of delivery agents, address-rewriting rules, and the format of the mail header.

The sendmail program uses the information from the /etc/mail/ file to perform its functions. Each system has a default file installed in the /etc/mail directory. You do not need to edit or change the default configuration file for mail servers or mail clients. The only systems that require a customized configuration file are the mailhost, a relay host, or a gateway. See "Mail Services Terminology" earlier in this chapter or the glossary at the back of this book for descriptions of each of these types of systems.

SunOS 5.x system software provides two default configuration files, which are also in the /etc/mail directory:

  A configuration file named for the system (or systems) you designate as the mailhost, a relay host, or a gateway
  A configuration file named (a duplicate copy of the default file)

Which configuration file you use on any individual system depends on the role the system plays in your mail service.

  For mail clients or mail servers, you do not need to do anything to set up or edit the default configuration file.
  To set up a mailhost, a relay host, or a gateway, copy the file and rename it (in the /etc/mail directory). Then edit the file to set parameters needed for your mail configuration: relay mailer and relay host. For more information about editing the file, refer to Chapter 4.

The following list describes some configuration parameters you may want to change, depending on the requirements of your site:

  Time values.
  Specify how often sendmail runs the queue. The interval is typically set to between 15 minutes and 1 hour.
  Specify read timeouts.
  Specify how long a message remains in the queue before it is returned to the sender.
  Delivery modes specify how quickly mail will be delivered.
  Load limiting prevents wasted time during loaded periods because it does not attempt to deliver large messages, messages to many recipients, or messages to sites that have been down for a long time.
  Log level specifies what kinds of problems are logged.
  File modes.
  setuid for sendmail
  Temporary file modes
  /etc/mail/aliases permissions

Refer to Chapter 3 for information on setting up the files. Refer to Chapter 4 for a detailed description of each of these parameters.

Previous Table of Contents Next