UNIVERSITY OF CAMBRIDGE COMPUTING SERVICE SPECIFICATION OF THE EXIM MAIL TRANSFER AGENT by Philip Hazel University Computing Service New Museums Site Pembroke Street Cambridge CB2 3QG United Kingdom phone: +44 1223 334600 fax: +44 1223 334679 email: ph10@cus.cam.ac.uk Edition for Exim 2.10, December 1998 Copyright (c) University of Cambridge 1998 CONTENTS 1. Introduction 1.1 Web site and Mailing list 1.2 Availability 1.3 Limitations 1.4 Features 1.5 Support for IPv6 1.6 Calling interface 1.7 Terminology 2. Incorporated code 3. How Exim delivers mail 3.1 Philosophy 3.2 Message reception 3.3 Life of a message 3.4 Drivers 3.5 Delivery in detail 3.6 Temporary delivery failures 4. Building and installing Exim 4.1 Unpacking 4.2 Multiple machine architectures and operating systems 4.3 DBM libraries 4.4 Pre-building configuration 4.5 Use of tcpwrappers 4.6 Including support for IPv6 4.7 The building process 4.8 Overriding build-time options for Exim 4.9 OS-specific header files 4.10 Overriding build-time options for the monitor 4.11 Installing commands and scripts 4.12 Installing info documentation 4.13 Setting up the spool directory 4.14 Testing 4.15 Switching Exim on 4.16 Exim on heavily loaded hosts 4.17 Stopping Exim on Solaris 2 5. The Exim command line 5.1 Setting options by program name 5.2 Trusted and admin users 5.3 Command line options 6. File and database lookups 6.1 Single-key lookup types 6.2 Query-style lookup types 6.3 Use of data lookups 6.4 Temporary errors in lookups 6.5 Partial matching in single-key lookups 6.6 Lookup caching 6.7 More about NIS+ 6.8 More about LDAP 7. The Exim configuration file 7.1 Configuration file format 7.2 Macros in the configuration file 7.3 Common option syntax 7.4 Integer 7.5 Octal integer 7.6 Fixed point number 7.7 Time interval 7.8 String 7.9 Expanded strings 7.10 User and group names 7.11 String lists 7.12 Domain lists 7.13 Partial matching in domain lists 7.14 Address lists 7.15 Host lists 7.16 Net lists 8. Regular expressions 8.1 Testing regular expressions 9. String expansions 9.1 Testing string expansions 9.2 Expansion items 9.3 Expansion operators 9.4 Expansion conditions 9.5 Expansion variables 9.6 Expansion string examples 10. Embedded Perl 11. Main configuration 12. Driver specifications 13. Default transports 14. Environment for running local transports 14.1 Uids and gids 14.2 Current and home directories 14.3 Expansion variables derived from the address 15. Generic options for transports 16. The appendfile transport 16.1 Private options for appendfile 16.2 Operational details for appending 16.3 Operational details for delivery to a new file 17. The autoreply transport 17.1 Private options for autoreply 18. The pipe transport 18.1 Returned status and data 18.2 How the command is run 18.3 Environment variables 18.4 Private options for pipe 18.5 Using an external local delivery agent 19. The smtp transport 20. Common generic options for directors and routers 20.1 Skipping directors and routers 21. Additional generic options for directors 21.1 Skipping directors 22. The aliasfile director 22.1 Alias file format 22.2 Types of alias item 22.3 Duplicate addresses 22.4 Repeated alias expansion 22.5 Errors in alias files 22.6 Specifying transports for aliasfile 22.7 Aliasfile private options 23. The forwardfile director 23.1 Forward file items 23.2 Repeated forwarding expansion 23.3 Errors in forward files 23.4 Filter files 23.5 The home directory 23.6 Forwardfile transports 23.7 Forwardfile private options 24. The localuser director 25. The smartuser director 26. Additional generic options for routers 27. The domainlist router 27.1 Routing rules 27.2 Host list format 27.3 Options format 27.4 Application of routing rules 27.5 Domainlist examples 28. The ipliteral router 29. The iplookup router 30. The lookuphost router 31. The queryprogram router 32. Retry configuration 32.1 Retry rules 32.2 Retry rule examples 32.3 Long-term failures 33. Address rewriting 33.1 Rewriting rules 33.2 Rewriting patterns 33.3 Rewriting replacements 33.4 Flags specifying what to rewrite 33.5 The SMTP-time rewriting flag 33.6 Flags controlling the rewriting process 33.7 The additional relay checking flag 33.8 Rewriting examples 34. Customizing error and warning messages 34.1 Customizing error messages 34.2 Customizing warning messages 35. The default configuration file 35.1 Main configuration settings 35.2 Transport configuration settings 35.3 Director configuration settings 35.4 Router configuration settings 35.5 Default retry rule 35.6 Rewriting configuration 36. Multiple user mailboxes 37. Using Exim to handle mailing lists 37.1 Syntax errors in mailing lists 37.2 NFS-mounted mailing lists 37.3 Re-expansion of mailing lists 37.4 Closed mailing lists 38. Virtual domains 38.1 All mail to a given host 38.2 Virtual domains not preserving envelopes 38.3 Virtual domains preserving envelopes 39. Intermittently connected hosts 40. Verification of incoming mail 40.1 Host verification 40.2 Sender verification 40.3 Fixing bad senders 40.4 Header verification 40.5 Receiver verification 41. Other policy controls on incoming mail 41.1 Host checking using RBL 41.2 Other host checking 41.3 Network checking 41.4 Sender checking 41.5 Control of relaying 41.6 Policy checking flowchart 41.7 Customizing prohibition messages 42. System-wide message filtering 42.1 The system message filter 42.2 Per-address filtering 43. SMTP processing 43.1 Outgoing SMTP over TCP/IP 43.2 Errors in outgoing SMTP 43.3 Variable Envelope Return Paths (VERP) 43.4 Incoming SMTP messages over TCP/IP 43.5 The VRFY, EXPN, and DEBUG commands 43.6 The ETRN command 43.7 Outgoing batched SMTP 43.8 Incoming batched SMTP 44. Message processing 44.1 Unqualified addresses 44.2 The UUCP From line 44.3 The Bcc: header 44.4 The Date: header 44.5 The Delivery-date: header 44.6 The Envelope-to: header 44.7 The From: header 44.8 The Message-id: header 44.9 The Received: header 44.10 The Return-path: header 44.11 The Sender: header 44.12 The To: header 44.13 Adding and removing headers 44.14 Constructed addresses 44.15 Case of local parts 44.16 Dots in local parts 44.17 Rewriting addresses 45. Automatic mail processing 45.1 System-wide automatic processing 45.2 Taking copies of mail 45.3 Automatic processing by users 45.4 Simplified vacation processing 46. Log files 46.1 Logging message reception 46.2 Logging deliveries 46.3 Deferred deliveries 46.4 Delivery failures 46.5 Completion 46.6 Other log entries 46.7 Log level 46.8 Message log 47. Day-to-day management 47.1 The panic log 47.2 The reject log 47.3 Log cycling 47.4 Statistics 47.5 What is Exim doing? 47.6 Changing the configuration 47.7 Watching the queue 47.8 Holding domains 48. Exim utilities 48.1 Querying Exim processes 48.2 Summarising the queue 48.3 Extracting log information 48.4 Cycling log files 48.5 Making DBM files 48.6 Individual retry times 48.7 Database maintenance 48.8 Mail statistics 48.9 Mailbox maintenance 49. The Exim monitor 49.1 Running the monitor 49.2 The stripcharts 49.3 Main action buttons 49.4 The log display 49.5 The queue display 49.6 The queue menu 50. Security considerations 50.1 Root privilege 50.2 Reading forward files 50.3 Delivering to local files 50.4 IPv4 source routing 50.5 The VRFY, EXPN, and ETRN commands in SMTP 50.6 Privileged users 50.7 Spool files 50.8 Use of argv[0] 50.9 Use of %f formatting 50.10 Embedded Exim path 50.11 Use of sprintf() 50.12 Use of debug_printf() and log_write() 50.13 Use of strcat() and strcpy() 51. Format of spool files 52. Adding new drivers or lookup types 1. INTRODUCTION "If I have seen further it is by standing on the shoulders of giants." (Isaac Newton) Exim is a mail transfer agent (MTA) for Unix systems connected to the Internet. Configuration files currently exist for the following operating systems: AIX, BSDI, DGUX, Digital UNIX, FreeBSD, HI-OSF (Hitachi), HP-UX, IRIX, Linux, MIPS RISCOS, NetBSD, OpenBSD, QNX, SCO, SCO SVR4.2 (aka UNIX-SV), SunOS4, SunOS5, Ultrix, and Unixware. However, code is not available for determining system load averages under Ultrix. The terms and conditions for the use and distribution of Exim are contained in the file NOTICE. Exim is distributed under the terms of the GNU General Public Licence, a copy of which may be found in the file LICENCE. 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 user interfaces are taken from Smail 3, though the actual code of Exim is entirely new. I am indebted to my colleague Piete Brooks for suggesting and implementing the scheme for building Exim for multiple architectures and operating systems, for porting Exim to several different versions of Unix, and for numerous sugges- tions when I was first developing it. Many other people, both in Cambridge and around the world, have contributed to the development and the testing of Exim, and to porting it to various operating systems. I am grateful to them all. This edition of the Exim specification applies to version 2.10 of Exim. Substantive changes from the 2.00 edition are marked by bars in the right margin, except in the Texinfo version of the documentation, because Texinfo doesn't support change bars. Minor corrections and rewordings are not so marked. As the program is still developing, there may be features in later versions of the program that have not yet made it into this document, which is updated only when there is a reasonable batch of changes to make. However, all changes are noted briefly in the distributed file called doc/ChangeLog, and specifi- cations of new features that are not in this manual are placed in doc/NewStuff. 1.1 Web site and Mailing list There is a web site at http://www.exim.org by courtesy of Planet Online Ltd, | who are situated in the UK. The site is mirrored in the USA at | http://www.us.exim.org by courtesy of Shore.Net. Planet Online also run the | following mailing lists: exim-users@exim.org general discussion list exim-users-digest@exim.org digest form of exim-users exim-announce@exim.org moderated, low volume announcements list Messages that are sent to the announcements list are automatically copied to the main list, and thence to the digest list. You should therefore join only one list. Requests to be added to or deleted from the mailing lists should be sent to exim-users-request@exim.org, exim-users-digest-request@exim.org, or exim-announce-request@exim.org, respectively. By courtesy of Martin Hamilton, there is an archive of the exim-users list in plain text form at http://www.roads.lut.ac.uk/lists/exim-users/exim- users.archive and in HTML via Hypermail at http://www.roads.lut.ac.uk/lists/exim-users/. The list is also forwarded to http://www.egroups.com/list/exim-users, which is | an archiving system with searching capabilities. 1.2 Availability The current release of Exim is always to be found in ftp://ftp.cus.cam.ac.uk/pub/software/programs/exim/exim-n.nn.tar.gz where n.nn is the highest such version number in the directory. When there is only a small amount of change from one version to the next, a patch file may be provided, with a final component name of the form exim-patch-n.nn-m.mm.gz The main distribution contains ASCII versions of this specification and other documentation; other formats of the documents are available in separate files: ftp://ftp.cus.cam.ac.uk/pub/software/programs/exim/exim-html-n.nn.tar.gz ftp://ftp.cus.cam.ac.uk/pub/software/programs/exim/exim-pdf-n.nn.tar.gz ftp://ftp.cus.cam.ac.uk/pub/software/programs/exim/exim-postscript-n.nn.tar.gz ftp://ftp.cus.cam.ac.uk/pub/software/programs/exim/exim-texinfo-n.nn.tar.gz These tar files contain only the /doc directory, not the complete distribution. An FAQ is available in two different formats from | | ftp://ftp.cus.cam.ac.uk/pub/software/programs/exim/FAQ.txt.gz | ftp://ftp.cus.cam.ac.uk/pub/software/programs/exim/FAQ.html.gz | | The FAQ and other documentation is also available online at the web site. | There is a directory called ftp://ftp.cus.cam.ac.uk/pub/software/programs/exim/Contrib/ which contains miscellaneous files contributed to the Exim community by Exim users, and there is also a collection of contributed configuration examples in | | ftp://ftp.cus.cam.ac.uk/pub/software/programs/exim/config.samples.tar.gz | | There are a number of sites that maintain mirrors of the Exim ftp directory. Those that I know about are listed in the file ftp://ftp.cus.cam.ac.uk/pub/software/programs/exim/Mirrors 1.3 Limitations . 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 fourteen 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 straightfor- ward 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. These are then qualified on arrival. . The only external transport currently implemented is an SMTP transport over a TCP/IP network (using sockets, including experimental support for IPv6). However, a pipe transport is available, and there are facilities for writing messages to files and pipes, optionally in "batched SMTP" format; these facilities can be used to send messages to some other transport mechanism such as UUCP, provided it can handle domain-style addresses. Batched SMTP input is also catered for. 1.4 Features These are some of the main features of Exim: . Exim follows the same general approach of decentralized control that Smail 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. . Exim has flexible retry algorithms, applicable to directing and routing addresses as well as to delivery. . Exim contains header and envelope rewriting facilities. . Unqualified addresses are accepted only from specified hosts or networks. . Exim can perform multiple deliveries down the same SMTP channel after deliveries have been delayed. . Exim can be configured to do local deliveries immediately but to leave remote (SMTP) deliveries until the message is picked up by a queue-runner process. This increases the likelihood of multiple messages being sent down a single SMTP connection. . Remote deliveries of the same message to different hosts can optionally be done in parallel. . Incoming SMTP messages start delivery as soon as they are received, without waiting for the SMTP call to close. . Perl-compatible regular expressions are available in a number of con- figuration parameters. . It is also possible to build Exim with an embedded Perl interpreter, | allowing arbitrary Perl code to be run in certain circumstances. | . Domain lists can include file lookups, making it possible to support very large numbers of local domains. . Exim supports optional checking of incoming return path (sender) and receiver addresses as they are received by SMTP. . SMTP calls from specific machines, optionally from specific idents, can be locked out, and incoming SMTP messages from specific senders can also be locked out. Exim also supports the use of the Realtime Blocking List (RBL). . Hosts that are permitted to relay mail through a machine to another external domain can be controlled by IP number or IP network number. Relay control by recipient domain and sender address is also available. . Messages on the queue can be 'frozen' and 'thawed' by the administrator. . Exim can handle a number of independent local domains on the same machine; each domain can have its own alias files, etc. This facility is sometimes known as 'virtual domains'. . Exim stats a user's home directory before looking for a .forward file, in order to detect the case of a missing NFS mount. Delivery is delayed if the directory is unavailable. . Exim contains an optional built-in mail filtering facility. This can be configured to allow users to provide personal filter files, and it is also possible for a system-wide filter file to be applied to every message. . Periodic warnings are automatically sent to messages' senders when delivery is delayed - the time between warnings is configurable. The warnings can be made conditional on the contents of the message. . A queue run can be manually started to deliver just a particular portion of the queue, or those messages with a recipient whose address contains a given string. There is support for the ETRN command in SMTP to interface to this. . Exim can be configured to run as root all the time, except when performing local deliveries, which it always does in a separate process under an appropriate uid and gid. Alternatively, it can be configured to run as root only when needed; in particular, it need not run as root when receiving incoming messages or when sending out messages over SMTP. See chapter 50 for a discussion of security issues. . I have tried to make the wording of delivery failure messages clearer and simpler, for the benefit of those less-experienced people who are now using email. Alternative wording for these messages can be provided in a separate file. . The Exim Monitor is an optional extra; it displays information about Exim's processing in an X window, and an administrator can perform a number of control actions from the window interface. However, all such actions are also available from the command line interface. 1.5 Support for IPv6 The current IP protocol is more strictly called IPv4. IPv6 is the next generation of IP protocol; it is currently in an experimental state. A number of vendors have released IPv6 versions of their systems and libraries. If Exim is built with HAVE_IPV6 set, it uses the IPv6 API for TCP/IP input and output. IP addresses can be given in IPv6 as well as IPv4 notation; incoming IPv4 calls use the embedded IPv6 address notation. Currently, Exim cannot discover for itself the addresses of the host's IPv6 interfaces (at least, not on Solaris 2 - I don't know the position on other systems) so the local_interfaces option must always be used to list them explicitly, in order to prevent mail looping. See the file README.IPV6 for general information about the current state of IPv6 support in Exim. 1.6 Calling interface Like many MTAs, Exim has adopted the Sendmail interface so that it can be a straight replacement for /usr/lib/sendmail. All the relevant Sendmail options are implemented, with two reservations. There are also some additional options that are compatible with Smail 3, and some further options that are new to Exim. The -t option, for taking a list of recipients from a message's headers, is documented (for Sendmail) as suppressing delivery to any addresses on the command line. However, it appears that this is not the case in practice. For this reason, Exim has an option called extract_addresses_remove_arguments which controls its behaviour in this regard. Sendmail uses the -bi option as a request to rebuild the alias file. As Exim does not have the concept of a single alias file, it cannot mimic this behaviour. It can be configured to run a particular script when this option is received; otherwise the option is ignored. The runtime configuration is held in a single text file which is divided into a number of sections. The entries in this file consist of keywords and values, in the style of Smail 3 configuration files. A default configuration file which is suitable for simple installations is provided in the distribution. Control of messages on the queue can be done via certain privileged command line options. There is also an optional monitor program called eximon, which displays current information in an X window, and contains a menu interface to Exim's command line administration options. 1.7 Terminology The term "local part", which is taken from RFC 822, is used to refer to that part of an email address that precedes the @ sign. The part that follows the @ sign is called the "domain" or "mail domain". The word "domain" is sometimes used to mean all but the first component of a machine's name. It is not used in that sense here, where it normally refers to the part of an email address following the @ sign. "Local domains" are mail domains for which the current host is responsible; in other words, it has special knowledge of what to do with messages sent to such domains, and normally that means using the local part of the address either to deliver the message on the local host or to transform the address using an alias file or something similar. All other domains are "remote domains", whose appearance normally causes the message to be transmitted to some other host. The distinction between local and remote domains is not always entirely clear- cut, since a host can have special knowledge about routing for remote domains, and messages for local domains may under some circumstances be passed to other hosts. The terms "local delivery" and "remote delivery" are used to distinguish delivery to a file or a pipe on the local machine from delivery by SMTP to some remote machine. The type of delivery does not necessarily correspond to the type of address. Mail for a local domain may get passed on to some other host, while mail for a remote domain might get delivered locally to a file or pipe for onward transmission by some other means. However, these are special cases. The term "mailmaster" is used to refer to the person in charge of maintaining the mail software on a given computer. Commonly this will be the same person who fulfils the postmaster role, but this may not always be the case. The term "queue" is used to refer to the set of messages awaiting delivery, because this term is in widespread use in the context of MTAs. However, in Exim's case the reality is more like a pool than a queue, because there is normally no ordering of waiting messages. The term "queue-runner" is used to describe a process that scans the queue and attempts to deliver those messages whose retry times have come. This term is used by other MTAs, and also relates to the command runq, but in Exim the waiting messages are normally processed in an unpredictable order. 2. INCORPORATED CODE A number of pieces of external code are included in the Exim distribution. . Regular expressions are supported in the main Exim program and in the Exim monitor using the freely-distributable PCRE library, copyright (c) 1998 University of Cambridge. The source is distributed in the directory src/pcre. . RFC 1413 callbacks are supported in the main Exim program using the libident library made freely available by Peter Eriksson at ftp.lysator.liu.se. Some modifications have been made in order to support IPv6. The source is distributed in the directory called src/libident. . Support for the cdb (Constant DataBase) lookup method is provided by code contributed by Nigel Metheringham of Planet Online Ltd. which contains the following statements: _________________________________________________________________________ Copyright (c) 1998 Nigel Metheringham, Planet Online Ltd This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This code implements Dan Bernstein's Constant DataBase (cdb) spec. Information, the spec and sample code for cdb can be obtained from http://www.pobox.com/~djb/cdb.html. This implementation borrows some code from Dan Bernstein's implementation (which has no license restrictions applied to it). _________________________________________________________________________ The implementation is completely contained within the code of Exim. It does not link against an external cdb library. . The Exim Monitor program, which is an X-Window application, includes modified versions of the Athena StripChart and TextPop widgets. This code is copyright by DEC and MIT, and their permission notice appears below, in accordance with the conditions expressed therein. ______________________________________________________________________________ Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, and the Massachusetts Institute of Technology, Cambridge, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or MIT not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ______________________________________________________________________________ 3. HOW EXIM DELIVERS MAIL 3.1 Philosophy Exim is designed to work efficiently on systems that are permanently connected to the Internet and are handling a general mix of mail. In such circumstances, most messages can be delivered immediately. Consequently, Exim does not maintain independent queues of messages for specific domains or hosts, though it does try to send several messages in a single SMTP connection after a host has been down, and it also maintains per-host retry information. 3.2 Message reception When Exim receives a message, it writes two files in its spool directory. The first contains the "envelope" information, the current status of the message, and the headers, while the second contains the body of the message. The envelope information consists of the address of the message's sender and the address(es) of the recipient(s). This information is entirely separate from any addresses contained in the headers. The status of the message includes a list of recipients who have already received the message. The format of the first spool file is described in chapter 51. Any header rewriting that is specified in the configuration (see chapter 33) is done once and for all at the time the message is received. It is also possible to specify the addition or removal of certain headers at the time the message is delivered (see chapters 15 and 20). Every message handled by Exim is given a "message id" which is sixteen characters long. It is divided into three parts, separated by hyphens. Each part is a sequence of letters and digits, representing a number in base 62: . The first six characters are the time the message was received, as a number in seconds - the normal Unix way of representing a time of day. If the clock goes backwards (due to resetting) in a process that is receiving more than one message, the later time is retained. . After the first hyphen, the next six characters are the id of the process that received the message. . The final two characters, after the second hyphen, are used to ensure uniqueness of the id. There are two different formats: (a) If the host_number option is not set, uniqueness is required only within the local host. This portion of the id is '00' except when a process receives more than one message in a single second, when the number is incremented for each additional message. (b) If the host_number option is set, uniqueness among a set of hosts is required. This portion of the id is set to the base 62 encoding of * 256 + where is the count of messages received by the current process within the current second. As the maximum value of the host number is 255, this allows for a maximum value of 14 for the sequence number. If this limit is reached, a delay of one second is imposed before reading the next message, in order to allow the clock to tick and the sequence number to get reset. The names of the two spool files consist of the message id, followed by -H for the file containing the envelope and headers, and -D for the data file. By default all these spool files are held in a single directory called "input" inside the general Exim spool directory. Some operating systems do not perform very well if the number of files in a directory gets very large; to improve performance in such cases there is an option that causes Exim to split up the input files into 62 sub-directories whose names are single letters or digits. Exim can be configured not to start a delivery process automatically when a message is received; this can be unconditional, or depend on the number of incoming SMTP connections or the system load (where available). In these situations, new messages wait on the queue until a queue-runner process picks them up, but normally delivery is started as soon as a message is received. 3.3 Life of a message A message remains in the spool directory until it is completely delivered to its recipients or to an error address, or until it is deleted by an administrator or by the user who originally created it. In cases when delivery cannot proceed - for example, when a message can neither be delivered to its recipients nor returned to its sender, the message is marked 'frozen' on the spool, and no more deliveries are attempted. An administrator can 'thaw' such messages when the problem has been corrected, and can also freeze individual messages by hand if necessary. In addition, an administrator can force a delivery error, causing an error message to be sent. There is also an auto_thaw option, which can be used to cause Exim to retry frozen messages after a certain time. When this is set, no message will remain on the queue for ever, because the delivery timeout will eventually be reached. Delivery failure messages that reach this timeout are discarded. As delivery proceeds, Exim writes timestamped information about each address to a per-message log file; this includes any delivery error messages. This log is solely for the benefit of the administrator, and is normally deleted with the spool files when processing of a message is complete. However, Exim can be configured to retain it (a dangerous option, as the files can accumulate rapidly on a busy system). Exim also writes delivery messages to its main log file, whose contents are described in chapter 46. All the information Exim itself needs to set up a delivery is kept in the first spool file with the headers. When a successful delivery occurs, the address is immediately written at the end of a journal file, whose name is the message id followed by -J. At the end of a delivery run, if there are some addresses left to be tried again later, the first spool file is updated to indicate which these are, and the journal file is then deleted. Updating the spool file is done by writing a new file and renaming it, to minimize the possibility of data loss. Should the system or the program crash after a successful delivery but before the spool file has been updated, the journal is left lying around. The next time Exim attempts to deliver the message it reads the journal file and updates the spool file before proceeding. This minimizes the chances of double deliveries caused by crashes. 3.4 Drivers The main delivery processing elements of Exim are called directors, routers, and transports, and collectively these are known as drivers. Code for a number of them is provided, compile-time options specify which ones are included in the binary, and runtime options specify which ones are actually used. A transport is a driver that transmits a copy of the message from Exim's spool to some destination. There are two kinds of transport: for a local transport, the destination is a file or a pipe on the local host, while for a remote transport the destination is some other host. A message is passed to a specific transport as a result of successful directing or routing. If a message has several recipients, it may be passed to a number of different transports. A director is a driver that operates on a local address, either determining how its delivery should happen, or converting the address into one or more new addresses (for example, via an alias file). A local address is one whose domain matches an entry in the list given in the local_domains option, or has been determined to be local by a router - see below. The fact that an address is local does not imply that the message has to be delivered locally; it can be directed either to a local or to a remote transport. A router is a driver that operates on an apparently remote address, that is an address whose domain does not match anything in the list given in local_domains. When a router succeeds it can route an address either to a local or to a remote transport, or it can change the domain, and pass the address on to subsequent routers. In exceptional cases, a router may determine that an address is local after all, and cause it to be passed to the directors. This happens automatically if a host lookup expands an abbreviated domain into one that is local; it can also be made to happen if an MX record points to the local host. This is the only case in which the directors are used to process an address that may not match anything in local_domains. The diagram below illustrates the relation- ship between the three kinds of driver. address | |<---------- new address -------- V | ----------------- | | matches | | ------- no ----| local_domains |--- yes ------- | | | option? | | | V ----------------- V | ----------- ------------ | | routers |--- local after all ------------->| directors |--- ----------- ------------- | ------------- | ---------------->| transport |<---------------- | queues | ------------- As new features have been added to Exim, the distinction between routers and directors has become less clear-cut than it once was. However, since a typical configuration has a number of directors and routers, checking the domain against local_domains once at the start does use fewer resources than checking it for each of them. 3.5 Delivery in detail When a message is to be delivered, the sequence of events is roughly as follows: . If a system-wide filter file is specified, the message is passed to it. The filter may add recipients to the message, replace the recipients, discard the message, cause a new message to be generated, or cause the message delivery to fail. This facility is intended as a weapon against mail bombs and unsolicited mail. The format of the filter file is the same as for user filter files, described in the separate document entitled "Exim's User interface to mail filtering". Some additional features are available in system filters - see chapter 42 for details. Note that a message is passed to the system filter only once per delivery attempt, however many recipients it has. However, if there are several delivery attempts because one or more addresses could not be immediately delivered, the system filter is run each time. The filter condition first_delivery can be used to detect this. . Each recipient address is parsed and a check is made to see if it is local, by comparing the domain with the list in the local_domains option. This can contain wildcards and file lookups. . If an address is local, it is passed to each configured director in turn until one is able to handle it. If none can, the address is failed. Directors can be targeted at particular local domains, so several local domains can be processed entirely independently of each other. . A director that accepts an address may set up a local or a remote transport for it. The transport is not run at this time; the address is placed on a queue for the particular transport, to be run later. Alternatively, the director may generate one or more new addresses (typically from alias, forward, or filter files). New addresses are fed back into this process from the top, but in order to avoid loops, a director ignores any address which has an identically-named ancestor that was processed by itself. . If an address is not local, it is passed to each configured router in turn until one is able to handle it. If none can, the address is failed. . A router that accepts an address may set up a transport for it, or may pass an altered address to subsequent routers, or it may discover that the address is a local address after all. This typically happens when a partial domain name is used and (for example) the DNS lookup is configured to try to extend such names. In this case, the address is passed to the directors. Exim can be configured to do this for any domain whose lowest MX record points to the local host. . Routers normally set up remote transports for messages that are to be delivered to other machines. However, a router can pass a message to a local transport, and by this means such messages can be routed to other transport mechanisms via pipes or files. . When all the directing and routing is done, addresses that have been successfully handled are passed to their assigned transports. When local transports are doing real local deliveries, they handle only one address at a time, but if a local transport is being used as a pseudo-remote transport (for example, to collect batched SMTP messages for transmission by some other means) multiple addresses can be handled. Remote transports can always handle more than one address at once, but can be configured not to do so, or to restrict multiple addresses to the same domain. . Each local delivery runs in a separate process under a non-privileged uid, and they are run in sequence. Exim can be configured so that remote deliveries run under a uid that is private to Exim, instead of running as root. By default the remote deliveries run one at a time in the main Exim process, but a configuration option is available to allow multiple remote deliveries for a single message to be run simultaneously, each in its own sub-process. . When it is doing a queue run, Exim checks its retry database to see if there has been a previous temporary delivery failure for the address before running any local transport. If it finds one, it does not attempt a new delivery until the retry time for the address is reached. This does not happen for delivery attempts that are not part of a queue run, so local deliveries are always attempted when delivery immediately follows message reception. . Remote transports do their own retry handling, since an address may be deliverable to one of a number of hosts, each of which may have a different retry time. If there have been previous failures and no host has reached its retry time, no delivery is attempted, whether in a queue run or not. See chapter 32 for details of retry strategies. . If there were any errors, a message is returned to an appropriate address (the sender in the common case), with details of the error for each failing address. Exim can be configured to send copies of error messages to other addresses. . If one or more addresses suffered a temporary failure, the message is left on the queue, to be tried again later. Otherwise the spool files and message log are deleted, though the message log can optionally be preserved if required. Delivery is said to be "deferred" when the message remains on the queue for a subsequent delivery attempt after a temporary failure. Such messages get processed again by queue-runner processes that are periodically started, either by an Exim daemon or via cron. Temporary failures may be detected during routing and directing as well as during the transport stage. Exim uses a set of configured rules to determine when next to retry the failing address (see chapter 32). These rules also specify when Exim should give up trying to deliver to the address, at which point it generates a failure report. When a delivery is not part of a queue run (typically an immediate delivery on receipt of a message), the directors are always run for local addresses, and local deliveries are always attempted, even if retry times are set for them. This makes for better behaviour if one particular message is causing problems (for example, causing quota overflow, or provoking an error in a filter file). If such a delivery suffers a temporary failure, the retry data gets updated as usual, for use by the next queue-runner process. When a message cannot be delivered to some or all of its intended recipients, a delivery failure report is generated. All the addresses that failed in a given delivery attempt are listed in a single failure report. If a message has many recipients, it is possible for some addresses to fail in one delivery attempt and others to fail subsequently, giving rise to more than one failure report for a single message. The wording of delivery failure reports can be customized by the administrator. See chapter 34 for details. Delivery failure messages contain an X-Failed-Recipients: header, listing all failed addresses, for the benefit of programs that try to analyse such messages automatically. A failure report is normally sent to the sender of the original message, as obtained from the message's envelope. For incoming SMTP messages, this is the address given in the MAIL FROM command. However, when an address is expanded via a forward or alias file, an alternative address can be specified for delivery failures of the generated addresses. For a mailing list expansion (see chapter 37) it is common to direct failure reports to the manager of the list. If a failure report (either locally generated or received from a remote host) itself suffers a delivery failure, the message is left on the queue, but is 'frozen', awaiting the attention of an administrator. There are options which can be used to make Exim discard such failure reports, or to keep them for only a short time. 3.6 Temporary delivery failures There are many reasons why a message may not be immediately deliverable to a particular address. Failure to connect to a remote machine (because it, or the connection to it, is down) is one of the most common. Local deliveries may also be delayed if NFS files are unavailable, or if a mailbox is on a file system where the user is over quota. Exim can be configured to impose its own quotas on local mailboxes; where system quotas are set they will also apply. A machine that is connected to the Internet can normally deliver most mail straight away (the usual figure for Cambridge is 98%). In its default configuration, Exim starts a delivery process whenever it receives a message, and usually this completes the entire delivery. This is a lightweight approach, avoiding the need for any centralized queue managing software. There are those who argue that a central message manager would be able to batch up messages for the same host and send them in a single SMTP call. I do not myself believe this would occur much in general, unless messages were significantly delayed in order to create a batch. However, if a host is unreachable for a period of time, a number of messages may be waiting for it by the time it recovers, and sending them in a single SMTP connection is clearly beneficial. Whenever a delivery to a remote host is deferred, Exim makes a note in its hints database, and whenever a successful SMTP delivery has happened, it looks to see if any other messages are waiting for the same host. If any are found, they are sent over the same SMTP connection, subject to a configuration limit as to the maximum number in any one connection. 4. BUILDING AND INSTALLING EXIM 4.1 Unpacking Exim is distributed as a gzipped tar file which, when upacked, creates a directory with the name of the current release (for example, exim-2.10) into which the following files are placed: LICENCE the GNU General Public Licence Makefile top-level make file NOTICE conditions for the use of Exim README list of files, directories and simple build instructions Other files whose names begin with README may also be present. The following subdirectories are created: OS OS-specific files doc documentation files exim_monitor source files for the Exim monitor scripts scripts used in the build process src remaining source files util independent utilities Some utilities are contained in the src directory, and are built with the Exim binary; those distributed in the util directory are things like the log file analyser, which do not depend on any compile-time configuration. 4.2 Multiple machine architectures and operating systems The building process for Exim is arranged to make it easy to build binaries for a number of different architectures and operating systems from the same set of source files. Compilation does not take place in the src directory. Instead, a "build directory" is created for each architecture and operating system. Symbolic links to the sources are installed in this directory, which is where the actual building takes place. In most cases, Exim can discover the machine architecture and operating system for itself, but the defaults can be overridden if necessary. 4.3 DBM libraries Licensed versions of Unix normally contain a library of DBM functions operating via the 'ndbm' interface, and this is what Exim expects by default. Free versions of Unix seem to vary in what they contain as standard. In particular, some versions of Linux have no default DBM library, and different | distributors have chosen to bundle different libraries with their packaged | versions. However, the more recent releases seem to have standardised on the | Berkeley DB library. | Different DBM libraries have different conventions for naming the files they use. When a program opens a file called dbmfile, there are four possibilities: (1) A traditional ndbm implementation, such as that supplied as part of Solaris 2, operates on two files called dbmfile.dir and dbmfile.pag. (2) The GNU library, gdbm, operates on a single file, but makes two different hard links to it with names dbmfile.dir and dbmfile.pag. (3) The Berkeley DB package, if called via its ndbm compatibility interface, operates on a single file called dbmfile.db, but otherwise looks to the programmer exactly the same as the traditional ndbm implementation. (4) If the Berkeley package is used in its native mode, it operates on a single file called dbmfile; the programmer's interface is somewhat different to the traditional ndbm interface. Exim and its utilities can be compiled to use any of these interfaces. By default it assumes an interface of type (1), though some operating system configuration files default to assuming (4). In order to use the Berkeley DB package in native mode, it is necessary to set USE_DB in an appropriate configuration file, and it may also be necessary to set DBMLIB, for example, DBMLIB = -ldb By avoiding the translation from one interface to another, some resources may be saved. To complicate things further, there are now two very different versions of the Berkeley DB package. Version 1.85 has been stable for quite some time, but the latest versions are numbered 2.x. Release 2 is very different internally and externally from the 1.85 release. Both versions of Berkeley DB can be obtained from http://www.sleepycat.com/ | but maintenance of version 1.85 is being phased out, and it may not compile on some systems. There is further discussion about the various DBM libraries in the file doc/dbm.discuss.txt. 4.4 Pre-building configuration Before building Exim, a local configuration file that specifies options independent of any operating system has to be created with the name Local/Makefile. A template for this file is supplied as the file src/EDITME, and it contains full descriptions of all the option settings therein. Default values are supplied for all of them except for those that specify the locations of the runtime configuration file and the directory for holding Exim binaries. These must be given, as Exim will not build without them. There are | a few parameters that can be specified either at build time or at run time to | enable the same binary to be used on a number of different machines. However, | if the locations of Exim's spool directory and log file directory (if not within the spool directory) are fixed, it is recommended that you specify them in Local/Makefile instead of at run time so that errors detected early in Exim's execution (such as a malformed configuration file) can be logged. If you are going to build the Exim monitor, a similar configuration process is required. The file exim_monitor/EDITME must be edited appropriately for your installation and saved under the name Local/eximon.conf. If you are happy with the default settings described in exim_monitor/EDITME, then Local/eximon.conf can be empty, but it must exist. This is all the configuration that is needed in straightforward cases for known operating systems. However, the building process is set up so that it is easy to override options that are set by default or by operating-system- specific configuration files, for example to change the name of the C compiler, which defaults to gcc. See section 4.8 below for details of how to do this. 4.5 Use of tcpwrappers Exim can be linked with the tcpwrappers library in order to check incoming SMTP calls using the tcpwrappers control files. This may be a convenient alternative to Exim's own checking facilities for installations that are already making use of tcpwrappers for other purposes. To do this, you should set USE_TCP_WRAPPERS in Local/Makefile, arrange for the file tcpd.h to be | available at compile time, and also ensure that the library libwrap.a is | available at link time, typically by including '-lwrap' in EXTRALIBS. For | example, if tcpwrappers is installed in /usr/local, you might have | | USE_TCP_WRAPPERS=yes | CFLAGS=-O -I/usr/local/include | EXTRALIBS=-L/usr/local/lib -lwrap | | in Local/Makefile. The name to use in the tcpwrappers control files is 'exim'. | For example, the line | | exim : LOCAL 192.168.0. .friendly.domain | | in your /etc/hosts.allow file allows connections from the local host, from the | subnet 192.168.0.0/24, and from all hosts in *.friendly.domain. All other | connections are denied. Consult the tcpwrappers documentation for further | details. | 4.6 Including support for IPv6 Exim contains experimental code for use on systems that have IPv6 support. The file README.IPV6 contains information on the current status of IPv6 in Exim. Setting HAVE_IPV6=YES in Local/Makefile causes the IPv6 code to be included; it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS. 4.7 The building process Once Local/Makefile (and Local/eximon.conf, if required) have been created, run "make" at the top level. It determines the architecture and operating system types, and creates a build directory if one does not exist. For example, on a Sun system running Solaris 2.5.1, the directory build- SunOS5-5.5.1-sparc is created. Symbolic links to relevant source files are installed in the build directory. If this is the first time "make" has been run, it calls a script which builds a make file inside the build directory, using the configuration files from the Local directory. The new make file is then passed to another instance of "make" which does the real work, building a number of utility scripts, and then compiling and linking the binaries for the Exim monitor (if configured), a number of utilities, and finally Exim itself. The command "make makefile" can be used to force a rebuild of the make file in the build directory, should this ever be necessary. If you have problems building Exim, check for any comments there may be in the README file concerning your operating system, and also take a look at the FAQ, where some common problems are covered. 4.8 Overriding build-time options for Exim The main make file that is created at the beginning of the building process consists of the concatenation of a number of files which set configuration values, followed by a fixed set of "make" instructions. If a value is set more than once, the last setting overrides any previous ones. This provides a convenient way of overriding defaults. The files that are concatenated are, in order: OS/Makefile-Default OS/Makefile- Local/Makefile Local/Makefile- Local/Makefile- Local/Makefile-- OS/Makefile-Base where is the operating system type and is the architecture type. Local/Makefile is required to exist, and the building process fails if it is absent. The other three Local files are optional, and are often not needed. The values used for and are obtained from scripts called scripts/os-type and scripts/arch-type respectively. If either of the environ- ment variables OSTYPE or ARCHTYPE is set, their values are used, thereby providing a means of forcing particular settings. Otherwise, the scripts try various ad hoc methods of determining these values. You can run these scripts directly from the shell in order to find out what values are being used on your system. OS/Makefile-Default contains comments about the variables that are set therein. Some (but not all) are mentioned below. If there is something that needs changing, review the contents of this file and the contents of the make file for your operating system (OS/Makefile-) to see what the default values are. If you need to change any of the values that are set in OS/Makefile-Default or in OS/Makefile-, or to add any new definitions, do so by putting the new values in an appropriate Local file. For example, to specify that the C compiler is called cc rather than gcc when compiling in the OSF1 operating system, and that it is to be to be called with the flag -std1, create a file called Local/Makefile-OSF1 containing the lines CC=cc CFLAGS=-std1 This makes it easy to transfer your configuration settings to new versions of Exim simply by copying the contents of the Local directory. Exim contains support for doing LDAP, NIS, and NIS+ lookups, but not all systems have these components installed, so the default is not to include the relevant code in the binary. All the different kinds of file and database lookup that Exim supports are implemented as separate code modules which are included only if the relevant compile-time options are set. In the case of LDAP, NIS, and NIS+, the settings for Local/Makefile are: LOOKUP_LDAP=yes LOOKUP_NIS=yes LOOKUP_NISPLUS=yes In all cases the relevant include files and interface libraries need to be installed before compiling Exim. When a lookup type is not included in the binary, attempts to configure Exim to use it cause configuration errors. Another optional lookup type is cdb, which is included in the binary only if LOOKUP_CDB=yes is set. In this case, the code is entirely contained within Exim, and no external include files or libraries are required. Exim can be linked with an embedded Perl interpreter, allowing Perl subrou- | tines to be called during string expansion. To enable this facility, | | EXIM_PERL=perl.o | | must be defined in Local/Makefile. Details of this facility are given in | chapter 10. | The location of the X11 libraries is something that varies a lot between operating systems, and of course there are different versions of X11 to cope with. The following three variables are set in OS/Makefile-Default: X11=/usr/X11R5 XINCLUDE=-I$(X11)/include XLFLAGS=-L$(X11)/lib These are overridden in some of the operating-system configuration files. For example, in OS/Makefile-SunOS5 there is X11=/usr/openwin XINCLUDE=-I$(X11)/include XLFLAGS=-L$(X11)/lib -R$(X11)/lib If you need to override the default setting for your operating system, place a definition of all three of these variables into your Local/Makefile- file. If you need to add any extra libraries to the link steps, these can be put in a variable called EXTRALIBS, which appears in all the link commands, but by default is not defined. There is also DBMLIB, which appears in the link commands for binaries that use DBM functions (see also section 4.3). Finally, there is EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor binary, and which can be used, for example, to include additional X11 libraries. Another variable which is not normally defined is STDERR_FILE. This defines a file to which debugging output is written if the -df flag is set, and is of use when running Exim under inetd. Yet another variable which should not normally be needed is ERRNO_QUOTA. Exim needs to know which error the operating system gives when writing to a file fails because the user is over quota. POSIX specifies an error called EDQUOT and this is present in the latest versions of all the systems Exim has been ported to at the time of writing. However, it is not present in earlier versions of SunOS5, which use ENOSPC instead. The code of Exim defaults to using EDQUOT if it is defined, and ENOSPC otherwise. You should set ERRNO_QUOTA only if your system uses some completely different error code. The make file copes with rebuilding Exim correctly if any of the configuration files are edited. However, if an optional configuration file is deleted, it is necessary to touch the associated non-optional file (that is, Local/Makefile or Local/eximon.conf) before rebuilding. 4.9 OS-specific header files The OS directory contains a number of files with names of the form os.h-. These are system-specific C header files that should not normally need to be changed. There is a list of macro settings that are recognized in the file OS/os.configuring, which should be consulted if you are porting Exim to a new operating system. 4.10 Overriding build-time options for the monitor A similar process is used for overriding things when building the Exim monitor, where the files that are involved are OS/eximon.conf-Default OS/eximon.conf- Local/eximon.conf Local/eximon.conf- Local/eximon.conf- Local/eximon.conf-- As with Exim itself, the final three files need not exist, and in this case the OS/eximon.conf- file is also optional. The default values in OS/eximon.conf-Default can be overridden dynamically by setting environment variables of the same name, preceded by EXIMON_. For example, setting EXIMON_LOG_DEPTH in the environment overrides the value of LOG_DEPTH at run time. 4.11 Installing commands and scripts The script scripts/exim_install copies binaries and utility scripts into the directory whose name is specified by the BIN_DIRECTORY setting in Local/Makefile. Files are copied only if they are newer than any versions already in the binary directory, and old versions are renamed by adding the suffix .O to their names. The command "make install" runs the exim_install script with no arguments. It can be run independently with arguments specifying which files are to be copied, from within a build directory. For example, (cd build-SunOS5-sparc; ../scripts/exim_install exim) copies just the main binary file. The main exim binary is required to be owned by root and setuid, for normal configurations. In some special cases (for | example, if a host is doing no local deliveries) is is possible to run Exim in | other ways. If the binary is run by a root process, the effect is the same as | if it were setuid root. The install script tries to set root as the owner of | the main binary, and to make it setuid. It should therefore normally be run as root. If you want to see what the script will do before running it for real, use the -n option (for which root is not needed): (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n) Exim's runtime configuration file is named by the CONFIGURE_FILE setting in Local/Makefile. If this file does not exist, then the default configuration file src/configure.default is copied there by the installation script. If a runtime configuration file already exists, it is left alone. The default | configuration uses the local host's name as the only local domain, and is set | up to do local deliveries into the shared directory /var/mail, running as the | local user. Aliases in /etc/aliases and .forward files in users' home | directories are supported, but no NIS or NIS+ support is configured. Remote | domains are routed using the DNS, with delivery over SMTP. | | 4.12 Installing info documentation | | Not all systems use the GNU info system for documentation, and for this | reason, the Texinfo source of Exim's documentation is not included in the main | distribution. Instead it is available separately from the ftp site (see | section 1.2). | | If you have defined INFO_DIRECTORY in Local/Makefile and the Texinfo source of | the documentation is found in the source tree, then running "make install" | automatically builds the info files and installs them. | 4.13 Setting up the spool directory When it starts up, Exim tries to create its spool directory if it does not exist. If a specific Exim uid and gid are specified, these are used for the owner and group of the spool directory. Sub-directories are automatically created in the spool directory as necessary. 4.14 Testing Having installed Exim, you can check that the runtime configuration file is syntactically valid by running the command exim -bV If there are any errors in the configuration file, Exim will output error messages. Otherwise it just outputs the version number and build date. Some simple routing tests can be done by using the address testing option. For example, exim -v -bt should verify that it recognizes a local mailbox, and exim -v -bt a remote one. Then try getting it to deliver mail, both locally and remotely. This can be done by passing messages directly to Exim, without going through a user agent. For example: exim postmaster@your.domain From: user@your.domain To: postmaster@your.domain Subject: Testing Exim This is a test message. ^D If you encounter problems, look at Exim's log files (mainlog and paniclog) to see if there is any relevant information there. Another source of information is running Exim with debugging turned on, by specifying the -d option. The larger the number after -d (up to 9), the more information is output. With -d2, for example, the sequence of directors or routers that process an address is output. If there's a message stuck on Exim's spool, you can force a delivery with debugging turned on by a command of the form exim -d9 -M One specific problem that has shown up on some sites is the inability to do local deliveries into a single shared mailbox directory that does not have the 'sticky bit' set on it. By default, Exim tries to create a lock file before writing to a mailbox file, and if it cannot create the lock file, the delivery is deferred. You can get round this either by setting the 'sticky bit' on the directory, or by setting a specific group for local deliveries and allowing that group to create files in the directory (see the comments above the local_delivery transport in the default configuration file). Another approach is to configure Exim not to use lock files, but just to rely on fcntl() locking instead. However, you should do this only if all user agents also use fcntl() locking. For further discussion of locking issues, see chapter 16. One thing that cannot be tested on a system that is already running a mailer is the receipt of incoming SMTP mail on the standard SMTP port. However, the -oX option can be used to run an Exim daemon that listens on some other port, or inetd can be used to do this. Testing a new version on a system that is already running Exim can most easily be done by building a binary with a different CONFIGURE_FILE setting. From within the runtime configuration, all other file and directory names that Exim uses can be altered, in order to keep it entirely clear of the production version. 4.15 Switching Exim on Building and installing Exim does not of itself put it in general use. The name by which the system message transfer agent is called by mail user agents is /usr/lib/sendmail, and it is necessary to make this name point to the exim binary in order to get them to use it. This is normally done by renaming any existing file and making /usr/lib/sendmail a symbolic link to the exim binary. It is then necessary to stop and restart the mailer daemon, if one is running. | 4.16 Exim on heavily loaded hosts | | If you are running Exim on a heavily loaded host you should consider | installing a current release of bind (from http://www.isc.org) as caching | nameserver, either locally or on a nearby host with fast communications. You | should also consider enabling Exim's split_spool_directory if you expect to | have large numbers of messages awaiting delivery. | 4.17 Stopping Exim on Solaris 2 The standard command for stopping the mailer daemon on Solaris 2 is /etc/init.d/sendmail stop If /usr/lib/sendmail has been turned into a symbolic link, this script fails to stop Exim because it uses the command ps -e and greps the output for the text 'sendmail'; this is not present because the actual program name (that is, 'exim') is given by the ps command with these options. A fix that appears to work on Solaris 2.5 and above is to change the script so that the ps command reads ps -e -o pid,comm which causes the name by which the daemon was started (that is, /usr/lib/sendmail) to be output. However, this fails if the daemon has been restarted with SIGHUP because Exim restarts itself using the real file name. A better solution is to replace the line that finds the process id with something like pid=`cat /var/spool/exim/exim-daemon.pid` to obtain the daemon's pid directly from the file that Exim saves it in. See the description of the -bd option for details of where Exim writes the daemon's process id file. 5. THE EXIM COMMAND LINE Exim's command line takes the standard Unix form of a sequence of options, each starting with a hyphen character, followed by a number of arguments. The options are compatible with the main options of Sendmail, and there are also some additional options, some of which are compatible with Smail 3. Certain combinations of options do not make sense, and provoke an error if used. The form of the arguments depends on which options are set. 5.1 Setting options by program name If Exim is called under the name mailq, it behaves as if the option -bp were present before any other options. This is for compatibility with some systems that contain a command of that name in one of the standard libraries, symbolically linked to /usr/lib/sendmail. If Exim is called under the name rsmtp it behaves as if the option -bS were present before any other options, for compatibility with smail. The -bS option is used for reading in a number of messages in batched SMTP format. If Exim is called under the name rmail it behaves as if the -i and -oee options were present before any other options, for compatibility with smail. The name rmail is used as an interface by some UUCP systems. If Exim is called under the name runq it behaves as if the option -q were present before any other options, for compatibility with smail. The -q option causes a single queue-runner process to be started. If Exim is called under the name newaliases it behaves as if the option -bi were present before any other options, for compatibility with Sendmail. This option is used for rebuilding Sendmail's alias file. Exim does not have the concept of a single alias file, but can be configured to run a given command if called with the -bi option. 5.2 Trusted and admin users Some Exim options are available only to "trusted users" and others are available only to "admin users". . A trusted user is root or the Exim user (if defined) or any user listed in the trusted_users configuration option, or any user for whom the currently set group is one of those listed in the trusted_groups configuration option. Trusted users are permitted to use the -f option to specify the senders of messages that are passed to Exim through the local interface, and also to specify host names, host addresses, protocol names, and ident values. Thus they are able to insert messages into Exim's queue locally that have the characteristics of messages received from a remote host. . An admin user is root or the Exim user (if defined) or any user that is a member of the Exim group (if defined). The current group does not have to be the Exim group. Admin users are permitted to operate on messages in the queue, for example, to force delivery failures. It is also necessary to be an admin user in order to see the full information provided by the Exim monitor. By default, the use of the -M and -q options to cause Exim to attempt delivery of messages on its queue is restricted to admin users. However, this restriction can be relaxed by setting the prod_requires_admin option false (that is, specifying no_prod_requires_admin). Similarly, the use of the -bp option to list all the messages in the queue is restricted to admin users unless queue_list_requires_admin is set false. 5.3 Command line options The command options are described in alphabetical order below. -- This is a pseudo-option whose only purpose is to terminate the options and therefore to cause subsequent command line items to be treated as arguments rather than options, even if they begin with hyphens. -bd Run Exim as a daemon, awaiting incoming SMTP connections. This option can be used only by an admin user. If either of the -d or -dm options are set, the daemon does not disconnect from the controlling terminal. By default, Exim listens for incoming connections on all the host's interfaces, but it can be restricted to specific interfaces by setting the local_interfaces option in the configuration file. The standard SMTP port is used, but this can be varied by means of the daemon_smtp_service configuration option or the -oX command line option. Most commonly, the -bd option is combined with the -q