Mail Administration Guide

Mail Services Terminology

In addition to the mail files and programs, there are many other components required to establish a mail service. The following sections define these components and some of the terminology used to describe them.

The first section defines the terminology used when discussing the software parts of the mail delivery system. The next section focuses on the functions of the hardware systems in a mail configuration.

Mail Services Software Terminology

This section describes the software components of a mail system. Each service includes at least one of each of the following: a mail user agent, a mail transport agent, and a mail delivery agent. Other software components include domain names, mail addresses, mailboxes, and mail aliases.

Mail User Agent

The mail user agent is the program that acts as the interface between the user and mail transport agent, such as the sendmail program. The mail user agents supplied with the Solaris operating system are /usr/bin/mail, /usr/bin/mailx, $OPENWINHOME/bin/mailtool, and /usr/dt/bin/dtmail.

Mail Transport Agent

The mail transport agent is responsible for the routing of mail messages and resolution of mail addresses. This is also know as a mail transfer agent. The transport agent for the Solaris software is sendmail. The transport agent performs these functions:

Mail Delivery Agent

A mail delivery agent is a program that implements a mail delivery protocol. The following mail delivery agents are provided with the Solaris operating environment.

Mailers

A mailer is a sendmail specific term. You can customize amail delivery agent. A mailer is used by sendmail to identify a specific instance of a customized mail delivery agent or a mail transport agent.

You need to specify at least one mailer in the sendmail.cf file of all systems in your network.

The ether mailer uses the SMTP protocol to transport a message. SMTP is the standard mail protocol used on the Internet. This is an example of an SMTP mail header:


To: paul@phoenix.stateu.edu
From: Iggy.Ignatz@eng.acme.com

If mail is sent between two users in the same domain, the header looks like this:


To: Irving.Who@eng.acme.com
From: Iggy.Ignatz@eng.acme.com

Use SMTP for sending mail outside your domain, especially for mailboxes that you must reach through the Internet.

The smartuucp mailer uses uux to deliver messages, but it formats headers with a domain-style address, and the To: and Cc: lines are formatted by domain, much like the SMTP headers. The smartuucp headers look like this:


To: paul@phoenix.stateu.com
From: ignatz@eng.acme.com

Use smartuucp for UUCP mail to systems that can handle and resolve domain-style names. The sender also must be able to handle domain-style names and be able to receive replies from the Internet.

The uucp mailer uses an exclamation point address in the headers. This is one of the original mailers. The headers look like this:


To: edu!stateu!phoenix!paul
From: acme!ignatz

You can define other mail delivery agents by providing a mailer specification in the sendmail.cf file.

Domain Names

A domain is a directory structure for network address naming. Electronic-mail addressing also uses domains. An email address has this format:


user@subdomain. ... .subdomain2.subdomain1.top-level-domain

The part of the address to the left of the @ sign is the local address. The local address may contain information about:

The receiving mailer is responsible for determining what the local part of the address means.

The part of the address to the right of the @ sign shows the domain address where the local address is located. A dot separates each part of the domain address. The domain can be an organization, a physical area, or a geographic region. In older forms the domain can show one or several computer systems.

Domain addresses are case insensitive. It makes no difference whether you use uppercase, lowercase, or mixed-case letters in the domain part of an address.

The order of domain information is hierarchical--the more local the address, the closer it is to the @ sign.

The larger the number of subdomains, the more detailed the information that is provided about the destination. Just as a subdirectory in a file-system hierarchy is considered to be inside the directory above, each subdomain in the mail address is considered to be inside the location to its right.

Table 1-1 shows the top-level domains.

Table 1-1 Top-level Domains

Domain 

Description 

Com

Commercial sites 

Edu

Educational sites 

Gov

United States government installations 

Mil

United States military installations 

Net

Networking organizations 

Org

Nonprofit organizations 

!%@:: A Directory of Electronic Mail Addressing and Networks by Donnalyn Frey and Rick Adams (O'Reilly & Associates, Inc., 1993) contains a complete list of international top-level domain addresses; it is updated periodically.

For mail delivery, the network or name space domain name and the mail domain name sometimes do not match. The DNS domain name and the mail domain name must be identical. By default, the sendmail program strips the first component from the network domain name to form the mail domain name. For example, if a NIS+ domain name were bldg5.eng.acme.com, its mail domain name would be eng.acme.com.


Note -

Although mail domain addresses are case insensitive, the name space domain name is not. For best results use lowercase characters when setting up the mail and name space domain names.


This default rule for determining the mail domain name restricts the number of components you can have in the network domain name. Fortunately, you can define the mail domain name in the sendmail.cf file. You can set the m variable (for mail domain name) using either a D macro definition or an L macro definition. The former is a simple assignment, while the latter uses a lookup table (sendmailvars) maintained by the name service. The advantage of the lookup table is that you can change the mail domain name easily without having to edit the sendmail.cf file on each client.

Mail Address

The mail address contains the name of the recipient and the system to which the mail message is delivered.

When you administer a small mail system that does not use a name service, addressing mail is easy: login names uniquely identify users.

When, however, you are administering a mail system that has more than one system with mailboxes, one or more domains, or when you have a UUCP (or other) mail connection to the outside world, mail addressing becomes more complex. Mail addresses can be route based, route independent, or a mixture of the two.

Route-Based Addressing

Route-based addressing requires the sender of an email message to specify the local address (typically, a user name) and its final destination, as well as the route that the message must take to reach its final destination. Route-based addresses are fairly common on UUCP networks, and have this format:


path!host!user

Whenever you see an exclamation point as part of an email address, all (or some) of the route was specified by the sender. Route-based addresses are always read from left to right.

For example, an email address that looks like this:


venus!acme!sierra!ignatz

means that mail sent to the user named ignatz is first sent to the system named venus, next to acme, and then to sierra. (Note that this is an example and not an actual route.) If any of the mail handlers is out of commission, the message will be delayed or returned as undeliverable.

Route-Independent Addressing

Route-independent addressing requires the sender of an email message to specify the name of the recipient and the final destination address. Route-independent addresses usually indicate the use of a high-speed network like the Internet. In addition, newer UUCP connections frequently use domain-style names. Route-independent addresses may have this format:


user@host.domain

The increased popularity of the domain hierarchical naming scheme for computers is making route-independent addresses more common. In fact, the most common route-independent address omits the host name and relies on the domain name service to properly identify the final destination of the email message:


user@domain

Route-independent addresses are read by searching for the @ sign, then reading the domain hierarchy from the right (the highest level) to the left (the most specific address to the right of the @ sign).

Mailbox

A mailbox is a file on a mail server that is the final destination for email messages. The name of the mailbox may be the user name or a place to put mail for someone with a specific function, like the postmaster. Mailboxes are in the /var/mail/username file, which can exist either on the user's local system or on a remote mail server. In either case, the mailbox is on the system to which the mail is delivered.

Mail should always be delivered to a local file system so that the user agent can pull mail from the mail spool and store it readily in the local mailbox. Do not use NFS-mounted file systems as the destination for a user's mailbox. Specifically, do not direct mail to a mail client that is mounting the /var/mail file system from a remote server. Mail for the user, in this case, should be addressed to the mail server and not to the client host name. NFS-mounted file systems can cause problems with mail delivery and handling. Clients that NFS-mount /var/mail go into "remote mode" and should arrange to have the server send and receive mail for them.

The /etc/mail/aliases file and name services like NIS and NIS+ provide mechanisms for creating aliases for electronic mail addresses, so that users do not need to know the precise local name of a user's mailbox.

Table 1-2 shows some common naming conventions for special-purpose mailboxes.

Table 1-2 Conventions for the Format of Mailbox Names

Format 

Description 

username

User names are frequently the same as mailbox names. 

Firstname.Lastname Firstname_Lastname Firstinitial.Lastname Firstinitial_Lastname

User names may be identified as full names with a dot (or an underscore) separating the first and last names, or by a first initial with a dot (or an underscore) separating the initial and the last name. 

postmaster

Users can address questions and report problems with the mail system to the postmaster mailbox. Each site and domain should have a postmaster mailbox.

MAILER-DAEMON

sendmail automatically routes any mail addressed to the MAILER-DAEMON to the postmaster.

x-interest

Names with dashes are likely to be a distribution list or a mailing list. This format is commonly used for net mail groups. 

x-interest-request

Names ending in -request are administrative addresses for distribution lists.

owner-x-interest

Names beginning with owner- are administrative addresses for distribution lists.

local%domain

The percent sign (%) marks a local address that is expanded when the message arrives at its destination. Most mail systems interpret mailbox names with % characters as full mail addresses. The % is replaced with an @, and the mail is redirected accordingly. Although many people use the % convention, it is not a formal standard. It is referred to as the "percent hack."

Aliases

An alias is an alternate name. For electronic mail, you can use aliases to assign a mailbox location or to define mailing lists.

For large sites, the mail alias typically defines the location of a mailbox. Providing a mail alias is like providing a mail stop as part of the address for an individual at a large corporation. If you do not provide the mail stop, the mail is delivered to a central address. Extra effort is required to determine where within the building the mail is to be delivered, and the possibility of error increases. For example, if there are two people named Kevin Smith in the same building, only one of them will get mail.

Use domains and location-independent addresses as much as possible when you create mailing lists. To enhance portability and flexibility of alias files, make your alias entries in mailing lists as generic and system independent as possible. For example, if you have a user named ignatz on system mars, in domain eng.acme.com, create the alias ignatz@eng instead of ignatz@mars. If user ignatz changes the name of his system but remains within the engineering domain, you do not need to update alias files to reflect the change in system name.

When creating alias entries, type one alias per line. You should have only one entry that contains the user's system name. For example, you could create the following entries for user ignatz:


ignatz: iggy.ignatz
iggyi: iggy.ignatz
iggy.ignatz: ignatz@mars

You can create an alias for local names or domains. For example, an alias entry for user fred who has a mailbox on the system mars and who is in the domain planets could have this entry in the NIS+ aliases table:


fred: fred@planets

When creating mail lists that include users outside your domain, create the alias with the user name and the domain name. For example, if you have a user named smallberries on system privet, in domain mgmt.acme.com, create the alias as smallberries@mgmt.acme.com.

You can configure the sendmail.cf file to translate the email address to a fully qualified domain name when mail goes outside the user's domain.

Uses for Aliases Files

You create mail aliases for global use in the NIS+ mail_aliases table, the NIS aliases map, or in local /etc/mail/aliases files. You can also create and administer mailing lists using the same alias files.

Depending on the configuration of your mail services, you may administer aliases by using the NIS or NIS+ name service to maintain a global aliases database or by updating all the local /etc/mail/aliases files to keep them synchronized.

Users can also create and use aliases. They can create aliases either in their local ~/.mailrc file, which only they can use, or in their local /etc/mail/aliases file, which can be used by anyone. Users cannot normally create or administer NIS or NIS+ alias files.

Hardware Components of a Mail Configuration

A mail configuration requires three elements, which can be combined on the same system or provided by separate systems:

When you want users to communicate with networks outside your domain, you must also add a fourth element, a mail gateway.

Figure 1-1 shows a typical electronic mail configuration, using the three basic mail elements plus a mail gateway. Each element is identified and described in the following sections.

Figure 1-1 Typical Electronic Mail Configuration

Graphic

Mail Host

A mail host is the machine that you designate as the main mail machine on your network. It is the machine to which other systems at the site forward mail that they cannot deliver. You designate a system as a mail host in the hosts database by adding the word mailhost to the right of the IP address in the local /etc/inet/hosts file or in the hosts file in the name service. You must also use the main.cf file as the mail-configuration file on the mail host system.

A good candidate for mail host is a system on the local-area network that also has a modem for setting up PPP or UUCP links over telephone lines. Another good candidate is a system configured as a router from your network to the Internet global network. (See TCP/IP and Data Communications Administration Guide for more information on PPP, UUCP, and routers.) If none of the systems on your local network has a modem, designate one as the mail host.

Some sites use standalone machines that are not networked in a time-sharing configuration; that is, the standalone machine serves terminals attached to its serial ports. You can set up electronic mail for this configuration by treating the standalone system as the mail host of a one-system network.

Mail Server

A mailbox is a single file that contains email for a particular user. Mail is delivered to the system where the user's mailbox resides: the local machine or a remote server. A mail server is any system that maintains user mailboxes in its /var/mail directory.

The mail server routes all mail from a client. When a client sends mail, the mail server puts it in a queue for delivery. Once the mail is in the queue, a user can reboot or turn off the client without losing those mail messages. When the recipient gets mail from a client, the path in the "From" line of the message contains the name of the mail server. If the recipient responds, the response goes to the user's mailbox.

If the mail server is not the user's local system, users in configurations using NFS software can mount the /var/mail directory by using the /etc/vfstab file (if they have root access) or by using the automounter. If NFS support is not available, the users can log in to the server to read their mail.

Good candidates for mail servers are systems that provide a home directory for users or that are backed up regularly.

If users on your network send other types of mail, such as PostScriptTM files, audio files, or files from desktop publishing systems, you need to allocate more space on the mail server for mailboxes.

One advantage to establishing a mail server for all mailboxes is that it makes backups easy. Having mail spread over many systems makes it hard to do backups. The disadvantage of storing many mailboxes on one server is that the server can be a single point of failure for many users, but the advantages of providing good backups usually make the risk worthwhile.

Mail Client

A mail client is any system that receives mail on a mail server and does not have a local /var/mail directory. This is known as the remote mode. The remote mode is enabled by adding the OR option in the sendmail.cf file.

You must check that the mail client has the appropriate entry in the /etc/vfstab file and a mount point to mount the mailbox from the mail server. Also make sure that the alias for the client is directed to the mail server's host name not to the client's.

Mail Gateway

The mail gateway is a machine that handles connections between networks running different communications protocols or communications between different networks using the same protocol. For example, a mail gateway might connect a TCP/IP network to a network running the Systems Network Architecture (SNA) protocol suite.

The simplest mail gateway to set up is one that connects two networks that use the same protocol or mailer. This system handles mail with an address for which sendmail cannot find a recipient in your domain. If a mail gateway exists, sendmail uses it for sending and receiving mail outside your domain.

You can set up a mail gateway between two networks using unmatched mailers, as shown in Figure 1-2. To support this, you must customize the sendmail.cf file on the mail gateway system, which can be a difficult and time-consuming process.

Figure 1-2 Gateway Between Different Communications Protocols

Graphic

If you have to set up a mail gateway, you should find a gateway-configuration file that is close to what you need and modify it to fit your situation.

If you have a machine providing connections to the Internet, you can configure that machine as the mail gateway. Carefully consider your site's security needs before you configure a mail gateway. You may need to create a firewall gateway between your corporate network and the outside world, and set that up as the mail gateway.

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.