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 |
---|---|---|
File |
A user agent |
|
File |
A filter to store mail in SunOS 4.1 mailbox format |
|
Link |
Link to /usr/lib/sendmail; used to list the mail queue |
|
File |
A program used to read mail statistics stored in the /etc/mail/sendmail.st file (if present) |
|
File |
A user agent |
|
File |
A program to manipulate the NIS+ aliases map |
|
File |
A program that connects to the mailer for address verification and debugging |
|
Link |
Link to /usr/lib/sendmail; used to create the binary form of the aliases file |
|
Link |
Link to /usr/bin/mail; command often used to permit only the sending of mail |
|
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 |
---|---|---|
File |
Default settings for the mailtool user agent |
|
File |
Mail-forwarding information |
|
File |
Binary form of mail-forwarding information (created by running newaliases) |
|
File |
Binary form of mail-forwarding information (created by running newaliases) |
|
File |
Default settings for the mailx user agent |
|
File |
Sample configuration file for main systems |
|
File |
Configuration file for mail routing |
|
File |
Optional file that you can be create if the number of aliases for the mail host is too long |
|
File |
Help file used by the SMTP HELP command |
|
File |
File that lists the PID of the listening daemon |
|
File |
The sendmail statistics file; if this file is present, sendmail logs the amount of traffic through each mailer |
|
File |
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 |
---|---|---|
File |
Mailer that delivers mail to mailboxes |
|
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 |
---|---|---|
Directory |
Where undelivered mail is stored |
|
File |
Mailboxes for delivered mail |
|
File |
Stores macro and class definitions for lookup from sendmail.cf |
|
Table |
NIS+ version of sendmailvars file |
|
File |
Mail-notification daemon |
|
File |
Error message logger, used by sendmail |
|
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.
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.
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.
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.
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:
A configuration file named main.cf for the system (or systems) you designate as the mail host or a mail gateway
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.
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 mail host or gateway, copy the main.cf file and rename it sendmail.cf (in the /etc/mail directory). Then edit the sendmail.cf file to set the relay mailer and relay host parameters needed for your mail configuration.
The following list describes some configuration parameters you may want to change, depending on the requirements of your site:
Delivery modes specifies how quickly mail will be delivered.
Load limiting prevents wasted time during loaded periods by not attempting to deliver large messages, messages to many recipients, and messages to sites that have been down for a long time.
User ID (setuid) for sendmail
Temporary file modes
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:
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.
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
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.
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.