|
|
Installing and Administering Internet Services: HP 9000 Networking > Chapter 2 Installing and Configuring Internet
ServicesTroubleshooting sendmail |
|
This section describes the following techniques for troubleshooting sendmail: Almost all sendmail troubleshooting must be done as superuser. The aliases database must be rebuilt if changes have been made to the aliases text file. You must restart sendmail after you change the configuration file or the aliases database. Issue the following commands on a standalone system or on the mail server to rebuild the aliases database and restart sendmail:
In order to deliver a message, sendmail must first resolve the recipient addresses appropriately. To determine how sendmail would route mail to a particular address, issue the following command:
The -bv (verify mode) option causes sendmail to verify addresses without collecting or sending a message. The -v (verbose) flag causes sendmail to report alias expansion and duplicate suppression. The -oL10 (log level) option sets the log level to 10. At log level 10 and above, sendmail -bv reports the mailer and host to which it resolves recipient addresses. For hosts that resolve to IPC mailers, MX hosts are not reported when using verify mode, because MX records are not collected until delivery is actually attempted. If the address is not being resolved as you expect, you may have to modify one or more of the following:
More detailed information about how the configuration file is rewriting the recipient addresses is provided by address test mode:
You can observe sendmail's interaction with the delivery agents by delivering the message in verbose mode, as in the following example:
sendmail responds with the following information:
sendmail is now ready for you to type a message. After the message, type a period (.) on a line by itself, as in the following example:
sendmail responds with the following information:
sendmail has interfaces to three types of delivery agents. In verbose mode, sendmail reports its interactions with them as follows:
It is possible to talk to the sendmail daemon and other SMTP servers directly with the following command:
This can be used to determine whether an SMTP server is running on host. If not, your connection attempt will return "Connection refused." Once you establish a connection to the sendmail daemon, you can use the SMTP VRFY command to determine whether the server can route to a particular address. For example,
Not all SMTP servers support the VRFY and EXPN commands. If sendmail cannot resolve your domain name, you may see the following warning message in your syslog file:
To resolve this problem, do one of the following:
If you attempt to start sendmail when there is already a sendmail daemon running, the following message may be logged to both the syslog file and to the console:
This message means that a sendmail daemon is already running. You can use either /sbin/init.d/sendmail stop or killsm to stop the running daemon. sendmail logs its mail messages through the syslogd logging facility. The syslogd configuration should write mail logging to the file /var/adm/syslog/mail.log. You can do this by adding the following line in /etc/syslog.conf:
You can use the HP mtail utility to look at a specified number of the last lines of the log file:
By default, mtail displays the last 20 lines of the log file. For more information on the mtail utility, type man 1M mtail at the HP-UX prompt. For more information about configuring syslogd, see Chapter 2 “Installing and Configuring Internet Services”. You can set the log level with the -oL option on the sendmail command line or on the OL line in the sendmail configuration file. At the lowest level, no logging is done. At the highest level, even the most mundane events are recorded. As a convention, log levels 11 and lower are considered useful. Log levels above 11 are normally used only for debugging purposes. We recommend that you configure syslogd to log mail messages with a priority level of debug and higher. sendmail's behavior at each log level is described in Table 2-1 “sendmail Logging Levels”. Table 2-1 sendmail Logging Levels
sendmail logs the following:
Log entries marked SYSERR indicate either system failures or configuration errors and may require the attention of the system administrator. Each system log entry for a mail transaction has a queue ID associated with it. All log entries for the same input message have the same queue ID. Log level is normally set to 10 in the configuration file. At this level, the following information is logged for each delivery:
Queued messages and SYSERRs are also logged. At typical logging levels, every piece of mail passing through sendmail adds two or three lines to the mail log. A script to manage the growth of the mail log could be run nightly, at midnight, with an entry in root's crontab file. Following is an example of a crontab entry for a script called newsyslog:
The following example shows what the script /var/adm/syslog/newsyslog might contain. The script assumes that syslog is configured to direct mail logging to /var/adm/syslog/mail.log.
The current contents of the mail queue can be printed with the following command:
The output looks similar to this example:.
The first entry is a message with queue ID AA15841 and a size of 86 bytes. The message arrived in the queue on Wednesday, February 9 at 7:08 a.m. The sender was janet. She sent a message to the recipients ees@vetmed.umd.edu and ebs@surv.ob.com. sendmail has already attempted to route the message, but the message remains in the queue because its SMTP connection was refused. This usually means that the SMTP server is temporarily not running on the remote host, but it also occurs if the remote host never runs an SMTP server. sendmail attempts to deliver this message the next time the mail queue is processed. Two other messages in the queue are also routed for delivery the next time the mail queue is processed. If mailq is run in verbose mode (with the -v option), then when it prints the queue, it will also show the priority of each queued message. The files that sendmail creates in the mail queue all have names of the form zzTAAnnnnn, where zz is the type of the queue file and TAA is an identifier used to distinguish separate queue entries that happen to have the same process ID. sendmail starts with TAA and loops through TAB, TAC, and so on, until it is able to form a unique ID. The five-digit number (nnnnn) is the process ID of the process creating the queue entry. A file whose name begins with df is a data file. The message body, excluding the header, is kept in this file. A file whose name begins with qf is a queue-control file, which contains the information necessary to process the job. A file whose name begins with xf is a transcript file. This file is normally empty while a piece of mail is in the queue. If a failure occurs, a transcript of the failed mail transaction is generated in this file. The queue-control file (type qf) is structured as a series of lines, each beginning with a letter that defines the content of the line. Lines in queue-control files are described in Table 2-2 “Lines in Queue-Control Files”. Table 2-2 Lines in Queue-Control Files
The following example is a queue-control file named qfAA00186. The sender is david, and the recipient is the local user carolyn. The current priority of the message is 17. The job creation time, in seconds since January, 1970, is 515 961 566. The last seven lines describe the header lines that appear on the message.
|
|