Exim has a complicated set of command-line options, including many that match those of sendmail. Instead of trying to put together exactly the right options for your needs, you can implement the most common types of operation by invoking traditional commands like rmail or rsmtp. These are symbolic links to Exim (or if they're not, you can easily link them to it). When you run one of the commands, Exim checks the name you used to invoke it and sets the proper options itself.
There are two links to Exim that you should have under all circumstances: /usr/bin/rmail and /usr/sbin/sendmail. [114] This is the new standard location of sendmail according to the Linux File System Standard. Another common location is /usr/lib/sendmail, which is likely to be used by mail programs that are not specially configured for Linux. You can define both filenames as symbolic links to Exim so that programs and scripts invoking sendmail will instead invoke Exim to do the same things.
When you compose and send a mail message with a user agent like elm, the message is piped to sendmail or rmail for delivery, which is why both /usr/sbin/sendmail and /usr/bin/rmail should point to Exim. The list of recipients for the message is passed to Exim on the command line. [115] Some user agents, however, use the SMTP protocol to pass messages to the transport agent, calling it with the -bs option.
The same happens with mail coming in via UUCP. You can set up the required pathnames to point to Exim by typing the following at a shell prompt:
$ ln -s /usr/sbin/exim /usr/bin/rmail
$ ln -s /usr/sbin/exim /usr/sbin/sendmail
If you want to dig further into the details of configuring Exim, you should consult the full Exim specification. If this isn't included in your favorite Linux distribution, you can get it from the source to Exim, or read it online from Exim's web site at http://www.exim.org.
To run Exim, you must first decide whether you want it to handle incoming SMTP messages by running as a separate daemon, or whether to have inetd manage the SMTP port and invoke Exim only whenever an SMTP connection is requested from a client. Usually, you will prefer daemon operation on the mail server because it loads the machine far less than spawning Exim over and over again for each connection. As the mail server also delivers most incoming mail directly to the users, you should choose inetd operation on most other hosts.
Whatever mode of operation you choose for each individual host, you have to make sure you have the following entry in your /etc/services file:
smtp 25/tcp # Simple Mail Transfer Protocol
This defines the TCP port number that is used for SMTP conversations. Port number 25 is the standard defined by the "Assigned Numbers" RFC (RFC-1700).
When run in daemon mode, Exim puts itself in the background and waits for connections on the SMTP port. When a connection occurs, it forks, and the child process conducts an SMTP conversation with the peer process on the calling host. The Exim daemon is usually started by invoking it from the rc script at boot time using the following command:
/usr/sbin/exim -bd -q15m
The -bd flag turns on daemon mode, and -q15m makes it process whatever messages have accumulated in the message queue every 15 minutes.
If you want to use inetd instead, your /etc/inetd.conf file should contain a line like this:
smtp stream tcp nowait root /usr/sbin/exim in.exim -bs
Remember you have to make inetd re-read inetd.conf by sending it an HUP signal after making any changes. [116] Use kill HUP pid, for which pid is the process ID of the inetd process retrieved from a ps listing.
Daemon and inetd modes are mutually exclusive. If you run Exim in daemon mode, you should make sure to comment out any line in inetd.conf for the smtp service. Equivalently, when having inetd manage Exim, make sure that no rc script starts the Exim daemon.
You can check that Exim is correctly set up for receiving incoming SMTP messages by telnetting to the SMTP port on your machine. This is what a successful connect to the SMTP server looks like:
$ telnet localhost smtp
Trying 127.0.0.1…
Connected to localhost.
Escape character is '^]'.
220 richard.vbrew.com ESMTP Exim 3.13 #1 Sun, 30 Jan 2000 16:23:55 +0600
quit
221 richard.brew.com closing connection
Connection closed by foreign host.
If this test doesn't produce the SMTP banner (the line starting with the 220 code), check that you are either running an Exim daemon process or have inetd correctly configured. If that doesn't reveal the problem, look in the Exim log files (described next) in case there is an error in Exim's configuration file.
If Your Mail Doesn't Get Through
A number of features are available for troubleshooting installation problems. The first place to check is Exim's log files. On Linux systems they are normally kept in /var/log/exim/log and are named exim_mainlog , exim_rejectlog , and exim_paniclog . On other operating systems, they are often kept in /var/spool/exim/log . You can find out where the log files are by running the command:
exim -bP log_file_path
The main log lists all transactions, the reject log contains details of messages that were rejected for policy reasons, and the panic log is for messages related to configuration errors and the like.
Typical entries in the main log are shown below. Each entry in the log itself is a single line of text, starting with a date and time. They have been split into several lines here in order to fit them on the page:
2000-01-30 15:46:37 12EwYe-0004WO-00 ‹= jack@vstout.vbrew.com
H=vstout.vbrew.com [192.168.131.111] U=exim P=esmtp S=32100
id=38690D72.286F@vstout.vbrew.com
2000-01-30 15:46:37 12EwYe-0004WO-00 =› jill ‹jill@vbrew.com›
D=localuser T=local_delivery
2000-01-30 15:46:37 12EwYe-0004WO-00 Completed
These entries show that a message from jack@vstout.vbrew.com to jill@vbrew.com was successfully delivered to a mailbox on the local host. Message arrivals are flagged with ‹=, and deliveries with =›.
There are two kinds of delivery errors: permanent and temporary. A permanent delivery error is recorded in a log entry like this, flagged with " ** ":
2000-01-30 14:48:28 12EvcH-0003rC-00 ** bill@lager.vbrew.com
R=lookuphost T=smtp: SMTP error from remote mailer after RCPT TO:
‹bill@lager.vbrew.com›: host lager.vbrew.com [192.168.157.2]:
550 ‹bill@lager.vbrew.com›… User unknown
After a failure like this, Exim sends a delivery failure report, often called a bounce message back to the sender.
Temporary errors are flagged with " - ":
2000-01-30 12:50:50 12E9Un-0004Wq-00 - jim@bitter.vbrew.com
T=smtp defer (145): Connection timed out
This error is typical for a situation in which Exim properly recognizes that the message should be delivered to a remote host, but is not able to connect to the SMTP service on that host. The host may be down or there could be a network problem. Whenever a message is deferred like this, it remains on Exim's queue and is retried at intervals. However, if it fails to be delivered for a sufficiently long time (usually several days), a permanent error occurs and the message is bounced.
Читать дальше