Filter files, especially the more complicated ones, should always be tested, as
it is easy to make mistakes. Exim provides a facility for preliminary testing
of a filter file before installing it. This tests the syntax of the file and
its basic operation, and can also be used with ordinary `.forward'
Exim Overview
Exim is a mail transport agent (MTA) developed at the University of Cambridge
for use on Unix systems connected to the Internet. It is freely available under
the terms of the GNU General Public Licence. In style it is similar to Smail 3,
but its facilities are more extensive, and in particular it has some defences
against mail bombs and unsolicited junk mail, in the form of options for
refusing messages from particular hosts, networks, or senders.
Exim is in production use on a number of sites that move tens of thousands of
messages per day. This document contains an overview description of the way
Exim works, with a certain amount of omission and simplification to keep it
fairly short. Please address any enquiries about Exim to Philip Hazel:
University of Cambridge
Computer Laboratory
Pembroke Street
Cambridge CB2 3QG
United Kingdom
This document is copyright (c) University of Cambridge 1997, but copying
permission is granted to all.
-------------------------------------------------------------------------
"If I have seen further it is by standing on the shoulders of giants."
(Isaac Newton)
Exim owes a great deal to Smail 3 and its author, Ron Karr. Without the
experience of running and working on the Smail 3 code, I could never have
contemplated starting to write a new mailer. Many of the ideas and
configuration interfaces are taken from Smail 3, though the actual code of Exim
is entirely new.
My intention was to write a mailer that had more functionality than Smail 3,
but which retained the simple lightweight approach, as this seemed to me to be
all that was needed for systems directly connected to the Internet, where most
messages are delivered almost immediately.
The following operating systems are currently supported: AIX, BSDI, DGUX, FreeBSD,
HI-OSF (Hitachi), HP-UX, IRIX, Linux, MIPS RISCOS, NetBSD, OpenBSD, DEC OSF1
(aka Digital UNIX), SCO, SCO SVR4.2 (aka UNIX-SV), SunOS4, SunOS5, Ultrix, and
Unixware.
For the benefit of those reading this overview to see whether Exim is of
interest to them, its limitations are listed first.
Exim is written in ANSI C. This should not be much of a limitation these days.
However, to help with systems that lack a true ANSI C library, Exim avoids
making any use of the value returned by the `sprintf()' function, which is one
of the main incompatibilities. It has its own version of `strerror()' for use
with SunOS4 and any other system that lacks this function, and a macro can be
defined to turn `memmove()' into `bcopy()' if necessary.
Exim uses file names that are longer than 14 characters.
Exim is intended for use as an Internet mailer, and therefore handles addresses
in RFC 822 domain format only. It cannot handle `bang paths', though simple
two-component bang paths can be converted by a straightforward rewriting
configuration.
Exim insists that every address it handles has a domain attached. For incoming
local messages, domainless addresses are automatically qualified with a
configured domain value. Configuration options specify from which remote
systems unqualified addresses are acceptable.
The only external transport currently implemented is an SMTP transport over
a TCP/IP network (using sockets), suitable for machines on the Internet.
However, a pipe transport is available, and there are facilities for writing
messages to files in `batched SMTP' format; both of these can be used to send
messages to some other transport mechanism such as UUCP. Batched SMTP input is
also catered for.
Exim follows the same general approach of decentralized control that Smail 3
does. There is no central process doing overall management of mail delivery.
However, unlike Smail, the independent delivery processes share data in the
form of `hints', which makes delivery more efficient in some cases. The hints
are kept in a number of DBM files. If any of these files are lost, the only
effect is to change the pattern of delivery attempts and retries.
Here is a summary of Exim's main features. More details are given in the
sections which follow.
Many configuration options can be given as expansion strings, and as these can
include file lookups, much of Exim's operation can be made table-driven if
desired. For example, it is possible to do local delivery on a machine on which
the users do not have accounts.
Regular expressions are available i
Exim 4.00 Specification chapter 11PreviousNextContents
(Exim 4.00 Specification)
Many strings that are given in Exim's run time configuration are expanded
before use. Some of them are expanded every time they are used; others are
expanded only once.
When a string is being expanded it is copied verbatim from left to right except
when a dollar or backslash character is encountered. A dollar specifies the
start of a portion of the string which is interpreted and replaced as described
below in section 11.4 onwards.
An uninterpreted dollar can be included in an expanded string by putting a
backslash in front of it. A backslash can be used to prevent any special
character being treated specially in an expansion, including itself. If the
string appears in quotes in the configuration file, two backslashes are
required because the quotes themselves cause interpretation of backslashes when
the string is read in.
An entire portion of the string can specified as non-expandable by placing it
between two occurrences of \N. This is particularly useful for protecting
regular expressions, which often contain backslashes and dollar signs. For
example:
A backslash followed by one of the letters ``n'', ``r'', or ``t'' in an expanded
string is recognized as an escape sequence for the character newline, carriage
return, or tab, respectively. A backslash followed by up to three octal digits
is recognized as an octal encoding for a single character, and a backslash
followed by ``x'' and up to two hexadecimal digits is a hexadecimal encoding.
These escape sequences are also recognized in quoted strings when they are read
in. Their interpretation in expansions as well is useful for unquoted strings,
and for other cases such as looked-up strings that are then expanded.
Many expansions can be tested by calling Exim with the -be option. This takes
the command arguments, or lines from the standard input if there are no
arguments, runs them through the string expansion code, and writes the results
to the standard output. Variables based on configuration values are set up, but
since no message is being processed, variables such as $local_part have no
value. Nevertheless the -be option can be useful for checking out file and
database lookups, and the use of expansion operators such as substr and
hash.
Exim gives up its root privilege when it is called with the -be option, and
instead runs under the uid and gid it was called with, to prevent users from
using -be for reading files to which they normally do not have access.
The following items are recognized in expanded strings. White space may be used
between sub-items that are keywords or substrings enclosed in braces inside an
outer set of braces, to improve readability. Within braces, however, white
space is significant.