Mail Administration Guide

Mail Service Programs and Files

Mail services include many programs and daemons that interact with each other. This section introduces the programs and the terms and concepts related to administering electronic mail. Table 1-3 shows the contents of the /usr/bin directory that are used for mail services.

Table 1-3 Contents of the /usr/bin Directory Used for Mail Services

Name 

Type 

Description 

mail

File 

A user agent 

mailcompat

File 

A filter to store mail in SunOS 4.1 mailbox format 

mailq

Link 

Link to /usr/lib/sendmail; used to list the mail queue

mailstats

File 

A program used to read mail statistics stored in the /etc/mail/sendmail.st file (if present)

mailx

File 

A user agent 

aliasadm

File 

A program to manipulate the NIS+ aliases map 

mconnect

File 

A program that connects to the mailer for address verification and debugging 

newaliases

Link 

Link to /usr/lib/sendmail; used to create the binary form of the aliases file

rmail

Link 

Link to /usr/bin/mail; command often used to permit only the sending of mail

vacation

File 

A command to set up an automatic reply to mail 

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

Table 1-4 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.cw

File 

Optional file that you can be create if the number of aliases for the mail host is too long 

sendmail.hf

File 

Help file used by the SMTP HELP command

sendmail.pid

File 

File that lists the PID of the listening daemon 

sendmail.st

File 

The sendmail statistics file; if this file is present, sendmail logs the amount of traffic through each mailer

subsidiary.cf

File 

Sample configuration file for subsidiary systems

Table 1-5 shows the contents of the /usr/lib directory that are used for mail services.

Table 1-5 Contents of the /usr/lib Directory Used for Mail Services

Name 

Type 

Description 

mail.local

File 

Mailer that delivers mail to mailboxes 

sendmail

File 

The routing program, also known as the mail transport agent 

Several other files and directories are used by the mail services, as shown in Table 1-6.

Table 1-6 Other Files Used for Mail Services

Name 

Type 

Description 

/var/spool/mqueue

Directory 

Where undelivered mail is stored 

/var/mail/mailbox1, /var/mail/mailbox2

File 

Mailboxes for delivered mail 

/etc/sendmailvars

File 

Stores macro and class definitions for lookup from sendmail.cf

sendmailvars.org_dir

Table 

NIS+ version of sendmailvars file

/usr/sbin/in.comsat

File 

Mail-notification daemon 

/usr/sbin/syslogd

File 

Error message logger, used by sendmail

$OPENWINHOME/bin/mailtool

File 

Window-based interface to sendmail

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

Figure 1-3 How Mail Programs Interact

Graphic

Users send messages by using programs like mailx or mailtool. See the mailx(1) or mailtool(1) man 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 the addresses (divides them into identifiable segments) in the message, using information from the configuration file, /etc/mail/sendmail.cf, to determine network name syntax, aliases, 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 /usr/lib/mail.local program on the local system delivers the mail to the mailbox in the /var/mail/username directory of the recipient of the message.

The recipient is notified that mail has arrived, and retrieves it using mail, mailx, mailtool, or a similar program.

sendmail Program

The SunOS 5.x operating system uses the sendmail program as a mail router. sendmail is responsible for receiving and delivering electronic mail messages. It is an interface between mail-reading programs like mail, mailx, and mailtool, and mail-transport programs like uucp. The sendmail program controls email messages that users send, evaluates the recipients' addresses, chooses an appropriate delivery program, rewrites the addresses in a format that the delivery agent can handle, reformats the mail headers as required, and finally passes the transformed message to the mail program for delivery.


Note -

SunOS 2.4 and earlier releases included a binary called sendmail.mx. This program is now included in the sendmail program and the functionality is turned on by adding the dns flag to the hosts entry in /etc/nsswitch.conf. For more information, see "Setting Up DNS Aliases Files".


Figure 1-4 shows how sendmail uses aliases. Programs that read mail, like /usr/bin/mailx, can have aliases of their own, which are expanded before the message reaches sendmail. The aliases for sendmail can come from a number of name space sources (local files, NIS or NIS+). The order of the lookup is determined by the nsswitch.conf file. See the nsswitch.conf(4) man page.

Figure 1-4 How sendmail Uses Aliases

Graphic

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. "sendmail Configuration File" presents a complete description of the file.

The sendmail program uses the information from the /etc/mail/sendmail.cf file to perform its functions. Each system has a default sendmail.cf 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 mail hosts and mail gateways.

The SunOS 5.x system provides two default configuration files in the /etc/mail directory:

  1. A configuration file named main.cf for the system (or systems) you designate as the mail host or a mail gateway

  2. A configuration file named subsidiary.cf (a duplicate copy of the default sendmail.cf file)

The configuration file you use on a system depends on the role the system plays in your mail service.

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

sendmail Configuration Table

In response to two entries in the sendmail.cf file, the sendmail program can define macros and classes by looking up values in the sendmailvars configuration table. There are two such commands:

  1. Lines that begin with the L key letter are macro definitions, where the values assigned to the specified variable are obtained from the configuration table.

  2. Lines that begin with the G key letter are class definitions, where the values assigned to the specified variable are obtained from the configuration table.

The L command has the following syntax:

LXsearch_key

For example: Lmmaildomain

In this case, the search key maildomain looks up a value in the configuration table to assign to the variable m. Most often the single-letter variable name is uppercase, but for internal variables (like m for the mail domain name) it is lowercase.

The G command has the following syntax:

GCsearch_key

For example: GVuucp-list

In this case, the search key uucp-list looks up a value in the configuration table to assign to the variable V.

In both cases, matching of the search key is case sensitive.

Both commands have counterparts for defining macros or classes within the sendmail.cf file, rather than the lookup table. D is the counterpart of L; C is the counterpart of G.

If you use NIS+ to administer the network, you can maintain a global version of the sendmailvars information. In addition to the NIS+ table or as an alternative, you can maintain the data in /etc/mail/sendmailvars. The order in which these sources are searched by sendmail is controlled by the sendmailvars entry in the /etc/nsswitch.conf file. By default, the search order is files nisplus, which means sendmail attempts to look up information in the local file before going to the NIS+ table.

Entries in an /etc/mail/sendmailvars file have the following format:

search_key [value1 value2 value3...]

You might follow the search key by a tab or several spaces; seperate values are with a single space.

The NIS+ sendmailvars table has two columns: a key column and a value column. The value column can have one or more values, each separated by a space. For example:

Key Column 

Value Column 

maildomain

eng.acme.com

uucp-list

acmemoon hugo comic

Most mail variables should be defined in the NIS+ table. However, in special cases, systems can override the global setting for a variable by including it in their local /etc/mail/sendmailvars file.

.forward Files

Users can create a .forward file in their home directories that sendmail uses to temporarily redirect mail or send mail to a custom set of programs without consulting a system administrator. When troubleshooting mail problems, particularly problems with mail not being delivered to the expected address, always check the user's home directory for a .forward file.

A common mistake users make is to put a .forward file in the home directory of host1 that forwards mail to user@host2. When the mail gets to host2, sendmail looks up user in the NIS or NIS+ aliases and sends the message back to user@host1, resulting in a loop, and more bounced mail.