User Accounts, Printers, and Mail Administration
この本のみを検索
PDF 文書ファイルをダウンロードする

Setting Up and Administering Mail Services

9

This chapter describes how to set up and administer mail services.
Use the following table to find the page where the instructions for specific tasks.
How to Set Up a Mail Serverpage 254
How to Set Up a Mail Clientpage 254
How to Set Up a Mail Hostpage 256
How to Set Up a Relay Hostpage 256
How to List the Contents of an NIS+ Aliases Tablepage 257
How to Add Entries by Editing an NIS+ Aliases Tablepage 259
How to Change Entries in an NIS+ Aliases Tablepage 259
How to Delete Entries from a NIS+ Aliases Tablepage 260
How to Set Up NIS Aliases Filespage 260
How to Set Up Local Mail Aliases Filespage 261
How to Set Up DNS Aliases Filespage 263
How to Set Up the Postmaster Aliaspage 264
How to Test the Mail Configurationpage 265
How to Print the Queuepage 268
How to Force the Queuepage 268
How to Run the Old Mail Queuepage 269
How to Check Aliasespage 272
How to Test the sendmail Programpage 272
How to Verify Connections to Other Systemspage 273
If you are not familiar with administering mail services, read Chapter 8, "Understanding Mail Services," for an introduction to the terminology and structure of the mail services, and for descriptions of several mail services configurations.

Setting Up Mail Services

You can set up a mail service relatively easily if your site does not provide connections to electronic mail (email) services outside your company, or if your company is in a single domain.
Appendix C, "Customizing sendmail Configuration Files," contains information about how to create more complicated configuration files.
Mail requires three types of configurations for local mail and a fourth for communication with networks outside of your domain. These configurations can be combined on the same system or provided by separate systems. There is also a fifth, optional, type of mail configuration called a gateway. You need to set up systems on your site to perform the functions described in Table 9-1.
Table 9-1
ConfigurationDescription
Mail serverYou need to have at least one mail server. The mail server stores mailboxes in the /var/mail directory.
Mail hostYou need at least one mail host. The mail host resolves difficult email addresses and reroutes mail within your domain.
Table 9-1
ConfigurationDescription
Mail clientMail clients are users who have mailboxes either locally or on a mail server.
Relay hostA relay host manages communication with networks outside of your domain.
GatewayA gateway is a connection between differing communications networks. A relay host may also act as a gateway. You must add rules to the sendmail.cf file to set up a gateway. See Appendix C, "Customizing sendmail Configuration Files," for information about adding rules. If you have to set up a gateway, you should find a gateway configuration file that is close to what you need, and modify it to fit your situation.
Before you begin to set up your mail service, choose the systems to act as mail servers, mail hosts, and relay hosts. You should also make a list of all the mail clients for which you will be providing service, and include the location of their mailboxes. This list will help you when you are ready to create mail aliases for your users. See Chapter 8, "Understanding Mail Services," for more information about the function each of these systems provides. For your convenience, guidelines about which systems are good candidates for mail server, mail host, and relay host are repeated in the following sections.
To simplify the setup instructions, this chapter tells you what you need to do to set up individual mail servers, mail hosts, mail clients, and relay hosts. If a system in your mail services configuration is acting in more than one capacity, follow the appropriate instructions for each type of system. For example, if your mail host and mail server functions are on the same system, follow the directions for setting up that system as a mail host and then follow the directions for setting up the same system as a mail server.

Note - The following procedures for setting up a mail server and mail client apply when mailboxes are NFS-mounted. However, typically, mailboxes are maintained in locally mounted /var/mail directories, in which case, the following procedures are not needed.

Setting Up Mail Security

By default, security permissions on a /var/mail directory allow read, write, and execute access to the owner, members of groups to which the owner belongs, and all others. On Solaris 2.x mail servers, you can make a /var/mail directory more secure by changing its default permissions to allow only read and write access to anyone outside the owner's groups, as long no SunOS 4.1.x mail clients are connected. For more information about changing directory permissions, refer to Security, Performance, and Accounting Administration.

· How to Set Up a Mail Server

The mail server routes all mail from a client. The only resource requirement for a mail server is that it has adequate spooling space for client mailboxes. See Chapter 8, "Understanding Mail Services," for recommendations about spooling space.
For this task, you will check the /etc/dfs/dfstab file to be sure the /var directory is exported.
  1. Type share and press Return.

    If the /var directory is not exported, continue with the next step.

  2. Type share -F nfs [-o options] /var/mail and press Return.


Note - The sendmail program automatically creates mailboxes in the /var/mail directory the first time a message is delivered. You do not need to create individual mailboxes for your mail clients.

· How to Set Up a Mail Client

A mail client is a user of mail services, with a mailbox either on a local system or on a mail server, and a mail alias in the /etc/mail/aliases file that points to the location of the mailbox.
To set up a mail client with a mailbox on a mail server:
  1. Become root on the mail client's system.

  2. Create a /var/mail mount point on the mail client's system.

  1. Edit the /etc/vfstab file and add an entry for the /var/mail directory on the mail server, mounting it on the local /var/mail directory. The client's mailbox will be automatically mounted any time the system is rebooted.

  2. Type mountall to mount the mailbox.

    The client's mailbox is mounted.

  3. Use the Administration Tool to edit the /etc/hosts file and add an entry for the mail server.

  4. Add the client to the /etc/mail/aliases file. See "Creating Mail Aliases" on page 257 for information about how to create mail aliases for different types of mail configurations.


Note - The sendmail program automatically creates mailboxes in the /var/mail directory the first time a message is delivered. You do not need to create individual mailboxes for your mail clients.

· How to Set Up a Mail Host

A mail host resolves email addresses and reroutes mail within your domain. A good candidate for a mail host is a system that connects your systems to the outside world or to a parent domain.
  1. Become root on the mail host system.

  2. Use the Administration Tool to edit the hosts database. Add the word mailhost following the IP address and system name of the mail host system. The system is designated as a mail host.

  3. Use the Administration Tool to create an entry for the new mail host in the hosts database on the master NIS server.

    If you are not using NIS, you must create an entry in the /etc/hosts database for each system on the network.

    The entry should use this format: IP address mailhost_name mailhost

  4. Type cp /etc/mail/main.cf /etc/mail/sendmail.cf and press Return.

    This copies and renames the /etc/mail/main.cf file.

  1. Reboot the mail host and test your mail configuration.

    See "Testing the Mail Configuration" on page 265 for information.

· How to Set Up a Relay Host

A relay host manages communication with networks outside of your domain that use the same relay mailer. The mailer on the sending relay host must match the mailer on the receiving system.
A good candidate for a relay host is a system attached to Ethernet and to phone lines, or a system configured as a router to the Internet. You may want to configure the mail host as the relay host, or configure another system as relay host. You may choose to configure more than one relay host for your domain. Each relay host you configure must use a mailer that matches the mailer on the connecting system. If you have uucp connections, you should configure the system (or systems) with uucp connections as the relay host.
  1. Become root on the relay host system.

  2. Type cp /etc/mail/main.cf /etc/mail/sendmail.cf and press Return.

    This command copies and renames the main.cf file.

  3. Edit the /etc/mail/sendmail.cf file and make the following changes:

    a. Only if your relay mailer is not uucp, change the default entry DMsmartuucp to the entry that is appropriate for your relay mailer. Available mailers are smartuucp (the default), ddn, ether, and uucp. If your relay mailer is uucp, you do not need to change this entry.

    You can specify a different relay mailer for each relay host (if appropriate). You can define rule sets for other relay mailers in the main.cf file. See "Mailers" on page 220 for a description of each of the default relay mailers.

    b. In the entry DRddn-gateway, replace ddn-gateway with the name of your relay host.

    The DR entry defines the relay host.

    c. In the entry CRddn-gateway, replace ddn-gateway with the name of your relay host.

    The CR entry defines the class of the relay host. You can designate one or more hosts as a member of this class.

d. (Optional) Add a Dmmail_domain or Lmmaildomain entry to define the mail domain name to be used for mail delivery.
The m macro defines the mail domain name. If the macro is not defined, the naming service domain name is used with the first component stripped off. For example, Ecd.East.Acme.COM becomes East.Acme.COM. If you use the L command, sendmail will look up the name to use in the sendmailvars table, using maildomain as the search key.
e. Save the edits.
  1. Reboot the mail host and test your mail configuration.

    See "Testing the Mail Configuration" on page 265 for information.

Creating Mail Aliases

You can use the aliasadm command to create mail aliases for a user. Mail aliases must be unique within the domain. This section tells you how to use command lines to search the mail aliases table for aliases, and to create mail aliases for NIS+, NIS, DNS, or on the local system.
Or you can use the Administration Tool's Database Manager application to perform these tasks on the Aliases database.

· How to List the Contents of an NIS+ Aliases Table

To use the aliasadm command, you must be either root, a member of the NIS+ group that owns the aliases table, or the person who created the table.
To list the entire contents of the NIS+ aliases table: * Type aliasadm -l and press Return. This lists the contents of the aliases table in alphabetic order by alias.

Note - If you have a large aliases table, listing the entire contents can take some time. If you are searching for a specific entry, pipe the output through the grep command (aliasadm -l | grep entry) so that you can use the grep search capability to find specific entries.

To list individual entries in the NIS+ aliases table: * Type aliasadm -m alias and press Return. The alias entry is listed.

  saturn# aliasadm -m ignatz  
  ignatz:ignatzsaturn@#Alias for Iggy Ignatz  


Note - The aliasadm -m option matches only the complete alias name. It does not match partial strings. You cannot use metacharacters (like *, and ?) with the aliasadm -m option. If you are interested in partial matches, try typing aliasadm -l | grep partial-string and pressing Return.

· How to Add Aliases to a NIS+ Aliases Table from the Command Line

If you are creating a completely new NIS+ aliases table, you first must initiate the NIS+ table.
To initiate an NIS+ table: * Type aliasadm -I and press Return.
To add aliases to an NIS+ table from the command line: 1. Compile a list of each of your mail clients, the locations of their mailboxes, and the names of the mail server systems.
  1. Become root on any system.

  2. For each alias, type aliasadm -a alias expanded_alias [options comments] and press Return.

    This adds the aliases to the NIS+ aliases table.

  3. Type aliasadm -m alias and press Return. This displays the entry you created.

  4. Check the entry to be sure it is correct.

Example of Adding Aliases to NIS+ From the Command Line


  # aliasadm -a iggy iggy.ignatz@saturn "Iggy Ignatz"  

· How to Add Entries by Editing an NIS+ Aliases Table

If you are adding more than two or three aliases, you may want to edit the NIS+ table directly.
  1. Compile a list of each of your mail clients, the locations of their mailboxes, and the names of the mail server systems.

  2. Become root on any system.

  3. Type aliasadm -e and press Return.

    The aliases table is displayed using the editor set with the $EDITOR environment variable. If the variable is not set, the vi editor is used.

  4. Type each alias on a separate line, using these formats:

    a. Enter the aliases in any order, at any place in the table.

    The order is not important to the NIS+ aliases table. The aliasadm -l command sorts the list and displays them in alphabetical order.

    b. Use the format alias: expanded_alias# ["option"# "comments"] If you leave the option column blank, enter an empty pair of quotation marks ("") and then add the comments.

    c. End each line by pressing Return.

  5. Check that the entries are correct.

  6. Save the changes.

· How to Change Entries in an NIS+ Aliases Table

  1. Become root on any system.

  2. Type aliasadm -m alias and press Return.

    The information for the alias is displayed.

  1. Type aliasadm -c alias expanded_alias [options comments] and press Return.

    The alias is changed using the new information you provide.

  2. Type aliasadm -m alias and press Return.

    The entry you created is displayed.

  3. Check the entry to be sure it is correct.

· How to Delete Entries from a NIS+ Aliases Table

  1. Become root on any system.

  2. Type aliasadm -d alias and press Return. The alias is deleted from the NIS+ aliases table.

· How to Set Up NIS Aliases Files

The /etc/mail/aliases file on an NIS master contains all names by which a system or person is known. The NIS master is searched if there is no match in the local /etc/mail/aliases files. The sendmail program uses the NIS master file to determine mailing addresses. See the reference manual page for aliases(4).
The /etc/mail/aliases file on the NIS master should contain entries for all mail clients. You can either edit the file on each system or edit the file on one system and copy it to each of the other systems.
Aliases are in the following form:

  name: name1, name2, ...  

You can use aliases for local names or domains. For example, an alias entry for user fred who has a mailbox on the system saturn and who is in the domain Planets would have this entry in the /etc/mail/aliases file:

  fred: fred@Planets  

To set up NIS mail aliases files: 1. Compile a list of each of your mail clients, the locations of their mailboxes, and the names of the mail server systems.
  1. Become root on the NIS master server.

  2. Edit the /etc/mail/aliases file, and make the following entries:

    a. Add an entry for each mail client. b. Change the entry Postmaster: root to the mail address of the person who is designated as postmaster.

    See "How to Set Up the Postmaster Alias" on page 264 for more information.

    c. If you have created a mailbox for administration of a mail server, create an entry for root: mailbox@mailserver.

    d. Save the changes.

  3. Edit the /etc/hosts file on the NIS master server and create an entry for each mail server.

  4. Type cd /var/yp and press Return.

  5. Type make and press Return.

    The changes in the /etc/hosts and /etc/mail/aliases files are propagated to NIS slave systems. It takes a few minutes, at most, for the aliases to take effect.

· How to Set Up Local Mail Aliases Files

The /etc/mail/aliases file on a local system contains all names by which a system or person is known. The sendmail program uses this file to determine mailing addresses. See the reference manual page for aliases(4).
If your network is not running a naming service, the /etc/mail/aliases file of each system should contain entries for all mail clients. You can either edit the file on each system, or edit the file on one system and copy it to each of the other systems.
Aliases are of the form:

  name: name1, name2, ...  

You can create aliases for only local names--a current host name or no host name. For example, an alias entry for user ignatz who has a mailbox on the system saturn would have this entry in the /etc/mail/aliases file:

  ignatz: ignatz@saturn  

It is a good idea to create an administrative account for each mail server. You do this by assigning root a mailbox on the mail server and adding an entry to the /etc/mail/aliases file for root. For example, if the system saturn is a mailbox server, add the entry root: sysadmin@saturn to the /etc/mail/aliases file.
To set up local mail aliases files: 1. Compile a list of each of your mail clients and the locations of their mailboxes.
  1. Become root on the mail server.

  2. Edit the /etc/mail/aliases file, and make the following entries:

    a. Add an entry for each mail client. b. Change the entry Postmaster: root to the mail address of the person who is designated as postmaster.

    See "How to Set Up the Postmaster Alias" on page 264 for more information.

    c. If you have created a mailbox for administration of a mail server, create an entry for root: mailbox@mailserver.

    d. Save the changes.

  3. Type newaliases and press Return.

    This creates an alias file in binary form that sendmail can use. The file is stored in the /etc/mail/aliases.dir and /etc/mail/aliases.pag files.

  1. Copy the /etc/mail/aliases, the /etc/mail/aliases.dir, and /etc/mail/aliases.pag files to each of the other systems. When you copy all three files, you do not need to run the newaliases command on each of the other systems.

    You can copy the files by using the rcp or rdist commands, or by using a script that you create for this purpose. Remember that you must update all the /etc/mail/aliases files each time you add or remove a mail client.

· How to Set Up DNS Aliases Files

The DNS naming service does not use aliases for individuals. It does use aliases for hosts or domains, called mail exchange (MX) records. These mail exchange records are set in the /etc/named.boot file on the DNS servers for the domain or subdomain. You can specify host names, or domain names, or both in this file. Domain names can contain wildcards. For example, *.acme.com is an acceptable domain name. See Name Services Administration Guide for more information about administering DNS.
You must use the sendmail.mx program with the DNS naming service. When you use the sendmail.mx program, the ${name} rule, which creates fully qualified host names, is activated in the sendmail.cf file. You do not need to edit the configuration file to activate this rule.
To set up the sendmail.mx program: 1. Type mv /usr/lib/sendmail /usr/lib/sendmail.nomx and press Return.
This renames the current sendmail program.
  1. Type mv /usr/lib/sendmail.mx /usr/lib/sendmail and press Return.

    The sendmail.mx file gets host names directly from DNS.

  2. Check for a mailhost entry.

    Make sure there is an entry for mailhost in both the DNS /etc/named.boot file on the DNS server (or servers) and in the NIS database or NIS+ mail aliases table.

· How to Set Up the Postmaster Alias

Every system should be able to send mail to a postmaster mailbox. You can create an NIS or NIS+ alias for postmaster, or create one in each local /etc/mail/aliases file. Here is the default /etc/mail/aliases entry:

  # Following alias is required by the mail protocol, RFC 822  
  # Set it to the address of a HUMAN who deals with this system's  
  # mail problems.  
  Postmaster: root  

To create the postmaster alias, edit each system's /etc/mail/aliases file and change root to the mail address of the person who will act as postmaster.
You may want to create a separate mailbox for the postmaster to keep postmaster mail separate from personal mail. If you create a separate mailbox, use the mailbox address instead of the postmaster's mail address when you edit the /etc/mail/aliases files.
To create a separate mailbox for postmaster: 1. Create a user account for the person designated as postmaster, and put an asterisk (*) in the password field.
  1. Type mail -f postmaster and press Return. The mail program will be able to read and write to the mailbox name.

To add the postmaster mailbox to the aliases: 1. Become root and edit the /etc/mail/aliases file on each system. If your network runs NIS or NIS+, edit the /etc/mail/aliases file.
  1. Change the postmaster alias from root to Postmaster: postmastermailbox@postmasterhost and save the changes.

  2. On the postmaster's local system create an entry in the

    /etc/mail/aliases file that defines the name of the alias (sysadmin, for example), and includes the path to the local mailbox.

  3. Type newaliases and press Return.

Or you could change the Postmaster: entry in the aliases file to a postmaster: /usr/somewhere/somefile entry.

Testing the Mail Configuration

When you have set up all the systems in your mail configuration, use the suggestions in this section to test the setup to be sure mail messages can be sent and received.

· How to Test the Mail Configuration

  1. Reboot any system for which you have changed a configuration file.

  2. Send test messages from each system by typing

    /usr/lib/sendmail -v </dev/null names and press Return. Specify a recipient's email address in place of the names variable.

    This command sends a null message to the specified recipient, and displays messages while it runs.

  3. Run the following tests:

    a. Send mail to yourself or other people on the local system by addressing the message to a regular user name. b. If you are on Ethernet, send mail to someone on another system.

    Do this in three directions: from the main system to a subsidiary system, from a subsidiary system to the main system, and from a subsidiary system to another subsidiary system.

    c. If you have a relay host, send mail to another domain from the mail host to ensure that the relay mailer and host are configured properly. d. If you have set up a uucp connection on your phone line to another host, send mail to someone at that host, and have that person send mail back or call you when he or she receives the message.

    e. Ask someone to send mail to you over the uucp connection. The sendmail program cannot tell whether the message gets through, because it hands the message to uucp for delivery.

    f. Send a message to postmaster on different systems and make sure that it comes to your postmaster's mailbox.

Administering the Mail Configuration

This section describes how to keep the mail service running smoothly.

Duties of the Postmaster

Your responsibilities as postmaster for administering mail include the following tasks:
  • Check the mail queues to be sure mail is flowing in and out.
  • Check any downed systems where mail is backing up. If the system is not needed, delete it from the mail service, or bring the system up to keep mail moving.
  • Fix personal aliases, as requested.
  • Administer alias databases as people move in and out of the domain.
  • Set up temporary forwarding files.
  • Contact owners of mailing lists and help them fix mailing list problems.
  • Go through postmaster mail daily and look for problems, like broken .forward files and mail alias loops.
  • Answer questions outside the company.
  • Truncate log files periodically.

Mail Queue

Under high-load or temporary-failure conditions, sendmail puts a message into a job queue instead of delivering it immediately. The mail queue usually is processed automatically, but sometimes you may have to intervene. For example, if a major host is down for a period of time, the queue may become clogged. Although sendmail ought to recover gracefully when the host comes up, you may find performance unacceptably bad in the meantime.

Format of Queue Files

The sendmail program stores temporary queue files in the queue file /var/spool/mqueue. All such queue files have the form xfAA99999, where AA9999 is the ID for the file and x is the type. Table 9-2 shows the types of queue files.
Table 9-2
TypeDescription
dData file. The message body (excluding the header) is kept in this file.
lLock file. If this file is present, the job is currently being processed and running the job in the queue will not process it. For this reason, an extraneous lock file can cause a job to seem to disappear.
nA file created when an ID is created. It is a separate file that ensures no mail can ever be destroyed because of a race condition. This file should not exist for more than a few milliseconds at any given time.
qQueue control file. This file contains the information needed to process the job.
tA temporary file. This file is an image of the qf file when it is being rebuilt.
When the rebuild is complete, the file is renamed qf.
xTranscript file that shows everything that happens during that session.
The qf file contains a series of lines each beginning with a code letter, as shown in Table 9-3.
Table 9-3 qf
CodeDescription
PThe current message priority, which is used to order the queue. The higher the number, the lower the priority. The priority increases as the message sits in the queue. The initial priority depends on the message class and the size of the message.
TThe job creation or submission time in seconds, which is used to compute when the job times out.
DThe name of the data file.
MA message line, which is printed by using sendmail with the -bp flag, and is generally used to store status information. It can contain any text.
SThe sender name.
Table 9-3 qf
CodeDescription
EThe error recipient name. Error messages are sent to this user instead of the sender. This line is optional.
HA header definition. There may be any number of these lines. The order is
important: it represents the order in the final message. The syntax is the same
as header definitions in the configuration file.
RA recipient name. There will be one line for each recipient. The recipient name will normally have complete aliases, but its aliases are redone when the job is processed. The recipient name must be at the end of the qf file.
See Appendix C, "Customizing sendmail Configuration Files," for more information.
The queue is automatically run at the interval specified in the sendmail.cf file (the default is every hour). The queue is read and sorted, and then sendmail tries to process all jobs in order. The sendmail program first checks to see if a job is locked. If the job is locked, sendmail ignores the job; if the job is not locked, sendmail processes it.
If a major host goes down for several days, the queue may become prohibitively large, and sendmail will spend time sorting the queue. You can fix this by moving the queue to a temporary place and creating a new queue. You can run the old queue later when the host is returned to service.

· How to Print the Queue

You can print the contents of the queue by specifying the -bp flag to sendmail:
* Type /usr/lib/sendmail -bp | more and press Return. A list of the queue IDs, the size of the message, the date the message entered the queue, message status, and the sender and recipients are displayed.

· How to Force the Queue

  1. Become root on the mail host.

  1. Type ps -el | grep sendmail and press Return. Note the process identification (PID) for sendmail. You will use it in the next step.

  2. Type kill pid and press Return.

    This kills the old sendmail daemon to keep it from trying to process the old queue directory.

  3. Type cd /var/spool and press Return.

  4. Type mv mqueue omqueue; mkdir mqueue and press Return. This moves the directory, mqueue, and all its contents to the directory, omqueue, and then creates a new empty mqueue directory.

  5. Type chmod 755 mqueue; chown daemon mqueue; chgrp daemon mqueue and press Return.

    These commands set the permissions of the directory to read/write/execute by owner, and read/execute by group and others; these commands also set the owner and group to daemon.

  6. Type /usr/lib/sendmail -bd -q1h and press Return. This starts a new sendmail daemon, with a queue runtime of one hour.

· How to Run the Old Mail Queue

To run the old mail queue: 1. Type /usr/lib/sendmail -oQ/var/spool/omqueue -q and press Return.
The -oQ flag specifies an alternate queue directory and the -q flag says to run every job in the queue. Use the -v flag if you want to see the verbose output displayed on the screen.
  1. When the queue is finally emptied, type rmdir /var/spool/omqueue and press Return.

    This removes the empty directory.

To run a subset of the mail queue: * Type /usr/lib/sendmail -R string and press Return. You can run a subset of the queue at any time with the -Rstring (run queue where any recipient name matches string) or with -Mnnnn (run just one message with queue ID nnnnn).

Example of Processing a Subset of the Queue

This example processes everything in the queue for recipient, wnj.

  # /usr/lib/sendmail -Rwnj  

System Log

The mail services log most errors using the syslogd program. The default is for syslogd to send messages to the loghost.
You can define a system called loghost in the /etc/hosts file to hold all logs for an entire NIS domain. The system log is supported by the syslogd program. You specify a loghost in /etc/hosts. If no loghost is specified, then error messages from syslogd are not reported.
Here is the default /etc/syslog.conf file:
Code Example 9-1 The syslog.conf File

  #ident  "%Z%%M% %I%     %E% SMI"        /* SunOS 5.x */  
  #  
  # Copyright (c) 1994 by Sun Microsystems, Inc.  
  #  
  # syslog configuration file.  
  #  
  # This file is processed by m4 so be careful to quote ('') names  
  # that match m4 reserved words. Also, within ifdef's, arguments  
  # containing commas must be quoted.  
  #  
  # Note: Have to exclude user from most lines so that user.alert  
  #       and user.emerg are not included, because old sendmails  
  #       will generate them for debugging information. If you  
  #       have no 4.2BSD based systems doing network logging, you  
  #       can remove all the special cases for "user" logging.  
  #  
  *.err;kern.debug;auth.notice;user.none          /dev/console  
  *.err;kern.debug;daemon,auth.notice;mail.crit;user.none  
  /var/adm/messages  
  
  *.alert;kern.err;daemon.err;user.none           operator  

Code Example 9-1 The syslog.conf File (Continued)

  *.alert;user.none                               root  
  
  *.emerg;user.none                               *  
  
  # if a non-loghost machine chooses to have authentication  
  messages  
  # sent to the loghost machine, un-comment out the following line:  
  #auth.notice                    ifdef('LOGHOST', /var/log/authlog,  
  @loghost)  
  
  mail.debug                      ifdef('LOGHOST', /var/log/syslog,  
  @loghost)  
  
  #  
  # non-loghost machines will use the following lines to cause  
  "user"  
  # log messages to be logged locally.  
  #  
  ifdef('LOGHOST', ,  
  user.err                                        /dev/console  
  user.err                                        /var/adm/messages  
  user.alert                                      'root, operator'  
  user.emerg                                      *  
  )  

You can change the default configuration by editing the /etc/syslog.conf file.
Each line in the system log contains a time stamp, the name of the system that generated it, and a message. The syslog file can log a large amount of information.
The log is arranged as a succession of levels. At the lowest level, only unusual occurrences are logged. At the highest level, even the most mundane and uninteresting events are recorded. As a convention, log levels under 10 are considered "useful." Log levels higher than 10 are usually used for debugging. See File System Administration for information about loghost and the syslogd program.

Troubleshooting Tips

This section provides some tips and tools that you can use for troubleshooting problems with the mail services.

· How to Check Aliases

To verify aliases and whether mail can be delivered to a given recipient:
* Type /usr/lib/sendmail -v -bv recipient and press Return. The command displays the aliases and identifies the final address as deliverable or not.
Here is an example of the output:

  % /usr/lib/sendmail -v -bv shamira@raks  
  shamira... aliased to   mwong  
  mwong... aliased to              shamira@raks  
  shamira@raks... deliverable  
  %  

You should take extra care to avoid loops and inconsistent databases when both local and domain-wide aliases are used. Be especially careful when you move a user from one system to another to avoid creating alias loops.

· How to Test the sendmail Program

  1. Type /usr/lib/sendmail -bt and press Return. Information is displayed.

  2. At the last prompt (>) type a 0 (zero) and the mail address you want to test.

  3. Type Control-d to end the session.

See Appendix C, "Customizing sendmail Configuration Files," for a complete description of the diagnostic information.

· How to Verify Connections to Other Systems

To verify connections to other systems, you can use the mconnect program to open connections to other sendmail systems over the network. The mconnect program runs interactively. You can issue various diagnostic commands. See the reference manual page for mconnect(1) for a complete description.
If you cannot use mconnect to connect to an SMTP port, check these conditions:
  • Is the system load too high?
  • Is the sendmail daemon running?
  • Does the system have the appropriate /etc/mail/sendmail.cf file?
  • Is port 25 (the port that sendmail uses) active?

Other Diagnostic Information

For other diagnostic information, check the following sources:
  • Look at the received lines in the header of the message. These lines trace the route the message took as it was relayed. Note that in the uucp network, many sites do not update these lines, and in the Internet, the lines often get rearranged. To straighten them out, look at the date and time in each line. Do not forget to account for time zone differences.
  • Look at the messages from MAILER-DAEMON. These typically report delivery problems.
  • Check the system log that records delivery problems for your group of systems. The sendmail program always records what it is doing in the system log. You may want to modify the crontab file to run a shell script nightly that searches the log for SYSERR messages and mails any that it finds to the postmaster.
  • Use the mailstats program to test mail types and determine the number of messages coming in and going out.