Exim is a mail transfer agent (MTA) that can be run as an alternative to Sendmail on Unix systems. Exim is open-source software that is distributed under the GNU General Public License (GPL), and it runs on all the most popular flavors of Unix and many more besides. A number of Unix distributions now include Exim as their default MTA.
I wrote Exim for use on medium-sized servers with permanent Internet connections in a university environment, but it is now used in a wide variety of different situations, from single-user machines on dial-up connections to clusters of servers supporting millions of customers at some large ISP sites. The code is small (between 500 KB and 1.2 MB on most hardware, depending on the compiler and which optional modules are included), and its performance scales well.
The job of a mail transfer agent is to receive messages from different sources and to deliver them to their destinations, potentially in a number of different ways. Exim can accept messages from remote hosts using SMTP over TCP/IP, and as well as from local processes. It handles local deliveries to mailbox files or to pipes attached to commands, as well as remote SMTP deliveries to other hosts. Exim consists of support for the new IPv6 protocol in its TCP/IP functions, as well as for the current IPv4 protocol. It does not directly support UUCP, though it can be interfaced to other software that does, provided that UUCP “bang path” addressing is not required, because Exim supports only Internet-style, domain-based addressing.
Exim’s configuration is flexible and can be set up to deal with a wide variety of requirements, including virtual domains and the expansion of mailing lists. Once you have grasped the general principles of how Exim works, you will find that the runtime configuration is straightforward and simple to set up. The configuration consists of a single file that is divided into a number of sections, and entries in each section that are keyword/value pairs. Regular expressions, compatible with Perl 5, are available for use in a number of options.
The configuration file can reference data from other files, in linear and indexed formats, and from NIS, NIS+, LDAP, MySQL, and PostgreSQL databases. It can also make use of online lists such as the Realtime Blackhole List (RBL). By this means, you can make much of Exim’s operation table-driven if desired. For example, it is possible to do local delivery on a machine on which the users do not have accounts. The ultimate flexibility can be obtained (at a price) by running a Perl interpreter while processing certain option strings.
You can use a number of different facilities for checking and controlling incoming messages. For example, the maximum size of messages can be specified, SMTP calls from specific hosts and networks (optionally from specific identifiers) can be locked out, as can incoming SMTP messages from specific senders You can identify blocked hosts explicitly, or via RBL lists, and you can control which hosts are permitted to use the Exim host as a relay for onward transmission of mail. The SMTP AUTH mechanism can be used to authenticate client hosts for this purpose.
End users are not normally concerned with which MTA is delivering into their mailboxes, but when Exim is in use, its filtering facility, which extends the power of the traditional .forward file, can be made available to them. A filter file can test various characteristics of a message, including the contents of the headers and the start of the body, and then direct delivery to specified addresses, files, or pipes according to what it finds. The filtering feature can also be used by the system administrator to inspect each message before delivery.
Like many MTAs, Exim has adopted the Sendmail command interface so that it can be a straight replacement for /usr/sbin/sendmail or /usr/lib/sendmail. All the relevant Sendmail options are implemented. There are also some additional options that are compatible with Smail 3, and some further options that are specific to Exim.
Messages on the queue can be controlled by the use of certain privileged command-line options. There is also an optional monitor program called eximon, which displays current information in an X window, and contains interfaces to the command-line options.
Exim is not designed for storing mail for dial-up hosts. When the volumes of such mail are large, it is better to get the messages “delivered” into files (that is, off Exim’s queue) and subsequently passed on to the dial-up hosts by other means.
There are some things that Exim does not do: it does not support any form of delivery status notification, and it has no built-in facilities for modifying the bodies of messages. In particular, it never translates message bodies from one form of encoding to another.
The aim of this book is to explain how Exim works, and to give background and tutorial information on the core facilities that the majority of administrators will need to know about. Some options that are required only in very special circumstances are not covered. In any case, a book can never keep up with developing software; if you want to know exactly what is available in any given release, you should consult the reference manual and other documentation that is included in the distribution for that release.
Exim is still being developed in the light of experience, changing requirements, and feedback from users. This book was originally written to correspond to Release 3.16, but while it was being revised, additional facilities, such as support for LMTP and SSL/TLS, were added to Exim for the 3.20 release. Some references to these important new features have therefore been included in the book, which now covers all the major features of the 3.2x releases. No further functional enhancements to Exim 3 are planned, though in due course a new major release (Exim 4) is expected.
The Exim reference manual and a FAQ are online at the Exim web site, at http://www.exim.org and its mirrors. Here you will also find the latest release of Exim, as a source distribution. In addition to the plain text version that is included in the distribution, the manual can be downloaded in HTML (for faster browser access), in PostScript or PDF (for printing), and in Texinfo format for the info command.
Some versions of GNU/Linux are now being distributed with binary versions of Exim included. For this reason, I’ve left the material on building Exim from source until the end of the book, and concentrated on the runtime aspects first. If you are working with a binary distribution, make sure you have a copy of the text version of the reference manual that comes with the source distribution. It provides full coverage of every configuration option, and can easily be searched.
The next chapter is a general discussion of the way email on the Internet works; Exim is hardly mentioned. This material has been included for the benefit of the many people who find themselves having to run a mail server without this essential background knowledge. You can skip to Chapter 3 if you already know about RFC 822 message format, SMTP, mail routing, and DNS usage.
 The terms mail transfer agent and mail transport agent are basically synonymous, and are used interchangeably.
 If you are not familiar with SMTP or some of the other acronyms used here, don’t be put off. The next chapter contains a description of how Internet mail works.
 See RFC 1891.