Add { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} } as another
[exim.git] / doc / doc-docbook / spec.xfpt
CommitLineData
8c44ad5f 1. $Cambridge: exim/doc/doc-docbook/spec.xfpt,v 1.10 2006/07/24 11:55:15 fanf2 Exp $
9b371988
PH
2.
3. /////////////////////////////////////////////////////////////////////////////
4. This is the primary source of the Exim Manual. It is an xfpt document that is
5. converted into DocBook XML for subsequent conversion into printing and online
6. formats. The markup used herein is "standard" xfpt markup, with some extras.
7. The markup is summarized in a file called Markup.txt.
8. /////////////////////////////////////////////////////////////////////////////
9
10.include stdflags
11.include stdmacs
12.docbook
13.book
14
15. /////////////////////////////////////////////////////////////////////////////
16. These definitions set some parameters and save some typing. Remember that
17. the <bookinfo> element must also be updated for each new edition.
18. /////////////////////////////////////////////////////////////////////////////
19
20.set ACL "access control lists (ACLs)"
c0712871
PH
21.set previousversion "4.61"
22.set version "4.62"
9b371988
PH
23
24
25. /////////////////////////////////////////////////////////////////////////////
26. Additional xfpt markup used by this document, over and above the default
27. provided in the xfpt library.
28. /////////////////////////////////////////////////////////////////////////////
29
30. --- Override the &$ flag to automatically insert a $ with the variable name
31
32.flag &$ $& "<varname>$" "</varname>"
33
34. --- Short flags for daggers in option headings. They will always be inside
35. --- an italic string, but we want the daggers to be roman.
36
37.flag &!! "</emphasis>&dagger;<emphasis>"
38.flag &!? "</emphasis>&Dagger;<emphasis>"
39
40. --- A macro for an Exim option definition heading, generating a one-line
41. --- table with four columns.
42
43.macro option
44.oindex "$1"
45.itable all 0 0 4 8* left 5* center 5* center 6* right
46.row "&%$1%&" "Use: &'$2'&" "Type: &'$3'&" "Default: &'$4'&"
47.endtable
48.endmacro
49
50. --- A macro for the common 2-column tables. The width of the first column
51. --- is suitable for the many tables at the start of the main options chapter;
52. --- the small number of other 2-column tables override it.
53
4f578862 54.macro table2 190pt 260pt
9b371988
PH
55.itable none 0 0 2 $1 left $2 left
56.endmacro
57
4f578862
PH
58. --- Macros for the concept and option index entries. For a "range" style of
59. --- entry, use .scindex for the start and .ecindex for the end. The first
60. --- argument of .scindex and the only argument of .ecindex must be the ID
61. --- that ties them together.
9b371988
PH
62
63.macro cindex
64&<indexterm role="concept">&
65&<primary>&$1&</primary>&
66.arg 2
67&<secondary>&$2&</secondary>&
68.endarg
69&</indexterm>&
70.endmacro
71
4f578862
PH
72.macro scindex
73&<indexterm role="concept" id="$1" class="startofrange">&
74&<primary>&$2&</primary>&
75.arg 3
76&<secondary>&$3&</secondary>&
77.endarg
78&</indexterm>&
79.endmacro
80
81.macro ecindex
82&<indexterm role="concept" startref="$1" class="endofrange"/>&
83.endmacro
84
9b371988
PH
85.macro oindex
86&<indexterm role="option">&
87&<primary>&$1&</primary>&
88.arg 2
89&<secondary>&$2&</secondary>&
90.endarg
91&</indexterm>&
92.endmacro
93
94.macro index
95.echo "** Don't use .index; use .cindex or .oindex"
96.endmacro
97. ////////////////////////////////////////////////////////////////////////////
98
99
100. ////////////////////////////////////////////////////////////////////////////
101. The <bookinfo> element is removed from the XML before processing for Ascii
102. output formats.
103. ////////////////////////////////////////////////////////////////////////////
104
105.literal xml
106<bookinfo>
107<title>Specification of the Exim Mail Transfer Agent</title>
108<titleabbrev>The Exim MTA</titleabbrev>
c0712871 109<date>27 April 2006</date>
9b371988
PH
110<author><firstname>Philip</firstname><surname>Hazel</surname></author>
111<authorinitials>PH</authorinitials>
112<affiliation><orgname>University of Cambridge Computing Service</orgname></affiliation>
113<address>New Museums Site, Pembroke Street, Cambridge CB2 3QH, England</address>
114<revhistory><revision>
c0712871
PH
115 <revnumber>4.62</revnumber>
116 <date>27 April 2006</date>
9b371988
PH
117 <authorinitials>PH</authorinitials>
118</revision></revhistory>
119<copyright><year>2006</year><holder>University of Cambridge</holder></copyright>
120</bookinfo>
121.literal off
122
123
124. /////////////////////////////////////////////////////////////////////////////
125. This chunk of literal XML implements index entries of the form "x, see y" and
126. "x, see also y". However, the DocBook DTD doesn't allow <indexterm> entries
127. at the top level, so we have to put the .chapter directive first.
128. /////////////////////////////////////////////////////////////////////////////
129
130.chapter "Introduction"
131.literal xml
132
168e428f
PH
133<indexterm role="concept">
134 <primary>$1, $2, etc.</primary>
135 <see><emphasis>numerical variables</emphasis></see>
136</indexterm>
137<indexterm role="concept">
138 <primary>address</primary>
139 <secondary>rewriting</secondary>
140 <see><emphasis>rewriting</emphasis></see>
141</indexterm>
142<indexterm role="concept">
068aaea8
PH
143 <primary>Bounce Address Tag Validation</primary>
144 <see><emphasis>BATV</emphasis></see>
145</indexterm>
146<indexterm role="concept">
147 <primary>Client SMTP Authorization</primary>
148 <see><emphasis>CSA</emphasis></see>
149</indexterm>
150<indexterm role="concept">
168e428f
PH
151 <primary>CR character</primary>
152 <see><emphasis>carriage return</emphasis></see>
153</indexterm>
154<indexterm role="concept">
155 <primary>CRL</primary>
156 <see><emphasis>certificate revocation list</emphasis></see>
157</indexterm>
158<indexterm role="concept">
159 <primary>delivery</primary>
160 <secondary>failure report</secondary>
161 <see><emphasis>bounce message</emphasis></see>
162</indexterm>
163<indexterm role="concept">
164 <primary>dialup</primary>
165 <see><emphasis>intermittently connected hosts</emphasis></see>
166</indexterm>
167<indexterm role="concept">
168 <primary>exiscan</primary>
169 <see><emphasis>content scanning</emphasis></see>
170</indexterm>
171<indexterm role="concept">
172 <primary>failover</primary>
173 <see><emphasis>fallback</emphasis></see>
174</indexterm>
175<indexterm role="concept">
176 <primary>fallover</primary>
177 <see><emphasis>fallback</emphasis></see>
178</indexterm>
179<indexterm role="concept">
180 <primary>filter</primary>
181 <secondary>Sieve</secondary>
182 <see><emphasis>Sieve filter</emphasis></see>
183</indexterm>
184<indexterm role="concept">
185 <primary>ident</primary>
186 <see><emphasis>RFC 1413</emphasis></see>
187</indexterm>
188<indexterm role="concept">
189 <primary>LF character</primary>
190 <see><emphasis>linefeed</emphasis></see>
191</indexterm>
192<indexterm role="concept">
193 <primary>maximum</primary>
194 <see><emphasis>limit</emphasis></see>
195</indexterm>
196<indexterm role="concept">
068aaea8
PH
197 <primary>monitor</primary>
198 <see><emphasis>Exim monitor</emphasis></see>
199</indexterm>
200<indexterm role="concept">
168e428f
PH
201 <primary>no_<emphasis>xxx</emphasis></primary>
202 <see>entry for xxx</see>
203</indexterm>
204<indexterm role="concept">
205 <primary>NUL</primary>
206 <see><emphasis>binary zero</emphasis></see>
207</indexterm>
208<indexterm role="concept">
209 <primary>passwd file</primary>
210 <see><emphasis>/etc/passwd</emphasis></see>
211</indexterm>
212<indexterm role="concept">
213 <primary>process id</primary>
214 <see><emphasis>pid</emphasis></see>
215</indexterm>
216<indexterm role="concept">
217 <primary>RBL</primary>
218 <see><emphasis>DNS list</emphasis></see>
219</indexterm>
220<indexterm role="concept">
221 <primary>redirection</primary>
222 <see><emphasis>address redirection</emphasis></see>
223</indexterm>
224<indexterm role="concept">
225 <primary>return path</primary>
226 <seealso><emphasis>envelope sender</emphasis></seealso>
227</indexterm>
228<indexterm role="concept">
229 <primary>scanning</primary>
230 <see><emphasis>content scanning</emphasis></see>
231</indexterm>
232<indexterm role="concept">
233 <primary>SSL</primary>
234 <see><emphasis>TLS</emphasis></see>
235</indexterm>
236<indexterm role="concept">
237 <primary>string</primary>
238 <secondary>expansion</secondary>
239 <see><emphasis>expansion</emphasis></see>
240</indexterm>
241<indexterm role="concept">
242 <primary>top bit</primary>
243 <see><emphasis>8-bit characters</emphasis></see>
244</indexterm>
245<indexterm role="concept">
246 <primary>variables</primary>
247 <see><emphasis>expansion, variables</emphasis></see>
248</indexterm>
249<indexterm role="concept">
250 <primary>zero, binary</primary>
251 <see><emphasis>binary zero</emphasis></see>
252</indexterm>
9b371988
PH
253
254.literal off
168e428f
PH
255
256
9b371988
PH
257. /////////////////////////////////////////////////////////////////////////////
258. This is the real start of the first chapter. See the comment above as to why
259. we can't have the .chapter line here.
260. chapter "Introduction"
261. /////////////////////////////////////////////////////////////////////////////
168e428f
PH
262
263Exim is a mail transfer agent (MTA) for hosts that are running Unix or
264Unix-like operating systems. It was designed on the assumption that it would be
265run on hosts that are permanently connected to the Internet. However, it can be
266used on intermittently connected hosts with suitable configuration adjustments.
267
268Configuration files currently exist for the following operating systems: AIX,
068aaea8
PH
269BSD/OS (aka BSDI), Darwin (Mac OS X), DGUX, Dragonfly, FreeBSD, GNU/Hurd,
270GNU/Linux, HI-OSF (Hitachi), HI-UX, HP-UX, IRIX, MIPS RISCOS, NetBSD, OpenBSD,
271OpenUNIX, QNX, SCO, SCO SVR4.2 (aka UNIX-SV), Solaris (aka SunOS5), SunOS4,
272Tru64-Unix (formerly Digital UNIX, formerly DEC-OSF1), Ultrix, and Unixware.
273Some of these operating systems are no longer current and cannot easily be
274tested, so the configuration files may no longer work in practice.
168e428f
PH
275
276There are also configuration files for compiling Exim in the Cygwin environment
277that can be installed on systems running Windows. However, this document does
278not contain any information about running Exim in the Cygwin environment.
279
280The terms and conditions for the use and distribution of Exim are contained in
9b371988
PH
281the file &_NOTICE_&. Exim is distributed under the terms of the GNU General
282Public Licence, a copy of which may be found in the file &_LICENCE_&.
168e428f
PH
283
284The use, supply or promotion of Exim for the purpose of sending bulk,
285unsolicited electronic mail is incompatible with the basic aims of the program,
286which revolve around the free provision of a service that enhances the quality
287of personal communications. The author of Exim regards indiscriminate
288mass-mailing as an antisocial, irresponsible abuse of the Internet.
289
290Exim owes a great deal to Smail 3 and its author, Ron Karr. Without the
291experience of running and working on the Smail 3 code, I could never have
292contemplated starting to write a new MTA. Many of the ideas and user interfaces
293were originally taken from Smail 3, though the actual code of Exim is entirely
294new, and has developed far beyond the initial concept.
295
296Many people, both in Cambridge and around the world, have contributed to the
297development and the testing of Exim, and to porting it to various operating
298systems. I am grateful to them all. The distribution now contains a file called
9b371988 299&_ACKNOWLEDGMENTS_&, in which I have started recording the names of
168e428f
PH
300contributors.
301
302
9b371988
PH
303.section "Exim documentation"
304.new
305.cindex "documentation"
306This edition of the Exim specification applies to version &version; of Exim.
307Substantive changes from the &previousversion; edition are marked in some
168e428f
PH
308renditions of the document; this paragraph is so marked if the rendition is
309capable of showing a change indicator.
9b371988 310.wen
168e428f
PH
311
312This document is very much a reference manual; it is not a tutorial. The reader
313is expected to have some familiarity with the SMTP mail transfer protocol and
314with general Unix system administration. Although there are some discussions
315and examples in places, the information is mostly organized in a way that makes
316it easy to look up, rather than in a natural order for sequential reading.
317Furthermore, the manual aims to cover every aspect of Exim in detail, including
318a number of rarely-used, special-purpose features that are unlikely to be of
319very wide interest.
320
9b371988
PH
321.cindex "books about Exim"
322An &"easier"& discussion of Exim which provides more in-depth explanatory,
323introductory, and tutorial material can be found in a book entitled &'The Exim
324SMTP Mail Server'&, published by UIT Cambridge
325(&url(http://www.uit.co.uk/exim-book/)).
168e428f
PH
326
327This book also contains a chapter that gives a general introduction to SMTP and
328Internet mail. Inevitably, however, the book is unlikely to be fully up-to-date
329with the latest release of Exim. (Note that the earlier book about Exim,
330published by O'Reilly, covers Exim 3, and many things have changed in Exim 4.)
331
9b371988 332.cindex "Debian" "information sources"
068aaea8
PH
333If you are using a Debian distribution of Exim, you will find information about
334Debian-specific features in the file
9b371988
PH
335.display
336&_/usr/share/doc/exim4-base/README.Debian_&
337.endd
338The command &(man update-exim.conf)& is another source of Debian-specific
068aaea8
PH
339information.
340
9b371988
PH
341.cindex "&_doc/NewStuff_&"
342.cindex "&_doc/ChangeLog_&"
343.cindex "change log"
168e428f
PH
344As the program develops, there may be features in newer versions that have not
345yet made it into this document, which is updated only when the most significant
346digit of the fractional part of the version number changes. Specifications of
347new features that are not yet in this manual are placed in the file
9b371988 348&_doc/NewStuff_& in the Exim distribution.
168e428f 349
9b371988 350Some features may be classified as &"experimental"&. These may change
168e428f
PH
351incompatibly while they are developing, or even be withdrawn. For this reason,
352they are not documented in this manual. Information about experimental features
9b371988 353can be found in the file &_doc/experimental.txt_&.
168e428f
PH
354
355All changes to the program (whether new features, bug fixes, or other kinds of
9b371988 356change) are noted briefly in the file called &_doc/ChangeLog_&.
168e428f 357
9b371988
PH
358.cindex "&_doc/spec.txt_&"
359This specification itself is available as an ASCII file in &_doc/spec.txt_& so
360that it can easily be searched with a text editor. Other files in the &_doc_&
168e428f
PH
361directory are:
362
9b371988
PH
363.table2 100pt
364.row &_OptionLists.txt_& "list of all options in alphabetical order"
365.row &_dbm.discuss.txt_& "discussion about DBM libraries"
366.row &_exim.8_& "a man page of Exim's command line options"
367.row &_experimental.txt_& "documentation of experimental features"
368.row &_filter.txt_& "specification of the filter language"
369.row &_pcrepattern.txt_& "specification of PCRE regular expressions"
370.row &_pcretest.txt_& "specification of the PCRE testing program"
371.row &_Exim3.upgrade_& "upgrade notes from release 2 to release 3"
372.row &_Exim4.upgrade_& "upgrade notes from release 3 to release 4"
373.endtable
168e428f
PH
374
375The main specification and the specification of the filtering language are also
376available in other formats (HTML, PostScript, PDF, and Texinfo). Section
9b371988 377&<<SECTavail>>& below tells you how to get hold of these.
168e428f
PH
378
379
380
9b371988
PH
381.section "FTP and web sites"
382.cindex "web site"
383.cindex "FTP site"
068aaea8 384The primary site for Exim source distributions is currently the University of
9b371988
PH
385Cambridge's FTP site, whose contents are described in &'Where to find the Exim
386distribution'& below. In addition, there is a web site and an FTP site at
387&%exim.org%&. These are now also hosted at the University of Cambridge. The
388&%exim.org%& site was previously hosted for a number of years by Energis
389Squared, formerly Planet Online Ltd, whose support I gratefully acknowledge.
390
391.cindex "wiki"
392.cindex "FAQ"
168e428f 393As well as Exim distribution tar files, the Exim web site contains a number of
9b371988
PH
394differently formatted versions of the documentation, including the FAQ in both
395text and HTML formats. The HTML version comes with a keyword-in-context index.
396A recent addition to the online information is the Exim wiki
397(&url(http://www.exim.org/eximwiki/)). We hope that this will make it easier
398for Exim users to contribute examples, tips, and know-how for the benefit of
399others.
168e428f
PH
400
401
402
9b371988
PH
403.section "Mailing lists"
404.cindex "mailing lists" "for Exim users"
168e428f
PH
405The following are the three main Exim mailing lists:
406
9b371988
PH
407.table2 140pt
408.row &'exim-users@exim.org'& "general discussion list"
409.row &'exim-dev@exim.org'& "discussion of bugs, enhancements, etc."
410.row &'exim-announce@exim.org'& "moderated, low volume announcements list"
411.endtable
168e428f
PH
412
413You can subscribe to these lists, change your existing subscriptions, and view
9b371988
PH
414or search the archives via the mailing lists link on the Exim home page.
415.cindex "Debian" "mailing list for"
4f578862
PH
416If you are using a Debian distribution of Exim, you may wish to subscribe to
417the Debian-specific mailing list &'pkg-exim4-users@lists.alioth.debian.org'&.
9b371988
PH
418
419.section "Exim training"
420.cindex "training courses"
068aaea8 421From time to time (approximately annually at the time of writing), training
9b371988
PH
422courses are run by the author of Exim in Cambridge, UK. Details of any
423forthcoming courses can be found on the web site
424&url(http://www-tus.csx.cam.ac.uk/courses/exim/).
168e428f
PH
425
426
9b371988
PH
427.section "Bug reports"
428.cindex "bug reports"
429.cindex "reporting bugs"
430Reports of obvious bugs should be emailed to &'bugs@exim.org'&. However, if you
431are unsure whether some behaviour is a bug or not, the best thing to do is to
432post a message to the &'exim-dev'& mailing list and have it discussed.
168e428f
PH
433
434
435
9b371988
PH
436.section "Where to find the Exim distribution" "SECTavail"
437.cindex "FTP site"
438.cindex "distribution" "ftp site"
168e428f 439The master ftp site for the Exim distribution is
9b371988
PH
440.display
441&*ftp://ftp.csx.cam.ac.uk/pub/software/email/exim*&
442.endd
168e428f 443This is mirrored by
9b371988
PH
444.display
445&*ftp://ftp.exim.org/pub/exim*&
446.endd
447The file references that follow are relative to the &_exim_& directories at
448these sites. There are now quite a number of independent mirror sites around
449the world. Those that I know about are listed in the file called &_Mirrors_&.
450
451Within the &_exim_& directory there are subdirectories called &_exim3_& (for
452previous Exim 3 distributions), &_exim4_& (for the latest Exim 4
453distributions), and &_Testing_& for testing versions. In the &_exim4_&
168e428f 454subdirectory, the current release can always be found in files called
9b371988
PH
455.display
456&_exim-n.nn.tar.gz_&
457&_exim-n.nn.tar.bz2_&
458.endd
459where &'n.nn'& is the highest such version number in the directory. The two
168e428f 460files contain identical data; the only difference is the type of compression.
9b371988 461The &_.bz2_& file is usually a lot smaller than the &_.gz_& file.
168e428f 462
9b371988
PH
463.cindex "distribution" "signing details"
464.cindex "distribution" "public key"
465.cindex "public key for signed distribution"
168e428f
PH
466The distributions are currently signed with Philip Hazel's GPG key. The
467corresponding public key is available from a number of keyservers, and there is
9b371988 468also a copy in the file &_Public-Key_&. The signatures for the tar bundles are
168e428f 469in:
9b371988
PH
470.display
471&_exim-n.nn.tar.gz.sig_&
472&_exim-n.nn.tar.bz2.sig_&
473.endd
168e428f 474For each released version, the log of changes is made separately available in a
9b371988 475separate file in the directory &_ChangeLogs_& so that it is possible to
168e428f
PH
476find out what has changed without having to download the entire distribution.
477
9b371988 478.cindex "documentation" "available formats"
168e428f
PH
479The main distribution contains ASCII versions of this specification and other
480documentation; other formats of the documents are available in separate files
9b371988
PH
481inside the &_exim4_& directory of the FTP site:
482.display
483&_exim-html-n.nn.tar.gz_&
484&_exim-pdf-n.nn.tar.gz_&
485&_exim-postscript-n.nn.tar.gz_&
486&_exim-texinfo-n.nn.tar.gz_&
487.endd
488These tar files contain only the &_doc_& directory, not the complete
489distribution, and are also available in &_.bz2_& as well as &_.gz_& forms.
490.cindex "FAQ"
168e428f 491The FAQ is available for downloading in two different formats in these files:
9b371988
PH
492.display
493&_exim4/FAQ.txt.gz_&
494&_exim4/FAQ.html.tar.gz_&
495.endd
168e428f
PH
496The first of these is a single ASCII file that can be searched with a text
497editor. The second is a directory of HTML files, normally accessed by starting
9b371988 498at &_index.html_&. The HTML version of the FAQ (which is also included in the
168e428f
PH
499HTML documentation tarbundle) includes a keyword-in-context index, which is
500often the most convenient way of finding your way around.
501
502
9b371988
PH
503.section "Wish list"
504.cindex "wish list"
168e428f
PH
505A wish list is maintained, containing ideas for new features that have been
506submitted. From time to time the file is exported to the ftp site into the file
9b371988 507&_exim4/WishList_&. Items are removed from the list if they get implemented.
168e428f
PH
508
509
510
9b371988
PH
511.section "Contributed material"
512.cindex "contributed material"
513At the ftp site, there is a directory called &_Contrib_& that contains
168e428f
PH
514miscellaneous files contributed to the Exim community by Exim users. There is
515also a collection of contributed configuration examples in
9b371988
PH
516&_exim4/config.samples.tar.gz_&. These samples are referenced from the FAQ.
517
518
519
520.section "Limitations"
521.ilist
522.cindex "limitations of Exim"
523.cindex "bang paths" "not handled by Exim"
524Exim is designed for use as an Internet MTA, and therefore handles addresses in
525RFC 2822 domain format only. It cannot handle UUCP &"bang paths"&, though
526simple two-component bang paths can be converted by a straightforward rewriting
527configuration. This restriction does not prevent Exim from being interfaced to
528UUCP as a transport mechanism, provided that domain addresses are used.
529.next
530.cindex "domainless addresses"
531.cindex "address" "without domain"
168e428f
PH
532Exim insists that every address it handles has a domain attached. For incoming
533local messages, domainless addresses are automatically qualified with a
534configured domain value. Configuration options specify from which remote
535systems unqualified addresses are acceptable. These are then qualified on
536arrival.
9b371988
PH
537.next
538.cindex "transport" "external"
539.cindex "external transports"
540The only external transport mechanisms that are currently implemented are SMTP
541and LMTP over a TCP/IP network (including support for IPv6). However, a pipe
168e428f 542transport is available, and there are facilities for writing messages to files
9b371988
PH
543and pipes, optionally in &'batched SMTP'& format; these facilities can be used
544to send messages to other transport mechanisms such as UUCP, provided they can
545handle domain-style addresses. Batched SMTP input is also catered for.
546.next
547Exim is not designed for storing mail for dial-in hosts. When the volumes of
548such mail are large, it is better to get the messages &"delivered"& into files
168e428f
PH
549(that is, off Exim's queue) and subsequently passed on to the dial-in hosts by
550other means.
9b371988
PH
551.next
552Although Exim does have basic facilities for scanning incoming messages, these
168e428f
PH
553are not comprehensive enough to do full virus or spam scanning. Such operations
554are best carried out using additional specialized software packages. If you
555compile Exim with the content-scanning extension, straightforward interfaces to
556a number of common scanners are provided.
9b371988 557.endlist
168e428f
PH
558
559
9b371988 560.section "Run time configuration"
168e428f
PH
561Exim's run time configuration is held in a single text file that is divided
562into a number of sections. The entries in this file consist of keywords and
563values, in the style of Smail 3 configuration files. A default configuration
564file which is suitable for simple online installations is provided in the
9b371988 565distribution, and is described in chapter &<<CHAPdefconfil>>& below.
168e428f
PH
566
567
9b371988
PH
568.section "Calling interface"
569.cindex "Sendmail compatibility" "command line interface"
168e428f 570Like many MTAs, Exim has adopted the Sendmail command line interface so that it
9b371988
PH
571can be a straight replacement for &_/usr/lib/sendmail_& or
572&_/usr/sbin/sendmail_& when sending mail, but you do not need to know anything
168e428f
PH
573about Sendmail in order to run Exim. For actions other than sending messages,
574Sendmail-compatible options also exist, but those that produce output (for
9b371988 575example, &%-bp%&, which lists the messages on the queue) do so in Exim's own
168e428f 576format. There are also some additional options that are compatible with Smail
9b371988 5773, and some further options that are new to Exim. Chapter &<<CHAPcommandline>>&
168e428f
PH
578documents all Exim's command line options. This information is automatically
579made into the man page that forms part of the Exim distribution.
580
581Control of messages on the queue can be done via certain privileged command
9b371988
PH
582line options. There is also an optional monitor program called &'eximon'&,
583which displays current information in an X window, and which contains a menu
168e428f
PH
584interface to Exim's command line administration options.
585
586
587
9b371988
PH
588.section "Terminology"
589.cindex "terminology definitions"
590.cindex "body of message" "definition of"
591The &'body'& of a message is the actual data that the sender wants to transmit.
592It is the last part of a message, and is separated from the &'header'& (see
168e428f
PH
593below) by a blank line.
594
9b371988 595.cindex "bounce message" "definition of"
168e428f 596When a message cannot be delivered, it is normally returned to the sender in a
9b371988
PH
597delivery failure message or a &"non-delivery report"& (NDR). The term
598&'bounce'& is commonly used for this action, and the error reports are often
599called &'bounce messages'&. This is a convenient shorthand for &"delivery
600failure error report"&. Such messages have an empty sender address in the
601message's &'envelope'& (see below) to ensure that they cannot themselves give
602rise to further bounce messages.
603
604The term &'default'& appears frequently in this manual. It is used to qualify a
168e428f
PH
605value which is used in the absence of any setting in the configuration. It may
606also qualify an action which is taken unless a configuration setting specifies
607otherwise.
608
9b371988 609The term &'defer'& is used when the delivery of a message to a specific
168e428f 610destination cannot immediately take place for some reason (a remote host may be
9b371988 611down, or a user's local mailbox may be full). Such deliveries are &'deferred'&
168e428f
PH
612until a later time.
613
9b371988
PH
614The word &'domain'& is sometimes used to mean all but the first component of a
615host's name. It is &'not'& used in that sense here, where it normally refers to
616the part of an email address following the @ sign.
168e428f 617
9b371988
PH
618.cindex "envelope" "definition of"
619.cindex "sender" "definition of"
620A message in transit has an associated &'envelope'&, as well as a header and a
168e428f
PH
621body. The envelope contains a sender address (to which bounce messages should
622be delivered), and any number of recipient addresses. References to the
623sender or the recipients of a message usually mean the addresses in the
624envelope. An MTA uses these addresses for delivery, and for returning bounce
625messages, not the addresses that appear in the header lines.
626
9b371988
PH
627.cindex "message header" "definition of"
628.cindex "header section" "definition of"
629The &'header'& of a message is the first part of a message's text, consisting
630of a number of lines, each of which has a name such as &'From:'&, &'To:'&,
631&'Subject:'&, etc. Long header lines can be split over several text lines by
168e428f
PH
632indenting the continuations. The header is separated from the body by a blank
633line.
634
9b371988
PH
635.cindex "local part" "definition of"
636.cindex "domain" "definition of"
637The term &'local part'&, which is taken from RFC 2822, is used to refer to that
168e428f 638part of an email address that precedes the @ sign. The part that follows the
9b371988 639@ sign is called the &'domain'& or &'mail domain'&.
168e428f 640
9b371988
PH
641.cindex "local delivery" "definition of"
642.cindex "remote delivery" "definition of"
643The terms &'local delivery'& and &'remote delivery'& are used to distinguish
168e428f 644delivery to a file or a pipe on the local host from delivery by SMTP over
068aaea8 645TCP/IP to another host. As far as Exim is concerned, all hosts other than the
9b371988 646host it is running on are &'remote'&.
168e428f 647
9b371988
PH
648.cindex "return path" "definition of"
649&'Return path'& is another name that is used for the sender address in a
168e428f
PH
650message's envelope.
651
9b371988
PH
652.cindex "queue" "definition of"
653The term &'queue'& is used to refer to the set of messages awaiting delivery,
168e428f
PH
654because this term is in widespread use in the context of MTAs. However, in
655Exim's case the reality is more like a pool than a queue, because there is
656normally no ordering of waiting messages.
657
9b371988
PH
658.cindex "queue runner" "definition of"
659The term &'queue runner'& is used to describe a process that scans the queue
168e428f 660and attempts to deliver those messages whose retry times have come. This term
9b371988 661is used by other MTAs, and also relates to the command &%runq%&, but in Exim
168e428f
PH
662the waiting messages are normally processed in an unpredictable order.
663
9b371988
PH
664.cindex "spool directory" "definition of"
665The term &'spool directory'& is used for a directory in which Exim keeps the
666messages on its queue &-- that is, those that it is in the process of
168e428f 667delivering. This should not be confused with the directory in which local
9b371988
PH
668mailboxes are stored, which is called a &"spool directory"& by some people. In
669the Exim documentation, &"spool"& is always used in the first sense.
168e428f
PH
670
671
672
673
674
675
9b371988
PH
676. ////////////////////////////////////////////////////////////////////////////
677. ////////////////////////////////////////////////////////////////////////////
168e428f 678
9b371988
PH
679.chapter "Incorporated code"
680.cindex "incorporated code"
681.cindex "regular expressions" "library"
682.cindex "PCRE"
168e428f
PH
683A number of pieces of external code are included in the Exim distribution.
684
9b371988
PH
685.ilist
686Regular expressions are supported in the main Exim program and in the Exim
687monitor using the freely-distributable PCRE library, copyright &copy;
688University of Cambridge. The source is distributed in the directory
689&_src/pcre_&. However, this is a cut-down version of PCRE. If you want to use
690the PCRE library in other programs, you should obtain and install the full
4f578862 691version from &url(ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre).
9b371988
PH
692.next
693.cindex "cdb" "acknowledgement"
168e428f
PH
694Support for the cdb (Constant DataBase) lookup method is provided by code
695contributed by Nigel Metheringham of (at the time he contributed it) Planet
9b371988
PH
696Online Ltd. The implementation is completely contained within the code of Exim.
697It does not link against an external cdb library. The code contains the
698following statements:
699
700.blockquote
701Copyright &copy; 1998 Nigel Metheringham, Planet Online Ltd
702
168e428f
PH
703This program is free software; you can redistribute it and/or modify it under
704the terms of the GNU General Public License as published by the Free Software
705Foundation; either version 2 of the License, or (at your option) any later
706version.
9b371988 707
168e428f
PH
708This code implements Dan Bernstein's Constant DataBase (cdb) spec. Information,
709the spec and sample code for cdb can be obtained from
9b371988
PH
710&url(http://www.pobox.com/~djb/cdb.html). This implementation borrows some
711code from Dan Bernstein's implementation (which has no license restrictions
712applied to it).
713.endblockquote
714.next
715.cindex "SPA authentication"
716.cindex "Samba project"
717.cindex "Microsoft Secure Password Authentication"
718Client support for Microsoft's &'Secure Password Authentication'& is provided
168e428f
PH
719by code contributed by Marc Prud'hommeaux. Server support was contributed by
720Tom Kistner. This includes code taken from the Samba project, which is released
721under the Gnu GPL.
9b371988
PH
722.next
723.cindex "Cyrus"
724.cindex "&'pwcheck'& daemon"
725.cindex "&'pwauthd'& daemon"
726Support for calling the Cyrus &'pwcheck'& and &'saslauthd'& daemons is provided
168e428f
PH
727by code taken from the Cyrus-SASL library and adapted by Alexander S.
728Sabourenkov. The permission notice appears below, in accordance with the
729conditions expressed therein.
9b371988
PH
730
731.blockquote
732Copyright &copy; 2001 Carnegie Mellon University. All rights reserved.
733
168e428f
PH
734Redistribution and use in source and binary forms, with or without
735modification, are permitted provided that the following conditions
736are met:
168e428f 737
9b371988
PH
738.olist
739Redistributions of source code must retain the above copyright
740notice, this list of conditions and the following disclaimer.
741.next
742Redistributions in binary form must reproduce the above copyright
168e428f
PH
743notice, this list of conditions and the following disclaimer in
744the documentation and/or other materials provided with the
745distribution.
9b371988
PH
746.next
747The name &"Carnegie Mellon University"& must not be used to
168e428f
PH
748endorse or promote products derived from this software without
749prior written permission. For permission or any other legal
750details, please contact
9b371988 751.display
068aaea8
PH
752 Office of Technology Transfer
753 Carnegie Mellon University
754 5000 Forbes Avenue
755 Pittsburgh, PA 15213-3890
756 (412) 268-4387, fax: (412) 268-7395
757 tech-transfer@andrew.cmu.edu
9b371988
PH
758.endd
759.next
760Redistributions of any form whatsoever must retain the following
168e428f 761acknowledgment:
9b371988
PH
762
763&"This product includes software developed by Computing Services
764at Carnegie Mellon University (&url(http://www.cmu.edu/computing/)."&
765
168e428f
PH
766CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
767THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
768AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
769FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
770WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
771AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
772OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
9b371988
PH
773.endlist
774.endblockquote
168e428f 775
9b371988
PH
776.next
777.cindex "Exim monitor" "acknowledgement"
778.cindex "X-windows"
779.cindex "Athena"
168e428f
PH
780The Exim Monitor program, which is an X-Window application, includes
781modified versions of the Athena StripChart and TextPop widgets.
782This code is copyright by DEC and MIT, and their permission notice appears
783below, in accordance with the conditions expressed therein.
9b371988
PH
784
785.blockquote
168e428f
PH
786Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
787and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
9b371988 788
168e428f 789All Rights Reserved
9b371988 790
168e428f
PH
791Permission to use, copy, modify, and distribute this software and its
792documentation for any purpose and without fee is hereby granted,
793provided that the above copyright notice appear in all copies and that
794both that copyright notice and this permission notice appear in
795supporting documentation, and that the names of Digital or MIT not be
796used in advertising or publicity pertaining to distribution of the
797software without specific, written prior permission.
9b371988 798
168e428f
PH
799DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
800ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
801DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
802ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
803WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
804ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
805SOFTWARE.
9b371988 806.endblockquote
168e428f 807
9b371988
PH
808.next
809Many people have contributed code fragments, some large, some small, that were
168e428f
PH
810not covered by any specific licence requirements. It is assumed that the
811contributors are happy to see their code incoporated into Exim under the GPL.
9b371988 812.endlist
168e428f
PH
813
814
815
816
817
9b371988
PH
818. ////////////////////////////////////////////////////////////////////////////
819. ////////////////////////////////////////////////////////////////////////////
168e428f 820
9b371988
PH
821.chapter "How Exim receives and delivers mail" "" &&&
822 "Receiving and delivering mail"
168e428f
PH
823
824
9b371988
PH
825.section "Overall philosophy"
826.cindex "design philosophy"
168e428f
PH
827Exim is designed to work efficiently on systems that are permanently connected
828to the Internet and are handling a general mix of mail. In such circumstances,
829most messages can be delivered immediately. Consequently, Exim does not
830maintain independent queues of messages for specific domains or hosts, though
831it does try to send several messages in a single SMTP connection after a host
832has been down, and it also maintains per-host retry information.
833
834
9b371988
PH
835.section "Policy control"
836.cindex "policy control" "overview"
168e428f
PH
837Policy controls are now an important feature of MTAs that are connected to the
838Internet. Perhaps their most important job is to stop MTAs being abused as
9b371988
PH
839&"open relays"& by misguided individuals who send out vast amounts of
840unsolicited junk, and want to disguise its source. Exim provides flexible
841facilities for specifying policy controls on incoming mail:
168e428f 842
9b371988
PH
843.ilist
844.cindex "&ACL;" "introduction"
168e428f 845Exim 4 (unlike previous versions of Exim) implements policy controls on
9b371988 846incoming mail by means of &'Access Control Lists'& (ACLs). Each list is a
168e428f
PH
847series of statements that may either grant or deny access. ACLs can be used at
848several places in the SMTP dialogue while receiving a message from a remote
9b371988
PH
849host. However, the most common places are after each RCPT command, and at the
850very end of the message. The sysadmin can specify conditions for accepting or
851rejecting individual recipients or the entire message, respectively, at these
852two points (see chapter &<<CHAPACL>>&). Denial of access results in an SMTP
168e428f 853error code.
9b371988
PH
854.next
855An ACL is also available for locally generated, non-SMTP messages. In this
168e428f 856case, the only available actions are to accept or deny the entire message.
9b371988
PH
857.next
858When Exim is compiled with the content-scanning extension, facilities are
168e428f
PH
859provided in the ACL mechanism for passing the message to external virus and/or
860spam scanning software. The result of such a scan is passed back to the ACL,
861which can then use it to decide what to do with the message.
9b371988
PH
862.next
863When a message has been received, either from a remote host or from the local
168e428f 864host, but before the final acknowledgement has been sent, a locally supplied C
9b371988
PH
865function called &[local_scan()]& can be run to inspect the message and decide
866whether to accept it or not (see chapter &<<CHAPlocalscan>>&). If the message
867is accepted, the list of recipients can be modified by the function.
868.next
869Using the &[local_scan()]& mechanism is another way of calling external scanner
870software. The &%SA-Exim%& add-on package works this way. It does not require
871Exim to be compiled with the content-scanning extension.
872.next
873After a message has been accepted, a further checking mechanism is available in
874the form of the &'system filter'& (see chapter &<<CHAPsystemfilter>>&). This
875runs at the start of every delivery process.
876.endlist
877
878
879
880.section "User filters"
881.cindex "filter" "introduction"
882.cindex "Sieve filter"
168e428f 883In a conventional Exim configuration, users are able to run private filters by
9b371988
PH
884setting up appropriate &_.forward_& files in their home directories. See
885chapter &<<CHAPredirect>>& (about the &(redirect)& router) for the
886configuration needed to support this, and the separate document entitled
887&'Exim's interfaces to mail filtering'& for user details. Two different kinds
888of filtering are available:
889
890.ilist
891Sieve filters are written in the standard filtering language that is defined
168e428f 892by RFC 3028.
9b371988
PH
893.next
894Exim filters are written in a syntax that is unique to Exim, but which is more
168e428f 895powerful than Sieve, which it pre-dates.
9b371988 896.endlist
168e428f
PH
897
898User filters are run as part of the routing process, described below.
899
900
901
9b371988
PH
902.section "Message identification" "SECTmessiden"
903.cindex "message ids" "details of format"
904.cindex "format" "of message id"
905.cindex "id of message"
906.cindex "base62"
907.cindex "base36"
908.cindex "Darwin"
909.cindex "Cygwin"
910Every message handled by Exim is given a &'message id'& which is sixteen
168e428f 911characters long. It is divided into three parts, separated by hyphens, for
9b371988 912example &`16VDhn-0001bo-D3`&. Each part is a sequence of letters and digits,
168e428f
PH
913normally encoding numbers in base 62. However, in the Darwin operating
914system (Mac OS X) and when Exim is compiled to run under Cygwin, base 36
915(avoiding the use of lower case letters) is used instead, because the message
916id is used to construct file names, and the names of files in those systems are
068aaea8 917not always case-sensitive.
168e428f 918
9b371988 919.cindex "pid (process id)" "re-use of"
168e428f
PH
920The detail of the contents of the message id have changed as Exim has evolved.
921Earlier versions relied on the operating system not re-using a process id (pid)
922within one second. On modern operating systems, this assumption can no longer
923be made, so the algorithm had to be changed. To retain backward compatibility,
924the format of the message id was retained, which is why the following rules are
925somewhat eccentric:
926
9b371988
PH
927.ilist
928The first six characters of the message id are the time at which the message
168e428f
PH
929started to be received, to a granularity of one second. That is, this field
930contains the number of seconds since the start of the epoch (the normal Unix
931way of representing the date and time of day).
9b371988
PH
932.next
933After the first hyphen, the next six characters are the id of the process that
168e428f 934received the message.
9b371988
PH
935.next
936There are two different possibilities for the final two characters:
937.olist
938.cindex "&%localhost_number%&"
939If &%localhost_number%& is not set, this value is the fractional part of the
168e428f
PH
940time of reception, normally in units of 1/2000 of a second, but for systems
941that must use base 36 instead of base 62 (because of case-insensitive file
942systems), the units are 1/1000 of a second.
9b371988
PH
943.next
944If &%localhost_number%& is set, it is multiplied by 200 (100) and added to
168e428f
PH
945the fractional part of the time, which in this case is in units of 1/200
946(1/100) of a second.
9b371988
PH
947.endlist
948.endlist
168e428f
PH
949
950After a message has been received, Exim waits for the clock to tick at the
951appropriate resolution before proceeding, so that if another message is
952received by the same process, or by another process with the same (re-used)
953pid, it is guaranteed that the time will be different. In most cases, the clock
954will already have ticked while the message was being received.
955
956
9b371988
PH
957.section "Receiving mail"
958.cindex "receiving mail"
959.cindex "message" "reception"
068aaea8
PH
960The only way Exim can receive mail from another host is using SMTP over
961TCP/IP, in which case the sender and recipient addresses are transferred using
168e428f
PH
962SMTP commands. However, from a locally running process (such as a user's MUA),
963there are several possibilities:
964
9b371988
PH
965.ilist
966If the process runs Exim with the &%-bm%& option, the message is read
168e428f 967non-interactively (usually via a pipe), with the recipients taken from the
9b371988
PH
968command line, or from the body of the message if &%-t%& is also used.
969.next
970If the process runs Exim with the &%-bS%& option, the message is also read
168e428f
PH
971non-interactively, but in this case the recipients are listed at the start of
972the message in a series of SMTP RCPT commands, terminated by a DATA
9b371988 973command. This is so-called &"batch SMTP"& format,
168e428f
PH
974but it isn't really SMTP. The SMTP commands are just another way of passing
975envelope addresses in a non-interactive submission.
9b371988
PH
976.next
977If the process runs Exim with the &%-bs%& option, the message is read
168e428f
PH
978interactively, using the SMTP protocol. A two-way pipe is normally used for
979passing data between the local process and the Exim process.
9b371988 980This is &"real"& SMTP and is handled in the same way as SMTP over TCP/IP. For
168e428f 981example, the ACLs for SMTP commands are used for this form of submission.
9b371988
PH
982.next
983A local process may also make a TCP/IP call to the host's loopback address
168e428f
PH
984(127.0.0.1) or any other of its IP addresses. When receiving messages, Exim
985does not treat the loopback address specially. It treats all such connections
986in the same way as connections from other hosts.
9b371988 987.endlist
168e428f
PH
988
989
9b371988
PH
990.cindex "message sender" "constructed by Exim"
991.cindex "sender" "constructed by Exim"
168e428f
PH
992In the three cases that do not involve TCP/IP, the sender address is
993constructed from the login name of the user that called Exim and a default
9b371988 994qualification domain (which can be set by the &%qualify_domain%& configuration
168e428f
PH
995option). For local or batch SMTP, a sender address that is passed using the
996SMTP MAIL command is ignored. However, the system administrator may allow
9b371988 997certain users (&"trusted users"&) to specify a different sender address
168e428f 998unconditionally, or all users to specify certain forms of different sender
9b371988
PH
999address. The &%-f%& option or the SMTP MAIL command is used to specify these
1000different addresses. See section &<<SECTtrustedadmin>>& for details of trusted
1001users, and the &%untrusted_set_sender%& option for a way of allowing untrusted
168e428f
PH
1002users to change sender addresses.
1003
1004Messages received by either of the non-interactive mechanisms are subject to
1005checking by the non-SMTP ACL, if one is defined. Messages received using SMTP
1006(either over TCP/IP, or interacting with a local process) can be checked by a
1007number of ACLs that operate at different times during the SMTP session. Either
1008individual recipients, or the entire message, can be rejected if local policy
9b371988
PH
1009requirements are not met. The &[local_scan()]& function (see chapter
1010&<<CHAPlocalscan>>&) is run for all incoming messages.
168e428f
PH
1011
1012Exim can be configured not to start a delivery process when a message is
1013received; this can be unconditional, or depend on the number of incoming SMTP
1014connections or the system load. In these situations, new messages wait on the
1015queue until a queue runner process picks them up. However, in standard
1016configurations under normal conditions, delivery is started as soon as a
1017message is received.
1018
1019
1020
1021
1022
9b371988
PH
1023.section "Handling an incoming message"
1024.cindex "spool directory" "files that hold a message"
1025.cindex "file" "how a message is held"
168e428f
PH
1026When Exim accepts a message, it writes two files in its spool directory. The
1027first contains the envelope information, the current status of the message, and
1028the header lines, and the second contains the body of the message. The names of
9b371988
PH
1029the two spool files consist of the message id, followed by &`-H`& for the
1030file containing the envelope and header, and &`-D`& for the data file.
168e428f 1031
9b371988 1032.cindex "spool directory" "&_input_& sub-directory"
168e428f 1033By default all these message files are held in a single directory called
9b371988 1034&_input_& inside the general Exim spool directory. Some operating systems do
c0712871 1035not perform very well if the number of files in a directory gets large; to
9b371988 1036improve performance in such cases, the &%split_spool_directory%& option can be
168e428f 1037used. This causes Exim to split up the input files into 62 sub-directories
c0712871
PH
1038whose names are single letters or digits. &new("When this is done, the queue is
1039processed one sub-directory at a time instead of all at once, which can improve
1040overall performance even when there are not enough files in each directory to
1041affect file system performance.")
168e428f
PH
1042
1043The envelope information consists of the address of the message's sender and
1044the addresses of the recipients. This information is entirely separate from
1045any addresses contained in the header lines. The status of the message includes
1046a list of recipients who have already received the message. The format of the
9b371988 1047first spool file is described in chapter &<<CHAPspool>>&.
168e428f 1048
9b371988 1049.cindex "rewriting" "addresses"
168e428f 1050Address rewriting that is specified in the rewrite section of the configuration
9b371988 1051(see chapter &<<CHAPrewrite>>&) is done once and for all on incoming addresses,
168e428f
PH
1052both in the header lines and the envelope, at the time the message is accepted.
1053If during the course of delivery additional addresses are generated (for
1054example, via aliasing), these new addresses are rewritten as soon as they are
1055generated. At the time a message is actually delivered (transported) further
1056rewriting can take place; because this is a transport option, it can be
1057different for different forms of delivery. It is also possible to specify the
1058addition or removal of certain header lines at the time the message is
9b371988
PH
1059delivered (see chapters &<<CHAProutergeneric>>& and
1060&<<CHAPtransportgeneric>>&).
168e428f
PH
1061
1062
1063
9b371988
PH
1064.section "Life of a message"
1065.cindex "message" "life of"
1066.cindex "message" "frozen"
168e428f
PH
1067A message remains in the spool directory until it is completely delivered to
1068its recipients or to an error address, or until it is deleted by an
1069administrator or by the user who originally created it. In cases when delivery
9b371988
PH
1070cannot proceed &-- for example, when a message can neither be delivered to its
1071recipients nor returned to its sender, the message is marked &"frozen"& on the
168e428f
PH
1072spool, and no more deliveries are attempted.
1073
9b371988
PH
1074.cindex "frozen messages" "thawing"
1075.cindex "message" "thawing frozen"
1076An administrator can &"thaw"& such messages when the problem has been
1077corrected, and can also freeze individual messages by hand if necessary. In
1078addition, an administrator can force a delivery error, causing a bounce message
1079to be sent.
1080
9b371988
PH
1081.cindex "&%timeout_frozen_after%&"
1082.cindex "&%ignore_bounce_errors_after%&"
1083There are options called &%ignore_bounce_errors_after%& and
1084&%timeout_frozen_after%&, which discard frozen messages after a certain time.
068aaea8 1085The first applies only to frozen bounces, the second to any frozen messages.
168e428f 1086
9b371988
PH
1087.cindex "message" "log file for"
1088.cindex "log" "file for each message"
168e428f 1089While Exim is working on a message, it writes information about each delivery
068aaea8 1090attempt to its main log file. This includes successful, unsuccessful, and
9b371988
PH
1091delayed deliveries for each recipient (see chapter &<<CHAPlog>>&). The log
1092lines are also written to a separate &'message log'& file for each message.
1093These logs are solely for the benefit of the administrator, and are normally
1094deleted along with the spool files when processing of a message is complete.
168e428f 1095The use of individual message logs can be disabled by setting
9b371988
PH
1096&%no_message_logs%&; this might give an improvement in performance on very busy
1097systems.
168e428f 1098
9b371988
PH
1099.cindex "journal file"
1100.cindex "file" "journal"
168e428f
PH
1101All the information Exim itself needs to set up a delivery is kept in the first
1102spool file, along with the header lines. When a successful delivery occurs, the
1103address is immediately written at the end of a journal file, whose name is the
9b371988
PH
1104message id followed by &`-J`&. At the end of a delivery run, if there are some
1105addresses left to be tried again later, the first spool file (the &`-H`& file)
168e428f
PH
1106is updated to indicate which these are, and the journal file is then deleted.
1107Updating the spool file is done by writing a new file and renaming it, to
1108minimize the possibility of data loss.
1109
1110Should the system or the program crash after a successful delivery but before
1111the spool file has been updated, the journal is left lying around. The next
1112time Exim attempts to deliver the message, it reads the journal file and
1113updates the spool file before proceeding. This minimizes the chances of double
1114deliveries caused by crashes.
1115
1116
1117
9b371988
PH
1118.section "Processing an address for delivery" "SECTprocaddress"
1119.cindex "drivers" "definition of"
1120.cindex "router" "definition of"
1121.cindex "transport" "definition of"
1122The main delivery processing elements of Exim are called &'routers'& and
1123&'transports'&, and collectively these are known as &'drivers'&. Code for a
168e428f
PH
1124number of them is provided in the source distribution, and compile-time options
1125specify which ones are included in the binary. Run time options specify which
1126ones are actually used for delivering messages.
1127
9b371988
PH
1128.cindex "drivers" "instance definition"
1129Each driver that is specified in the run time configuration is an &'instance'&
168e428f 1130of that particular driver type. Multiple instances are allowed; for example,
9b371988 1131you can set up several different &(smtp)& transports, each with different
168e428f
PH
1132option values that might specify different ports or different timeouts. Each
1133instance has its own identifying name. In what follows we will normally use the
1134instance name when discussing one particular instance (that is, one specific
1135configuration of the driver), and the generic driver name when discussing
1136the driver's features in general.
1137
9b371988 1138A &'router'& is a driver that operates on an address, either determining how
068aaea8 1139its delivery should happen, by assigning it to a specific transport, or
168e428f
PH
1140converting the address into one or more new addresses (for example, via an
1141alias file). A router may also explicitly choose to fail an address, causing it
1142to be bounced.
1143
9b371988
PH
1144A &'transport'& is a driver that transmits a copy of the message from Exim's
1145spool to some destination. There are two kinds of transport: for a &'local'&
168e428f 1146transport, the destination is a file or a pipe on the local host, whereas for a
9b371988 1147&'remote'& transport the destination is some other host. A message is passed
168e428f
PH
1148to a specific transport as a result of successful routing. If a message has
1149several recipients, it may be passed to a number of different transports.
1150
9b371988 1151.cindex "preconditions" "definition of"
168e428f
PH
1152An address is processed by passing it to each configured router instance in
1153turn, subject to certain preconditions, until a router accepts the address or
1154specifies that it should be bounced. We will describe this process in more
068aaea8
PH
1155detail shortly. First, as a simple example, we consider how each recipient
1156address in a message is processed in a small configuration of three routers.
168e428f 1157
068aaea8 1158To make this a more concrete example, it is described in terms of some actual
168e428f
PH
1159routers, but remember, this is only an example. You can configure Exim's
1160routers in many different ways, and there may be any number of routers in a
1161configuration.
1162
1163The first router that is specified in a configuration is often one that handles
1164addresses in domains that are not recognized specially by the local host. These
1165are typically addresses for arbitrary domains on the Internet. A precondition
1166is set up which looks for the special domains known to the host (for example,
9b371988 1167its own domain name), and the router is run for addresses that do &'not'&
168e428f
PH
1168match. Typically, this is a router that looks up domains in the DNS in order to
1169find the hosts to which this address routes. If it succeeds, the address is
068aaea8 1170assigned to a suitable SMTP transport; if it does not succeed, the router is
168e428f
PH
1171configured to fail the address.
1172
068aaea8 1173The second router is reached only when the domain is recognized as one that
9b371988 1174&"belongs"& to the local host. This router does redirection &-- also known as
068aaea8
PH
1175aliasing and forwarding. When it generates one or more new addresses from the
1176original, each of them is routed independently from the start. Otherwise, the
1177router may cause an address to fail, or it may simply decline to handle the
1178address, in which case the address is passed to the next router.
168e428f
PH
1179
1180The final router in many configurations is one that checks to see if the
1181address belongs to a local mailbox. The precondition may involve a check to
1182see if the local part is the name of a login account, or it may look up the
1183local part in a file or a database. If its preconditions are not met, or if
1184the router declines, we have reached the end of the routers. When this happens,
1185the address is bounced.
1186
1187
1188
9b371988
PH
1189.section "Processing an address for verification"
1190.cindex "router" "for verification"
1191.cindex "verifying address" "overview"
168e428f 1192As well as being used to decide how to deliver to an address, Exim's routers
9b371988 1193are also used for &'address verification'&. Verification can be requested as
168e428f 1194one of the checks to be performed in an ACL for incoming messages, on both
9b371988
PH
1195sender and recipient addresses, and it can be tested using the &%-bv%& and
1196&%-bvs%& command line options.
168e428f 1197
9b371988 1198When an address is being verified, the routers are run in &"verify mode"&. This
168e428f
PH
1199does not affect the way the routers work, but it is a state that can be
1200detected. By this means, a router can be skipped or made to behave differently
1201when verifying. A common example is a configuration in which the first router
1202sends all messages to a message-scanning program, unless they have been
1203previously scanned. Thus, the first router accepts all addresses without any
9b371988 1204checking, making it useless for verifying. Normally, the &%no_verify%& option
168e428f
PH
1205would be set for such a router, causing it to be skipped in verify mode.
1206
1207
1208
1209
9b371988
PH
1210.section "Running an individual router" "SECTrunindrou"
1211.cindex "router" "running details"
1212.cindex "preconditions" "checking"
1213.cindex "router" "result of running"
168e428f
PH
1214As explained in the example above, a number of preconditions are checked before
1215running a router. If any are not met, the router is skipped, and the address is
9b371988 1216passed to the next router. When all the preconditions on a router &'are'& met,
168e428f
PH
1217the router is run. What happens next depends on the outcome, which is one of
1218the following:
1219
9b371988
PH
1220.ilist
1221&'accept'&: The router accepts the address, and either assigns it to a
1222transport, or generates one or more &"child"& addresses. Processing the
1223original address ceases,
1224.cindex "&%unseen%& option"
1225unless the &%unseen%& option is set on the router. This option
168e428f 1226can be used to set up multiple deliveries with different routing (for example,
9b371988
PH
1227for keeping archive copies of messages). When &%unseen%& is set, the address is
1228passed to the next router. Normally, however, an &'accept'& return marks the
168e428f 1229end of routing.
9b371988 1230
068aaea8
PH
1231Any child addresses generated by the router are processed independently,
1232starting with the first router by default. It is possible to change this by
9b371988
PH
1233setting the &%redirect_router%& option to specify which router to start at for
1234child addresses. Unlike &%pass_router%& (see below) the router specified by
1235&%redirect_router%& may be anywhere in the router configuration.
1236.next
1237&'pass'&: The router recognizes the address, but cannot handle it itself. It
168e428f
PH
1238requests that the address be passed to another router. By default the address
1239is passed to the next router, but this can be changed by setting the
9b371988 1240&%pass_router%& option. However, (unlike &%redirect_router%&) the named router
168e428f 1241must be below the current router (to avoid loops).
9b371988
PH
1242.next
1243&'decline'&: The router declines to accept the address because it does not
168e428f 1244recognize it at all. By default, the address is passed to the next router, but
9b371988
PH
1245this can be prevented by setting the &%no_more%& option. When &%no_more%& is
1246set, all the remaining routers are skipped. In effect, &%no_more%& converts
1247&'decline'& into &'fail'&.
1248.next
1249&'fail'&: The router determines that the address should fail, and queues it for
168e428f 1250the generation of a bounce message. There is no further processing of the
9b371988
PH
1251original address unless &%unseen%& is set on the router.
1252.next
1253&'defer'&: The router cannot handle the address at the present time. (A
068aaea8
PH
1254database may be offline, or a DNS lookup may have timed out.) No further
1255processing of the address happens in this delivery attempt. It is tried again
1256next time the message is considered for delivery.
9b371988
PH
1257.next
1258&'error'&: There is some error in the router (for example, a syntax error in
168e428f 1259its configuration). The action is as for defer.
9b371988 1260.endlist
168e428f
PH
1261
1262If an address reaches the end of the routers without having been accepted by
068aaea8 1263any of them, it is bounced as unrouteable. The default error message in this
9b371988
PH
1264situation is &"unrouteable address"&, but you can set your own message by
1265making use of the &%cannot_route_message%& option. This can be set for any
1266router; the value from the last router that &"saw"& the address is used.
168e428f
PH
1267
1268Sometimes while routing you want to fail a delivery when some conditions are
1269met but others are not, instead of passing the address on for further routing.
1270You can do this by having a second router that explicitly fails the delivery
9b371988 1271when the relevant conditions are met. The &(redirect)& router has a &"fail"&
168e428f
PH
1272facility for this purpose.
1273
1274
9b371988 1275.section "Duplicate addresses"
9b371988
PH
1276.cindex "case of local parts"
1277.cindex "address duplicate" "discarding"
068aaea8
PH
1278Once routing is complete, Exim scans the addresses that are assigned to local
1279and remote transports, and discards any duplicates that it finds. During this
1280check, local parts are treated as case-sensitive.
1281
168e428f 1282
9b371988
PH
1283.section "Router preconditions" "SECTrouprecon"
1284.cindex "router preconditions" "order of processing"
1285.cindex "preconditions" "order of processing"
168e428f
PH
1286The preconditions that are tested for each router are listed below, in the
1287order in which they are tested. The individual configuration options are
9b371988 1288described in more detail in chapter &<<CHAProutergeneric>>&.
168e428f 1289
9b371988
PH
1290.ilist
1291The &%local_part_prefix%& and &%local_part_suffix%& options can specify that
168e428f
PH
1292the local parts handled by the router may or must have certain prefixes and/or
1293suffixes. If a mandatory affix (prefix or suffix) is not present, the router is
1294skipped. These conditions are tested first. When an affix is present, it is
1295removed from the local part before further processing, including the evaluation
1296of any other conditions.
9b371988
PH
1297.next
1298Routers can be designated for use only when not verifying an address, that is,
168e428f 1299only when routing it for delivery (or testing its delivery routing). If the
9b371988 1300&%verify%& option is set false, the router is skipped when Exim is verifying an
168e428f 1301address.
9b371988
PH
1302Setting the &%verify%& option actually sets two options, &%verify_sender%& and
1303&%verify_recipient%&, which independently control the use of the router for
168e428f
PH
1304sender and recipient verification. You can set these options directly if
1305you want a router to be used for only one type of verification.
9b371988
PH
1306.next
1307If the &%address_test%& option is set false, the router is skipped when Exim is
1308run with the &%-bt%& option to test an address routing. This can be helpful
1309when the first router sends all new messages to a scanner of some sort; it
1310makes it possible to use &%-bt%& to test subsequent delivery routing without
1311having to simulate the effect of the scanner.
1312.next
1313Routers can be designated for use only when verifying an address, as
1314opposed to routing it for delivery. The &%verify_only%& option controls this.
1315.next
1316Individual routers can be explicitly skipped when running the routers to
1317check an address given in the SMTP EXPN command (see the &%expn%& option).
1318.next
1319If the &%domains%& option is set, the domain of the address must be in the set
068aaea8 1320of domains that it defines.
9b371988
PH
1321.next
1322.cindex "&$local_part_prefix$&"
1323.cindex "&$local_part$&"
1324.cindex "&$local_part_suffix$&"
1325If the &%local_parts%& option is set, the local part of the address must be in
1326the set of local parts that it defines. If &%local_part_prefix%& or
1327&%local_part_suffix%& is in use, the prefix or suffix is removed from the local
168e428f 1328part before this check. If you want to do precondition tests on local parts
9b371988
PH
1329that include affixes, you can do so by using a &%condition%& option (see below)
1330that uses the variables &$local_part$&, &$local_part_prefix$&, and
1331&$local_part_suffix$& as necessary.
1332.next
1333.cindex "&$local_user_uid$&"
1334.cindex "&$local_user_gid$&"
1335.cindex "&$home$&"
1336If the &%check_local_user%& option is set, the local part must be the name of
068aaea8 1337an account on the local host. If this check succeeds, the uid and gid of the
9b371988
PH
1338local user are placed in &$local_user_uid$& and &$local_user_gid$& and the
1339user's home directory is placed in &$home$&; these values can be used in the
1340remaining preconditions.
1341.next
1342If the &%router_home_directory%& option is set, it is expanded at this point,
1343because it overrides the value of &$home$&. If this expansion were left till
1344later, the value of &$home$& as set by &%check_local_user%& would be used in
1345subsequent tests. Having two different values of &$home$& in the same router
168e428f 1346could lead to confusion.
9b371988
PH
1347.next
1348If the &%senders%& option is set, the envelope sender address must be in the
1349set of addresses that it defines.
1350.next
1351If the &%require_files%& option is set, the existence or non-existence of
168e428f 1352specified files is tested.
9b371988
PH
1353.next
1354.cindex "customizing" "precondition"
1355If the &%condition%& option is set, it is evaluated and tested. This option
1356uses an expanded string to allow you to set up your own custom preconditions.
1357Expanded strings are described in chapter &<<CHAPexpand>>&.
1358.endlist
168e428f 1359
168e428f 1360
9b371988
PH
1361Note that &%require_files%& comes near the end of the list, so you cannot use
1362it to check for the existence of a file in which to lookup up a domain, local
168e428f 1363part, or sender. However, as these options are all expanded, you can use the
9b371988
PH
1364&%exists%& expansion condition to make such tests within each condition. The
1365&%require_files%& option is intended for checking files that the router may be
168e428f 1366going to use internally, or which are needed by a specific transport (for
9b371988 1367example, &_.procmailrc_&).
168e428f
PH
1368
1369
1370
9b371988
PH
1371.section "Delivery in detail"
1372.cindex "delivery" "in detail"
168e428f
PH
1373When a message is to be delivered, the sequence of events is as follows:
1374
9b371988
PH
1375.ilist
1376If a system-wide filter file is specified, the message is passed to it. The
168e428f
PH
1377filter may add recipients to the message, replace the recipients, discard the
1378message, cause a new message to be generated, or cause the message delivery to
1379fail. The format of the system filter file is the same as for Exim user filter
9b371988
PH
1380files, described in the separate document entitled &'Exim's interfaces to mail
1381filtering'&.
1382.cindex "Sieve filter" "not available for system filter"
1383(&*Note*&: Sieve cannot be used for system filter files.)
1384
1385Some additional features are available in system filters &-- see chapter
1386&<<CHAPsystemfilter>>& for details. Note that a message is passed to the system
168e428f
PH
1387filter only once per delivery attempt, however many recipients it has. However,
1388if there are several delivery attempts because one or more addresses could not
1389be immediately delivered, the system filter is run each time. The filter
9b371988 1390condition &%first_delivery%& can be used to detect the first run of the system
168e428f 1391filter.
9b371988
PH
1392.next
1393Each recipient address is offered to each configured router in turn, subject to
1394its preconditions, until one is able to handle it. If no router can handle the
1395address, that is, if they all decline, the address is failed. Because routers
1396can be targeted at particular domains, several locally handled domains can be
1397processed entirely independently of each other.
1398.next
1399.cindex "routing" "loops in"
1400.cindex "loop" "while routing"
1401A router that accepts an address may assign it to a local or a remote
1402transport. However, the transport is not run at this time. Instead, the address
1403is placed on a list for the particular transport, which will be run later.
068aaea8
PH
1404Alternatively, the router may generate one or more new addresses (typically
1405from alias, forward, or filter files). New addresses are fed back into this
1406process from the top, but in order to avoid loops, a router ignores any address
1407which has an identically-named ancestor that was processed by itself.
9b371988
PH
1408.next
1409When all the routing has been done, addresses that have been successfully
168e428f
PH
1410handled are passed to their assigned transports. When local transports are
1411doing real local deliveries, they handle only one address at a time, but if a
1412local transport is being used as a pseudo-remote transport (for example, to
1413collect batched SMTP messages for transmission by some other means) multiple
1414addresses can be handled. Remote transports can always handle more than one
1415address at a time, but can be configured not to do so, or to restrict multiple
1416addresses to the same domain.
9b371988
PH
1417.next
1418Each local delivery to a file or a pipe runs in a separate process under a
168e428f
PH
1419non-privileged uid, and these deliveries are run one at a time. Remote
1420deliveries also run in separate processes, normally under a uid that is private
9b371988 1421to Exim (&"the Exim user"&), but in this case, several remote deliveries can be
168e428f 1422run in parallel. The maximum number of simultaneous remote deliveries for any
9b371988 1423one message is set by the &%remote_max_parallel%& option.
168e428f
PH
1424The order in which deliveries are done is not defined, except that all local
1425deliveries happen before any remote deliveries.
9b371988
PH
1426.next
1427.cindex "queue runner"
168e428f
PH
1428When it encounters a local delivery during a queue run, Exim checks its retry
1429database to see if there has been a previous temporary delivery failure for the
1430address before running the local transport. If there was a previous failure,
1431Exim does not attempt a new delivery until the retry time for the address is
1432reached. However, this happens only for delivery attempts that are part of a
1433queue run. Local deliveries are always attempted when delivery immediately
1434follows message reception, even if retry times are set for them. This makes for
1435better behaviour if one particular message is causing problems (for example,
1436causing quota overflow, or provoking an error in a filter file).
9b371988
PH
1437.next
1438.cindex "delivery" "retry in remote transports"
168e428f
PH
1439Remote transports do their own retry handling, since an address may be
1440deliverable to one of a number of hosts, each of which may have a different
1441retry time. If there have been previous temporary failures and no host has
1442reached its retry time, no delivery is attempted, whether in a queue run or
9b371988
PH
1443not. See chapter &<<CHAPretry>>& for details of retry strategies.
1444.next
1445If there were any permanent errors, a bounce message is returned to an
168e428f
PH
1446appropriate address (the sender in the common case), with details of the error
1447for each failing address. Exim can be configured to send copies of bounce
1448messages to other addresses.
9b371988
PH
1449.next
1450.cindex "delivery" "deferral"
168e428f
PH
1451If one or more addresses suffered a temporary failure, the message is left on
1452the queue, to be tried again later. Delivery of these addresses is said to be
9b371988
PH
1453&'deferred'&.
1454.next
1455When all the recipient addresses have either been delivered or bounced,
168e428f
PH
1456handling of the message is complete. The spool files and message log are
1457deleted, though the message log can optionally be preserved if required.
9b371988 1458.endlist
168e428f
PH
1459
1460
1461
1462
9b371988
PH
1463.section "Retry mechanism"
1464.cindex "delivery" "retry mechanism"
1465.cindex "retry" "description of mechanism"
1466.cindex "queue runner"
168e428f
PH
1467Exim's mechanism for retrying messages that fail to get delivered at the first
1468attempt is the queue runner process. You must either run an Exim daemon that
9b371988
PH
1469uses the &%-q%& option with a time interval to start queue runners at regular
1470intervals, or use some other means (such as &'cron'&) to start them. If you do
168e428f
PH
1471not arrange for queue runners to be run, messages that fail temporarily at the
1472first attempt will remain on your queue for ever. A queue runner process works
068aaea8 1473its way through the queue, one message at a time, trying each delivery that has
168e428f
PH
1474passed its retry time.
1475You can run several queue runners at once.
1476
1477Exim uses a set of configured rules to determine when next to retry the failing
9b371988
PH
1478address (see chapter &<<CHAPretry>>&). These rules also specify when Exim
1479should give up trying to deliver to the address, at which point it generates a
1480bounce message. If no retry rules are set for a particular host, address, and
1481error combination, no retries are attempted, and temporary errors are treated
1482as permanent.
168e428f
PH
1483
1484
1485
9b371988
PH
1486.section "Temporary delivery failure"
1487.cindex "delivery" "temporary failure"
168e428f
PH
1488There are many reasons why a message may not be immediately deliverable to a
1489particular address. Failure to connect to a remote machine (because it, or the
1490connection to it, is down) is one of the most common. Temporary failures may be
1491detected during routing as well as during the transport stage of delivery.
1492Local deliveries may be delayed if NFS files are unavailable, or if a mailbox
1493is on a file system where the user is over quota. Exim can be configured to
1494impose its own quotas on local mailboxes; where system quotas are set they will
1495also apply.
1496
1497If a host is unreachable for a period of time, a number of messages may be
1498waiting for it by the time it recovers, and sending them in a single SMTP
1499connection is clearly beneficial. Whenever a delivery to a remote host is
1500deferred,
1501
9b371988 1502.cindex "hints database"
168e428f
PH
1503Exim makes a note in its hints database, and whenever a successful
1504SMTP delivery has happened, it looks to see if any other messages are waiting
1505for the same host. If any are found, they are sent over the same SMTP
1506connection, subject to a configuration limit as to the maximum number in any
1507one connection.
1508
1509
1510
1511
9b371988
PH
1512.section "Permanent delivery failure"
1513.cindex "delivery" "permanent failure"
1514.cindex "bounce message" "when generated"
168e428f
PH
1515When a message cannot be delivered to some or all of its intended recipients, a
1516bounce message is generated. Temporary delivery failures turn into permanent
1517errors when their timeout expires. All the addresses that fail in a given
1518delivery attempt are listed in a single message. If the original message has
1519many recipients, it is possible for some addresses to fail in one delivery
1520attempt and others to fail subsequently, giving rise to more than one bounce
1521message. The wording of bounce messages can be customized by the administrator.
9b371988 1522See chapter &<<CHAPemsgcust>>& for details.
168e428f 1523
9b371988
PH
1524.cindex "&'X-Failed-Recipients:'& header line"
1525Bounce messages contain an &'X-Failed-Recipients:'& header line that lists the
168e428f
PH
1526failed addresses, for the benefit of programs that try to analyse such messages
1527automatically.
1528
9b371988 1529.cindex "bounce message" "recipient of"
168e428f
PH
1530A bounce message is normally sent to the sender of the original message, as
1531obtained from the message's envelope. For incoming SMTP messages, this is the
9b371988
PH
1532address given in the MAIL command. However, when an address is expanded via a
1533forward or alias file, an alternative address can be specified for delivery
1534failures of the generated addresses. For a mailing list expansion (see section
1535&<<SECTmailinglists>>&) it is common to direct bounce messages to the manager
1536of the list.
168e428f
PH
1537
1538
1539
9b371988
PH
1540.section "Failures to deliver bounce messages"
1541.cindex "bounce message" "failure to deliver"
168e428f
PH
1542If a bounce message (either locally generated or received from a remote host)
1543itself suffers a permanent delivery failure, the message is left on the queue,
1544but it is frozen, awaiting the attention of an administrator. There are options
068aaea8 1545that can be used to make Exim discard such failed messages, or to keep them
9b371988
PH
1546for only a short time (see &%timeout_frozen_after%& and
1547&%ignore_bounce_errors_after%&).
168e428f
PH
1548
1549
1550
1551
1552
9b371988
PH
1553. ////////////////////////////////////////////////////////////////////////////
1554. ////////////////////////////////////////////////////////////////////////////
168e428f 1555
9b371988 1556.chapter "Building and installing Exim"
4f578862 1557.scindex IIDbuex "building Exim"
168e428f 1558
9b371988 1559.section "Unpacking"
168e428f
PH
1560Exim is distributed as a gzipped or bzipped tar file which, when upacked,
1561creates a directory with the name of the current release (for example,
9b371988
PH
1562&_exim-&version;_&) into which the following files are placed:
1563
1564.table2 140pt
1565.row &_ACKNOWLEDGMENTS_& "contains some acknowledgments"
1566.row &_CHANGES_& "contains a reference to where changes are documented"
1567.row &_LICENCE_& "the GNU General Public Licence"
1568.row &_Makefile_& "top-level make file"
1569.row &_NOTICE_& "conditions for the use of Exim"
1570.row &_README_& "list of files, directories and simple build &&&
1571 instructions"
1572.endtable
1573
1574Other files whose names begin with &_README_& may also be present. The
168e428f
PH
1575following subdirectories are created:
1576
9b371988
PH
1577.table2 140pt
1578.row &_Local_& "an empty directory for local configuration files"
1579.row &_OS_& "OS-specific files"
1580.row &_doc_& "documentation files"
1581.row &_exim_monitor_& "source files for the Exim monitor"
1582.row &_scripts_& "scripts used in the build process"
1583.row &_src_& "remaining source files"
1584.row &_util_& "independent utilities"
1585.endtable
1586
1587The main utility programs are contained in the &_src_& directory, and are built
1588with the Exim binary. The &_util_& directory contains a few optional scripts
168e428f
PH
1589that may be useful to some sites.
1590
1591
9b371988
PH
1592.section "Multiple machine architectures and operating systems"
1593.cindex "building Exim" "multiple OS/architectures"
168e428f
PH
1594The building process for Exim is arranged to make it easy to build binaries for
1595a number of different architectures and operating systems from the same set of
9b371988
PH
1596source files. Compilation does not take place in the &_src_& directory.
1597Instead, a &'build directory'& is created for each architecture and operating
1598system.
1599.cindex "symbolic link" "to build directory"
168e428f 1600Symbolic links to the sources are installed in this directory, which is where
9b371988
PH
1601the actual building takes place. In most cases, Exim can discover the machine
1602architecture and operating system for itself, but the defaults can be
1603overridden if necessary.
168e428f 1604
168e428f 1605
9b371988
PH
1606.section "DBM libraries" "SECTdb"
1607.cindex "DBM libraries" "discussion of"
1608.cindex "hints database" "DBM files used for"
168e428f
PH
1609Even if you do not use any DBM files in your configuration, Exim still needs a
1610DBM library in order to operate, because it uses indexed files for its hints
1611databases. Unfortunately, there are a number of DBM libraries in existence, and
1612different operating systems often have different ones installed.
1613
9b371988
PH
1614.cindex "Solaris" "DBM library for"
1615.cindex "IRIX" "DBM library for"
1616.cindex "BSD" "DBM library for"
1617.cindex "Linux" "DBM library for"
168e428f
PH
1618If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
1619Linux distribution, the DBM configuration should happen automatically, and you
1620may be able to ignore this section. Otherwise, you may have to learn more than
1621you would like about DBM libraries from what follows.
1622
9b371988 1623.cindex "&'ndbm'& DBM library"
168e428f 1624Licensed versions of Unix normally contain a library of DBM functions operating
9b371988 1625via the &'ndbm'& interface, and this is what Exim expects by default. Free
168e428f
PH
1626versions of Unix seem to vary in what they contain as standard. In particular,
1627some early versions of Linux have no default DBM library, and different
1628distributors have chosen to bundle different libraries with their packaged
1629versions. However, the more recent releases seem to have standardised on the
1630Berkeley DB library.
1631
1632Different DBM libraries have different conventions for naming the files they
9b371988 1633use. When a program opens a file called &_dbmfile_&, there are several
168e428f
PH
1634possibilities:
1635
9b371988
PH
1636.olist
1637A traditional &'ndbm'& implementation, such as that supplied as part of
1638Solaris, operates on two files called &_dbmfile.dir_& and &_dbmfile.pag_&.
1639.next
1640.cindex "&'gdbm'& DBM library"
1641The GNU library, &'gdbm'&, operates on a single file. If used via its &'ndbm'&
168e428f 1642compatibility interface it makes two different hard links to it with names
9b371988 1643&_dbmfile.dir_& and &_dbmfile.pag_&, but if used via its native interface, the
168e428f 1644file name is used unmodified.
9b371988
PH
1645.next
1646.cindex "Berkeley DB library"
1647The Berkeley DB package, if called via its &'ndbm'& compatibility interface,
1648operates on a single file called &_dbmfile.db_&, but otherwise looks to the
1649programmer exactly the same as the traditional &'ndbm'& implementation.
1650.next
1651If the Berkeley package is used in its native mode, it operates on a single
1652file called &_dbmfile_&; the programmer's interface is somewhat different to
1653the traditional &'ndbm'& interface.
1654.next
1655To complicate things further, there are several very different versions of the
168e428f 1656Berkeley DB package. Version 1.85 was stable for a very long time, releases
9b371988
PH
16572.&'x'& and 3.&'x'& were current for a while, but the latest versions are now
1658numbered 4.&'x'&. Maintenance of some of the earlier releases has ceased. All
168e428f 1659versions of Berkeley DB can be obtained from
9b371988
PH
1660&url(http://www.sleepycat.com/).
1661.next
1662.cindex "&'tdb'& DBM library"
1663Yet another DBM library, called &'tdb'&, is available from
1664&url(http://download.sourceforge.net/tdb). It has its own interface, and also
1665operates on a single file.
1666.endlist
1667
1668.cindex "USE_DB"
1669.cindex "DBM libraries" "configuration for building"
168e428f
PH
1670Exim and its utilities can be compiled to use any of these interfaces. In order
1671to use any version of the Berkeley DB package in native mode, you must set
1672USE_DB in an appropriate configuration file (typically
9b371988
PH
1673&_Local/Makefile_&). For example:
1674.code
1675USE_DB=yes
1676.endd
168e428f
PH
1677Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
1678error is diagnosed if you set more than one of these.
1679
1680At the lowest level, the build-time configuration sets none of these options,
1681thereby assuming an interface of type (1). However, some operating system
1682configuration files (for example, those for the BSD operating systems and
1683Linux) assume type (4) by setting USE_DB as their default, and the
1684configuration files for Cygwin set USE_GDBM. Anything you set in
9b371988 1685&_Local/Makefile_&, however, overrides these system defaults.
168e428f
PH
1686
1687As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
1688necessary to set DBMLIB, to cause inclusion of the appropriate library, as
1689in one of these lines:
9b371988
PH
1690.code
1691DBMLIB = -ldb
1692DBMLIB = -ltdb
1693.endd
168e428f
PH
1694Settings like that will work if the DBM library is installed in the standard
1695place. Sometimes it is not, and the library's header file may also not be in
1696the default path. You may need to set INCLUDE to specify where the header
1697file is, and to specify the path to the library more fully in DBMLIB, as in
1698this example:
9b371988
PH
1699.code
1700INCLUDE=-I/usr/local/include/db-4.1
1701DBMLIB=/usr/local/lib/db-4.1/libdb.a
1702.endd
168e428f 1703There is further detailed discussion about the various DBM libraries in the
9b371988 1704file &_doc/dbm.discuss.txt_& in the Exim distribution.
168e428f
PH
1705
1706
1707
9b371988
PH
1708.section "Pre-building configuration"
1709.cindex "building Exim" "pre-building configuration"
1710.cindex "configuration for building Exim"
1711.cindex "&_Local/Makefile_&"
1712.cindex "&_src/EDITME_&"
168e428f
PH
1713Before building Exim, a local configuration file that specifies options
1714independent of any operating system has to be created with the name
9b371988
PH
1715&_Local/Makefile_&. A template for this file is supplied as the file
1716&_src/EDITME_&, and it contains full descriptions of all the option settings
168e428f
PH
1717therein. These descriptions are therefore not repeated here. If you are
1718building Exim for the first time, the simplest thing to do is to copy
9b371988 1719&_src/EDITME_& to &_Local/Makefile_&, then read it and edit it appropriately.
168e428f
PH
1720
1721There are three settings that you must supply, because Exim will not build
1722without them. They are the location of the run time configuration file
1723(CONFIGURE_FILE), the directory in which Exim binaries will be installed
1724(BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
1725maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
1726a colon-separated list of file names; Exim uses the first of them that exists.
1727
1728There are a few other parameters that can be specified either at build time or
1729at run time, to enable the same binary to be used on a number of different
1730machines. However, if the locations of Exim's spool directory and log file
1731directory (if not within the spool directory) are fixed, it is recommended that
9b371988 1732you specify them in &_Local/Makefile_& instead of at run time, so that errors
168e428f
PH
1733detected early in Exim's execution (such as a malformed configuration file) can
1734be logged.
1735
9b371988 1736.cindex "content scanning" "specifying at build time"
068aaea8 1737Exim's interfaces for calling virus and spam scanning software directly from
168e428f
PH
1738access control lists are not compiled by default. If you want to include these
1739facilities, you need to set
9b371988
PH
1740.code
1741WITH_CONTENT_SCAN=yes
1742.endd
1743in your &_Local/Makefile_&. For details of the facilities themselves, see
1744chapter &<<CHAPexiscan>>&.
168e428f
PH
1745
1746
9b371988
PH
1747.cindex "&_Local/eximon.conf_&"
1748.cindex "_exim_monitor/EDITME_"
168e428f 1749If you are going to build the Exim monitor, a similar configuration process is
9b371988
PH
1750required. The file &_exim_monitor/EDITME_& must be edited appropriately for
1751your installation and saved under the name &_Local/eximon.conf_&. If you are
1752happy with the default settings described in &_exim_monitor/EDITME_&,
1753&_Local/eximon.conf_& can be empty, but it must exist.
168e428f
PH
1754
1755This is all the configuration that is needed in straightforward cases for known
1756operating systems. However, the building process is set up so that it is easy
1757to override options that are set by default or by operating-system-specific
1758configuration files, for example to change the name of the C compiler, which
9b371988
PH
1759defaults to &%gcc%&. See section &<<SECToverride>>& below for details of how to
1760do this.
168e428f
PH
1761
1762
1763
9b371988
PH
1764.section "Support for iconv()"
1765.cindex "&[iconv()]& support"
1766.cindex "RFC 2047"
168e428f
PH
1767The contents of header lines in messages may be encoded according to the rules
1768described RFC 2047. This makes it possible to transmit characters that are not
1769in the ASCII character set, and to label them as being in a particular
9b371988 1770character set. When Exim is inspecting header lines by means of the &%$h_%&
168e428f
PH
1771mechanism, it decodes them, and translates them into a specified character set
1772(default ISO-8859-1). The translation is possible only if the operating system
9b371988
PH
1773supports the &[iconv()]& function.
1774
1775However, some of the operating systems that supply &[iconv()]& do not support
1776very many conversions. The GNU &%libiconv%& library (available from
1777&url(http://www.gnu.org/software/libiconv/)) can be installed on such
1778systems to remedy this deficiency, as well as on systems that do not supply
1779&[iconv()]& at all. After installing &%libiconv%&, you should add
1780.code
1781HAVE_ICONV=yes
1782.endd
1783to your &_Local/Makefile_& and rebuild Exim.
1784
1785
1786
1787.section "Including TLS/SSL encryption support" "SECTinctlsssl"
1788.cindex "TLS" "including support for TLS"
1789.cindex "encryption" "including support for"
1790.cindex "SUPPORT_TLS"
1791.cindex "OpenSSL" "building Exim with"
1792.cindex "GnuTLS" "building Exim with"
168e428f
PH
1793Exim can be built to support encrypted SMTP connections, using the STARTTLS
1794command as per RFC 2487. It can also support legacy clients that expect to
1795start a TLS session immediately on connection to a non-standard port (see the
9b371988 1796&%tls_on_connect_ports%& runtime option and the &%-tls-on-connect%& command
168e428f
PH
1797line option).
1798
1799If you want to build Exim with TLS support, you must first install either the
1800OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
1801implementing SSL.
1802
1803If OpenSSL is installed, you should set
9b371988
PH
1804.code
1805SUPPORT_TLS=yes
1806TLS_LIBS=-lssl -lcrypto
1807.endd
1808in &_Local/Makefile_&. You may also need to specify the locations of the
168e428f 1809OpenSSL library and include files. For example:
9b371988
PH
1810.code
1811SUPPORT_TLS=yes
1812TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
1813TLS_INCLUDE=-I/usr/local/openssl/include/
1814.endd
1815.cindex "USE_GNUTLS"
168e428f 1816If GnuTLS is installed, you should set
9b371988
PH
1817.code
1818SUPPORT_TLS=yes
1819USE_GNUTLS=yes
1820TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
1821.endd
1822in &_Local/Makefile_&, and again you may need to specify the locations of the
168e428f 1823library and include files. For example:
9b371988
PH
1824.code
1825SUPPORT_TLS=yes
1826USE_GNUTLS=yes
1827TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
1828TLS_INCLUDE=-I/usr/gnu/include
1829.endd
168e428f 1830You do not need to set TLS_INCLUDE if the relevant directory is already
9b371988
PH
1831specified in INCLUDE. Details of how to configure Exim to make use of TLS are
1832given in chapter &<<CHAPTLS>>&.
168e428f
PH
1833
1834
1835
1836
9b371988
PH
1837.section "Use of tcpwrappers"
1838.cindex "tcpwrappers" "building Exim to support"
1839.cindex "USE_TCP_WRAPPERS"
1840Exim can be linked with the &'tcpwrappers'& library in order to check incoming
1841SMTP calls using the &'tcpwrappers'& control files. This may be a convenient
168e428f 1842alternative to Exim's own checking facilities for installations that are
9b371988
PH
1843already making use of &'tcpwrappers'& for other purposes. To do this, you
1844should set USE_TCP_WRAPPERS in &_Local/Makefile_&, arrange for the file
1845&_tcpd.h_& to be available at compile time, and also ensure that the library
1846&_libwrap.a_& is available at link time, typically by including &%-lwrap%& in
1847EXTRALIBS_EXIM. For example, if &'tcpwrappers'& is installed in &_/usr/local_&,
1848you might have
1849.code
1850USE_TCP_WRAPPERS=yes
1851CFLAGS=-O -I/usr/local/include
1852EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
1853.endd
1854in &_Local/Makefile_&. The name to use in the &'tcpwrappers'& control files is
1855&"exim"&. For example, the line
1856.code
1857exim : LOCAL 192.168.1. .friendly.domain.example
1858.endd
1859in your &_/etc/hosts.allow_& file allows connections from the local host, from
1860the subnet 192.168.1.0/24, and from all hosts in &'friendly.domain.example'&.
1861All other connections are denied. Consult the &'tcpwrappers'& documentation for
168e428f
PH
1862further details.
1863
1864
1865
9b371988
PH
1866.section "Including support for IPv6"
1867.cindex "IPv6" "including support for"
168e428f 1868Exim contains code for use on systems that have IPv6 support. Setting
9b371988 1869&`HAVE_IPV6=YES`& in &_Local/Makefile_& causes the IPv6 code to be included;
168e428f
PH
1870it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
1871where the IPv6 support is not fully integrated into the normal include and
1872library files.
1873
1874Two different types of DNS record for handling IPv6 addresses have been
1875defined. AAAA records (analagous to A records for IPv4) are in use, and are
1876currently seen as the mainstream. Another record type called A6 was proposed
1877as better than AAAA because it had more flexibility. However, it was felt to be
9b371988 1878over-complex, and its status was reduced to &"experimental"&. It is not known
168e428f 1879if anyone is actually using A6 records. Exim has support for A6 records, but
9b371988 1880this is included only if you set &`SUPPORT_A6=YES`& in &_Local/Makefile_&. The
168e428f
PH
1881support has not been tested for some time.
1882
1883
1884
9b371988
PH
1885.section "The building process"
1886.cindex "build directory"
1887Once &_Local/Makefile_& (and &_Local/eximon.conf_&, if required) have been
1888created, run &'make'& at the top level. It determines the architecture and
168e428f
PH
1889operating system types, and creates a build directory if one does not exist.
1890For example, on a Sun system running Solaris 8, the directory
9b371988
PH
1891&_build-SunOS5-5.8-sparc_& is created.
1892.cindex "symbolic link" "to source files"
168e428f
PH
1893Symbolic links to relevant source files are installed in the build directory.
1894
9b371988 1895&*Warning*&: The &%-j%& (parallel) flag must not be used with &'make'&; the
168e428f
PH
1896building process fails if it is set.
1897
9b371988 1898If this is the first time &'make'& has been run, it calls a script that builds
168e428f 1899a make file inside the build directory, using the configuration files from the
9b371988
PH
1900&_Local_& directory. The new make file is then passed to another instance of
1901&'make'&. This does the real work, building a number of utility scripts, and
168e428f 1902then compiling and linking the binaries for the Exim monitor (if configured), a
9b371988
PH
1903number of utility programs, and finally Exim itself. The command &`make
1904makefile`& can be used to force a rebuild of the make file in the build
168e428f
PH
1905directory, should this ever be necessary.
1906
1907If you have problems building Exim, check for any comments there may be in the
9b371988 1908&_README_& file concerning your operating system, and also take a look at the
168e428f
PH
1909FAQ, where some common problems are covered.
1910
1911
1912
9b371988 1913.section 'Output from &"make"&'
9b371988 1914The output produced by the &'make'& process for compile lines is often very
068aaea8
PH
1915unreadable, because these lines can be very long. For this reason, the normal
1916output is suppressed by default, and instead output similar to that which
1917appears when compiling the 2.6 Linux kernel is generated: just a short line for
1918each module that is being compiled or linked. However, it is still possible to
9b371988
PH
1919get the full output, by calling &'make'& like this:
1920.code
1921FULLECHO='' make -e
1922.endd
1923The value of FULLECHO defaults to &"@"&, the flag character that suppresses
1924command reflection in &'make'&. When you ask for the full output, it is
068aaea8
PH
1925given in addition to the the short output.
1926
1927
1928
9b371988
PH
1929.section "Overriding build-time options for Exim" "SECToverride"
1930.cindex "build-time options" "overriding"
168e428f
PH
1931The main make file that is created at the beginning of the building process
1932consists of the concatenation of a number of files which set configuration
9b371988 1933values, followed by a fixed set of &'make'& instructions. If a value is set
168e428f
PH
1934more than once, the last setting overrides any previous ones. This provides a
1935convenient way of overriding defaults. The files that are concatenated are, in
1936order:
9b371988
PH
1937.display
1938&_OS/Makefile-Default_&
1939&_OS/Makefile-_&<&'ostype'&>
1940&_Local/Makefile_&
1941&_Local/Makefile-_&<&'ostype'&>
1942&_Local/Makefile-_&<&'archtype'&>
1943&_Local/Makefile-_&<&'ostype'&>-<&'archtype'&>
1944&_OS/Makefile-Base_&
1945.endd
1946.cindex "&_Local/Makefile_&"
1947.cindex "building Exim" "operating system type"
1948.cindex "building Exim" "architecture type"
1949where <&'ostype'&> is the operating system type and <&'archtype'&> is the
1950architecture type. &_Local/Makefile_& is required to exist, and the building
1951process fails if it is absent. The other three &_Local_& files are optional,
168e428f
PH
1952and are often not needed.
1953
9b371988
PH
1954The values used for <&'ostype'&> and <&'archtype'&> are obtained from scripts
1955called &_scripts/os-type_& and &_scripts/arch-type_& respectively. If either of
168e428f
PH
1956the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
1957values are used, thereby providing a means of forcing particular settings.
9b371988 1958Otherwise, the scripts try to get values from the &%uname%& command. If this
168e428f 1959fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
9b371988 1960of &'ad hoc'& transformations are then applied, to produce the standard names
168e428f
PH
1961that Exim expects. You can run these scripts directly from the shell in order
1962to find out what values are being used on your system.
1963
1964
9b371988 1965&_OS/Makefile-Default_& contains comments about the variables that are set
168e428f
PH
1966therein. Some (but not all) are mentioned below. If there is something that
1967needs changing, review the contents of this file and the contents of the make
9b371988 1968file for your operating system (&_OS/Makefile-<ostype>_&) to see what the
168e428f
PH
1969default values are.
1970
1971
9b371988
PH
1972.cindex "building Exim" "overriding default settings"
1973If you need to change any of the values that are set in &_OS/Makefile-Default_&
1974or in &_OS/Makefile-<ostype>_&, or to add any new definitions, you do not
168e428f 1975need to change the original files. Instead, you should make the changes by
9b371988
PH
1976putting the new values in an appropriate &_Local_& file. For example,
1977.cindex "Tru64-Unix build-time settings"
168e428f
PH
1978when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
1979formerly DEC-OSF1) operating system, it is necessary to specify that the C
9b371988
PH
1980compiler is called &'cc'& rather than &'gcc'&. Also, the compiler must be
1981called with the option &%-std1%&, to make it recognize some of the features of
168e428f 1982Standard C that Exim uses. (Most other compilers recognize Standard C by
9b371988 1983default.) To do this, you should create a file called &_Local/Makefile-OSF1_&
168e428f 1984containing the lines
9b371988
PH
1985.code
1986CC=cc
1987CFLAGS=-std1
1988.endd
168e428f 1989If you are compiling for just one operating system, it may be easier to put
9b371988 1990these lines directly into &_Local/Makefile_&.
168e428f
PH
1991
1992Keeping all your local configuration settings separate from the distributed
1993files makes it easy to transfer them to new versions of Exim simply by copying
9b371988 1994the contents of the &_Local_& directory.
168e428f
PH
1995
1996
9b371988
PH
1997.cindex "NIS lookup type" "including support for"
1998.cindex "NIS+ lookup type" "including support for"
1999.cindex "LDAP" "including support for"
2000.cindex "lookup" "inclusion in binary"
168e428f
PH
2001Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2002lookup, but not all systems have these components installed, so the default is
2003not to include the relevant code in the binary. All the different kinds of file
2004and database lookup that Exim supports are implemented as separate code modules
2005which are included only if the relevant compile-time options are set. In the
9b371988
PH
2006case of LDAP, NIS, and NIS+, the settings for &_Local/Makefile_& are:
2007.code
2008LOOKUP_LDAP=yes
2009LOOKUP_NIS=yes
2010LOOKUP_NISPLUS=yes
2011.endd
168e428f 2012and similar settings apply to the other lookup types. They are all listed in
9b371988 2013&_src/EDITME_&. In many cases the relevant include files and interface
168e428f 2014libraries need to be installed before compiling Exim.
9b371988 2015.cindex "cdb" "including support for"
068aaea8
PH
2016However, there are some optional lookup types (such as cdb) for which
2017the code is entirely contained within Exim, and no external include
168e428f
PH
2018files or libraries are required. When a lookup type is not included in the
2019binary, attempts to configure Exim to use it cause run time configuration
2020errors.
2021
9b371988 2022.cindex "Perl" "including support for"
168e428f
PH
2023Exim can be linked with an embedded Perl interpreter, allowing Perl
2024subroutines to be called during string expansion. To enable this facility,
9b371988
PH
2025.code
2026EXIM_PERL=perl.o
2027.endd
2028must be defined in &_Local/Makefile_&. Details of this facility are given in
2029chapter &<<CHAPperl>>&.
168e428f 2030
9b371988 2031.cindex "X11 libraries" "location of"
168e428f 2032The location of the X11 libraries is something that varies a lot between
068aaea8 2033operating systems, and there may be different versions of X11 to cope
168e428f
PH
2034with. Exim itself makes no use of X11, but if you are compiling the Exim
2035monitor, the X11 libraries must be available.
9b371988
PH
2036The following three variables are set in &_OS/Makefile-Default_&:
2037.code
2038X11=/usr/X11R6
2039XINCLUDE=-I$(X11)/include
2040XLFLAGS=-L$(X11)/lib
2041.endd
168e428f 2042These are overridden in some of the operating-system configuration files. For
9b371988
PH
2043example, in &_OS/Makefile-SunOS5_& there is
2044.code
2045X11=/usr/openwin
2046XINCLUDE=-I$(X11)/include
2047XLFLAGS=-L$(X11)/lib -R$(X11)/lib
2048.endd
168e428f
PH
2049If you need to override the default setting for your operating system, place a
2050definition of all three of these variables into your
9b371988 2051&_Local/Makefile-<ostype>_& file.
168e428f 2052
9b371988 2053.cindex "EXTRALIBS"
168e428f
PH
2054If you need to add any extra libraries to the link steps, these can be put in a
2055variable called EXTRALIBS, which appears in all the link commands, but by
2056default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
2057command for linking the main Exim binary, and not for any associated utilities.
2058
9b371988 2059.cindex "DBM libraries" "configuration for building"
168e428f 2060There is also DBMLIB, which appears in the link commands for binaries that
9b371988 2061use DBM functions (see also section &<<SECTdb>>&). Finally, there is
168e428f
PH
2062EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
2063binary, and which can be used, for example, to include additional X11
2064libraries.
2065
9b371988 2066.cindex "configuration file" "editing"
168e428f
PH
2067The make file copes with rebuilding Exim correctly if any of the configuration
2068files are edited. However, if an optional configuration file is deleted, it is
9b371988
PH
2069necessary to touch the associated non-optional file (that is,
2070&_Local/Makefile_& or &_Local/eximon.conf_&) before rebuilding.
168e428f
PH
2071
2072
9b371988
PH
2073.section "OS-specific header files"
2074.cindex "&_os.h_&"
2075.cindex "building Exim" "OS-specific C header files"
2076The &_OS_& directory contains a number of files with names of the form
2077&_os.h-<ostype>_&. These are system-specific C header files that should not
168e428f 2078normally need to be changed. There is a list of macro settings that are
9b371988 2079recognized in the file &_OS/os.configuring_&, which should be consulted if you
168e428f
PH
2080are porting Exim to a new operating system.
2081
2082
2083
9b371988
PH
2084.section "Overriding build-time options for the monitor"
2085.cindex "building Eximon" "overriding default options"
168e428f
PH
2086A similar process is used for overriding things when building the Exim monitor,
2087where the files that are involved are
9b371988
PH
2088.display
2089&_OS/eximon.conf-Default_&
2090&_OS/eximon.conf-_&<&'ostype'&>
2091&_Local/eximon.conf_&
2092&_Local/eximon.conf-_&<&'ostype'&>
2093&_Local/eximon.conf-_&<&'archtype'&>
2094&_Local/eximon.conf-_&<&'ostype'&>-<&'archtype'&>
2095.endd
2096.cindex "&_Local/eximon.conf_&"
168e428f 2097As with Exim itself, the final three files need not exist, and in this case the
9b371988
PH
2098&_OS/eximon.conf-<ostype>_& file is also optional. The default values in
2099&_OS/eximon.conf-Default_& can be overridden dynamically by setting environment
168e428f
PH
2100variables of the same name, preceded by EXIMON_. For example, setting
2101EXIMON_LOG_DEPTH in the environment overrides the value of
2102LOG_DEPTH at run time.
4f578862 2103.ecindex IIDbuex
168e428f
PH
2104
2105
9b371988
PH
2106.section "Installing Exim binaries and scripts"
2107.cindex "installing Exim"
2108.cindex "BIN_DIRECTORY"
2109The command &`make install`& runs the &(exim_install)& script with no
2110arguments. The script copies binaries and utility scripts into the directory
2111whose name is specified by the BIN_DIRECTORY setting in &_Local/Makefile_&.
2112.cindex "setuid" "installing Exim with"
068aaea8
PH
2113The install script copies files only if they are newer than the files they are
2114going to replace. The Exim binary is required to be owned by root and have the
9b371988
PH
2115&'setuid'& bit set, for normal configurations. Therefore, you must run &`make
2116install`& as root so that it can set up the Exim binary in this way. However, in
068aaea8
PH
2117some special situations (for example, if a host is doing no local deliveries)
2118it may be possible to run Exim without making the binary setuid root (see
9b371988 2119chapter &<<CHAPsecurity>>& for details).
168e428f 2120
9b371988 2121.cindex "CONFIGURE_FILE"
168e428f 2122Exim's run time configuration file is named by the CONFIGURE_FILE setting
9b371988
PH
2123in &_Local/Makefile_&. If this names a single file, and the file does not
2124exist, the default configuration file &_src/configure.default_& is copied there
168e428f
PH
2125by the installation script. If a run time configuration file already exists, it
2126is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
2127alternative files, no default is installed.
2128
9b371988
PH
2129.cindex "system aliases file"
2130.cindex "&_/etc/aliases_&"
168e428f
PH
2131One change is made to the default configuration file when it is installed: the
2132default configuration contains a router that references a system aliases file.
2133The path to this file is set to the value specified by
9b371988 2134SYSTEM_ALIASES_FILE in &_Local/Makefile_& (&_/etc/aliases_& by default).
168e428f
PH
2135If the system aliases file does not exist, the installation script creates it,
2136and outputs a comment to the user.
2137
2138The created file contains no aliases, but it does contain comments about the
2139aliases a site should normally have. Mail aliases have traditionally been
9b371988
PH
2140kept in &_/etc/aliases_&. However, some operating systems are now using
2141&_/etc/mail/aliases_&. You should check if yours is one of these, and change
168e428f
PH
2142Exim's configuration if necessary.
2143
2144The default configuration uses the local host's name as the only local domain,
9b371988
PH
2145and is set up to do local deliveries into the shared directory &_/var/mail_&,
2146running as the local user. System aliases and &_.forward_& files in users' home
168e428f
PH
2147directories are supported, but no NIS or NIS+ support is configured. Domains
2148other than the name of the local host are routed using the DNS, with delivery
2149over SMTP.
2150
168e428f
PH
2151It is possible to install Exim for special purposes (such as building a binary
2152distribution) in a private part of the file system. You can do this by a
2153command such as
9b371988
PH
2154.code
2155make DESTDIR=/some/directory/ install
2156.endd
168e428f
PH
2157This has the effect of pre-pending the specified directory to all the file
2158paths, except the name of the system aliases file that appears in the default
9b371988 2159configuration. (If a default alias file is created, its name &'is'& modified.)
168e428f
PH
2160For backwards compatibility, ROOT is used if DESTDIR is not set,
2161but this usage is deprecated.
2162
9b371988
PH
2163.cindex "installing Exim" "what is not installed"
2164Running &'make install'& does not copy the Exim 4 conversion script
2165&'convert4r4'&, or the &'pcretest'& test program. You will probably run the
168e428f 2166first of these only once (if you are upgrading from Exim 3), and the second
9b371988 2167isn't really part of Exim. None of the documentation files in the &_doc_&
168e428f 2168directory are copied, except for the info files when you have set
9b371988 2169INFO_DIRECTORY, as described in section &<<SECTinsinfdoc>>& below.
168e428f 2170
9b371988 2171For the utility programs, old versions are renamed by adding the suffix &_.O_&
168e428f
PH
2172to their names. The Exim binary itself, however, is handled differently. It is
2173installed under a name that includes the version number and the compile number,
9b371988
PH
2174for example &_exim-&version;-1_&. The script then arranges for a symbolic link
2175called &_exim_& to point to the binary. If you are updating a previous version
2176of Exim, the script takes care to ensure that the name &_exim_& is never absent
168e428f
PH
2177from the directory (as seen by other processes).
2178
9b371988
PH
2179.cindex "installing Exim" "testing the script"
2180If you want to see what the &'make install'& will do before running it for
2181real, you can pass the &%-n%& option to the installation script by this
2182command:
2183.code
2184make INSTALL_ARG=-n install
2185.endd
168e428f
PH
2186The contents of the variable INSTALL_ARG are passed to the installation
2187script. You do not need to be root to run this test. Alternatively, you can run
2188the installation script directly, but this must be from within the build
2189directory. For example, from the top-level Exim directory you could use this
2190command:
9b371988
PH
2191.code
2192(cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
2193.endd
2194.cindex "installing Exim" "install script options"
168e428f
PH
2195There are two other options that can be supplied to the installation script.
2196
9b371988
PH
2197.ilist
2198&%-no_chown%& bypasses the call to change the owner of the installed binary
168e428f 2199to root, and the call to make it a setuid binary.
9b371988
PH
2200.next
2201&%-no_symlink%& bypasses the setting up of the symbolic link &_exim_& to the
168e428f 2202installed binary.
9b371988 2203.endlist
168e428f
PH
2204
2205INSTALL_ARG can be used to pass these options to the script. For example:
9b371988
PH
2206.code
2207make INSTALL_ARG=-no_symlink install
2208.endd
168e428f
PH
2209The installation script can also be given arguments specifying which files are
2210to be copied. For example, to install just the Exim binary, and nothing else,
2211without creating the symbolic link, you could use:
9b371988
PH
2212.code
2213make INSTALL_ARG='-no_symlink exim' install
2214.endd
168e428f
PH
2215
2216
2217
9b371988
PH
2218.section "Installing info documentation" "SECTinsinfdoc"
2219.cindex "installing Exim" "&'info'& documentation"
2220Not all systems use the GNU &'info'& system for documentation, and for this
168e428f
PH
2221reason, the Texinfo source of Exim's documentation is not included in the main
2222distribution. Instead it is available separately from the ftp site (see section
9b371988 2223&<<SECTavail>>&).
168e428f 2224
9b371988
PH
2225If you have defined INFO_DIRECTORY in &_Local/Makefile_& and the Texinfo
2226source of the documentation is found in the source tree, running &`make
2227install`& automatically builds the info files and installs them.
168e428f
PH
2228
2229
2230
9b371988
PH
2231.section "Setting up the spool directory"
2232.cindex "spool directory" "creating"
168e428f
PH
2233When it starts up, Exim tries to create its spool directory if it does not
2234exist. The Exim uid and gid are used for the owner and group of the spool
2235directory. Sub-directories are automatically created in the spool directory as
2236necessary.
2237
2238
2239
2240
9b371988
PH
2241.section "Testing"
2242.cindex "testing" "installation"
168e428f
PH
2243Having installed Exim, you can check that the run time configuration file is
2244syntactically valid by running the following command, which assumes that the
2245Exim binary directory is within your PATH environment variable:
9b371988
PH
2246.code
2247exim -bV
2248.endd
168e428f
PH
2249If there are any errors in the configuration file, Exim outputs error messages.
2250Otherwise it outputs the version number and build date,
2251the DBM library that is being used, and information about which drivers and
2252other optional code modules are included in the binary.
2253Some simple routing tests can be done by using the address testing option. For
2254example,
9b371988
PH
2255.display
2256&`exim -bt`& <&'local username'&>
2257.endd
168e428f 2258should verify that it recognizes a local mailbox, and
9b371988
PH
2259.display
2260&`exim -bt`& <&'remote address'&>
2261.endd
168e428f
PH
2262a remote one. Then try getting it to deliver mail, both locally and remotely.
2263This can be done by passing messages directly to Exim, without going through a
2264user agent. For example:
9b371988 2265.code
068aaea8
PH
2266exim -v postmaster@your.domain.example
2267From: user@your.domain.example
2268To: postmaster@your.domain.example
2269Subject: Testing Exim
168e428f 2270
068aaea8
PH
2271This is a test message.
2272^D
9b371988
PH
2273.endd
2274The &%-v%& option causes Exim to output some verification of what it is doing.
168e428f 2275In this case you should see copies of three log lines, one for the message's
9b371988 2276arrival, one for its delivery, and one containing &"Completed"&.
168e428f 2277
9b371988
PH
2278.cindex "delivery" "problems with"
2279If you encounter problems, look at Exim's log files (&'mainlog'& and
2280&'paniclog'&) to see if there is any relevant information there. Another source
168e428f 2281of information is running Exim with debugging turned on, by specifying the
9b371988 2282&%-d%& option. If a message is stuck on Exim's spool, you can force a delivery
168e428f 2283with debugging turned on by a command of the form
9b371988
PH
2284.display
2285&`exim -d -M`& <&'exim-message-id'&>
2286.endd
2287You must be root or an &"admin user"& in order to do this. The &%-d%& option
168e428f 2288produces rather a lot of output, but you can cut this down to specific areas.
9b371988
PH
2289For example, if you use &%-d-all+route%& only the debugging information
2290relevant to routing is included. (See the &%-d%& option in chapter
2291&<<CHAPcommandline>>& for more details.)
168e428f 2292
9b371988
PH
2293.cindex '&"sticky"& bit'
2294.cindex "lock files"
168e428f
PH
2295One specific problem that has shown up on some sites is the inability to do
2296local deliveries into a shared mailbox directory, because it does not have the
9b371988 2297&"sticky bit"& set on it. By default, Exim tries to create a lock file before
168e428f 2298writing to a mailbox file, and if it cannot create the lock file, the delivery
9b371988 2299is deferred. You can get round this either by setting the &"sticky bit"& on the
168e428f
PH
2300directory, or by setting a specific group for local deliveries and allowing
2301that group to create files in the directory (see the comments above the
9b371988 2302&(local_delivery)& transport in the default configuration file). Another
168e428f 2303approach is to configure Exim not to use lock files, but just to rely on
9b371988
PH
2304&[fcntl()]& locking instead. However, you should do this only if all user
2305agents also use &[fcntl()]& locking. For further discussion of locking issues,
2306see chapter &<<CHAPappendfile>>&.
168e428f
PH
2307
2308One thing that cannot be tested on a system that is already running an MTA is
2309the receipt of incoming SMTP mail on the standard SMTP port. However, the
9b371988
PH
2310&%-oX%& option can be used to run an Exim daemon that listens on some other
2311port, or &'inetd'& can be used to do this. The &%-bh%& option and the
2312&'exim_checkaccess'& utility can be used to check out policy controls on
168e428f
PH
2313incoming SMTP mail.
2314
2315Testing a new version on a system that is already running Exim can most easily
2316be done by building a binary with a different CONFIGURE_FILE setting. From
2317within the run time configuration, all other file and directory names
2318that Exim uses can be altered, in order to keep it entirely clear of the
2319production version.
2320
2321
9b371988
PH
2322.section "Replacing another MTA with Exim"
2323.cindex "replacing another MTA"
168e428f
PH
2324Building and installing Exim for the first time does not of itself put it in
2325general use. The name by which the system's MTA is called by mail user agents
9b371988
PH
2326is either &_/usr/sbin/sendmail_&, or &_/usr/lib/sendmail_& (depending on the
2327operating system), and it is necessary to make this name point to the &'exim'&
168e428f 2328binary in order to get the user agents to pass messages to Exim. This is
9b371988
PH
2329normally done by renaming any existing file and making &_/usr/sbin/sendmail_&
2330or &_/usr/lib/sendmail_&
2331.cindex "symbolic link" "to &'exim'& binary"
2332a symbolic link to the &'exim'& binary. It is a good idea to remove any setuid
168e428f
PH
2333privilege and executable status from the old MTA. It is then necessary to stop
2334and restart the mailer daemon, if one is running.
2335
9b371988
PH
2336.cindex "FreeBSD" "MTA indirection"
2337.cindex "&_/etc/mail/mailer.conf_&"
168e428f
PH
2338Some operating systems have introduced alternative ways of switching MTAs. For
2339example, if you are running FreeBSD, you need to edit the file
9b371988 2340&_/etc/mail/mailer.conf_& instead of setting up a symbolic link as just
168e428f
PH
2341described. A typical example of the contents of this file for running Exim is
2342as follows:
9b371988
PH
2343.code
2344sendmail /usr/exim/bin/exim
2345send-mail /usr/exim/bin/exim
2346mailq /usr/exim/bin/exim -bp
2347newaliases /usr/bin/true
2348.endd
2349Once you have set up the symbolic link, or edited &_/etc/mail/mailer.conf_&,
2350your Exim installation is &"live"&. Check it by sending a message from your
168e428f
PH
2351favourite user agent.
2352
2353You should consider what to tell your users about the change of MTA. Exim may
2354have different capabilities to what was previously running, and there are
2355various operational differences such as the text of messages produced by
2356command line options and in bounce messages. If you allow your users to make
2357use of Exim's filtering capabilities, you should make the document entitled
9b371988 2358&'Exim's interface to mail filtering'& available to them.
168e428f
PH
2359
2360
2361
9b371988
PH
2362.section "Upgrading Exim"
2363.cindex "upgrading Exim"
168e428f
PH
2364If you are already running Exim on your host, building and installing a new
2365version automatically makes it available to MUAs, or any other programs that
2366call the MTA directly. However, if you are running an Exim daemon, you do need
9b371988
PH
2367to send it a HUP signal, to make it re-execute itself, and thereby pick up the
2368new binary. You do not need to stop processing mail in order to install a new
068aaea8
PH
2369version of Exim. The install script does not modify an existing runtime
2370configuration file.
2371
168e428f
PH
2372
2373
2374
9b371988
PH
2375.section "Stopping the Exim daemon on Solaris"
2376.cindex "Solaris" "stopping Exim on"
168e428f 2377The standard command for stopping the mailer daemon on Solaris is
9b371988
PH
2378.code
2379/etc/init.d/sendmail stop
2380.endd
2381If &_/usr/lib/sendmail_& has been turned into a symbolic link, this script
2382fails to stop Exim because it uses the command &'ps -e'& and greps the output
2383for the text &"sendmail"&; this is not present because the actual program name
2384(that is, &"exim"&) is given by the &'ps'& command with these options. A
2385solution is to replace the line that finds the process id with something like
2386.code
2387pid=`cat /var/spool/exim/exim-daemon.pid`
2388.endd
168e428f
PH
2389to obtain the daemon's pid directly from the file that Exim saves it in.
2390
9b371988 2391Note, however, that stopping the daemon does not &"stop Exim"&. Messages can
168e428f
PH
2392still be received from local processes, and if automatic delivery is configured
2393(the normal case), deliveries will still occur.
2394
2395
2396
2397
9b371988
PH
2398. ////////////////////////////////////////////////////////////////////////////
2399. ////////////////////////////////////////////////////////////////////////////
168e428f 2400
9b371988 2401.chapter "The Exim command line" "CHAPcommandline"
4f578862
PH
2402.scindex IIDclo1 "command line" "options"
2403.scindex IIDclo2 "options" "command line"
168e428f
PH
2404Exim's command line takes the standard Unix form of a sequence of options,
2405each starting with a hyphen character, followed by a number of arguments. The
2406options are compatible with the main options of Sendmail, and there are also
2407some additional options, some of which are compatible with Smail 3. Certain
2408combinations of options do not make sense, and provoke an error if used.
2409The form of the arguments depends on which options are set.
2410
2411
9b371988
PH
2412.section "Setting options by program name"
2413.cindex "&'mailq'&"
2414If Exim is called under the name &'mailq'&, it behaves as if the option &%-bp%&
168e428f 2415were present before any other options.
9b371988 2416The &%-bp%& option requests a listing of the contents of the mail queue on the
168e428f
PH
2417standard output.
2418This feature is for compatibility with some systems that contain a command of
2419that name in one of the standard libraries, symbolically linked to
9b371988
PH
2420&_/usr/sbin/sendmail_& or &_/usr/lib/sendmail_&.
2421
2422.cindex "&'rsmtp'&"
2423If Exim is called under the name &'rsmtp'& it behaves as if the option &%-bS%&
2424were present before any other options, for compatibility with Smail. The
2425&%-bS%& option is used for reading in a number of messages in batched SMTP
2426format.
2427
2428.cindex "&'rmail'&"
2429If Exim is called under the name &'rmail'& it behaves as if the &%-i%& and
2430&%-oee%& options were present before any other options, for compatibility with
2431Smail. The name &'rmail'& is used as an interface by some UUCP systems.
2432
2433.cindex "&'runq'&"
2434.cindex "queue runner"
2435If Exim is called under the name &'runq'& it behaves as if the option &%-q%&
2436were present before any other options, for compatibility with Smail. The &%-q%&
168e428f
PH
2437option causes a single queue runner process to be started.
2438
9b371988
PH
2439.cindex "&'newaliases'&"
2440.cindex "alias file" "building"
2441.cindex "Sendmail compatibility" "calling Exim as &'newaliases'&"
2442If Exim is called under the name &'newaliases'& it behaves as if the option
2443&%-bi%& were present before any other options, for compatibility with Sendmail.
168e428f
PH
2444This option is used for rebuilding Sendmail's alias file. Exim does not have
2445the concept of a single alias file, but can be configured to run a given
9b371988 2446command if called with the &%-bi%& option.
168e428f
PH
2447
2448
9b371988
PH
2449.section "Trusted and admin users" "SECTtrustedadmin"
2450Some Exim options are available only to &'trusted users'& and others are
2451available only to &'admin users'&. In the description below, the phrases &"Exim
2452user"& and &"Exim group"& mean the user and group defined by EXIM_USER and
2453EXIM_GROUP in &_Local/Makefile_& or set by the &%exim_user%& and
2454&%exim_group%& options. These do not necessarily have to use the name &"exim"&.
168e428f 2455
9b371988
PH
2456.ilist
2457.cindex "trusted user" "definition of"
2458.cindex "user" "trusted definition of"
168e428f 2459The trusted users are root, the Exim user, any user listed in the
9b371988
PH
2460&%trusted_users%& configuration option, and any user whose current group or any
2461supplementary group is one of those listed in the &%trusted_groups%&
168e428f 2462configuration option. Note that the Exim group is not automatically trusted.
9b371988
PH
2463
2464.cindex '&"From"& line'
2465.cindex "envelope sender"
2466Trusted users are always permitted to use the &%-f%& option or a leading
2467&"From&~"& line to specify the envelope sender of a message that is passed to
2468Exim through the local interface (see the &%-bm%& and &%-f%& options below).
2469See the &%untrusted_set_sender%& option for a way of permitting non-trusted
2470users to set envelope senders.
2471
2472.cindex "&'From:'& header line"
2473.cindex "&'Sender:'& header line"
2474For a trusted user, there is never any check on the contents of the &'From:'&
2475header line, and a &'Sender:'& line is never added. Furthermore, any existing
2476&'Sender:'& line in incoming local (non-TCP/IP) messages is not removed.
2477
168e428f
PH
2478Trusted users may also specify a host name, host address, interface address,
2479protocol name, ident value, and authentication data when submitting a message
2480locally. Thus, they are able to insert messages into Exim's queue locally that
2481have the characteristics of messages received from a remote host. Untrusted
9b371988 2482users may in some circumstances use &%-f%&, but can never set the other values
168e428f 2483that are available to trusted users.
9b371988
PH
2484.next
2485.cindex "user" "admin definition of"
2486.cindex "admin user" "definition of"
168e428f 2487The admin users are root, the Exim user, and any user that is a member of the
9b371988 2488Exim group or of any group listed in the &%admin_groups%& configuration option.
168e428f 2489The current group does not have to be one of these groups.
9b371988 2490
168e428f
PH
2491Admin users are permitted to list the queue, and to carry out certain
2492operations on messages, for example, to force delivery failures. It is also
2493necessary to be an admin user in order to see the full information provided by
2494the Exim monitor, and full debugging output.
9b371988
PH
2495
2496By default, the use of the &%-M%&, &%-q%&, &%-R%&, and &%-S%& options to cause
2497Exim to attempt delivery of messages on its queue is restricted to admin users.
2498However, this restriction can be relaxed by setting the &%prod_requires_admin%&
2499option false (that is, specifying &%no_prod_requires_admin%&).
2500
2501Similarly, the use of the &%-bp%& option to list all the messages in the queue
2502is restricted to admin users unless &%queue_list_requires_admin%& is set
168e428f 2503false.
9b371988 2504.endlist
168e428f
PH
2505
2506
9b371988 2507&*Warning*&: If you configure your system so that admin users are able to
168e428f
PH
2508edit Exim's configuration file, you are giving those users an easy way of
2509getting root. There is further discussion of this issue at the start of chapter
9b371988 2510&<<CHAPconf>>&.
168e428f
PH
2511
2512
2513
2514
9b371988 2515.section "Command line options"
168e428f
PH
2516The command options are described in alphabetical order below.
2517
9b371988
PH
2518. ////////////////////////////////////////////////////////////////////////////
2519. Insert a stylized XML comment here, to identify the start of the command line
2520. options. This is for the benefit of the Perl script that automatically
2521. creates a man page for the options.
2522. ////////////////////////////////////////////////////////////////////////////
168e428f 2523
9b371988 2524.literal xml
168e428f 2525<!-- === Start of command line options === -->
9b371988 2526.literal off
168e428f
PH
2527
2528
9b371988
PH
2529.vlist
2530.vitem &%--%&
2531.oindex "--"
2532.cindex "options" "command line; terminating"
168e428f
PH
2533This is a pseudo-option whose only purpose is to terminate the options and
2534therefore to cause subsequent command line items to be treated as arguments
2535rather than options, even if they begin with hyphens.
2536
9b371988
PH
2537.vitem &%--help%&
2538.oindex "&%--help%&"
168e428f
PH
2539This option causes Exim to output a few sentences stating what it is.
2540The same output is generated if the Exim binary is called with no options and
2541no arguments.
2542
9b371988
PH
2543.vitem &%-B%&<&'type'&>
2544.oindex "&%-B%&"
2545.cindex "8-bit characters"
2546.cindex "Sendmail compatibility" "8-bit characters"
168e428f
PH
2547This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
2548clean; it ignores this option.
2549
9b371988
PH
2550.vitem &%-bd%&
2551.oindex "&%-bd%&"
2552.cindex "daemon"
2553.cindex "SMTP listener"
2554.cindex "queue runner"
168e428f 2555This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
9b371988
PH
2556the &%-bd%& option is combined with the &%-q%&<&'time'&> option, to specify
2557that the daemon should also initiate periodic queue runs.
2558
2559The &%-bd%& option can be used only by an admin user. If either of the &%-d%&
2560(debugging) or &%-v%& (verifying) options are set, the daemon does not
168e428f
PH
2561disconnect from the controlling terminal. When running this way, it can be
2562stopped by pressing ctrl-C.
9b371988 2563
168e428f
PH
2564By default, Exim listens for incoming connections to the standard SMTP port on
2565all the host's running interfaces. However, it is possible to listen on other
2566ports, on multiple ports, and only on specific interfaces. Chapter
9b371988
PH
2567&<<CHAPinterfaces>>& contains a description of the options that control this.
2568
168e428f 2569When a listening daemon
9b371988
PH
2570.cindex "daemon" "process id (pid)"
2571.cindex "pid (process id)" "of daemon"
2572is started without the use of &%-oX%& (that is, without overriding the normal
2573configuration), it writes its process id to a file called &_exim-daemon.pid_&
2574in Exim's spool directory. This location can be overridden by setting
2575PID_FILE_PATH in &_Local/Makefile_&. The file is written while Exim is still
168e428f 2576running as root.
9b371988
PH
2577
2578When &%-oX%& is used on the command line to start a listening daemon, the
2579process id is not written to the normal pid file path. However, &%-oP%& can be
168e428f 2580used to specify a path on the command line if a pid file is required.
9b371988 2581
168e428f 2582The SIGHUP signal
9b371988 2583.cindex "SIGHUP"
168e428f
PH
2584can be used to cause the daemon to re-exec itself. This should be done whenever
2585Exim's configuration file, or any file that is incorporated into it by means of
9b371988
PH
2586the &%.include%& facility, is changed, and also whenever a new version of Exim
2587is installed. It is not necessary to do this when other files that are
2588referenced from the configuration (for example, alias files) are changed,
2589because these are reread each time they are used.
2590
2591.vitem &%-bdf%&
2592.oindex "&%-bdf%&"
2593This option has the same effect as &%-bd%& except that it never disconnects
2594from the controlling terminal, even when no debugging is specified.
2595
2596.vitem &%-be%&
2597.oindex "&%-be%&"
2598.cindex "testing" "string expansion"
2599.cindex "expansion" "testing"
168e428f
PH
2600Run Exim in expansion testing mode. Exim discards its root privilege, to
2601prevent ordinary users from using this mode to read otherwise inaccessible
2602files. If no arguments are given, Exim runs interactively, prompting for lines
4f578862 2603of data. Otherwise, it processes each argument in turn.
9b371988
PH
2604
2605If Exim was built with USE_READLINE=yes in &_Local/Makefile_&, it tries
2606to load the &%libreadline%& library dynamically whenever the &%-be%& option is
2607used without command line arguments. If successful, it uses the &[readline()]&
168e428f
PH
2608function, which provides extensive line-editing facilities, for reading the
2609test data. A line history is supported.
9b371988 2610
168e428f 2611Long expansion expressions can be split over several lines by using backslash
068aaea8 2612continuations. As in Exim's run time configuration, white space at the start of
168e428f
PH
2613continuation lines is ignored. Each argument or data line is passed through the
2614string expansion mechanism, and the result is output. Variable values from the
9b371988
PH
2615configuration file (for example, &$qualify_domain$&) are available, but no
2616message-specific values (such as &$domain$&) are set, because no message is
168e428f
PH
2617being processed.
2618
9b371988
PH
2619&*Note*&: If you use this mechanism to test lookups, and you change the data
2620files or databases you are using, you must exit and restart Exim before trying
2621the same lookup again. Otherwise, because each Exim process caches the results
2622of lookups, you will just get the same result as before.
9b371988
PH
2623
2624.vitem &%-bF%&&~<&'filename'&>
2625.oindex "&%-bF%&"
2626.cindex "system filter" "testing"
2627.cindex "testing" "system filter"
2628This option is the same as &%-bf%& except that it assumes that the filter being
168e428f
PH
2629tested is a system filter. The additional commands that are available only in
2630system filters are recognized.
2631
9b371988
PH
2632.vitem &%-bf%&&~<&'filename'&>
2633.oindex "&%-bf%&"
2634.cindex "filter" "testing"
2635.cindex "testing" "filter file"
2636.cindex "forward file" "testing"
2637.cindex "testing" "forward file"
2638.cindex "Sieve filter" "testing"
168e428f
PH
2639This option runs Exim in user filter testing mode; the file is the filter file
2640to be tested, and a test message must be supplied on the standard input. If
2641there are no message-dependent tests in the filter, an empty file can be
2642supplied.
168e428f 2643
9b371988
PH
2644If you want to test a system filter file, use &%-bF%& instead of &%-bf%&. You
2645can use both &%-bF%& and &%-bf%& on the same command, in order to test a system
2646filter and a user filter in the same run. For example:
2647.code
2648exim -bF /system/filter -bf /user/filter </test/message
2649.endd
168e428f
PH
2650This is helpful when the system filter adds header lines or sets filter
2651variables that are used by the user filter.
168e428f 2652
9b371988
PH
2653If the test filter file does not begin with one of the special lines
2654.code
2655# Exim filter
2656# Sieve filter
2657.endd
2658it is taken to be a normal &_.forward_& file, and is tested for validity under
2659that interpretation. See sections &<<SECTitenonfilred>>& to
2660&<<SECTspecitredli>>& for a description of the possible contents of non-filter
2661redirection lists.
2662
2663The result of an Exim command that uses &%-bf%&, provided no errors are
168e428f
PH
2664detected, is a list of the actions that Exim would try to take if presented
2665with the message for real. More details of filter testing are given in the
9b371988
PH
2666separate document entitled &'Exim's interfaces to mail filtering'&.
2667
168e428f 2668When testing a filter file,
9b371988
PH
2669.cindex "&""From""& line"
2670.cindex "envelope sender"
2671.cindex "&%-f%& option" "for filter testing"
2672the envelope sender can be set by the &%-f%& option,
2673or by a &"From&~"& line at the start of the test message. Various parameters
2674that would normally be taken from the envelope recipient address of the message
2675can be set by means of additional command line options (see the next four
2676options).
2677
2678.vitem &%-bfd%&&~<&'domain'&>
2679.oindex "&%-bfd%&"
2680.cindex "&$qualify_domain$&"
168e428f 2681This sets the domain of the recipient address when a filter file is being
9b371988
PH
2682tested by means of the &%-bf%& option. The default is the value of
2683&$qualify_domain$&.
168e428f 2684
9b371988
PH
2685.vitem &%-bfl%&&~<&'local&~part'&>
2686.oindex "&%-bfl%&"
168e428f 2687This sets the local part of the recipient address when a filter file is being
9b371988 2688tested by means of the &%-bf%& option. The default is the username of the
168e428f
PH
2689process that calls Exim. A local part should be specified with any prefix or
2690suffix stripped, because that is how it appears to the filter when a message is
2691actually being delivered.
2692
9b371988
PH
2693.vitem &%-bfp%&&~<&'prefix'&>
2694.oindex "&%-bfp%&"
168e428f 2695This sets the prefix of the local part of the recipient address when a filter
9b371988 2696file is being tested by means of the &%-bf%& option. The default is an empty
168e428f
PH
2697prefix.
2698
9b371988
PH
2699.vitem &%-bfs%&&~<&'suffix'&>
2700.oindex "&%-bfs%&"
168e428f 2701This sets the suffix of the local part of the recipient address when a filter
9b371988 2702file is being tested by means of the &%-bf%& option. The default is an empty
168e428f
PH
2703suffix.
2704
9b371988
PH
2705.vitem &%-bh%&&~<&'IP&~address'&>
2706.oindex "&%-bh%&"
2707.cindex "testing" "incoming SMTP"
2708.cindex "SMTP" "testing incoming"
2709.cindex "testing" "relay control"
2710.cindex "relaying" "testing configuration"
2711.cindex "policy control" "testing"
2712.cindex "debugging" "&%-bh%& option"
168e428f
PH
2713This option runs a fake SMTP session as if from the given IP address, using the
2714standard input and output. The IP address may include a port number at the end,
2715after a full stop. For example:
9b371988
PH
2716.code
2717exim -bh 10.9.8.7.1234
2718exim -bh fe80::a00:20ff:fe86:a061.5678
2719.endd
168e428f 2720When an IPv6 address is given, it is converted into canonical form. In the case
9b371988
PH
2721of the second example above, the value of &$sender_host_address$& after
2722conversion to the canonical form is
2723&`fe80:0000:0000:0a00:20ff:fe86:a061.5678`&.
2724
168e428f 2725Comments as to what is going on are written to the standard error file. These
9b371988 2726include lines beginning with &"LOG"& for anything that would have been logged.
168e428f
PH
2727This facility is provided for testing configuration options for incoming
2728messages, to make sure they implement the required policy. For example, you can
9b371988
PH
2729test your relay controls using &%-bh%&.
2730
2731&*Warning 1*&:
2732.cindex "RFC 1413"
168e428f
PH
2733You cannot test features of the configuration that rely on
2734ident (RFC 1413) callouts. These cannot be done when testing using
9b371988
PH
2735&%-bh%& because there is no incoming SMTP connection.
2736
2737&*Warning 2*&: Address verification callouts (see section &<<SECTcallver>>&)
2738are also skipped when testing using &%-bh%&. If you want these callouts to
2739occur, use &%-bhc%& instead.
2740
168e428f
PH
2741Messages supplied during the testing session are discarded, and nothing is
2742written to any of the real log files. There may be pauses when DNS (and other)
9b371988 2743lookups are taking place, and of course these may time out. The &%-oMi%& option
168e428f 2744can be used to specify a specific IP interface and port if this is important.
9b371988
PH
2745
2746The &'exim_checkaccess'& utility is a &"packaged"& version of &%-bh%& whose
168e428f 2747output just states whether a given recipient address from a given host is
9b371988 2748acceptable or not. See section &<<SECTcheckaccess>>&.
168e428f 2749
9b371988
PH
2750.vitem &%-bhc%&&~<&'IP&~address'&>
2751.oindex "&%-bhc%&"
2752This option operates in the same way as &%-bh%&, except that address
168e428f
PH
2753verification callouts are performed if required. This includes consulting and
2754updating the callout cache database.
2755
9b371988
PH
2756.vitem &%-bi%&
2757.oindex "&%-bi%&"
2758.cindex "alias file" "building"
2759.cindex "building alias file"
2760.cindex "Sendmail compatibility" "&%-bi%& option"
2761Sendmail interprets the &%-bi%& option as a request to rebuild its alias file.
168e428f 2762Exim does not have the concept of a single alias file, and so it cannot mimic
9b371988 2763this behaviour. However, calls to &_/usr/lib/sendmail_& with the &%-bi%& option
168e428f
PH
2764tend to appear in various scripts such as NIS make files, so the option must be
2765recognized.
9b371988
PH
2766
2767If &%-bi%& is encountered, the command specified by the &%bi_command%&
168e428f 2768configuration option is run, under the uid and gid of the caller of Exim. If
9b371988
PH
2769the &%-oA%& option is used, its value is passed to the command as an argument.
2770The command set by &%bi_command%& may not contain arguments. The command can
2771use the &'exim_dbmbuild'& utility, or some other means, to rebuild alias files
2772if this is required. If the &%bi_command%& option is not set, calling Exim with
2773&%-bi%& is a no-op.
2774
2775.vitem &%-bm%&
2776.oindex "&%-bm%&"
2777.cindex "local message reception"
168e428f
PH
2778This option runs an Exim receiving process that accepts an incoming,
2779locally-generated message on the current input. The recipients are given as the
9b371988 2780command arguments (except when &%-t%& is also present &-- see below). Each
168e428f
PH
2781argument can be a comma-separated list of RFC 2822 addresses. This is the
2782default option for selecting the overall action of an Exim call; it is assumed
2783if no other conflicting option is present.
9b371988 2784
168e428f 2785If any addresses in the message are unqualified (have no domain), they are
9b371988
PH
2786qualified by the values of the &%qualify_domain%& or &%qualify_recipient%&
2787options, as appropriate. The &%-bnq%& option (see below) provides a way of
168e428f 2788suppressing this for special cases.
9b371988 2789
168e428f 2790Policy checks on the contents of local messages can be enforced by means of
9b371988
PH
2791the non-SMTP ACL. See chapter &<<CHAPACL>>& for details.
2792
2793.cindex "return code" "for &%-bm%&"
2794The return code is zero if the message is successfully accepted. Otherwise, the
2795action is controlled by the &%-oe%&&'x'& option setting &-- see below.
2796
168e428f 2797The format
9b371988
PH
2798.cindex "message" "format"
2799.cindex "format" "message"
2800.cindex "&""From""& line"
2801.cindex "UUCP" "&""From""& line"
2802.cindex "Sendmail compatibility" "&""From""& line"
168e428f
PH
2803of the message must be as defined in RFC 2822, except that, for
2804compatibility with Sendmail and Smail, a line in one of the forms
9b371988
PH
2805.code
2806From sender Fri Jan 5 12:55 GMT 1997
2807From sender Fri, 5 Jan 97 12:55:01
2808.endd
168e428f
PH
2809(with the weekday optional, and possibly with additional text after the date)
2810is permitted to appear at the start of the message. There appears to be no
2811authoritative specification of the format of this line. Exim recognizes it by
9b371988 2812matching against the regular expression defined by the &%uucp_from_pattern%&
168e428f 2813option, which can be changed if necessary.
9b371988 2814
168e428f 2815The
9b371988 2816.cindex "&%-f%& option" "overriding &""From""& line"
168e428f 2817specified sender is treated as if it were given as the argument to the
9b371988 2818&%-f%& option, but if a &%-f%& option is also present, its argument is used in
168e428f
PH
2819preference to the address taken from the message. The caller of Exim must be a
2820trusted user for the sender of a message to be set in this way.
2821
9b371988
PH
2822.vitem &%-bnq%&
2823.oindex "&%-bnq%&"
2824.cindex "address qualification" "suppressing"
168e428f
PH
2825By default, Exim automatically qualifies unqualified addresses (those
2826without domains) that appear in messages that are submitted locally (that
2827is, not over TCP/IP). This qualification applies both to addresses in
2828envelopes, and addresses in header lines. Sender addresses are qualified using
9b371988
PH
2829&%qualify_domain%&, and recipient addresses using &%qualify_recipient%& (which
2830defaults to the value of &%qualify_domain%&).
2831
2832Sometimes, qualification is not wanted. For example, if &%-bS%& (batch SMTP) is
168e428f
PH
2833being used to re-submit messages that originally came from remote hosts after
2834content scanning, you probably do not want to qualify unqualified addresses in
2835header lines. (Such lines will be present only if you have not enabled a header
2836syntax check in the appropriate ACL.)
9b371988
PH
2837
2838The &%-bnq%& option suppresses all qualification of unqualified addresses in
168e428f
PH
2839messages that originate on the local host. When this is used, unqualified
2840addresses in the envelope provoke errors (causing message rejection) and
2841unqualified addresses in header lines are left alone.
2842
2843
9b371988
PH
2844.vitem &%-bP%&
2845.oindex "&%-bP%&"
2846.cindex "configuration options" "extracting"
2847.cindex "options" "configuration &-- extracting"
168e428f
PH
2848If this option is given with no arguments, it causes the values of all Exim's
2849main configuration options to be written to the standard output. The values
2850of one or more specific options can be requested by giving their names as
2851arguments, for example:
9b371988
PH
2852.code
2853exim -bP qualify_domain hold_domains
2854.endd
2855However, any option setting that is preceded by the word &"hide"& in the
168e428f
PH
2856configuration file is not shown in full, except to an admin user. For other
2857users, the output is as in this example:
9b371988
PH
2858.code
2859mysql_servers = <value not displayable>
2860.endd
2861If &%configure_file%& is given as an argument, the name of the run time
168e428f
PH
2862configuration file is output.
2863If a list of configuration files was supplied, the value that is output here
2864is the name of the file that was actually used.
168e428f 2865
9b371988
PH
2866.cindex "daemon" "process id (pid)"
2867.cindex "pid (process id)" "of daemon"
2868If &%log_file_path%& or &%pid_file_path%& are given, the names of the
2869directories where log files and daemon pid files are written are output,
2870respectively. If these values are unset, log files are written in a
2871sub-directory of the spool directory called &%log%&, and the pid file is
2872written directly into the spool directory.
2873
2874If &%-bP%& is followed by a name preceded by &`+`&, for example,
2875.code
2876exim -bP +local_domains
2877.endd
168e428f
PH
2878it searches for a matching named list of any type (domain, host, address, or
2879local part) and outputs what it finds.
9b371988
PH
2880
2881.cindex "options" "router &-- extracting"
2882.cindex "options" "transport &-- extracting"
2883If one of the words &%router%&, &%transport%&, or &%authenticator%& is given,
168e428f
PH
2884followed by the name of an appropriate driver instance, the option settings for
2885that driver are output. For example:
9b371988
PH
2886.code
2887exim -bP transport local_delivery
2888.endd
168e428f
PH
2889The generic driver options are output first, followed by the driver's private
2890options. A list of the names of drivers of a particular type can be obtained by
9b371988
PH
2891using one of the words &%router_list%&, &%transport_list%&, or
2892&%authenticator_list%&, and a complete list of all drivers with their option
2893settings can be obtained by using &%routers%&, &%transports%&, or
2894&%authenticators%&.
168e428f
PH
2895
2896
9b371988
PH
2897.vitem &%-bp%&
2898.oindex "&%-bp%&"
2899.cindex "queue" "listing messages on"
2900.cindex "listing" "messages on the queue"
168e428f 2901This option requests a listing of the contents of the mail queue on the
9b371988 2902standard output. If the &%-bp%& option is followed by a list of message ids,
168e428f 2903just those messages are listed. By default, this option can be used only by an
9b371988 2904admin user. However, the &%queue_list_requires_admin%& option can be set false
168e428f 2905to allow any user to see the queue.
168e428f 2906
9b371988
PH
2907Each message on the queue is displayed as in the following example:
2908.code
290925m 2.9K 0t5C6f-0000c8-00 <alice@wonderland.fict.example>
2910 red.king@looking-glass.fict.example
2911 <other addresses>
2912.endd
2913.cindex "message" "size in queue listing"
2914.cindex "size" "of message"
2915The first line contains the length of time the message has been on the queue
168e428f
PH
2916(in this case 25 minutes), the size of the message (2.9K), the unique local
2917identifier for the message, and the message sender, as contained in the
2918envelope. For bounce messages, the sender address is empty, and appears as
9b371988 2919&"<>"&. If the message was submitted locally by an untrusted user who overrode
168e428f
PH
2920the default sender address, the user's login name is shown in parentheses
2921before the sender address.
9b371988
PH
2922
2923.cindex "frozen messages" "in queue listing"
2924If the message is frozen (attempts to deliver it are suspended) then the text
2925&"*** frozen ***"& is displayed at the end of this line.
2926
168e428f
PH
2927The recipients of the message (taken from the envelope, not the headers) are
2928displayed on subsequent lines. Those addresses to which the message has already
2929been delivered are marked with the letter D. If an original address gets
2930expanded into several addresses via an alias or forward file, the original is
2931displayed with a D only when deliveries for all of its child addresses are
2932complete.
2933
2934
9b371988
PH
2935.vitem &%-bpa%&
2936.oindex "&%-bpa%&"
2937This option operates like &%-bp%&, but in addition it shows delivered addresses
168e428f 2938that were generated from the original top level address(es) in each message by
9b371988
PH
2939alias or forwarding operations. These addresses are flagged with &"+D"& instead
2940of just &"D"&.
168e428f
PH
2941
2942
9b371988
PH
2943.vitem &%-bpc%&
2944.oindex "&%-bpc%&"
2945.cindex "queue" "count of messages on"
168e428f
PH
2946This option counts the number of messages on the queue, and writes the total
2947to the standard output. It is restricted to admin users, unless
9b371988 2948&%queue_list_requires_admin%& is set false.
168e428f
PH
2949
2950
9b371988
PH
2951.vitem &%-bpr%&
2952.oindex "&%-bpr%&"
2953This option operates like &%-bp%&, but the output is not sorted into
168e428f
PH
2954chronological order of message arrival. This can speed it up when there are
2955lots of messages on the queue, and is particularly useful if the output is
2956going to be post-processed in a way that doesn't need the sorting.
2957
9b371988
PH
2958.vitem &%-bpra%&
2959.oindex "&%-bpra%&"
2960This option is a combination of &%-bpr%& and &%-bpa%&.
168e428f 2961
9b371988
PH
2962.vitem &%-bpru%&
2963.oindex "&%-bpru%&"
2964This option is a combination of &%-bpr%& and &%-bpu%&.
168e428f
PH
2965
2966
9b371988
PH
2967.vitem &%-bpu%&
2968.oindex "&%-bpu%&"
2969This option operates like &%-bp%& but shows only undelivered top-level
2970addresses for each message displayed. Addresses generated by aliasing or
2971forwarding are not shown, unless the message was deferred after processing by a
2972router with the &%one_time%& option set.
168e428f
PH
2973
2974
9b371988
PH
2975.vitem &%-brt%&
2976.oindex "&%-brt%&"
2977.cindex "testing" "retry configuration"
2978.cindex "retry" "configuration testing"
168e428f
PH
2979This option is for testing retry rules, and it must be followed by up to three
2980arguments. It causes Exim to look for a retry rule that matches the values
2981and to write it to the standard output. For example:
9b371988
PH
2982.code
2983exim -brt bach.comp.mus.example
2984Retry rule: *.comp.mus.example F,2h,15m; F,4d,30m;
2985.endd
2986See chapter &<<CHAPretry>>& for a description of Exim's retry rules. The first
168e428f 2987argument, which is required, can be a complete address in the form
4f578862
PH
2988&'local_part@domain'&, or it can be just a domain name. If the second argument
2989contains a dot, it is interpreted as an optional second domain name; if no
2990retry rule is found for the first argument, the second is tried. This ties in
2991with Exim's behaviour when looking for retry rules for remote hosts &-- if no
2992rule is found that matches the host, one that matches the mail domain is
2993sought. Finally, an argument that is the name of a specific delivery error, as
2994used in setting up retry rules, can be given. For example:
2995.code
2996exim -brt haydn.comp.mus.example quota_3d
2997Retry rule: *@haydn.comp.mus.example quota_3d F,1h,15m
2998.endd
168e428f 2999
9b371988
PH
3000.vitem &%-brw%&
3001.oindex "&%-brw%&"
3002.cindex "testing" "rewriting"
3003.cindex "rewriting" "testing"
168e428f
PH
3004This option is for testing address rewriting rules, and it must be followed by
3005a single argument, consisting of either a local part without a domain, or a
3006complete address with a fully qualified domain. Exim outputs how this address
3007would be rewritten for each possible place it might appear. See chapter
9b371988 3008&<<CHAPrewrite>>& for further details.
168e428f 3009
9b371988
PH
3010.vitem &%-bS%&
3011.oindex "&%-bS%&"
3012.cindex "SMTP" "batched incoming"
3013.cindex "batched SMTP input"
168e428f
PH
3014This option is used for batched SMTP input, which is an alternative interface
3015for non-interactive local message submission. A number of messages can be
3016submitted in a single run. However, despite its name, this is not really SMTP
3017input. Exim reads each message's envelope from SMTP commands on the standard
3018input, but generates no responses. If the caller is trusted, or
9b371988 3019&%untrusted_set_sender%& is set, the senders in the SMTP MAIL commands are
168e428f 3020believed; otherwise the sender is always the caller of Exim.
9b371988 3021
168e428f
PH
3022The message itself is read from the standard input, in SMTP format (leading
3023dots doubled), terminated by a line containing just a single dot. An error is
3024provoked if the terminating dot is missing. A further message may then follow.
9b371988 3025
168e428f 3026As for other local message submissions, the contents of incoming batch SMTP
9b371988
PH
3027messages can be checked using the non-SMTP ACL (see chapter &<<CHAPACL>>&).
3028Unqualified addresses are automatically qualified using &%qualify_domain%& and
3029&%qualify_recipient%&, as appropriate, unless the &%-bnq%& option is used.
3030
168e428f
PH
3031Some other SMTP commands are recognized in the input. HELO and EHLO act
3032as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
3033QUIT quits, ignoring the rest of the standard input.
9b371988
PH
3034
3035.cindex "return code" "for &%-bS%&"
168e428f
PH
3036If any error is encountered, reports are written to the standard output and
3037error streams, and Exim gives up immediately. The return code is 0 if no error
3038was detected; it is 1 if one or more messages were accepted before the error
3039was detected; otherwise it is 2.
9b371988 3040
168e428f 3041More details of input using batched SMTP are given in section
9b371988 3042&<<SECTincomingbatchedSMTP>>&.
168e428f 3043
9b371988
PH
3044.vitem &%-bs%&
3045.oindex "&%-bs%&"
3046.cindex "SMTP" "local input"
3047.cindex "local SMTP input"
168e428f
PH
3048This option causes Exim to accept one or more messages by reading SMTP commands
3049on the standard input, and producing SMTP replies on the standard output. SMTP
9b371988 3050policy controls, as defined in ACLs (see chapter &<<CHAPACL>>&) are applied.
168e428f
PH
3051Some user agents use this interface as a way of passing locally-generated
3052messages to the MTA.
9b371988 3053
168e428f 3054In
9b371988
PH
3055.cindex "sender" "source of"
3056this usage, if the caller of Exim is trusted, or &%untrusted_set_sender%& is
168e428f
PH
3057set, the senders of messages are taken from the SMTP MAIL commands.
3058Otherwise the content of these commands is ignored and the sender is set up as
3059the calling user. Unqualified addresses are automatically qualified using
9b371988
PH
3060&%qualify_domain%& and &%qualify_recipient%&, as appropriate, unless the
3061&%-bnq%& option is used.
3062
3063.cindex "inetd"
168e428f 3064The
9b371988
PH
3065&%-bs%& option is also used to run Exim from &'inetd'&, as an alternative to
3066using a listening daemon. Exim can distinguish the two cases by checking
3067whether the standard input is a TCP/IP socket. When Exim is called from
3068&'inetd'&, the source of the mail is assumed to be remote, and the comments
3069above concerning senders and qualification do not apply. In this situation,
3070Exim behaves in exactly the same way as it does when receiving a message via
3071the listening daemon.
3072
3073.vitem &%-bt%&
3074.oindex "&%-bt%&"
3075.cindex "testing" "addresses"
3076.cindex "address" "testing"
168e428f
PH
3077This option runs Exim in address testing mode, in which each argument is taken
3078as an address to be tested for deliverability. The results are written to the
3079standard output. If a test fails, and the caller is not an admin user, no
3080details of the failure are output, because these might contain sensitive
3081information such as usernames and passwords for database lookups.
9b371988 3082
168e428f
PH
3083If no arguments are given, Exim runs in an interactive manner, prompting with a
3084right angle bracket for addresses to be tested.
9b371988
PH
3085
3086Unlike the &%-be%& test option, you cannot arrange for Exim to use the
3087&[readline()]& function, because it is running as &'root'& and there are
168e428f 3088security issues.
9b371988 3089
168e428f 3090Each address is handled as if it were the recipient address of a message
9b371988 3091(compare the &%-bv%& option). It is passed to the routers and the result is
168e428f 3092written to the standard output. However, any router that has
9b371988 3093&%no_address_test%& set is bypassed. This can make &%-bt%& easier to use for
168e428f
PH
3094genuine routing tests if your first router passes everything to a scanner
3095program.
9b371988 3096
168e428f 3097The
9b371988 3098.cindex "return code" "for &%-bt%&"
168e428f
PH
3099return code is 2 if any address failed outright; it is 1 if no address
3100failed outright but at least one could not be resolved for some reason. Return
3101code 0 is given only when all addresses succeed.
9b371988
PH
3102
3103&*Warning*&: &%-bt%& can only do relatively simple testing. If any of the
168e428f
PH
3104routers in the configuration makes any tests on the sender address of a
3105message,
9b371988
PH
3106.cindex "&%-f%& option" "for address testing"
3107you can use the &%-f%& option to set an appropriate sender when running
3108&%-bt%& tests. Without it, the sender is assumed to be the calling user at the
168e428f
PH
3109default qualifying domain. However, if you have set up (for example) routers
3110whose behaviour depends on the contents of an incoming message, you cannot test
9b371988 3111those conditions using &%-bt%&. The &%-N%& option provides a possible way of
168e428f
PH
3112doing such tests.
3113
9b371988
PH
3114.vitem &%-bV%&