1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
5 <title>Specification of the Exim Mail Transfer Agent</title>
6 <titleabbrev>The Exim MTA</titleabbrev>
7 <date>27 July 2006</date>
8 <author><firstname>Philip</firstname><surname>Hazel</surname></author>
9 <authorinitials>PH</authorinitials>
10 <affiliation><orgname>University of Cambridge Computing Service</orgname></affiliation>
11 <address>New Museums Site, Pembroke Street, Cambridge CB2 3QH, England</address>
12 <revhistory><revision>
13 <revnumber>4.63</revnumber>
14 <date>27 July 2006</date>
15 <authorinitials>PH</authorinitials>
16 </revision></revhistory>
17 <copyright><year>2006</year><holder>University of Cambridge</holder></copyright>
20 <title>Introduction</title>
22 <indexterm role="concept">
23 <primary>$1, $2, etc.</primary>
24 <see><emphasis>numerical variables</emphasis></see>
26 <indexterm role="concept">
27 <primary>address</primary>
28 <secondary>rewriting</secondary>
29 <see><emphasis>rewriting</emphasis></see>
31 <indexterm role="concept">
32 <primary>Bounce Address Tag Validation</primary>
33 <see><emphasis>BATV</emphasis></see>
35 <indexterm role="concept">
36 <primary>Client SMTP Authorization</primary>
37 <see><emphasis>CSA</emphasis></see>
39 <indexterm role="concept">
40 <primary>CR character</primary>
41 <see><emphasis>carriage return</emphasis></see>
43 <indexterm role="concept">
44 <primary>CRL</primary>
45 <see><emphasis>certificate revocation list</emphasis></see>
47 <indexterm role="concept">
48 <primary>delivery</primary>
49 <secondary>failure report</secondary>
50 <see><emphasis>bounce message</emphasis></see>
52 <indexterm role="concept">
53 <primary>dialup</primary>
54 <see><emphasis>intermittently connected hosts</emphasis></see>
56 <indexterm role="concept">
57 <primary>exiscan</primary>
58 <see><emphasis>content scanning</emphasis></see>
60 <indexterm role="concept">
61 <primary>failover</primary>
62 <see><emphasis>fallback</emphasis></see>
64 <indexterm role="concept">
65 <primary>fallover</primary>
66 <see><emphasis>fallback</emphasis></see>
68 <indexterm role="concept">
69 <primary>filter</primary>
70 <secondary>Sieve</secondary>
71 <see><emphasis>Sieve filter</emphasis></see>
73 <indexterm role="concept">
74 <primary>ident</primary>
75 <see><emphasis>RFC 1413</emphasis></see>
77 <indexterm role="concept">
78 <primary>LF character</primary>
79 <see><emphasis>linefeed</emphasis></see>
81 <indexterm role="concept">
82 <primary>maximum</primary>
83 <see><emphasis>limit</emphasis></see>
85 <indexterm role="concept">
86 <primary>monitor</primary>
87 <see><emphasis>Exim monitor</emphasis></see>
89 <indexterm role="concept">
90 <primary>no_<emphasis>xxx</emphasis></primary>
91 <see>entry for xxx</see>
93 <indexterm role="concept">
94 <primary>NUL</primary>
95 <see><emphasis>binary zero</emphasis></see>
97 <indexterm role="concept">
98 <primary>passwd file</primary>
99 <see><emphasis>/etc/passwd</emphasis></see>
101 <indexterm role="concept">
102 <primary>process id</primary>
103 <see><emphasis>pid</emphasis></see>
105 <indexterm role="concept">
106 <primary>RBL</primary>
107 <see><emphasis>DNS list</emphasis></see>
109 <indexterm role="concept">
110 <primary>redirection</primary>
111 <see><emphasis>address redirection</emphasis></see>
113 <indexterm role="concept">
114 <primary>return path</primary>
115 <seealso><emphasis>envelope sender</emphasis></seealso>
117 <indexterm role="concept">
118 <primary>scanning</primary>
119 <see><emphasis>content scanning</emphasis></see>
121 <indexterm role="concept">
122 <primary>SSL</primary>
123 <see><emphasis>TLS</emphasis></see>
125 <indexterm role="concept">
126 <primary>string</primary>
127 <secondary>expansion</secondary>
128 <see><emphasis>expansion</emphasis></see>
130 <indexterm role="concept">
131 <primary>top bit</primary>
132 <see><emphasis>8-bit characters</emphasis></see>
134 <indexterm role="concept">
135 <primary>variables</primary>
136 <see><emphasis>expansion, variables</emphasis></see>
138 <indexterm role="concept">
139 <primary>zero, binary</primary>
140 <see><emphasis>binary zero</emphasis></see>
144 Exim is a mail transfer agent (MTA) for hosts that are running Unix or
145 Unix-like operating systems. It was designed on the assumption that it would be
146 run on hosts that are permanently connected to the Internet. However, it can be
147 used on intermittently connected hosts with suitable configuration adjustments.
150 Configuration files currently exist for the following operating systems: AIX,
151 BSD/OS (aka BSDI), Darwin (Mac OS X), DGUX, Dragonfly, FreeBSD, GNU/Hurd,
152 GNU/Linux, HI-OSF (Hitachi), HI-UX, HP-UX, IRIX, MIPS RISCOS, NetBSD, OpenBSD,
153 OpenUNIX, QNX, SCO, SCO SVR4.2 (aka UNIX-SV), Solaris (aka SunOS5), SunOS4,
154 Tru64-Unix (formerly Digital UNIX, formerly DEC-OSF1), Ultrix, and Unixware.
155 Some of these operating systems are no longer current and cannot easily be
156 tested, so the configuration files may no longer work in practice.
159 There are also configuration files for compiling Exim in the Cygwin environment
160 that can be installed on systems running Windows. However, this document does
161 not contain any information about running Exim in the Cygwin environment.
164 The terms and conditions for the use and distribution of Exim are contained in
165 the file <filename>NOTICE</filename>. Exim is distributed under the terms of the GNU General
166 Public Licence, a copy of which may be found in the file <filename>LICENCE</filename>.
169 The use, supply or promotion of Exim for the purpose of sending bulk,
170 unsolicited electronic mail is incompatible with the basic aims of the program,
171 which revolve around the free provision of a service that enhances the quality
172 of personal communications. The author of Exim regards indiscriminate
173 mass-mailing as an antisocial, irresponsible abuse of the Internet.
176 Exim owes a great deal to Smail 3 and its author, Ron Karr. Without the
177 experience of running and working on the Smail 3 code, I could never have
178 contemplated starting to write a new MTA. Many of the ideas and user interfaces
179 were originally taken from Smail 3, though the actual code of Exim is entirely
180 new, and has developed far beyond the initial concept.
183 Many people, both in Cambridge and around the world, have contributed to the
184 development and the testing of Exim, and to porting it to various operating
185 systems. I am grateful to them all. The distribution now contains a file called
186 <filename>ACKNOWLEDGMENTS</filename>, in which I have started recording the names of
190 <title>Exim documentation</title>
191 <para revisionflag="changed">
192 <indexterm role="concept">
193 <primary>documentation</primary>
195 This edition of the Exim specification applies to version 4.63 of Exim.
196 Substantive changes from the 4.62 edition are marked in some
197 renditions of the document; this paragraph is so marked if the rendition is
198 capable of showing a change indicator.
201 This document is very much a reference manual; it is not a tutorial. The reader
202 is expected to have some familiarity with the SMTP mail transfer protocol and
203 with general Unix system administration. Although there are some discussions
204 and examples in places, the information is mostly organized in a way that makes
205 it easy to look up, rather than in a natural order for sequential reading.
206 Furthermore, the manual aims to cover every aspect of Exim in detail, including
207 a number of rarely-used, special-purpose features that are unlikely to be of
211 <indexterm role="concept">
212 <primary>books about Exim</primary>
214 An <quote>easier</quote> discussion of Exim which provides more in-depth explanatory,
215 introductory, and tutorial material can be found in a book entitled <emphasis>The Exim
216 SMTP Mail Server</emphasis>, published by UIT Cambridge
217 (<emphasis role="bold"><ulink url="http://www.uit.co.uk/exim-book/">http://www.uit.co.uk/exim-book/</ulink></emphasis>).
220 This book also contains a chapter that gives a general introduction to SMTP and
221 Internet mail. Inevitably, however, the book is unlikely to be fully up-to-date
222 with the latest release of Exim. (Note that the earlier book about Exim,
223 published by O’Reilly, covers Exim 3, and many things have changed in Exim 4.)
226 <indexterm role="concept">
227 <primary>Debian</primary>
228 <secondary>information sources</secondary>
230 If you are using a Debian distribution of Exim, you will find information about
231 Debian-specific features in the file
234 <filename>/usr/share/doc/exim4-base/README.Debian</filename>
237 The command <command>man update-exim.conf</command> is another source of Debian-specific
241 <indexterm role="concept">
242 <primary><filename>doc/NewStuff</filename></primary>
244 <indexterm role="concept">
245 <primary><filename>doc/ChangeLog</filename></primary>
247 <indexterm role="concept">
248 <primary>change log</primary>
250 As the program develops, there may be features in newer versions that have not
251 yet made it into this document, which is updated only when the most significant
252 digit of the fractional part of the version number changes. Specifications of
253 new features that are not yet in this manual are placed in the file
254 <filename>doc/NewStuff</filename> in the Exim distribution.
257 Some features may be classified as <quote>experimental</quote>. These may change
258 incompatibly while they are developing, or even be withdrawn. For this reason,
259 they are not documented in this manual. Information about experimental features
260 can be found in the file <filename>doc/experimental.txt</filename>.
263 All changes to the program (whether new features, bug fixes, or other kinds of
264 change) are noted briefly in the file called <filename>doc/ChangeLog</filename>.
267 <indexterm role="concept">
268 <primary><filename>doc/spec.txt</filename></primary>
270 This specification itself is available as an ASCII file in <filename>doc/spec.txt</filename> so
271 that it can easily be searched with a text editor. Other files in the <filename>doc</filename>
274 <informaltable frame="none">
275 <tgroup cols="2" colsep="0" rowsep="0">
276 <colspec colwidth="100pt" align="left"/>
277 <colspec colwidth="254pt" align="left"/>
280 <entry><filename>OptionLists.txt</filename></entry>
281 <entry>list of all options in alphabetical order</entry>
284 <entry><filename>dbm.discuss.txt</filename></entry>
285 <entry>discussion about DBM libraries</entry>
288 <entry><filename>exim.8</filename></entry>
289 <entry>a man page of Exim’s command line options</entry>
292 <entry><filename>experimental.txt</filename></entry>
293 <entry>documentation of experimental features</entry>
296 <entry><filename>filter.txt</filename></entry>
297 <entry>specification of the filter language</entry>
300 <entry><filename>pcrepattern.txt</filename></entry>
301 <entry>specification of PCRE regular expressions</entry>
304 <entry><filename>pcretest.txt</filename></entry>
305 <entry>specification of the PCRE testing program</entry>
308 <entry><filename>Exim3.upgrade</filename></entry>
309 <entry>upgrade notes from release 2 to release 3</entry>
312 <entry><filename>Exim4.upgrade</filename></entry>
313 <entry>upgrade notes from release 3 to release 4</entry>
319 The main specification and the specification of the filtering language are also
320 available in other formats (HTML, PostScript, PDF, and Texinfo). Section
321 <xref linkend="SECTavail"/> below tells you how to get hold of these.
325 <title>FTP and web sites</title>
327 <indexterm role="concept">
328 <primary>web site</primary>
330 <indexterm role="concept">
331 <primary>FTP site</primary>
333 The primary site for Exim source distributions is currently the University of
334 Cambridge’s FTP site, whose contents are described in <emphasis>Where to find the Exim
335 distribution</emphasis> below. In addition, there is a web site and an FTP site at
336 <option>exim.org</option>. These are now also hosted at the University of Cambridge. The
337 <option>exim.org</option> site was previously hosted for a number of years by Energis
338 Squared, formerly Planet Online Ltd, whose support I gratefully acknowledge.
341 <indexterm role="concept">
342 <primary>wiki</primary>
344 <indexterm role="concept">
345 <primary>FAQ</primary>
347 As well as Exim distribution tar files, the Exim web site contains a number of
348 differently formatted versions of the documentation, including the FAQ in both
349 text and HTML formats. The HTML version comes with a keyword-in-context index.
350 A recent addition to the online information is the Exim wiki
351 (<emphasis role="bold"><ulink url="http://www.exim.org/eximwiki/">http://www.exim.org/eximwiki/</ulink></emphasis>). We hope that this will make it easier
352 for Exim users to contribute examples, tips, and know-how for the benefit of
357 <title>Mailing lists</title>
359 <indexterm role="concept">
360 <primary>mailing lists</primary>
361 <secondary>for Exim users</secondary>
363 The following are the three main Exim mailing lists:
365 <informaltable frame="none">
366 <tgroup cols="2" colsep="0" rowsep="0">
367 <colspec colwidth="140pt" align="left"/>
368 <colspec colwidth="254pt" align="left"/>
371 <entry><emphasis>exim-users@exim.org</emphasis></entry>
372 <entry>general discussion list</entry>
375 <entry><emphasis>exim-dev@exim.org</emphasis></entry>
376 <entry>discussion of bugs, enhancements, etc.</entry>
379 <entry><emphasis>exim-announce@exim.org</emphasis></entry>
380 <entry>moderated, low volume announcements list</entry>
385 <para revisionflag="changed">
386 You can subscribe to these lists, change your existing subscriptions, and view
387 or search the archives via the mailing lists link on the Exim home page.
388 <indexterm role="concept">
389 <primary>Debian</primary>
390 <secondary>mailing list for</secondary>
392 If you are using a Debian distribution of Exim, you may wish to subscribe to
393 the Debian-specific mailing list <emphasis>pkg-exim4-users@lists.alioth.debian.org</emphasis>
396 <literallayout revisionflag="changed">
397 <emphasis role="bold"><ulink url="http://lists.alioth.debian.org/mailman/listinfo/pkg-exim4-users">http://lists.alioth.debian.org/mailman/listinfo/pkg-exim4-users</ulink></emphasis>
399 <para revisionflag="changed">
400 Please ask Debian-specific questions on this list and not on the general Exim
405 <title>Exim training</title>
407 <indexterm role="concept">
408 <primary>training courses</primary>
410 From time to time (approximately annually at the time of writing), training
411 courses are run by the author of Exim in Cambridge, UK. Details of any
412 forthcoming courses can be found on the web site
413 <emphasis role="bold"><ulink url="http://www-tus.csx.cam.ac.uk/courses/exim/">http://www-tus.csx.cam.ac.uk/courses/exim/</ulink></emphasis>.
417 <title>Bug reports</title>
419 <indexterm role="concept">
420 <primary>bug reports</primary>
422 <indexterm role="concept">
423 <primary>reporting bugs</primary>
425 Reports of obvious bugs should be emailed to <emphasis>bugs@exim.org</emphasis>. However, if you
426 are unsure whether some behaviour is a bug or not, the best thing to do is to
427 post a message to the <emphasis>exim-dev</emphasis> mailing list and have it discussed.
430 <section id="SECTavail">
431 <title>Where to find the Exim distribution</title>
433 <indexterm role="concept">
434 <primary>FTP site</primary>
436 <indexterm role="concept">
437 <primary>distribution</primary>
438 <secondary>ftp site</secondary>
440 The master ftp site for the Exim distribution is
443 <emphasis role="bold">ftp://ftp.csx.cam.ac.uk/pub/software/email/exim</emphasis>
449 <emphasis role="bold">ftp://ftp.exim.org/pub/exim</emphasis>
452 The file references that follow are relative to the <filename>exim</filename> directories at
453 these sites. There are now quite a number of independent mirror sites around
454 the world. Those that I know about are listed in the file called <filename>Mirrors</filename>.
457 Within the <filename>exim</filename> directory there are subdirectories called <filename>exim3</filename> (for
458 previous Exim 3 distributions), <filename>exim4</filename> (for the latest Exim 4
459 distributions), and <filename>Testing</filename> for testing versions. In the <filename>exim4</filename>
460 subdirectory, the current release can always be found in files called
463 <filename>exim-n.nn.tar.gz</filename>
464 <filename>exim-n.nn.tar.bz2</filename>
467 where <emphasis>n.nn</emphasis> is the highest such version number in the directory. The two
468 files contain identical data; the only difference is the type of compression.
469 The <filename>.bz2</filename> file is usually a lot smaller than the <filename>.gz</filename> file.
472 <indexterm role="concept">
473 <primary>distribution</primary>
474 <secondary>signing details</secondary>
476 <indexterm role="concept">
477 <primary>distribution</primary>
478 <secondary>public key</secondary>
480 <indexterm role="concept">
481 <primary>public key for signed distribution</primary>
483 The distributions are currently signed with Philip Hazel’s GPG key. The
484 corresponding public key is available from a number of keyservers, and there is
485 also a copy in the file <filename>Public-Key</filename>. The signatures for the tar bundles are
489 <filename>exim-n.nn.tar.gz.sig</filename>
490 <filename>exim-n.nn.tar.bz2.sig</filename>
493 For each released version, the log of changes is made separately available in a
494 separate file in the directory <filename>ChangeLogs</filename> so that it is possible to
495 find out what has changed without having to download the entire distribution.
498 <indexterm role="concept">
499 <primary>documentation</primary>
500 <secondary>available formats</secondary>
502 The main distribution contains ASCII versions of this specification and other
503 documentation; other formats of the documents are available in separate files
504 inside the <filename>exim4</filename> directory of the FTP site:
507 <filename>exim-html-n.nn.tar.gz</filename>
508 <filename>exim-pdf-n.nn.tar.gz</filename>
509 <filename>exim-postscript-n.nn.tar.gz</filename>
510 <filename>exim-texinfo-n.nn.tar.gz</filename>
513 These tar files contain only the <filename>doc</filename> directory, not the complete
514 distribution, and are also available in <filename>.bz2</filename> as well as <filename>.gz</filename> forms.
515 <indexterm role="concept">
516 <primary>FAQ</primary>
518 The FAQ is available for downloading in two different formats in these files:
521 <filename>exim4/FAQ.txt.gz</filename>
522 <filename>exim4/FAQ.html.tar.gz</filename>
525 The first of these is a single ASCII file that can be searched with a text
526 editor. The second is a directory of HTML files, normally accessed by starting
527 at <filename>index.html</filename>. The HTML version of the FAQ (which is also included in the
528 HTML documentation tarbundle) includes a keyword-in-context index, which is
529 often the most convenient way of finding your way around.
533 <title>Wish list</title>
535 <indexterm role="concept">
536 <primary>wish list</primary>
539 <para revisionflag="changed">
540 A wish list is maintained, containing ideas for new features that have been
541 submitted. This used to be a single file that from time to time was exported to
542 the ftp site into the file <filename>exim4/WishList</filename>. However, it has now been
543 imported into Exim’s Bugzilla data.
547 <title>Contributed material</title>
549 <indexterm role="concept">
550 <primary>contributed material</primary>
552 At the ftp site, there is a directory called <filename>Contrib</filename> that contains
553 miscellaneous files contributed to the Exim community by Exim users. There is
554 also a collection of contributed configuration examples in
555 <filename>exim4/config.samples.tar.gz</filename>. These samples are referenced from the FAQ.
559 <title>Limitations</title>
563 <indexterm role="concept">
564 <primary>limitations of Exim</primary>
566 <indexterm role="concept">
567 <primary>bang paths</primary>
568 <secondary>not handled by Exim</secondary>
570 Exim is designed for use as an Internet MTA, and therefore handles addresses in
571 RFC 2822 domain format only. It cannot handle UUCP <quote>bang paths</quote>, though
572 simple two-component bang paths can be converted by a straightforward rewriting
573 configuration. This restriction does not prevent Exim from being interfaced to
574 UUCP as a transport mechanism, provided that domain addresses are used.
579 <indexterm role="concept">
580 <primary>domainless addresses</primary>
582 <indexterm role="concept">
583 <primary>address</primary>
584 <secondary>without domain</secondary>
586 Exim insists that every address it handles has a domain attached. For incoming
587 local messages, domainless addresses are automatically qualified with a
588 configured domain value. Configuration options specify from which remote
589 systems unqualified addresses are acceptable. These are then qualified on
595 <indexterm role="concept">
596 <primary>transport</primary>
597 <secondary>external</secondary>
599 <indexterm role="concept">
600 <primary>external transports</primary>
602 The only external transport mechanisms that are currently implemented are SMTP
603 and LMTP over a TCP/IP network (including support for IPv6). However, a pipe
604 transport is available, and there are facilities for writing messages to files
605 and pipes, optionally in <emphasis>batched SMTP</emphasis> format; these facilities can be used
606 to send messages to other transport mechanisms such as UUCP, provided they can
607 handle domain-style addresses. Batched SMTP input is also catered for.
612 Exim is not designed for storing mail for dial-in hosts. When the volumes of
613 such mail are large, it is better to get the messages <quote>delivered</quote> into files
614 (that is, off Exim’s queue) and subsequently passed on to the dial-in hosts by
620 Although Exim does have basic facilities for scanning incoming messages, these
621 are not comprehensive enough to do full virus or spam scanning. Such operations
622 are best carried out using additional specialized software packages. If you
623 compile Exim with the content-scanning extension, straightforward interfaces to
624 a number of common scanners are provided.
630 <title>Run time configuration</title>
632 Exim’s run time configuration is held in a single text file that is divided
633 into a number of sections. The entries in this file consist of keywords and
634 values, in the style of Smail 3 configuration files. A default configuration
635 file which is suitable for simple online installations is provided in the
636 distribution, and is described in chapter <xref linkend="CHAPdefconfil"/> below.
640 <title>Calling interface</title>
642 <indexterm role="concept">
643 <primary>Sendmail compatibility</primary>
644 <secondary>command line interface</secondary>
646 Like many MTAs, Exim has adopted the Sendmail command line interface so that it
647 can be a straight replacement for <filename>/usr/lib/sendmail</filename> or
648 <filename>/usr/sbin/sendmail</filename> when sending mail, but you do not need to know anything
649 about Sendmail in order to run Exim. For actions other than sending messages,
650 Sendmail-compatible options also exist, but those that produce output (for
651 example, <option>-bp</option>, which lists the messages on the queue) do so in Exim’s own
652 format. There are also some additional options that are compatible with Smail
653 3, and some further options that are new to Exim. Chapter <xref linkend="CHAPcommandline"/>
654 documents all Exim’s command line options. This information is automatically
655 made into the man page that forms part of the Exim distribution.
658 Control of messages on the queue can be done via certain privileged command
659 line options. There is also an optional monitor program called <emphasis>eximon</emphasis>,
660 which displays current information in an X window, and which contains a menu
661 interface to Exim’s command line administration options.
665 <title>Terminology</title>
667 <indexterm role="concept">
668 <primary>terminology definitions</primary>
670 <indexterm role="concept">
671 <primary>body of message</primary>
672 <secondary>definition of</secondary>
674 The <emphasis>body</emphasis> of a message is the actual data that the sender wants to transmit.
675 It is the last part of a message, and is separated from the <emphasis>header</emphasis> (see
676 below) by a blank line.
679 <indexterm role="concept">
680 <primary>bounce message</primary>
681 <secondary>definition of</secondary>
683 When a message cannot be delivered, it is normally returned to the sender in a
684 delivery failure message or a <quote>non-delivery report</quote> (NDR). The term
685 <emphasis>bounce</emphasis> is commonly used for this action, and the error reports are often
686 called <emphasis>bounce messages</emphasis>. This is a convenient shorthand for <quote>delivery
687 failure error report</quote>. Such messages have an empty sender address in the
688 message’s <emphasis>envelope</emphasis> (see below) to ensure that they cannot themselves give
689 rise to further bounce messages.
692 The term <emphasis>default</emphasis> appears frequently in this manual. It is used to qualify a
693 value which is used in the absence of any setting in the configuration. It may
694 also qualify an action which is taken unless a configuration setting specifies
698 The term <emphasis>defer</emphasis> is used when the delivery of a message to a specific
699 destination cannot immediately take place for some reason (a remote host may be
700 down, or a user’s local mailbox may be full). Such deliveries are <emphasis>deferred</emphasis>
704 The word <emphasis>domain</emphasis> is sometimes used to mean all but the first component of a
705 host’s name. It is <emphasis>not</emphasis> used in that sense here, where it normally refers to
706 the part of an email address following the @ sign.
709 <indexterm role="concept">
710 <primary>envelope</primary>
711 <secondary>definition of</secondary>
713 <indexterm role="concept">
714 <primary>sender</primary>
715 <secondary>definition of</secondary>
717 A message in transit has an associated <emphasis>envelope</emphasis>, as well as a header and a
718 body. The envelope contains a sender address (to which bounce messages should
719 be delivered), and any number of recipient addresses. References to the
720 sender or the recipients of a message usually mean the addresses in the
721 envelope. An MTA uses these addresses for delivery, and for returning bounce
722 messages, not the addresses that appear in the header lines.
725 <indexterm role="concept">
726 <primary>message header</primary>
727 <secondary>definition of</secondary>
729 <indexterm role="concept">
730 <primary>header section</primary>
731 <secondary>definition of</secondary>
733 The <emphasis>header</emphasis> of a message is the first part of a message’s text, consisting
734 of a number of lines, each of which has a name such as <emphasis>From:</emphasis>, <emphasis>To:</emphasis>,
735 <emphasis>Subject:</emphasis>, etc. Long header lines can be split over several text lines by
736 indenting the continuations. The header is separated from the body by a blank
740 <indexterm role="concept">
741 <primary>local part</primary>
742 <secondary>definition of</secondary>
744 <indexterm role="concept">
745 <primary>domain</primary>
746 <secondary>definition of</secondary>
748 The term <emphasis>local part</emphasis>, which is taken from RFC 2822, is used to refer to that
749 part of an email address that precedes the @ sign. The part that follows the
750 @ sign is called the <emphasis>domain</emphasis> or <emphasis>mail domain</emphasis>.
753 <indexterm role="concept">
754 <primary>local delivery</primary>
755 <secondary>definition of</secondary>
757 <indexterm role="concept">
758 <primary>remote delivery</primary>
759 <secondary>definition of</secondary>
761 The terms <emphasis>local delivery</emphasis> and <emphasis>remote delivery</emphasis> are used to distinguish
762 delivery to a file or a pipe on the local host from delivery by SMTP over
763 TCP/IP to another host. As far as Exim is concerned, all hosts other than the
764 host it is running on are <emphasis>remote</emphasis>.
767 <indexterm role="concept">
768 <primary>return path</primary>
769 <secondary>definition of</secondary>
771 <emphasis>Return path</emphasis> is another name that is used for the sender address in a
772 message’s envelope.
775 <indexterm role="concept">
776 <primary>queue</primary>
777 <secondary>definition of</secondary>
779 The term <emphasis>queue</emphasis> is used to refer to the set of messages awaiting delivery,
780 because this term is in widespread use in the context of MTAs. However, in
781 Exim’s case the reality is more like a pool than a queue, because there is
782 normally no ordering of waiting messages.
785 <indexterm role="concept">
786 <primary>queue runner</primary>
787 <secondary>definition of</secondary>
789 The term <emphasis>queue runner</emphasis> is used to describe a process that scans the queue
790 and attempts to deliver those messages whose retry times have come. This term
791 is used by other MTAs, and also relates to the command <option>runq</option>, but in Exim
792 the waiting messages are normally processed in an unpredictable order.
795 <indexterm role="concept">
796 <primary>spool directory</primary>
797 <secondary>definition of</secondary>
799 The term <emphasis>spool directory</emphasis> is used for a directory in which Exim keeps the
800 messages on its queue – that is, those that it is in the process of
801 delivering. This should not be confused with the directory in which local
802 mailboxes are stored, which is called a <quote>spool directory</quote> by some people. In
803 the Exim documentation, <quote>spool</quote> is always used in the first sense.
809 <title>Incorporated code</title>
811 <indexterm role="concept">
812 <primary>incorporated code</primary>
814 <indexterm role="concept">
815 <primary>regular expressions</primary>
816 <secondary>library</secondary>
818 <indexterm role="concept">
819 <primary>PCRE</primary>
821 A number of pieces of external code are included in the Exim distribution.
826 Regular expressions are supported in the main Exim program and in the Exim
827 monitor using the freely-distributable PCRE library, copyright ©
828 University of Cambridge. The source is distributed in the directory
829 <filename>src/pcre</filename>. However, this is a cut-down version of PCRE. If you want to use
830 the PCRE library in other programs, you should obtain and install the full
831 version from <emphasis role="bold"><ulink url="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre">ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre</ulink></emphasis>.
836 <indexterm role="concept">
837 <primary>cdb</primary>
838 <secondary>acknowledgement</secondary>
840 Support for the cdb (Constant DataBase) lookup method is provided by code
841 contributed by Nigel Metheringham of (at the time he contributed it) Planet
842 Online Ltd. The implementation is completely contained within the code of Exim.
843 It does not link against an external cdb library. The code contains the
844 following statements:
848 Copyright © 1998 Nigel Metheringham, Planet Online Ltd
851 This program is free software; you can redistribute it and/or modify it under
852 the terms of the GNU General Public License as published by the Free Software
853 Foundation; either version 2 of the License, or (at your option) any later
857 This code implements Dan Bernstein’s Constant DataBase (cdb) spec. Information,
858 the spec and sample code for cdb can be obtained from
859 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>. This implementation borrows some
860 code from Dan Bernstein’s implementation (which has no license restrictions
867 <indexterm role="concept">
868 <primary>SPA authentication</primary>
870 <indexterm role="concept">
871 <primary>Samba project</primary>
873 <indexterm role="concept">
874 <primary>Microsoft Secure Password Authentication</primary>
876 Client support for Microsoft’s <emphasis>Secure Password Authentication</emphasis> is provided
877 by code contributed by Marc Prud’hommeaux. Server support was contributed by
878 Tom Kistner. This includes code taken from the Samba project, which is released
884 <indexterm role="concept">
885 <primary>Cyrus</primary>
887 <indexterm role="concept">
888 <primary><emphasis>pwcheck</emphasis> daemon</primary>
890 <indexterm role="concept">
891 <primary><emphasis>pwauthd</emphasis> daemon</primary>
893 Support for calling the Cyrus <emphasis>pwcheck</emphasis> and <emphasis>saslauthd</emphasis> daemons is provided
894 by code taken from the Cyrus-SASL library and adapted by Alexander S.
895 Sabourenkov. The permission notice appears below, in accordance with the
896 conditions expressed therein.
900 Copyright © 2001 Carnegie Mellon University. All rights reserved.
903 Redistribution and use in source and binary forms, with or without
904 modification, are permitted provided that the following conditions
907 <orderedlist numeration="arabic">
910 Redistributions of source code must retain the above copyright
911 notice, this list of conditions and the following disclaimer.
916 Redistributions in binary form must reproduce the above copyright
917 notice, this list of conditions and the following disclaimer in
918 the documentation and/or other materials provided with the
924 The name <quote>Carnegie Mellon University</quote> must not be used to
925 endorse or promote products derived from this software without
926 prior written permission. For permission or any other legal
927 details, please contact
930 Office of Technology Transfer
931 Carnegie Mellon University
933 Pittsburgh, PA 15213-3890
934 (412) 268-4387, fax: (412) 268-7395
935 tech-transfer@andrew.cmu.edu
940 Redistributions of any form whatsoever must retain the following
944 <quote>This product includes software developed by Computing Services
945 at Carnegie Mellon University (<emphasis role="bold"><ulink url="http://www.cmu.edu/computing/">http://www.cmu.edu/computing/</ulink></emphasis>.</quote>
948 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
949 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
950 AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
951 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
952 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
953 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
954 OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
962 <indexterm role="concept">
963 <primary>Exim monitor</primary>
964 <secondary>acknowledgement</secondary>
966 <indexterm role="concept">
967 <primary>X-windows</primary>
969 <indexterm role="concept">
970 <primary>Athena</primary>
972 The Exim Monitor program, which is an X-Window application, includes
973 modified versions of the Athena StripChart and TextPop widgets.
974 This code is copyright by DEC and MIT, and their permission notice appears
975 below, in accordance with the conditions expressed therein.
979 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
980 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
986 Permission to use, copy, modify, and distribute this software and its
987 documentation for any purpose and without fee is hereby granted,
988 provided that the above copyright notice appear in all copies and that
989 both that copyright notice and this permission notice appear in
990 supporting documentation, and that the names of Digital or MIT not be
991 used in advertising or publicity pertaining to distribution of the
992 software without specific, written prior permission.
995 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
996 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
997 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
998 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
999 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
1000 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
1007 Many people have contributed code fragments, some large, some small, that were
1008 not covered by any specific licence requirements. It is assumed that the
1009 contributors are happy to see their code incoporated into Exim under the GPL.
1016 <title>How Exim receives and delivers mail</title>
1017 <titleabbrev>Receiving and delivering mail</titleabbrev>
1019 <title>Overall philosophy</title>
1021 <indexterm role="concept">
1022 <primary>design philosophy</primary>
1024 Exim is designed to work efficiently on systems that are permanently connected
1025 to the Internet and are handling a general mix of mail. In such circumstances,
1026 most messages can be delivered immediately. Consequently, Exim does not
1027 maintain independent queues of messages for specific domains or hosts, though
1028 it does try to send several messages in a single SMTP connection after a host
1029 has been down, and it also maintains per-host retry information.
1033 <title>Policy control</title>
1035 <indexterm role="concept">
1036 <primary>policy control</primary>
1037 <secondary>overview</secondary>
1039 Policy controls are now an important feature of MTAs that are connected to the
1040 Internet. Perhaps their most important job is to stop MTAs being abused as
1041 <quote>open relays</quote> by misguided individuals who send out vast amounts of
1042 unsolicited junk, and want to disguise its source. Exim provides flexible
1043 facilities for specifying policy controls on incoming mail:
1048 <indexterm role="concept">
1049 <primary>access control lists (ACLs)</primary>
1050 <secondary>introduction</secondary>
1052 Exim 4 (unlike previous versions of Exim) implements policy controls on
1053 incoming mail by means of <emphasis>Access Control Lists</emphasis> (ACLs). Each list is a
1054 series of statements that may either grant or deny access. ACLs can be used at
1055 several places in the SMTP dialogue while receiving a message from a remote
1056 host. However, the most common places are after each RCPT command, and at the
1057 very end of the message. The sysadmin can specify conditions for accepting or
1058 rejecting individual recipients or the entire message, respectively, at these
1059 two points (see chapter <xref linkend="CHAPACL"/>). Denial of access results in an SMTP
1065 An ACL is also available for locally generated, non-SMTP messages. In this
1066 case, the only available actions are to accept or deny the entire message.
1071 When Exim is compiled with the content-scanning extension, facilities are
1072 provided in the ACL mechanism for passing the message to external virus and/or
1073 spam scanning software. The result of such a scan is passed back to the ACL,
1074 which can then use it to decide what to do with the message.
1079 When a message has been received, either from a remote host or from the local
1080 host, but before the final acknowledgement has been sent, a locally supplied C
1081 function called <function>local_scan()</function> can be run to inspect the message and decide
1082 whether to accept it or not (see chapter <xref linkend="CHAPlocalscan"/>). If the message
1083 is accepted, the list of recipients can be modified by the function.
1088 Using the <function>local_scan()</function> mechanism is another way of calling external scanner
1089 software. The <option>SA-Exim</option> add-on package works this way. It does not require
1090 Exim to be compiled with the content-scanning extension.
1095 After a message has been accepted, a further checking mechanism is available in
1096 the form of the <emphasis>system filter</emphasis> (see chapter <xref linkend="CHAPsystemfilter"/>). This
1097 runs at the start of every delivery process.
1103 <title>User filters</title>
1105 <indexterm role="concept">
1106 <primary>filter</primary>
1107 <secondary>introduction</secondary>
1109 <indexterm role="concept">
1110 <primary>Sieve filter</primary>
1112 In a conventional Exim configuration, users are able to run private filters by
1113 setting up appropriate <filename>.forward</filename> files in their home directories. See
1114 chapter <xref linkend="CHAPredirect"/> (about the <command>redirect</command> router) for the
1115 configuration needed to support this, and the separate document entitled
1116 <emphasis>Exim’s interfaces to mail filtering</emphasis> for user details. Two different kinds
1117 of filtering are available:
1122 Sieve filters are written in the standard filtering language that is defined
1128 Exim filters are written in a syntax that is unique to Exim, but which is more
1129 powerful than Sieve, which it pre-dates.
1134 User filters are run as part of the routing process, described below.
1137 <section id="SECTmessiden">
1138 <title>Message identification</title>
1140 <indexterm role="concept">
1141 <primary>message ids</primary>
1142 <secondary>details of format</secondary>
1144 <indexterm role="concept">
1145 <primary>format</primary>
1146 <secondary>of message id</secondary>
1148 <indexterm role="concept">
1149 <primary>id of message</primary>
1151 <indexterm role="concept">
1152 <primary>base62</primary>
1154 <indexterm role="concept">
1155 <primary>base36</primary>
1157 <indexterm role="concept">
1158 <primary>Darwin</primary>
1160 <indexterm role="concept">
1161 <primary>Cygwin</primary>
1163 Every message handled by Exim is given a <emphasis>message id</emphasis> which is sixteen
1164 characters long. It is divided into three parts, separated by hyphens, for
1165 example <literal>16VDhn-0001bo-D3</literal>. Each part is a sequence of letters and digits,
1166 normally encoding numbers in base 62. However, in the Darwin operating
1167 system (Mac OS X) and when Exim is compiled to run under Cygwin, base 36
1168 (avoiding the use of lower case letters) is used instead, because the message
1169 id is used to construct file names, and the names of files in those systems are
1170 not always case-sensitive.
1173 <indexterm role="concept">
1174 <primary>pid (process id)</primary>
1175 <secondary>re-use of</secondary>
1177 The detail of the contents of the message id have changed as Exim has evolved.
1178 Earlier versions relied on the operating system not re-using a process id (pid)
1179 within one second. On modern operating systems, this assumption can no longer
1180 be made, so the algorithm had to be changed. To retain backward compatibility,
1181 the format of the message id was retained, which is why the following rules are
1187 The first six characters of the message id are the time at which the message
1188 started to be received, to a granularity of one second. That is, this field
1189 contains the number of seconds since the start of the epoch (the normal Unix
1190 way of representing the date and time of day).
1195 After the first hyphen, the next six characters are the id of the process that
1196 received the message.
1201 There are two different possibilities for the final two characters:
1203 <orderedlist numeration="arabic">
1206 <indexterm role="concept">
1207 <primary><option>localhost_number</option></primary>
1209 If <option>localhost_number</option> is not set, this value is the fractional part of the
1210 time of reception, normally in units of 1/2000 of a second, but for systems
1211 that must use base 36 instead of base 62 (because of case-insensitive file
1212 systems), the units are 1/1000 of a second.
1217 If <option>localhost_number</option> is set, it is multiplied by 200 (100) and added to
1218 the fractional part of the time, which in this case is in units of 1/200
1219 (1/100) of a second.
1226 After a message has been received, Exim waits for the clock to tick at the
1227 appropriate resolution before proceeding, so that if another message is
1228 received by the same process, or by another process with the same (re-used)
1229 pid, it is guaranteed that the time will be different. In most cases, the clock
1230 will already have ticked while the message was being received.
1234 <title>Receiving mail</title>
1236 <indexterm role="concept">
1237 <primary>receiving mail</primary>
1239 <indexterm role="concept">
1240 <primary>message</primary>
1241 <secondary>reception</secondary>
1243 The only way Exim can receive mail from another host is using SMTP over
1244 TCP/IP, in which case the sender and recipient addresses are transferred using
1245 SMTP commands. However, from a locally running process (such as a user’s MUA),
1246 there are several possibilities:
1251 If the process runs Exim with the <option>-bm</option> option, the message is read
1252 non-interactively (usually via a pipe), with the recipients taken from the
1253 command line, or from the body of the message if <option>-t</option> is also used.
1258 If the process runs Exim with the <option>-bS</option> option, the message is also read
1259 non-interactively, but in this case the recipients are listed at the start of
1260 the message in a series of SMTP RCPT commands, terminated by a DATA
1261 command. This is so-called <quote>batch SMTP</quote> format,
1262 but it isn’t really SMTP. The SMTP commands are just another way of passing
1263 envelope addresses in a non-interactive submission.
1268 If the process runs Exim with the <option>-bs</option> option, the message is read
1269 interactively, using the SMTP protocol. A two-way pipe is normally used for
1270 passing data between the local process and the Exim process.
1271 This is <quote>real</quote> SMTP and is handled in the same way as SMTP over TCP/IP. For
1272 example, the ACLs for SMTP commands are used for this form of submission.
1277 A local process may also make a TCP/IP call to the host’s loopback address
1278 (127.0.0.1) or any other of its IP addresses. When receiving messages, Exim
1279 does not treat the loopback address specially. It treats all such connections
1280 in the same way as connections from other hosts.
1285 <indexterm role="concept">
1286 <primary>message sender</primary>
1287 <secondary>constructed by Exim</secondary>
1289 <indexterm role="concept">
1290 <primary>sender</primary>
1291 <secondary>constructed by Exim</secondary>
1293 In the three cases that do not involve TCP/IP, the sender address is
1294 constructed from the login name of the user that called Exim and a default
1295 qualification domain (which can be set by the <option>qualify_domain</option> configuration
1296 option). For local or batch SMTP, a sender address that is passed using the
1297 SMTP MAIL command is ignored. However, the system administrator may allow
1298 certain users (<quote>trusted users</quote>) to specify a different sender address
1299 unconditionally, or all users to specify certain forms of different sender
1300 address. The <option>-f</option> option or the SMTP MAIL command is used to specify these
1301 different addresses. See section <xref linkend="SECTtrustedadmin"/> for details of trusted
1302 users, and the <option>untrusted_set_sender</option> option for a way of allowing untrusted
1303 users to change sender addresses.
1306 Messages received by either of the non-interactive mechanisms are subject to
1307 checking by the non-SMTP ACL, if one is defined. Messages received using SMTP
1308 (either over TCP/IP, or interacting with a local process) can be checked by a
1309 number of ACLs that operate at different times during the SMTP session. Either
1310 individual recipients, or the entire message, can be rejected if local policy
1311 requirements are not met. The <function>local_scan()</function> function (see chapter
1312 <xref linkend="CHAPlocalscan"/>) is run for all incoming messages.
1315 Exim can be configured not to start a delivery process when a message is
1316 received; this can be unconditional, or depend on the number of incoming SMTP
1317 connections or the system load. In these situations, new messages wait on the
1318 queue until a queue runner process picks them up. However, in standard
1319 configurations under normal conditions, delivery is started as soon as a
1320 message is received.
1324 <title>Handling an incoming message</title>
1326 <indexterm role="concept">
1327 <primary>spool directory</primary>
1328 <secondary>files that hold a message</secondary>
1330 <indexterm role="concept">
1331 <primary>file</primary>
1332 <secondary>how a message is held</secondary>
1334 When Exim accepts a message, it writes two files in its spool directory. The
1335 first contains the envelope information, the current status of the message, and
1336 the header lines, and the second contains the body of the message. The names of
1337 the two spool files consist of the message id, followed by <literal>-H</literal> for the
1338 file containing the envelope and header, and <literal>-D</literal> for the data file.
1341 <indexterm role="concept">
1342 <primary>spool directory</primary>
1343 <secondary><filename>input</filename> sub-directory</secondary>
1345 By default all these message files are held in a single directory called
1346 <filename>input</filename> inside the general Exim spool directory. Some operating systems do
1347 not perform very well if the number of files in a directory gets large; to
1348 improve performance in such cases, the <option>split_spool_directory</option> option can be
1349 used. This causes Exim to split up the input files into 62 sub-directories
1350 whose names are single letters or digits. When this is done, the queue is
1351 processed one sub-directory at a time instead of all at once, which can improve
1352 overall performance even when there are not enough files in each directory to
1353 affect file system performance.
1356 The envelope information consists of the address of the message’s sender and
1357 the addresses of the recipients. This information is entirely separate from
1358 any addresses contained in the header lines. The status of the message includes
1359 a list of recipients who have already received the message. The format of the
1360 first spool file is described in chapter <xref linkend="CHAPspool"/>.
1363 <indexterm role="concept">
1364 <primary>rewriting</primary>
1365 <secondary>addresses</secondary>
1367 Address rewriting that is specified in the rewrite section of the configuration
1368 (see chapter <xref linkend="CHAPrewrite"/>) is done once and for all on incoming addresses,
1369 both in the header lines and the envelope, at the time the message is accepted.
1370 If during the course of delivery additional addresses are generated (for
1371 example, via aliasing), these new addresses are rewritten as soon as they are
1372 generated. At the time a message is actually delivered (transported) further
1373 rewriting can take place; because this is a transport option, it can be
1374 different for different forms of delivery. It is also possible to specify the
1375 addition or removal of certain header lines at the time the message is
1376 delivered (see chapters <xref linkend="CHAProutergeneric"/> and
1377 <xref linkend="CHAPtransportgeneric"/>).
1381 <title>Life of a message</title>
1383 <indexterm role="concept">
1384 <primary>message</primary>
1385 <secondary>life of</secondary>
1387 <indexterm role="concept">
1388 <primary>message</primary>
1389 <secondary>frozen</secondary>
1391 A message remains in the spool directory until it is completely delivered to
1392 its recipients or to an error address, or until it is deleted by an
1393 administrator or by the user who originally created it. In cases when delivery
1394 cannot proceed – for example, when a message can neither be delivered to its
1395 recipients nor returned to its sender, the message is marked <quote>frozen</quote> on the
1396 spool, and no more deliveries are attempted.
1399 <indexterm role="concept">
1400 <primary>frozen messages</primary>
1401 <secondary>thawing</secondary>
1403 <indexterm role="concept">
1404 <primary>message</primary>
1405 <secondary>thawing frozen</secondary>
1407 An administrator can <quote>thaw</quote> such messages when the problem has been
1408 corrected, and can also freeze individual messages by hand if necessary. In
1409 addition, an administrator can force a delivery error, causing a bounce message
1413 <indexterm role="concept">
1414 <primary><option>timeout_frozen_after</option></primary>
1416 <indexterm role="concept">
1417 <primary><option>ignore_bounce_errors_after</option></primary>
1419 There are options called <option>ignore_bounce_errors_after</option> and
1420 <option>timeout_frozen_after</option>, which discard frozen messages after a certain time.
1421 The first applies only to frozen bounces, the second to any frozen messages.
1424 <indexterm role="concept">
1425 <primary>message</primary>
1426 <secondary>log file for</secondary>
1428 <indexterm role="concept">
1429 <primary>log</primary>
1430 <secondary>file for each message</secondary>
1432 While Exim is working on a message, it writes information about each delivery
1433 attempt to its main log file. This includes successful, unsuccessful, and
1434 delayed deliveries for each recipient (see chapter <xref linkend="CHAPlog"/>). The log
1435 lines are also written to a separate <emphasis>message log</emphasis> file for each message.
1436 These logs are solely for the benefit of the administrator, and are normally
1437 deleted along with the spool files when processing of a message is complete.
1438 The use of individual message logs can be disabled by setting
1439 <option>no_message_logs</option>; this might give an improvement in performance on very busy
1443 <indexterm role="concept">
1444 <primary>journal file</primary>
1446 <indexterm role="concept">
1447 <primary>file</primary>
1448 <secondary>journal</secondary>
1450 All the information Exim itself needs to set up a delivery is kept in the first
1451 spool file, along with the header lines. When a successful delivery occurs, the
1452 address is immediately written at the end of a journal file, whose name is the
1453 message id followed by <literal>-J</literal>. At the end of a delivery run, if there are some
1454 addresses left to be tried again later, the first spool file (the <literal>-H</literal> file)
1455 is updated to indicate which these are, and the journal file is then deleted.
1456 Updating the spool file is done by writing a new file and renaming it, to
1457 minimize the possibility of data loss.
1460 Should the system or the program crash after a successful delivery but before
1461 the spool file has been updated, the journal is left lying around. The next
1462 time Exim attempts to deliver the message, it reads the journal file and
1463 updates the spool file before proceeding. This minimizes the chances of double
1464 deliveries caused by crashes.
1467 <section id="SECTprocaddress">
1468 <title>Processing an address for delivery</title>
1470 <indexterm role="concept">
1471 <primary>drivers</primary>
1472 <secondary>definition of</secondary>
1474 <indexterm role="concept">
1475 <primary>router</primary>
1476 <secondary>definition of</secondary>
1478 <indexterm role="concept">
1479 <primary>transport</primary>
1480 <secondary>definition of</secondary>
1482 The main delivery processing elements of Exim are called <emphasis>routers</emphasis> and
1483 <emphasis>transports</emphasis>, and collectively these are known as <emphasis>drivers</emphasis>. Code for a
1484 number of them is provided in the source distribution, and compile-time options
1485 specify which ones are included in the binary. Run time options specify which
1486 ones are actually used for delivering messages.
1489 <indexterm role="concept">
1490 <primary>drivers</primary>
1491 <secondary>instance definition</secondary>
1493 Each driver that is specified in the run time configuration is an <emphasis>instance</emphasis>
1494 of that particular driver type. Multiple instances are allowed; for example,
1495 you can set up several different <command>smtp</command> transports, each with different
1496 option values that might specify different ports or different timeouts. Each
1497 instance has its own identifying name. In what follows we will normally use the
1498 instance name when discussing one particular instance (that is, one specific
1499 configuration of the driver), and the generic driver name when discussing
1500 the driver’s features in general.
1503 A <emphasis>router</emphasis> is a driver that operates on an address, either determining how
1504 its delivery should happen, by assigning it to a specific transport, or
1505 converting the address into one or more new addresses (for example, via an
1506 alias file). A router may also explicitly choose to fail an address, causing it
1510 A <emphasis>transport</emphasis> is a driver that transmits a copy of the message from Exim’s
1511 spool to some destination. There are two kinds of transport: for a <emphasis>local</emphasis>
1512 transport, the destination is a file or a pipe on the local host, whereas for a
1513 <emphasis>remote</emphasis> transport the destination is some other host. A message is passed
1514 to a specific transport as a result of successful routing. If a message has
1515 several recipients, it may be passed to a number of different transports.
1518 <indexterm role="concept">
1519 <primary>preconditions</primary>
1520 <secondary>definition of</secondary>
1522 An address is processed by passing it to each configured router instance in
1523 turn, subject to certain preconditions, until a router accepts the address or
1524 specifies that it should be bounced. We will describe this process in more
1525 detail shortly. First, as a simple example, we consider how each recipient
1526 address in a message is processed in a small configuration of three routers.
1529 To make this a more concrete example, it is described in terms of some actual
1530 routers, but remember, this is only an example. You can configure Exim’s
1531 routers in many different ways, and there may be any number of routers in a
1535 The first router that is specified in a configuration is often one that handles
1536 addresses in domains that are not recognized specially by the local host. These
1537 are typically addresses for arbitrary domains on the Internet. A precondition
1538 is set up which looks for the special domains known to the host (for example,
1539 its own domain name), and the router is run for addresses that do <emphasis>not</emphasis>
1540 match. Typically, this is a router that looks up domains in the DNS in order to
1541 find the hosts to which this address routes. If it succeeds, the address is
1542 assigned to a suitable SMTP transport; if it does not succeed, the router is
1543 configured to fail the address.
1546 The second router is reached only when the domain is recognized as one that
1547 <quote>belongs</quote> to the local host. This router does redirection – also known as
1548 aliasing and forwarding. When it generates one or more new addresses from the
1549 original, each of them is routed independently from the start. Otherwise, the
1550 router may cause an address to fail, or it may simply decline to handle the
1551 address, in which case the address is passed to the next router.
1554 The final router in many configurations is one that checks to see if the
1555 address belongs to a local mailbox. The precondition may involve a check to
1556 see if the local part is the name of a login account, or it may look up the
1557 local part in a file or a database. If its preconditions are not met, or if
1558 the router declines, we have reached the end of the routers. When this happens,
1559 the address is bounced.
1563 <title>Processing an address for verification</title>
1565 <indexterm role="concept">
1566 <primary>router</primary>
1567 <secondary>for verification</secondary>
1569 <indexterm role="concept">
1570 <primary>verifying address</primary>
1571 <secondary>overview</secondary>
1573 As well as being used to decide how to deliver to an address, Exim’s routers
1574 are also used for <emphasis>address verification</emphasis>. Verification can be requested as
1575 one of the checks to be performed in an ACL for incoming messages, on both
1576 sender and recipient addresses, and it can be tested using the <option>-bv</option> and
1577 <option>-bvs</option> command line options.
1580 When an address is being verified, the routers are run in <quote>verify mode</quote>. This
1581 does not affect the way the routers work, but it is a state that can be
1582 detected. By this means, a router can be skipped or made to behave differently
1583 when verifying. A common example is a configuration in which the first router
1584 sends all messages to a message-scanning program, unless they have been
1585 previously scanned. Thus, the first router accepts all addresses without any
1586 checking, making it useless for verifying. Normally, the <option>no_verify</option> option
1587 would be set for such a router, causing it to be skipped in verify mode.
1590 <section id="SECTrunindrou">
1591 <title>Running an individual router</title>
1593 <indexterm role="concept">
1594 <primary>router</primary>
1595 <secondary>running details</secondary>
1597 <indexterm role="concept">
1598 <primary>preconditions</primary>
1599 <secondary>checking</secondary>
1601 <indexterm role="concept">
1602 <primary>router</primary>
1603 <secondary>result of running</secondary>
1605 As explained in the example above, a number of preconditions are checked before
1606 running a router. If any are not met, the router is skipped, and the address is
1607 passed to the next router. When all the preconditions on a router <emphasis>are</emphasis> met,
1608 the router is run. What happens next depends on the outcome, which is one of
1614 <emphasis>accept</emphasis>: The router accepts the address, and either assigns it to a
1615 transport, or generates one or more <quote>child</quote> addresses. Processing the
1616 original address ceases,
1617 <indexterm role="concept">
1618 <primary><option>unseen</option> option</primary>
1620 unless the <option>unseen</option> option is set on the router. This option
1621 can be used to set up multiple deliveries with different routing (for example,
1622 for keeping archive copies of messages). When <option>unseen</option> is set, the address is
1623 passed to the next router. Normally, however, an <emphasis>accept</emphasis> return marks the
1627 Any child addresses generated by the router are processed independently,
1628 starting with the first router by default. It is possible to change this by
1629 setting the <option>redirect_router</option> option to specify which router to start at for
1630 child addresses. Unlike <option>pass_router</option> (see below) the router specified by
1631 <option>redirect_router</option> may be anywhere in the router configuration.
1636 <emphasis>pass</emphasis>: The router recognizes the address, but cannot handle it itself. It
1637 requests that the address be passed to another router. By default the address
1638 is passed to the next router, but this can be changed by setting the
1639 <option>pass_router</option> option. However, (unlike <option>redirect_router</option>) the named router
1640 must be below the current router (to avoid loops).
1645 <emphasis>decline</emphasis>: The router declines to accept the address because it does not
1646 recognize it at all. By default, the address is passed to the next router, but
1647 this can be prevented by setting the <option>no_more</option> option. When <option>no_more</option> is
1648 set, all the remaining routers are skipped. In effect, <option>no_more</option> converts
1649 <emphasis>decline</emphasis> into <emphasis>fail</emphasis>.
1654 <emphasis>fail</emphasis>: The router determines that the address should fail, and queues it for
1655 the generation of a bounce message. There is no further processing of the
1656 original address unless <option>unseen</option> is set on the router.
1661 <emphasis>defer</emphasis>: The router cannot handle the address at the present time. (A
1662 database may be offline, or a DNS lookup may have timed out.) No further
1663 processing of the address happens in this delivery attempt. It is tried again
1664 next time the message is considered for delivery.
1669 <emphasis>error</emphasis>: There is some error in the router (for example, a syntax error in
1670 its configuration). The action is as for defer.
1675 If an address reaches the end of the routers without having been accepted by
1676 any of them, it is bounced as unrouteable. The default error message in this
1677 situation is <quote>unrouteable address</quote>, but you can set your own message by
1678 making use of the <option>cannot_route_message</option> option. This can be set for any
1679 router; the value from the last router that <quote>saw</quote> the address is used.
1682 Sometimes while routing you want to fail a delivery when some conditions are
1683 met but others are not, instead of passing the address on for further routing.
1684 You can do this by having a second router that explicitly fails the delivery
1685 when the relevant conditions are met. The <command>redirect</command> router has a <quote>fail</quote>
1686 facility for this purpose.
1690 <title>Duplicate addresses</title>
1692 <indexterm role="concept">
1693 <primary>case of local parts</primary>
1695 <indexterm role="concept">
1696 <primary>address duplicate</primary>
1697 <secondary>discarding</secondary>
1699 <indexterm role="concept">
1700 <primary>duplicate addresses</primary>
1702 Once routing is complete, Exim scans the addresses that are assigned to local
1703 and remote transports, and discards any duplicates that it finds. During this
1704 check, local parts are treated as case-sensitive. <phrase revisionflag="changed">This happens only when
1705 actually delivering a message; when testing routers with <option>-bt</option>, all the
1706 routed addresses are shown.</phrase>
1709 <section id="SECTrouprecon">
1710 <title>Router preconditions</title>
1712 <indexterm role="concept">
1713 <primary>router preconditions</primary>
1714 <secondary>order of processing</secondary>
1716 <indexterm role="concept">
1717 <primary>preconditions</primary>
1718 <secondary>order of processing</secondary>
1720 The preconditions that are tested for each router are listed below, in the
1721 order in which they are tested. The individual configuration options are
1722 described in more detail in chapter <xref linkend="CHAProutergeneric"/>.
1727 The <option>local_part_prefix</option> and <option>local_part_suffix</option> options can specify that
1728 the local parts handled by the router may or must have certain prefixes and/or
1729 suffixes. If a mandatory affix (prefix or suffix) is not present, the router is
1730 skipped. These conditions are tested first. When an affix is present, it is
1731 removed from the local part before further processing, including the evaluation
1732 of any other conditions.
1737 Routers can be designated for use only when not verifying an address, that is,
1738 only when routing it for delivery (or testing its delivery routing). If the
1739 <option>verify</option> option is set false, the router is skipped when Exim is verifying an
1741 Setting the <option>verify</option> option actually sets two options, <option>verify_sender</option> and
1742 <option>verify_recipient</option>, which independently control the use of the router for
1743 sender and recipient verification. You can set these options directly if
1744 you want a router to be used for only one type of verification.
1749 If the <option>address_test</option> option is set false, the router is skipped when Exim is
1750 run with the <option>-bt</option> option to test an address routing. This can be helpful
1751 when the first router sends all new messages to a scanner of some sort; it
1752 makes it possible to use <option>-bt</option> to test subsequent delivery routing without
1753 having to simulate the effect of the scanner.
1758 Routers can be designated for use only when verifying an address, as
1759 opposed to routing it for delivery. The <option>verify_only</option> option controls this.
1764 Individual routers can be explicitly skipped when running the routers to
1765 check an address given in the SMTP EXPN command (see the <option>expn</option> option).
1770 If the <option>domains</option> option is set, the domain of the address must be in the set
1771 of domains that it defines.
1776 <indexterm role="concept">
1777 <primary><varname>$local_part_prefix</varname></primary>
1779 <indexterm role="concept">
1780 <primary><varname>$local_part</varname></primary>
1782 <indexterm role="concept">
1783 <primary><varname>$local_part_suffix</varname></primary>
1785 If the <option>local_parts</option> option is set, the local part of the address must be in
1786 the set of local parts that it defines. If <option>local_part_prefix</option> or
1787 <option>local_part_suffix</option> is in use, the prefix or suffix is removed from the local
1788 part before this check. If you want to do precondition tests on local parts
1789 that include affixes, you can do so by using a <option>condition</option> option (see below)
1790 that uses the variables <varname>$local_part</varname>, <varname>$local_part_prefix</varname>, and
1791 <varname>$local_part_suffix</varname> as necessary.
1796 <indexterm role="concept">
1797 <primary><varname>$local_user_uid</varname></primary>
1799 <indexterm role="concept">
1800 <primary><varname>$local_user_gid</varname></primary>
1802 <indexterm role="concept">
1803 <primary><varname>$home</varname></primary>
1805 If the <option>check_local_user</option> option is set, the local part must be the name of
1806 an account on the local host. If this check succeeds, the uid and gid of the
1807 local user are placed in <varname>$local_user_uid</varname> and <varname>$local_user_gid</varname> and the
1808 user’s home directory is placed in <varname>$home</varname>; these values can be used in the
1809 remaining preconditions.
1814 If the <option>router_home_directory</option> option is set, it is expanded at this point,
1815 because it overrides the value of <varname>$home</varname>. If this expansion were left till
1816 later, the value of <varname>$home</varname> as set by <option>check_local_user</option> would be used in
1817 subsequent tests. Having two different values of <varname>$home</varname> in the same router
1818 could lead to confusion.
1823 If the <option>senders</option> option is set, the envelope sender address must be in the
1824 set of addresses that it defines.
1829 If the <option>require_files</option> option is set, the existence or non-existence of
1830 specified files is tested.
1835 <indexterm role="concept">
1836 <primary>customizing</primary>
1837 <secondary>precondition</secondary>
1839 If the <option>condition</option> option is set, it is evaluated and tested. This option
1840 uses an expanded string to allow you to set up your own custom preconditions.
1841 Expanded strings are described in chapter <xref linkend="CHAPexpand"/>.
1846 Note that <option>require_files</option> comes near the end of the list, so you cannot use
1847 it to check for the existence of a file in which to lookup up a domain, local
1848 part, or sender. However, as these options are all expanded, you can use the
1849 <option>exists</option> expansion condition to make such tests within each condition. The
1850 <option>require_files</option> option is intended for checking files that the router may be
1851 going to use internally, or which are needed by a specific transport (for
1852 example, <filename>.procmailrc</filename>).
1856 <title>Delivery in detail</title>
1858 <indexterm role="concept">
1859 <primary>delivery</primary>
1860 <secondary>in detail</secondary>
1862 When a message is to be delivered, the sequence of events is as follows:
1867 If a system-wide filter file is specified, the message is passed to it. The
1868 filter may add recipients to the message, replace the recipients, discard the
1869 message, cause a new message to be generated, or cause the message delivery to
1870 fail. The format of the system filter file is the same as for Exim user filter
1871 files, described in the separate document entitled <emphasis>Exim’s interfaces to mail
1872 filtering</emphasis>.
1873 <indexterm role="concept">
1874 <primary>Sieve filter</primary>
1875 <secondary>not available for system filter</secondary>
1877 (<emphasis role="bold">Note</emphasis>: Sieve cannot be used for system filter files.)
1880 Some additional features are available in system filters – see chapter
1881 <xref linkend="CHAPsystemfilter"/> for details. Note that a message is passed to the system
1882 filter only once per delivery attempt, however many recipients it has. However,
1883 if there are several delivery attempts because one or more addresses could not
1884 be immediately delivered, the system filter is run each time. The filter
1885 condition <option>first_delivery</option> can be used to detect the first run of the system
1891 Each recipient address is offered to each configured router in turn, subject to
1892 its preconditions, until one is able to handle it. If no router can handle the
1893 address, that is, if they all decline, the address is failed. Because routers
1894 can be targeted at particular domains, several locally handled domains can be
1895 processed entirely independently of each other.
1900 <indexterm role="concept">
1901 <primary>routing</primary>
1902 <secondary>loops in</secondary>
1904 <indexterm role="concept">
1905 <primary>loop</primary>
1906 <secondary>while routing</secondary>
1908 A router that accepts an address may assign it to a local or a remote
1909 transport. However, the transport is not run at this time. Instead, the address
1910 is placed on a list for the particular transport, which will be run later.
1911 Alternatively, the router may generate one or more new addresses (typically
1912 from alias, forward, or filter files). New addresses are fed back into this
1913 process from the top, but in order to avoid loops, a router ignores any address
1914 which has an identically-named ancestor that was processed by itself.
1919 When all the routing has been done, addresses that have been successfully
1920 handled are passed to their assigned transports. When local transports are
1921 doing real local deliveries, they handle only one address at a time, but if a
1922 local transport is being used as a pseudo-remote transport (for example, to
1923 collect batched SMTP messages for transmission by some other means) multiple
1924 addresses can be handled. Remote transports can always handle more than one
1925 address at a time, but can be configured not to do so, or to restrict multiple
1926 addresses to the same domain.
1931 Each local delivery to a file or a pipe runs in a separate process under a
1932 non-privileged uid, and these deliveries are run one at a time. Remote
1933 deliveries also run in separate processes, normally under a uid that is private
1934 to Exim (<quote>the Exim user</quote>), but in this case, several remote deliveries can be
1935 run in parallel. The maximum number of simultaneous remote deliveries for any
1936 one message is set by the <option>remote_max_parallel</option> option.
1937 The order in which deliveries are done is not defined, except that all local
1938 deliveries happen before any remote deliveries.
1943 <indexterm role="concept">
1944 <primary>queue runner</primary>
1946 When it encounters a local delivery during a queue run, Exim checks its retry
1947 database to see if there has been a previous temporary delivery failure for the
1948 address before running the local transport. If there was a previous failure,
1949 Exim does not attempt a new delivery until the retry time for the address is
1950 reached. However, this happens only for delivery attempts that are part of a
1951 queue run. Local deliveries are always attempted when delivery immediately
1952 follows message reception, even if retry times are set for them. This makes for
1953 better behaviour if one particular message is causing problems (for example,
1954 causing quota overflow, or provoking an error in a filter file).
1959 <indexterm role="concept">
1960 <primary>delivery</primary>
1961 <secondary>retry in remote transports</secondary>
1963 Remote transports do their own retry handling, since an address may be
1964 deliverable to one of a number of hosts, each of which may have a different
1965 retry time. If there have been previous temporary failures and no host has
1966 reached its retry time, no delivery is attempted, whether in a queue run or
1967 not. See chapter <xref linkend="CHAPretry"/> for details of retry strategies.
1972 If there were any permanent errors, a bounce message is returned to an
1973 appropriate address (the sender in the common case), with details of the error
1974 for each failing address. Exim can be configured to send copies of bounce
1975 messages to other addresses.
1980 <indexterm role="concept">
1981 <primary>delivery</primary>
1982 <secondary>deferral</secondary>
1984 If one or more addresses suffered a temporary failure, the message is left on
1985 the queue, to be tried again later. Delivery of these addresses is said to be
1986 <emphasis>deferred</emphasis>.
1991 When all the recipient addresses have either been delivered or bounced,
1992 handling of the message is complete. The spool files and message log are
1993 deleted, though the message log can optionally be preserved if required.
1999 <title>Retry mechanism</title>
2001 <indexterm role="concept">
2002 <primary>delivery</primary>
2003 <secondary>retry mechanism</secondary>
2005 <indexterm role="concept">
2006 <primary>retry</primary>
2007 <secondary>description of mechanism</secondary>
2009 <indexterm role="concept">
2010 <primary>queue runner</primary>
2012 Exim’s mechanism for retrying messages that fail to get delivered at the first
2013 attempt is the queue runner process. You must either run an Exim daemon that
2014 uses the <option>-q</option> option with a time interval to start queue runners at regular
2015 intervals, or use some other means (such as <emphasis>cron</emphasis>) to start them. If you do
2016 not arrange for queue runners to be run, messages that fail temporarily at the
2017 first attempt will remain on your queue for ever. A queue runner process works
2018 its way through the queue, one message at a time, trying each delivery that has
2019 passed its retry time.
2020 You can run several queue runners at once.
2023 Exim uses a set of configured rules to determine when next to retry the failing
2024 address (see chapter <xref linkend="CHAPretry"/>). These rules also specify when Exim
2025 should give up trying to deliver to the address, at which point it generates a
2026 bounce message. If no retry rules are set for a particular host, address, and
2027 error combination, no retries are attempted, and temporary errors are treated
2032 <title>Temporary delivery failure</title>
2034 <indexterm role="concept">
2035 <primary>delivery</primary>
2036 <secondary>temporary failure</secondary>
2038 There are many reasons why a message may not be immediately deliverable to a
2039 particular address. Failure to connect to a remote machine (because it, or the
2040 connection to it, is down) is one of the most common. Temporary failures may be
2041 detected during routing as well as during the transport stage of delivery.
2042 Local deliveries may be delayed if NFS files are unavailable, or if a mailbox
2043 is on a file system where the user is over quota. Exim can be configured to
2044 impose its own quotas on local mailboxes; where system quotas are set they will
2048 If a host is unreachable for a period of time, a number of messages may be
2049 waiting for it by the time it recovers, and sending them in a single SMTP
2050 connection is clearly beneficial. Whenever a delivery to a remote host is
2054 <indexterm role="concept">
2055 <primary>hints database</primary>
2057 Exim makes a note in its hints database, and whenever a successful
2058 SMTP delivery has happened, it looks to see if any other messages are waiting
2059 for the same host. If any are found, they are sent over the same SMTP
2060 connection, subject to a configuration limit as to the maximum number in any
2065 <title>Permanent delivery failure</title>
2067 <indexterm role="concept">
2068 <primary>delivery</primary>
2069 <secondary>permanent failure</secondary>
2071 <indexterm role="concept">
2072 <primary>bounce message</primary>
2073 <secondary>when generated</secondary>
2075 When a message cannot be delivered to some or all of its intended recipients, a
2076 bounce message is generated. Temporary delivery failures turn into permanent
2077 errors when their timeout expires. All the addresses that fail in a given
2078 delivery attempt are listed in a single message. If the original message has
2079 many recipients, it is possible for some addresses to fail in one delivery
2080 attempt and others to fail subsequently, giving rise to more than one bounce
2081 message. The wording of bounce messages can be customized by the administrator.
2082 See chapter <xref linkend="CHAPemsgcust"/> for details.
2085 <indexterm role="concept">
2086 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2088 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2089 failed addresses, for the benefit of programs that try to analyse such messages
2093 <indexterm role="concept">
2094 <primary>bounce message</primary>
2095 <secondary>recipient of</secondary>
2097 A bounce message is normally sent to the sender of the original message, as
2098 obtained from the message’s envelope. For incoming SMTP messages, this is the
2099 address given in the MAIL command. However, when an address is expanded via a
2100 forward or alias file, an alternative address can be specified for delivery
2101 failures of the generated addresses. For a mailing list expansion (see section
2102 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2107 <title>Failures to deliver bounce messages</title>
2109 <indexterm role="concept">
2110 <primary>bounce message</primary>
2111 <secondary>failure to deliver</secondary>
2113 If a bounce message (either locally generated or received from a remote host)
2114 itself suffers a permanent delivery failure, the message is left on the queue,
2115 but it is frozen, awaiting the attention of an administrator. There are options
2116 that can be used to make Exim discard such failed messages, or to keep them
2117 for only a short time (see <option>timeout_frozen_after</option> and
2118 <option>ignore_bounce_errors_after</option>).
2124 <title>Building and installing Exim</title>
2126 <indexterm role="concept" id="IIDbuex" class="startofrange">
2127 <primary>building Exim</primary>
2131 <title>Unpacking</title>
2133 Exim is distributed as a gzipped or bzipped tar file which, when upacked,
2134 creates a directory with the name of the current release (for example,
2135 <filename>exim-4.63</filename>) into which the following files are placed:
2137 <informaltable frame="none">
2138 <tgroup cols="2" colsep="0" rowsep="0">
2139 <colspec colwidth="140pt" align="left"/>
2140 <colspec colwidth="254pt" align="left"/>
2143 <entry><filename>ACKNOWLEDGMENTS</filename></entry>
2144 <entry>contains some acknowledgments</entry>
2147 <entry><filename>CHANGES</filename></entry>
2148 <entry>contains a reference to where changes are documented</entry>
2151 <entry><filename>LICENCE</filename></entry>
2152 <entry>the GNU General Public Licence</entry>
2155 <entry><filename>Makefile</filename></entry>
2156 <entry>top-level make file</entry>
2159 <entry><filename>NOTICE</filename></entry>
2160 <entry>conditions for the use of Exim</entry>
2163 <entry><filename>README</filename></entry>
2164 <entry>list of files, directories and simple build instructions</entry>
2170 Other files whose names begin with <filename>README</filename> may also be present. The
2171 following subdirectories are created:
2173 <informaltable frame="none">
2174 <tgroup cols="2" colsep="0" rowsep="0">
2175 <colspec colwidth="140pt" align="left"/>
2176 <colspec colwidth="254pt" align="left"/>
2179 <entry><filename>Local</filename></entry>
2180 <entry>an empty directory for local configuration files</entry>
2183 <entry><filename>OS</filename></entry>
2184 <entry>OS-specific files</entry>
2187 <entry><filename>doc</filename></entry>
2188 <entry>documentation files</entry>
2191 <entry><filename>exim_monitor</filename></entry>
2192 <entry>source files for the Exim monitor</entry>
2195 <entry><filename>scripts</filename></entry>
2196 <entry>scripts used in the build process</entry>
2199 <entry><filename>src</filename></entry>
2200 <entry>remaining source files</entry>
2203 <entry><filename>util</filename></entry>
2204 <entry>independent utilities</entry>
2210 The main utility programs are contained in the <filename>src</filename> directory, and are built
2211 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2212 that may be useful to some sites.
2216 <title>Multiple machine architectures and operating systems</title>
2218 <indexterm role="concept">
2219 <primary>building Exim</primary>
2220 <secondary>multiple OS/architectures</secondary>
2222 The building process for Exim is arranged to make it easy to build binaries for
2223 a number of different architectures and operating systems from the same set of
2224 source files. Compilation does not take place in the <filename>src</filename> directory.
2225 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2227 <indexterm role="concept">
2228 <primary>symbolic link</primary>
2229 <secondary>to build directory</secondary>
2231 Symbolic links to the sources are installed in this directory, which is where
2232 the actual building takes place. In most cases, Exim can discover the machine
2233 architecture and operating system for itself, but the defaults can be
2234 overridden if necessary.
2237 <section id="SECTdb">
2238 <title>DBM libraries</title>
2240 <indexterm role="concept">
2241 <primary>DBM libraries</primary>
2242 <secondary>discussion of</secondary>
2244 <indexterm role="concept">
2245 <primary>hints database</primary>
2246 <secondary>DBM files used for</secondary>
2248 Even if you do not use any DBM files in your configuration, Exim still needs a
2249 DBM library in order to operate, because it uses indexed files for its hints
2250 databases. Unfortunately, there are a number of DBM libraries in existence, and
2251 different operating systems often have different ones installed.
2254 <indexterm role="concept">
2255 <primary>Solaris</primary>
2256 <secondary>DBM library for</secondary>
2258 <indexterm role="concept">
2259 <primary>IRIX</primary>
2260 <secondary>DBM library for</secondary>
2262 <indexterm role="concept">
2263 <primary>BSD</primary>
2264 <secondary>DBM library for</secondary>
2266 <indexterm role="concept">
2267 <primary>Linux</primary>
2268 <secondary>DBM library for</secondary>
2270 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2271 Linux distribution, the DBM configuration should happen automatically, and you
2272 may be able to ignore this section. Otherwise, you may have to learn more than
2273 you would like about DBM libraries from what follows.
2276 <indexterm role="concept">
2277 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2279 Licensed versions of Unix normally contain a library of DBM functions operating
2280 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2281 versions of Unix seem to vary in what they contain as standard. In particular,
2282 some early versions of Linux have no default DBM library, and different
2283 distributors have chosen to bundle different libraries with their packaged
2284 versions. However, the more recent releases seem to have standardised on the
2285 Berkeley DB library.
2288 Different DBM libraries have different conventions for naming the files they
2289 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2292 <orderedlist numeration="arabic">
2295 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2296 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2301 <indexterm role="concept">
2302 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2304 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2305 compatibility interface it makes two different hard links to it with names
2306 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2307 file name is used unmodified.
2312 <indexterm role="concept">
2313 <primary>Berkeley DB library</primary>
2315 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2316 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2317 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2322 If the Berkeley package is used in its native mode, it operates on a single
2323 file called <filename>dbmfile</filename>; the programmer’s interface is somewhat different to
2324 the traditional <emphasis>ndbm</emphasis> interface.
2329 To complicate things further, there are several very different versions of the
2330 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2331 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while, but the latest versions are now
2332 numbered 4.<emphasis>x</emphasis>. Maintenance of some of the earlier releases has ceased. All
2333 versions of Berkeley DB can be obtained from
2334 <emphasis role="bold"><ulink url="http://www.sleepycat.com/">http://www.sleepycat.com/</ulink></emphasis>.
2339 <indexterm role="concept">
2340 <primary><emphasis>tdb</emphasis> DBM library</primary>
2342 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2343 <emphasis role="bold"><ulink url="http://download.sourceforge.net/tdb">http://download.sourceforge.net/tdb</ulink></emphasis>. It has its own interface, and also
2344 operates on a single file.
2349 <indexterm role="concept">
2350 <primary>USE_DB</primary>
2352 <indexterm role="concept">
2353 <primary>DBM libraries</primary>
2354 <secondary>configuration for building</secondary>
2356 Exim and its utilities can be compiled to use any of these interfaces. In order
2357 to use any version of the Berkeley DB package in native mode, you must set
2358 USE_DB in an appropriate configuration file (typically
2359 <filename>Local/Makefile</filename>). For example:
2361 <literallayout class="monospaced">
2365 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2366 error is diagnosed if you set more than one of these.
2369 At the lowest level, the build-time configuration sets none of these options,
2370 thereby assuming an interface of type (1). However, some operating system
2371 configuration files (for example, those for the BSD operating systems and
2372 Linux) assume type (4) by setting USE_DB as their default, and the
2373 configuration files for Cygwin set USE_GDBM. Anything you set in
2374 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2377 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2378 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2379 in one of these lines:
2381 <literallayout class="monospaced">
2386 Settings like that will work if the DBM library is installed in the standard
2387 place. Sometimes it is not, and the library’s header file may also not be in
2388 the default path. You may need to set INCLUDE to specify where the header
2389 file is, and to specify the path to the library more fully in DBMLIB, as in
2392 <literallayout class="monospaced">
2393 INCLUDE=-I/usr/local/include/db-4.1
2394 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2397 There is further detailed discussion about the various DBM libraries in the
2398 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2402 <title>Pre-building configuration</title>
2404 <indexterm role="concept">
2405 <primary>building Exim</primary>
2406 <secondary>pre-building configuration</secondary>
2408 <indexterm role="concept">
2409 <primary>configuration for building Exim</primary>
2411 <indexterm role="concept">
2412 <primary><filename>Local/Makefile</filename></primary>
2414 <indexterm role="concept">
2415 <primary><filename>src/EDITME</filename></primary>
2417 Before building Exim, a local configuration file that specifies options
2418 independent of any operating system has to be created with the name
2419 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2420 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2421 therein. These descriptions are therefore not repeated here. If you are
2422 building Exim for the first time, the simplest thing to do is to copy
2423 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2426 There are three settings that you must supply, because Exim will not build
2427 without them. They are the location of the run time configuration file
2428 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2429 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2430 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2431 a colon-separated list of file names; Exim uses the first of them that exists.
2434 There are a few other parameters that can be specified either at build time or
2435 at run time, to enable the same binary to be used on a number of different
2436 machines. However, if the locations of Exim’s spool directory and log file
2437 directory (if not within the spool directory) are fixed, it is recommended that
2438 you specify them in <filename>Local/Makefile</filename> instead of at run time, so that errors
2439 detected early in Exim’s execution (such as a malformed configuration file) can
2443 <indexterm role="concept">
2444 <primary>content scanning</primary>
2445 <secondary>specifying at build time</secondary>
2447 Exim’s interfaces for calling virus and spam scanning software directly from
2448 access control lists are not compiled by default. If you want to include these
2449 facilities, you need to set
2451 <literallayout class="monospaced">
2452 WITH_CONTENT_SCAN=yes
2455 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2456 chapter <xref linkend="CHAPexiscan"/>.
2459 <indexterm role="concept">
2460 <primary><filename>Local/eximon.conf</filename></primary>
2462 <indexterm role="concept">
2463 <primary>_exim_monitor/EDITME_</primary>
2465 If you are going to build the Exim monitor, a similar configuration process is
2466 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2467 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2468 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2469 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2472 This is all the configuration that is needed in straightforward cases for known
2473 operating systems. However, the building process is set up so that it is easy
2474 to override options that are set by default or by operating-system-specific
2475 configuration files, for example to change the name of the C compiler, which
2476 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2481 <title>Support for iconv()</title>
2483 <indexterm role="concept">
2484 <primary><function>iconv()</function> support</primary>
2486 <indexterm role="concept">
2487 <primary>RFC 2047</primary>
2489 The contents of header lines in messages may be encoded according to the rules
2490 described RFC 2047. This makes it possible to transmit characters that are not
2491 in the ASCII character set, and to label them as being in a particular
2492 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2493 mechanism, it decodes them, and translates them into a specified character set
2494 (default ISO-8859-1). The translation is possible only if the operating system
2495 supports the <function>iconv()</function> function.
2498 However, some of the operating systems that supply <function>iconv()</function> do not support
2499 very many conversions. The GNU <option>libiconv</option> library (available from
2500 <emphasis role="bold"><ulink url="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2501 systems to remedy this deficiency, as well as on systems that do not supply
2502 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2504 <literallayout class="monospaced">
2508 to your <filename>Local/Makefile</filename> and rebuild Exim.
2511 <section id="SECTinctlsssl">
2512 <title>Including TLS/SSL encryption support</title>
2514 <indexterm role="concept">
2515 <primary>TLS</primary>
2516 <secondary>including support for TLS</secondary>
2518 <indexterm role="concept">
2519 <primary>encryption</primary>
2520 <secondary>including support for</secondary>
2522 <indexterm role="concept">
2523 <primary>SUPPORT_TLS</primary>
2525 <indexterm role="concept">
2526 <primary>OpenSSL</primary>
2527 <secondary>building Exim with</secondary>
2529 <indexterm role="concept">
2530 <primary>GnuTLS</primary>
2531 <secondary>building Exim with</secondary>
2533 Exim can be built to support encrypted SMTP connections, using the STARTTLS
2534 command as per RFC 2487. It can also support legacy clients that expect to
2535 start a TLS session immediately on connection to a non-standard port (see the
2536 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2540 If you want to build Exim with TLS support, you must first install either the
2541 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2545 If OpenSSL is installed, you should set
2547 <literallayout class="monospaced">
2549 TLS_LIBS=-lssl -lcrypto
2552 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2553 OpenSSL library and include files. For example:
2555 <literallayout class="monospaced">
2557 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2558 TLS_INCLUDE=-I/usr/local/openssl/include/
2561 <indexterm role="concept">
2562 <primary>USE_GNUTLS</primary>
2564 If GnuTLS is installed, you should set
2566 <literallayout class="monospaced">
2569 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2572 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2573 library and include files. For example:
2575 <literallayout class="monospaced">
2578 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2579 TLS_INCLUDE=-I/usr/gnu/include
2582 You do not need to set TLS_INCLUDE if the relevant directory is already
2583 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2584 given in chapter <xref linkend="CHAPTLS"/>.
2588 <title>Use of tcpwrappers</title>
2590 <indexterm role="concept">
2591 <primary>tcpwrappers</primary>
2592 <secondary>building Exim to support</secondary>
2594 <indexterm role="concept">
2595 <primary>USE_TCP_WRAPPERS</primary>
2597 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2598 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2599 alternative to Exim’s own checking facilities for installations that are
2600 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2601 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2602 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2603 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2604 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2607 <literallayout class="monospaced">
2608 USE_TCP_WRAPPERS=yes
2609 CFLAGS=-O -I/usr/local/include
2610 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2613 in <filename>Local/Makefile</filename>. The name to use in the <emphasis>tcpwrappers</emphasis> control files is
2614 <quote>exim</quote>. For example, the line
2616 <literallayout class="monospaced">
2617 exim : LOCAL 192.168.1. .friendly.domain.example
2620 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2621 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2622 All other connections are denied. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2627 <title>Including support for IPv6</title>
2629 <indexterm role="concept">
2630 <primary>IPv6</primary>
2631 <secondary>including support for</secondary>
2633 Exim contains code for use on systems that have IPv6 support. Setting
2634 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2635 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2636 where the IPv6 support is not fully integrated into the normal include and
2640 Two different types of DNS record for handling IPv6 addresses have been
2641 defined. AAAA records (analagous to A records for IPv4) are in use, and are
2642 currently seen as the mainstream. Another record type called A6 was proposed
2643 as better than AAAA because it had more flexibility. However, it was felt to be
2644 over-complex, and its status was reduced to <quote>experimental</quote>. It is not known
2645 if anyone is actually using A6 records. Exim has support for A6 records, but
2646 this is included only if you set <literal>SUPPORT_A6=YES</literal> in <filename>Local/Makefile</filename>. The
2647 support has not been tested for some time.
2651 <title>The building process</title>
2653 <indexterm role="concept">
2654 <primary>build directory</primary>
2656 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2657 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2658 operating system types, and creates a build directory if one does not exist.
2659 For example, on a Sun system running Solaris 8, the directory
2660 <filename>build-SunOS5-5.8-sparc</filename> is created.
2661 <indexterm role="concept">
2662 <primary>symbolic link</primary>
2663 <secondary>to source files</secondary>
2665 Symbolic links to relevant source files are installed in the build directory.
2668 <emphasis role="bold">Warning</emphasis>: The <option>-j</option> (parallel) flag must not be used with <emphasis>make</emphasis>; the
2669 building process fails if it is set.
2672 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2673 a make file inside the build directory, using the configuration files from the
2674 <filename>Local</filename> directory. The new make file is then passed to another instance of
2675 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2676 then compiling and linking the binaries for the Exim monitor (if configured), a
2677 number of utility programs, and finally Exim itself. The command <literal>make
2678 makefile</literal> can be used to force a rebuild of the make file in the build
2679 directory, should this ever be necessary.
2682 If you have problems building Exim, check for any comments there may be in the
2683 <filename>README</filename> file concerning your operating system, and also take a look at the
2684 FAQ, where some common problems are covered.
2688 <title>Output from <quote>make</quote></title>
2690 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2691 unreadable, because these lines can be very long. For this reason, the normal
2692 output is suppressed by default, and instead output similar to that which
2693 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2694 each module that is being compiled or linked. However, it is still possible to
2695 get the full output, by calling <emphasis>make</emphasis> like this:
2697 <literallayout class="monospaced">
2701 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2702 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2703 given in addition to the the short output.
2706 <section id="SECToverride">
2707 <title>Overriding build-time options for Exim</title>
2709 <indexterm role="concept">
2710 <primary>build-time options</primary>
2711 <secondary>overriding</secondary>
2713 The main make file that is created at the beginning of the building process
2714 consists of the concatenation of a number of files which set configuration
2715 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2716 more than once, the last setting overrides any previous ones. This provides a
2717 convenient way of overriding defaults. The files that are concatenated are, in
2721 <filename>OS/Makefile-Default</filename>
2722 <filename>OS/Makefile-</filename><<emphasis>ostype</emphasis>>
2723 <filename>Local/Makefile</filename>
2724 <filename>Local/Makefile-</filename><<emphasis>ostype</emphasis>>
2725 <filename>Local/Makefile-</filename><<emphasis>archtype</emphasis>>
2726 <filename>Local/Makefile-</filename><<emphasis>ostype</emphasis>>-<<emphasis>archtype</emphasis>>
2727 <filename>OS/Makefile-Base</filename>
2730 <indexterm role="concept">
2731 <primary><filename>Local/Makefile</filename></primary>
2733 <indexterm role="concept">
2734 <primary>building Exim</primary>
2735 <secondary>operating system type</secondary>
2737 <indexterm role="concept">
2738 <primary>building Exim</primary>
2739 <secondary>architecture type</secondary>
2741 where <<emphasis>ostype</emphasis>> is the operating system type and <<emphasis>archtype</emphasis>> is the
2742 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2743 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2744 and are often not needed.
2747 The values used for <<emphasis>ostype</emphasis>> and <<emphasis>archtype</emphasis>> are obtained from scripts
2748 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2749 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2750 values are used, thereby providing a means of forcing particular settings.
2751 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2752 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2753 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2754 that Exim expects. You can run these scripts directly from the shell in order
2755 to find out what values are being used on your system.
2758 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2759 therein. Some (but not all) are mentioned below. If there is something that
2760 needs changing, review the contents of this file and the contents of the make
2761 file for your operating system (<filename>OS/Makefile-<ostype></filename>) to see what the
2765 <indexterm role="concept">
2766 <primary>building Exim</primary>
2767 <secondary>overriding default settings</secondary>
2769 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2770 or in <filename>OS/Makefile-<ostype></filename>, or to add any new definitions, you do not
2771 need to change the original files. Instead, you should make the changes by
2772 putting the new values in an appropriate <filename>Local</filename> file. For example,
2773 <indexterm role="concept">
2774 <primary>Tru64-Unix build-time settings</primary>
2776 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2777 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2778 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2779 called with the option <option>-std1</option>, to make it recognize some of the features of
2780 Standard C that Exim uses. (Most other compilers recognize Standard C by
2781 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2782 containing the lines
2784 <literallayout class="monospaced">
2789 If you are compiling for just one operating system, it may be easier to put
2790 these lines directly into <filename>Local/Makefile</filename>.
2793 Keeping all your local configuration settings separate from the distributed
2794 files makes it easy to transfer them to new versions of Exim simply by copying
2795 the contents of the <filename>Local</filename> directory.
2798 <indexterm role="concept">
2799 <primary>NIS lookup type</primary>
2800 <secondary>including support for</secondary>
2802 <indexterm role="concept">
2803 <primary>NIS+ lookup type</primary>
2804 <secondary>including support for</secondary>
2806 <indexterm role="concept">
2807 <primary>LDAP</primary>
2808 <secondary>including support for</secondary>
2810 <indexterm role="concept">
2811 <primary>lookup</primary>
2812 <secondary>inclusion in binary</secondary>
2814 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2815 lookup, but not all systems have these components installed, so the default is
2816 not to include the relevant code in the binary. All the different kinds of file
2817 and database lookup that Exim supports are implemented as separate code modules
2818 which are included only if the relevant compile-time options are set. In the
2819 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2821 <literallayout class="monospaced">
2827 and similar settings apply to the other lookup types. They are all listed in
2828 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2829 libraries need to be installed before compiling Exim.
2830 <indexterm role="concept">
2831 <primary>cdb</primary>
2832 <secondary>including support for</secondary>
2834 However, there are some optional lookup types (such as cdb) for which
2835 the code is entirely contained within Exim, and no external include
2836 files or libraries are required. When a lookup type is not included in the
2837 binary, attempts to configure Exim to use it cause run time configuration
2841 <indexterm role="concept">
2842 <primary>Perl</primary>
2843 <secondary>including support for</secondary>
2845 Exim can be linked with an embedded Perl interpreter, allowing Perl
2846 subroutines to be called during string expansion. To enable this facility,
2848 <literallayout class="monospaced">
2852 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2853 chapter <xref linkend="CHAPperl"/>.
2856 <indexterm role="concept">
2857 <primary>X11 libraries</primary>
2858 <secondary>location of</secondary>
2860 The location of the X11 libraries is something that varies a lot between
2861 operating systems, and there may be different versions of X11 to cope
2862 with. Exim itself makes no use of X11, but if you are compiling the Exim
2863 monitor, the X11 libraries must be available.
2864 The following three variables are set in <filename>OS/Makefile-Default</filename>:
2866 <literallayout class="monospaced">
2868 XINCLUDE=-I$(X11)/include
2869 XLFLAGS=-L$(X11)/lib
2872 These are overridden in some of the operating-system configuration files. For
2873 example, in <filename>OS/Makefile-SunOS5</filename> there is
2875 <literallayout class="monospaced">
2877 XINCLUDE=-I$(X11)/include
2878 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
2881 If you need to override the default setting for your operating system, place a
2882 definition of all three of these variables into your
2883 <filename>Local/Makefile-<ostype></filename> file.
2886 <indexterm role="concept">
2887 <primary>EXTRALIBS</primary>
2889 If you need to add any extra libraries to the link steps, these can be put in a
2890 variable called EXTRALIBS, which appears in all the link commands, but by
2891 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
2892 command for linking the main Exim binary, and not for any associated utilities.
2895 <indexterm role="concept">
2896 <primary>DBM libraries</primary>
2897 <secondary>configuration for building</secondary>
2899 There is also DBMLIB, which appears in the link commands for binaries that
2900 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
2901 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
2902 binary, and which can be used, for example, to include additional X11
2906 <indexterm role="concept">
2907 <primary>configuration file</primary>
2908 <secondary>editing</secondary>
2910 The make file copes with rebuilding Exim correctly if any of the configuration
2911 files are edited. However, if an optional configuration file is deleted, it is
2912 necessary to touch the associated non-optional file (that is,
2913 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
2917 <title>OS-specific header files</title>
2919 <indexterm role="concept">
2920 <primary><filename>os.h</filename></primary>
2922 <indexterm role="concept">
2923 <primary>building Exim</primary>
2924 <secondary>OS-specific C header files</secondary>
2926 The <filename>OS</filename> directory contains a number of files with names of the form
2927 <filename>os.h-<ostype></filename>. These are system-specific C header files that should not
2928 normally need to be changed. There is a list of macro settings that are
2929 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
2930 are porting Exim to a new operating system.
2934 <title>Overriding build-time options for the monitor</title>
2936 <indexterm role="concept">
2937 <primary>building Eximon</primary>
2938 <secondary>overriding default options</secondary>
2940 A similar process is used for overriding things when building the Exim monitor,
2941 where the files that are involved are
2944 <filename>OS/eximon.conf-Default</filename>
2945 <filename>OS/eximon.conf-</filename><<emphasis>ostype</emphasis>>
2946 <filename>Local/eximon.conf</filename>
2947 <filename>Local/eximon.conf-</filename><<emphasis>ostype</emphasis>>
2948 <filename>Local/eximon.conf-</filename><<emphasis>archtype</emphasis>>
2949 <filename>Local/eximon.conf-</filename><<emphasis>ostype</emphasis>>-<<emphasis>archtype</emphasis>>
2952 <indexterm role="concept">
2953 <primary><filename>Local/eximon.conf</filename></primary>
2955 As with Exim itself, the final three files need not exist, and in this case the
2956 <filename>OS/eximon.conf-<ostype></filename> file is also optional. The default values in
2957 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
2958 variables of the same name, preceded by EXIMON_. For example, setting
2959 EXIMON_LOG_DEPTH in the environment overrides the value of
2960 LOG_DEPTH at run time.
2961 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
2965 <title>Installing Exim binaries and scripts</title>
2967 <indexterm role="concept">
2968 <primary>installing Exim</primary>
2970 <indexterm role="concept">
2971 <primary>BIN_DIRECTORY</primary>
2973 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
2974 arguments. The script copies binaries and utility scripts into the directory
2975 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
2976 <indexterm role="concept">
2977 <primary>setuid</primary>
2978 <secondary>installing Exim with</secondary>
2980 The install script copies files only if they are newer than the files they are
2981 going to replace. The Exim binary is required to be owned by root and have the
2982 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
2983 install</literal> as root so that it can set up the Exim binary in this way. However, in
2984 some special situations (for example, if a host is doing no local deliveries)
2985 it may be possible to run Exim without making the binary setuid root (see
2986 chapter <xref linkend="CHAPsecurity"/> for details).
2989 <indexterm role="concept">
2990 <primary>CONFIGURE_FILE</primary>
2992 Exim’s run time configuration file is named by the CONFIGURE_FILE setting
2993 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
2994 exist, the default configuration file <filename>src/configure.default</filename> is copied there
2995 by the installation script. If a run time configuration file already exists, it
2996 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
2997 alternative files, no default is installed.
3000 <indexterm role="concept">
3001 <primary>system aliases file</primary>
3003 <indexterm role="concept">
3004 <primary><filename>/etc/aliases</filename></primary>
3006 One change is made to the default configuration file when it is installed: the
3007 default configuration contains a router that references a system aliases file.
3008 The path to this file is set to the value specified by
3009 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
3010 If the system aliases file does not exist, the installation script creates it,
3011 and outputs a comment to the user.
3014 The created file contains no aliases, but it does contain comments about the
3015 aliases a site should normally have. Mail aliases have traditionally been
3016 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
3017 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
3018 Exim’s configuration if necessary.
3021 The default configuration uses the local host’s name as the only local domain,
3022 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
3023 running as the local user. System aliases and <filename>.forward</filename> files in users’ home
3024 directories are supported, but no NIS or NIS+ support is configured. Domains
3025 other than the name of the local host are routed using the DNS, with delivery
3029 It is possible to install Exim for special purposes (such as building a binary
3030 distribution) in a private part of the file system. You can do this by a
3033 <literallayout class="monospaced">
3034 make DESTDIR=/some/directory/ install
3037 This has the effect of pre-pending the specified directory to all the file
3038 paths, except the name of the system aliases file that appears in the default
3039 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3040 For backwards compatibility, ROOT is used if DESTDIR is not set,
3041 but this usage is deprecated.
3044 <indexterm role="concept">
3045 <primary>installing Exim</primary>
3046 <secondary>what is not installed</secondary>
3048 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3049 <emphasis>convert4r4</emphasis>, or the <emphasis>pcretest</emphasis> test program. You will probably run the
3050 first of these only once (if you are upgrading from Exim 3), and the second
3051 isn’t really part of Exim. None of the documentation files in the <filename>doc</filename>
3052 directory are copied, except for the info files when you have set
3053 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3056 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3057 to their names. The Exim binary itself, however, is handled differently. It is
3058 installed under a name that includes the version number and the compile number,
3059 for example <filename>exim-4.63-1</filename>. The script then arranges for a symbolic link
3060 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3061 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3062 from the directory (as seen by other processes).
3065 <indexterm role="concept">
3066 <primary>installing Exim</primary>
3067 <secondary>testing the script</secondary>
3069 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3070 real, you can pass the <option>-n</option> option to the installation script by this
3073 <literallayout class="monospaced">
3074 make INSTALL_ARG=-n install
3077 The contents of the variable INSTALL_ARG are passed to the installation
3078 script. You do not need to be root to run this test. Alternatively, you can run
3079 the installation script directly, but this must be from within the build
3080 directory. For example, from the top-level Exim directory you could use this
3083 <literallayout class="monospaced">
3084 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3087 <indexterm role="concept">
3088 <primary>installing Exim</primary>
3089 <secondary>install script options</secondary>
3091 There are two other options that can be supplied to the installation script.
3096 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3097 to root, and the call to make it a setuid binary.
3102 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3108 INSTALL_ARG can be used to pass these options to the script. For example:
3110 <literallayout class="monospaced">
3111 make INSTALL_ARG=-no_symlink install
3114 The installation script can also be given arguments specifying which files are
3115 to be copied. For example, to install just the Exim binary, and nothing else,
3116 without creating the symbolic link, you could use:
3118 <literallayout class="monospaced">
3119 make INSTALL_ARG='-no_symlink exim' install
3122 <section id="SECTinsinfdoc">
3123 <title>Installing info documentation</title>
3125 <indexterm role="concept">
3126 <primary>installing Exim</primary>
3127 <secondary><emphasis>info</emphasis> documentation</secondary>
3129 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3130 reason, the Texinfo source of Exim’s documentation is not included in the main
3131 distribution. Instead it is available separately from the ftp site (see section
3132 <xref linkend="SECTavail"/>).
3135 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3136 source of the documentation is found in the source tree, running <literal>make
3137 install</literal> automatically builds the info files and installs them.
3141 <title>Setting up the spool directory</title>
3143 <indexterm role="concept">
3144 <primary>spool directory</primary>
3145 <secondary>creating</secondary>
3147 When it starts up, Exim tries to create its spool directory if it does not
3148 exist. The Exim uid and gid are used for the owner and group of the spool
3149 directory. Sub-directories are automatically created in the spool directory as
3154 <title>Testing</title>
3156 <indexterm role="concept">
3157 <primary>testing</primary>
3158 <secondary>installation</secondary>
3160 Having installed Exim, you can check that the run time configuration file is
3161 syntactically valid by running the following command, which assumes that the
3162 Exim binary directory is within your PATH environment variable:
3164 <literallayout class="monospaced">
3168 If there are any errors in the configuration file, Exim outputs error messages.
3169 Otherwise it outputs the version number and build date,
3170 the DBM library that is being used, and information about which drivers and
3171 other optional code modules are included in the binary.
3172 Some simple routing tests can be done by using the address testing option. For
3176 <literal>exim -bt</literal> <<emphasis>local username</emphasis>>
3179 should verify that it recognizes a local mailbox, and
3182 <literal>exim -bt</literal> <<emphasis>remote address</emphasis>>
3185 a remote one. Then try getting it to deliver mail, both locally and remotely.
3186 This can be done by passing messages directly to Exim, without going through a
3187 user agent. For example:
3189 <literallayout class="monospaced">
3190 exim -v postmaster@your.domain.example
3191 From: user@your.domain.example
3192 To: postmaster@your.domain.example
3193 Subject: Testing Exim
3195 This is a test message.
3199 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3200 In this case you should see copies of three log lines, one for the message’s
3201 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3204 <indexterm role="concept">
3205 <primary>delivery</primary>
3206 <secondary>problems with</secondary>
3208 If you encounter problems, look at Exim’s log files (<emphasis>mainlog</emphasis> and
3209 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3210 of information is running Exim with debugging turned on, by specifying the
3211 <option>-d</option> option. If a message is stuck on Exim’s spool, you can force a delivery
3212 with debugging turned on by a command of the form
3215 <literal>exim -d -M</literal> <<emphasis>exim-message-id</emphasis>>
3218 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3219 produces rather a lot of output, but you can cut this down to specific areas.
3220 For example, if you use <option>-d-all+route</option> only the debugging information
3221 relevant to routing is included. (See the <option>-d</option> option in chapter
3222 <xref linkend="CHAPcommandline"/> for more details.)
3225 <indexterm role="concept">
3226 <primary><quote>sticky</quote> bit</primary>
3228 <indexterm role="concept">
3229 <primary>lock files</primary>
3231 One specific problem that has shown up on some sites is the inability to do
3232 local deliveries into a shared mailbox directory, because it does not have the
3233 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3234 writing to a mailbox file, and if it cannot create the lock file, the delivery
3235 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3236 directory, or by setting a specific group for local deliveries and allowing
3237 that group to create files in the directory (see the comments above the
3238 <command>local_delivery</command> transport in the default configuration file). Another
3239 approach is to configure Exim not to use lock files, but just to rely on
3240 <function>fcntl()</function> locking instead. However, you should do this only if all user
3241 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3242 see chapter <xref linkend="CHAPappendfile"/>.
3245 One thing that cannot be tested on a system that is already running an MTA is
3246 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3247 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3248 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3249 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3253 Testing a new version on a system that is already running Exim can most easily
3254 be done by building a binary with a different CONFIGURE_FILE setting. From
3255 within the run time configuration, all other file and directory names
3256 that Exim uses can be altered, in order to keep it entirely clear of the
3261 <title>Replacing another MTA with Exim</title>
3263 <indexterm role="concept">
3264 <primary>replacing another MTA</primary>
3266 Building and installing Exim for the first time does not of itself put it in
3267 general use. The name by which the system’s MTA is called by mail user agents
3268 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3269 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3270 binary in order to get the user agents to pass messages to Exim. This is
3271 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3272 or <filename>/usr/lib/sendmail</filename>
3273 <indexterm role="concept">
3274 <primary>symbolic link</primary>
3275 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3277 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3278 privilege and executable status from the old MTA. It is then necessary to stop
3279 and restart the mailer daemon, if one is running.
3282 <indexterm role="concept">
3283 <primary>FreeBSD</primary>
3284 <secondary>MTA indirection</secondary>
3286 <indexterm role="concept">
3287 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3289 Some operating systems have introduced alternative ways of switching MTAs. For
3290 example, if you are running FreeBSD, you need to edit the file
3291 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3292 described. A typical example of the contents of this file for running Exim is
3295 <literallayout class="monospaced">
3296 sendmail /usr/exim/bin/exim
3297 send-mail /usr/exim/bin/exim
3298 mailq /usr/exim/bin/exim -bp
3299 newaliases /usr/bin/true
3302 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3303 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3304 favourite user agent.
3307 You should consider what to tell your users about the change of MTA. Exim may
3308 have different capabilities to what was previously running, and there are
3309 various operational differences such as the text of messages produced by
3310 command line options and in bounce messages. If you allow your users to make
3311 use of Exim’s filtering capabilities, you should make the document entitled
3312 <emphasis>Exim’s interface to mail filtering</emphasis> available to them.
3316 <title>Upgrading Exim</title>
3318 <indexterm role="concept">
3319 <primary>upgrading Exim</primary>
3321 If you are already running Exim on your host, building and installing a new
3322 version automatically makes it available to MUAs, or any other programs that
3323 call the MTA directly. However, if you are running an Exim daemon, you do need
3324 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3325 new binary. You do not need to stop processing mail in order to install a new
3326 version of Exim. The install script does not modify an existing runtime
3331 <title>Stopping the Exim daemon on Solaris</title>
3333 <indexterm role="concept">
3334 <primary>Solaris</primary>
3335 <secondary>stopping Exim on</secondary>
3337 The standard command for stopping the mailer daemon on Solaris is
3339 <literallayout class="monospaced">
3340 /etc/init.d/sendmail stop
3343 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3344 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3345 for the text <quote>sendmail</quote>; this is not present because the actual program name
3346 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3347 solution is to replace the line that finds the process id with something like
3349 <literallayout class="monospaced">
3350 pid=`cat /var/spool/exim/exim-daemon.pid`
3353 to obtain the daemon’s pid directly from the file that Exim saves it in.
3356 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3357 still be received from local processes, and if automatic delivery is configured
3358 (the normal case), deliveries will still occur.
3363 <chapter id="CHAPcommandline">
3364 <title>The Exim command line</title>
3366 <indexterm role="concept" id="IIDclo1" class="startofrange">
3367 <primary>command line</primary>
3368 <secondary>options</secondary>
3370 <indexterm role="concept" id="IIDclo2" class="startofrange">
3371 <primary>options</primary>
3372 <secondary>command line</secondary>
3374 Exim’s command line takes the standard Unix form of a sequence of options,
3375 each starting with a hyphen character, followed by a number of arguments. The
3376 options are compatible with the main options of Sendmail, and there are also
3377 some additional options, some of which are compatible with Smail 3. Certain
3378 combinations of options do not make sense, and provoke an error if used.
3379 The form of the arguments depends on which options are set.
3382 <title>Setting options by program name</title>
3384 <indexterm role="concept">
3385 <primary><emphasis>mailq</emphasis></primary>
3387 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3388 were present before any other options.
3389 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3391 This feature is for compatibility with some systems that contain a command of
3392 that name in one of the standard libraries, symbolically linked to
3393 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3396 <indexterm role="concept">
3397 <primary><emphasis>rsmtp</emphasis></primary>
3399 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3400 were present before any other options, for compatibility with Smail. The
3401 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3405 <indexterm role="concept">
3406 <primary><emphasis>rmail</emphasis></primary>
3408 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3409 <option>-oee</option> options were present before any other options, for compatibility with
3410 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3413 <indexterm role="concept">
3414 <primary><emphasis>runq</emphasis></primary>
3416 <indexterm role="concept">
3417 <primary>queue runner</primary>
3419 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3420 were present before any other options, for compatibility with Smail. The <option>-q</option>
3421 option causes a single queue runner process to be started.
3424 <indexterm role="concept">
3425 <primary><emphasis>newaliases</emphasis></primary>
3427 <indexterm role="concept">
3428 <primary>alias file</primary>
3429 <secondary>building</secondary>
3431 <indexterm role="concept">
3432 <primary>Sendmail compatibility</primary>
3433 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3435 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3436 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3437 This option is used for rebuilding Sendmail’s alias file. Exim does not have
3438 the concept of a single alias file, but can be configured to run a given
3439 command if called with the <option>-bi</option> option.
3442 <section id="SECTtrustedadmin">
3443 <title>Trusted and admin users</title>
3445 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3446 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3447 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3448 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3449 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3454 <indexterm role="concept">
3455 <primary>trusted user</primary>
3456 <secondary>definition of</secondary>
3458 <indexterm role="concept">
3459 <primary>user</primary>
3460 <secondary>trusted definition of</secondary>
3462 The trusted users are root, the Exim user, any user listed in the
3463 <option>trusted_users</option> configuration option, and any user whose current group or any
3464 supplementary group is one of those listed in the <option>trusted_groups</option>
3465 configuration option. Note that the Exim group is not automatically trusted.
3468 <indexterm role="concept">
3469 <primary><quote>From</quote> line</primary>
3471 <indexterm role="concept">
3472 <primary>envelope sender</primary>
3474 Trusted users are always permitted to use the <option>-f</option> option or a leading
3475 <quote>From </quote> line to specify the envelope sender of a message that is passed to
3476 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3477 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3478 users to set envelope senders.
3481 <indexterm role="concept">
3482 <primary><emphasis>From:</emphasis> header line</primary>
3484 <indexterm role="concept">
3485 <primary><emphasis>Sender:</emphasis> header line</primary>
3487 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3488 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3489 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3492 Trusted users may also specify a host name, host address, interface address,
3493 protocol name, ident value, and authentication data when submitting a message
3494 locally. Thus, they are able to insert messages into Exim’s queue locally that
3495 have the characteristics of messages received from a remote host. Untrusted
3496 users may in some circumstances use <option>-f</option>, but can never set the other values
3497 that are available to trusted users.
3502 <indexterm role="concept">
3503 <primary>user</primary>
3504 <secondary>admin definition of</secondary>
3506 <indexterm role="concept">
3507 <primary>admin user</primary>
3508 <secondary>definition of</secondary>
3510 The admin users are root, the Exim user, and any user that is a member of the
3511 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3512 The current group does not have to be one of these groups.
3515 Admin users are permitted to list the queue, and to carry out certain
3516 operations on messages, for example, to force delivery failures. It is also
3517 necessary to be an admin user in order to see the full information provided by
3518 the Exim monitor, and full debugging output.
3521 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3522 Exim to attempt delivery of messages on its queue is restricted to admin users.
3523 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3524 option false (that is, specifying <option>no_prod_requires_admin</option>).
3527 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3528 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3534 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3535 edit Exim’s configuration file, you are giving those users an easy way of
3536 getting root. There is further discussion of this issue at the start of chapter
3537 <xref linkend="CHAPconf"/>.
3541 <title>Command line options</title>
3542 <para revisionflag="changed">
3543 Exim’s command line options are described in alphabetical order below. If none
3544 of the options that specifies a specific action (such as starting the daemon or
3545 a queue runner, or testing an address, or receiving a message in a specific
3546 format, or listing the queue) are present, and there is at least one argument
3547 on the command line, <option>-bm</option> (accept a local message on the standard input,
3548 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3549 outputs a brief message about itself and exits.
3551 <!-- === Start of command line options === -->
3554 <term><option>--</option></term>
3557 <indexterm role="option">
3558 <primary>--</primary>
3560 <indexterm role="concept">
3561 <primary>options</primary>
3562 <secondary>command line; terminating</secondary>
3564 This is a pseudo-option whose only purpose is to terminate the options and
3565 therefore to cause subsequent command line items to be treated as arguments
3566 rather than options, even if they begin with hyphens.
3568 </listitem></varlistentry>
3570 <term><option>--help</option></term>
3573 <indexterm role="option">
3574 <primary><option>--help</option></primary>
3576 This option causes Exim to output a few sentences stating what it is.
3577 The same output is generated if the Exim binary is called with no options and
3580 </listitem></varlistentry>
3582 <term><option>-B</option><<emphasis>type</emphasis>></term>
3585 <indexterm role="option">
3586 <primary><option>-B</option></primary>
3588 <indexterm role="concept">
3589 <primary>8-bit characters</primary>
3591 <indexterm role="concept">
3592 <primary>Sendmail compatibility</primary>
3593 <secondary>8-bit characters</secondary>
3595 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3596 clean; it ignores this option.
3598 </listitem></varlistentry>
3600 <term><option>-bd</option></term>
3603 <indexterm role="option">
3604 <primary><option>-bd</option></primary>
3606 <indexterm role="concept">
3607 <primary>daemon</primary>
3609 <indexterm role="concept">
3610 <primary>SMTP listener</primary>
3612 <indexterm role="concept">
3613 <primary>queue runner</primary>
3615 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3616 the <option>-bd</option> option is combined with the <option>-q</option><<emphasis>time</emphasis>> option, to specify
3617 that the daemon should also initiate periodic queue runs.
3620 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3621 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3622 disconnect from the controlling terminal. When running this way, it can be
3623 stopped by pressing ctrl-C.
3626 By default, Exim listens for incoming connections to the standard SMTP port on
3627 all the host’s running interfaces. However, it is possible to listen on other
3628 ports, on multiple ports, and only on specific interfaces. Chapter
3629 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3632 When a listening daemon
3633 <indexterm role="concept">
3634 <primary>daemon</primary>
3635 <secondary>process id (pid)</secondary>
3637 <indexterm role="concept">
3638 <primary>pid (process id)</primary>
3639 <secondary>of daemon</secondary>
3641 is started without the use of <option>-oX</option> (that is, without overriding the normal
3642 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3643 in Exim’s spool directory. This location can be overridden by setting
3644 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3648 When <option>-oX</option> is used on the command line to start a listening daemon, the
3649 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3650 used to specify a path on the command line if a pid file is required.
3654 <indexterm role="concept">
3655 <primary>SIGHUP</primary>
3657 can be used to cause the daemon to re-exec itself. This should be done whenever
3658 Exim’s configuration file, or any file that is incorporated into it by means of
3659 the <option>.include</option> facility, is changed, and also whenever a new version of Exim
3660 is installed. It is not necessary to do this when other files that are
3661 referenced from the configuration (for example, alias files) are changed,
3662 because these are reread each time they are used.
3664 </listitem></varlistentry>
3666 <term><option>-bdf</option></term>
3669 <indexterm role="option">
3670 <primary><option>-bdf</option></primary>
3672 This option has the same effect as <option>-bd</option> except that it never disconnects
3673 from the controlling terminal, even when no debugging is specified.
3675 </listitem></varlistentry>
3677 <term><option>-be</option></term>
3680 <indexterm role="option">
3681 <primary><option>-be</option></primary>
3683 <indexterm role="concept">
3684 <primary>testing</primary>
3685 <secondary>string expansion</secondary>
3687 <indexterm role="concept">
3688 <primary>expansion</primary>
3689 <secondary>testing</secondary>
3691 Run Exim in expansion testing mode. Exim discards its root privilege, to
3692 prevent ordinary users from using this mode to read otherwise inaccessible
3693 files. If no arguments are given, Exim runs interactively, prompting for lines
3694 of data. Otherwise, it processes each argument in turn.
3697 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3698 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3699 used without command line arguments. If successful, it uses the <function>readline()</function>
3700 function, which provides extensive line-editing facilities, for reading the
3701 test data. A line history is supported.
3704 Long expansion expressions can be split over several lines by using backslash
3705 continuations. As in Exim’s run time configuration, white space at the start of
3706 continuation lines is ignored. Each argument or data line is passed through the
3707 string expansion mechanism, and the result is output. Variable values from the
3708 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3709 message-specific values (such as <varname>$domain</varname>) are set, because no message is
3713 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3714 files or databases you are using, you must exit and restart Exim before trying
3715 the same lookup again. Otherwise, because each Exim process caches the results
3716 of lookups, you will just get the same result as before.
3718 </listitem></varlistentry>
3720 <term><option>-bF</option> <<emphasis>filename</emphasis>></term>
3723 <indexterm role="option">
3724 <primary><option>-bF</option></primary>
3726 <indexterm role="concept">
3727 <primary>system filter</primary>
3728 <secondary>testing</secondary>
3730 <indexterm role="concept">
3731 <primary>testing</primary>
3732 <secondary>system filter</secondary>
3734 This option is the same as <option>-bf</option> except that it assumes that the filter being
3735 tested is a system filter. The additional commands that are available only in
3736 system filters are recognized.
3738 </listitem></varlistentry>
3740 <term><option>-bf</option> <<emphasis>filename</emphasis>></term>
3743 <indexterm role="option">
3744 <primary><option>-bf</option></primary>
3746 <indexterm role="concept">
3747 <primary>filter</primary>
3748 <secondary>testing</secondary>
3750 <indexterm role="concept">
3751 <primary>testing</primary>
3752 <secondary>filter file</secondary>
3754 <indexterm role="concept">
3755 <primary>forward file</primary>
3756 <secondary>testing</secondary>
3758 <indexterm role="concept">
3759 <primary>testing</primary>
3760 <secondary>forward file</secondary>
3762 <indexterm role="concept">
3763 <primary>Sieve filter</primary>
3764 <secondary>testing</secondary>
3766 This option runs Exim in user filter testing mode; the file is the filter file
3767 to be tested, and a test message must be supplied on the standard input. If
3768 there are no message-dependent tests in the filter, an empty file can be
3772 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
3773 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
3774 filter and a user filter in the same run. For example:
3776 <literallayout class="monospaced">
3777 exim -bF /system/filter -bf /user/filter </test/message
3780 This is helpful when the system filter adds header lines or sets filter
3781 variables that are used by the user filter.
3784 If the test filter file does not begin with one of the special lines
3786 <literallayout class="monospaced">
3791 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
3792 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
3793 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
3797 The result of an Exim command that uses <option>-bf</option>, provided no errors are
3798 detected, is a list of the actions that Exim would try to take if presented
3799 with the message for real. More details of filter testing are given in the
3800 separate document entitled <emphasis>Exim’s interfaces to mail filtering</emphasis>.
3803 When testing a filter file,
3804 <indexterm role="concept">
3805 <primary><quote>From</quote> line</primary>
3807 <indexterm role="concept">
3808 <primary>envelope sender</primary>
3810 <indexterm role="concept">
3811 <primary><option>-f</option> option</primary>
3812 <secondary>for filter testing</secondary>
3814 the envelope sender can be set by the <option>-f</option> option,
3815 or by a <quote>From </quote> line at the start of the test message. Various parameters
3816 that would normally be taken from the envelope recipient address of the message
3817 can be set by means of additional command line options (see the next four
3820 </listitem></varlistentry>
3822 <term><option>-bfd</option> <<emphasis>domain</emphasis>></term>
3825 <indexterm role="option">
3826 <primary><option>-bfd</option></primary>
3828 <indexterm role="concept">
3829 <primary><varname>$qualify_domain</varname></primary>
3831 This sets the domain of the recipient address when a filter file is being
3832 tested by means of the <option>-bf</option> option. The default is the value of
3833 <varname>$qualify_domain</varname>.
3835 </listitem></varlistentry>
3837 <term><option>-bfl</option> <<emphasis>local part</emphasis>></term>
3840 <indexterm role="option">
3841 <primary><option>-bfl</option></primary>
3843 This sets the local part of the recipient address when a filter file is being
3844 tested by means of the <option>-bf</option> option. The default is the username of the
3845 process that calls Exim. A local part should be specified with any prefix or
3846 suffix stripped, because that is how it appears to the filter when a message is
3847 actually being delivered.
3849 </listitem></varlistentry>
3851 <term><option>-bfp</option> <<emphasis>prefix</emphasis>></term>
3854 <indexterm role="option">
3855 <primary><option>-bfp</option></primary>
3857 This sets the prefix of the local part of the recipient address when a filter
3858 file is being tested by means of the <option>-bf</option> option. The default is an empty
3861 </listitem></varlistentry>
3863 <term><option>-bfs</option> <<emphasis>suffix</emphasis>></term>
3866 <indexterm role="option">
3867 <primary><option>-bfs</option></primary>
3869 This sets the suffix of the local part of the recipient address when a filter
3870 file is being tested by means of the <option>-bf</option> option. The default is an empty
3873 </listitem></varlistentry>
3875 <term><option>-bh</option> <<emphasis>IP address</emphasis>></term>
3878 <indexterm role="option">
3879 <primary><option>-bh</option></primary>
3881 <indexterm role="concept">
3882 <primary>testing</primary>
3883 <secondary>incoming SMTP</secondary>
3885 <indexterm role="concept">
3886 <primary>SMTP</primary>
3887 <secondary>testing incoming</secondary>
3889 <indexterm role="concept">
3890 <primary>testing</primary>
3891 <secondary>relay control</secondary>
3893 <indexterm role="concept">
3894 <primary>relaying</primary>
3895 <secondary>testing configuration</secondary>
3897 <indexterm role="concept">
3898 <primary>policy control</primary>
3899 <secondary>testing</secondary>
3901 <indexterm role="concept">
3902 <primary>debugging</primary>
3903 <secondary><option>-bh</option> option</secondary>
3905 This option runs a fake SMTP session as if from the given IP address, using the
3906 standard input and output. The IP address may include a port number at the end,
3907 after a full stop. For example:
3909 <literallayout class="monospaced">
3910 exim -bh 10.9.8.7.1234
3911 exim -bh fe80::a00:20ff:fe86:a061.5678
3914 When an IPv6 address is given, it is converted into canonical form. In the case
3915 of the second example above, the value of <varname>$sender_host_address</varname> after
3916 conversion to the canonical form is
3917 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
3920 Comments as to what is going on are written to the standard error file. These
3921 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
3922 This facility is provided for testing configuration options for incoming
3923 messages, to make sure they implement the required policy. For example, you can
3924 test your relay controls using <option>-bh</option>.
3927 <emphasis role="bold">Warning 1</emphasis>:
3928 <indexterm role="concept">
3929 <primary>RFC 1413</primary>
3932 <para revisionflag="changed">
3933 You can test features of the configuration that rely on ident (RFC 1413)
3934 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
3935 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
3939 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
3940 are also skipped when testing using <option>-bh</option>. If you want these callouts to
3941 occur, use <option>-bhc</option> instead.
3943 <para revisionflag="changed">
3944 Messages supplied during the testing session are discarded, and nothing is
3945 written to any of the real log files. There may be pauses when DNS (and other)
3946 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
3947 can be used to specify a specific IP interface and port if this is important,
3948 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
3949 session were authenticated.
3952 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
3953 output just states whether a given recipient address from a given host is
3954 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
3956 </listitem></varlistentry>
3958 <term><option>-bhc</option> <<emphasis>IP address</emphasis>></term>
3961 <indexterm role="option">
3962 <primary><option>-bhc</option></primary>
3964 This option operates in the same way as <option>-bh</option>, except that address
3965 verification callouts are performed if required. This includes consulting and
3966 updating the callout cache database.
3968 </listitem></varlistentry>
3970 <term><option>-bi</option></term>
3973 <indexterm role="option">
3974 <primary><option>-bi</option></primary>
3976 <indexterm role="concept">
3977 <primary>alias file</primary>
3978 <secondary>building</secondary>
3980 <indexterm role="concept">
3981 <primary>building alias file</primary>
3983 <indexterm role="concept">
3984 <primary>Sendmail compatibility</primary>
3985 <secondary><option>-bi</option> option</secondary>
3987 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
3988 Exim does not have the concept of a single alias file, and so it cannot mimic
3989 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
3990 tend to appear in various scripts such as NIS make files, so the option must be
3994 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
3995 configuration option is run, under the uid and gid of the caller of Exim. If
3996 the <option>-oA</option> option is used, its value is passed to the command as an argument.
3997 The command set by <option>bi_command</option> may not contain arguments. The command can
3998 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
3999 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4000 <option>-bi</option> is a no-op.
4002 </listitem></varlistentry>
4004 <term><option>-bm</option></term>
4007 <indexterm role="option">
4008 <primary><option>-bm</option></primary>
4010 <indexterm role="concept">
4011 <primary>local message reception</primary>
4013 This option runs an Exim receiving process that accepts an incoming,
4014 locally-generated message on the current input. The recipients are given as the
4015 command arguments (except when <option>-t</option> is also present – see below). Each
4016 argument can be a comma-separated list of RFC 2822 addresses. This is the
4017 default option for selecting the overall action of an Exim call; it is assumed
4018 if no other conflicting option is present.
4021 If any addresses in the message are unqualified (have no domain), they are
4022 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4023 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4024 suppressing this for special cases.
4027 Policy checks on the contents of local messages can be enforced by means of
4028 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4031 <indexterm role="concept">
4032 <primary>return code</primary>
4033 <secondary>for <option>-bm</option></secondary>
4035 The return code is zero if the message is successfully accepted. Otherwise, the
4036 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting – see below.
4040 <indexterm role="concept">
4041 <primary>message</primary>
4042 <secondary>format</secondary>
4044 <indexterm role="concept">
4045 <primary>format</primary>
4046 <secondary>message</secondary>
4048 <indexterm role="concept">
4049 <primary><quote>From</quote> line</primary>
4051 <indexterm role="concept">
4052 <primary>UUCP</primary>
4053 <secondary><quote>From</quote> line</secondary>
4055 <indexterm role="concept">
4056 <primary>Sendmail compatibility</primary>
4057 <secondary><quote>From</quote> line</secondary>
4059 of the message must be as defined in RFC 2822, except that, for
4060 compatibility with Sendmail and Smail, a line in one of the forms
4062 <literallayout class="monospaced">
4063 From sender Fri Jan 5 12:55 GMT 1997
4064 From sender Fri, 5 Jan 97 12:55:01
4067 (with the weekday optional, and possibly with additional text after the date)
4068 is permitted to appear at the start of the message. There appears to be no
4069 authoritative specification of the format of this line. Exim recognizes it by
4070 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4071 option, which can be changed if necessary.
4075 <indexterm role="concept">
4076 <primary><option>-f</option> option</primary>
4077 <secondary>overriding <quote>From</quote> line</secondary>
4079 specified sender is treated as if it were given as the argument to the
4080 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4081 preference to the address taken from the message. The caller of Exim must be a
4082 trusted user for the sender of a message to be set in this way.
4084 </listitem></varlistentry>
4086 <term><option>-bnq</option></term>
4089 <indexterm role="option">
4090 <primary><option>-bnq</option></primary>
4092 <indexterm role="concept">
4093 <primary>address qualification</primary>
4094 <secondary>suppressing</secondary>
4096 By default, Exim automatically qualifies unqualified addresses (those
4097 without domains) that appear in messages that are submitted locally (that
4098 is, not over TCP/IP). This qualification applies both to addresses in
4099 envelopes, and addresses in header lines. Sender addresses are qualified using
4100 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4101 defaults to the value of <option>qualify_domain</option>).
4104 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4105 being used to re-submit messages that originally came from remote hosts after
4106 content scanning, you probably do not want to qualify unqualified addresses in
4107 header lines. (Such lines will be present only if you have not enabled a header
4108 syntax check in the appropriate ACL.)
4111 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4112 messages that originate on the local host. When this is used, unqualified
4113 addresses in the envelope provoke errors (causing message rejection) and
4114 unqualified addresses in header lines are left alone.
4116 </listitem></varlistentry>
4118 <term><option>-bP</option></term>
4121 <indexterm role="option">
4122 <primary><option>-bP</option></primary>
4124 <indexterm role="concept">
4125 <primary>configuration options</primary>
4126 <secondary>extracting</secondary>
4128 <indexterm role="concept">
4129 <primary>options</primary>
4130 <secondary>configuration – extracting</secondary>
4132 If this option is given with no arguments, it causes the values of all Exim’s
4133 main configuration options to be written to the standard output. The values
4134 of one or more specific options can be requested by giving their names as
4135 arguments, for example:
4137 <literallayout class="monospaced">
4138 exim -bP qualify_domain hold_domains
4141 However, any option setting that is preceded by the word <quote>hide</quote> in the
4142 configuration file is not shown in full, except to an admin user. For other
4143 users, the output is as in this example:
4145 <literallayout class="monospaced">
4146 mysql_servers = <value not displayable>
4149 If <option>configure_file</option> is given as an argument, the name of the run time
4150 configuration file is output.
4151 If a list of configuration files was supplied, the value that is output here
4152 is the name of the file that was actually used.
4155 <indexterm role="concept">
4156 <primary>daemon</primary>
4157 <secondary>process id (pid)</secondary>
4159 <indexterm role="concept">
4160 <primary>pid (process id)</primary>
4161 <secondary>of daemon</secondary>
4163 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4164 directories where log files and daemon pid files are written are output,
4165 respectively. If these values are unset, log files are written in a
4166 sub-directory of the spool directory called <option>log</option>, and the pid file is
4167 written directly into the spool directory.
4170 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4172 <literallayout class="monospaced">
4173 exim -bP +local_domains
4176 it searches for a matching named list of any type (domain, host, address, or
4177 local part) and outputs what it finds.
4180 <indexterm role="concept">
4181 <primary>options</primary>
4182 <secondary>router – extracting</secondary>
4184 <indexterm role="concept">
4185 <primary>options</primary>
4186 <secondary>transport – extracting</secondary>
4188 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4189 followed by the name of an appropriate driver instance, the option settings for
4190 that driver are output. For example:
4192 <literallayout class="monospaced">
4193 exim -bP transport local_delivery
4196 The generic driver options are output first, followed by the driver’s private
4197 options. A list of the names of drivers of a particular type can be obtained by
4198 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4199 <option>authenticator_list</option>, and a complete list of all drivers with their option
4200 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4201 <option>authenticators</option>.
4203 </listitem></varlistentry>
4205 <term><option>-bp</option></term>
4208 <indexterm role="option">
4209 <primary><option>-bp</option></primary>
4211 <indexterm role="concept">
4212 <primary>queue</primary>
4213 <secondary>listing messages on</secondary>
4215 <indexterm role="concept">
4216 <primary>listing</primary>
4217 <secondary>messages on the queue</secondary>
4219 This option requests a listing of the contents of the mail queue on the
4220 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4221 just those messages are listed. By default, this option can be used only by an
4222 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4223 to allow any user to see the queue.
4226 Each message on the queue is displayed as in the following example:
4228 <literallayout class="monospaced">
4229 25m 2.9K 0t5C6f-0000c8-00 <alice@wonderland.fict.example>
4230 red.king@looking-glass.fict.example
4231 <other addresses>
4234 <indexterm role="concept">
4235 <primary>message</primary>
4236 <secondary>size in queue listing</secondary>
4238 <indexterm role="concept">
4239 <primary>size</primary>
4240 <secondary>of message</secondary>
4242 The first line contains the length of time the message has been on the queue
4243 (in this case 25 minutes), the size of the message (2.9K), the unique local
4244 identifier for the message, and the message sender, as contained in the
4245 envelope. For bounce messages, the sender address is empty, and appears as
4246 <quote><></quote>. If the message was submitted locally by an untrusted user who overrode
4247 the default sender address, the user’s login name is shown in parentheses
4248 before the sender address.
4251 <indexterm role="concept">
4252 <primary>frozen messages</primary>
4253 <secondary>in queue listing</secondary>
4255 If the message is frozen (attempts to deliver it are suspended) then the text
4256 <quote>*** frozen ***</quote> is displayed at the end of this line.
4259 The recipients of the message (taken from the envelope, not the headers) are
4260 displayed on subsequent lines. Those addresses to which the message has already
4261 been delivered are marked with the letter D. If an original address gets
4262 expanded into several addresses via an alias or forward file, the original is
4263 displayed with a D only when deliveries for all of its child addresses are
4266 </listitem></varlistentry>
4268 <term><option>-bpa</option></term>
4271 <indexterm role="option">
4272 <primary><option>-bpa</option></primary>
4274 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4275 that were generated from the original top level address(es) in each message by
4276 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4277 of just <quote>D</quote>.
4279 </listitem></varlistentry>
4281 <term><option>-bpc</option></term>
4284 <indexterm role="option">
4285 <primary><option>-bpc</option></primary>
4287 <indexterm role="concept">
4288 <primary>queue</primary>
4289 <secondary>count of messages on</secondary>
4291 This option counts the number of messages on the queue, and writes the total
4292 to the standard output. It is restricted to admin users, unless
4293 <option>queue_list_requires_admin</option> is set false.
4295 </listitem></varlistentry>
4297 <term><option>-bpr</option></term>
4300 <indexterm role="option">
4301 <primary><option>-bpr</option></primary>
4303 This option operates like <option>-bp</option>, but the output is not sorted into
4304 chronological order of message arrival. This can speed it up when there are
4305 lots of messages on the queue, and is particularly useful if the output is
4306 going to be post-processed in a way that doesn’t need the sorting.
4308 </listitem></varlistentry>
4310 <term><option>-bpra</option></term>
4313 <indexterm role="option">
4314 <primary><option>-bpra</option></primary>
4316 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4318 </listitem></varlistentry>
4320 <term><option>-bpru</option></term>
4323 <indexterm role="option">
4324 <primary><option>-bpru</option></primary>
4326 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4328 </listitem></varlistentry>
4330 <term><option>-bpu</option></term>
4333 <indexterm role="option">
4334 <primary><option>-bpu</option></primary>
4336 This option operates like <option>-bp</option> but shows only undelivered top-level
4337 addresses for each message displayed. Addresses generated by aliasing or
4338 forwarding are not shown, unless the message was deferred after processing by a
4339 router with the <option>one_time</option> option set.
4341 </listitem></varlistentry>
4343 <term><option>-brt</option></term>
4346 <indexterm role="option">
4347 <primary><option>-brt</option></primary>
4349 <indexterm role="concept">
4350 <primary>testing</primary>
4351 <secondary>retry configuration</secondary>
4353 <indexterm role="concept">
4354 <primary>retry</primary>
4355 <secondary>configuration testing</secondary>
4357 This option is for testing retry rules, and it must be followed by up to three
4358 arguments. It causes Exim to look for a retry rule that matches the values
4359 and to write it to the standard output. For example:
4361 <literallayout class="monospaced">
4362 exim -brt bach.comp.mus.example
4363 Retry rule: *.comp.mus.example F,2h,15m; F,4d,30m;
4366 See chapter <xref linkend="CHAPretry"/> for a description of Exim’s retry rules. The first
4367 argument, which is required, can be a complete address in the form
4368 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4369 contains a dot, it is interpreted as an optional second domain name; if no
4370 retry rule is found for the first argument, the second is tried. This ties in
4371 with Exim’s behaviour when looking for retry rules for remote hosts – if no
4372 rule is found that matches the host, one that matches the mail domain is
4373 sought. Finally, an argument that is the name of a specific delivery error, as
4374 used in setting up retry rules, can be given. For example:
4376 <literallayout class="monospaced">
4377 exim -brt haydn.comp.mus.example quota_3d
4378 Retry rule: *@haydn.comp.mus.example quota_3d F,1h,15m
4380 </listitem></varlistentry>
4382 <term><option>-brw</option></term>
4385 <indexterm role="option">
4386 <primary><option>-brw</option></primary>
4388 <indexterm role="concept">
4389 <primary>testing</primary>
4390 <secondary>rewriting</secondary>
4392 <indexterm role="concept">
4393 <primary>rewriting</primary>
4394 <secondary>testing</secondary>
4396 This option is for testing address rewriting rules, and it must be followed by
4397 a single argument, consisting of either a local part without a domain, or a
4398 complete address with a fully qualified domain. Exim outputs how this address
4399 would be rewritten for each possible place it might appear. See chapter
4400 <xref linkend="CHAPrewrite"/> for further details.
4402 </listitem></varlistentry>
4404 <term><option>-bS</option></term>
4407 <indexterm role="option">
4408 <primary><option>-bS</option></primary>
4410 <indexterm role="concept">
4411 <primary>SMTP</primary>
4412 <secondary>batched incoming</secondary>
4414 <indexterm role="concept">
4415 <primary>batched SMTP input</primary>
4417 This option is used for batched SMTP input, which is an alternative interface
4418 for non-interactive local message submission. A number of messages can be
4419 submitted in a single run. However, despite its name, this is not really SMTP
4420 input. Exim reads each message’s envelope from SMTP commands on the standard
4421 input, but generates no responses. If the caller is trusted, or
4422 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4423 believed; otherwise the sender is always the caller of Exim.
4426 The message itself is read from the standard input, in SMTP format (leading
4427 dots doubled), terminated by a line containing just a single dot. An error is
4428 provoked if the terminating dot is missing. A further message may then follow.
4431 As for other local message submissions, the contents of incoming batch SMTP
4432 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4433 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4434 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4437 Some other SMTP commands are recognized in the input. HELO and EHLO act
4438 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4439 QUIT quits, ignoring the rest of the standard input.
4442 <indexterm role="concept">
4443 <primary>return code</primary>
4444 <secondary>for <option>-bS</option></secondary>
4446 If any error is encountered, reports are written to the standard output and
4447 error streams, and Exim gives up immediately. The return code is 0 if no error
4448 was detected; it is 1 if one or more messages were accepted before the error
4449 was detected; otherwise it is 2.
4452 More details of input using batched SMTP are given in section
4453 <xref linkend="SECTincomingbatchedSMTP"/>.
4455 </listitem></varlistentry>
4457 <term><option>-bs</option></term>
4460 <indexterm role="option">
4461 <primary><option>-bs</option></primary>
4463 <indexterm role="concept">
4464 <primary>SMTP</primary>
4465 <secondary>local input</secondary>
4467 <indexterm role="concept">
4468 <primary>local SMTP input</primary>
4470 This option causes Exim to accept one or more messages by reading SMTP commands
4471 on the standard input, and producing SMTP replies on the standard output. SMTP
4472 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4473 Some user agents use this interface as a way of passing locally-generated
4474 messages to the MTA.
4478 <indexterm role="concept">
4479 <primary>sender</primary>
4480 <secondary>source of</secondary>
4482 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4483 set, the senders of messages are taken from the SMTP MAIL commands.
4484 Otherwise the content of these commands is ignored and the sender is set up as
4485 the calling user. Unqualified addresses are automatically qualified using
4486 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4487 <option>-bnq</option> option is used.
4490 <indexterm role="concept">
4491 <primary>inetd</primary>
4494 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4495 using a listening daemon. Exim can distinguish the two cases by checking
4496 whether the standard input is a TCP/IP socket. When Exim is called from
4497 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4498 above concerning senders and qualification do not apply. In this situation,
4499 Exim behaves in exactly the same way as it does when receiving a message via
4500 the listening daemon.
4502 </listitem></varlistentry>
4504 <term><option>-bt</option></term>
4507 <indexterm role="option">
4508 <primary><option>-bt</option></primary>
4510 <indexterm role="concept">
4511 <primary>testing</primary>
4512 <secondary>addresses</secondary>
4514 <indexterm role="concept">
4515 <primary>address</primary>
4516 <secondary>testing</secondary>
4518 This option runs Exim in address testing mode, in which each argument is taken
4519 as an address to be tested for deliverability. The results are written to the
4520 standard output. If a test fails, and the caller is not an admin user, no
4521 details of the failure are output, because these might contain sensitive
4522 information such as usernames and passwords for database lookups.
4525 If no arguments are given, Exim runs in an interactive manner, prompting with a
4526 right angle bracket for addresses to be tested.
4529 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4530 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4534 Each address is handled as if it were the recipient address of a message
4535 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4536 written to the standard output. However, any router that has
4537 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4538 genuine routing tests if your first router passes everything to a scanner
4543 <indexterm role="concept">
4544 <primary>return code</primary>
4545 <secondary>for <option>-bt</option></secondary>
4547 return code is 2 if any address failed outright; it is 1 if no address
4548 failed outright but at least one could not be resolved for some reason. Return
4549 code 0 is given only when all addresses succeed.
4551 <para revisionflag="changed">
4552 <indexterm role="concept">
4553 <primary>duplicate addresses</primary>
4555 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
4556 addresses after routing is complete, so that only one delivery takes place.
4557 This does not happen when testing with <option>-bt</option>; the full results of routing are
4561 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4562 routers in the configuration makes any tests on the sender address of a
4564 <indexterm role="concept">
4565 <primary><option>-f</option> option</primary>
4566 <secondary>for address testing</secondary>
4568 you can use the <option>-f</option> option to set an appropriate sender when running
4569 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4570 default qualifying domain. However, if you have set up (for example) routers
4571 whose behaviour depends on the contents of an incoming message, you cannot test
4572 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4575 </listitem></varlistentry>
4577 <term><option>-bV</option></term>
4580 <indexterm role="option">
4581 <primary><option>-bV</option></primary>
4583 <indexterm role="concept">
4584 <primary>version number of Exim</primary>
4585 <secondary>verifying</secondary>
4587 This option causes Exim to write the current version number, compilation
4588 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4589 It also lists the DBM library this is being used, the optional modules (such as
4590 specific lookup types), the drivers that are included in the binary, and the
4591 name of the run time configuration file that is in use.
4594 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4595 configuration file. However, this is a static check only. It cannot check
4596 values that are to be expanded. For example, although a misspelt ACL verb is
4597 detected, an error in the verb’s arguments is not. You cannot rely on <option>-bV</option>
4598 alone to discover (for example) all the typos in the configuration; some
4599 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4600 dynamic testing facilities.
4602 </listitem></varlistentry>
4604 <term><option>-bv</option></term>
4607 <indexterm role="option">
4608 <primary><option>-bv</option></primary>
4610 <indexterm role="concept">
4611 <primary>verifying address</primary>
4612 <secondary>using <option>-bv</option></secondary>
4614 <indexterm role="concept">
4615 <primary>address</primary>
4616 <secondary>verification</secondary>
4619 <para revisionflag="changed">
4620 This option runs Exim in address verification mode, in which each argument is
4621 taken as an address to be verified by the routers. (This does not involve any
4622 verification callouts). During normal operation, verification happens mostly as
4623 a consequence processing a <option>verify</option> condition in an ACL (see chapter
4624 <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly including callouts,
4625 see the <option>-bh</option> and <option>-bhc</option> options.
4628 If verification fails, and the caller is not an admin user, no details of the
4629 failure are output, because these might contain sensitive information such as
4630 usernames and passwords for database lookups.
4633 If no arguments are given, Exim runs in an interactive manner, prompting with a
4634 right angle bracket for addresses to be verified.
4637 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4638 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
4642 Verification differs from address testing (the <option>-bt</option> option) in that routers
4643 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
4644 router that has <option>fail_verify</option> set, verification fails. The address is
4645 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
4646 address, <option>-bvs</option> should be used.
4649 If the <option>-v</option> option is not set, the output consists of a single line for each
4650 address, stating whether it was verified or not, and giving a reason in the
4651 latter case. Otherwise, more details are given of how the address has been
4652 handled, and in the case of address redirection, all the generated addresses
4653 are also considered. Without <option>-v</option>, generating more than one address by
4654 redirection causes verification to end successfully.
4658 <indexterm role="concept">
4659 <primary>return code</primary>
4660 <secondary>for <option>-bv</option></secondary>
4662 return code is 2 if any address failed outright; it is 1 if no address
4663 failed outright but at least one could not be resolved for some reason. Return
4664 code 0 is given only when all addresses succeed.
4667 If any of the routers in the configuration makes any tests on the sender
4668 address of a message, you should use the <option>-f</option> option to set an appropriate
4669 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
4670 calling user at the default qualifying domain.
4672 </listitem></varlistentry>
4674 <term><option>-bvs</option></term>
4677 <indexterm role="option">
4678 <primary><option>-bvs</option></primary>
4680 This option acts like <option>-bv</option>, but verifies the address as a sender rather
4681 than a recipient address. This affects any rewriting and qualification that
4684 </listitem></varlistentry>
4686 <term><option>-C</option> <<emphasis>filelist</emphasis>></term>
4689 <indexterm role="option">
4690 <primary><option>-C</option></primary>
4692 <indexterm role="concept">
4693 <primary>configuration file</primary>
4694 <secondary>alternate</secondary>
4696 <indexterm role="concept">
4697 <primary>CONFIGURE_FILE</primary>
4699 <indexterm role="concept">
4700 <primary>alternate configuration file</primary>
4702 This option causes Exim to find the run time configuration file from the given
4703 list instead of from the list specified by the CONFIGURE_FILE
4704 compile-time setting. Usually, the list will consist of just a single file
4705 name, but it can be a colon-separated list of names. In this case, the first
4706 file that exists is used. Failure to open an existing file stops Exim from
4707 proceeding any further along the list, and an error is generated.
4710 When this option is used by a caller other than root or the Exim user, and the
4711 list is different from the compiled-in list, Exim gives up its root privilege
4712 immediately, and runs with the real and effective uid and gid set to those of
4713 the caller. However, if ALT_CONFIG_ROOT_ONLY is defined in
4714 <filename>Local/Makefile</filename>, root privilege is retained for <option>-C</option> only if the caller of
4718 That is, the Exim user is no longer privileged in this regard. This build-time
4719 option is not set by default in the Exim source distribution tarbundle.
4720 However, if you are using a <quote>packaged</quote> version of Exim (source or binary),
4721 the packagers might have enabled it.
4724 Setting ALT_CONFIG_ROOT_ONLY locks out the possibility of testing a
4725 configuration using <option>-C</option> right through message reception and delivery, even
4726 if the caller is root. The reception works, but by that time, Exim is running
4727 as the Exim user, so when it re-executes to regain privilege for the delivery,
4728 the use of <option>-C</option> causes privilege to be lost. However, root can test reception
4729 and delivery using two separate commands (one to put a message on the queue,
4730 using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
4733 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
4734 prefix string with which any file named in a <option>-C</option> command line option
4735 must start. In addition, the file name must not contain the sequence <literal>/../</literal>.
4736 However, if the value of the <option>-C</option> option is identical to the value of
4737 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
4738 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
4739 unset, any file name can be used with <option>-C</option>.
4742 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
4743 to a directory to which only root has access. This prevents someone who has
4744 broken into the Exim account from running a privileged Exim with an arbitrary
4748 The <option>-C</option> facility is useful for ensuring that configuration files are
4749 syntactically correct, but cannot be used for test deliveries, unless the
4750 caller is privileged, or unless it is an exotic configuration that does not
4751 require privilege. No check is made on the owner or group of the files
4752 specified by this option.
4754 </listitem></varlistentry>
4756 <term><option>-D</option><<emphasis>macro</emphasis>>=<<emphasis>value</emphasis>></term>
4759 <indexterm role="option">
4760 <primary><option>-D</option></primary>
4762 <indexterm role="concept">
4763 <primary>macro</primary>
4764 <secondary>setting on command line</secondary>
4766 This option can be used to override macro definitions in the configuration file
4767 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
4768 unprivileged caller, it causes Exim to give up its root privilege.
4769 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
4770 completely disabled, and its use causes an immediate error exit.
4773 The entire option (including equals sign if present) must all be within one
4774 command line item. <option>-D</option> can be used to set the value of a macro to the empty
4775 string, in which case the equals sign is optional. These two commands are
4778 <literallayout class="monospaced">
4783 To include spaces in a macro definition item, quotes must be used. If you use
4784 quotes, spaces are permitted around the macro name and the equals sign. For
4787 <literallayout class="monospaced">
4788 exim '-D ABC = something' ...
4791 <option>-D</option> may be repeated up to 10 times on a command line.
4793 </listitem></varlistentry>
4795 <term><option>-d</option><<emphasis>debug options</emphasis>></term>
4798 <indexterm role="option">
4799 <primary><option>-d</option></primary>
4801 <indexterm role="concept">
4802 <primary>debugging</primary>
4803 <secondary>list of selectors</secondary>
4805 <indexterm role="concept">
4806 <primary>debugging</primary>
4807 <secondary><option>-d</option> option</secondary>
4809 This option causes debugging information to be written to the standard
4810 error stream. It is restricted to admin users because debugging output may show
4811 database queries that contain password information. Also, the details of users’
4812 filter files should be protected. When <option>-d</option> is used, <option>-v</option> is assumed. If
4813 <option>-d</option> is given on its own, a lot of standard debugging data is output. This
4814 can be reduced, or increased to include some more rarely needed information, by
4815 directly following <option>-d</option> with a string made up of names preceded by plus or
4816 minus characters. These add or remove sets of debugging data, respectively. For
4817 example, <option>-d+filter</option> adds filter debugging, whereas <option>-d-all+filter</option> selects
4818 only filter debugging. Note that no spaces are allowed in the debug setting.
4819 The available debugging categories are:
4822 <literal>acl </literal> ACL interpretation
4823 <literal>auth </literal> authenticators
4824 <literal>deliver </literal> general delivery logic
4825 <literal>dns </literal> DNS lookups (see also resolver)
4826 <literal>dnsbl </literal> DNS black list (aka RBL) code
4827 <literal>exec </literal> arguments for <function>execv()</function> calls
4828 <literal>expand </literal> detailed debugging for string expansions
4829 <literal>filter </literal> filter handling
4830 <literal>hints_lookup </literal> hints data lookups
4831 <literal>host_lookup </literal> all types of name-to-IP address handling
4832 <literal>ident </literal> ident lookup
4833 <literal>interface </literal> lists of local interfaces
4834 <literal>lists </literal> matching things in lists
4835 <literal>load </literal> system load checks
4836 <literal>local_scan </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
4837 <literal>lookup </literal> general lookup code and all lookups
4838 <literal>memory </literal> memory handling
4839 <literal>pid </literal> add pid to debug output lines
4840 <literal>process_info </literal> setting info for the process log
4841 <literal>queue_run </literal> queue runs
4842 <literal>receive </literal> general message reception logic
4843 <literal>resolver </literal> turn on the DNS resolver’s debugging output
4844 <literal>retry </literal> retry handling
4845 <literal>rewrite </literal> address rewriting
4846 <literal>route </literal> address routing
4847 <literal>timestamp </literal> add timestamp to debug output lines
4848 <literal>tls </literal> TLS logic
4849 <literal>transport </literal> transports
4850 <literal>uid </literal> changes of uid/gid and looking up uid/gid
4851 <literal>verify </literal> address verification logic
4852 <literal>all </literal> almost all of the above (see below), and also <option>-v</option>
4855 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
4856 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
4857 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
4858 is included, an awful lot of output that is very rarely of interest is
4859 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
4860 turn everything off.
4863 <indexterm role="concept">
4864 <primary>resolver</primary>
4865 <secondary>debugging output</secondary>
4867 <indexterm role="concept">
4868 <primary>DNS resolver</primary>
4869 <secondary>debugging output</secondary>
4871 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
4872 with DEBUG enabled. This is not the case in some operating systems. Also,
4873 unfortunately, debugging output from the DNS resolver is written to stdout
4877 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
4878 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
4879 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
4880 daemon, which then passes it on to any re-executed Exims. Exim also
4881 automatically adds the pid to debug lines when several remote deliveries are
4885 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
4886 of all debug output lines. This can be useful when trying to track down delays
4890 If the <option>debug_print</option> option is set in any driver, it produces output whenever
4891 any debugging is selected, or if <option>-v</option> is used.
4893 </listitem></varlistentry>
4895 <term><option>-dd</option><<emphasis>debug options</emphasis>></term>
4898 <indexterm role="option">
4899 <primary><option>-dd</option></primary>
4901 This option behaves exactly like <option>-d</option> except when used on a command that
4902 starts a daemon process. In that case, debugging is turned off for the
4903 subprocesses that the daemon creates. Thus, it is useful for monitoring the
4904 behaviour of the daemon without creating as much output as full debugging does.
4906 </listitem></varlistentry>
4908 <term><option>-dropcr</option></term>
4911 <indexterm role="option">
4912 <primary><option>-dropcr</option></primary>
4914 This is an obsolete option that is now a no-op. It used to affect the way Exim
4915 handled CR and LF characters in incoming messages. What happens now is
4916 described in section <xref linkend="SECTlineendings"/>.
4918 </listitem></varlistentry>
4920 <term><option>-E</option></term>
4923 <indexterm role="option">
4924 <primary><option>-E</option></primary>
4926 <indexterm role="concept">
4927 <primary>bounce message</primary>
4928 <secondary>generating</secondary>
4930 This option specifies that an incoming message is a locally-generated delivery
4931 failure report. It is used internally by Exim when handling delivery failures
4932 and is not intended for external use. Its only effect is to stop Exim
4933 generating certain messages to the postmaster, as otherwise message cascades
4934 could occur in some situations. As part of the same option, a message id may
4935 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
4936 new message contains the id, following <quote>R=</quote>, as a cross-reference.
4938 </listitem></varlistentry>
4940 <term><option>-e</option><emphasis>x</emphasis></term>
4943 <indexterm role="option">
4944 <primary><option>-e</option><emphasis>x</emphasis></primary>
4946 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
4947 called by various programs without the leading <option>o</option> in the option. For
4948 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
4949 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
4951 </listitem></varlistentry>
4953 <term><option>-F</option> <<emphasis>string</emphasis>></term>
4956 <indexterm role="option">
4957 <primary><option>-F</option></primary>
4959 <indexterm role="concept">
4960 <primary>sender</primary>
4961 <secondary>name</secondary>
4963 <indexterm role="concept">
4964 <primary>name</primary>
4965 <secondary>of sender</secondary>
4967 This option sets the sender’s full name for use when a locally-generated
4968 message is being accepted. In the absence of this option, the user’s <emphasis>gecos</emphasis>
4969 entry from the password data is used. As users are generally permitted to alter
4970 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
4971 between <option>-F</option> and the <<emphasis>string</emphasis>> is optional.
4973 </listitem></varlistentry>
4975 <term><option>-f</option> <<emphasis>address</emphasis>></term>
4978 <indexterm role="option">
4979 <primary><option>-f</option></primary>
4981 <indexterm role="concept">
4982 <primary>sender</primary>
4983 <secondary>address</secondary>
4985 <indexterm role="concept">
4986 <primary>address</primary>
4987 <secondary>sender</secondary>
4989 <indexterm role="concept">
4990 <primary>trusted user</primary>
4992 <indexterm role="concept">
4993 <primary>envelope sender</primary>
4995 <indexterm role="concept">
4996 <primary>user</primary>
4997 <secondary>trusted</secondary>
4999 This option sets the address of the envelope sender of a locally-generated
5000 message (also known as the return path). The option can normally be used only
5001 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5005 Processes running as root or the Exim user are always trusted. Other
5006 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5007 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5008 of a local message is set to the caller’s login name at the default qualify
5012 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5013 can be specified by any user, trusted or not, to create a message that can
5014 never provoke a bounce. An empty sender can be specified either as an empty
5015 string, or as a pair of angle brackets with nothing between them, as in these
5016 examples of shell commands:
5018 <literallayout class="monospaced">
5019 exim -f '<>' user@domain
5020 exim -f "" user@domain
5023 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5024 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5025 <option>-bv</option> options.
5028 Allowing untrusted users to change the sender address does not of itself make
5029 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5030 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5031 though this can be overridden by setting <option>no_local_from_check</option>.
5035 <indexterm role="concept">
5036 <primary><quote>From</quote> line</primary>
5038 space between <option>-f</option> and the <<emphasis>address</emphasis>> is optional (that is, they can be
5039 given as two arguments or one combined argument). The sender of a
5040 locally-generated message can also be set (when permitted) by an initial
5041 <quote>From </quote> line in the message – see the description of <option>-bm</option> above – but
5042 if <option>-f</option> is also present, it overrides <quote>From </quote>.
5044 </listitem></varlistentry>
5046 <term><option>-G</option></term>
5049 <indexterm role="option">
5050 <primary><option>-G</option></primary>
5052 <indexterm role="concept">
5053 <primary>Sendmail compatibility</primary>
5054 <secondary><option>-G</option> option ignored</secondary>
5056 This is a Sendmail option which is ignored by Exim.
5058 </listitem></varlistentry>
5060 <term><option>-h</option> <<emphasis>number</emphasis>></term>
5063 <indexterm role="option">
5064 <primary><option>-h</option></primary>
5066 <indexterm role="concept">
5067 <primary>Sendmail compatibility</primary>
5068 <secondary><option>-h</option> option ignored</secondary>
5070 This option is accepted for compatibility with Sendmail, but has no effect. (In
5071 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5074 </listitem></varlistentry>
5076 <term><option>-i</option></term>
5079 <indexterm role="option">
5080 <primary><option>-i</option></primary>
5082 <indexterm role="concept">
5083 <primary>Solaris</primary>
5084 <secondary><emphasis>mail</emphasis> command</secondary>
5086 <indexterm role="concept">
5087 <primary>dot in incoming</primary>
5088 <secondary>non-SMTP message</secondary>
5090 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5091 line by itself should not terminate an incoming, non-SMTP message. I can find
5092 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5093 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5095 </listitem></varlistentry>
5097 <term><option>-M</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5100 <indexterm role="option">
5101 <primary><option>-M</option></primary>
5103 <indexterm role="concept">
5104 <primary>forcing delivery</primary>
5106 <indexterm role="concept">
5107 <primary>delivery</primary>
5108 <secondary>forcing attempt</secondary>
5110 <indexterm role="concept">
5111 <primary>frozen messages</primary>
5112 <secondary>forcing delivery</secondary>
5114 This option requests Exim to run a delivery attempt on each message in turn. If
5115 any of the messages are frozen, they are automatically thawed before the
5116 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5117 and <option>hold_domains</option> are ignored.
5121 <indexterm role="concept">
5122 <primary>hints database</primary>
5123 <secondary>overriding retry hints</secondary>
5125 hints for any of the addresses are overridden – Exim tries to deliver even if
5126 the normal retry time has not yet been reached. This option requires the caller
5127 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5128 which can be set false to relax this restriction (and also the same requirement
5129 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5132 The deliveries happen synchronously, that is, the original Exim process does
5133 not terminate until all the delivery attempts have finished. No output is
5134 produced unless there is a serious error. If you want to see what is happening,
5135 use the <option>-v</option> option as well, or inspect Exim’s main log.
5137 </listitem></varlistentry>
5139 <term><option>-Mar</option> <<emphasis>message id</emphasis>> <<emphasis>address</emphasis>> <<emphasis>address</emphasis>> ...</term>
5142 <indexterm role="option">
5143 <primary><option>-Mar</option></primary>
5145 <indexterm role="concept">
5146 <primary>message</primary>
5147 <secondary>adding recipients</secondary>
5149 <indexterm role="concept">
5150 <primary>recipient</primary>
5151 <secondary>adding</secondary>
5153 This option requests Exim to add the addresses to the list of recipients of the
5154 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5155 id, and the remaining ones must be email addresses. However, if the message is
5156 active (in the middle of a delivery attempt), it is not altered. This option
5157 can be used only by an admin user.
5159 </listitem></varlistentry>
5161 <term><option>-MC</option> <<emphasis>transport</emphasis>> <<emphasis>hostname</emphasis>> <<emphasis>sequence number</emphasis>> <<emphasis>message id</emphasis>></term>
5164 <indexterm role="option">
5165 <primary><option>-MC</option></primary>
5167 <indexterm role="concept">
5168 <primary>SMTP</primary>
5169 <secondary>passed connection</secondary>
5171 <indexterm role="concept">
5172 <primary>SMTP</primary>
5173 <secondary>multiple deliveries</secondary>
5175 <indexterm role="concept">
5176 <primary>multiple SMTP deliveries</primary>
5178 This option is not intended for use by external callers. It is used internally
5179 by Exim to invoke another instance of itself to deliver a waiting message using
5180 an existing SMTP connection, which is passed as the standard input. Details are
5181 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5182 must be root or the Exim user in order to use it.
5184 </listitem></varlistentry>
5186 <term><option>-MCA</option></term>
5189 <indexterm role="option">
5190 <primary><option>-MCA</option></primary>
5192 This option is not intended for use by external callers. It is used internally
5193 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5194 connection to the remote host has been authenticated.
5196 </listitem></varlistentry>
5198 <term><option>-MCP</option></term>
5201 <indexterm role="option">
5202 <primary><option>-MCP</option></primary>
5204 This option is not intended for use by external callers. It is used internally
5205 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5206 which Exim is connected supports pipelining.
5208 </listitem></varlistentry>
5210 <term><option>-MCQ</option> <<emphasis>process id</emphasis>> <<emphasis>pipe fd</emphasis>></term>
5213 <indexterm role="option">
5214 <primary><option>-MCQ</option></primary>
5216 This option is not intended for use by external callers. It is used internally
5217 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5218 started by a queue runner. It passes on the process id of the queue runner,
5219 together with the file descriptor number of an open pipe. Closure of the pipe
5220 signals the final completion of the sequence of processes that are passing
5221 messages through the same SMTP connection.
5223 </listitem></varlistentry>
5225 <term><option>-MCS</option></term>
5228 <indexterm role="option">
5229 <primary><option>-MCS</option></primary>
5231 This option is not intended for use by external callers. It is used internally
5232 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5233 SMTP SIZE option should be used on messages delivered down the existing
5236 </listitem></varlistentry>
5238 <term><option>-MCT</option></term>
5241 <indexterm role="option">
5242 <primary><option>-MCT</option></primary>
5244 This option is not intended for use by external callers. It is used internally
5245 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5246 host to which Exim is connected supports TLS encryption.
5248 </listitem></varlistentry>
5250 <term><option>-Mc</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5253 <indexterm role="option">
5254 <primary><option>-Mc</option></primary>
5256 <indexterm role="concept">
5257 <primary>hints database</primary>
5258 <secondary>not overridden by <option>-Mc</option></secondary>
5260 <indexterm role="concept">
5261 <primary>delivery</primary>
5262 <secondary>manually started – not forced</secondary>
5264 This option requests Exim to run a delivery attempt on each message in turn,
5265 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5266 that are found. This option is not very useful to external callers. It is
5267 provided mainly for internal use by Exim when it needs to re-invoke itself in
5268 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5269 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5270 respects retry times and other options such as <option>hold_domains</option> that are
5271 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5272 If you want to run a specific delivery as if in a queue run, you should use
5273 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5274 and other deliveries is made in one or two places.
5276 </listitem></varlistentry>
5278 <term><option>-Mes</option> <<emphasis>message id</emphasis>> <<emphasis>address</emphasis>></term>
5281 <indexterm role="option">
5282 <primary><option>-Mes</option></primary>
5284 <indexterm role="concept">
5285 <primary>message</primary>
5286 <secondary>changing sender</secondary>
5288 <indexterm role="concept">
5289 <primary>sender</primary>
5290 <secondary>changing</secondary>
5292 This option requests Exim to change the sender address in the message to the
5293 given address, which must be a fully qualified address or <quote><></quote> (<quote>es</quote> for
5294 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5295 be a message id, and the second one an email address. However, if the message
5296 is active (in the middle of a delivery attempt), its status is not altered.
5297 This option can be used only by an admin user.
5299 </listitem></varlistentry>
5301 <term><option>-Mf</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5304 <indexterm role="option">
5305 <primary><option>-Mf</option></primary>
5307 <indexterm role="concept">
5308 <primary>freezing messages</primary>
5310 <indexterm role="concept">
5311 <primary>message</primary>
5312 <secondary>manually freezing</secondary>
5314 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5315 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5316 either manually or as a result of the <option>auto_thaw</option> configuration option.
5317 However, if any of the messages are active (in the middle of a delivery
5318 attempt), their status is not altered. This option can be used only by an admin
5321 </listitem></varlistentry>
5323 <term><option>-Mg</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5326 <indexterm role="option">
5327 <primary><option>-Mg</option></primary>
5329 <indexterm role="concept">
5330 <primary>giving up on messages</primary>
5332 <indexterm role="concept">
5333 <primary>message</primary>
5334 <secondary>abandoning delivery attempts</secondary>
5336 <indexterm role="concept">
5337 <primary>delivery</primary>
5338 <secondary>abandoning further attempts</secondary>
5340 This option requests Exim to give up trying to deliver the listed messages,
5341 including any that are frozen. However, if any of the messages are active,
5342 their status is not altered. For non-bounce messages, a delivery error message
5343 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5344 Bounce messages are just discarded. This option can be used only by an admin
5347 </listitem></varlistentry>
5349 <term><option>-Mmad</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5352 <indexterm role="option">
5353 <primary><option>-Mmad</option></primary>
5355 <indexterm role="concept">
5356 <primary>delivery</primary>
5357 <secondary>cancelling all</secondary>
5359 This option requests Exim to mark all the recipient addresses in the messages
5360 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5361 message is active (in the middle of a delivery attempt), its status is not
5362 altered. This option can be used only by an admin user.
5364 </listitem></varlistentry>
5366 <term><option>-Mmd</option> <<emphasis>message id</emphasis>> <<emphasis>address</emphasis>> <<emphasis>address</emphasis>> ...</term>
5369 <indexterm role="option">
5370 <primary><option>-Mmd</option></primary>
5372 <indexterm role="concept">
5373 <primary>delivery</primary>
5374 <secondary>cancelling by address</secondary>
5376 <indexterm role="concept">
5377 <primary>recipient</primary>
5378 <secondary>removing</secondary>
5380 <indexterm role="concept">
5381 <primary>removing recipients</primary>
5383 This option requests Exim to mark the given addresses as already delivered
5384 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5385 the remaining ones must be email addresses. These are matched to recipient
5386 addresses in the message in a case-sensitive manner. If the message is active
5387 (in the middle of a delivery attempt), its status is not altered. This option
5388 can be used only by an admin user.
5390 </listitem></varlistentry>
5392 <term><option>-Mrm</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5395 <indexterm role="option">
5396 <primary><option>-Mrm</option></primary>
5398 <indexterm role="concept">
5399 <primary>removing messages</primary>
5401 <indexterm role="concept">
5402 <primary>abandoning mail</primary>
5404 <indexterm role="concept">
5405 <primary>message</primary>
5406 <secondary>manually discarding</secondary>
5408 This option requests Exim to remove the given messages from the queue. No
5409 bounce messages are sent; each message is simply forgotten. However, if any of
5410 the messages are active, their status is not altered. This option can be used
5411 only by an admin user or by the user who originally caused the message to be
5412 placed on the queue.
5414 </listitem></varlistentry>
5416 <term><option>-Mt</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5419 <indexterm role="option">
5420 <primary><option>-Mt</option></primary>
5422 <indexterm role="concept">
5423 <primary>thawing messages</primary>
5425 <indexterm role="concept">
5426 <primary>unfreezing messages</primary>
5428 <indexterm role="concept">
5429 <primary>frozen messages</primary>
5430 <secondary>thawing</secondary>
5432 <indexterm role="concept">
5433 <primary>message</primary>
5434 <secondary>thawing frozen</secondary>
5436 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5437 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5438 messages are active, their status is not altered. This option can be used only
5441 </listitem></varlistentry>
5443 <term><option>-Mvb</option> <<emphasis>message id</emphasis>></term>
5446 <indexterm role="option">
5447 <primary><option>-Mvb</option></primary>
5449 <indexterm role="concept">
5450 <primary>listing</primary>
5451 <secondary>message body</secondary>
5453 <indexterm role="concept">
5454 <primary>message</primary>
5455 <secondary>listing body of</secondary>
5457 This option causes the contents of the message body (-D) spool file to be
5458 written to the standard output. This option can be used only by an admin user.
5460 </listitem></varlistentry>
5462 <term><option>-Mvh</option> <<emphasis>message id</emphasis>></term>
5465 <indexterm role="option">
5466 <primary><option>-Mvh</option></primary>
5468 <indexterm role="concept">
5469 <primary>listing</primary>
5470 <secondary>message headers</secondary>
5472 <indexterm role="concept">
5473 <primary>header lines</primary>
5474 <secondary>listing</secondary>
5476 <indexterm role="concept">
5477 <primary>message</primary>
5478 <secondary>listing header lines</secondary>
5480 This option causes the contents of the message headers (-H) spool file to be
5481 written to the standard output. This option can be used only by an admin user.
5483 </listitem></varlistentry>
5485 <term><option>-Mvl</option> <<emphasis>message id</emphasis>></term>
5488 <indexterm role="option">
5489 <primary><option>-Mvl</option></primary>
5491 <indexterm role="concept">
5492 <primary>listing</primary>
5493 <secondary>message log</secondary>
5495 <indexterm role="concept">
5496 <primary>message</primary>
5497 <secondary>listing message log</secondary>
5499 This option causes the contents of the message log spool file to be written to
5500 the standard output. This option can be used only by an admin user.
5502 </listitem></varlistentry>
5504 <term><option>-m</option></term>
5507 <indexterm role="option">
5508 <primary><option>-m</option></primary>
5510 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
5511 treats it that way too.
5513 </listitem></varlistentry>
5515 <term><option>-N</option></term>
5518 <indexterm role="option">
5519 <primary><option>-N</option></primary>
5521 <indexterm role="concept">
5522 <primary>debugging</primary>
5523 <secondary><option>-N</option> option</secondary>
5525 <indexterm role="concept">
5526 <primary>debugging</primary>
5527 <secondary>suppressing delivery</secondary>
5529 This is a debugging option that inhibits delivery of a message at the transport
5530 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery –
5531 it just doesn’t actually transport the message, but instead behaves as if it
5532 had successfully done so. However, it does not make any updates to the retry
5533 database, and the log entries for deliveries are flagged with <quote>*></quote> rather
5534 than <quote>=></quote>.
5537 Because <option>-N</option> discards any message to which it applies, only root or the Exim
5538 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
5539 words, an ordinary user can use it only when supplying an incoming message to
5540 which it will apply. Although transportation never fails when <option>-N</option> is set, an
5541 address may be deferred because of a configuration problem on a transport, or a
5542 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
5543 the message, and applies to any subsequent delivery attempts that may happen
5546 </listitem></varlistentry>
5548 <term><option>-n</option></term>
5551 <indexterm role="option">
5552 <primary><option>-n</option></primary>
5554 <indexterm role="concept">
5555 <primary>Sendmail compatibility</primary>
5556 <secondary><option>-n</option> option ignored</secondary>
5558 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>. It is ignored
5561 </listitem></varlistentry>
5563 <term><option>-O</option> <<emphasis>data</emphasis>></term>
5566 <indexterm role="option">
5567 <primary><option>-O</option></primary>
5569 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
5572 </listitem></varlistentry>
5574 <term><option>-oA</option> <<emphasis>file name</emphasis>></term>
5577 <indexterm role="option">
5578 <primary><option>-oA</option></primary>
5580 <indexterm role="concept">
5581 <primary>Sendmail compatibility</primary>
5582 <secondary><option>-oA</option> option</secondary>
5584 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
5585 alternative alias file name. Exim handles <option>-bi</option> differently; see the
5588 </listitem></varlistentry>
5590 <term><option>-oB</option> <<emphasis>n</emphasis>></term>
5593 <indexterm role="option">
5594 <primary><option>-oB</option></primary>
5596 <indexterm role="concept">
5597 <primary>SMTP</primary>
5598 <secondary>passed connection</secondary>
5600 <indexterm role="concept">
5601 <primary>SMTP</primary>
5602 <secondary>multiple deliveries</secondary>
5604 <indexterm role="concept">
5605 <primary>multiple SMTP deliveries</primary>
5607 This is a debugging option which limits the maximum number of messages that can
5608 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
5609 transport. If <<emphasis>n</emphasis>> is omitted, the limit is set to 1.
5611 </listitem></varlistentry>
5613 <term><option>-odb</option></term>
5616 <indexterm role="option">
5617 <primary><option>-odb</option></primary>
5619 <indexterm role="concept">
5620 <primary>background delivery</primary>
5622 <indexterm role="concept">
5623 <primary>delivery</primary>
5624 <secondary>in the background</secondary>
5626 This option applies to all modes in which Exim accepts incoming messages,
5627 including the listening daemon. It requests <quote>background</quote> delivery of such
5628 messages, which means that the accepting process automatically starts a
5629 delivery process for each message received, but does not wait for the delivery
5630 processes to finish.
5633 When all the messages have been received, the reception process exits,
5634 leaving the delivery processes to finish in their own time. The standard output
5635 and error streams are closed at the start of each delivery process.
5636 This is the default action if none of the <option>-od</option> options are present.
5639 If one of the queueing options in the configuration file
5640 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
5641 overrides it if <option>queue_only_override</option> is set true, which is the default
5642 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
5644 </listitem></varlistentry>
5646 <term><option>-odf</option></term>
5649 <indexterm role="option">
5650 <primary><option>-odf</option></primary>
5652 <indexterm role="concept">
5653 <primary>foreground delivery</primary>
5655 <indexterm role="concept">
5656 <primary>delivery</primary>
5657 <secondary>in the foreground</secondary>
5659 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
5660 accepted a locally-generated message. (For the daemon it is exactly the same as
5661 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
5662 and Exim waits for it to complete before proceeding.
5665 The original Exim reception process does not finish until the delivery
5666 process for the final message has ended. The standard error stream is left open
5670 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
5671 false and one of the queueing options in the configuration file is in effect.
5674 If there is a temporary delivery error during foreground delivery, the
5675 message is left on the queue for later delivery, and the original reception
5676 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
5677 restricted configuration that never queues messages.
5679 </listitem></varlistentry>
5681 <term><option>-odi</option></term>
5684 <indexterm role="option">
5685 <primary><option>-odi</option></primary>
5687 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
5690 </listitem></varlistentry>
5692 <term><option>-odq</option></term>
5695 <indexterm role="option">
5696 <primary><option>-odq</option></primary>
5698 <indexterm role="concept">
5699 <primary>non-immediate delivery</primary>
5701 <indexterm role="concept">
5702 <primary>delivery</primary>
5703 <secondary>suppressing immediate</secondary>
5705 <indexterm role="concept">
5706 <primary>queueing incoming messages</primary>
5708 This option applies to all modes in which Exim accepts incoming messages,
5709 including the listening daemon. It specifies that the accepting process should
5710 not automatically start a delivery process for each message received. Messages
5711 are placed on the queue, and remain there until a subsequent queue runner
5712 process encounters them. There are several configuration options (such as
5713 <option>queue_only</option>) that can be used to queue incoming messages under certain
5714 conditions. This option overrides all of them and also <option>-odqs</option>. It always
5717 </listitem></varlistentry>
5719 <term><option>-odqs</option></term>
5722 <indexterm role="option">
5723 <primary><option>-odqs</option></primary>
5725 <indexterm role="concept">
5726 <primary>SMTP</primary>
5727 <secondary>delaying delivery</secondary>
5729 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
5730 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
5731 <option>queue_only_override</option> is false and one of the queueing options in the
5732 configuration file is in effect.
5735 When <option>-odqs</option> does operate, a delivery process is started for each incoming
5736 message, in the background by default, but in the foreground if <option>-odi</option> is
5737 also present. The recipient addresses are routed, and local deliveries are done
5738 in the normal way. However, if any SMTP deliveries are required, they are not
5739 done at this time, so the message remains on the queue until a subsequent queue
5740 runner process encounters it. Because routing was done, Exim knows which
5741 messages are waiting for which hosts, and so a number of messages for the same
5742 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
5743 configuration option has the same effect for specific domains. See also the
5744 <option>-qq</option> option.
5746 </listitem></varlistentry>
5748 <term><option>-oee</option></term>
5751 <indexterm role="option">
5752 <primary><option>-oee</option></primary>
5754 <indexterm role="concept">
5755 <primary>error</primary>
5756 <secondary>reporting</secondary>
5758 If an error is detected while a non-SMTP message is being received (for
5759 example, a malformed address), the error is reported to the sender in a mail
5763 <indexterm role="concept">
5764 <primary>return code</primary>
5765 <secondary>for <option>-oee</option></secondary>
5768 this error message is successfully sent, the Exim receiving process
5769 exits with a return code of zero. If not, the return code is 2 if the problem
5770 is that the original message has no recipients, or 1 any other error. This is
5771 the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
5773 </listitem></varlistentry>
5775 <term><option>-oem</option></term>
5778 <indexterm role="option">
5779 <primary><option>-oem</option></primary>
5781 <indexterm role="concept">
5782 <primary>error</primary>
5783 <secondary>reporting</secondary>
5785 <indexterm role="concept">
5786 <primary>return code</primary>
5787 <secondary>for <option>-oem</option></secondary>
5789 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
5790 return code, whether or not the error message was successfully sent.
5791 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
5793 </listitem></varlistentry>
5795 <term><option>-oep</option></term>
5798 <indexterm role="option">
5799 <primary><option>-oep</option></primary>
5801 <indexterm role="concept">
5802 <primary>error</primary>
5803 <secondary>reporting</secondary>
5805 If an error is detected while a non-SMTP message is being received, the
5806 error is reported by writing a message to the standard error file (stderr).
5807 <indexterm role="concept">
5808 <primary>return code</primary>
5809 <secondary>for <option>-oep</option></secondary>
5811 The return code is 1 for all errors.
5813 </listitem></varlistentry>
5815 <term><option>-oeq</option></term>
5818 <indexterm role="option">
5819 <primary><option>-oeq</option></primary>
5821 <indexterm role="concept">
5822 <primary>error</primary>
5823 <secondary>reporting</secondary>
5825 This option is supported for compatibility with Sendmail, but has the same
5826 effect as <option>-oep</option>.
5828 </listitem></varlistentry>
5830 <term><option>-oew</option></term>
5833 <indexterm role="option">
5834 <primary><option>-oew</option></primary>
5836 <indexterm role="concept">
5837 <primary>error</primary>
5838 <secondary>reporting</secondary>
5840 This option is supported for compatibility with Sendmail, but has the same
5841 effect as <option>-oem</option>.
5843 </listitem></varlistentry>
5845 <term><option>-oi</option></term>
5848 <indexterm role="option">
5849 <primary><option>-oi</option></primary>
5851 <indexterm role="concept">
5852 <primary>dot in incoming</primary>
5853 <secondary>non-SMTP message</secondary>
5855 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
5856 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
5857 single dot does terminate, though Exim does no special processing for other
5858 lines that start with a dot. This option is set by default if Exim is called as
5859 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
5861 </listitem></varlistentry>
5863 <term><option>-oitrue</option></term>
5866 <indexterm role="option">
5867 <primary><option>-oitrue</option></primary>
5869 This option is treated as synonymous with <option>-oi</option>.
5871 </listitem></varlistentry>
5873 <term><option>-oMa</option> <<emphasis>host address</emphasis>></term>
5876 <indexterm role="option">
5877 <primary><option>-oMa</option></primary>
5879 <indexterm role="concept">
5880 <primary>sender host address</primary>
5881 <secondary>specifying for local message</secondary>
5883 A number of options starting with <option>-oM</option> can be used to set values associated
5884 with remote hosts on locally-submitted messages (that is, messages not received
5885 over TCP/IP). These options can be used by any caller in conjunction with the
5886 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
5887 other circumstances, they are ignored unless the caller is trusted.
5890 The <option>-oMa</option> option sets the sender host address. This may include a port
5891 number at the end, after a full stop (period). For example:
5893 <literallayout class="monospaced">
5894 exim -bs -oMa 10.9.8.7.1234
5897 An alternative syntax is to enclose the IP address in square brackets,
5898 followed by a colon and the port number:
5900 <literallayout class="monospaced">
5901 exim -bs -oMa [10.9.8.7]:1234
5904 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
5905 port, if present, in <varname>$sender_host_port</varname>. <phrase revisionflag="changed">If both <option>-oMa</option> and <option>-bh</option>
5906 are present on the command line, the sender host IP address is taken from
5907 whichever one is last.</phrase>
5909 </listitem></varlistentry>
5911 <term><option>-oMaa</option> <<emphasis>name</emphasis>></term>
5914 <indexterm role="option">
5915 <primary><option>-oMaa</option></primary>
5917 <indexterm role="concept">
5918 <primary>authentication name</primary>
5919 <secondary>specifying for local message</secondary>
5921 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
5922 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
5923 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
5924 <phrase revisionflag="changed">This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
5925 authenticated SMTP session without actually using the SMTP AUTH command.</phrase>
5927 </listitem></varlistentry>
5929 <term><option>-oMai</option> <<emphasis>string</emphasis>></term>
5932 <indexterm role="option">
5933 <primary><option>-oMai</option></primary>
5935 <indexterm role="concept">
5936 <primary>authentication id</primary>
5937 <secondary>specifying for local message</secondary>
5940 <para revisionflag="changed">
5941 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
5942 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
5943 This overrides the default value (the caller’s login id, except with <option>-bh</option>,
5944 where there is no default) for messages from local sources. See chapter
5945 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
5947 </listitem></varlistentry>
5949 <term><option>-oMas</option> <<emphasis>address</emphasis>></term>
5952 <indexterm role="option">
5953 <primary><option>-oMas</option></primary>
5955 <indexterm role="concept">
5956 <primary>authentication sender</primary>
5957 <secondary>specifying for local message</secondary>
5960 <para revisionflag="changed">
5961 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
5962 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
5963 overrides the sender address that is created from the caller’s login id for
5964 messages from local sources, except when <option>-bh</option> is used, when there is no
5965 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
5966 specified on a MAIL command overrides this value. See chapter
5967 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
5969 </listitem></varlistentry>
5971 <term><option>-oMi</option> <<emphasis>interface address</emphasis>></term>
5974 <indexterm role="option">
5975 <primary><option>-oMi</option></primary>
5977 <indexterm role="concept">
5978 <primary>interface address</primary>
5979 <secondary>specifying for local message</secondary>
5981 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
5982 option sets the IP interface address value. A port number may be included,
5983 using the same syntax as for <option>-oMa</option>. The interface address is placed in
5984 <varname>$interface_address</varname> and the port number, if present, in <varname>$interface_port</varname>.
5986 </listitem></varlistentry>
5988 <term><option>-oMr</option> <<emphasis>protocol name</emphasis>></term>
5991 <indexterm role="option">
5992 <primary><option>-oMr</option></primary>
5994 <indexterm role="concept">
5995 <primary>protocol</primary>
5996 <secondary>incoming – specifying for local message</secondary>
5998 <indexterm role="concept">
5999 <primary><varname>$received_protocol</varname></primary>
6002 <para revisionflag="changed">
6003 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6004 option sets the received protocol value that is stored in
6005 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6006 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6007 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6008 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6009 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6010 be set by <option>-oMr</option>.
6012 </listitem></varlistentry>
6014 <term><option>-oMs</option> <<emphasis>host name</emphasis>></term>
6017 <indexterm role="option">
6018 <primary><option>-oMs</option></primary>
6020 <indexterm role="concept">
6021 <primary>sender host name</primary>
6022 <secondary>specifying for local message</secondary>
6024 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6025 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6026 present, Exim does not attempt to look up a host name from an IP address; it
6027 uses the name it is given.
6029 </listitem></varlistentry>
6031 <term><option>-oMt</option> <<emphasis>ident string</emphasis>></term>
6034 <indexterm role="option">
6035 <primary><option>-oMt</option></primary>
6037 <indexterm role="concept">
6038 <primary>sender ident string</primary>
6039 <secondary>specifying for local message</secondary>
6042 <para revisionflag="changed">
6043 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6044 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6045 local callers is the login id of the calling process, except when <option>-bh</option> is
6046 used, when there is no default.
6048 </listitem></varlistentry>
6050 <term><option>-om</option></term>
6053 <indexterm role="option">
6054 <primary><option>-om</option></primary>
6056 <indexterm role="concept">
6057 <primary>Sendmail compatibility</primary>
6058 <secondary><option>-om</option> option ignored</secondary>
6060 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6061 message should receive a copy of the message if the sender appears in an alias
6062 expansion. Exim always does this, so the option does nothing.
6064 </listitem></varlistentry>
6066 <term><option>-oo</option></term>
6069 <indexterm role="option">
6070 <primary><option>-oo</option></primary>
6072 <indexterm role="concept">
6073 <primary>Sendmail compatibility</primary>
6074 <secondary><option>-oo</option> option ignored</secondary>
6076 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6077 whatever that means.
6079 </listitem></varlistentry>
6081 <term><option>-oP</option> <<emphasis>path</emphasis>></term>
6084 <indexterm role="option">
6085 <primary><option>-oP</option></primary>
6087 <indexterm role="concept">
6088 <primary>pid (process id)</primary>
6089 <secondary>of daemon</secondary>
6091 <indexterm role="concept">
6092 <primary>daemon</primary>
6093 <secondary>process id (pid)</secondary>
6095 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6096 value. The option specifies the file to which the process id of the daemon is
6097 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6098 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6099 because in those cases, the normal pid file is not used.
6101 </listitem></varlistentry>
6103 <term><option>-or</option> <<emphasis>time</emphasis>></term>
6106 <indexterm role="option">
6107 <primary><option>-or</option></primary>
6109 <indexterm role="concept">
6110 <primary>timeout</primary>
6111 <secondary>for non-SMTP input</secondary>
6113 This option sets a timeout value for incoming non-SMTP messages. If it is not
6114 set, Exim will wait forever for the standard input. The value can also be set
6115 by the <option>receive_timeout</option> option. The format used for specifying times is
6116 described in section <xref linkend="SECTtimeformat"/>.
6118 </listitem></varlistentry>
6120 <term><option>-os</option> <<emphasis>time</emphasis>></term>
6123 <indexterm role="option">
6124 <primary><option>-os</option></primary>
6126 <indexterm role="concept">
6127 <primary>timeout</primary>
6128 <secondary>for SMTP input</secondary>
6130 <indexterm role="concept">
6131 <primary>SMTP timeout</primary>
6132 <secondary>input</secondary>
6134 This option sets a timeout value for incoming SMTP messages. The timeout
6135 applies to each SMTP command and block of data. The value can also be set by
6136 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6137 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6139 </listitem></varlistentry>
6141 <term><option>-ov</option></term>
6144 <indexterm role="option">
6145 <primary><option>-ov</option></primary>
6147 This option has exactly the same effect as <option>-v</option>.
6149 </listitem></varlistentry>
6151 <term><option>-oX</option> <<emphasis>number or string</emphasis>></term>
6154 <indexterm role="option">
6155 <primary><option>-oX</option></primary>
6157 <indexterm role="concept">
6158 <primary>TCP/IP</primary>
6159 <secondary>setting listening ports</secondary>
6161 <indexterm role="concept">
6162 <primary>TCP/IP</primary>
6163 <secondary>setting listening interfaces</secondary>
6165 <indexterm role="concept">
6166 <primary>port</primary>
6167 <secondary>receiving TCP/IP</secondary>
6169 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6170 is also given. It controls which ports and interfaces the daemon uses. Details
6171 of the syntax, and how it interacts with configuration file options, are given
6172 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6173 file is written unless <option>-oP</option> is also present to specify a pid file name.
6175 </listitem></varlistentry>
6177 <term><option>-pd</option></term>
6180 <indexterm role="option">
6181 <primary><option>-pd</option></primary>
6183 <indexterm role="concept">
6184 <primary>Perl</primary>
6185 <secondary>starting the interpreter</secondary>
6187 This option applies when an embedded Perl interpreter is linked with Exim (see
6188 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6189 option, forcing the starting of the interpreter to be delayed until it is
6192 </listitem></varlistentry>
6194 <term><option>-ps</option></term>
6197 <indexterm role="option">
6198 <primary><option>-ps</option></primary>
6200 <indexterm role="concept">
6201 <primary>Perl</primary>
6202 <secondary>starting the interpreter</secondary>
6204 This option applies when an embedded Perl interpreter is linked with Exim (see
6205 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6206 option, forcing the starting of the interpreter to occur as soon as Exim is
6209 </listitem></varlistentry>
6211 <term><option>-p</option><<emphasis>rval</emphasis>>:<<emphasis>sval</emphasis>></term>
6214 <indexterm role="option">
6215 <primary><option>-p</option></primary>
6217 For compatibility with Sendmail, this option is equivalent to
6220 <literal>-oMr</literal> <<emphasis>rval</emphasis>> <literal>-oMs</literal> <<emphasis>sval</emphasis>>
6223 It sets the incoming protocol and host name (for trusted callers). The
6224 host name and its colon can be omitted when only the protocol is to be set.
6225 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6226 to embedded Perl. It is therefore impossible to set a protocol value of <literal>p</literal>
6227 or <literal>s</literal> using this option (but that does not seem a real limitation).
6229 </listitem></varlistentry>
6231 <term><option>-q</option></term>
6234 <indexterm role="option">
6235 <primary><option>-q</option></primary>
6237 <indexterm role="concept">
6238 <primary>queue runner</primary>
6239 <secondary>starting manually</secondary>
6241 This option is normally restricted to admin users. However, there is a
6242 configuration option called <option>prod_requires_admin</option> which can be set false to
6243 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6244 and <option>-S</option> options).
6247 <indexterm role="concept">
6248 <primary>queue runner</primary>
6249 <secondary>description of operation</secondary>
6251 The <option>-q</option> option starts one queue runner process. This scans the queue of
6252 waiting messages, and runs a delivery process for each one in turn. It waits
6253 for each delivery process to finish before starting the next one. A delivery
6254 process may not actually do any deliveries if the retry times for the addresses
6255 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6259 <indexterm role="concept">
6260 <primary>SMTP</primary>
6261 <secondary>passed connection</secondary>
6263 <indexterm role="concept">
6264 <primary>SMTP</primary>
6265 <secondary>multiple deliveries</secondary>
6267 <indexterm role="concept">
6268 <primary>multiple SMTP deliveries</primary>
6270 the delivery process spawns other processes to deliver other messages down
6271 passed SMTP connections, the queue runner waits for these to finish before
6275 When all the queued messages have been considered, the original queue runner
6276 process terminates. In other words, a single pass is made over the waiting
6277 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6278 this to be repeated periodically.
6281 Exim processes the waiting messages in an unpredictable order. It isn’t very
6282 random, but it is likely to be different each time, which is all that matters.
6283 If one particular message screws up a remote MTA, other messages to the same
6284 MTA have a chance of getting through if they get tried first.
6287 It is possible to cause the messages to be processed in lexical message id
6288 order, which is essentially the order in which they arrived, by setting the
6289 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6291 </listitem></varlistentry>
6293 <term><option>-q</option><<emphasis>qflags</emphasis>></term>
6296 The <option>-q</option> option may be followed by one or more flag letters that change its
6297 behaviour. They are all optional, but if more than one is present, they must
6298 appear in the correct order. Each flag is described in a separate item below.
6300 </listitem></varlistentry>
6302 <term><option>-qq...</option></term>
6305 <indexterm role="option">
6306 <primary><option>-qq</option></primary>
6308 <indexterm role="concept">
6309 <primary>queue</primary>
6310 <secondary>double scanning</secondary>
6312 <indexterm role="concept">
6313 <primary>queue</primary>
6314 <secondary>routing</secondary>
6316 <indexterm role="concept">
6317 <primary>routing</primary>
6318 <secondary>whole queue before delivery</secondary>
6320 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6321 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6322 every domain. Addresses are routed, local deliveries happen, but no remote
6326 <indexterm role="concept">
6327 <primary>hints database</primary>
6328 <secondary>remembering routing</secondary>
6330 The hints database that remembers which messages are waiting for specific hosts
6331 is updated, as if delivery to those hosts had been deferred. After this is
6332 complete, a second, normal queue scan happens, with routing and delivery taking
6333 place as normal. Messages that are routed to the same host should mostly be
6334 delivered down a single SMTP
6335 <indexterm role="concept">
6336 <primary>SMTP</primary>
6337 <secondary>passed connection</secondary>
6339 <indexterm role="concept">
6340 <primary>SMTP</primary>
6341 <secondary>multiple deliveries</secondary>
6343 <indexterm role="concept">
6344 <primary>multiple SMTP deliveries</primary>
6346 connection because of the hints that were set up during the first queue scan.
6347 This option may be useful for hosts that are connected to the Internet
6350 </listitem></varlistentry>
6352 <term><option>-q[q]i...</option></term>
6355 <indexterm role="option">
6356 <primary><option>-qi</option></primary>
6358 <indexterm role="concept">
6359 <primary>queue</primary>
6360 <secondary>initial delivery</secondary>
6362 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6363 those messages that haven’t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6364 delivery</quote>.) This can be helpful if you are putting messages on the queue using
6365 <option>-odq</option> and want a queue runner just to process the new messages.
6367 </listitem></varlistentry>
6369 <term><option>-q[q][i]f...</option></term>
6372 <indexterm role="option">
6373 <primary><option>-qf</option></primary>
6375 <indexterm role="concept">
6376 <primary>queue</primary>
6377 <secondary>forcing delivery</secondary>
6379 <indexterm role="concept">
6380 <primary>delivery</primary>
6381 <secondary>forcing in queue run</secondary>
6383 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6384 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6385 their retry times are tried.
6387 </listitem></varlistentry>
6389 <term><option>-q[q][i]ff...</option></term>
6392 <indexterm role="option">
6393 <primary><option>-qff</option></primary>
6395 <indexterm role="concept">
6396 <primary>frozen messages</primary>
6397 <secondary>forcing delivery</secondary>
6399 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6402 </listitem></varlistentry>
6404 <term><option>-q[q][i][f[f]]l</option></term>
6407 <indexterm role="option">
6408 <primary><option>-ql</option></primary>
6410 <indexterm role="concept">
6411 <primary>queue</primary>
6412 <secondary>local deliveries only</secondary>
6414 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6415 be done. If a message requires any remote deliveries, it remains on the queue
6418 </listitem></varlistentry>
6420 <term><option>-q</option><<emphasis>qflags</emphasis>> <<emphasis>start id</emphasis>> <<emphasis>end id</emphasis>></term>
6423 <indexterm role="concept">
6424 <primary>queue</primary>
6425 <secondary>delivering specific messages</secondary>
6427 When scanning the queue, Exim can be made to skip over messages whose ids are
6428 lexically less than a given value by following the <option>-q</option> option with a
6429 starting message id. For example:
6431 <literallayout class="monospaced">
6432 exim -q 0t5C6f-0000c8-00
6435 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
6436 second message id is given, messages whose ids are lexically greater than it
6437 are also skipped. If the same id is given twice, for example,
6439 <literallayout class="monospaced">
6440 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
6443 just one delivery process is started, for that message. This differs from
6444 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
6445 that it counts as a delivery from a queue run. Note that the selection
6446 mechanism does not affect the order in which the messages are scanned. There
6447 are also other ways of selecting specific sets of messages for delivery in a
6448 queue run – see <option>-R</option> and <option>-S</option>.
6450 </listitem></varlistentry>
6452 <term><option>-q</option><<emphasis>qflags</emphasis>><<emphasis>time</emphasis>></term>
6455 <indexterm role="concept">
6456 <primary>queue runner</primary>
6457 <secondary>starting periodically</secondary>
6459 <indexterm role="concept">
6460 <primary>periodic queue running</primary>
6462 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
6463 starting a queue runner process at intervals specified by the given time value
6464 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
6465 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
6466 single daemon process handles both functions. A common way of starting up a
6467 combined daemon at system boot time is to use a command such as
6469 <literallayout class="monospaced">
6470 /usr/exim/bin/exim -bd -q30m
6473 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
6474 process every 30 minutes.
6477 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
6478 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
6480 </listitem></varlistentry>
6482 <term><option>-qR</option><<emphasis>rsflags</emphasis>> <<emphasis>string</emphasis>></term>
6485 <indexterm role="option">
6486 <primary><option>-qR</option></primary>
6488 This option is synonymous with <option>-R</option>. It is provided for Sendmail
6491 </listitem></varlistentry>
6493 <term><option>-qS</option><<emphasis>rsflags</emphasis>> <<emphasis>string</emphasis>></term>
6496 <indexterm role="option">
6497 <primary><option>-qS</option></primary>
6499 This option is synonymous with <option>-S</option>.
6501 </listitem></varlistentry>
6503 <term><option>-R</option><<emphasis>rsflags</emphasis>> <<emphasis>string</emphasis>></term>
6506 <indexterm role="option">
6507 <primary><option>-R</option></primary>
6509 <indexterm role="concept">
6510 <primary>queue runner</primary>
6511 <secondary>for specific recipients</secondary>
6513 <indexterm role="concept">
6514 <primary>delivery</primary>
6515 <secondary>to given domain</secondary>
6517 <indexterm role="concept">
6518 <primary>domain</primary>
6519 <secondary>delivery to</secondary>
6521 The <<emphasis>rsflags</emphasis>> may be empty, in which case the white space before the string
6522 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
6523 which are the possible values for <<emphasis>rsflags</emphasis>>. White space is required if
6524 <<emphasis>rsflags</emphasis>> is not empty.
6527 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
6528 perform a single queue run, except that, when scanning the messages on the
6529 queue, Exim processes only those that have at least one undelivered recipient
6530 address containing the given string, which is checked in a case-independent
6531 way. If the <<emphasis>rsflags</emphasis>> start with <emphasis>r</emphasis>, <<emphasis>string</emphasis>> is interpreted as a
6532 regular expression; otherwise it is a literal string.
6535 Once a message is selected, all its addresses are processed. For the first
6536 selected message, Exim overrides any retry information and forces a delivery
6537 attempt for each undelivered address. This means that if delivery of any
6538 address in the first message is successful, any existing retry information is
6539 deleted, and so delivery attempts for that address in subsequently selected
6540 messages (which are processed without forcing) will run. However, if delivery
6541 of any address does not succeed, the retry information is updated, and in
6542 subsequently selected messages, the failing address will be skipped.
6545 <indexterm role="concept">
6546 <primary>frozen messages</primary>
6547 <secondary>forcing delivery</secondary>
6549 If the <<emphasis>rsflags</emphasis>> contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
6550 all selected messages, not just the first; frozen messages are included when
6551 <emphasis>ff</emphasis> is present.
6554 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
6555 to a given domain after a host has been down for some time. When the SMTP
6556 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
6557 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
6558 an arbitrary command instead.
6560 </listitem></varlistentry>
6562 <term><option>-r</option></term>
6565 <indexterm role="option">
6566 <primary><option>-r</option></primary>
6568 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
6570 </listitem></varlistentry>
6572 <term><option>-S</option><<emphasis>rsflags</emphasis>> <<emphasis>string</emphasis>></term>
6575 <indexterm role="option">
6576 <primary><option>-S</option></primary>
6578 <indexterm role="concept">
6579 <primary>delivery</primary>
6580 <secondary>from given sender</secondary>
6582 <indexterm role="concept">
6583 <primary>queue runner</primary>
6584 <secondary>for specific senders</secondary>
6586 This option acts like <option>-R</option> except that it checks the string against each
6587 message’s sender instead of against the recipients. If <option>-R</option> is also set, both
6588 conditions must be met for a message to be selected. If either of the options
6589 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
6591 </listitem></varlistentry>
6593 <term><option>-Tqt</option> <<emphasis>times</emphasis>></term>
6596 <indexterm role="option">
6597 <primary><option>-Tqt</option></primary>
6599 This an option that is exclusively for use by the Exim testing suite. It is not
6600 recognized when Exim is run normally. It allows for the setting up of explicit
6601 <quote>queue times</quote> so that various warning/retry features can be tested.
6603 </listitem></varlistentry>
6605 <term><option>-t</option></term>
6608 <indexterm role="option">
6609 <primary><option>-t</option></primary>
6611 <indexterm role="concept">
6612 <primary>recipient</primary>
6613 <secondary>extracting from header lines</secondary>
6615 <indexterm role="concept">
6616 <primary><emphasis>Bcc:</emphasis> header line</primary>
6618 <indexterm role="concept">
6619 <primary><emphasis>Cc:</emphasis> header line</primary>
6621 <indexterm role="concept">
6622 <primary><emphasis>To:</emphasis> header line</primary>
6624 When Exim is receiving a locally-generated, non-SMTP message on its standard
6625 input, the <option>-t</option> option causes the recipients of the message to be obtained
6626 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
6627 from the command arguments. The addresses are extracted before any rewriting
6628 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
6631 <indexterm role="concept">
6632 <primary>Sendmail compatibility</primary>
6633 <secondary><option>-t</option> option</secondary>
6635 If the command has any arguments, they specify addresses to which the message
6636 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
6637 the recipients list obtained from the headers. This is compatible with Smail 3
6638 and in accordance with the documented behaviour of several versions of
6639 Sendmail, as described in man pages on a number of operating systems (e.g.
6640 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
6641 argument addresses to those obtained from the headers, and the O’Reilly
6642 Sendmail book documents it that way. Exim can be made to add argument addresses
6643 instead of subtracting them by setting the option
6644 <option>extract_addresses_remove_arguments</option> false.
6647 <indexterm role="concept">
6648 <primary><option>Resent-</option> header lines</primary>
6649 <secondary>with <option>-t</option></secondary>
6651 If there are any <option>Resent-</option> header lines in the message, Exim extracts
6652 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
6653 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
6654 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
6655 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
6658 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
6659 message is resent several times). The RFC also specifies that they should be
6660 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
6661 not at all clear how <option>-t</option> should operate in the present of multiple sets,
6662 nor indeed exactly what constitutes a <quote>set</quote>.
6663 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
6664 are often added at the end of the header, and if a message is resent more than
6665 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
6666 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
6668 </listitem></varlistentry>
6670 <term><option>-ti</option></term>
6673 <indexterm role="option">
6674 <primary><option>-ti</option></primary>
6676 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
6677 compatibility with Sendmail.
6679 </listitem></varlistentry>
6681 <term><option>-tls-on-connect</option></term>
6684 <indexterm role="option">
6685 <primary><option>-tls-on-connect</option></primary>
6687 <indexterm role="concept">
6688 <primary>TLS</primary>
6689 <secondary>use without STARTTLS</secondary>
6691 <indexterm role="concept">
6692 <primary>TLS</primary>
6693 <secondary>automatic start</secondary>
6695 This option is available when Exim is compiled with TLS support. It forces all
6696 incoming SMTP connections to behave as if the incoming port is listed in the
6697 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
6698 <xref linkend="CHAPTLS"/> for further details.
6700 </listitem></varlistentry>
6702 <term><option>-U</option></term>
6705 <indexterm role="option">
6706 <primary><option>-U</option></primary>
6708 <indexterm role="concept">
6709 <primary>Sendmail compatibility</primary>
6710 <secondary><option>-U</option> option ignored</secondary>
6712 Sendmail uses this option for <quote>initial message submission</quote>, and its
6713 documentation states that in future releases, it may complain about
6714 syntactically invalid messages rather than fixing them when this flag is not
6715 set. Exim ignores this option.
6717 </listitem></varlistentry>
6719 <term><option>-v</option></term>
6722 <indexterm role="option">
6723 <primary><option>-v</option></primary>
6725 This option causes Exim to write information to the standard error stream,
6726 describing what it is doing. In particular, it shows the log lines for
6727 receiving and delivering a message, and if an SMTP connection is made, the SMTP
6728 dialogue is shown. Some of the log lines shown may not actually be written to
6729 the log if the setting of <option>log_selector</option> discards them. Any relevant
6730 selectors are shown with each log line. If none are shown, the logging is
6733 </listitem></varlistentry>
6735 <term><option>-x</option></term>
6738 <indexterm role="option">
6739 <primary><option>-x</option></primary>
6741 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
6742 National Language Support extended characters in the body of the mail item</quote>).
6743 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
6746 </listitem></varlistentry>
6749 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
6750 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
6752 <!-- === End of command line options === -->
6756 <chapter id="CHAPconf">
6757 <title>The Exim run time configuration file</title>
6758 <titleabbrev>The runtime configuration file</titleabbrev>
6760 <indexterm role="concept">
6761 <primary>run time configuration</primary>
6763 <indexterm role="concept">
6764 <primary>configuration file</primary>
6765 <secondary>general description</secondary>
6767 <indexterm role="concept">
6768 <primary>CONFIGURE_FILE</primary>
6770 <indexterm role="concept">
6771 <primary>configuration file</primary>
6772 <secondary>errors in</secondary>
6774 <indexterm role="concept">
6775 <primary>error</primary>
6776 <secondary>in configuration file</secondary>
6778 <indexterm role="concept">
6779 <primary>return code</primary>
6780 <secondary>for bad configuration</secondary>
6782 Exim uses a single run time configuration file that is read whenever an Exim
6783 binary is executed. Note that in normal operation, this happens frequently,
6784 because Exim is designed to operate in a distributed manner, without central
6788 If a syntax error is detected while reading the configuration file, Exim
6789 writes a message on the standard error, and exits with a non-zero return code.
6790 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
6791 errors can be detected at this time. The values of any expanded options are
6792 not checked until the expansion happens, even when the expansion does not
6793 actually alter the string.
6796 The name of the configuration file is compiled into the binary for security
6797 reasons, and is specified by the CONFIGURE_FILE compilation option. In
6798 most configurations, this specifies a single file. However, it is permitted to
6799 give a colon-separated list of file names, in which case Exim uses the first
6800 existing file in the list.
6803 <indexterm role="concept">
6804 <primary>EXIM_USER</primary>
6806 <indexterm role="concept">
6807 <primary>EXIM_GROUP</primary>
6809 <indexterm role="concept">
6810 <primary>CONFIGURE_OWNER</primary>
6812 <indexterm role="concept">
6813 <primary>CONFIGURE_GROUP</primary>
6815 <indexterm role="concept">
6816 <primary>configuration file</primary>
6817 <secondary>ownership</secondary>
6819 <indexterm role="concept">
6820 <primary>ownership</primary>
6821 <secondary>configuration file</secondary>
6823 The run time configuration file must be owned by root or by the user that is
6824 specified at compile time by the EXIM_USER option, or by the user that is
6825 specified at compile time by the CONFIGURE_OWNER option (if set). The
6826 configuration file must not be world-writeable or group-writeable, unless its
6827 group is the one specified at compile time by the EXIM_GROUP option or by the
6828 CONFIGURE_GROUP option.
6831 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
6832 to root, anybody who is able to edit the run time configuration file has an
6833 easy way to run commands as root. If you make your mail administrators members
6834 of the Exim group, but do not trust them with root, make sure that the run time
6835 configuration is not group writeable.
6838 A default configuration file, which will work correctly in simple situations,
6839 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
6840 defines just one file name, the installation process copies the default
6841 configuration to a new file of that name if it did not previously exist. If
6842 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
6843 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
6847 <title>Using a different configuration file</title>
6849 <indexterm role="concept">
6850 <primary>configuration file</primary>
6851 <secondary>alternate</secondary>
6853 A one-off alternate configuration can be specified by the <option>-C</option> command line
6854 option, which may specify a single file or a list of files. However, when
6855 <option>-C</option> is used, Exim gives up its root privilege, unless called by root or the
6856 Exim user (or unless the argument for <option>-C</option> is identical to the built-in value
6857 from CONFIGURE_FILE). <option>-C</option> is useful mainly for checking the syntax of
6858 configuration files before installing them. No owner or group checks are done
6859 on a configuration file specified by <option>-C</option>.
6862 The privileged use of <option>-C</option> by the Exim user can be locked out by setting
6863 ALT_CONFIG_ROOT_ONLY in <filename>Local/Makefile</filename> when building Exim. However,
6864 if you do this, you also lock out the possibility of testing a
6865 configuration using <option>-C</option> right through message reception and delivery, even
6866 if the caller is root. The reception works, but by that time, Exim is running
6867 as the Exim user, so when it re-execs to regain privilege for the delivery, the
6868 use of <option>-C</option> causes privilege to be lost. However, root can test reception and
6869 delivery using two separate commands (one to put a message on the queue, using
6870 <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
6873 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
6874 prefix string with which any file named in a <option>-C</option> command line option must
6875 start. In addition, the file name must not contain the sequence <quote><literal>/../</literal></quote>.
6876 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any file
6877 name can be used with <option>-C</option>.
6880 One-off changes to a configuration can be specified by the <option>-D</option> command line
6881 option, which defines and overrides values for macros used inside the
6882 configuration file. However, like <option>-C</option>, the use of this option by a
6883 non-privileged user causes Exim to discard its root privilege.
6884 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
6885 completely disabled, and its use causes an immediate error exit.
6888 Some sites may wish to use the same Exim binary on different machines that
6889 share a file system, but to use different configuration files on each machine.
6890 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
6891 looks for a file whose name is the configuration file name followed by a dot
6892 and the machine’s node name, as obtained from the <function>uname()</function> function. If this
6893 file does not exist, the standard name is tried. This processing occurs for
6894 each file name in the list given by CONFIGURE_FILE or <option>-C</option>.
6897 In some esoteric situations different versions of Exim may be run under
6898 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
6899 help with this. See the comments in <filename>src/EDITME</filename> for details.
6902 <section id="SECTconffilfor">
6903 <title>Configuration file format</title>
6905 <indexterm role="concept">
6906 <primary>configuration file</primary>
6907 <secondary>format of</secondary>
6909 <indexterm role="concept">
6910 <primary>format</primary>
6911 <secondary>configuration file</secondary>
6913 Exim’s configuration file is divided into a number of different parts. General
6914 option settings must always appear at the start of the file. The other parts
6915 are all optional, and may appear in any order. Each part other than the first
6916 is introduced by the word <quote>begin</quote> followed by the name of the part. The
6922 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail.
6927 <indexterm role="concept">
6928 <primary>AUTH</primary>
6929 <secondary>configuration</secondary>
6931 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
6932 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
6937 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
6938 addresses and determine how the message is to be delivered.
6943 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
6944 define mechanisms for copying messages to destinations.
6949 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be immediately delivered.
6954 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
6955 when new addresses are generated during delivery.
6960 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
6961 want to use this feature, you must set
6963 <literallayout class="monospaced">
6964 LOCAL_SCAN_HAS_OPTIONS=yes
6967 in <filename>Local/Makefile</filename> before building Exim. Full details of the
6968 <function>local_scan()</function> facility are given in chapter <xref linkend="CHAPlocalscan"/>.
6973 <indexterm role="concept">
6974 <primary>configuration file</primary>
6975 <secondary>leading white space in</secondary>
6977 <indexterm role="concept">
6978 <primary>configuration file</primary>
6979 <secondary>trailing white space in</secondary>
6981 <indexterm role="concept">
6982 <primary>white space</primary>
6983 <secondary>in configuration file</secondary>
6985 Leading and trailing white space in configuration lines is always ignored.
6988 Blank lines in the file, and lines starting with a # character (ignoring
6989 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
6990 # character other than at the beginning of a line is not treated specially,
6991 and does not introduce a comment.
6994 Any non-comment line can be continued by ending it with a backslash. Note that
6995 the general rule for white space means that trailing white space after the
6996 backslash and leading white space at the start of continuation
6997 lines is ignored. Comment lines beginning with # (but not empty lines) may
6998 appear in the middle of a sequence of continuation lines.
7001 A convenient way to create a configuration file is to start from the
7002 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7003 change settings as required.
7006 The ACLs, retry rules, and rewriting rules have their own syntax which is
7007 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7008 respectively. The other parts of the configuration file have some syntactic
7009 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7010 onwards. Before that, the inclusion, macro, and conditional facilities are
7015 <title>File inclusions in the configuration file</title>
7017 <indexterm role="concept">
7018 <primary>inclusions in configuration file</primary>
7020 <indexterm role="concept">
7021 <primary>configuration file</primary>
7022 <secondary>including other files</secondary>
7024 <indexterm role="concept">
7025 <primary>.include in configuration file</primary>
7027 <indexterm role="concept">
7028 <primary>.include_if_exists in configuration file</primary>
7030 You can include other files inside Exim’s run time configuration file by
7034 <literal>.include</literal> <<emphasis>file name</emphasis>>
7035 <literal>.include_if_exists</literal> <<emphasis>file name</emphasis>>
7038 on a line by itself. Double quotes round the file name are optional. If you use
7039 the first form, a configuration error occurs if the file does not exist; the
7040 second form does nothing for non-existent files. In all cases, an absolute file
7044 Includes may be nested to any depth, but remember that Exim reads its
7045 configuration file often, so it is a good idea to keep them to a minimum.
7046 If you change the contents of an included file, you must HUP the daemon,
7047 because an included file is read only when the configuration itself is read.
7050 The processing of inclusions happens early, at a physical line level, so, like
7051 comment lines, an inclusion can be used in the middle of an option setting,
7054 <literallayout class="monospaced">
7055 hosts_lookup = a.b.c \
7059 Include processing happens after macro processing (see below). Its effect is to
7060 process the lines of the included file as if they occurred inline where the
7064 <section id="SECTmacrodefs">
7065 <title>Macros in the configuration file</title>
7067 <indexterm role="concept">
7068 <primary>macro</primary>
7069 <secondary>description of</secondary>
7071 <indexterm role="concept">
7072 <primary>configuration file</primary>
7073 <secondary>macros</secondary>
7075 If a line in the main part of the configuration (that is, before the first
7076 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7077 definition, and must be of the form
7080 <<emphasis>name</emphasis>> = <<emphasis>rest of line</emphasis>>
7083 The name must consist of letters, digits, and underscores, and need not all be
7084 in upper case, though that is recommended. The rest of the line, including any
7085 continuations, is the replacement text, and has leading and trailing white
7086 space removed. Quotes are not removed. The replacement text can never end with
7087 a backslash character, but this doesn’t seem to be a serious limitation.
7090 Macros may also be defined between router, transport, authenticator, or ACL
7091 definitions. They may not, however, be defined within an individual driver or
7092 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7096 <title>Macro substitution</title>
7098 Once a macro is defined, all subsequent lines in the file (and any included
7099 files) are scanned for the macro name; if there are several macros, the line is
7100 scanned for each in turn, in the order in which the macros are defined. The
7101 replacement text is not re-scanned for the current macro, though it is scanned
7102 for subsequently defined macros. For this reason, a macro name may not contain
7103 the name of a previously defined macro as a substring. You could, for example,
7107 <literal>ABCD_XYZ = </literal><<emphasis>something</emphasis>>
7108 <literal>ABCD = </literal><<emphasis>something else</emphasis>>
7111 but putting the definitions in the opposite order would provoke a configuration
7112 error. Macro expansion is applied to individual physical lines from the file,
7113 before checking for line continuation or file inclusion (see above). If a line
7114 consists solely of a macro name, and the expansion of the macro is empty, the
7115 line is ignored. A macro at the start of a line may turn the line into a
7116 comment line or a <literal>.include</literal> line.
7120 <title>Redefining macros</title>
7122 Once defined, the value of a macro can be redefined later in the configuration
7123 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7124 <emphasis>=</emphasis>. For example:
7126 <literallayout class="monospaced">
7129 MAC == updated value
7132 Redefinition does not alter the order in which the macros are applied to the
7133 subsequent lines of the configuration file. It is still the same order in which
7134 the macros were originally defined. All that changes is the macro’s value.
7135 Redefinition makes it possible to accumulate values. For example:
7137 <literallayout class="monospaced">
7140 MAC == MAC and something added
7143 This can be helpful in situations where the configuration file is built
7144 from a number of other files.
7148 <title>Overriding macro values</title>
7150 The values set for macros in the configuration file can be overridden by the
7151 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7152 used, unless called by root or the Exim user. A definition on the command line
7153 using the <option>-D</option> option causes all definitions and redefinitions within the
7158 <title>Example of macro usage</title>
7160 As an example of macro usage, consider a configuration where aliases are looked
7161 up in a MySQL database. It helps to keep the file less cluttered if long
7162 strings such as SQL statements are defined separately as macros, for example:
7164 <literallayout class="monospaced">
7165 ALIAS_QUERY = select mailbox from user where \
7166 login=${quote_mysql:$local_part};
7169 This can then be used in a <command>redirect</command> router setting like this:
7171 <literallayout class="monospaced">
7172 data = ${lookup mysql{ALIAS_QUERY}}
7175 In earlier versions of Exim macros were sometimes used for domain, host, or
7176 address lists. In Exim 4 these are handled better by named lists – see
7177 section <xref linkend="SECTnamedlists"/>.
7181 <title>Conditional skips in the configuration file</title>
7183 <indexterm role="concept">
7184 <primary>configuration file</primary>
7185 <secondary>conditional skips</secondary>
7187 <indexterm role="concept">
7188 <primary>.ifdef</primary>
7190 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7191 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7192 portions of the configuration file. The processing happens whenever the file is
7193 read (that is, when an Exim binary starts to run).
7196 The implementation is very simple. Instances of the first four directives must
7197 be followed by text that includes the names of one or macros. The condition
7198 that is tested is whether or not any macro substitution has taken place in the
7201 <literallayout class="monospaced">
7203 message_size_limit = 50M
7205 message_size_limit = 100M
7209 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined, and 100M
7210 otherwise. If there is more than one macro named on the line, the condition
7211 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7212 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7215 Although you can use a macro expansion to generate one of these directives,
7216 it is not very useful, because the condition <quote>there was a macro substitution
7217 in this line</quote> will always be true.
7220 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7221 to clarify complicated nestings.
7224 <section id="SECTcos">
7225 <title>Common option syntax</title>
7227 <indexterm role="concept">
7228 <primary>common option syntax</primary>
7230 <indexterm role="concept">
7231 <primary>syntax of common options</primary>
7233 <indexterm role="concept">
7234 <primary>configuration file</primary>
7235 <secondary>common option syntax</secondary>
7237 For the main set of options, driver options, and <function>local_scan()</function> options,
7238 each setting is on a line by itself, and starts with a name consisting of
7239 lower-case letters and underscores. Many options require a data value, and in
7240 these cases the name must be followed by an equals sign (with optional white
7241 space) and then the value. For example:
7243 <literallayout class="monospaced">
7244 qualify_domain = mydomain.example.com
7247 Some option settings may contain sensitive data, for example, passwords for
7248 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7249 line option to read these values, you can precede the option settings with the
7250 word <quote>hide</quote>. For example:
7252 <literallayout class="monospaced">
7253 hide mysql_servers = localhost/users/admin/secret-password
7256 For non-admin users, such options are displayed like this:
7258 <literallayout class="monospaced">
7259 mysql_servers = <value not displayable>
7262 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7263 all instances of the same driver.
7266 The following sections describe the syntax used for the different data types
7267 that are found in option settings.
7271 <title>Boolean options</title>
7273 <indexterm role="concept">
7274 <primary>format</primary>
7275 <secondary>boolean</secondary>
7277 <indexterm role="concept">
7278 <primary>boolean configuration values</primary>
7280 <indexterm role="option">
7281 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7283 <indexterm role="option">
7284 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7286 Options whose type is given as boolean are on/off switches. There are two
7287 different ways of specifying such options: with and without a data value. If
7288 the option name is specified on its own without data, the switch is turned on;
7289 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7290 boolean options may be followed by an equals sign and one of the words
7291 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7292 the following two settings have exactly the same effect:
7294 <literallayout class="monospaced">
7299 The following two lines also have the same (opposite) effect:
7301 <literallayout class="monospaced">
7306 You can use whichever syntax you prefer.
7310 <title>Integer values</title>
7312 <indexterm role="concept">
7313 <primary>integer configuration values</primary>
7315 <indexterm role="concept">
7316 <primary>format</primary>
7317 <secondary>integer</secondary>
7319 If an integer data item starts with the characters <quote>0x</quote>, the remainder of it
7320 is interpreted as a hexadecimal number. Otherwise, it is treated as octal if it
7321 starts with the digit 0, and decimal if not. If an integer value is followed by
7322 the letter K, it is multiplied by 1024; if it is followed by the letter M, it
7323 is multiplied by 1024x1024.
7326 When the values of integer option settings are output, values which are an
7327 exact multiple of 1024 or 1024x1024 are
7328 sometimes, but not always,
7329 printed using the letters K and M. The printing style is independent of the
7330 actual input format that was used.
7334 <title>Octal integer values</title>
7336 <indexterm role="concept">
7337 <primary>integer format</primary>
7339 <indexterm role="concept">
7340 <primary>format</primary>
7341 <secondary>octal integer</secondary>
7343 The value of an option specified as an octal integer is always interpreted in
7344 octal, whether or not it starts with the digit zero. Such options are always
7349 <title>Fixed point number values</title>
7351 <indexterm role="concept">
7352 <primary>fixed point configuration values</primary>
7354 <indexterm role="concept">
7355 <primary>format</primary>
7356 <secondary>fixed point</secondary>
7358 A fixed point number consists of a decimal integer, optionally followed by a
7359 decimal point and up to three further digits.
7362 <section id="SECTtimeformat">
7363 <title>Time interval values</title>
7365 <indexterm role="concept">
7366 <primary>time interval</primary>
7367 <secondary>specifying in configuration</secondary>
7369 <indexterm role="concept">
7370 <primary>format</primary>
7371 <secondary>time interval</secondary>
7373 A time interval is specified as a sequence of numbers, each followed by one of
7374 the following letters, with no intervening white space:
7376 <informaltable frame="none">
7377 <tgroup cols="2" colsep="0" rowsep="0">
7378 <colspec colwidth="50pt" align="left"/>
7379 <colspec colwidth="254pt" align="left"/>
7382 <entry> <option>s</option></entry>
7383 <entry>seconds</entry>
7386 <entry> <option>m</option></entry>
7387 <entry>minutes</entry>
7390 <entry> <option>h</option></entry>
7391 <entry>hours</entry>
7394 <entry> <option>d</option></entry>
7398 <entry> <option>w</option></entry>
7399 <entry>weeks</entry>
7405 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
7406 intervals are output in the same format. Exim does not restrict the values; it
7407 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
7410 <section id="SECTstrings">
7411 <title>String values</title>
7413 <indexterm role="concept">
7414 <primary>string</primary>
7415 <secondary>format of configuration values</secondary>
7417 <indexterm role="concept">
7418 <primary>format</primary>
7419 <secondary>string</secondary>
7421 If a string data item does not start with a double-quote character, it is taken
7422 as consisting of the remainder of the line plus any continuation lines,
7423 starting at the first character after any leading white space, with trailing
7424 white space removed, and with no interpretation of the characters in the
7425 string. Because Exim removes comment lines (those beginning with #) at an early
7426 stage, they can appear in the middle of a multi-line string. The following
7427 settings are therefore equivalent:
7429 <literallayout class="monospaced">
7430 trusted_users = uucp:mail
7432 trusted_users = uucp:\
7433 # This comment line is ignored
7437 <indexterm role="concept">
7438 <primary>string</primary>
7439 <secondary>quoted</secondary>
7441 <indexterm role="concept">
7442 <primary>escape characters in quoted strings</primary>
7444 If a string does start with a double-quote, it must end with a closing
7445 double-quote, and any backslash characters other than those used for line
7446 continuation are interpreted as escape characters, as follows:
7448 <informaltable frame="none">
7449 <tgroup cols="2" colsep="0" rowsep="0">
7450 <colspec colwidth="100pt" align="left"/>
7451 <colspec colwidth="254pt" align="left"/>
7454 <entry> <literal>\\</literal></entry>
7455 <entry>single backslash</entry>
7458 <entry> <literal>\n</literal></entry>
7459 <entry>newline</entry>
7462 <entry> <literal>\r</literal></entry>
7463 <entry>carriage return</entry>
7466 <entry> <literal>\t</literal></entry>
7470 <entry> <literal>\</literal><<emphasis>octal digits</emphasis>></entry>
7471 <entry>up to 3 octal digits specify one character</entry>
7474 <entry> <literal>\x</literal><<emphasis>hex digits</emphasis>></entry>
7475 <entry>up to 2 hexadecimal digits specify one character</entry>
7481 If a backslash is followed by some other character, including a double-quote
7482 character, that character replaces the pair.
7485 Quoting is necessary only if you want to make use of the backslash escapes to
7486 insert special characters, or if you need to specify a value with leading or
7487 trailing spaces. These cases are rare, so quoting is almost never needed in
7488 current versions of Exim. In versions of Exim before 3.14, quoting was required
7489 in order to continue lines, so you may come across older configuration files
7490 and examples that apparently quote unnecessarily.
7494 <title>Expanded strings</title>
7496 <indexterm role="concept">
7497 <primary>string expansion</primary>
7498 <secondary>definition of</secondary>
7500 <indexterm role="concept">
7501 <primary>expansion</primary>
7502 <secondary>definition of</secondary>
7504 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
7505 by which means various parts of the string may be changed according to the
7506 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
7507 is as just described; in particular, the handling of backslashes in quoted
7508 strings is done as part of the input process, before expansion takes place.
7509 However, backslash is also an escape character for the expander, so any
7510 backslashes that are required for that reason must be doubled if they are
7511 within a quoted configuration string.
7515 <title>User and group names</title>
7517 <indexterm role="concept">
7518 <primary>user name</primary>
7519 <secondary>format of</secondary>
7521 <indexterm role="concept">
7522 <primary>format</primary>
7523 <secondary>user name</secondary>
7525 <indexterm role="concept">
7526 <primary>group</primary>
7527 <secondary>name format</secondary>
7529 <indexterm role="concept">
7530 <primary>format</primary>
7531 <secondary>group name</secondary>
7533 User and group names are specified as strings, using the syntax described
7534 above, but the strings are interpreted specially. A user or group name must
7535 either consist entirely of digits, or be a name that can be looked up using the
7536 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
7539 <section id="SECTlistconstruct">
7540 <title>List construction</title>
7542 <indexterm role="concept">
7543 <primary>list</primary>
7544 <secondary>syntax of in configuration</secondary>
7546 <indexterm role="concept">
7547 <primary>format</primary>
7548 <secondary>list item in configuration</secondary>
7550 <indexterm role="concept">
7551 <primary>string list</primary>
7552 <secondary>definition</secondary>
7554 The data for some configuration options is a list of items, with colon as the
7555 default separator. Many of these options are shown with type <quote>string list</quote> in
7556 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
7557 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
7558 are all the same; however, those other than <quote>string list</quote> are subject to
7559 particular kinds of interpretation, as described in chapter
7560 <xref linkend="CHAPdomhosaddlists"/>.
7563 In all these cases, the entire list is treated as a single string as far as the
7564 input syntax is concerned. The <option>trusted_users</option> setting in section
7565 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
7566 in a list, it must be entered as two colons. Leading and trailing white space
7567 on each item in a list is ignored. This makes it possible to include items that
7568 start with a colon, and in particular, certain forms of IPv6 address. For
7571 <literallayout class="monospaced">
7572 local_interfaces = 127.0.0.1 : ::::1
7575 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
7578 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
7579 list items, it is not ignored when parsing the list. The space after the first
7580 colon in the example above is necessary. If it were not there, the list would
7581 be interpreted as the two items 127.0.0.1:: and 1.
7584 <indexterm role="concept">
7585 <primary>list separator</primary>
7586 <secondary>changing</secondary>
7588 <indexterm role="concept">
7589 <primary>IPv6</primary>
7590 <secondary>addresses in lists</secondary>
7592 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
7593 introduced to allow the separator character to be changed. If a list begins
7594 with a left angle bracket, followed by any punctuation character, that
7595 character is used instead of colon as the list separator. For example, the list
7596 above can be rewritten to use a semicolon separator like this:
7598 <literallayout class="monospaced">
7599 local_interfaces = <; 127.0.0.1 ; ::1
7602 This facility applies to all lists, with the exception of the list in
7603 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
7604 confined to circumstances where they really are needed.
7607 <section id="SECTempitelis">
7608 <title>Empty items in lists</title>
7610 <indexterm role="concept">
7611 <primary>list</primary>
7612 <secondary>empty item in</secondary>
7614 An empty item at the end of a list is always ignored. In other words, trailing
7615 separator characters are ignored. Thus, the list in
7617 <literallayout class="monospaced">
7618 senders = user@domain :
7621 contains only a single item. If you want to include an empty string as one item
7622 in a list, it must not be the last item. For example, this list contains three
7623 items, the second of which is empty:
7625 <literallayout class="monospaced">
7626 senders = user1@domain : : user2@domain
7629 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
7630 are interpreted as representing a single colon data character (and the list
7631 would then contain just one item). If you want to specify a list that contains
7632 just one, empty item, you can do it as in this example:
7634 <literallayout class="monospaced">
7638 In this case, the first item is empty, and the second is discarded because it
7639 is at the end of the list.
7642 <section id="SECTfordricon">
7643 <title>Format of driver configurations</title>
7645 <indexterm role="concept">
7646 <primary>drivers</primary>
7647 <secondary>configuration format</secondary>
7649 There are separate parts in the configuration for defining routers, transports,
7650 and authenticators. In each part, you are defining a number of driver
7651 instances, each with its own set of options. Each driver instance is defined by
7652 a sequence of lines like this:
7655 <<emphasis>instance name</emphasis>>:
7656 <<emphasis>option</emphasis>>
7658 <<emphasis>option</emphasis>>
7661 In the following example, the instance name is <command>localuser</command>, and it is
7662 followed by three options settings:
7664 <literallayout class="monospaced">
7668 transport = local_delivery
7671 For each driver instance, you specify which Exim code module it uses – by the
7672 setting of the <option>driver</option> option – and (optionally) some configuration
7673 settings. For example, in the case of transports, if you want a transport to
7674 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
7675 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
7676 described in detail in its own separate chapter later in this manual.
7679 You can have several routers, transports, or authenticators that are based on
7680 the same underlying driver (each must have a different instance name).
7683 The order in which routers are defined is important, because addresses are
7684 passed to individual routers one by one, in order. The order in which
7685 transports are defined does not matter at all. The order in which
7686 authenticators are defined is used only when Exim, as a client, is searching
7687 them to find one that matches an authentication mechanism offered by the
7691 <indexterm role="concept">
7692 <primary>generic options</primary>
7694 <indexterm role="concept">
7695 <primary>options</primary>
7696 <secondary>generic – definition of</secondary>
7698 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
7699 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
7700 same type (that is, all routers, all transports or all authenticators). The
7701 <option>driver</option> option is a generic option that must appear in every definition.
7702 <indexterm role="concept">
7703 <primary>private options</primary>
7705 The private options are special for each driver, and none need appear, because
7706 they all have default values.
7709 The options may appear in any order, except that the <option>driver</option> option must
7710 precede any private options, since these depend on the particular driver. For
7711 this reason, it is recommended that <option>driver</option> always be the first option.
7714 Driver instance names, which are used for reference in log entries and
7715 elsewhere, can be any sequence of letters, digits, and underscores (starting
7716 with a letter) and must be unique among drivers of the same type. A router and
7717 a transport (for example) can each have the same name, but no two router
7718 instances can have the same name. The name of a driver instance should not be
7719 confused with the name of the underlying driver module. For example, the
7720 configuration lines:
7722 <literallayout class="monospaced">
7727 create an instance of the <command>smtp</command> transport driver whose name is
7728 <command>remote_smtp</command>. The same driver code can be used more than once, with
7729 different instance names and different option settings each time. A second
7730 instance of the <command>smtp</command> transport, with different options, might be defined
7733 <literallayout class="monospaced">
7737 command_timeout = 10s
7740 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
7741 these transport instances from routers, and these names would appear in log
7745 Comment lines may be present in the middle of driver specifications. The full
7746 list of option settings for any particular driver instance, including all the
7747 defaulted values, can be extracted by making use of the <option>-bP</option> command line
7753 <chapter id="CHAPdefconfil">
7754 <title>The default configuration file</title>
7756 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
7757 <primary>configuration file</primary>
7758 <secondary>default <quote>walk through</quote></secondary>
7760 <indexterm role="concept">
7761 <primary>default</primary>
7762 <secondary>configuration file <quote>walk through</quote></secondary>
7764 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
7765 is sufficient for a host with simple mail requirements. As an introduction to
7766 the way Exim is configured, this chapter <quote>walks through</quote> the default
7767 configuration, giving brief explanations of the settings. Detailed descriptions
7768 of the options are given in subsequent chapters. The default configuration file
7769 itself contains extensive comments about ways you might want to modify the
7770 initial settings. However, note that there are many options that are not
7771 mentioned at all in the default configuration.
7773 <section id="SECTdefconfmain">
7774 <title>Main configuration settings</title>
7776 The main (global) configuration option settings must always come first in the
7777 file. The first thing you’ll see in the file, after some initial comments, is
7780 <literallayout class="monospaced">
7781 # primary_hostname =
7784 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
7785 to know the official, fully qualified name of your host, and this is where you
7786 can specify it. However, in most cases you do not need to set this option. When
7787 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
7790 The first three non-comment configuration lines are as follows:
7792 <literallayout class="monospaced">
7793 domainlist local_domains = @
7794 domainlist relay_to_domains =
7795 hostlist relay_from_hosts = 127.0.0.1
7798 These are not, in fact, option settings. They are definitions of two named
7799 domain lists and one named host list. Exim allows you to give names to lists of
7800 domains, hosts, and email addresses, in order to make it easier to manage the
7801 configuration file (see section <xref linkend="SECTnamedlists"/>).
7804 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
7805 later in the configuration to identify domains that are to be delivered
7809 <indexterm role="concept">
7810 <primary>@ in a domain list</primary>
7812 There is just one item in this list, the string <quote>@</quote>. This is a special form
7813 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
7814 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
7815 be delivered locally. Because the local host’s name is referenced indirectly,
7816 the same configuration file can be used on different hosts.
7819 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
7820 list itself is empty. Later in the configuration we will come to the part that
7821 controls mail relaying through the local host; it allows relaying to any
7822 domains in this list. By default, therefore, no relaying on the basis of a mail
7823 domain is permitted.
7826 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
7827 used later in the configuration to permit relaying from any host or IP address
7828 that matches the list. The default contains just the IP address of the IPv4
7829 loopback interface, which means that processes on the local host are able to
7830 submit mail for relaying by sending it over TCP/IP to that interface. No other
7831 hosts are permitted to submit messages for relaying.
7834 Just to be sure there’s no misunderstanding: at this point in the configuration
7835 we aren’t actually setting up any controls. We are just defining some domains
7836 and hosts that will be used in the controls that are specified later.
7839 The next two configuration lines are genuine option settings:
7841 <literallayout class="monospaced">
7842 acl_smtp_rcpt = acl_check_rcpt
7843 acl_smtp_data = acl_check_data
7846 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
7847 during an incoming SMTP session for every recipient of a message (every RCPT
7848 command), and after the contents of the message have been received,
7849 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
7850 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
7851 section of the configuration. The RCPT ACL controls which recipients are
7852 accepted for an incoming message – if a configuration does not provide an ACL
7853 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
7854 contents of a message to be checked.
7857 Two commented-out option settings are next:
7859 <literallayout class="monospaced">
7860 # av_scanner = clamd:/tmp/clamd
7861 # spamd_address = 127.0.0.1 783
7864 These are example settings that can be used when Exim is compiled with the
7865 content-scanning extension. The first specifies the interface to the virus
7866 scanner, and the second specifies the interface to SpamAssassin. Further
7867 details are given in chapter <xref linkend="CHAPexiscan"/>.
7869 <para revisionflag="changed">
7870 Three more commented-out option settings follow:
7872 <literallayout class="monospaced" revisionflag="changed">
7873 # tls_advertise_hosts = *
7874 # tls_certificate = /etc/ssl/exim.crt
7875 # tls_privatekey = /etc/ssl/exim.pem
7877 <para revisionflag="changed">
7878 These are example settings that can be used when Exim is compiled with
7879 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
7880 first one specifies the list of clients that are allowed to use TLS when
7881 connecting to this server; in this case the wildcard means all clients. The
7882 other options specify where Exim should find its TLS certificate and private
7883 key, which together prove the server’s identity to any clients that connect.
7884 More details are given in chapter <xref linkend="CHAPTLS"/>.
7886 <para revisionflag="changed">
7887 Another two commented-out option settings follow:
7889 <literallayout class="monospaced" revisionflag="changed">
7890 # daemon_smtp_ports = 25 : 465 : 587
7891 # tls_on_connect_ports = 465
7893 <para revisionflag="changed">
7894 <indexterm role="concept">
7895 <primary>port</primary>
7896 <secondary>465 and 587</secondary>
7898 <indexterm role="concept">
7899 <primary>port</primary>
7900 <secondary>for message submission</secondary>
7902 <indexterm role="concept">
7903 <primary>message</primary>
7904 <secondary>submission, ports for</secondary>
7906 <indexterm role="concept">
7907 <primary>ssmtp protocol</primary>
7909 <indexterm role="concept">
7910 <primary>smtps protocol</primary>
7912 <indexterm role="concept">
7913 <primary>SMTP</primary>
7914 <secondary>ssmtp protocol</secondary>
7916 <indexterm role="concept">
7917 <primary>SMTP</primary>
7918 <secondary>smtps protocol</secondary>
7920 These options provide better support for roaming users who wish to use this
7921 server for message submission. They are not much use unless you have turned on
7922 TLS (as described in the previous paragraph) and authentication (about which
7923 more in section <xref linkend="SECTdefconfauth"/>). The usual SMTP port 25 is often blocked
7924 on end-user networks, so RFC 4409 specifies that message submission should use
7925 port 587 instead. However some software (notably Microsoft Outlook) cannot be
7926 configured to use port 587 correctly, so these settings also enable the
7927 non-standard <quote>smtps</quote> (aka <quote>ssmtp</quote>) port 465 (see section
7928 <xref linkend="SECTsupobssmt"/>).
7931 Two more commented-out options settings follow:
7933 <literallayout class="monospaced">
7935 # qualify_recipient =
7938 The first of these specifies a domain that Exim uses when it constructs a
7939 complete email address from a local login name. This is often needed when Exim
7940 receives a message from a local process. If you do not set <option>qualify_domain</option>,
7941 the value of <option>primary_hostname</option> is used. If you set both of these options,
7942 you can have different qualification domains for sender and recipient
7943 addresses. If you set only the first one, its value is used in both cases.
7946 <indexterm role="concept">
7947 <primary>domain literal</primary>
7948 <secondary>recognizing format</secondary>
7950 The following line must be uncommented if you want Exim to recognize
7951 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
7952 (an IP address within square brackets) instead of a named domain.
7954 <literallayout class="monospaced">
7955 # allow_domain_literals
7958 The RFCs still require this form, but many people think that in the modern
7959 Internet it makes little sense to permit mail to be sent to specific hosts by
7960 quoting their IP addresses. This ancient format has been used by people who
7961 try to abuse hosts by using them for unwanted relaying. However, some
7962 people believe there are circumstances (for example, messages addressed to
7963 <emphasis>postmaster</emphasis>) where domain literals are still useful.
7966 The next configuration line is a kind of trigger guard:
7968 <literallayout class="monospaced">
7972 It specifies that no delivery must ever be run as the root user. The normal
7973 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
7974 setting is a guard against slips in the configuration.
7975 The list of users specified by <option>never_users</option> is not, however, the complete
7976 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
7977 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
7978 contents of <option>never_users</option> are added to this list. By default
7979 FIXED_NEVER_USERS also specifies root.
7982 When a remote host connects to Exim in order to send mail, the only information
7983 Exim has about the host’s identity is its IP address. The next configuration
7986 <literallayout class="monospaced">
7990 specifies that Exim should do a reverse DNS lookup on all incoming connections,
7991 in order to get a host name. This improves the quality of the logging
7992 information, but if you feel it is too expensive, you can remove it entirely,
7993 or restrict the lookup to hosts on <quote>nearby</quote> networks.
7994 Note that it is not always possible to find a host name from an IP address,
7995 because not all DNS reverse zones are maintained, and sometimes DNS servers are
7999 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8000 1413 (hence their names):
8002 <literallayout class="monospaced">
8004 rfc1413_query_timeout = 5s
8007 These settings cause Exim to make ident callbacks for all incoming SMTP calls.
8008 You can limit the hosts to which these calls are made, or change the timeout
8009 that is used. If you set the timeout to zero, all ident calls are disabled.
8010 Although they are cheap and can provide useful information for tracing problem
8011 messages, some hosts and firewalls have problems with ident calls. This can
8012 result in a timeout instead of an immediate refused connection, leading to
8013 delays on starting up an incoming SMTP session.
8016 When Exim receives messages over SMTP connections, it expects all addresses to
8017 be fully qualified with a domain, as required by the SMTP definition. However,
8018 if you are running a server to which simple clients submit messages, you may
8019 find that they send unqualified addresses. The two commented-out options:
8021 <literallayout class="monospaced">
8022 # sender_unqualified_hosts =
8023 # recipient_unqualified_hosts =
8026 show how you can specify hosts that are permitted to send unqualified sender
8027 and recipient addresses, respectively.
8030 The <option>percent_hack_domains</option> option is also commented out:
8032 <literallayout class="monospaced">
8033 # percent_hack_domains =
8036 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8037 This is an almost obsolete form of explicit email routing. If you do not know
8038 anything about it, you can safely ignore this topic.
8041 The last two settings in the main part of the default configuration are
8042 concerned with messages that have been <quote>frozen</quote> on Exim’s queue. When a
8043 message is frozen, Exim no longer continues to try to deliver it. Freezing
8044 occurs when a bounce message encounters a permanent failure because the sender
8045 address of the original message that caused the bounce is invalid, so the
8046 bounce cannot be delivered. This is probably the most common case, but there
8047 are also other conditions that cause freezing, and frozen messages are not
8048 always bounce messages.
8050 <literallayout class="monospaced">
8051 ignore_bounce_errors_after = 2d
8052 timeout_frozen_after = 7d
8055 The first of these options specifies that failing bounce messages are to be
8056 discarded after 2 days on the queue. The second specifies that any frozen
8057 message (whether a bounce message or not) is to be timed out (and discarded)
8058 after a week. In this configuration, the first setting ensures that no failing
8059 bounce message ever lasts a week.
8063 <title>ACL configuration</title>
8065 <indexterm role="concept">
8066 <primary>default</primary>
8067 <secondary>ACLs</secondary>
8069 <indexterm role="concept">
8070 <primary>access control lists (ACLs)</primary>
8071 <secondary>default configuration</secondary>
8073 In the default configuration, the ACL section follows the main configuration.
8074 It starts with the line
8076 <literallayout class="monospaced">
8080 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
8081 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
8082 and <option>acl_smtp_data</option> above.
8085 <indexterm role="concept">
8086 <primary>RCPT</primary>
8087 <secondary>ACL for</secondary>
8089 The first ACL is used for every RCPT command in an incoming SMTP message. Each
8090 RCPT command specifies one of the message’s recipients. The ACL statements
8091 are considered in order, until the recipient address is either accepted or
8092 rejected. The RCPT command is then accepted or rejected, according to the
8093 result of the ACL processing.
8095 <literallayout class="monospaced">
8099 This line, consisting of a name terminated by a colon, marks the start of the
8102 <literallayout class="monospaced">
8106 This ACL statement accepts the recipient if the sending host matches the list.
8107 But what does that strange list mean? It doesn’t actually contain any host
8108 names or IP addresses. The presence of the colon puts an empty item in the
8109 list; Exim matches this only if the incoming message did not come from a remote
8110 host, because in that case, the remote hostname is empty. The colon is
8111 important. Without it, the list itself is empty, and can never match anything.
8114 What this statement is doing is to accept unconditionally all recipients in
8115 messages that are submitted by SMTP from local processes using the standard
8116 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8119 <literallayout class="monospaced">
8120 deny message = Restricted characters in address
8121 domains = +local_domains
8122 local_parts = ^[.] : ^.*[@%!/|]
8124 deny message = Restricted characters in address
8125 domains = !+local_domains
8126 local_parts = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8129 These statements are concerned with local parts that contain any of the
8130 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8131 Although these characters are entirely legal in local parts (in the case of
8132 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8133 in Internet mail addresses.
8136 The first three have in the past been associated with explicitly routed
8137 addresses (percent is still sometimes used – see the <option>percent_hack_domains</option>
8138 option). Addresses containing these characters are regularly tried by spammers
8139 in an attempt to bypass relaying restrictions, and also by open relay testing
8140 programs. Unless you really need them it is safest to reject these characters
8141 at this early stage. This configuration is heavy-handed in rejecting these
8142 characters for all messages it accepts from remote hosts. This is a deliberate
8143 policy of being as safe as possible.
8146 The first rule above is stricter, and is applied to messages that are addressed
8147 to one of the local domains handled by this host. This is implemented by the
8148 first condition, which restricts it to domains that are listed in the
8149 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8150 reference to a named list. In this configuration, there is just one domain in
8151 <emphasis>local_domains</emphasis>, but in general there may be many.
8154 The second condition on the first statement uses two regular expressions to
8155 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8156 or <quote>|</quote>. If you have local accounts that include these characters, you will
8157 have to modify this rule.
8160 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8161 allows them because they have been encountered in practice. (Consider the
8162 common convention of local parts constructed as
8163 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8164 the author of Exim, who has no second initial.) However, a local part starting
8165 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8166 file name (for example, for a mailing list). This is also true for local parts
8167 that contain slashes. A pipe symbol can also be troublesome if the local part
8168 is incorporated unthinkingly into a shell command line.
8171 The second rule above applies to all other domains, and is less strict. This
8172 allows your own users to send outgoing messages to sites that use slashes
8173 and vertical bars in their local parts. It blocks local parts that begin
8174 with a dot, slash, or vertical bar, but allows these characters within the
8175 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8176 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8177 (or your users’ viruses) from mounting certain kinds of attack on remote sites.
8179 <literallayout class="monospaced">
8180 accept local_parts = postmaster
8181 domains = +local_domains
8184 This statement, which has two conditions, accepts an incoming address if the
8185 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
8186 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8187 reference to a named list. In this configuration, there is just one domain in
8188 <emphasis>local_domains</emphasis>, but in general there may be many.
8191 The presence of this statement means that mail to postmaster is never blocked
8192 by any of the subsequent tests. This can be helpful while sorting out problems
8193 in cases where the subsequent tests are incorrectly denying access.
8195 <literallayout class="monospaced">
8196 require verify = sender
8199 This statement requires the sender address to be verified before any subsequent
8200 ACL statement can be used. If verification fails, the incoming recipient
8201 address is refused. Verification consists of trying to route the address, to
8202 see if a bounce message could be delivered to it. In the case of remote
8203 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
8204 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
8205 discusses the details of address verification.
8207 <literallayout class="monospaced">
8208 accept hosts = +relay_from_hosts
8209 control = submission
8212 This statement accepts the address if the message is coming from one of the
8213 hosts that are defined as being allowed to relay through this host. Recipient
8214 verification is omitted here, because in many cases the clients are dumb MUAs
8215 that do not cope well with SMTP error responses. For the same reason, the
8216 second line specifies <quote>submission mode</quote> for messages that are accepted. This
8217 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
8218 messages that are deficient in some way, for example, because they lack a
8219 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
8220 probably add recipient verification here, and disable submission mode.
8222 <literallayout class="monospaced">
8223 accept authenticated = *
8224 control = submission
8227 This statement accepts the address if the client host has authenticated itself.
8228 Submission mode is again specified, on the grounds that such messages are most
8229 likely to come from MUAs. The default configuration does not define any
8230 authenticators, though it does include some nearly complete commented-out
8231 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
8232 fact authenticate until you complete the authenticator definitions.
8234 <literallayout class="monospaced" revisionflag="changed">
8235 require message = relay not permitted
8236 domains = +local_domains : +relay_domains
8238 <para revisionflag="changed">
8239 This statement rejects the address if its domain is neither a local domain nor
8240 one of the domains for which this host is a relay.
8242 <literallayout class="monospaced" revisionflag="changed">
8243 require verify = recipient
8245 <para revisionflag="changed">
8246 This statement requires the recipient address to be verified; if verification
8247 fails, the address is rejected.
8249 <literallayout class="monospaced" revisionflag="changed">
8250 # deny message = rejected because $sender_host_address \
8251 # is in a black list at $dnslist_domain\n\
8253 # dnslists = black.list.example
8255 # warn dnslists = black.list.example
8256 # add_header = X-Warning: $sender_host_address is in \
8257 # a black list at $dnslist_domain
8258 # log_message = found in $dnslist_domain
8260 <para revisionflag="changed">
8261 These commented-out lines are examples of how you could configure Exim to check
8262 sending hosts against a DNS black list. The first statement rejects messages
8263 from blacklisted hosts, whereas the second just inserts a warning header
8266 <literallayout class="monospaced" revisionflag="changed">
8267 # require verify = csa
8269 <para revisionflag="changed">
8270 This commented-out line is an example of how you could turn on client SMTP
8271 authorization (CSA) checking. Such checks do DNS lookups for special SRV
8274 <literallayout class="monospaced" revisionflag="changed">
8277 <para revisionflag="changed">
8278 The final statement in the first ACL unconditionally accepts any recipient
8279 address that has successfully passed all the previous tests.
8281 <literallayout class="monospaced">
8285 This line marks the start of the second ACL, and names it. Most of the contents
8286 of this ACL are commented out:
8288 <literallayout class="monospaced">
8290 # message = This message contains a virus \
8294 These lines are examples of how to arrange for messages to be scanned for
8295 viruses when Exim has been compiled with the content-scanning extension, and a
8296 suitable virus scanner is installed. If the message is found to contain a
8297 virus, it is rejected with the given custom error message.
8299 <literallayout class="monospaced">
8300 # warn spam = nobody
8301 # message = X-Spam_score: $spam_score\n\
8302 # X-Spam_score_int: $spam_score_int\n\
8303 # X-Spam_bar: $spam_bar\n\
8304 # X-Spam_report: $spam_report
8307 These lines are an example of how to arrange for messages to be scanned by
8308 SpamAssassin when Exim has been compiled with the content-scanning extension,
8309 and SpamAssassin has been installed. The SpamAssassin check is run with
8310 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
8311 series of extra header line. In this case, the message is not rejected,
8312 whatever the spam score.
8314 <literallayout class="monospaced">
8318 This final line in the DATA ACL accepts the message unconditionally.
8322 <title>Router configuration</title>
8324 <indexterm role="concept">
8325 <primary>default</primary>
8326 <secondary>routers</secondary>
8328 <indexterm role="concept">
8329 <primary>routers</primary>
8330 <secondary>default</secondary>
8332 The router configuration comes next in the default configuration, introduced
8335 <literallayout class="monospaced">
8339 Routers are the modules in Exim that make decisions about where to send
8340 messages. An address is passed to each router in turn, until it is either
8341 accepted, or failed. This means that the order in which you define the routers
8342 matters. Each router is fully described in its own chapter later in this
8343 manual. Here we give only brief overviews.
8345 <literallayout class="monospaced">
8347 # driver = ipliteral
8348 # domains = !+local_domains
8349 # transport = remote_smtp
8352 <indexterm role="concept">
8353 <primary>domain literal</primary>
8354 <secondary>default router</secondary>
8356 This router is commented out because the majority of sites do not want to
8357 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
8358 you uncomment this router, you also need to uncomment the setting of
8359 <option>allow_domain_literals</option> in the main part of the configuration.
8361 <literallayout class="monospaced">
8364 domains = ! +local_domains
8365 transport = remote_smtp
8366 ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
8370 The first uncommented router handles addresses that do not involve any local
8371 domains. This is specified by the line
8373 <literallayout class="monospaced">
8374 domains = ! +local_domains
8377 The <option>domains</option> option lists the domains to which this router applies, but the
8378 exclamation mark is a negation sign, so the router is used only for domains
8379 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
8380 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
8381 indicates that it is referring to a named list. Addresses in other domains are
8382 passed on to the following routers.
8385 The name of the router driver is <command>dnslookup</command>,
8386 and is specified by the <option>driver</option> option. Do not be confused by the fact that
8387 the name of this router instance is the same as the name of the driver. The
8388 instance name is arbitrary, but the name set in the <option>driver</option> option must be
8389 one of the driver modules that is in the Exim binary.
8392 The <command>dnslookup</command> router routes addresses by looking up their domains in the
8393 DNS in order to obtain a list of hosts to which the address is routed. If the
8394 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
8395 specified by the <option>transport</option> option. If the router does not find the domain
8396 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
8397 the address fails and is bounced.
8400 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
8401 be entirely ignored. This option is present because a number of cases have been
8402 encountered where MX records in the DNS point to host names
8403 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
8404 Completely ignoring these IP addresses causes Exim to fail to route the
8405 email address, so it bounces. Otherwise, Exim would log a routing problem, and
8406 continue to try to deliver the message periodically until the address timed
8409 <literallayout class="monospaced">
8414 data = ${lookup{$local_part}lsearch{/etc/aliases}}
8416 file_transport = address_file
8417 pipe_transport = address_pipe
8420 Control reaches this and subsequent routers only for addresses in the local
8421 domains. This router checks to see whether the local part is defined as an
8422 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
8423 data that it looks up from that file. If no data is found for the local part,
8424 the value of the <option>data</option> option is empty, causing the address to be passed to
8428 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
8429 often used. That is why it is referenced by from the default configuration
8430 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
8431 <filename>Local/Makefile</filename> before building Exim.
8433 <literallayout class="monospaced">
8437 # local_part_suffix = +* : -*
8438 # local_part_suffix_optional
8439 file = $home/.forward
8444 file_transport = address_file
8445 pipe_transport = address_pipe
8446 reply_transport = address_reply
8449 This is the most complicated router in the default configuration. It is another
8450 redirection router, but this time it is looking for forwarding data set up by
8451 individual users. The <option>check_local_user</option> setting specifies a check that the
8452 local part of the address is the login name of a local user. If it is not, the
8453 router is skipped. The two commented options that follow <option>check_local_user</option>,
8456 <literallayout class="monospaced">
8457 # local_part_suffix = +* : -*
8458 # local_part_suffix_optional
8461 <indexterm role="concept">
8462 <primary><varname>$local_part_suffix</varname></primary>
8464 show how you can specify the recognition of local part suffixes. If the first
8465 is uncommented, a suffix beginning with either a plus or a minus sign, followed
8466 by any sequence of characters, is removed from the local part and placed in the
8467 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
8468 presence of a suffix in the local part is optional. When a suffix is present,
8469 the check for a local login uses the local part with the suffix removed.
8472 When a local user account is found, the file called <filename>.forward</filename> in the user’s
8473 home directory is consulted. If it does not exist, or is empty, the router
8474 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
8475 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
8478 <indexterm role="concept">
8479 <primary>Sieve filter</primary>
8480 <secondary>enabling in default router</secondary>
8482 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
8483 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
8484 is commented out by default), the contents of the file are interpreted as a set
8485 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
8486 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
8487 separate document entitled <emphasis>Exim’s interfaces to mail filtering</emphasis>.
8490 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
8491 verifying addresses, or when running as a consequence of an SMTP EXPN command.
8492 There are two reasons for doing this:
8494 <orderedlist numeration="arabic">
8497 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
8498 checking an address for validity; it makes sense not to waste resources doing
8504 More importantly, when Exim is verifying addresses or handling an EXPN
8505 command during an SMTP session, it is running as the Exim user, not as root.
8506 The group is the Exim group, and no additional groups are set up.
8507 It may therefore not be possible for Exim to read users’ <filename>.forward</filename> files at
8513 The setting of <option>check_ancestor</option> prevents the router from generating a new
8514 address that is the same as any previous address that was redirected. (This
8515 works round a problem concerning a bad interaction between aliasing and
8516 forwarding – see section <xref linkend="SECTredlocmai"/>).
8519 The final three option settings specify the transports that are to be used when
8520 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
8521 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
8523 <literallayout class="monospaced">
8524 a.nother@elsewhere.example, /home/spqr/archive
8527 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
8530 <literallayout class="monospaced">
8534 # local_part_suffix = +* : -*
8535 # local_part_suffix_optional
8536 transport = local_delivery
8539 The final router sets up delivery into local mailboxes, provided that the local
8540 part is the name of a local login, by accepting the address and assigning it to
8541 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
8542 routers, so the address is bounced. The commented suffix settings fulfil the
8543 same purpose as they do for the <command>userforward</command> router.
8547 <title>Transport configuration</title>
8549 <indexterm role="concept">
8550 <primary>default</primary>
8551 <secondary>transports</secondary>
8553 <indexterm role="concept">
8554 <primary>transports</primary>
8555 <secondary>default</secondary>
8557 Transports define mechanisms for actually delivering messages. They operate
8558 only when referenced from routers, so the order in which they are defined does
8559 not matter. The transports section of the configuration starts with
8561 <literallayout class="monospaced">
8565 One remote transport and four local transports are defined.
8567 <literallayout class="monospaced">
8572 This transport is used for delivering messages over SMTP connections. All its
8573 options are defaulted. The list of remote hosts comes from the router.
8575 <literallayout class="monospaced">
8578 file = /var/mail/$local_part
8586 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
8587 traditional BSD mailbox format. By default it runs under the uid and gid of the
8588 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
8589 directory. Some systems use the alternative approach of running mail deliveries
8590 under a particular group instead of using the sticky bit. The commented options
8591 show how this can be done.
8594 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
8595 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
8596 similarly-named options above.
8598 <literallayout class="monospaced">
8604 This transport is used for handling deliveries to pipes that are generated by
8605 redirection (aliasing or users’ <filename>.forward</filename> files). The <option>return_output</option>
8606 option specifies that any output generated by the pipe is to be returned to the
8609 <literallayout class="monospaced">
8617 This transport is used for handling deliveries to files that are generated by
8618 redirection. The name of the file is not specified in this instance of
8619 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
8621 <literallayout class="monospaced">
8626 This transport is used for handling automatic replies generated by users’
8631 <title>Default retry rule</title>
8633 <indexterm role="concept">
8634 <primary>retry</primary>
8635 <secondary>default rule</secondary>
8637 <indexterm role="concept">
8638 <primary>default</primary>
8639 <secondary>retry rule</secondary>
8641 The retry section of the configuration file contains rules which affect the way
8642 Exim retries deliveries that cannot be completed at the first attempt. It is
8643 introduced by the line
8645 <literallayout class="monospaced">
8649 In the default configuration, there is just one rule, which applies to all
8652 <literallayout class="monospaced">
8653 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
8656 This causes any temporarily failing address to be retried every 15 minutes for
8657 2 hours, then at intervals starting at one hour and increasing by a factor of
8658 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
8659 is not delivered after 4 days of temporary failure, it is bounced.
8663 <title>Rewriting configuration</title>
8665 The rewriting section of the configuration, introduced by
8667 <literallayout class="monospaced">
8671 contains rules for rewriting addresses in messages as they arrive. There are no
8672 rewriting rules in the default configuration file.
8675 <section id="SECTdefconfauth">
8676 <title>Authenticators configuration</title>
8678 <indexterm role="concept">
8679 <primary>AUTH</primary>
8680 <secondary>configuration</secondary>
8682 The authenticators section of the configuration, introduced by
8684 <literallayout class="monospaced">
8685 begin authenticators
8688 defines mechanisms for the use of the SMTP AUTH command. The default
8689 configuration file contains two commented-out example authenticators
8690 which support plaintext username/password authentication using the
8691 standard PLAIN mechanism and the traditional but non-standard LOGIN
8692 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
8693 to support most MUA software.
8696 The example PLAIN authenticator looks like this:
8698 <literallayout class="monospaced">
8700 # driver = plaintext
8701 # server_set_id = $auth2
8702 # server_prompts = :
8703 # server_condition = Authentication is not yet configured
8704 # server_advertise_condition = ${if def:tls_cipher }
8707 And the example LOGIN authenticator looks like this:
8709 <literallayout class="monospaced">
8711 # driver = plaintext
8712 # server_set_id = $auth1
8713 # server_prompts = <| Username: | Password:
8714 # server_condition = Authentication is not yet configured
8715 # server_advertise_condition = ${if def:tls_cipher }
8718 The <option>server_set_id</option> option makes Exim remember the authenticated username
8719 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
8720 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
8721 that it implements the details of the specific authentication mechanism,
8722 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
8723 when Exim offers authentication to clients; in the examples, this is only
8724 when TLS or SSL has been started, so to enable the authenticators you also
8725 need to add support for TLS as described in <xref linkend="SECTdefconfmain"/>.
8728 The <option>server_condition</option> setting defines how to verify that the username and
8729 password are correct. In the examples it just produces an error message.
8730 To make the authenticators work, you can use a string expansion
8731 expression like one of the examples in <xref linkend="CHAPplaintext"/>.
8734 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
8739 <chapter id="CHAPregexp">
8740 <title>Regular expressions</title>
8742 <indexterm role="concept">
8743 <primary>regular expressions</primary>
8744 <secondary>library</secondary>
8746 <indexterm role="concept">
8747 <primary>PCRE</primary>
8749 Exim supports the use of regular expressions in many of its options. It
8750 uses the PCRE regular expression library; this provides regular expression
8751 matching that is compatible with Perl 5. The syntax and semantics of
8752 regular expressions is discussed in many Perl reference books, and also in
8753 Jeffrey Friedl’s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
8754 O’Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
8757 The documentation for the syntax and semantics of the regular expressions that
8758 are supported by PCRE is included in plain text in the file
8759 <filename>doc/pcrepattern.txt</filename> in the Exim distribution, and also in the HTML
8760 tarbundle of Exim documentation. It describes in detail the features of the
8761 regular expressions that PCRE supports, so no further description is included
8762 here. The PCRE functions are called from Exim using the default option settings
8763 (that is, with no PCRE options set), except that the PCRE_CASELESS option is
8764 set when the matching is required to be case-insensitive.
8767 In most cases, when a regular expression is required in an Exim configuration,
8768 it has to start with a circumflex, in order to distinguish it from plain text
8769 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
8770 second item in the colon-separated list is a regular expression.
8772 <literallayout class="monospaced">
8773 domains = a.b.c : ^\\d{3} : *.y.z : ...
8776 The doubling of the backslash is required because of string expansion that
8777 precedes interpretation – see section <xref linkend="SECTlittext"/> for more discussion
8778 of this issue, and a way of avoiding the need for doubling backslashes. The
8779 regular expression that is eventually used in this example contains just one
8780 backslash. The circumflex is included in the regular expression, and has the
8781 normal effect of <quote>anchoring</quote> it to the start of the string that is being
8785 There are, however, two cases where a circumflex is not required for the
8786 recognition of a regular expression: these are the <option>match</option> condition in a
8787 string expansion, and the <option>matches</option> condition in an Exim filter file. In
8788 these cases, the relevant string is always treated as a regular expression; if
8789 it does not start with a circumflex, the expression is not anchored, and can
8790 match anywhere in the subject string.
8793 In all cases, if you want a regular expression to match at the end of a string,
8794 you must code the $ metacharacter to indicate this. For example:
8796 <literallayout class="monospaced">
8797 domains = ^\\d{3}\\.example
8800 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
8803 <literallayout class="monospaced">
8804 domains = ^\\d{3}\\.example\$
8807 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
8808 $ is needed because string expansion also interprets dollar characters.
8811 <title>Testing regular expressions</title>
8813 <indexterm role="concept">
8814 <primary>testing</primary>
8815 <secondary>regular expressions</secondary>
8817 <indexterm role="concept">
8818 <primary>regular expressions</primary>
8819 <secondary>testing</secondary>
8821 <indexterm role="concept">
8822 <primary><emphasis>pcretest</emphasis></primary>
8824 A program called <emphasis>pcretest</emphasis> forms part of the PCRE distribution and is built
8825 with PCRE during the process of building Exim. It is primarily intended for
8826 testing PCRE itself, but it can also be used for experimenting with regular
8827 expressions. After building Exim, the binary can be found in the build
8828 directory (it is not installed anywhere automatically). There is documentation
8829 of various options in <filename>doc/pcretest.txt</filename>, but for simple testing, none are
8830 needed. This is the output of a sample run of <emphasis>pcretest</emphasis>:
8833 <literal> re> </literal><emphasis role="bold"><literal>/^([@]+)@.+\.(ac|edu)\.(?!kr)[a-z]{2}$/</literal></emphasis>
8834 <literal>data> </literal><emphasis role="bold"><literal>x@y.ac.uk</literal></emphasis>
8835 <literal> 0: x@y.ac.uk</literal>
8836 <literal> 1: x</literal>
8837 <literal> 2: ac</literal>
8838 <literal>data> </literal><emphasis role="bold"><literal>x@y.ac.kr</literal></emphasis>
8839 <literal>No match</literal>
8840 <literal>data> </literal><emphasis role="bold"><literal>x@y.edu.com</literal></emphasis>
8841 <literal>No match</literal>
8842 <literal>data> </literal><emphasis role="bold"><literal>x@y.edu.co</literal></emphasis>
8843 <literal> 0: x@y.edu.co</literal>
8844 <literal> 1: x</literal>
8845 <literal> 2: edu</literal>
8848 Input typed by the user is shown in bold face. After the <quote>re></quote> prompt, a
8849 regular expression enclosed in delimiters is expected. If this compiles without
8850 error, <quote>data></quote> prompts are given for strings against which the expression is
8851 matched. An empty data line causes a new regular expression to be read. If the
8852 match is successful, the captured substring values (that is, what would be in
8853 the variables <varname>$0</varname>, <varname>$1</varname>, <varname>$2</varname>, etc.) are shown. The above example tests for
8854 an email address whose domain ends with either <quote>ac</quote> or <quote>edu</quote> followed by a
8855 two-character top-level domain that is not <quote>kr</quote>. The local part is captured
8856 in <varname>$1</varname> and the <quote>ac</quote> or <quote>edu</quote> in <varname>$2</varname>.
8861 <chapter id="CHAPfdlookup">
8862 <title>File and database lookups</title>
8864 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
8865 <primary>file</primary>
8866 <secondary>lookups</secondary>
8868 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
8869 <primary>database lookups</primary>
8871 <indexterm role="concept">
8872 <primary>lookup</primary>
8873 <secondary>description of</secondary>
8875 Exim can be configured to look up data in files or databases as it processes
8876 messages. Two different kinds of syntax are used:
8878 <orderedlist numeration="arabic">
8881 A string that is to be expanded may contain explicit lookup requests. These
8882 cause parts of the string to be replaced by data that is obtained from the
8883 lookup. Lookups of this type are conditional expansion items. Different results
8884 can be defined for the cases of lookup success and failure. See chapter
8885 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
8890 Lists of domains, hosts, and email addresses can contain lookup requests as a
8891 way of avoiding excessively long linear lists. In this case, the data that is
8892 returned by the lookup is often (but not always) discarded; whether the lookup
8893 succeeds or fails is what really counts. These kinds of list are described in
8894 chapter <xref linkend="CHAPdomhosaddlists"/>.
8899 String expansions, lists, and lookups interact with each other in such a way
8900 that there is no order in which to describe any one of them that does not
8901 involve references to the others. Each of these three chapters makes more sense
8902 if you have read the other two first. If you are reading this for the first
8903 time, be aware that some of it will make a lot more sense after you have read
8904 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
8907 <title>Examples of different lookup syntax</title>
8909 It is easy to confuse the two different kinds of lookup, especially as the
8910 lists that may contain the second kind are always expanded before being
8911 processed as lists. Therefore, they may also contain lookups of the first kind.
8912 Be careful to distinguish between the following two examples:
8914 <literallayout class="monospaced">
8915 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
8916 domains = lsearch;/some/file
8919 The first uses a string expansion, the result of which must be a domain list.
8920 No strings have been specified for a successful or a failing lookup; the
8921 defaults in this case are the looked-up data and an empty string, respectively.
8922 The expansion takes place before the string is processed as a list, and the
8923 file that is searched could contain lines like this:
8925 <literallayout class="monospaced">
8926 192.168.3.4: domain1:domain2:...
8927 192.168.1.9: domain3:domain4:...
8930 When the lookup succeeds, the result of the expansion is a list of domains (and
8931 possibly other types of item that are allowed in domain lists).
8934 In the second example, the lookup is a single item in a domain list. It causes
8935 Exim to use a lookup to see if the domain that is being processed can be found
8936 in the file. The file could contains lines like this:
8938 <literallayout class="monospaced">
8943 Any data that follows the keys is not relevant when checking that the domain
8944 matches the list item.
8947 It is possible, though no doubt confusing, to use both kinds of lookup at once.
8948 Consider a file containing lines like this:
8950 <literallayout class="monospaced">
8951 192.168.5.6: lsearch;/another/file
8954 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
8955 first <option>domains</option> setting above generates the second setting, which therefore
8956 causes a second lookup to occur.
8959 The rest of this chapter describes the different lookup types that are
8960 available. Any of them can be used in any part of the configuration where a
8961 lookup is permitted.
8965 <title>Lookup types</title>
8967 <indexterm role="concept">
8968 <primary>lookup</primary>
8969 <secondary>types of</secondary>
8971 <indexterm role="concept">
8972 <primary>single-key lookup</primary>
8973 <secondary>definition of</secondary>
8975 Two different types of data lookup are implemented:
8980 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
8981 and a single key to search for. The key must be a non-empty string for the
8982 lookup to succeed. The lookup type determines how the file is searched.
8987 <indexterm role="concept">
8988 <primary>query-style lookup</primary>
8989 <secondary>definition of</secondary>
8991 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
8992 key value is assumed by Exim for query-style lookups. You can use whichever
8993 Exim variables you need to construct the database query.
8998 The code for each lookup type is in a separate source file that is included in
8999 the binary of Exim only if the corresponding compile-time option is set. The
9000 default settings in <filename>src/EDITME</filename> are:
9002 <literallayout class="monospaced">
9007 which means that only linear searching and DBM lookups are included by default.
9008 For some types of lookup (e.g. SQL databases), you need to install appropriate
9009 libraries and header files before building Exim.
9012 <section id="SECTsinglekeylookups">
9013 <title>Single-key lookup types</title>
9015 <indexterm role="concept">
9016 <primary>lookup</primary>
9017 <secondary>single-key types</secondary>
9019 <indexterm role="concept">
9020 <primary>single-key lookup</primary>
9021 <secondary>list of types</secondary>
9023 The following single-key lookup types are implemented:
9028 <indexterm role="concept">
9029 <primary>cdb</primary>
9030 <secondary>description of</secondary>
9032 <indexterm role="concept">
9033 <primary>lookup</primary>
9034 <secondary>cdb</secondary>
9036 <indexterm role="concept">
9037 <primary>binary zero</primary>
9038 <secondary>in lookup key</secondary>
9040 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
9041 string without a terminating binary zero. The cdb format is designed for
9042 indexed files that are read frequently and never updated, except by total
9043 re-creation. As such, it is particulary suitable for large files containing
9044 aliases or other indexed data referenced by an MTA. Information about cdb can
9045 be found in several places:
9048 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>
9049 <emphasis role="bold"><ulink url="ftp://ftp.corpit.ru/pub/tinycdb/">ftp://ftp.corpit.ru/pub/tinycdb/</ulink></emphasis>
9050 <emphasis role="bold"><ulink url="http://packages.debian.org/stable/utils/freecdb.html">http://packages.debian.org/stable/utils/freecdb.html</ulink></emphasis>
9053 A cdb distribution is not needed in order to build Exim with cdb support,
9054 because the code for reading cdb files is included directly in Exim itself.
9055 However, no means of building or testing cdb files is provided with Exim, so
9056 you need to obtain a cdb distribution in order to do this.
9061 <indexterm role="concept">
9062 <primary>DBM</primary>
9063 <secondary>lookup type</secondary>
9065 <indexterm role="concept">
9066 <primary>lookup</primary>
9067 <secondary>dbm</secondary>
9069 <indexterm role="concept">
9070 <primary>binary zero</primary>
9071 <secondary>in lookup key</secondary>
9073 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
9074 DBM file by looking up the record with the given key. A terminating binary
9075 zero is included in the key that is passed to the DBM library. See section
9076 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
9079 <indexterm role="concept">
9080 <primary>Berkeley DB library</primary>
9081 <secondary>file format</secondary>
9083 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
9084 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
9085 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
9086 the DB_UNKNOWN option. This enables it to handle any of the types of database
9087 that the library supports, and can be useful for accessing DBM files created by
9088 other applications. (For earlier DB versions, DB_HASH is always used.)
9093 <indexterm role="concept">
9094 <primary>lookup</primary>
9095 <secondary>dbmnz</secondary>
9097 <indexterm role="concept">
9098 <primary>lookup</primary>
9099 <secondary>dbm – terminating zero</secondary>
9101 <indexterm role="concept">
9102 <primary>binary zero</primary>
9103 <secondary>in lookup key</secondary>
9105 <indexterm role="concept">
9106 <primary>Courier</primary>
9108 <indexterm role="concept">
9109 <primary><filename>/etc/userdbshadow.dat</filename></primary>
9111 <indexterm role="concept">
9112 <primary>dmbnz lookup type</primary>
9114 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
9115 is not included in the key that is passed to the DBM library. You may need this
9116 if you want to look up data in files that are created by or shared with some
9117 other application that does not use terminating zeros. For example, you need to
9118 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
9119 calls using the passwords from Courier’s <filename>/etc/userdbshadow.dat</filename> file. Exim’s
9120 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
9121 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
9126 <indexterm role="concept">
9127 <primary>lookup</primary>
9128 <secondary>dsearch</secondary>
9130 <indexterm role="concept">
9131 <primary>dsearch lookup type</primary>
9133 <command>dsearch</command>: The given file must be a directory; this is searched for a file
9134 whose name is the key. The key may not contain any forward slash characters.
9135 The result of a successful lookup is the name of the file. An example of how
9136 this lookup can be used to support virtual domains is given in section
9137 <xref linkend="SECTvirtualdomains"/>.
9142 <indexterm role="concept">
9143 <primary>lookup</primary>
9144 <secondary>iplsearch</secondary>
9146 <indexterm role="concept">
9147 <primary>iplsearch lookup type</primary>
9149 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
9150 terminated by a colon or white space or the end of the line. The keys in the
9151 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
9152 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
9153 being interpreted as a key terminator. For example:
9155 <literallayout class="monospaced">
9156 1.2.3.4: data for 1.2.3.4
9157 192.168.0.0/16 data for 192.168.0.0/16
9158 "abcd::cdab": data for abcd::cdab
9159 "abcd:abcd::/32" data for abcd:abcd::/32
9162 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
9163 file is searched linearly, using the CIDR masks where present, until a matching
9164 key is found. The first key that matches is used; there is no attempt to find a
9165 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
9166 <command>iplsearch</command> is the same as for <command>lsearch</command>.
9169 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
9170 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9171 lookup types support only literal keys.
9174 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
9175 the implicit key is the host’s IP address rather than its name (see section
9176 <xref linkend="SECThoslispatsikey"/>).
9180 <para revisionflag="changed">
9181 <indexterm role="concept">
9182 <primary>linear search</primary>
9184 <indexterm role="concept">
9185 <primary>lookup</primary>
9186 <secondary>lsearch</secondary>
9188 <indexterm role="concept">
9189 <primary>lsearch lookup type</primary>
9191 <indexterm role="concept">
9192 <primary>case sensitivity</primary>
9193 <secondary>in lsearch lookup</secondary>
9195 <command>lsearch</command>: The given file is a text file that is searched linearly for a
9196 line beginning with the search key, terminated by a colon or white space or the
9197 end of the line. The search is case-insensitive; that is, upper and lower case
9198 letters are treated as the same. The first occurrence of the key that is found
9199 in the file is used.
9202 White space between the key and the colon is permitted. The remainder of the
9203 line, with leading and trailing white space removed, is the data. This can be
9204 continued onto subsequent lines by starting them with any amount of white
9205 space, but only a single space character is included in the data at such a
9206 junction. If the data begins with a colon, the key must be terminated by a
9209 <literallayout class="monospaced">
9213 Empty lines and lines beginning with # are ignored, even if they occur in the
9214 middle of an item. This is the traditional textual format of alias files. Note
9215 that the keys in an <command>lsearch</command> file are literal strings. There is no
9216 wildcarding of any kind.
9219 <indexterm role="concept">
9220 <primary>lookup</primary>
9221 <secondary>lsearch – colons in keys</secondary>
9223 <indexterm role="concept">
9224 <primary>white space</primary>
9225 <secondary>in lsearch key</secondary>
9227 In most <command>lsearch</command> files, keys are not required to contain colons or #
9228 characters, or white space. However, if you need this feature, it is available.
9229 If a key begins with a doublequote character, it is terminated only by a
9230 matching quote (or end of line), and the normal escaping rules apply to its
9231 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
9232 quoted keys (exactly as for unquoted keys). There is no special handling of
9233 quotes for the data part of an <command>lsearch</command> line.
9238 <indexterm role="concept">
9239 <primary>NIS lookup type</primary>
9241 <indexterm role="concept">
9242 <primary>lookup</primary>
9243 <secondary>NIS</secondary>
9245 <indexterm role="concept">
9246 <primary>binary zero</primary>
9247 <secondary>in lookup key</secondary>
9249 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
9250 the given key, without a terminating binary zero. There is a variant called
9251 <command>nis0</command> which does include the terminating binary zero in the key. This is
9252 reportedly needed for Sun-style alias files. Exim does not recognize NIS
9253 aliases; the full map names must be used.
9258 <indexterm role="concept">
9259 <primary>wildlsearch lookup type</primary>
9261 <indexterm role="concept">
9262 <primary>lookup</primary>
9263 <secondary>wildlsearch</secondary>
9265 <indexterm role="concept">
9266 <primary>nwildlsearch lookup type</primary>
9268 <indexterm role="concept">
9269 <primary>lookup</primary>
9270 <secondary>nwildlsearch</secondary>
9272 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
9273 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
9274 the file may be wildcarded. The difference between these two lookup types is
9275 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
9276 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
9278 <para revisionflag="changed">
9279 <indexterm role="concept">
9280 <primary>case sensitivity</primary>
9281 <secondary>in (n)wildlsearch lookup</secondary>
9283 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
9284 file that are regular expressions can be made case-sensitive by the use of
9285 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
9287 <orderedlist numeration="arabic">
9290 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
9292 <literallayout class="monospaced">
9293 *.a.b.c data for anything.a.b.c
9294 *fish data for anythingfish
9299 The string may begin with a circumflex to indicate a regular expression. For
9300 example, for <command>wildlsearch</command>:
9302 <literallayout class="monospaced">
9303 ^\N\d+\.a\.b\N data for <digits>.a.b
9306 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
9307 expression. If you are using <command>nwildlsearch</command>, where the keys are not
9308 string-expanded, the equivalent entry is:
9310 <literallayout class="monospaced">
9311 ^\d+\.a\.b data for <digits>.a.b
9313 <para revisionflag="changed">
9314 The case-insensitive flag is set at the start of compiling the regular
9315 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
9316 For example, to make the entire pattern case-sensitive:
9318 <literallayout class="monospaced" revisionflag="changed">
9319 ^(?-i)\d+\.a\.b data for <digits>.a.b
9322 If the regular expression contains white space or colon characters, you must
9323 either quote it (see <command>lsearch</command> above), or represent these characters in other
9324 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
9325 colon. This may be easier than quoting, because if you quote, you have to
9326 escape all the backslashes inside the quotes.
9329 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
9330 match for later use, because the results of all lookups are cached. If a lookup
9331 is repeated, the result is taken from the cache, and no actual pattern matching
9332 takes place. The values of all the numeric variables are unset after a
9333 <command>(n)wildlsearch</command> match.
9338 Although I cannot see it being of much use, the general matching function that
9339 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
9340 lookup name terminated by a semicolon, and followed by lookup data. For
9343 <literallayout class="monospaced">
9344 cdb;/some/file data for keys that match the file
9347 The data that is obtained from the nested lookup is discarded.
9352 Keys that do not match any of these patterns are interpreted literally. The
9353 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
9354 be followed by optional colons.
9357 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
9358 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9359 lookup types support only literal keys.
9365 <title>Query-style lookup types</title>
9367 <indexterm role="concept">
9368 <primary>lookup</primary>
9369 <secondary>query-style types</secondary>
9371 <indexterm role="concept">
9372 <primary>query-style lookup</primary>
9373 <secondary>list of types</secondary>
9375 The supported query-style lookup types are listed below. Further details about
9376 many of them are given in later sections.
9381 <indexterm role="concept">
9382 <primary>DNS</primary>
9383 <secondary>as a lookup type</secondary>
9385 <indexterm role="concept">
9386 <primary>lookup</primary>
9387 <secondary>DNS</secondary>
9389 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
9390 are given in the supplied query. The resulting data is the contents of the
9391 records. See section <xref linkend="SECTdnsdb"/>.
9396 <indexterm role="concept">
9397 <primary>InterBase lookup type</primary>
9399 <indexterm role="concept">
9400 <primary>lookup</primary>
9401 <secondary>InterBase</secondary>
9403 <command>ibase</command>: This does a lookup in an InterBase database.
9408 <indexterm role="concept">
9409 <primary>LDAP</primary>
9410 <secondary>lookup type</secondary>
9412 <indexterm role="concept">
9413 <primary>lookup</primary>
9414 <secondary>LDAP</secondary>
9416 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
9417 returns attributes from a single entry. There is a variant called <command>ldapm</command>
9418 that permits values from multiple entries to be returned. A third variant
9419 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
9420 any attribute values. See section <xref linkend="SECTldap"/>.
9425 <indexterm role="concept">
9426 <primary>MySQL</primary>
9427 <secondary>lookup type</secondary>
9429 <indexterm role="concept">
9430 <primary>lookup</primary>
9431 <secondary>MySQL</secondary>
9433 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
9434 MySQL database. See section <xref linkend="SECTsql"/>.
9439 <indexterm role="concept">
9440 <primary>NIS+ lookup type</primary>
9442 <indexterm role="concept">
9443 <primary>lookup</primary>
9444 <secondary>NIS+</secondary>
9446 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
9447 the field to be returned. See section <xref linkend="SECTnisplus"/>.
9452 <indexterm role="concept">
9453 <primary>Oracle</primary>
9454 <secondary>lookup type</secondary>
9456 <indexterm role="concept">
9457 <primary>lookup</primary>
9458 <secondary>Oracle</secondary>
9460 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
9461 Oracle database. See section <xref linkend="SECTsql"/>.
9466 <indexterm role="concept">
9467 <primary>lookup</primary>
9468 <secondary>passwd</secondary>
9470 <indexterm role="concept">
9471 <primary>passwd lookup type</primary>
9473 <indexterm role="concept">
9474 <primary><filename>/etc/passwd</filename></primary>
9476 <command>passwd</command> is a query-style lookup with queries that are just user names. The
9477 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
9478 success, the result string is the same as you would get from an <command>lsearch</command>
9479 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
9480 password value. For example:
9482 <literallayout class="monospaced">
9483 *:42:42:King Rat:/home/kr:/bin/bash
9488 <indexterm role="concept">
9489 <primary>PostgreSQL lookup type</primary>
9491 <indexterm role="concept">
9492 <primary>lookup</primary>
9493 <secondary>PostgreSQL</secondary>
9495 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
9496 PostgreSQL database. See section <xref linkend="SECTsql"/>.
9501 <indexterm role="concept">
9502 <primary>sqlite lookup type</primary>
9504 <indexterm role="concept">
9505 <primary>lookup</primary>
9506 <secondary>sqlite</secondary>
9508 <command>sqlite</command>: The format of the query is a file name followed by an SQL statement
9509 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
9514 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
9515 not likely to be useful in normal operation.
9520 <indexterm role="concept">
9521 <primary>whoson lookup type</primary>
9523 <indexterm role="concept">
9524 <primary>lookup</primary>
9525 <secondary>whoson</secondary>
9527 <command>whoson</command>: <emphasis>Whoson</emphasis> (<emphasis role="bold"><ulink url="http://whoson.sourceforge.net">http://whoson.sourceforge.net</ulink></emphasis>) is a proposed
9528 Internet protocol that allows Internet server programs to check whether a
9529 particular (dynamically allocated) IP address is currently allocated to a known
9530 (trusted) user and, optionally, to obtain the identity of the said user. In
9531 Exim, this can be used to implement <quote>POP before SMTP</quote> checking using ACL
9534 <literallayout class="monospaced">
9535 require condition = \
9536 ${lookup whoson {$sender_host_address}{yes}{no}}
9539 The query consists of a single IP address. The value returned is the name of
9540 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
9541 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
9542 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
9548 <title>Temporary errors in lookups</title>
9550 <indexterm role="concept">
9551 <primary>lookup</primary>
9552 <secondary>temporary error in</secondary>
9554 Lookup functions can return temporary error codes if the lookup cannot be
9555 completed. For example, an SQL or LDAP database might be unavailable. For this
9556 reason, it is not advisable to use a lookup that might do this for critical
9557 options such as a list of local domains.
9560 When a lookup cannot be completed in a router or transport, delivery
9561 of the message (to the relevant address) is deferred, as for any other
9562 temporary error. In other circumstances Exim may assume the lookup has failed,
9563 or may give up altogether.
9566 <section id="SECTdefaultvaluelookups">
9567 <title>Default values in single-key lookups</title>
9569 <indexterm role="concept">
9570 <primary>wildcard lookups</primary>
9572 <indexterm role="concept">
9573 <primary>lookup</primary>
9574 <secondary>default values</secondary>
9576 <indexterm role="concept">
9577 <primary>lookup</primary>
9578 <secondary>wildcard</secondary>
9580 <indexterm role="concept">
9581 <primary>lookup</primary>
9582 <secondary>* added to type</secondary>
9584 <indexterm role="concept">
9585 <primary>default</primary>
9586 <secondary>in single-key lookups</secondary>
9588 In this context, a <quote>default value</quote> is a value specified by the administrator
9589 that is to be used if a lookup fails.
9592 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
9593 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
9594 provide a default value. See also the section on partial matching below.
9597 <indexterm role="concept">
9598 <primary>*@ with single-key lookup</primary>
9600 <indexterm role="concept">
9601 <primary>lookup</primary>
9602 <secondary>*@ added to type</secondary>
9604 <indexterm role="concept">
9605 <primary>alias file</primary>
9606 <secondary>per-domain default</secondary>
9608 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
9609 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
9610 character, a second lookup is done with everything before the last @ replaced
9611 by *. This makes it possible to provide per-domain defaults in alias files
9612 that include the domains in the keys. If the second lookup fails (or doesn’t
9613 take place because there is no @ in the key), <quote>*</quote> is looked up.
9614 For example, a <command>redirect</command> router might contain:
9616 <literallayout class="monospaced">
9617 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
9620 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
9621 looks up these keys, in this order:
9623 <literallayout class="monospaced">
9629 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
9630 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
9631 complete scan is done for each key, and only if it is not found at all does
9632 Exim move on to try the next key.
9635 <section id="SECTpartiallookup">
9636 <title>Partial matching in single-key lookups</title>
9638 <indexterm role="concept">
9639 <primary>partial matching</primary>
9641 <indexterm role="concept">
9642 <primary>wildcard lookups</primary>
9644 <indexterm role="concept">
9645 <primary>lookup</primary>
9646 <secondary>partial matching</secondary>
9648 <indexterm role="concept">
9649 <primary>lookup</primary>
9650 <secondary>wildcard</secondary>
9652 <indexterm role="concept">
9653 <primary>asterisk</primary>
9654 <secondary>in search type</secondary>
9656 The normal operation of a single-key lookup is to search the file for an exact
9657 match with the given key. However, in a number of situations where domains are
9658 being looked up, it is useful to be able to do partial matching. In this case,
9659 information in the file that has a key starting with <quote>*.</quote> is matched by any
9660 domain that ends with the components that follow the full stop. For example, if
9661 a key in a DBM file is
9663 <literallayout class="monospaced">
9664 *.dates.fict.example
9667 then when partial matching is enabled this is matched by (amongst others)
9668 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
9669 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
9673 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
9674 also not available for any lookup items in address lists (see section
9675 <xref linkend="SECTaddresslist"/>).
9678 Partial matching is implemented by doing a series of separate lookups using
9679 keys constructed by modifying the original subject key. This means that it can
9680 be used with any of the single-key lookup types, provided that
9681 partial matching keys
9682 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
9683 Keys in the file that do not begin with the prefix are matched only by
9684 unmodified subject keys when partial matching is in use.
9687 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
9688 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
9689 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
9690 is added at the start of the subject key, and it is looked up again. If that
9691 fails, further lookups are tried with dot-separated components removed from the
9692 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
9696 A minimum number of two non-* components are required. This can be adjusted
9697 by including a number before the hyphen in the search type. For example,
9698 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
9699 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
9700 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
9701 up when the minimum number of non-* components is two:
9703 <literallayout class="monospaced">
9704 2250.dates.fict.example
9705 *.2250.dates.fict.example
9706 *.dates.fict.example
9710 As soon as one key in the sequence is successfully looked up, the lookup
9714 <indexterm role="concept">
9715 <primary>lookup</primary>
9716 <secondary>partial matching – changing prefix</secondary>
9718 <indexterm role="concept">
9719 <primary>prefix</primary>
9720 <secondary>for partial matching</secondary>
9722 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
9723 changed. The motivation for this feature is to allow Exim to operate with file
9724 formats that are used by other MTAs. A different prefix can be supplied in
9725 parentheses instead of the hyphen after <quote>partial</quote>. For example:
9727 <literallayout class="monospaced">
9728 domains = partial(.)lsearch;/some/file
9731 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9732 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
9733 components is unchanged). The prefix may consist of any punctuation characters
9734 other than a closing parenthesis. It may be empty, for example:
9736 <literallayout class="monospaced">
9737 domains = partial1()cdb;/some/file
9740 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9741 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
9744 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
9745 just one non-wild component has failed, and the original key is shortened right
9746 down to the null string) depends on the prefix:
9751 If the prefix has zero length, the whole lookup fails.
9756 If the prefix has length 1, a lookup for just the prefix is done. For
9757 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
9762 Otherwise, if the prefix ends in a dot, the dot is removed, and the
9763 remainder is looked up. With the default prefix, therefore, the final lookup is
9764 for <quote>*</quote> on its own.
9769 Otherwise, the whole prefix is looked up.
9774 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
9775 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
9776 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
9777 specified, adding <quote>*</quote> to the search type has no effect with the default
9778 prefix, because the <quote>*</quote> key is already included in the sequence of partial
9779 lookups. However, there might be a use for lookup types such as
9780 <quote>partial0(.)lsearch*</quote>.
9783 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
9784 in domain lists and the like. Partial matching works only in terms of
9785 dot-separated components; a key such as <literal>*fict.example</literal>
9786 in a database file is useless, because the asterisk in a partial matching
9787 subject key is always followed by a dot.
9791 <title>Lookup caching</title>
9793 <indexterm role="concept">
9794 <primary>lookup</primary>
9795 <secondary>caching</secondary>
9797 <indexterm role="concept">
9798 <primary>caching</primary>
9799 <secondary>lookup data</secondary>
9801 Exim caches all lookup results in order to avoid needless repetition of
9802 lookups. However, because (apart from the daemon) Exim operates as a collection
9803 of independent, short-lived processes, this caching applies only within a
9804 single Exim process. There is no inter-process lookup caching facility.
9807 For single-key lookups, Exim keeps the relevant files open in case there is
9808 another lookup that needs them. In some types of configuration this can lead to
9809 many files being kept open for messages with many recipients. To avoid hitting
9810 the operating system limit on the number of simultaneously open files, Exim
9811 closes the least recently used file when it needs to open more files than its
9812 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
9815 The single-key lookup files are closed and the lookup caches are flushed at
9816 strategic points during delivery – for example, after all routing is
9821 <title>Quoting lookup data</title>
9823 <indexterm role="concept">
9824 <primary>lookup</primary>
9825 <secondary>quoting</secondary>
9827 <indexterm role="concept">
9828 <primary>quoting</primary>
9829 <secondary>in lookups</secondary>
9831 When data from an incoming message is included in a query-style lookup, there
9832 is the possibility of special characters in the data messing up the syntax of
9833 the query. For example, a NIS+ query that contains
9835 <literallayout class="monospaced">
9839 will be broken if the local part happens to contain a closing square bracket.
9840 For NIS+, data can be enclosed in double quotes like this:
9842 <literallayout class="monospaced">
9843 [name="$local_part"]
9846 but this still leaves the problem of a double quote in the data. The rule for
9847 NIS+ is that double quotes must be doubled. Other lookup types have different
9848 rules, and to cope with the differing requirements, an expansion operator
9849 of the following form is provided:
9851 <literallayout class="monospaced">
9852 ${quote_<lookup-type>:<string>}
9855 For example, the safest way to write the NIS+ query is
9857 <literallayout class="monospaced">
9858 [name="${quote_nisplus:$local_part}"]
9861 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
9862 operator can be used for all lookup types, but has no effect for single-key
9863 lookups, since no quoting is ever needed in their key strings.
9866 <section id="SECTdnsdb">
9867 <title>More about dnsdb</title>
9869 <indexterm role="concept">
9870 <primary>dnsdb lookup</primary>
9872 <indexterm role="concept">
9873 <primary>lookup</primary>
9874 <secondary>dnsdb</secondary>
9876 <indexterm role="concept">
9877 <primary>DNS</primary>
9878 <secondary>as a lookup type</secondary>
9880 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
9881 of a record type and a domain name, separated by an equals sign. For example,
9882 an expansion string could contain:
9884 <literallayout class="monospaced">
9885 ${lookup dnsdb{mx=a.b.example}{$value}fail}
9888 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
9889 is used on its own as the result. If the lookup <phrase revisionflag="changed">does not succeed,</phrase> the
9890 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> – see section
9891 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
9894 The supported DNS record types are A, CNAME, MX, NS, PTR, SRV, and TXT, and,
9895 when Exim is compiled with IPv6 support, AAAA (and A6 if that is also
9896 configured). If no type is given, TXT is assumed. When the type is PTR,
9897 the data can be an IP address, written as normal; inversion and the addition of
9898 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
9900 <literallayout class="monospaced">
9901 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
9904 If the data for a PTR record is not a syntactically valid IP address, it is not
9905 altered and nothing is added.
9908 <indexterm role="concept">
9909 <primary>MX record</primary>
9910 <secondary>in <command>dnsdb</command> lookup</secondary>
9912 <indexterm role="concept">
9913 <primary>SRV record</primary>
9914 <secondary>in <command>dnsdb</command> lookup</secondary>
9916 For an MX lookup, both the preference value and the host name are returned for
9917 each record, separated by a space. For an SRV lookup, the priority, weight,
9918 port, and host name are returned for each record, separated by spaces.
9921 For any record type, if multiple records are found (or, for A6 lookups, if a
9922 single record leads to multiple addresses), the data is returned as a
9923 concatenation, with newline as the default separator. The order, of course,
9924 depends on the DNS resolver. You can specify a different separator character
9925 between multiple records by putting a right angle-bracket followed immediately
9926 by the new separator at the start of the query. For example:
9928 <literallayout class="monospaced">
9929 ${lookup dnsdb{>: a=host1.example}}
9932 It is permitted to specify a space as the separator character. Further
9933 white space is ignored.
9937 <title>Pseudo dnsdb record types</title>
9939 <indexterm role="concept">
9940 <primary>MX record</primary>
9941 <secondary>in <command>dnsdb</command> lookup</secondary>
9943 By default, both the preference value and the host name are returned for
9944 each MX record, separated by a space. If you want only host names, you can use
9945 the pseudo-type MXH:
9947 <literallayout class="monospaced">
9948 ${lookup dnsdb{mxh=a.b.example}}
9951 In this case, the preference values are omitted, and just the host names are
9955 <indexterm role="concept">
9956 <primary>name server</primary>
9957 <secondary>for enclosing domain</secondary>
9959 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
9960 records on the given domain, but if none are found, it removes the first
9961 component of the domain name, and tries again. This process continues until NS
9962 records are found or there are no more components left (or there is a DNS
9963 error). In other words, it may return the name servers for a top-level domain,
9964 but it never returns the root name servers. If there are no NS records for the
9965 top-level domain, the lookup fails. Consider these examples:
9967 <literallayout class="monospaced">
9968 ${lookup dnsdb{zns=xxx.quercite.com}}
9969 ${lookup dnsdb{zns=xxx.edu}}
9972 Assuming that in each case there are no NS records for the full domain name,
9973 the first returns the name servers for <option>quercite.com</option>, and the second returns
9974 the name servers for <option>edu</option>.
9977 You should be careful about how you use this lookup because, unless the
9978 top-level domain does not exist, the lookup always returns some host names. The
9979 sort of use to which this might be put is for seeing if the name servers for a
9980 given domain are on a blacklist. You can probably assume that the name servers
9981 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
9985 <indexterm role="concept">
9986 <primary>CSA</primary>
9987 <secondary>in <command>dnsdb</command> lookup</secondary>
9989 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
9990 records according to the CSA rules, which are described in section
9991 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
9992 not sufficient because of the extra parent domain search behaviour of CSA. The
9993 result of a successful lookup such as:
9995 <literallayout class="monospaced">
9996 ${lookup dnsdb {csa=$sender_helo_name}}
9999 has two space-separated fields: an authorization code and a target host name.
10000 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
10001 authorization required but absent, or <quote>?</quote> for unknown.
10005 <title>Multiple dnsdb lookups</title>
10007 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
10008 However, you can specify a list of domains or IP addresses in a single
10009 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
10010 the default separator, but with the ability to change this. For example:
10012 <literallayout class="monospaced">
10013 ${lookup dnsdb{one.domain.com:two.domain.com}}
10014 ${lookup dnsdb{a=one.host.com:two.host.com}}
10015 ${lookup dnsdb{ptr = <; 1.2.3.4 ; 4.5.6.8}}
10018 In order to retain backwards compatibility, there is one special case: if
10019 the lookup type is PTR and no change of separator is specified, Exim looks
10020 to see if the rest of the string is precisely one IPv6 address. In this
10021 case, it does not treat it as a list.
10024 The data from each lookup is concatenated, with newline separators by default,
10025 in the same way that multiple DNS records for a single item are handled. A
10026 different separator can be specified, as described above.
10029 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10030 temporary DNS error for any of them, the behaviour is controlled by
10031 an optional keyword followed by a comma that may appear before the record
10032 type. The possible keywords are <quote>defer_strict</quote>, <quote>defer_never</quote>, and
10033 <quote>defer_lax</quote>. With <quote>strict</quote> behaviour, any temporary DNS error causes the
10034 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10035 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10036 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10037 error causes the whole lookup to defer only if none of the other lookups
10038 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10040 <literallayout class="monospaced">
10041 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10042 ${lookup dnsdb{a=one.host.com:two.host.com}}
10045 Thus, in the default case, as long as at least one of the DNS lookups
10046 yields some data, the lookup succeeds.
10049 <section id="SECTldap">
10050 <title>More about LDAP</title>
10052 <indexterm role="concept">
10053 <primary>LDAP lookup</primary>
10055 <indexterm role="concept">
10056 <primary>lookup</primary>
10057 <secondary>LDAP</secondary>
10059 <indexterm role="concept">
10060 <primary>Solaris</primary>
10061 <secondary>LDAP</secondary>
10063 The original LDAP implementation came from the University of Michigan; this has
10064 become <quote>Open LDAP</quote>, and there are now two different releases. Another
10065 implementation comes from Netscape, and Solaris 7 and subsequent releases
10066 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
10067 the lookup function level, their error handling is different. For this reason
10068 it is necessary to set a compile-time variable when building Exim with LDAP, to
10069 indicate which LDAP library is in use. One of the following should appear in
10070 your <filename>Local/Makefile</filename>:
10072 <literallayout class="monospaced">
10073 LDAP_LIB_TYPE=UMICHIGAN
10074 LDAP_LIB_TYPE=OPENLDAP1
10075 LDAP_LIB_TYPE=OPENLDAP2
10076 LDAP_LIB_TYPE=NETSCAPE
10077 LDAP_LIB_TYPE=SOLARIS
10080 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
10081 same interface as the University of Michigan version.
10084 There are three LDAP lookup types in Exim. These behave slightly differently in
10085 the way they handle the results of a query:
10090 <command>ldap</command> requires the result to contain just one entry; if there are more, it
10096 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
10097 Distinguished Name that is returned rather than any attribute values.
10102 <command>ldapm</command> permits the result to contain more than one entry; the attributes
10103 from all of them are returned.
10108 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
10109 Exim behaves as if the entry did not exist, and the lookup fails. The format of
10110 the data returned by a successful lookup is described in the next section.
10111 First we explain how LDAP queries are coded.
10114 <section id="SECTforldaque">
10115 <title>Format of LDAP queries</title>
10117 <indexterm role="concept">
10118 <primary>LDAP</primary>
10119 <secondary>query format</secondary>
10121 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
10122 the configuration of a <command>redirect</command> router one might have this setting:
10124 <literallayout class="monospaced">
10125 data = ${lookup ldap \
10126 {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
10127 c=UK?mailbox?base?}}
10130 <indexterm role="concept">
10131 <primary>LDAP</primary>
10132 <secondary>with TLS</secondary>
10134 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
10135 secure (encrypted) LDAP connections. The second of these ensures that an
10136 encrypted TLS connection is used.
10140 <title>LDAP quoting</title>
10142 <indexterm role="concept">
10143 <primary>LDAP</primary>
10144 <secondary>quoting</secondary>
10146 Two levels of quoting are required in LDAP queries, the first for LDAP itself
10147 and the second because the LDAP query is represented as a URL. Furthermore,
10148 within an LDAP query, two different kinds of quoting are required. For this
10149 reason, there are two different LDAP-specific quoting operators.
10152 The <option>quote_ldap</option> operator is designed for use on strings that are part of
10153 filter specifications. Conceptually, it first does the following conversions on
10156 <literallayout class="monospaced">
10163 in accordance with RFC 2254. The resulting string is then quoted according
10164 to the rules for URLs, that is, all non-alphanumeric characters except
10166 <literallayout class="monospaced">
10167 ! $ ' - . _ ( ) * +
10170 are converted to their hex values, preceded by a percent sign. For example:
10172 <literallayout class="monospaced">
10173 ${quote_ldap: a(bc)*, a<yz>; }
10178 <literallayout class="monospaced">
10179 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
10182 Removing the URL quoting, this is (with a leading and a trailing space):
10184 <literallayout class="monospaced">
10185 a\28bc\29\2A, a<yz>;
10188 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
10189 base DN specifications in queries. Conceptually, it first converts the string
10190 by inserting a backslash in front of any of the following characters:
10192 <literallayout class="monospaced">
10193 , + " \ < > ;
10196 It also inserts a backslash before any leading spaces or # characters, and
10197 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
10198 is then quoted according to the rules for URLs. For example:
10200 <literallayout class="monospaced">
10201 ${quote_ldap_dn: a(bc)*, a<yz>; }
10206 <literallayout class="monospaced">
10207 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
10210 Removing the URL quoting, this is (with a trailing space):
10212 <literallayout class="monospaced">
10213 \ a(bc)*\, a\<yz\>\;\
10216 There are some further comments about quoting in the section on LDAP
10217 authentication below.
10221 <title>LDAP connections</title>
10223 <indexterm role="concept">
10224 <primary>LDAP</primary>
10225 <secondary>connections</secondary>
10227 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
10228 is in use, via a Unix domain socket. The example given above does not specify
10229 an LDAP server. A server that is reached by TCP/IP can be specified in a query
10230 by starting it with
10232 <literallayout class="monospaced">
10233 ldap://<hostname>:<port>/...
10236 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
10237 used. When no server is specified in a query, a list of default servers is
10238 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
10239 colon-separated list of servers which are tried in turn until one successfully
10240 handles a query, or there is a serious error. Successful handling either
10241 returns the requested data, or indicates that it does not exist. Serious errors
10242 are syntactical, or multiple values when only a single value is expected.
10243 Errors which cause the next server to be tried are connection failures, bind
10244 failures, and timeouts.
10247 For each server name in the list, a port number can be given. The standard way
10248 of specifing a host and port is to use a colon separator (RFC 1738). Because
10249 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
10250 doubled. For example
10252 <literallayout class="monospaced">
10253 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
10256 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
10257 to the LDAP library with no server name, and the library’s default (normally
10258 the local host) is used.
10261 If you are using the OpenLDAP library, you can connect to an LDAP server using
10262 a Unix domain socket instead of a TCP/IP connection. This is specified by using
10263 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
10264 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
10268 For this type of connection, instead of a host name for the server, a pathname
10269 for the socket is required, and the port number is not relevant. The pathname
10270 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
10271 the query. In the former case, you can have settings such as
10273 <literallayout class="monospaced">
10274 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
10277 When the pathname is given in the query, you have to escape the slashes as
10278 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
10280 <literallayout class="monospaced">
10281 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
10284 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
10285 a pathname, it uses the Unix domain socket code, even if the query actually
10286 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
10287 socket connection. This behaviour means that you can use a setting of
10288 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
10289 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
10290 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
10294 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
10295 specified, an error is diagnosed. However, if there are more items in
10296 <option>ldap_default_servers</option>, they are tried. In other words:
10301 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
10307 Using <literal>ldapi</literal> with a host name causes an error.
10312 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
10313 <option>ldap_default_servers</option>, does whatever the library does by default.
10317 <title>LDAP authentication and control information</title>
10319 <indexterm role="concept">
10320 <primary>LDAP</primary>
10321 <secondary>authentication</secondary>
10323 The LDAP URL syntax provides no way of passing authentication and other control
10324 information to the server. To make this possible, the URL in an LDAP query may
10325 be preceded by any number of <<emphasis>name</emphasis>>=<<emphasis>value</emphasis>> settings, separated by
10326 spaces. If a value contains spaces it must be enclosed in double quotes, and
10327 when double quotes are used, backslash is interpreted in the usual way inside
10328 them. The following names are recognized:
10330 <literallayout revisionflag="changed">
10331 <literal>DEREFERENCE</literal> set the dereferencing parameter
10332 <literal>NETTIME </literal> set a timeout for a network operation
10333 <literal>USER </literal> set the DN, for authenticating the LDAP bind
10334 <literal>PASS </literal> set the password, likewise
10335 <literal>REFERRALS </literal> set the referrals parameter
10336 <literal>SIZE </literal> set the limit for the number of entries returned
10337 <literal>TIME </literal> set the maximum waiting time for a query
10339 <para revisionflag="changed">
10340 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
10341 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
10342 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
10343 library from trying to follow referrals issued by the LDAP server.
10346 The name CONNECT is an obsolete name for NETTIME, retained for
10347 backwards compatibility. This timeout (specified as a number of seconds) is
10348 enforced from the client end for operations that can be carried out over a
10349 network. Specifically, it applies to network connections and calls to the
10350 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
10351 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
10352 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
10353 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
10354 Netscape SDK; for OpenLDAP no action is taken.
10357 The TIME parameter (also a number of seconds) is passed to the server to
10358 set a server-side limit on the time taken to complete a search.
10361 Here is an example of an LDAP query in an Exim lookup that uses some of these
10362 values. This is a single line, folded to fit on the page:
10364 <literallayout class="monospaced">
10366 {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
10367 ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
10371 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
10372 any of the auxiliary data. Exim configuration settings that include lookups
10373 which contain password information should be preceded by <quote>hide</quote> to prevent
10374 non-admin users from using the <option>-bP</option> option to see their values.
10377 The auxiliary data items may be given in any order. The default is no
10378 connection timeout (the system timeout is used), no user or password, no limit
10379 on the number of entries returned, and no time limit on queries.
10382 When a DN is quoted in the USER= setting for LDAP authentication, Exim
10383 removes any URL quoting that it may contain before passing it LDAP. Apparently
10384 some libraries do this for themselves, but some do not. Removing the URL
10385 quoting has two advantages:
10390 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
10391 DNs as with DNs inside actual queries.
10396 It permits spaces inside USER= DNs.
10401 For example, a setting such as
10403 <literallayout class="monospaced">
10404 USER=cn=${quote_ldap_dn:$1}
10407 should work even if <varname>$1</varname> contains spaces.
10410 Expanded data for the PASS= value should be quoted using the <option>quote</option>
10411 expansion operator, rather than the LDAP quote operators. The only reason this
10412 field needs quoting is to ensure that it conforms to the Exim syntax, which
10413 does not allow unquoted spaces. For example:
10415 <literallayout class="monospaced">
10419 The LDAP authentication mechanism can be used to check passwords as part of
10420 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
10421 <xref linkend="CHAPexpand"/>.
10425 <title>Format of data returned by LDAP</title>
10427 <indexterm role="concept">
10428 <primary>LDAP</primary>
10429 <secondary>returned data formats</secondary>
10431 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
10432 as a sequence of values, for example
10434 <literallayout class="monospaced">
10435 cn=manager, o=University of Cambridge, c=UK
10438 The <command>ldap</command> lookup type generates an error if more than one entry matches the
10439 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
10440 the result between the data from different entries. It is possible for multiple
10441 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
10442 you know that whatever values are returned all came from a single entry in the
10446 In the common case where you specify a single attribute in your LDAP query, the
10447 result is not quoted, and does not contain the attribute name. If the attribute
10448 has multiple values, they are separated by commas.
10451 If you specify multiple attributes, the result contains space-separated, quoted
10452 strings, each preceded by the attribute name and an equals sign. Within the
10453 quotes, the quote character, backslash, and newline are escaped with
10454 backslashes, and commas are used to separate multiple values for the attribute.
10455 Apart from the escaping, the string within quotes takes the same form as the
10456 output when a single attribute is requested. Specifying no attributes is the
10457 same as specifying all of an entry’s attributes.
10460 Here are some examples of the output format. The first line of each pair is an
10461 LDAP query, and the second is the data that is returned. The attribute called
10462 <option>attr1</option> has two values, whereas <option>attr2</option> has only one value:
10464 <literallayout class="monospaced">
10465 ldap:///o=base?attr1?sub?(uid=fred)
10468 ldap:///o=base?attr2?sub?(uid=fred)
10471 ldap:///o=base?attr1,attr2?sub?(uid=fred)
10472 attr1="value1.1, value1.2" attr2="value two"
10474 ldap:///o=base??sub?(uid=fred)
10475 objectClass="top" attr1="value1.1, value1.2" attr2="value two"
10478 The <option>extract</option> operator in string expansions can be used to pick out
10479 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs. You can
10480 make use of Exim’s <option>-be</option> option to run expansion tests and thereby check the
10481 results of LDAP lookups.
10484 <section id="SECTnisplus">
10485 <title>More about NIS+</title>
10487 <indexterm role="concept">
10488 <primary>NIS+ lookup type</primary>
10490 <indexterm role="concept">
10491 <primary>lookup</primary>
10492 <secondary>NIS+</secondary>
10494 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
10495 and field name. If this is given, the result of a successful query is the
10496 contents of the named field; otherwise the result consists of a concatenation
10497 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
10498 values containing spaces are quoted. For example, the query
10500 <literallayout class="monospaced">
10501 [name=mg1456],passwd.org_dir
10504 might return the string
10506 <literallayout class="monospaced">
10507 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
10508 home=/home/mg1456 shell=/bin/bash shadow=""
10511 (split over two lines here to fit on the page), whereas
10513 <literallayout class="monospaced">
10514 [name=mg1456],passwd.org_dir:gcos
10519 <literallayout class="monospaced">
10523 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
10524 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
10525 operator is to double any quote characters within the text.
10528 <section id="SECTsql">
10529 <title>SQL lookups</title>
10531 <indexterm role="concept">
10532 <primary>SQL lookup types</primary>
10534 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, and SQLite
10535 databases. Queries for these databases contain SQL statements, so an example
10538 <literallayout class="monospaced">
10539 ${lookup mysql{select mailbox from users where id='userx'}\
10543 If the result of the query contains more than one field, the data for each
10544 field in the row is returned, preceded by its name, so the result of
10546 <literallayout class="monospaced">
10547 ${lookup pgsql{select home,name from users where id='userx'}\
10553 <literallayout class="monospaced">
10554 home=/home/userx name="Mister X"
10557 Empty values and values containing spaces are double quoted, with embedded
10558 quotes escaped by a backslash. If the result of the query contains just one
10559 field, the value is passed back verbatim, without a field name, for example:
10561 <literallayout class="monospaced">
10565 If the result of the query yields more than one row, it is all concatenated,
10566 with a newline between the data for each row.
10570 <title>More about MySQL, PostgreSQL, Oracle, and InterBase</title>
10572 <indexterm role="concept">
10573 <primary>MySQL</primary>
10574 <secondary>lookup type</secondary>
10576 <indexterm role="concept">
10577 <primary>PostgreSQL lookup type</primary>
10579 <indexterm role="concept">
10580 <primary>lookup</primary>
10581 <secondary>MySQL</secondary>
10583 <indexterm role="concept">
10584 <primary>lookup</primary>
10585 <secondary>PostgreSQL</secondary>
10587 <indexterm role="concept">
10588 <primary>Oracle</primary>
10589 <secondary>lookup type</secondary>
10591 <indexterm role="concept">
10592 <primary>lookup</primary>
10593 <secondary>Oracle</secondary>
10595 <indexterm role="concept">
10596 <primary>InterBase lookup type</primary>
10598 <indexterm role="concept">
10599 <primary>lookup</primary>
10600 <secondary>InterBase</secondary>
10602 If any MySQL, PostgreSQL, Oracle, or InterBase lookups are used, the
10603 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, or <option>ibase_servers</option>
10604 option (as appropriate) must be set to a colon-separated list of server
10605 information. Each item in the list is a slash-separated list of four items:
10606 host name, database name, user name, and password. In the case of Oracle, the
10607 host name field is used for the <quote>service name</quote>, and the database name field
10608 is not used and should be empty. For example:
10610 <literallayout class="monospaced">
10611 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
10614 Because password data is sensitive, you should always precede the setting with
10615 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
10616 option. Here is an example where two MySQL servers are listed:
10618 <literallayout class="monospaced">
10619 hide mysql_servers = localhost/users/root/secret:\
10620 otherhost/users/root/othersecret
10623 For MySQL and PostgreSQL, a host may be specified as <<emphasis>name</emphasis>>:<<emphasis>port</emphasis>> but
10624 because this is a colon-separated list, the colon has to be doubled. For each
10625 query, these parameter groups are tried in order until a connection and a query
10629 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
10630 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
10631 respectively, and the characters single-quote, double-quote, and backslash
10632 itself are escaped with backslashes. The <option>quote_pgsql</option> expansion operator, in
10633 addition, escapes the percent and underscore characters. This cannot be done
10634 for MySQL because these escapes are not recognized in contexts where these
10635 characters are not special.
10639 <title>Special MySQL features</title>
10641 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
10642 causes a connection to the server on the local host by means of a Unix domain
10643 socket. An alternate socket can be specified in parentheses. The full syntax of
10644 each item in <option>mysql_servers</option> is:
10647 <<emphasis>hostname</emphasis>>::<<emphasis>port</emphasis>>(<<emphasis>socket name</emphasis>>)/<<emphasis>database</emphasis>>/<<emphasis>user</emphasis>>/<<emphasis>password</emphasis>>
10650 Any of the three sub-parts of the first field can be omitted. For normal use on
10651 the local host it can be left blank or set to just <quote>localhost</quote>.
10654 No database need be supplied – but if it is absent here, it must be given in
10658 If a MySQL query is issued that does not request any data (an insert, update,
10659 or delete command), the result of the lookup is the number of rows affected.
10662 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
10663 anything (for example, setting a field to the value it already has), the result
10664 is zero because no rows are affected.
10668 <title>Special PostgreSQL features</title>
10670 PostgreSQL lookups can also use Unix domain socket connections to the database.
10671 This is usually faster and costs less CPU time than a TCP/IP connection.
10672 However it can be used only if the mail server runs on the same machine as the
10673 database server. A configuration line for PostgreSQL via Unix domain sockets
10676 <literallayout class="monospaced">
10677 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
10680 In other words, instead of supplying a host name, a path to the socket is
10681 given. The path name is enclosed in parentheses so that its slashes aren’t
10682 visually confused with the delimiters for the other server parameters.
10685 If a PostgreSQL query is issued that does not request any data (an insert,
10686 update, or delete command), the result of the lookup is the number of rows
10690 <section id="SECTsqlite">
10691 <title>More about SQLite</title>
10693 <indexterm role="concept">
10694 <primary>lookup</primary>
10695 <secondary>SQLite</secondary>
10697 <indexterm role="concept">
10698 <primary>SQLite lookup type</primary>
10700 SQLite is different to the other SQL lookups because a file name is required in
10701 addition to the SQL query. An SQLite database is a single file, and there is no
10702 daemon as in the other SQL databases. The interface to Exim requires the name
10703 of the file, as an absolute path, to be given at the start of the query. It is
10704 separated from the query by white space. This means that the path name cannot
10705 contain white space. Here is a lookup expansion example:
10707 <literallayout class="monospaced">
10708 ${lookup sqlite {/some/thing/sqlitedb \
10709 select name from aliases where id='userx';}}
10712 In a list, the syntax is similar. For example:
10714 <literallayout class="monospaced">
10715 domainlist relay_domains = sqlite;/some/thing/sqlitedb \
10716 select * from relays where ip='$sender_host_address';
10719 The only character affected by the <option>quote_sqlite</option> operator is a single
10720 quote, which it doubles.
10723 The SQLite library handles multiple simultaneous accesses to the database
10724 internally. Multiple readers are permitted, but only one process can
10725 update at once. Attempts to access the database while it is being updated
10726 are rejected after a timeout period, during which the SQLite library
10727 waits for the lock to be released. In Exim, the default timeout is set
10728 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
10730 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
10731 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
10736 <chapter id="CHAPdomhosaddlists">
10737 <title>Domain, host, address, and local part lists</title>
10738 <titleabbrev>Domain, host, and address lists</titleabbrev>
10740 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
10741 <primary>lists of domains; hosts; etc.</primary>
10743 A number of Exim configuration options contain lists of domains, hosts,
10744 email addresses, or local parts. For example, the <option>hold_domains</option> option
10745 contains a list of domains whose delivery is currently suspended. These lists
10746 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
10747 arguments to expansion conditions such as <option>match_domain</option>.
10750 Each item in one of these lists is a pattern to be matched against a domain,
10751 host, email address, or local part, respectively. In the sections below, the
10752 different types of pattern for each case are described, but first we cover some
10753 general facilities that apply to all four kinds of list.
10756 <title>Expansion of lists</title>
10758 <indexterm role="concept">
10759 <primary>expansion</primary>
10760 <secondary>of lists</secondary>
10762 Each list is expanded as a single string before it is used. The result of
10763 expansion must be a list, possibly containing empty items, which is split up
10764 into separate items for matching. By default, colon is the separator character,
10765 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
10766 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
10767 discusses the way to specify empty list items.
10770 If the string expansion is forced to fail, Exim behaves as if the item it is
10771 testing (domain, host, address, or local part) is not in the list. Other
10772 expansion failures cause temporary errors.
10775 If an item in a list is a regular expression, backslashes, dollars and possibly
10776 other special characters in the expression must be protected against
10777 misinterpretation by the string expander. The easiest way to do this is to use
10778 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
10779 expression should not be expanded. For example, in an ACL you might have:
10781 <literallayout class="monospaced">
10782 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
10783 ${lookup{$domain}lsearch{/badsenders/bydomain}}
10786 The first item is a regular expression that is protected from expansion by
10787 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
10788 senders based on the receiving domain.
10792 <title>Negated items in lists</title>
10794 <indexterm role="concept">
10795 <primary>list</primary>
10796 <secondary>negation</secondary>
10798 <indexterm role="concept">
10799 <primary>negation</primary>
10800 <secondary>in lists</secondary>
10802 Items in a list may be positive or negative. Negative items are indicated by a
10803 leading exclamation mark, which may be followed by optional white space. A list
10804 defines a set of items (domains, etc). When Exim processes one of these lists,
10805 it is trying to find out whether a domain, host, address, or local part
10806 (respectively) is in the set that is defined by the list. It works like this:
10809 The list is scanned from left to right. If a positive item is matched, the
10810 subject that is being checked is in the set; if a negative item is matched, the
10811 subject is not in the set. If the end of the list is reached without the
10812 subject having matched any of the patterns, it is in the set if the last item
10813 was a negative one, but not if it was a positive one. For example, the list in
10815 <literallayout class="monospaced">
10816 domainlist relay_domains = !a.b.c : *.b.c
10819 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
10820 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
10821 list is positive. However, if the setting were
10823 <literallayout class="monospaced">
10824 domainlist relay_domains = !a.b.c
10827 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
10828 list is negative. In other words, a list that ends with a negative item behaves
10829 as if it had an extra item <literal>:*</literal> on the end.
10832 Another way of thinking about positive and negative items in lists is to read
10833 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
10837 <section id="SECTfilnamlis">
10838 <title>File names in lists</title>
10840 <indexterm role="concept">
10841 <primary>list</primary>
10842 <secondary>file name in</secondary>
10844 If an item in a domain, host, address, or local part list is an absolute file
10845 name (beginning with a slash character), each line of the file is read and
10846 processed as if it were an independent item in the list, except that further
10847 file names are not allowed,
10848 and no expansion of the data from the file takes place.
10849 Empty lines in the file are ignored, and the file may also contain comment
10855 For domain and host lists, if a # character appears anywhere in a line of the
10856 file, it and all following characters are ignored.
10861 Because local parts may legitimately contain # characters, a comment in an
10862 address list or local part list file is recognized only if # is preceded by
10863 white space or the start of the line. For example:
10865 <literallayout class="monospaced">
10866 not#comment@x.y.z # but this is a comment
10871 Putting a file name in a list has the same effect as inserting each line of the
10872 file as an item in the list (blank lines and comments excepted). However, there
10873 is one important difference: the file is read each time the list is processed,
10874 so if its contents vary over time, Exim’s behaviour changes.
10877 If a file name is preceded by an exclamation mark, the sense of any match
10878 within the file is inverted. For example, if
10880 <literallayout class="monospaced">
10881 hold_domains = !/etc/nohold-domains
10884 and the file contains the lines
10886 <literallayout class="monospaced">
10891 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
10892 any domain matching <literal>*.b.c</literal> is not.
10896 <title>An lsearch file is not an out-of-line list</title>
10898 As will be described in the sections that follow, lookups can be used in lists
10899 to provide indexed methods of checking list membership. There has been some
10900 confusion about the way <command>lsearch</command> lookups work in lists. Because
10901 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
10902 sometimes thought that it is allowed to contain wild cards and other kinds of
10903 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
10904 always fixed strings, just as for any other single-key lookup type.
10906 <para revisionflag="changed">
10907 If you want to use a file to contain wild-card patterns that form part of a
10908 list, just give the file name on its own, without a search type, as described
10909 in the previous section. You could also use the <command>wildlsearch</command> or
10910 <command>nwildlsearch</command>, but there is no advantage in doing this.
10913 <section id="SECTnamedlists">
10914 <title>Named lists</title>
10916 <indexterm role="concept">
10917 <primary>named lists</primary>
10919 <indexterm role="concept">
10920 <primary>list</primary>
10921 <secondary>named</secondary>
10923 A list of domains, hosts, email addresses, or local parts can be given a name
10924 which is then used to refer to the list elsewhere in the configuration. This is
10925 particularly convenient if the same list is required in several different
10926 places. It also allows lists to be given meaningful names, which can improve
10927 the readability of the configuration. For example, it is conventional to define
10928 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
10929 locally on a host, using a configuration line such as
10931 <literallayout class="monospaced">
10932 domainlist local_domains = localhost:my.dom.example
10935 Named lists are referenced by giving their name preceded by a plus sign, so,
10936 for example, a router that is intended to handle local domains would be
10937 configured with the line
10939 <literallayout class="monospaced">
10940 domains = +local_domains
10943 The first router in a configuration is often one that handles all domains
10944 except the local ones, using a configuration with a negated item like this:
10946 <literallayout class="monospaced">
10949 domains = ! +local_domains
10950 transport = remote_smtp
10954 The four kinds of named list are created by configuration lines starting with
10955 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
10956 respectively. Then there follows the name that you are defining, followed by an
10957 equals sign and the list itself. For example:
10959 <literallayout class="monospaced">
10960 hostlist relay_hosts = 192.168.23.0/24 : my.friend.example
10961 addresslist bad_senders = cdb;/etc/badsenders
10964 A named list may refer to other named lists:
10966 <literallayout class="monospaced">
10967 domainlist dom1 = first.example : second.example
10968 domainlist dom2 = +dom1 : third.example
10969 domainlist dom3 = fourth.example : +dom2 : fifth.example
10972 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
10973 effect may not be what you intended, because the negation does not propagate
10974 out to the higher level. For example, consider:
10976 <literallayout class="monospaced">
10977 domainlist dom1 = !a.b
10978 domainlist dom2 = +dom1 : *.b
10981 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
10982 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
10983 means it matches the second list as well. The effect is not the same as
10985 <literallayout class="monospaced">
10986 domainlist dom2 = !a.b : *.b
10989 where <emphasis>x.y</emphasis> does not match. It’s best to avoid negation altogether in
10990 referenced lists if you can.
10993 Named lists may have a performance advantage. When Exim is routing an
10994 address or checking an incoming message, it caches the result of tests on named
10995 lists. So, if you have a setting such as
10997 <literallayout class="monospaced">
10998 domains = +local_domains
11001 on several of your routers
11002 or in several ACL statements,
11003 the actual test is done only for the first one. However, the caching works only
11004 if there are no expansions within the list itself or any sublists that it
11005 references. In other words, caching happens only for lists that are known to be
11006 the same each time they are referenced.
11009 By default, there may be up to 16 named lists of each type. This limit can be
11010 extended by changing a compile-time variable. The use of domain and host lists
11011 is recommended for concepts such as local domains, relay domains, and relay
11012 hosts. The default configuration is set up like this.
11016 <title>Named lists compared with macros</title>
11018 <indexterm role="concept">
11019 <primary>list</primary>
11020 <secondary>named compared with macro</secondary>
11022 <indexterm role="concept">
11023 <primary>macro</primary>
11024 <secondary>compared with named list</secondary>
11026 At first sight, named lists might seem to be no different from macros in the
11027 configuration file. However, macros are just textual substitutions. If you
11030 <literallayout class="monospaced">
11031 ALIST = host1 : host2
11032 auth_advertise_hosts = !ALIST
11035 it probably won’t do what you want, because that is exactly the same as
11037 <literallayout class="monospaced">
11038 auth_advertise_hosts = !host1 : host2
11041 Notice that the second host name is not negated. However, if you use a host
11044 <literallayout class="monospaced">
11045 hostlist alist = host1 : host2
11046 auth_advertise_hosts = ! +alist
11049 the negation applies to the whole list, and so that is equivalent to
11051 <literallayout class="monospaced">
11052 auth_advertise_hosts = !host1 : !host2
11056 <title>Named list caching</title>
11058 <indexterm role="concept">
11059 <primary>list</primary>
11060 <secondary>caching of named</secondary>
11062 <indexterm role="concept">
11063 <primary>caching</primary>
11064 <secondary>named lists</secondary>
11066 While processing a message, Exim caches the result of checking a named list if
11067 it is sure that the list is the same each time. In practice, this means that
11068 the cache operates only if the list contains no $ characters, which guarantees
11069 that it will not change when it is expanded. Sometimes, however, you may have
11070 an expanded list that you know will be the same each time within a given
11071 message. For example:
11073 <literallayout class="monospaced">
11074 domainlist special_domains = \
11075 ${lookup{$sender_host_address}cdb{/some/file}}
11078 This provides a list of domains that depends only on the sending host’s IP
11079 address. If this domain list is referenced a number of times (for example,
11080 in several ACL lines, or in several routers) the result of the check is not
11081 cached by default, because Exim does not know that it is going to be the
11082 same list each time.
11085 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
11086 cache the result anyway. For example:
11088 <literallayout class="monospaced">
11089 domainlist_cache special_domains = ${lookup{...
11092 If you do this, you should be absolutely sure that caching is going to do
11093 the right thing in all cases. When in doubt, leave it out.
11096 <section id="SECTdomainlist">
11097 <title>Domain lists</title>
11099 <indexterm role="concept">
11100 <primary>domain list</primary>
11101 <secondary>patterns for</secondary>
11103 <indexterm role="concept">
11104 <primary>list</primary>
11105 <secondary>domain list</secondary>
11107 Domain lists contain patterns that are to be matched against a mail domain.
11108 The following types of item may appear in domain lists:
11113 <indexterm role="concept">
11114 <primary>primary host name</primary>
11116 <indexterm role="concept">
11117 <primary>host name</primary>
11118 <secondary>matched in domain list</secondary>
11120 <indexterm role="concept">
11121 <primary><option>primary_hostname</option></primary>
11123 <indexterm role="concept">
11124 <primary>domain list</primary>
11125 <secondary>matching primary host name</secondary>
11127 <indexterm role="concept">
11128 <primary>@ in a domain list</primary>
11130 If a pattern consists of a single @ character, it matches the local host name,
11131 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
11132 possible to use the same configuration file on several different hosts that
11133 differ only in their names.
11138 <indexterm role="concept">
11139 <primary>@[] in a domain list</primary>
11141 <indexterm role="concept">
11142 <primary>domain list</primary>
11143 <secondary>matching local IP interfaces</secondary>
11145 <indexterm role="concept">
11146 <primary>domain literal</primary>
11148 If a pattern consists of the string <literal>@[]</literal> it matches any local IP interface
11149 address, enclosed in square brackets, as in an email address that contains a
11151 In today’s Internet, the use of domain literals is controversial.
11156 <indexterm role="concept">
11157 <primary>@mx_any</primary>
11159 <indexterm role="concept">
11160 <primary>@mx_primary</primary>
11162 <indexterm role="concept">
11163 <primary>@mx_secondary</primary>
11165 <indexterm role="concept">
11166 <primary>domain list</primary>
11167 <secondary>matching MX pointers to local host</secondary>
11169 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
11170 has an MX record pointing to the local host or to any host that is listed in
11171 <indexterm role="concept">
11172 <primary><option>hosts_treat_as_local</option></primary>
11174 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
11175 are similar, except that the first matches only when a primary MX target is the
11176 local host, and the second only when no primary MX target is the local host,
11177 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
11178 preference value – there may of course be more than one of them.
11181 The MX lookup that takes place when matching a pattern of this type is
11182 performed with the resolver options for widening names turned off. Thus, for
11183 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
11184 resolver’s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
11185 options of the <command>dnslookup</command> router for a discussion of domain widening.
11188 Sometimes you may want to ignore certain IP addresses when using one of these
11189 patterns. You can specify this by following the pattern with <literal>/ignore=</literal><<emphasis>ip
11190 list</emphasis>>, where <<emphasis>ip list</emphasis>> is a list of IP addresses. These addresses are
11191 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
11192 on a router). For example:
11194 <literallayout class="monospaced">
11195 domains = @mx_any/ignore=127.0.0.1
11198 This example matches any domain that has an MX record pointing to one of
11199 the local host’s IP addresses other than 127.0.0.1.
11202 The list of IP addresses is in fact processed by the same code that processes
11203 host lists, so it may contain CIDR-coded network specifications and it may also
11204 contain negative items.
11207 Because the list of IP addresses is a sublist within a domain list, you have to
11208 be careful about delimiters if there is more than one address. Like any other
11209 list, the default delimiter can be changed. Thus, you might have:
11211 <literallayout class="monospaced">
11212 domains = @mx_any/ignore=<;127.0.0.1;0.0.0.0 : \
11213 an.other.domain : ...
11216 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
11217 involved, it is easiest to change the delimiter for the main list as well:
11219 <literallayout class="monospaced">
11220 domains = <? @mx_any/ignore=<;127.0.0.1;::1 ? \
11221 an.other.domain ? ...
11226 <indexterm role="concept">
11227 <primary>asterisk</primary>
11228 <secondary>in domain list</secondary>
11230 <indexterm role="concept">
11231 <primary>domain list</primary>
11232 <secondary>asterisk in</secondary>
11234 <indexterm role="concept">
11235 <primary>domain list</primary>
11236 <secondary>matching <quote>ends with</quote></secondary>
11238 If a pattern starts with an asterisk, the remaining characters of the pattern
11239 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
11240 domain lists differs from its use in partial matching lookups. In a domain
11241 list, the character following the asterisk need not be a dot, whereas partial
11242 matching works only in terms of dot-separated components. For example, a domain
11243 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
11244 <emphasis>cipher.key.ex</emphasis>.
11249 <indexterm role="concept">
11250 <primary>regular expressions</primary>
11251 <secondary>in domain list</secondary>
11253 <indexterm role="concept">
11254 <primary>domain list</primary>
11255 <secondary>matching regular expression</secondary>
11257 If a pattern starts with a circumflex character, it is treated as a regular
11258 expression, and matched against the domain using a regular expression matching
11259 function. The circumflex is treated as part of the regular expression.
11260 References to descriptions of the syntax of regular expressions are given in
11261 chapter <xref linkend="CHAPregexp"/>.
11264 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
11265 must escape any backslash and dollar characters in the regular expression, or
11266 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
11267 it is not to be expanded (unless you really do want to build a regular
11268 expression by expansion, of course).
11273 <indexterm role="concept">
11274 <primary>lookup</primary>
11275 <secondary>in domain list</secondary>
11277 <indexterm role="concept">
11278 <primary>domain list</primary>
11279 <secondary>matching by lookup</secondary>
11281 If a pattern starts with the name of a single-key lookup type followed by a
11282 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
11283 must be a file name in a suitable format for the lookup type. For example, for
11284 <quote>cdb;</quote> it must be an absolute path:
11286 <literallayout class="monospaced">
11287 domains = cdb;/etc/mail/local_domains.cdb
11290 The appropriate type of lookup is done on the file using the domain name as the
11291 key. In most cases, the data that is looked up is not used; Exim is interested
11292 only in whether or not the key is present in the file. However, when a lookup
11293 is used for the <option>domains</option> option on a router
11294 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
11295 <varname>$domain_data</varname> variable and can be referred to in other router options or
11296 other statements in the same ACL.
11301 Any of the single-key lookup type names may be preceded by
11302 <literal>partial</literal><<emphasis>n</emphasis>><literal>-</literal>, where the <<emphasis>n</emphasis>> is optional, for example,
11304 <literallayout class="monospaced">
11305 domains = partial-dbm;/partial/domains
11308 This causes partial matching logic to be invoked; a description of how this
11309 works is given in section <xref linkend="SECTpartiallookup"/>.
11314 <indexterm role="concept">
11315 <primary>asterisk</primary>
11316 <secondary>in lookup type</secondary>
11318 Any of the single-key lookup types may be followed by an asterisk. This causes
11319 a default lookup for a key consisting of a single asterisk to be done if the
11320 original lookup fails. This is not a useful feature when using a domain list to
11321 select particular domains (because any domain would match), but it might have
11322 value if the result of the lookup is being used via the <varname>$domain_data</varname>
11323 expansion variable.
11328 If the pattern starts with the name of a query-style lookup type followed by a
11329 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
11330 pattern must be an appropriate query for the lookup type, as described in
11331 chapter <xref linkend="CHAPfdlookup"/>. For example:
11333 <literallayout class="monospaced">
11334 hold_domains = mysql;select domain from holdlist \
11335 where domain = '$domain';
11338 In most cases, the data that is looked up is not used (so for an SQL query, for
11339 example, it doesn’t matter what field you select). Exim is interested only in
11340 whether or not the query succeeds. However, when a lookup is used for the
11341 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
11342 variable and can be referred to in other options.
11347 <indexterm role="concept">
11348 <primary>domain list</primary>
11349 <secondary>matching literal domain name</secondary>
11351 If none of the above cases apply, a caseless textual comparison is made
11352 between the pattern and the domain.
11357 Here is an example that uses several different kinds of pattern:
11359 <literallayout class="monospaced">
11360 domainlist funny_domains = \
11363 *.foundation.fict.example : \
11364 \N^[1-2]\d{3}\.fict\.example$\N : \
11365 partial-dbm;/opt/data/penguin/book : \
11366 nis;domains.byname : \
11367 nisplus;[name=$domain,status=local],domains.org_dir
11370 There are obvious processing trade-offs among the various matching modes. Using
11371 an asterisk is faster than a regular expression, and listing a few names
11372 explicitly probably is too. The use of a file or database lookup is expensive,
11373 but may be the only option if hundreds of names are required. Because the
11374 patterns are tested in order, it makes sense to put the most commonly matched
11378 <section id="SECThostlist">
11379 <title>Host lists</title>
11381 <indexterm role="concept">
11382 <primary>host list</primary>
11383 <secondary>patterns in</secondary>
11385 <indexterm role="concept">
11386 <primary>list</primary>
11387 <secondary>host list</secondary>
11389 Host lists are used to control what remote hosts are allowed to do. For
11390 example, some hosts may be allowed to use the local host as a relay, and some
11391 may be permitted to use the SMTP ETRN command. Hosts can be identified in
11392 two different ways, by name or by IP address. In a host list, some types of
11393 pattern are matched to a host name, and some are matched to an IP address.
11394 You need to be particularly careful with this when single-key lookups are
11395 involved, to ensure that the right value is being used as the key.
11399 <title>Special host list patterns</title>
11401 <indexterm role="concept">
11402 <primary>empty item in hosts list</primary>
11404 <indexterm role="concept">
11405 <primary>host list</primary>
11406 <secondary>empty string in</secondary>
11408 If a host list item is the empty string, it matches only when no remote host is
11409 involved. This is the case when a message is being received from a local
11410 process using SMTP on the standard input, that is, when a TCP/IP connection is
11414 <indexterm role="concept">
11415 <primary>asterisk</primary>
11416 <secondary>in host list</secondary>
11418 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
11419 the IP address nor the name is actually inspected.
11422 <section id="SECThoslispatip">
11423 <title>Host list patterns that match by IP address</title>
11425 <indexterm role="concept">
11426 <primary>host list</primary>
11427 <secondary>matching IP addresses</secondary>
11429 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
11430 the incoming address actually appears in the IPv6 host as
11431 <literal>::ffff:</literal><<emphasis>v4address</emphasis>>. When such an address is tested against a host
11432 list, it is converted into a traditional IPv4 address first. (Not all operating
11433 systems accept IPv4 calls on IPv6 sockets, as there have been some security
11437 The following types of pattern in a host list check the remote host by
11438 inspecting its IP address:
11443 If the pattern is a plain domain name (not a regular expression, not starting
11444 with *, not a lookup of any kind), Exim calls the operating system function
11445 to find the associated IP address(es). Exim uses the newer
11446 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
11447 This typically causes a forward DNS lookup of the name. The result is compared
11448 with the IP address of the subject host.
11451 If there is a temporary problem (such as a DNS timeout) with the host name
11452 lookup, a temporary error occurs. For example, if the list is being used in an
11453 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
11454 temporary SMTP error code. If no IP address can be found for the host name,
11455 what happens is described in section <xref linkend="SECTbehipnot"/> below.
11460 <indexterm role="concept">
11461 <primary>@ in a host list</primary>
11463 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
11464 domain name, as just described.
11469 If the pattern is an IP address, it is matched against the IP address of the
11470 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
11471 IPv6 addresses can be given in colon-separated format, but the colons have to
11472 be doubled so as not to be taken as item separators when the default list
11473 separator is used. IPv6 addresses are recognized even when Exim is compiled
11474 without IPv6 support. This means that if they appear in a host list on an
11475 IPv4-only host, Exim will not treat them as host names. They are just addresses
11476 that can never match a client host.
11481 <indexterm role="concept">
11482 <primary>@[] in a host list</primary>
11484 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
11485 the local host. For example, if the local host is an IPv4 host with one
11486 interface address 10.45.23.56, these two ACL statements have the same effect:
11488 <literallayout class="monospaced">
11489 accept hosts = 127.0.0.1 : 10.45.23.56
11495 <indexterm role="concept">
11496 <primary>CIDR notation</primary>
11498 If the pattern is an IP address followed by a slash and a mask length (for
11499 example 10.11.42.0/24), it is matched against the IP address of the subject
11500 host under the given mask. This allows, an entire network of hosts to be
11501 included (or excluded) by a single item. The mask uses CIDR notation; it
11502 specifies the number of address bits that must match, starting from the most
11503 significant end of the address.
11506 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
11507 of a range of addresses. It is the number of bits in the network portion of the
11508 address. The above example specifies a 24-bit netmask, so it matches all 256
11509 addresses in the 10.11.42.0 network. An item such as
11511 <literallayout class="monospaced">
11515 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
11516 32 for an IPv4 address is the same as no mask at all; just a single address
11520 Here is another example which shows an IPv4 and an IPv6 network:
11522 <literallayout class="monospaced">
11523 recipient_unqualified_hosts = 192.168.0.0/16: \
11524 3ffe::ffff::836f::::/48
11527 The doubling of list separator characters applies only when these items
11528 appear inline in a host list. It is not required when indirecting via a file.
11531 <literallayout class="monospaced">
11532 recipient_unqualified_hosts = /opt/exim/unqualnets
11535 could make use of a file containing
11537 <literallayout class="monospaced">
11539 3ffe:ffff:836f::/48
11542 to have exactly the same effect as the previous example. When listing IPv6
11543 addresses inline, it is usually more convenient to use the facility for
11544 changing separator characters. This list contains the same two networks:
11546 <literallayout class="monospaced">
11547 recipient_unqualified_hosts = <; 172.16.0.0/12; \
11548 3ffe:ffff:836f::/48
11551 The separator is changed to semicolon by the leading <quote><;</quote> at the start of the
11557 <section id="SECThoslispatsikey">
11558 <title>Host list patterns for single-key lookups by host address</title>
11560 <indexterm role="concept">
11561 <primary>host list</primary>
11562 <secondary>lookup of IP address</secondary>
11564 When a host is to be identified by a single-key lookup of its complete IP
11565 address, the pattern takes this form:
11568 <literal>net-<</literal><emphasis>single-key-search-type</emphasis><literal>>;<</literal><emphasis>search-data</emphasis><literal>></literal>
11573 <literallayout class="monospaced">
11574 hosts_lookup = net-cdb;/hosts-by-ip.db
11577 The text form of the IP address of the subject host is used as the lookup key.
11578 IPv6 addresses are converted to an unabbreviated form, using lower case
11579 letters, with dots as separators because colon is the key terminator in
11580 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
11581 quoting the keys, but this is a facility that was added later.] The data
11582 returned by the lookup is not used.
11585 <indexterm role="concept">
11586 <primary>IP address</primary>
11587 <secondary>masking</secondary>
11589 <indexterm role="concept">
11590 <primary>host list</primary>
11591 <secondary>masked IP address</secondary>
11593 Single-key lookups can also be performed using masked IP addresses, using
11594 patterns of this form:
11597 <literal>net<</literal><emphasis>number</emphasis><literal>>-<</literal><emphasis>single-key-search-type</emphasis><literal>>;<</literal><emphasis>search-data</emphasis><literal>></literal>
11602 <literallayout class="monospaced">
11603 net24-dbm;/networks.db
11606 The IP address of the subject host is masked using <<emphasis>number</emphasis>> as the mask
11607 length. A textual string is constructed from the masked value, followed by the
11608 mask, and this is used as the lookup key. For example, if the host’s IP address
11609 is 192.168.34.6, the key that is looked up for the above example is
11610 <quote>192.168.34.0/24</quote>. IPv6 addresses are converted to a text value using lower
11611 case letters and dots as separators instead of the more usual colon, because
11612 colon is the key terminator in <command>lsearch</command> files. Full, unabbreviated IPv6
11613 addresses are always used.
11616 <emphasis role="bold">Warning</emphasis>: Specifing <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
11617 IPv6 address) is not the same as specifing just <option>net-</option> without a number. In
11618 the former case the key strings include the mask value, whereas in the latter
11619 case the IP address is used on its own.
11622 <section id="SECThoslispatnam">
11623 <title>Host list patterns that match by host name</title>
11625 <indexterm role="concept">
11626 <primary>host</primary>
11627 <secondary>lookup failures</secondary>
11629 <indexterm role="concept">
11630 <primary>unknown host name</primary>
11632 <indexterm role="concept">
11633 <primary>host list</primary>
11634 <secondary>matching host name</secondary>
11636 There are several types of pattern that require Exim to know the name of the
11637 remote host. These are either wildcard patterns or lookups by name. (If a
11638 complete hostname is given without any wildcarding, it is used to find an IP
11639 address to match against, as described in the section <xref linkend="SECThoslispatip"/>
11643 If the remote host name is not already known when Exim encounters one of these
11644 patterns, it has to be found from the IP address.
11645 Although many sites on the Internet are conscientious about maintaining reverse
11646 DNS data for their hosts, there are also many that do not do this.
11647 Consequently, a name cannot always be found, and this may lead to unwanted
11648 effects. Take care when configuring host lists with wildcarded name patterns.
11649 Consider what will happen if a name cannot be found.
11652 Because of the problems of determining host names from IP addresses, matching
11653 against host names is not as common as matching against IP addresses.
11656 By default, in order to find a host name, Exim first does a reverse DNS lookup;
11657 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
11658 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
11659 are done can be changed by setting the <option>host_lookup_order</option> option.
11662 There are some options that control what happens if a host name cannot be
11663 found. These are described in section <xref linkend="SECTbehipnot"/> below.
11666 <indexterm role="concept">
11667 <primary>host</primary>
11668 <secondary>alias for</secondary>
11670 <indexterm role="concept">
11671 <primary>alias for host</primary>
11673 As a result of aliasing, hosts may have more than one name. When processing any
11674 of the following types of pattern, all the host’s names are checked:
11679 <indexterm role="concept">
11680 <primary>asterisk</primary>
11681 <secondary>in host list</secondary>
11683 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
11684 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
11685 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
11686 requirement. Other kinds of wildcarding require the use of a regular
11692 <indexterm role="concept">
11693 <primary>regular expressions</primary>
11694 <secondary>in host list</secondary>
11696 <indexterm role="concept">
11697 <primary>host list</primary>
11698 <secondary>regular expression in</secondary>
11700 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
11701 matched against the host name. For example,
11703 <literallayout class="monospaced">
11707 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
11708 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
11709 that backslash and dollar characters are not misinterpreted as part of the
11710 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
11711 part of the string as non-expandable. For example:
11713 <literallayout class="monospaced">
11714 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
11717 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
11718 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
11719 example. Without it, a match at the start of the host name is all that is
11725 <section id="SECTbehipnot">
11726 <title>Behaviour when an IP address or name cannot be found</title>
11728 <indexterm role="concept">
11729 <primary>host</primary>
11730 <secondary>lookup failures</secondary>
11732 While processing a host list, Exim may need to look up an IP address from a
11733 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
11734 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
11735 behaviour when it fails to find the information it is seeking is the same.
11738 <indexterm role="concept">
11739 <primary><literal>+include_unknown</literal></primary>
11741 <indexterm role="concept">
11742 <primary><literal>+ignore_unknown</literal></primary>
11744 By default, Exim behaves as if the host does not match the list. This may not
11745 always be what you want to happen. To change Exim’s behaviour, the special
11746 items <literal>+include_unknown</literal> or <literal>+ignore_unknown</literal> may appear in the list (at
11747 top level – they are not recognized in an indirected file).
11752 If any item that follows <literal>+include_unknown</literal> requires information that
11753 cannot found, Exim behaves as if the host does match the list. For example,
11755 <literallayout class="monospaced">
11756 host_reject_connection = +include_unknown:*.enemy.ex
11759 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
11760 any hosts whose name it cannot find.
11765 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
11766 be found, Exim ignores that item and proceeds to the rest of the list. For
11769 <literallayout class="monospaced">
11770 accept hosts = +ignore_unknown : friend.example : \
11774 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
11775 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
11776 name can be found for 192.168.4.5, it is rejected.
11781 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
11782 list. The effect of each one lasts until the next, or until the end of the
11786 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
11787 apply to temporary DNS errors. They always cause a defer action (except when
11788 <option>dns_again_means_nonexist</option> converts them into permanent errors).
11791 <section id="SECThoslispatnamsk">
11792 <title>Host list patterns for single-key lookups by host name</title>
11794 <indexterm role="concept">
11795 <primary>host</primary>
11796 <secondary>lookup failures</secondary>
11798 <indexterm role="concept">
11799 <primary>unknown host name</primary>
11801 <indexterm role="concept">
11802 <primary>host list</primary>
11803 <secondary>matching host name</secondary>
11805 If a pattern is of the form
11808 <<emphasis>single-key-search-type</emphasis>>;<<emphasis>search-data</emphasis>>
11813 <literallayout class="monospaced">
11814 dbm;/host/accept/list
11817 a single-key lookup is performend, using the host name as its key. If the
11818 lookup succeeds, the host matches the item. The actual data that is looked up
11822 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
11823 keys in the file, not IP addresses. If you want to do lookups based on IP
11824 addresses, you must precede the search type with <quote>net-</quote> (see section
11825 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
11826 two items in the same list, one doing an address lookup and one doing a name
11827 lookup, both using the same file.
11831 <title>Host list patterns for query-style lookups</title>
11833 If a pattern is of the form
11836 <<emphasis>query-style-search-type</emphasis>>;<<emphasis>query</emphasis>>
11839 the query is obeyed, and if it succeeds, the host matches the item. The actual
11840 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
11841 <varname>$sender_host_name</varname> can be used in the query. For example:
11843 <literallayout class="monospaced">
11844 hosts_lookup = pgsql;\
11845 select ip from hostlist where ip='$sender_host_address'
11848 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
11849 can use the <option>sg</option> expansion item to change this if you need to. If you want to
11850 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
11854 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
11855 looks up the host name if has not already done so. (See section
11856 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
11859 Historical note: prior to release 4.30, Exim would always attempt to find a
11860 host name before running the query, unless the search type was preceded by
11861 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
11862 still recognized for query-style lookups, but its presence or absence has no
11863 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
11864 See section <xref linkend="SECThoslispatsikey"/>.)
11867 <section id="SECTmixwilhos">
11868 <title>Mixing wildcarded host names and addresses in host lists</title>
11870 <indexterm role="concept">
11871 <primary>host list</primary>
11872 <secondary>mixing names and addresses in</secondary>
11874 If you have name lookups or wildcarded host names and IP addresses in the same
11875 host list, you should normally put the IP addresses first. For example, in an
11876 ACL you could have:
11878 <literallayout class="monospaced">
11879 accept hosts = 10.9.8.7 : *.friend.example
11882 The reason for this lies in the left-to-right way that Exim processes lists.
11883 It can test IP addresses without doing any DNS lookups, but when it reaches an
11884 item that requires a host name, it fails if it cannot find a host name to
11885 compare with the pattern. If the above list is given in the opposite order, the
11886 <option>accept</option> statement fails for a host whose name cannot be found, even if its
11887 IP address is 10.9.8.7.
11890 If you really do want to do the name check first, and still recognize the IP
11891 address, you can rewrite the ACL like this:
11893 <literallayout class="monospaced">
11894 accept hosts = *.friend.example
11895 accept hosts = 10.9.8.7
11898 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
11899 <xref linkend="CHAPACL"/> for details of ACLs.
11902 <section id="SECTaddresslist">
11903 <title>Address lists</title>
11905 <indexterm role="concept">
11906 <primary>list</primary>
11907 <secondary>address list</secondary>
11909 <indexterm role="concept">
11910 <primary>address list</primary>
11911 <secondary>empty item</secondary>
11913 <indexterm role="concept">
11914 <primary>address list</primary>
11915 <secondary>patterns</secondary>
11917 Address lists contain patterns that are matched against mail addresses. There
11918 is one special case to be considered: the sender address of a bounce message is
11919 always empty. You can test for this by providing an empty item in an address
11920 list. For example, you can set up a router to process bounce messages by
11921 using this option setting:
11923 <literallayout class="monospaced">
11927 The presence of the colon creates an empty item. If you do not provide any
11928 data, the list is empty and matches nothing. The empty sender can also be
11929 detected by a regular expression that matches an empty string,
11930 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
11933 Non-empty items in an address list can be straightforward email addresses. For
11936 <literallayout class="monospaced">
11937 senders = jbc@askone.example : hs@anacreon.example
11940 A certain amount of wildcarding is permitted. If a pattern contains an @
11941 character, but is not a regular expression and does not begin with a
11942 semicolon-terminated lookup type (described below), the local part of the
11943 subject address is compared with the local part of the pattern, which may start
11944 with an asterisk. If the local parts match, the domain is checked in exactly
11945 the same way as for a pattern in a domain list. For example, the domain can be
11946 wildcarded, refer to a named list, or be a lookup:
11948 <literallayout class="monospaced">
11949 deny senders = *@*.spamming.site:\
11950 *@+hostile_domains:\
11951 bozo@partial-lsearch;/list/of/dodgy/sites:\
11952 *@dbm;/bad/domains.db
11955 <indexterm role="concept">
11956 <primary>local part</primary>
11957 <secondary>starting with !</secondary>
11959 <indexterm role="concept">
11960 <primary>address list</primary>
11961 <secondary>local part starting with !</secondary>
11963 If a local part that begins with an exclamation mark is required, it has to be
11964 specified using a regular expression, because otherwise the exclamation mark is
11965 treated as a sign of negation, as is standard in lists.
11968 If a non-empty pattern that is not a regular expression or a lookup does not
11969 contain an @ character, it is matched against the domain part of the subject
11970 address. The only two formats that are recognized this way are a literal
11971 domain, or a domain pattern that starts with *. In both these cases, the effect
11972 is the same as if <literal>*@</literal> preceded the pattern. For example:
11974 <literallayout class="monospaced">
11975 deny senders = enemy.domain : *.enemy.domain
11978 The following kinds of more complicated address list pattern can match any
11979 address, including the empty address that is characteristic of bounce message
11985 <indexterm role="concept">
11986 <primary>regular expressions</primary>
11987 <secondary>in address list</secondary>
11989 <indexterm role="concept">
11990 <primary>address list</primary>
11991 <secondary>regular expression in</secondary>
11993 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
11994 done against the complete address, with the pattern as the regular expression.
11995 You must take care that backslash and dollar characters are not misinterpreted
11996 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
11997 to mark that part of the string as non-expandable. For example:
11999 <literallayout class="monospaced">
12000 deny senders = \N^.*this.*@example\.com$\N : \
12001 \N^\d{8}.+@spamhaus.example$\N : ...
12004 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
12005 start with <quote>^</quote> by the time they are being interpreted as address patterns.
12010 <indexterm role="concept">
12011 <primary>address list</primary>
12012 <secondary>lookup for complete address</secondary>
12014 Complete addresses can be looked up by using a pattern that starts with a
12015 lookup type terminated by a semicolon, followed by the data for the lookup. For
12018 <literallayout class="monospaced">
12019 deny senders = cdb;/etc/blocked.senders : \
12020 mysql;select address from blocked where \
12021 address='${quote_mysql:$sender_address}'
12024 Both query-style and single-key lookup types can be used. For a single-key
12025 lookup type, Exim uses the complete address as the key. However, empty keys are
12026 not supported for single-key lookups, so a match against the empty address
12027 always fails. This restriction does not apply to query-style lookups.
12030 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
12031 cannot be used, and is ignored if specified, with an entry being written to the
12033 <indexterm role="concept">
12034 <primary>*@ with single-key lookup</primary>
12036 However, you can configure lookup defaults, as described in section
12037 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
12038 default. For example, with this lookup:
12040 <literallayout class="monospaced">
12041 accept senders = lsearch*@;/some/file
12044 the file could contains lines like this:
12046 <literallayout class="monospaced">
12047 user1@domain1.example
12051 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
12054 <literallayout class="monospaced">
12055 nimrod@jaeger.example
12060 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
12061 would mean that every address matches, thus rendering the test useless.
12064 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
12066 <literallayout class="monospaced">
12067 deny recipients = dbm*@;/some/file
12068 deny recipients = *@dbm;/some/file
12071 The first does a whole address lookup, with defaulting, as just described,
12072 because it starts with a lookup type. The second matches the local part and
12073 domain independently, as described in a bullet point below.
12078 The following kinds of address list pattern can match only non-empty addresses.
12079 If the subject address is empty, a match against any of these pattern types
12085 <indexterm role="concept">
12086 <primary>@@ with single-key lookup</primary>
12088 <indexterm role="concept">
12089 <primary>address list</primary>
12090 <secondary>@@ lookup type</secondary>
12092 <indexterm role="concept">
12093 <primary>address list</primary>
12094 <secondary>split local part and domain</secondary>
12096 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
12097 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
12098 split into a local part and a domain. The domain is looked up in the file. If
12099 it is not found, there is no match. If it is found, the data that is looked up
12100 from the file is treated as a colon-separated list of local part patterns, each
12101 of which is matched against the subject local part in turn.
12104 <indexterm role="concept">
12105 <primary>asterisk</primary>
12106 <secondary>in address list</secondary>
12108 The lookup may be a partial one, and/or one involving a search for a default
12109 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
12110 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
12111 even be further lookups. They may also be independently negated. For example,
12114 <literallayout class="monospaced">
12115 deny senders = @@dbm;/etc/reject-by-domain
12118 the data from which the DBM file is built could contain lines like
12120 <literallayout class="monospaced">
12121 baddomain.com: !postmaster : *
12124 to reject all senders except <option>postmaster</option> from that domain.
12127 <indexterm role="concept">
12128 <primary>local part</primary>
12129 <secondary>starting with !</secondary>
12131 If a local part that actually begins with an exclamation mark is required, it
12132 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
12133 may be split over several lines by indenting the second and subsequent lines,
12134 but the separating colon must still be included at line breaks. White space
12135 surrounding the colons is ignored. For example:
12137 <literallayout class="monospaced">
12138 aol.com: spammer1 : spammer2 : ^[0-9]+$ :
12139 spammer3 : spammer4
12142 As in all colon-separated lists in Exim, a colon can be included in an item by
12146 If the last item in the list starts with a right angle-bracket, the remainder
12147 of the item is taken as a new key to look up in order to obtain a continuation
12148 list of local parts. The new key can be any sequence of characters. Thus one
12149 might have entries like
12151 <literallayout class="monospaced">
12152 aol.com: spammer1 : spammer 2 : >*
12153 xyz.com: spammer3 : >*
12157 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
12158 local parts for all domains, in addition to the specific local parts listed for
12159 each domain. Of course, using this feature costs another lookup each time a
12160 chain is followed, but the effort needed to maintain the data is reduced.
12163 <indexterm role="concept">
12164 <primary>loop</primary>
12165 <secondary>in lookups</secondary>
12167 It is possible to construct loops using this facility, and in order to catch
12168 them, the chains may be no more than fifty items long.
12173 The @@<<emphasis>lookup</emphasis>> style of item can also be used with a query-style
12174 lookup, but in this case, the chaining facility is not available. The lookup
12175 can only return a single list of local parts.
12180 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
12181 in these two examples:
12183 <literallayout class="monospaced">
12185 senders = *@+my_list
12188 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
12189 example it is a named domain list.
12192 <section id="SECTcasletadd">
12193 <title>Case of letters in address lists</title>
12195 <indexterm role="concept">
12196 <primary>case of local parts</primary>
12198 <indexterm role="concept">
12199 <primary>address list</primary>
12200 <secondary>case forcing</secondary>
12202 <indexterm role="concept">
12203 <primary>case forcing in address lists</primary>
12205 Domains in email addresses are always handled caselessly, but for local parts
12206 case may be significant on some systems (see <option>caseful_local_part</option> for how
12207 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
12208 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
12209 blocking lists should be done in a case-independent manner. Since most address
12210 lists in Exim are used for this kind of control, Exim attempts to do this by
12214 The domain portion of an address is always lowercased before matching it to an
12215 address list. The local part is lowercased by default, and any string
12216 comparisons that take place are done caselessly. This means that the data in
12217 the address list itself, in files included as plain file names, and in any file
12218 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
12219 keys in files that are looked up by a search type other than <command>lsearch</command> (which
12220 works caselessly) must be in lower case, because these lookups are not
12224 <indexterm role="concept">
12225 <primary><literal>+caseful</literal></primary>
12227 To allow for the possibility of caseful address list matching, if an item in
12228 an address list is the string <quote>+caseful</quote>, the original case of the local
12229 part is restored for any comparisons that follow, and string comparisons are no
12230 longer case-independent. This does not affect the domain, which remains in
12231 lower case. However, although independent matches on the domain alone are still
12232 performed caselessly, regular expressions that match against an entire address
12233 become case-sensitive after <quote>+caseful</quote> has been seen.
12236 <section id="SECTlocparlis">
12237 <title>Local part lists</title>
12239 <indexterm role="concept">
12240 <primary>list</primary>
12241 <secondary>local part list</secondary>
12243 <indexterm role="concept">
12244 <primary>local part</primary>
12245 <secondary>list</secondary>
12247 Case-sensitivity in local part lists is handled in the same way as for address
12248 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
12249 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
12250 set false, the subject is lowercased and the matching is initially
12251 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
12252 matching in the local part list, but not elsewhere in the router. If
12253 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
12254 option is case-sensitive from the start.
12257 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
12258 comments are handled in the same way as address lists – they are recognized
12259 only if the # is preceded by white space or the start of the line.
12260 Otherwise, local part lists are matched in the same way as domain lists, except
12261 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
12262 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
12263 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
12265 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
12270 <chapter id="CHAPexpand">
12271 <title>String expansions</title>
12273 <indexterm role="concept" id="IIDstrexp" class="startofrange">
12274 <primary>expansion</primary>
12275 <secondary>of strings</secondary>
12277 Many strings in Exim’s run time configuration are expanded before use. Some of
12278 them are expanded every time they are used; others are expanded only once.
12281 When a string is being expanded it is copied verbatim from left to right except
12282 when a dollar or backslash character is encountered. A dollar specifies the
12283 start of a portion of the string that is interpreted and replaced as described
12284 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
12285 escape character, as described in the following section.
12287 <section id="SECTlittext">
12288 <title>Literal text in expanded strings</title>
12290 <indexterm role="concept">
12291 <primary>expansion</primary>
12292 <secondary>including literal text</secondary>
12294 An uninterpreted dollar can be included in an expanded string by putting a
12295 backslash in front of it. A backslash can be used to prevent any special
12296 character being treated specially in an expansion, including backslash itself.
12297 If the string appears in quotes in the configuration file, two backslashes are
12298 required because the quotes themselves cause interpretation of backslashes when
12299 the string is read in (see section <xref linkend="SECTstrings"/>).
12302 <indexterm role="concept">
12303 <primary>expansion</primary>
12304 <secondary>non-expandable substrings</secondary>
12306 A portion of the string can specified as non-expandable by placing it between
12307 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
12308 expressions, which often contain backslashes and dollar signs. For example:
12310 <literallayout class="monospaced">
12311 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
12314 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
12315 without interpretation until it reaches the next <literal>\N</literal> or the end of the
12320 <title>Character escape sequences in expanded strings</title>
12322 <indexterm role="concept">
12323 <primary>expansion</primary>
12324 <secondary>escape sequences</secondary>
12326 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
12327 expanded string is recognized as an escape sequence for the character newline,
12328 carriage return, or tab, respectively. A backslash followed by up to three
12329 octal digits is recognized as an octal encoding for a single character, and a
12330 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
12334 These escape sequences are also recognized in quoted strings when they are read
12335 in. Their interpretation in expansions as well is useful for unquoted strings,
12336 and for other cases such as looked-up strings that are then expanded.
12340 <title>Testing string expansions</title>
12342 <indexterm role="concept">
12343 <primary>expansion</primary>
12344 <secondary>testing</secondary>
12346 <indexterm role="concept">
12347 <primary>testing</primary>
12348 <secondary>string expansion</secondary>
12350 <indexterm role="concept">
12351 <primary><option>-be</option> option</primary>
12353 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
12354 takes the command arguments, or lines from the standard input if there are no
12355 arguments, runs them through the string expansion code, and writes the results
12356 to the standard output. Variables based on configuration values are set up, but
12357 since no message is being processed, variables such as <varname>$local_part</varname> have no
12358 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
12359 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
12360 and <option>nhash</option>.
12363 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
12364 instead runs under the uid and gid it was called with, to prevent users from
12365 using <option>-be</option> for reading files to which they do not have access.
12368 <section id="SECTforexpfai">
12369 <title>Forced expansion failure</title>
12371 <indexterm role="concept">
12372 <primary>expansion</primary>
12373 <secondary>forced failure</secondary>
12375 A number of expansions that are described in the following section have
12376 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
12377 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
12378 used depends on some condition that is evaluated as part of the expansion. If,
12379 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
12380 the entire string expansion fails in a way that can be detected by the code
12381 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
12382 its consequences depend on the circumstances. In some cases it is no different
12383 from any other expansion failure, but in others a different action may be
12384 taken. Such variations are mentioned in the documentation of the option that is
12388 <section id="SECTexpansionitems">
12389 <title>Expansion items</title>
12391 The following items are recognized in expanded strings. White space may be used
12392 between sub-items that are keywords or substrings enclosed in braces inside an
12393 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
12394 white space is significant.
12398 <term><emphasis role="bold">$</emphasis><<emphasis>variable name</emphasis>> or <emphasis role="bold">${</emphasis><<emphasis>variable name</emphasis>><emphasis role="bold">}</emphasis></term>
12401 <indexterm role="concept">
12402 <primary>expansion</primary>
12403 <secondary>variables</secondary>
12405 Substitute the contents of the named variable, for example:
12407 <literallayout class="monospaced">
12412 The second form can be used to separate the name from subsequent alphanumeric
12413 characters. This form (using braces) is available only for variables; it does
12414 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
12415 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
12416 given, the expansion fails.
12418 </listitem></varlistentry>
12420 <term><emphasis role="bold">${</emphasis><<emphasis>op</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
12423 <indexterm role="concept">
12424 <primary>expansion</primary>
12425 <secondary>operators</secondary>
12427 The string is first itself expanded, and then the operation specified by
12428 <<emphasis>op</emphasis>> is applied to it. For example:
12430 <literallayout class="monospaced">
12434 The string starts with the first character after the colon, which may be
12435 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
12436 below. The operator notation is used for simple expansion items that have just
12437 one argument, because it reduces the number of braces and therefore makes the
12438 string easier to understand.
12440 </listitem></varlistentry>
12442 <term><emphasis role="bold">${dlfunc{</emphasis><<emphasis>file</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>function</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>arg</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>arg</emphasis>><emphasis role="bold">}...}</emphasis></term>
12445 <indexterm role="concept">
12446 <primary><option>dlfunc</option></primary>
12448 This expansion dynamically loads and then calls a locally-written C function.
12449 This functionality is available only if Exim is compiled with
12451 <literallayout class="monospaced">
12455 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
12456 object so that it doesn’t reload the same object file in the same Exim process
12457 (but of course Exim does start new processes frequently).
12460 There may be from zero to eight arguments to the function. When compiling
12461 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
12462 included. The Exim variables and functions that are defined by that API
12463 are also available for dynamically loaded functions. The function itself
12464 must have the following type:
12466 <literallayout class="monospaced">
12467 int dlfunction(uschar **yield, int argc, uschar *argv[])
12470 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
12471 function should return one of the following values:
12474 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
12475 into the expanded string that is being built.
12478 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
12479 from <emphasis>yield</emphasis>, if it is set.
12482 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
12483 taken from <emphasis>yield</emphasis> if it is set.
12486 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
12489 When compiling a function that is to be used in this way with gcc,
12490 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
12491 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
12493 </listitem></varlistentry>
12495 <term><emphasis role="bold">${extract{</emphasis><<emphasis>key</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string3</emphasis>><emphasis role="bold">}}</emphasis></term>
12498 <indexterm role="concept">
12499 <primary>expansion</primary>
12500 <secondary>extracting substrings by key</secondary>
12502 <indexterm role="concept">
12503 <primary><option>extract</option></primary>
12504 <secondary>substrings by key</secondary>
12506 The key and <<emphasis>string1</emphasis>> are first expanded separately. Leading and trailing
12507 white space is removed from the key (but not from any of the strings). The key
12508 must not consist entirely of digits. The expanded <<emphasis>string1</emphasis>> must be of the
12512 <<emphasis>key1</emphasis>> = <<emphasis>value1</emphasis>> <<emphasis>key2</emphasis>> = <<emphasis>value2</emphasis>> ...
12515 <indexterm role="concept">
12516 <primary><varname>$value</varname></primary>
12518 where the equals signs and spaces (but not both) are optional. If any of the
12519 values contain white space, they must be enclosed in double quotes, and any
12520 values that are enclosed in double quotes are subject to escape processing as
12521 described in section <xref linkend="SECTstrings"/>. The expanded <<emphasis>string1</emphasis>> is searched
12522 for the value that corresponds to the key. The search is case-insensitive. If
12523 the key is found, <<emphasis>string2</emphasis>> is expanded, and replaces the whole item;
12524 otherwise <<emphasis>string3</emphasis>> is used. During the expansion of <<emphasis>string2</emphasis>> the
12525 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
12526 is restored to any previous value it might have had.
12529 If {<<emphasis>string3</emphasis>>} is omitted, the item is replaced by an empty string if the
12530 key is not found. If {<<emphasis>string2</emphasis>>} is also omitted, the value that was
12531 extracted is used. Thus, for example, these two expansions are identical, and
12532 yield <quote>2001</quote>:
12534 <literallayout class="monospaced">
12535 ${extract{gid}{uid=1984 gid=2001}}
12536 ${extract{gid}{uid=1984 gid=2001}{$value}}
12539 Instead of {<<emphasis>string3</emphasis>>} the word <quote>fail</quote> (not in curly brackets) can
12540 appear, for example:
12542 <literallayout class="monospaced">
12543 ${extract{Z}{A=... B=...}{$value} fail }
12546 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
12547 {<<emphasis>string2</emphasis>>} must be present for <quote>fail</quote> to be recognized.
12549 </listitem></varlistentry>
12551 <term><emphasis role="bold">${extract{</emphasis><<emphasis>number</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>separators</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string3</emphasis>><emphasis role="bold">}}</emphasis></term>
12554 <indexterm role="concept">
12555 <primary>expansion</primary>
12556 <secondary>extracting substrings by number</secondary>
12558 <indexterm role="concept">
12559 <primary><option>extract</option></primary>
12560 <secondary>substrings by number</secondary>
12562 The <<emphasis>number</emphasis>> argument must consist entirely of decimal digits,
12563 apart from leading and trailing white space, which is ignored.
12564 This is what distinguishes this form of <option>extract</option> from the previous kind. It
12565 behaves in the same way, except that, instead of extracting a named field, it
12566 extracts from <<emphasis>string1</emphasis>> the field whose number is given as the first
12567 argument. You can use <varname>$value</varname> in <<emphasis>string2</emphasis>> or <literal>fail</literal> instead of
12568 <<emphasis>string3</emphasis>> as before.
12571 The fields in the string are separated by any one of the characters in the
12572 separator string. These may include space or tab characters.
12573 The first field is numbered one. If the number is negative, the fields are
12574 counted from the end of the string, with the rightmost one numbered -1. If the
12575 number given is zero, the entire string is returned. If the modulus of the
12576 number is greater than the number of fields in the string, the result is the
12577 expansion of <<emphasis>string3</emphasis>>, or the empty string if <<emphasis>string3</emphasis>> is not
12578 provided. For example:
12580 <literallayout class="monospaced">
12581 ${extract{2}{:}{x:42:99:& Mailer::/bin/bash}}
12584 yields <quote>42</quote>, and
12586 <literallayout class="monospaced">
12587 ${extract{-4}{:}{x:42:99:& Mailer::/bin/bash}}
12590 yields <quote>99</quote>. Two successive separators mean that the field between them is
12591 empty (for example, the fifth field above).
12593 </listitem></varlistentry>
12595 <term><emphasis role="bold">${hash{</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string3</emphasis>><emphasis role="bold">}}</emphasis></term>
12598 <indexterm role="concept">
12599 <primary>hash function</primary>
12600 <secondary>textual</secondary>
12602 <indexterm role="concept">
12603 <primary>expansion</primary>
12604 <secondary>textual hash</secondary>
12606 This is a textual hashing function, and was the first to be implemented in
12607 early versions of Exim. In current releases, there are other hashing functions
12608 (numeric, MD5, and SHA-1), which are described below.
12611 The first two strings, after expansion, must be numbers. Call them <<emphasis>m</emphasis>> and
12612 <<emphasis>n</emphasis>>. If you are using fixed values for these numbers, that is, if
12613 <<emphasis>string1</emphasis>> and <<emphasis>string2</emphasis>> do not change when they are expanded, you can
12614 use the simpler operator notation that avoids some of the braces:
12616 <literallayout class="monospaced">
12617 ${hash_<n>_<m>:<string>}
12620 The second number is optional (in both notations). If <<emphasis>n</emphasis>> is greater than
12621 or equal to the length of the string, the expansion item returns the string.
12622 Otherwise it computes a new string of length <<emphasis>n</emphasis>> by applying a hashing
12623 function to the string. The new string consists of characters taken from the
12624 first <<emphasis>m</emphasis>> characters of the string
12626 <literallayout class="monospaced">
12627 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
12630 If <<emphasis>m</emphasis>> is not present the value 26 is used, so that only lower case
12631 letters appear. For example:
12634 <literal>$hash{3}{monty}} </literal> yields <literal>jmg</literal>
12635 <literal>$hash{5}{monty}} </literal> yields <literal>monty</literal>
12636 <literal>$hash{4}{62}{monty python}}</literal> yields <literal>fbWx</literal>
12638 </listitem></varlistentry>
12640 <term><emphasis role="bold">$header_</emphasis><<emphasis>header name</emphasis>><emphasis role="bold">:</emphasis> or <emphasis role="bold">$h_</emphasis><<emphasis>header name</emphasis>><emphasis role="bold">:</emphasis></term>
12643 See <emphasis role="bold">$rheader</emphasis> below.
12645 </listitem></varlistentry>
12647 <term><emphasis role="bold">$bheader_</emphasis><<emphasis>header name</emphasis>><emphasis role="bold">:</emphasis> or <emphasis role="bold">$bh_</emphasis><<emphasis>header name</emphasis>><emphasis role="bold">:</emphasis></term>
12650 See <emphasis role="bold">$rheader</emphasis> below.
12652 </listitem></varlistentry>
12654 <term><emphasis role="bold">$rheader_</emphasis><<emphasis>header name</emphasis>><emphasis role="bold">:</emphasis> or <emphasis role="bold">$rh_</emphasis><<emphasis>header name</emphasis>><emphasis role="bold">:</emphasis></term>
12657 <indexterm role="concept">
12658 <primary>expansion</primary>
12659 <secondary>header insertion</secondary>
12661 <indexterm role="concept">
12662 <primary><varname>$header_</varname></primary>
12664 <indexterm role="concept">
12665 <primary><varname>$bheader_</varname></primary>
12667 <indexterm role="concept">
12668 <primary><varname>$rheader_</varname></primary>
12670 <indexterm role="concept">
12671 <primary>header lines</primary>
12672 <secondary>in expansion strings</secondary>
12674 <indexterm role="concept">
12675 <primary>header lines</primary>
12676 <secondary>character sets</secondary>
12678 <indexterm role="concept">
12679 <primary>header lines</primary>
12680 <secondary>decoding</secondary>
12682 Substitute the contents of the named message header line, for example
12684 <literallayout class="monospaced">
12688 The newline that terminates a header line is not included in the expansion, but
12689 internal newlines (caused by splitting the header line over several physical
12690 lines) may be present.
12693 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
12694 the data in the header line is interpreted.
12699 <indexterm role="concept">
12700 <primary>white space</primary>
12701 <secondary>in header lines</secondary>
12703 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
12704 processing at all, and without the removal of leading and trailing white space.
12709 <indexterm role="concept">
12710 <primary>base64 encoding</primary>
12711 <secondary>in header lines</secondary>
12713 <option>bheader</option> removes leading and trailing white space, and then decodes base64
12714 or quoted-printable MIME <quote>words</quote> within the header text, but does no
12715 character set translation. If decoding of what looks superficially like a MIME
12716 <quote>word</quote> fails, the raw string is returned. If decoding
12717 <indexterm role="concept">
12718 <primary>binary zero</primary>
12719 <secondary>in header line</secondary>
12721 produces a binary zero character, it is replaced by a question mark – this is
12722 what Exim does for binary zeros that are actually received in header lines.
12727 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
12728 standard character set. This is an attempt to produce the same string as would
12729 be displayed on a user’s MUA. If translation fails, the <option>bheader</option> string is
12730 returned. Translation is attempted only on operating systems that support the
12731 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
12732 a system Makefile or in <filename>Local/Makefile</filename>.
12737 In a filter file, the target character set for <option>header</option> can be specified by a
12738 command of the following form:
12740 <literallayout class="monospaced">
12741 headers charset "UTF-8"
12744 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
12745 subsequently obeyed filter commands. In the absence of this command, the target
12746 character set in a filter is taken from the setting of the <option>headers_charset</option>
12747 option in the runtime configuration. The value of this option defaults to the
12748 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
12752 Header names follow the syntax of RFC 2822, which states that they may contain
12753 any printing characters except space and colon. Consequently, curly brackets
12754 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
12755 if they were variables. Attempting to do so causes a syntax error.
12758 Only header lines that are common to all copies of a message are visible to
12759 this mechanism. These are the original header lines that are received with the
12760 message, and any that are added by an ACL <option>warn</option> statement or by a system
12761 filter. Header lines that are added to a particular copy of a message by a
12762 router or transport are not accessible.
12765 For incoming SMTP messages, no header lines are visible in ACLs that are obeyed
12766 before the DATA ACL, because the header structure is not set up until the
12767 message is received. Header lines that are added by <option>warn</option> statements in a
12768 RCPT ACL (for example) are saved until the message’s incoming header lines
12769 are available, at which point they are added. When a DATA ACL is running,
12770 however, header lines added by earlier ACLs are visible.
12773 Upper case and lower case letters are synonymous in header names. If the
12774 following character is white space, the terminating colon may be omitted, but
12775 this is not recommended, because you may then forget it when it is needed. When
12776 white space terminates the header name, it is included in the expanded string.
12777 If the message does not contain the given header, the expansion item is
12778 replaced by an empty string. (See the <option>def</option> condition in section
12779 <xref linkend="SECTexpcond"/> for a means of testing for the existence of a header.)
12782 If there is more than one header with the same name, they are all
12783 concatenated to form the substitution string, up to a maximum length of 64K. A
12784 newline character is inserted between each line. For the <option>header</option> expansion,
12785 for those headers that contain lists of addresses, a comma is also inserted at
12786 the junctions between lines. This does not happen for the <option>rheader</option>
12789 </listitem></varlistentry>
12791 <term><emphasis role="bold">${hmac{</emphasis><<emphasis>hashname</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>secret</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}}</emphasis></term>
12794 <indexterm role="concept">
12795 <primary>expansion</primary>
12796 <secondary>hmac hashing</secondary>
12798 <indexterm role="concept">
12799 <primary><option>hmac</option></primary>
12801 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
12802 shared secret and some text into a message authentication code, as specified in
12803 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
12804 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
12805 cryptographic hash, allowing for authentication that is not possible with MD5
12806 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
12807 present. For example:
12809 <literallayout class="monospaced">
12810 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
12813 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
12816 <literallayout class="monospaced">
12817 dd97e3ba5d1a61b5006108f8c8252953
12820 As an example of how this might be used, you might put in the main part of
12821 an Exim configuration:
12823 <literallayout class="monospaced">
12824 SPAMSCAN_SECRET=cohgheeLei2thahw
12827 In a router or a transport you could then have:
12829 <literallayout class="monospaced">
12831 X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
12832 ${hmac{md5}{SPAMSCAN_SECRET}\
12833 {${primary_hostname},${message_exim_id},$h_message-id:}}
12836 Then given a message, you can check where it was scanned by looking at the
12837 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
12838 this header line is authentic by recomputing the authentication code from the
12839 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
12840 using Exim’s <option>-be</option> option, or by other means, for example by using the
12841 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
12843 </listitem></varlistentry>
12845 <term><emphasis role="bold">${if </emphasis><<emphasis>condition</emphasis>><emphasis role="bold"> {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}}</emphasis></term>
12848 <indexterm role="concept">
12849 <primary>expansion</primary>
12850 <secondary>conditional</secondary>
12852 <indexterm role="concept">
12853 <primary><option>if</option>, expansion item</primary>
12855 If <<emphasis>condition</emphasis>> is true, <<emphasis>string1</emphasis>> is expanded and replaces the whole
12856 item; otherwise <<emphasis>string2</emphasis>> is used. The available conditions are described
12857 in section <xref linkend="SECTexpcond"/> below. For example:
12859 <literallayout class="monospaced">
12860 ${if eq {$local_part}{postmaster} {yes}{no} }
12863 The second string need not be present; if it is not and the condition is not
12864 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
12865 be present instead of the second string (without any curly brackets). In this
12866 case, the expansion is forced to fail if the condition is not true (see section
12867 <xref linkend="SECTforexpfai"/>).
12870 If both strings are omitted, the result is the string <literal>true</literal> if the condition
12871 is true, and the empty string if the condition is false. This makes it less
12872 cumbersome to write custom ACL and router conditions. For example, instead of
12874 <literallayout class="monospaced">
12875 condition = ${if >{$acl_m4}{3}{true}{false}}
12880 <literallayout class="monospaced">
12881 condition = ${if >{$acl_m4}{3}}
12883 </listitem></varlistentry>
12885 <term><emphasis role="bold">${length{</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}}</emphasis></term>
12888 <indexterm role="concept">
12889 <primary>expansion</primary>
12890 <secondary>string truncation</secondary>
12892 <indexterm role="concept">
12893 <primary><option>length</option></primary>
12894 <secondary>expansion item</secondary>
12896 The <option>length</option> item is used to extract the initial portion of a string. Both
12897 strings are expanded, and the first one must yield a number, <<emphasis>n</emphasis>>, say. If
12898 you are using a fixed value for the number, that is, if <<emphasis>string1</emphasis>> does not
12899 change when expanded, you can use the simpler operator notation that avoids
12900 some of the braces:
12902 <literallayout class="monospaced">
12903 ${length_<n>:<string>}
12906 The result of this item is either the first <<emphasis>n</emphasis>> characters or the whole
12907 of <<emphasis>string2</emphasis>>, whichever is the shorter. Do not confuse <option>length</option> with
12908 <option>strlen</option>, which gives the length of a string.
12910 </listitem></varlistentry>
12912 <term><emphasis role="bold">${lookup{</emphasis><<emphasis>key</emphasis>><emphasis role="bold">} </emphasis><<emphasis>search type</emphasis>><emphasis role="bold"> {</emphasis><<emphasis>file</emphasis>><emphasis role="bold">} {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">} {</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}}</emphasis></term>
12915 This is the first of one of two different types of lookup item, which are both
12916 described in the next item.
12918 </listitem></varlistentry>
12920 <term><emphasis role="bold">${lookup </emphasis><<emphasis>search type</emphasis>><emphasis role="bold"> {</emphasis><<emphasis>query</emphasis>><emphasis role="bold">} {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">} {</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}}</emphasis></term>
12923 <indexterm role="concept">
12924 <primary>expansion</primary>
12925 <secondary>lookup in</secondary>
12927 <indexterm role="concept">
12928 <primary>file</primary>
12929 <secondary>lookups</secondary>
12931 <indexterm role="concept">
12932 <primary>lookup</primary>
12933 <secondary>in expanded string</secondary>
12935 The two forms of lookup item specify data lookups in files and databases, as
12936 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
12937 lookups, and the second is used for query-style lookups. The <<emphasis>key</emphasis>>,
12938 <<emphasis>file</emphasis>>, and <<emphasis>query</emphasis>> strings are expanded before use.
12941 If there is any white space in a lookup item which is part of a filter command,
12942 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
12943 other place where white space is significant, the lookup item must be enclosed
12944 in double quotes. The use of data lookups in users’ filter files may be locked
12945 out by the system administrator.
12948 <indexterm role="concept">
12949 <primary><varname>$value</varname></primary>
12951 If the lookup succeeds, <<emphasis>string1</emphasis>> is expanded and replaces the entire item.
12952 During its expansion, the variable <varname>$value</varname> contains the data returned by the
12953 lookup. Afterwards it reverts to the value it had previously (at the outer
12954 level it is empty). If the lookup fails, <<emphasis>string2</emphasis>> is expanded and replaces
12955 the entire item. If {<<emphasis>string2</emphasis>>} is omitted, the replacement is the empty
12956 string on failure. If <<emphasis>string2</emphasis>> is provided, it can itself be a nested
12957 lookup, thus providing a mechanism for looking up a default value when the
12958 original lookup fails.
12961 If a nested lookup is used as part of <<emphasis>string1</emphasis>>, <varname>$value</varname> contains the
12962 data for the outer lookup while the parameters of the second lookup are
12963 expanded, and also while <<emphasis>string2</emphasis>> of the second lookup is expanded, should
12964 the second lookup fail. Instead of {<<emphasis>string2</emphasis>>} the word <quote>fail</quote> can
12965 appear, and in this case, if the lookup fails, the entire expansion is forced
12966 to fail (see section <xref linkend="SECTforexpfai"/>). If both {<<emphasis>string1</emphasis>>} and
12967 {<<emphasis>string2</emphasis>>} are omitted, the result is the looked up value in the case of a
12968 successful lookup, and nothing in the case of failure.
12971 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
12972 search type in order to do partial matching, and * or *@ may follow a search
12973 type to request default lookups if the key does not match (see sections
12974 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
12977 <indexterm role="concept">
12978 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
12979 <secondary>in lookup expansion</secondary>
12981 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
12982 and non-wild parts of the key during the expansion of the replacement text.
12983 They return to their previous values at the end of the lookup item.
12986 This example looks up the postmaster alias in the conventional alias file:
12988 <literallayout class="monospaced">
12989 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
12992 This example uses NIS+ to look up the full name of the user corresponding to
12993 the local part of an address, forcing the expansion to fail if it is not found:
12995 <literallayout class="monospaced">
12996 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
12999 </listitem></varlistentry>
13001 <term><emphasis role="bold">${nhash{</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string3</emphasis>><emphasis role="bold">}}</emphasis></term>
13004 <indexterm role="concept">
13005 <primary>expansion</primary>
13006 <secondary>numeric hash</secondary>
13008 <indexterm role="concept">
13009 <primary>hash function</primary>
13010 <secondary>numeric</secondary>
13012 The three strings are expanded; the first two must yield numbers. Call them
13013 <<emphasis>n</emphasis>> and <<emphasis>m</emphasis>>. If you are using fixed values for these numbers, that is,
13014 if <<emphasis>string1</emphasis>> and <<emphasis>string2</emphasis>> do not change when they are expanded, you
13015 can use the simpler operator notation that avoids some of the braces:
13017 <literallayout class="monospaced">
13018 ${nhash_<n>_<m>:<string>}
13021 The second number is optional (in both notations). If there is only one number,
13022 the result is a number in the range 0–<<emphasis>n</emphasis>>-1. Otherwise, the string is
13023 processed by a div/mod hash function that returns two numbers, separated by a
13024 slash, in the ranges 0 to <<emphasis>n</emphasis>>-1 and 0 to <<emphasis>m</emphasis>>-1, respectively. For
13027 <literallayout class="monospaced">
13028 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
13031 returns the string <quote>6/33</quote>.
13033 </listitem></varlistentry>
13035 <term><emphasis role="bold">${perl{</emphasis><<emphasis>subroutine</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>arg</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>arg</emphasis>><emphasis role="bold">}...}</emphasis></term>
13038 <indexterm role="concept">
13039 <primary>Perl</primary>
13040 <secondary>use in expanded string</secondary>
13042 <indexterm role="concept">
13043 <primary>expansion</primary>
13044 <secondary>calling Perl from</secondary>
13046 This item is available only if Exim has been built to include an embedded Perl
13047 interpreter. The subroutine name and the arguments are first separately
13048 expanded, and then the Perl subroutine is called with those arguments. No
13049 additional arguments need be given; the maximum number permitted, including the
13050 name of the subroutine, is nine.
13053 The return value of the subroutine is inserted into the expanded string, unless
13054 the return value is <option>undef</option>. In that case, the expansion fails in the same
13055 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
13056 Whatever you return is evaluated in a scalar context. For example, if you
13057 return the name of a Perl vector, the return value is the size of the vector,
13061 If the subroutine exits by calling Perl’s <option>die</option> function, the expansion fails
13062 with the error message that was passed to <option>die</option>. More details of the embedded
13063 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
13066 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
13067 out the use of this expansion item in filter files.
13069 </listitem></varlistentry>
13071 <term><emphasis role="bold">${prvs{</emphasis><<emphasis>address</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>secret</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>keynumber</emphasis>><emphasis role="bold">}}</emphasis></term>
13074 <indexterm role="concept">
13075 <primary>prvs</primary>
13076 <secondary>expansion item</secondary>
13078 The first argument is a complete email address and the second is secret
13079 keystring. The third argument, specifying a key number, is optional. If absent,
13080 it defaults to 0. The result of the expansion is a prvs-signed email address,
13081 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
13082 as part of a bounce address tag validation (BATV) scheme. For more discussion
13083 and an example, see section <xref linkend="SECTverifyPRVS"/>.
13085 </listitem></varlistentry>
13087 <term><emphasis role="bold">${prvscheck{</emphasis><<emphasis>address</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>secret</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}}</emphasis></term>
13090 <indexterm role="concept">
13091 <primary>prvscheck</primary>
13092 <secondary>expansion item</secondary>
13094 This expansion item is the complement of the <option>prvs</option> item. It is used for
13095 checking prvs-signed addresses. If the expansion of the first argument does not
13096 yield a syntactically valid prvs-signed address, the whole item expands to the
13097 empty string. When the first argument does expand to a syntactically valid
13098 prvs-signed address, the second argument is expanded, with the prvs-decoded
13099 version of the address and the key number extracted from the address in the
13100 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
13103 These two variables can be used in the expansion of the second argument to
13104 retrieve the secret. The validity of the prvs-signed address is then checked
13105 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
13106 which is empty for failure or <quote>1</quote> for success.
13109 The third argument is optional; if it is missing, it defaults to an empty
13110 string. This argument is now expanded. If the result is an empty string, the
13111 result of the expansion is the decoded version of the address. This is the case
13112 whether or not the signature was valid. Otherwise, the result of the expansion
13113 is the expansion of the third argument.
13116 All three variables can be used in the expansion of the third argument.
13117 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
13118 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
13120 </listitem></varlistentry>
13122 <term><emphasis role="bold">${readfile{</emphasis><<emphasis>file name</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>eol string</emphasis>><emphasis role="bold">}}</emphasis></term>
13125 <indexterm role="concept">
13126 <primary>expansion</primary>
13127 <secondary>inserting an entire file</secondary>
13129 <indexterm role="concept">
13130 <primary>file</primary>
13131 <secondary>inserting into expansion</secondary>
13133 <indexterm role="concept">
13134 <primary><option>readfile</option> expansion item</primary>
13136 The file name and end-of-line string are first expanded separately. The file is
13137 then read, and its contents replace the entire item. All newline characters in
13138 the file are replaced by the end-of-line string if it is present. Otherwise,
13139 newlines are left in the string.
13140 String expansion is not applied to the contents of the file. If you want this,
13141 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
13142 the string expansion fails.
13145 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
13146 locks out the use of this expansion item in filter files.
13148 </listitem></varlistentry>
13150 <term><emphasis role="bold">${readsocket{</emphasis><<emphasis>name</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>request</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>timeout</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>eol string</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>fail string</emphasis>><emphasis role="bold">}}</emphasis></term>
13153 <indexterm role="concept">
13154 <primary>expansion</primary>
13155 <secondary>inserting from a socket</secondary>
13157 <indexterm role="concept">
13158 <primary>socket</primary>
13159 <secondary>use of in expansion</secondary>
13161 <indexterm role="concept">
13162 <primary><option>readsocket</option> expansion item</primary>
13164 This item inserts data from a Unix domain or Internet socket into the expanded
13165 string. The minimal way of using it uses just two arguments, as in these
13168 <literallayout class="monospaced">
13169 ${readsocket{/socket/name}{request string}}
13170 ${readsocket{inet:some.host:1234}{request string}}
13173 For a Unix domain socket, the first substring must be the path to the socket.
13174 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
13175 a host name or IP address, followed by a colon and a port, which can be a
13176 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
13177 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
13180 <literallayout class="monospaced">
13181 ${readsocket{inet:[::1]:1234}{request string}}
13184 Only a single host name may be given, but if looking it up yields more than
13185 one IP address, they are each tried in turn until a connection is made. For
13186 both kinds of socket, Exim makes a connection, writes the request string
13187 (unless it is an empty string) and reads from the socket until an end-of-file
13188 is read. A timeout of 5 seconds is applied. Additional, optional arguments
13189 extend what can be done. Firstly, you can vary the timeout. For example:
13191 <literallayout class="monospaced">
13192 ${readsocket{/socket/name}{request string}{3s}}
13195 A fourth argument allows you to change any newlines that are in the data
13196 that is read, in the same way as for <option>readfile</option> (see above). This example
13197 turns them into spaces:
13199 <literallayout class="monospaced">
13200 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
13203 As with all expansions, the substrings are expanded before the processing
13204 happens. Errors in these sub-expansions cause the expansion to fail. In
13205 addition, the following errors can occur:
13210 Failure to create a socket file descriptor;
13215 Failure to connect the socket;
13220 Failure to write the request string;
13225 Timeout on reading from the socket.
13230 By default, any of these errors causes the expansion to fail. However, if
13231 you supply a fifth substring, it is expanded and used when any of the above
13232 errors occurs. For example:
13234 <literallayout class="monospaced">
13235 ${readsocket{/socket/name}{request string}{3s}{\n}\
13239 You can test for the existence of a Unix domain socket by wrapping this
13240 expansion in <literal>${if exists</literal>, but there is a race condition between that test
13241 and the actual opening of the socket, so it is safer to use the fifth argument
13242 if you want to be absolutely sure of avoiding an expansion error for a
13243 non-existent Unix domain socket, or a failure to connect to an Internet socket.
13246 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
13247 locks out the use of this expansion item in filter files.
13249 </listitem></varlistentry>
13251 <term><emphasis role="bold">$rheader_</emphasis><<emphasis>header name</emphasis>><emphasis role="bold">: or $rh_</emphasis><<emphasis>header name</emphasis>><emphasis role="bold">:</emphasis></term>
13254 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
13255 expansion item above.
13257 </listitem></varlistentry>
13259 <term><emphasis role="bold">${run{</emphasis><<emphasis>command</emphasis>><emphasis role="bold"> </emphasis><<emphasis>args</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}}</emphasis></term>
13262 <indexterm role="concept">
13263 <primary>expansion</primary>
13264 <secondary>running a command</secondary>
13266 <indexterm role="concept">
13267 <primary><option>run</option> expansion item</primary>
13269 The command and its arguments are first expanded separately, and then the
13270 command is run in a separate process, but under the same uid and gid. As in
13271 other command executions from Exim, a shell is not used by default. If you want
13272 a shell, you must explicitly code it.
13275 <indexterm role="concept">
13276 <primary>return code</primary>
13277 <secondary>from <option>run</option> expansion</secondary>
13279 <indexterm role="concept">
13280 <primary><varname>$value</varname></primary>
13282 If the command succeeds (gives a zero return code) <<emphasis>string1</emphasis>> is expanded
13283 and replaces the entire item; during this expansion, the standard output from
13284 the command is in the variable <varname>$value</varname>. If the command fails, <<emphasis>string2</emphasis>>,
13285 if present, is expanded and used. Once again, during the expansion, the
13286 standard output from the command is in the variable <varname>$value</varname>. If <<emphasis>string2</emphasis>>
13287 is absent, the result is empty. Alternatively, <<emphasis>string2</emphasis>> can be the word
13288 <quote>fail</quote> (not in braces) to force expansion failure if the command does not
13289 succeed. If both strings are omitted, the result is contents of the standard
13290 output on success, and nothing on failure.
13293 <indexterm role="concept">
13294 <primary><varname>$runrc</varname></primary>
13296 The return code from the command is put in the variable <varname>$runrc</varname>, and this
13297 remains set afterwards, so in a filter file you can do things like this:
13299 <literallayout class="monospaced">
13300 if "${run{x y z}{}}$runrc" is 1 then ...
13301 elif $runrc is 2 then ...
13306 If execution of the command fails (for example, the command does not exist),
13307 the return code is 127 – the same code that shells use for non-existent
13311 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
13312 option values are expanded, except for those preconditions whose order of
13313 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
13314 by the expansion of one option, and use it in another.
13317 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
13318 out the use of this expansion item in filter files.
13320 </listitem></varlistentry>
13322 <term><emphasis role="bold">${sg{</emphasis><<emphasis>subject</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>regex</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>replacement</emphasis>><emphasis role="bold">}}</emphasis></term>
13325 <indexterm role="concept">
13326 <primary>expansion</primary>
13327 <secondary>string substitution</secondary>
13329 <indexterm role="concept">
13330 <primary><option>sg</option> expansion item</primary>
13332 This item works like Perl’s substitution operator (s) with the global (/g)
13333 option; hence its name. However, unlike the Perl equivalent, Exim does not
13334 modify the subject string; instead it returns the modified string for insertion
13335 into the overall expansion. The item takes three arguments: the subject string,
13336 a regular expression, and a substitution string. For example:
13338 <literallayout class="monospaced">
13339 ${sg{abcdefabcdef}{abc}{xyz}}
13342 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
13343 if any $ or \ characters are required in the regular expression or in the
13344 substitution string, they have to be escaped. For example:
13346 <literallayout class="monospaced">
13347 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
13350 yields <quote>defabc</quote>, and
13352 <literallayout class="monospaced">
13353 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
13356 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
13357 the regular expression from string expansion.
13359 </listitem></varlistentry>
13361 <term><emphasis role="bold">${substr{</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string3</emphasis>><emphasis role="bold">}}</emphasis></term>
13364 <indexterm role="concept">
13365 <primary><option>substr</option></primary>
13367 <indexterm role="concept">
13368 <primary>substring extraction</primary>
13370 <indexterm role="concept">
13371 <primary>expansion</primary>
13372 <secondary>substring extraction</secondary>
13374 The three strings are expanded; the first two must yield numbers. Call them
13375 <<emphasis>n</emphasis>> and <<emphasis>m</emphasis>>. If you are using fixed values for these numbers, that is,
13376 if <<emphasis>string1</emphasis>> and <<emphasis>string2</emphasis>> do not change when they are expanded, you
13377 can use the simpler operator notation that avoids some of the braces:
13379 <literallayout class="monospaced">
13380 ${substr_<n>_<m>:<string>}
13383 The second number is optional (in both notations).
13384 If it is absent in the simpler format, the preceding underscore must also be
13388 The <option>substr</option> item can be used to extract more general substrings than
13389 <option>length</option>. The first number, <<emphasis>n</emphasis>>, is a starting offset, and <<emphasis>m</emphasis>> is the
13390 length required. For example
13392 <literallayout class="monospaced">
13393 ${substr{3}{2}{$local_part}}
13396 If the starting offset is greater than the string length the result is the
13397 null string; if the length plus starting offset is greater than the string
13398 length, the result is the right-hand part of the string, starting from the
13399 given offset. The first character in the string has offset zero.
13402 The <option>substr</option> expansion item can take negative offset values to count
13403 from the right-hand end of its operand. The last character is offset -1, the
13404 second-last is offset -2, and so on. Thus, for example,
13406 <literallayout class="monospaced">
13407 ${substr{-5}{2}{1234567}}
13410 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
13411 length of the string, the substring starts at the beginning of the string, and
13412 the length is reduced by the amount of overshoot. Thus, for example,
13414 <literallayout class="monospaced">
13415 ${substr{-5}{2}{12}}
13418 yields an empty string, but
13420 <literallayout class="monospaced">
13421 ${substr{-3}{2}{12}}
13424 yields <quote>1</quote>.
13427 When the second number is omitted from <option>substr</option>, the remainder of the string
13428 is taken if the offset is positive. If it is negative, all characters in the
13429 string preceding the offset point are taken. For example, an offset of -1 and
13430 no length, as in these semantically identical examples:
13432 <literallayout class="monospaced">
13434 ${substr{-1}{abcde}}
13437 yields all but the last character of the string, that is, <quote>abcd</quote>.
13439 </listitem></varlistentry>
13441 <term><emphasis role="bold">${tr{</emphasis><<emphasis>subject</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>characters</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>replacements</emphasis>><emphasis role="bold">}}</emphasis></term>
13444 <indexterm role="concept">
13445 <primary>expansion</primary>
13446 <secondary>character translation</secondary>
13448 <indexterm role="concept">
13449 <primary><option>tr</option> expansion item</primary>
13451 This item does single-character translation on its subject string. The second
13452 argument is a list of characters to be translated in the subject string. Each
13453 matching character is replaced by the corresponding character from the
13454 replacement list. For example
13456 <literallayout class="monospaced">
13457 ${tr{abcdea}{ac}{13}}
13460 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
13461 last occurrence is used. If the third string is shorter than the second, its
13462 last character is replicated. However, if it is empty, no translation takes
13465 </listitem></varlistentry>
13468 <section id="SECTexpop">
13469 <title>Expansion operators</title>
13471 <indexterm role="concept">
13472 <primary>expansion</primary>
13473 <secondary>operators</secondary>
13475 For expansion items that perform transformations on a single argument string,
13476 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
13477 The substring is first expanded before the operation is applied to it. The
13478 following operations can be performed:
13482 <term><emphasis role="bold">${address:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13485 <indexterm role="concept">
13486 <primary>expansion</primary>
13487 <secondary>RFC 2822 address handling</secondary>
13489 <indexterm role="concept">
13490 <primary><option>address</option></primary>
13491 <secondary>expansion item</secondary>
13493 The string is interpreted as an RFC 2822 address, as it might appear in a
13494 header line, and the effective address is extracted from it. If the string does
13495 not parse successfully, the result is empty.
13497 </listitem></varlistentry>
13499 <term><emphasis role="bold">${base62:</emphasis><<emphasis>digits</emphasis>><emphasis role="bold">}</emphasis></term>
13502 <indexterm role="concept">
13503 <primary><option>base62</option></primary>
13505 <indexterm role="concept">
13506 <primary>expansion</primary>
13507 <secondary>conversion to base 62</secondary>
13509 The string must consist entirely of decimal digits. The number is converted to
13510 base 62 and output as a string of six characters, including leading zeros. In
13511 the few operating environments where Exim uses base 36 instead of base 62 for
13512 its message identifiers (because those systems do not have case-sensitive file
13513 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
13514 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
13516 </listitem></varlistentry>
13518 <term><emphasis role="bold">${base62d:</emphasis><<emphasis>base-62 digits</emphasis>><emphasis role="bold">}</emphasis></term>
13521 <indexterm role="concept">
13522 <primary><option>base62d</option></primary>
13524 <indexterm role="concept">
13525 <primary>expansion</primary>
13526 <secondary>conversion to base 62</secondary>
13528 The string must consist entirely of base-62 digits, or, in operating
13529 environments where Exim uses base 36 instead of base 62 for its message
13530 identifiers, base-36 digits. The number is converted to decimal and output as a
13533 </listitem></varlistentry>
13535 <term><emphasis role="bold">${domain:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13538 <indexterm role="concept">
13539 <primary>domain</primary>
13540 <secondary>extraction</secondary>
13542 <indexterm role="concept">
13543 <primary>expansion</primary>
13544 <secondary>domain extraction</secondary>
13546 The string is interpreted as an RFC 2822 address and the domain is extracted
13547 from it. If the string does not parse successfully, the result is empty.
13549 </listitem></varlistentry>
13551 <term><emphasis role="bold">${escape:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13554 <indexterm role="concept">
13555 <primary>expansion</primary>
13556 <secondary>escaping non-printing characters</secondary>
13558 <indexterm role="concept">
13559 <primary><option>escape</option>, expansion item</primary>
13561 If the string contains any non-printing characters, they are converted to
13562 escape sequences starting with a backslash. Whether characters with the most
13563 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
13564 is controlled by the <option>print_topbitchars</option> option.
13566 </listitem></varlistentry>
13568 <term><emphasis role="bold">${eval:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis> and <emphasis role="bold">${eval10:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13571 <indexterm role="concept">
13572 <primary>expansion</primary>
13573 <secondary>expression evaluation</secondary>
13575 <indexterm role="concept">
13576 <primary>expansion</primary>
13577 <secondary>arithmetic expression</secondary>
13579 <indexterm role="concept">
13580 <primary><option>eval</option> expansion item</primary>
13582 These items supports simple arithmetic in expansion strings. The string (after
13583 expansion) must be a conventional arithmetic expression, but it is limited to
13584 five basic operators (plus, minus, times, divide, remainder) and parentheses.
13585 All operations are carried out using integer arithmetic. Plus and minus have a
13586 lower priority than times, divide, and remainder; operators with the same
13587 priority are evaluated from left to right.
13589 <para revisionflag="changed">
13590 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
13591 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
13592 decimal, even if they start with a leading zero; hexadecimal numbers are not
13593 permitted. This can be useful when processing numbers extracted from dates or
13594 times, which often do have leading zeros.
13597 A number may be followed by <quote>K</quote> or <quote>M</quote> to multiply it by 1024 or 1024*1024,
13598 respectively. Negative numbers are supported. The result of the computation is
13599 a decimal representation of the answer (without <quote>K</quote> or <quote>M</quote>). For example:
13602 <literal>${eval:1+1} </literal> yields 2
13603 <literal>${eval:1+2*3} </literal> yields 7
13604 <literal>${eval:(1+2)*3} </literal> yields 9
13605 <literal>${eval:2+42%5} </literal> yields 4
13608 As a more realistic example, in an ACL you might have
13610 <literallayout class="monospaced">
13611 deny message = Too many bad recipients
13614 {>{$rcpt_count}{10}} \
13617 {$recipients_count} \
13618 {${eval:$rcpt_count/2}} \
13623 The condition is true if there have been more than 10 RCPT commands and
13624 fewer than half of them have resulted in a valid recipient.
13626 </listitem></varlistentry>
13628 <term><emphasis role="bold">${expand:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13631 <indexterm role="concept">
13632 <primary>expansion</primary>
13633 <secondary>re-expansion of substring</secondary>
13635 The <option>expand</option> operator causes a string to be expanded for a second time. For
13638 <literallayout class="monospaced">
13639 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
13642 first looks up a string in a file while expanding the operand for <option>expand</option>,
13643 and then re-expands what it has found.
13645 </listitem></varlistentry>
13647 <term><emphasis role="bold">${from_utf8:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13650 <indexterm role="concept">
13651 <primary>Unicode</primary>
13653 <indexterm role="concept">
13654 <primary>UTF-8</primary>
13655 <secondary>conversion from</secondary>
13657 <indexterm role="concept">
13658 <primary>expansion</primary>
13659 <secondary>UTF-8 conversion</secondary>
13661 <indexterm role="concept">
13662 <primary><option>from_utf8</option></primary>
13664 The world is slowly moving towards Unicode, although there are no standards for
13665 email yet. However, other applications (including some databases) are starting
13666 to store data in Unicode, using UTF-8 encoding. This operator converts from a
13667 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
13668 converted to underscores. The input must be a valid UTF-8 string. If it is not,
13669 the result is an undefined sequence of bytes.
13672 Unicode code points with values less than 256 are compatible with ASCII and
13673 ISO-8859-1 (also known as Latin-1).
13674 For example, character 169 is the copyright symbol in both cases, though the
13675 way it is encoded is different. In UTF-8, more than one byte is needed for
13676 characters with code values greater than 127, whereas ISO-8859-1 is a
13677 single-byte encoding (but thereby limited to 256 characters). This makes
13678 translation from UTF-8 to ISO-8859-1 straightforward.
13680 </listitem></varlistentry>
13682 <term><emphasis role="bold">${hash_</emphasis><<emphasis>n</emphasis>><emphasis role="bold">_</emphasis><<emphasis>m</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13685 <indexterm role="concept">
13686 <primary>hash function</primary>
13687 <secondary>textual</secondary>
13689 <indexterm role="concept">
13690 <primary>expansion</primary>
13691 <secondary>textual hash</secondary>
13693 The <option>hash</option> operator is a simpler interface to the hashing function that can
13694 be used when the two parameters are fixed numbers (as opposed to strings that
13695 change when expanded). The effect is the same as
13697 <literallayout class="monospaced">
13698 ${hash{<n>}{<m>}{<string>}}
13701 See the description of the general <option>hash</option> item above for details. The
13702 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
13704 </listitem></varlistentry>
13706 <term><emphasis role="bold">${hex2b64:</emphasis><<emphasis>hexstring</emphasis>><emphasis role="bold">}</emphasis></term>
13709 <indexterm role="concept">
13710 <primary>base64 encoding</primary>
13711 <secondary>conversion from hex</secondary>
13713 <indexterm role="concept">
13714 <primary>expansion</primary>
13715 <secondary>hex to base64</secondary>
13717 <indexterm role="concept">
13718 <primary><option>hex2b64</option></primary>
13720 This operator converts a hex string into one that is base64 encoded. This can
13721 be useful for processing the output of the MD5 and SHA-1 hashing functions.
13723 </listitem></varlistentry>
13725 <term><emphasis role="bold">${lc:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13728 <indexterm role="concept">
13729 <primary>case forcing in strings</primary>
13731 <indexterm role="concept">
13732 <primary>string</primary>
13733 <secondary>case forcing</secondary>
13735 <indexterm role="concept">
13736 <primary>lower casing</primary>
13738 <indexterm role="concept">
13739 <primary>expansion</primary>
13740 <secondary>case forcing</secondary>
13742 <indexterm role="concept">
13743 <primary><option>lc</option> expansion item</primary>
13745 This forces the letters in the string into lower-case, for example:
13747 <literallayout class="monospaced">
13750 </listitem></varlistentry>
13752 <term><emphasis role="bold">${length_</emphasis><<emphasis>number</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13755 <indexterm role="concept">
13756 <primary>expansion</primary>
13757 <secondary>string truncation</secondary>
13759 <indexterm role="concept">
13760 <primary><option>length</option></primary>
13761 <secondary>expansion item</secondary>
13763 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
13764 can be used when the parameter is a fixed number (as opposed to a string that
13765 changes when expanded). The effect is the same as
13767 <literallayout class="monospaced">
13768 ${length{<number>}{<string>}}
13771 See the description of the general <option>length</option> item above for details. Note that
13772 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
13773 when <option>length</option> is used as an operator.
13775 </listitem></varlistentry>
13777 <term><emphasis role="bold">${local_part:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13780 <indexterm role="concept">
13781 <primary>expansion</primary>
13782 <secondary>local part extraction</secondary>
13784 <indexterm role="concept">
13785 <primary><option>local_part</option> expansion item</primary>
13787 The string is interpreted as an RFC 2822 address and the local part is
13788 extracted from it. If the string does not parse successfully, the result is
13791 </listitem></varlistentry>
13793 <term><emphasis role="bold">${mask:</emphasis><<emphasis>IP address</emphasis>><emphasis role="bold">/</emphasis><<emphasis>bit count</emphasis>><emphasis role="bold">}</emphasis></term>
13796 <indexterm role="concept">
13797 <primary>masked IP address</primary>
13799 <indexterm role="concept">
13800 <primary>IP address</primary>
13801 <secondary>masking</secondary>
13803 <indexterm role="concept">
13804 <primary>CIDR notation</primary>
13806 <indexterm role="concept">
13807 <primary>expansion</primary>
13808 <secondary>IP address masking</secondary>
13810 <indexterm role="concept">
13811 <primary><option>mask</option>, expansion item</primary>
13813 If the form of the string to be operated on is not an IP address followed by a
13814 slash and an integer (that is, a network address in CIDR notation), the
13815 expansion fails. Otherwise, this operator converts the IP address to binary,
13816 masks off the least significant bits according to the bit count, and converts
13817 the result back to text, with mask appended. For example,
13819 <literallayout class="monospaced">
13820 ${mask:10.111.131.206/28}
13823 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
13824 be mostly used for looking up masked addresses in files, the result for an IPv6
13825 address uses dots to separate components instead of colons, because colon
13826 terminates a key string in lsearch files. So, for example,
13828 <literallayout class="monospaced">
13829 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
13834 <literallayout class="monospaced">
13835 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
13838 Letters in IPv6 addresses are always output in lower case.
13840 </listitem></varlistentry>
13842 <term><emphasis role="bold">${md5:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13845 <indexterm role="concept">
13846 <primary>MD5 hash</primary>
13848 <indexterm role="concept">
13849 <primary>expansion</primary>
13850 <secondary>MD5 hash</secondary>
13852 <indexterm role="concept">
13853 <primary><option>md5</option> expansion item</primary>
13855 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
13856 as a 32-digit hexadecimal number, in which any letters are in lower case.
13858 </listitem></varlistentry>
13860 <term><emphasis role="bold">${nhash_</emphasis><<emphasis>n</emphasis>><emphasis role="bold">_</emphasis><<emphasis>m</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13863 <indexterm role="concept">
13864 <primary>expansion</primary>
13865 <secondary>numeric hash</secondary>
13867 <indexterm role="concept">
13868 <primary>hash function</primary>
13869 <secondary>numeric</secondary>
13871 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
13872 that can be used when the two parameters are fixed numbers (as opposed to
13873 strings that change when expanded). The effect is the same as
13875 <literallayout class="monospaced">
13876 ${nhash{<n>}{<m>}{<string>}}
13879 See the description of the general <option>nhash</option> item above for details.
13881 </listitem></varlistentry>
13883 <term><emphasis role="bold">${quote:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13886 <indexterm role="concept">
13887 <primary>quoting</primary>
13888 <secondary>in string expansions</secondary>
13890 <indexterm role="concept">
13891 <primary>expansion</primary>
13892 <secondary>quoting</secondary>
13894 <indexterm role="concept">
13895 <primary><option>quote</option>, expansion item</primary>
13897 The <option>quote</option> operator puts its argument into double quotes if it
13898 is an empty string or
13899 contains anything other than letters, digits, underscores, dots, and hyphens.
13900 Any occurrences of double quotes and backslashes are escaped with a backslash.
13901 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
13902 respectively For example,
13904 <literallayout class="monospaced">
13910 <literallayout class="monospaced">
13914 The place where this is useful is when the argument is a substitution from a
13915 variable or a message header.
13917 </listitem></varlistentry>
13919 <term><emphasis role="bold">${quote_local_part:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13922 <indexterm role="concept">
13923 <primary><option>quote_local_part</option> expansion item</primary>
13925 This operator is like <option>quote</option>, except that it quotes the string only if
13926 required to do so by the rules of RFC 2822 for quoting local parts. For
13927 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
13928 If you are creating a new email address from the contents of <varname>$local_part</varname>
13929 (or any other unknown data), you should always use this operator.
13931 </listitem></varlistentry>
13933 <term><emphasis role="bold">${quote_</emphasis><<emphasis>lookup-type</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13936 <indexterm role="concept">
13937 <primary>quoting</primary>
13938 <secondary>lookup-specific</secondary>
13940 This operator applies lookup-specific quoting rules to the string. Each
13941 query-style lookup type has its own quoting rules which are described with
13942 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
13944 <literallayout class="monospaced">
13945 ${quote_ldap:two * two}
13950 <literallayout class="monospaced">
13954 For single-key lookup types, no quoting is ever necessary and this operator
13955 yields an unchanged string.
13957 </listitem></varlistentry>
13959 <term><emphasis role="bold">${rfc2047:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13962 <indexterm role="concept">
13963 <primary>expansion</primary>
13964 <secondary>RFC 2047</secondary>
13966 <indexterm role="concept">
13967 <primary>RFC 2047</primary>
13968 <secondary>expansion operator</secondary>
13970 <indexterm role="concept">
13971 <primary><option>rfc2047</option> expansion item</primary>
13973 This operator encodes text according to the rules of RFC 2047. This is an
13974 encoding that is used in header lines to encode non-ASCII characters. It is
13975 assumed that the input string is in the encoding specified by the
13976 <option>headers_charset</option> option, which defaults to ISO-8859-1. If the string
13977 contains only characters in the range 33–126, and no instances of the
13980 <literallayout class="monospaced">
13981 ? = ( ) < > @ , ; : \ " . [ ] _
13984 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
13985 string, using as many <quote>encoded words</quote> as necessary to encode all the
13988 </listitem></varlistentry>
13990 <term><emphasis role="bold">${rxquote:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13993 <indexterm role="concept">
13994 <primary>quoting</primary>
13995 <secondary>in regular expressions</secondary>
13997 <indexterm role="concept">
13998 <primary>regular expressions</primary>
13999 <secondary>quoting</secondary>
14001 <indexterm role="concept">
14002 <primary><option>rxquote</option> expansion item</primary>
14004 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
14005 characters in its argument. This is useful when substituting the values of
14006 variables or headers inside regular expressions.
14008 </listitem></varlistentry>
14010 <term><emphasis role="bold">${sha1:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14013 <indexterm role="concept">
14014 <primary>SHA-1 hash</primary>
14016 <indexterm role="concept">
14017 <primary>expansion</primary>
14018 <secondary>SHA-1 hashing</secondary>
14020 <indexterm role="concept">
14021 <primary><option>sha2</option> expansion item</primary>
14023 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
14024 it as a 40-digit hexadecimal number, in which any letters are in upper case.
14026 </listitem></varlistentry>
14028 <term><emphasis role="bold">${stat:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14031 <indexterm role="concept">
14032 <primary>expansion</primary>
14033 <secondary>statting a file</secondary>
14035 <indexterm role="concept">
14036 <primary>file</primary>
14037 <secondary>extracting characteristics</secondary>
14039 <indexterm role="concept">
14040 <primary><option>stat</option> expansion item</primary>
14042 The string, after expansion, must be a file path. A call to the <function>stat()</function>
14043 function is made for this path. If <function>stat()</function> fails, an error occurs and the
14044 expansion fails. If it succeeds, the data from the stat replaces the item, as a
14045 series of <<emphasis>name</emphasis>>=<<emphasis>value</emphasis>> pairs, where the values are all numerical,
14046 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
14047 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
14048 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
14049 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
14050 can extract individual fields using the <option>extract</option> expansion item.
14053 The use of the <option>stat</option> expansion in users’ filter files can be locked out by
14054 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
14055 systems for files larger than 2GB.
14057 </listitem></varlistentry>
14059 <term><emphasis role="bold">${str2b64:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14062 <indexterm role="concept">
14063 <primary>expansion</primary>
14064 <secondary>base64 encoding</secondary>
14066 <indexterm role="concept">
14067 <primary>base64 encoding</primary>
14068 <secondary>in string expansion</secondary>
14070 <indexterm role="concept">
14071 <primary><option>str2b64</option> expansion item</primary>
14073 This operator converts a string into one that is base64 encoded.
14075 </listitem></varlistentry>
14077 <term><emphasis role="bold">${strlen:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14080 <indexterm role="concept">
14081 <primary>expansion</primary>
14082 <secondary>string length</secondary>
14084 <indexterm role="concept">
14085 <primary>string</primary>
14086 <secondary>length in expansion</secondary>
14088 <indexterm role="concept">
14089 <primary><option>strlen</option> expansion item</primary>
14091 The item is replace by the length of the expanded string, expressed as a
14092 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
14094 </listitem></varlistentry>
14096 <term><emphasis role="bold">${substr_</emphasis><<emphasis>start</emphasis>><emphasis role="bold">_</emphasis><<emphasis>length</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14099 <indexterm role="concept">
14100 <primary><option>substr</option> expansion item</primary>
14102 <indexterm role="concept">
14103 <primary>substring extraction</primary>
14105 <indexterm role="concept">
14106 <primary>expansion</primary>
14107 <secondary>substring expansion</secondary>
14109 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
14110 can be used when the two parameters are fixed numbers (as opposed to strings
14111 that change when expanded). The effect is the same as
14113 <literallayout class="monospaced">
14114 ${substr{<start>}{<length>}{<string>}}
14117 See the description of the general <option>substr</option> item above for details. The
14118 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
14120 </listitem></varlistentry>
14122 <term><emphasis role="bold">${time_eval:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14125 <indexterm role="concept">
14126 <primary><option>time_eval</option> expansion item</primary>
14128 <indexterm role="concept">
14129 <primary>time interval</primary>
14130 <secondary>decoding</secondary>
14132 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
14135 </listitem></varlistentry>
14137 <term><emphasis role="bold">${time_interval:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14140 <indexterm role="concept">
14141 <primary><option>time_interval</option> expansion item</primary>
14143 <indexterm role="concept">
14144 <primary>time interval</primary>
14145 <secondary>formatting</secondary>
14147 The argument (after sub-expansion) must be a sequence of decimal digits that
14148 represents an interval of time as a number of seconds. It is converted into a
14149 number of larger units and output in Exim’s normal time format, for example,
14150 <literal>1w3d4h2m6s</literal>.
14152 </listitem></varlistentry>
14154 <term><emphasis role="bold">${uc:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14157 <indexterm role="concept">
14158 <primary>case forcing in strings</primary>
14160 <indexterm role="concept">
14161 <primary>string</primary>
14162 <secondary>case forcing</secondary>
14164 <indexterm role="concept">
14165 <primary>upper casing</primary>
14167 <indexterm role="concept">
14168 <primary>expansion</primary>
14169 <secondary>case forcing</secondary>
14171 <indexterm role="concept">
14172 <primary><option>uc</option> expansion item</primary>
14174 This forces the letters in the string into upper-case.
14176 </listitem></varlistentry>
14179 <section id="SECTexpcond">
14180 <title>Expansion conditions</title>
14182 <indexterm role="concept">
14183 <primary>expansion</primary>
14184 <secondary>conditions</secondary>
14186 The following conditions are available for testing by the <option>${if</option> construct
14187 while expanding strings:
14191 <term><emphasis role="bold">!</emphasis><<emphasis>condition</emphasis>></term>
14194 <indexterm role="concept">
14195 <primary>expansion</primary>
14196 <secondary>negating a condition</secondary>
14198 <indexterm role="concept">
14199 <primary>negation</primary>
14200 <secondary>in expansion condition</secondary>
14202 Preceding any condition with an exclamation mark negates the result of the
14205 </listitem></varlistentry>
14207 <term><<emphasis>symbolic operator</emphasis>> <emphasis role="bold">{</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14210 <indexterm role="concept">
14211 <primary>numeric comparison</primary>
14213 <indexterm role="concept">
14214 <primary>expansion</primary>
14215 <secondary>numeric comparison</secondary>
14217 There are a number of symbolic operators for doing numeric comparisons. They
14221 <literal>= </literal> equal
14222 <literal>== </literal> equal
14223 <literal>> </literal> greater
14224 <literal>>= </literal> greater or equal
14225 <literal>< </literal> less
14226 <literal><= </literal> less or equal
14231 <literallayout class="monospaced">
14232 ${if >{$message_size}{10M} ...
14235 Note that the general negation operator provides for inequality testing. The
14236 two strings must take the form of optionally signed decimal integers,
14237 optionally followed by one of the letters <quote>K</quote> or <quote>M</quote> (in either upper or
14238 lower case), signifying multiplication by 1024 or 1024*1024, respectively.
14240 </listitem></varlistentry>
14242 <term><emphasis role="bold">crypteq {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14245 <indexterm role="concept">
14246 <primary>expansion</primary>
14247 <secondary>encrypted comparison</secondary>
14249 <indexterm role="concept">
14250 <primary>encrypted strings</primary>
14251 <secondary>comparing</secondary>
14253 <indexterm role="concept">
14254 <primary><option>crypteq</option> expansion condition</primary>
14256 This condition is included in the Exim binary if it is built to support any
14257 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
14258 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
14259 included in the binary.
14262 The <option>crypteq</option> condition has two arguments. The first is encrypted and
14263 compared against the second, which is already encrypted. The second string may
14264 be in the LDAP form for storing encrypted strings, which starts with the
14265 encryption type in curly brackets, followed by the data. If the second string
14266 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
14267 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
14268 Typically this will be a field from a password file. An example of an encrypted
14269 string in LDAP form is:
14271 <literallayout class="monospaced">
14272 {md5}CY9rzUYh03PK3k6DJie09g==
14275 If such a string appears directly in an expansion, the curly brackets have to
14276 be quoted, because they are part of the expansion syntax. For example:
14278 <literallayout class="monospaced">
14279 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
14282 The following encryption types (whose names are matched case-independently) are
14288 <indexterm role="concept">
14289 <primary>MD5 hash</primary>
14291 <indexterm role="concept">
14292 <primary>base64 encoding</primary>
14293 <secondary>in encrypted password</secondary>
14295 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
14296 printable characters to compare with the remainder of the second string. If the
14297 length of the comparison string is 24, Exim assumes that it is base64 encoded
14298 (as in the above example). If the length is 32, Exim assumes that it is a
14299 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
14305 <indexterm role="concept">
14306 <primary>SHA-1 hash</primary>
14308 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
14309 printable characters to compare with the remainder of the second string. If the
14310 length of the comparison string is 28, Exim assumes that it is base64 encoded.
14311 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
14312 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
14317 <indexterm role="concept">
14318 <primary><function>crypt()</function></primary>
14320 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
14321 only the first eight characters of the password. However, in modern operating
14322 systems this is no longer true, and in many cases the entire password is used,
14323 whatever its length.
14328 <indexterm role="concept">
14329 <primary><function>crypt16()</function></primary>
14331 <option>{crypt16}</option> calls the <function>crypt16()</function> function (also known as <function>bigcrypt()</function>),
14332 which was orginally created to use up to 16 characters of the password. Again,
14333 in modern operating systems, more characters may be used.
14338 Exim has its own version of <function>crypt16()</function> (which is just a double call to
14339 <function>crypt()</function>). For operating systems that have their own version, setting
14340 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
14341 operating system version instead of its own. This option is set by default in
14342 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
14343 support <function>crypt16()</function>.
14346 If you do not put any curly bracket encryption type in a <option>crypteq</option>
14347 comparison, the default is either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as determined
14348 by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default default is
14349 <literal>{crypt}</literal>. Whatever the default, you can always use either function by
14350 specifying it explicitly in curly brackets.
14353 Note that if a password is no longer than 8 characters, the results of
14354 encrypting it with <function>crypt()</function> and <function>crypt16()</function> are identical. That means that
14355 <function>crypt16()</function> is backwards compatible, as long as nobody feeds it a password
14356 longer than 8 characters.
14358 </listitem></varlistentry>
14360 <term><emphasis role="bold">def:</emphasis><<emphasis>variable name</emphasis>></term>
14363 <indexterm role="concept">
14364 <primary>expansion</primary>
14365 <secondary>checking for empty variable</secondary>
14367 <indexterm role="concept">
14368 <primary><option>def</option> expansion condition</primary>
14370 The <option>def</option> condition must be followed by the name of one of the expansion
14371 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
14372 variable does not contain the empty string. For example:
14374 <literallayout class="monospaced">
14375 ${if def:sender_ident {from $sender_ident}}
14378 Note that the variable name is given without a leading <option>$</option> character. If the
14379 variable does not exist, the expansion fails.
14381 </listitem></varlistentry>
14383 <term><emphasis role="bold">def:header_</emphasis><<emphasis>header name</emphasis>><emphasis role="bold">:</emphasis> or <emphasis role="bold">def:h_</emphasis><<emphasis>header name</emphasis>><emphasis role="bold">:</emphasis></term>
14386 <indexterm role="concept">
14387 <primary>expansion</primary>
14388 <secondary>checking header line existence</secondary>
14390 This condition is true if a message is being processed and the named header
14391 exists in the message. For example,
14393 <literallayout class="monospaced">
14394 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
14397 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
14398 the header name must be terminated by a colon if white space does not follow.
14400 </listitem></varlistentry>
14402 <term><emphasis role="bold">eq {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14405 <indexterm role="concept">
14406 <primary>string</primary>
14407 <secondary>comparison</secondary>
14409 <indexterm role="concept">
14410 <primary>expansion</primary>
14411 <secondary>string comparison</secondary>
14413 <indexterm role="concept">
14414 <primary><option>eq</option> expansion condition</primary>
14416 The two substrings are first expanded. The condition is true if the two
14417 resulting strings are identical, including the case of letters.
14419 </listitem></varlistentry>
14421 <term><emphasis role="bold">eqi {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14424 <indexterm role="concept">
14425 <primary>string</primary>
14426 <secondary>comparison</secondary>
14428 <indexterm role="concept">
14429 <primary>expansion</primary>
14430 <secondary>string comparison</secondary>
14432 <indexterm role="concept">
14433 <primary><option>eqi</option> expansion condition</primary>
14435 The two substrings are first expanded. The condition is true if the two
14436 resulting strings are identical when compared in a case-independent way.
14438 </listitem></varlistentry>
14440 <term><emphasis role="bold">exists {</emphasis><<emphasis>file name</emphasis>><emphasis role="bold">}</emphasis></term>
14443 <indexterm role="concept">
14444 <primary>expansion</primary>
14445 <secondary>file existence test</secondary>
14447 <indexterm role="concept">
14448 <primary>file</primary>
14449 <secondary>existence test</secondary>
14451 <indexterm role="concept">
14452 <primary><option>exists</option>, expansion condition</primary>
14454 The substring is first expanded and then interpreted as an absolute path. The
14455 condition is true if the named file (or directory) exists. The existence test
14456 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
14457 users’ filter files may be locked out by the system administrator.
14459 </listitem></varlistentry>
14461 <term><emphasis role="bold">first_delivery</emphasis></term>
14464 <indexterm role="concept">
14465 <primary>delivery</primary>
14466 <secondary>first</secondary>
14468 <indexterm role="concept">
14469 <primary>first delivery</primary>
14471 <indexterm role="concept">
14472 <primary>expansion</primary>
14473 <secondary>first delivery test</secondary>
14475 <indexterm role="concept">
14476 <primary><option>first_delivery</option> expansion condition</primary>
14478 This condition, which has no data, is true during a message’s first delivery
14479 attempt. It is false during any subsequent delivery attempts.
14481 </listitem></varlistentry>
14483 <term><emphasis role="bold">ge {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14486 <indexterm role="concept">
14487 <primary><option>ge</option> expansion condition</primary>
14489 See <emphasis role="bold">gei</emphasis>.
14491 </listitem></varlistentry>
14493 <term><emphasis role="bold">gei {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14496 <indexterm role="concept">
14497 <primary>string</primary>
14498 <secondary>comparison</secondary>
14500 <indexterm role="concept">
14501 <primary>expansion</primary>
14502 <secondary>string comparison</secondary>
14504 <indexterm role="concept">
14505 <primary><option>gei</option> expansion condition</primary>
14507 The two substrings are first expanded. The condition is true if the first
14508 string is lexically greater than or equal to the second string: for <option>ge</option> the
14509 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
14512 </listitem></varlistentry>
14514 <term><emphasis role="bold">gt {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14517 <indexterm role="concept">
14518 <primary><option>gt</option> expansion condition</primary>
14520 See <emphasis role="bold">gti</emphasis>.
14522 </listitem></varlistentry>
14524 <term><emphasis role="bold">gti {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14527 <indexterm role="concept">
14528 <primary>string</primary>
14529 <secondary>comparison</secondary>
14531 <indexterm role="concept">
14532 <primary>expansion</primary>
14533 <secondary>string comparison</secondary>
14535 <indexterm role="concept">
14536 <primary><option>gti</option> expansion condition</primary>
14538 The two substrings are first expanded. The condition is true if the first
14539 string is lexically greater than the second string: for <option>gt</option> the comparison
14540 includes the case of letters, whereas for <option>gti</option> the comparison is
14543 </listitem></varlistentry>
14545 <term><emphasis role="bold">isip {</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14548 <indexterm role="concept">
14549 <primary><option>isip</option> expansion condition</primary>
14551 See <emphasis role="bold">isip6</emphasis>.
14553 </listitem></varlistentry>
14555 <term><emphasis role="bold">isip4 {</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14558 <indexterm role="concept">
14559 <primary><option>isip4</option> expansion condition</primary>
14561 See <emphasis role="bold">isip6</emphasis>.
14563 </listitem></varlistentry>
14565 <term><emphasis role="bold">isip6 {</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14568 <indexterm role="concept">
14569 <primary>IP address</primary>
14570 <secondary>testing string format</secondary>
14572 <indexterm role="concept">
14573 <primary>string</primary>
14574 <secondary>testing for IP address</secondary>
14576 <indexterm role="concept">
14577 <primary><option>isip6</option> expansion condition</primary>
14579 The substring is first expanded, and then tested to see if it has the form of
14580 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
14581 <option>isip4</option> and <option>isip6</option> test just for IPv4 or IPv6 addresses, respectively. For
14582 example, you could use
14584 <literallayout class="monospaced">
14585 ${if isip4{$sender_host_address}...
14588 to test which version of IP an incoming SMTP connection is using.
14590 </listitem></varlistentry>
14592 <term><emphasis role="bold">ldapauth {</emphasis><<emphasis>ldap query</emphasis>><emphasis role="bold">}</emphasis></term>
14595 <indexterm role="concept">
14596 <primary>LDAP</primary>
14597 <secondary>use for authentication</secondary>
14599 <indexterm role="concept">
14600 <primary>expansion</primary>
14601 <secondary>LDAP authentication test</secondary>
14603 <indexterm role="concept">
14604 <primary><option>ldapauth</option> expansion condition</primary>
14606 This condition supports user authentication using LDAP. See section
14607 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
14608 queries. For this use, the query must contain a user name and password. The
14609 query itself is not used, and can be empty. The condition is true if the
14610 password is not empty, and the user name and password are accepted by the LDAP
14611 server. An empty password is rejected without calling LDAP because LDAP binds
14612 with an empty password are considered anonymous regardless of the username, and
14613 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
14614 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
14617 </listitem></varlistentry>
14619 <term><emphasis role="bold">le {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14622 <indexterm role="concept">
14623 <primary><option>le</option> expansion condition</primary>
14625 See <emphasis role="bold">lei</emphasis>.
14627 </listitem></varlistentry>
14629 <term><emphasis role="bold">lei {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14632 <indexterm role="concept">
14633 <primary>string</primary>
14634 <secondary>comparison</secondary>
14636 <indexterm role="concept">
14637 <primary>expansion</primary>
14638 <secondary>string comparison</secondary>
14640 <indexterm role="concept">
14641 <primary><option>lei</option> expansion condition</primary>
14643 The two substrings are first expanded. The condition is true if the first
14644 string is lexically less than or equal to the second string: for <option>le</option> the
14645 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
14648 </listitem></varlistentry>
14650 <term><emphasis role="bold">lt {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14653 <indexterm role="concept">
14654 <primary><option>lt</option> expansion condition</primary>
14656 See <emphasis role="bold">lti</emphasis>.
14658 </listitem></varlistentry>
14660 <term><emphasis role="bold">lti {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14663 <indexterm role="concept">
14664 <primary>string</primary>
14665 <secondary>comparison</secondary>
14667 <indexterm role="concept">
14668 <primary>expansion</primary>
14669 <secondary>string comparison</secondary>
14671 <indexterm role="concept">
14672 <primary><option>lti</option> expansion condition</primary>
14674 The two substrings are first expanded. The condition is true if the first
14675 string is lexically less than the second string: for <option>lt</option> the comparison
14676 includes the case of letters, whereas for <option>lti</option> the comparison is
14679 </listitem></varlistentry>
14681 <term><emphasis role="bold">match {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14684 <indexterm role="concept">
14685 <primary>expansion</primary>
14686 <secondary>regular expression comparison</secondary>
14688 <indexterm role="concept">
14689 <primary>regular expressions</primary>
14690 <secondary>match in expanded string</secondary>
14692 <indexterm role="concept">
14693 <primary><option>match</option>, expansion condition</primary>
14695 The two substrings are first expanded. The second is then treated as a regular
14696 expression and applied to the first. Because of the pre-expansion, if the
14697 regular expression contains dollar, or backslash characters, they must be
14698 escaped. Care must also be taken if the regular expression contains braces
14699 (curly brackets). A closing brace must be escaped so that it is not taken as a
14700 premature termination of <<emphasis>string2</emphasis>>. The easiest approach is to use the
14701 <literal>\N</literal> feature to disable expansion of the regular expression.
14704 <literallayout class="monospaced">
14705 ${if match {$local_part}{\N^\d{3}\N} ...
14708 If the whole expansion string is in double quotes, further escaping of
14709 backslashes is also required.
14712 The condition is true if the regular expression match succeeds.
14713 The regular expression is not required to begin with a circumflex
14714 metacharacter, but if there is no circumflex, the expression is not anchored,
14715 and it may match anywhere in the subject, not just at the start. If you want
14716 the pattern to match at the end of the subject, you must include the <literal>$</literal>
14717 metacharacter at an appropriate point.
14720 <indexterm role="concept">
14721 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
14722 <secondary>in <option>if</option> expansion</secondary>
14724 At the start of an <option>if</option> expansion the values of the numeric variable
14725 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
14726 succeeds causes them to be reset to the substrings of that condition and they
14727 will have these values during the expansion of the success string. At the end
14728 of the <option>if</option> expansion, the previous values are restored. After testing a
14729 combination of conditions using <option>or</option>, the subsequent values of the numeric
14730 variables are those of the condition that succeeded.
14732 </listitem></varlistentry>
14734 <term><emphasis role="bold">match_address {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14737 <indexterm role="concept">
14738 <primary><option>match_address</option> expansion condition</primary>
14740 See <emphasis role="bold">match_local_part</emphasis>.
14742 </listitem></varlistentry>
14744 <term><emphasis role="bold">match_domain {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14747 <indexterm role="concept">
14748 <primary><option>match_domain</option> expansion condition</primary>
14750 See <emphasis role="bold">match_local_part</emphasis>.
14752 </listitem></varlistentry>
14754 <term><emphasis role="bold">match_ip {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14757 <indexterm role="concept">
14758 <primary><option>match_ip</option> expansion condition</primary>
14760 This condition matches an IP address to a list of IP address patterns. It must
14761 be followed by two argument strings. The first (after expansion) must be an IP
14762 address or an empty string. The second (after expansion) is a restricted host
14763 list that can match only an IP address, not a host name. For example:
14765 <literallayout class="monospaced">
14766 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
14769 The specific types of host list item that are permitted in the list are:
14774 An IP address, optionally with a CIDR mask.
14779 A single asterisk, which matches any IP address.
14784 An empty item, which matches only if the IP address is empty. This could be
14785 useful for testing for a locally submitted message or one from specific hosts
14786 in a single test such as
14788 <literallayout class="monospaced">
14789 ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
14792 where the first item in the list is the empty string.
14797 The item @[] matches any of the local host’s interface addresses.
14802 Lookups are assumed to be <quote>net-</quote> style lookups, even if <literal>net-</literal> is not
14803 specified. Thus, the following are equivalent:
14805 <literallayout class="monospaced">
14806 ${if match_ip{$sender_host_address}{lsearch;/some/file}...
14807 ${if match_ip{$sender_host_address}{net-lsearch;/some/file}...
14809 <para revisionflag="changed">
14810 You do need to specify the <literal>net-</literal> prefix if you want to specify a
14811 specific address mask, for example, by using <literal>net24-</literal>. However, unless you
14812 are combining a <option>match_ip</option> condition with others, it is usually neater to use
14813 an expansion lookup such as:
14815 <literallayout class="monospaced" revisionflag="changed">
14816 ${lookup{${mask:$sender_host_address/24}}lsearch{/some/file}...
14821 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
14823 </listitem></varlistentry>
14825 <term><emphasis role="bold">match_local_part {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14828 <indexterm role="concept">
14829 <primary>domain list</primary>
14830 <secondary>in expansion condition</secondary>
14832 <indexterm role="concept">
14833 <primary>address list</primary>
14834 <secondary>in expansion condition</secondary>
14836 <indexterm role="concept">
14837 <primary>local part list</primary>
14838 <secondary>in expansion condition</secondary>
14840 <indexterm role="concept">
14841 <primary><option>match_local_part</option> expansion condition</primary>
14843 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
14844 possible to test domain, address, and local part lists within expansions. Each
14845 condition requires two arguments: an item and a list to match. A trivial
14848 <literallayout class="monospaced">
14849 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
14852 In each case, the second argument may contain any of the allowable items for a
14853 list of the appropriate type. Also, because the second argument (after
14854 expansion) is a standard form of list, it is possible to refer to a named list.
14855 Thus, you can use conditions like this:
14857 <literallayout class="monospaced">
14858 ${if match_domain{$domain}{+local_domains}{...
14861 <indexterm role="concept">
14862 <primary><literal>+caseful</literal></primary>
14864 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
14865 item can be used, as in all address lists, to cause subsequent items to
14866 have their local parts matched casefully. Domains are always matched
14870 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
14871 hosts have two identities: a name and an IP address, and it is not clear
14872 how to specify cleanly how such a test would work. However, IP addresses can be
14873 matched using <option>match_ip</option>.
14875 </listitem></varlistentry>
14877 <term><emphasis role="bold">pam {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">:...}</emphasis></term>
14880 <indexterm role="concept">
14881 <primary>PAM authentication</primary>
14883 <indexterm role="concept">
14884 <primary>AUTH</primary>
14885 <secondary>with PAM</secondary>
14887 <indexterm role="concept">
14888 <primary>Solaris</primary>
14889 <secondary>PAM support</secondary>
14891 <indexterm role="concept">
14892 <primary>expansion</primary>
14893 <secondary>PAM authentication test</secondary>
14895 <indexterm role="concept">
14896 <primary><option>pam</option> expansion condition</primary>
14898 <emphasis>Pluggable Authentication Modules</emphasis>
14899 (<emphasis role="bold"><ulink url="http://www.kernel.org/pub/linux/libs/pam/">http://www.kernel.org/pub/linux/libs/pam/</ulink></emphasis>) are a facility that is
14900 available in the latest releases of Solaris and in some GNU/Linux
14901 distributions. The Exim support, which is intended for use in conjunction with
14902 the SMTP AUTH command, is available only if Exim is compiled with
14904 <literallayout class="monospaced">
14908 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
14909 in some releases of GNU/Linux <option>-ldl</option> is also needed.
14912 The argument string is first expanded, and the result must be a
14913 colon-separated list of strings. Leading and trailing white space is ignored.
14914 The PAM module is initialized with the service name <quote>exim</quote> and the user name
14915 taken from the first item in the colon-separated data string (<<emphasis>string1</emphasis>>).
14916 The remaining items in the data string are passed over in response to requests
14917 from the authentication function. In the simple case there will only be one
14918 request, for a password, so the data consists of just two strings.
14921 There can be problems if any of the strings are permitted to contain colon
14922 characters. In the usual way, these have to be doubled to avoid being taken as
14923 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
14924 item can be used to double any existing colons. For example, the configuration
14925 of a LOGIN authenticator might contain this setting:
14927 <literallayout class="monospaced" revisionflag="changed">
14928 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
14930 <para revisionflag="changed">
14931 For a PLAIN authenticator you could use:
14933 <literallayout class="monospaced" revisionflag="changed">
14934 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
14937 In some operating systems, PAM authentication can be done only from a process
14938 running as root. Since Exim is running as the Exim user when receiving
14939 messages, this means that PAM cannot be used directly in those systems.
14940 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
14941 Linux PAM package is available from <emphasis role="bold"><ulink url="http://www.e-admin.de/pam_exim/">http://www.e-admin.de/pam_exim/</ulink></emphasis>.
14942 The patched module allows one special uid/gid combination, in addition to root,
14943 to authenticate. If you build the patched module to allow the Exim user and
14944 group, PAM can then be used from an Exim authenticator.
14946 </listitem></varlistentry>
14948 <term><emphasis role="bold">pwcheck {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14951 <indexterm role="concept">
14952 <primary><emphasis>pwcheck</emphasis> daemon</primary>
14954 <indexterm role="concept">
14955 <primary>Cyrus</primary>
14957 <indexterm role="concept">
14958 <primary>expansion</primary>
14959 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
14961 <indexterm role="concept">
14962 <primary><option>pwcheck</option> expansion condition</primary>
14964 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
14965 This is one way of making it possible for passwords to be checked by a process
14966 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
14967 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
14970 The pwcheck support is not included in Exim by default. You need to specify
14971 the location of the pwcheck daemon’s socket in <filename>Local/Makefile</filename> before
14972 building Exim. For example:
14974 <literallayout class="monospaced">
14975 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
14978 You do not need to install the full Cyrus software suite in order to use
14979 the pwcheck daemon. You can compile and install just the daemon alone
14980 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
14981 access to the <filename>/var/pwcheck</filename> directory.
14984 The <option>pwcheck</option> condition takes one argument, which must be the user name and
14985 password, separated by a colon. For example, in a LOGIN authenticator
14986 configuration, you might have this:
14988 <literallayout class="monospaced" revisionflag="changed">
14989 server_condition = ${if pwcheck{$auth1:$auth2}}
14991 </listitem></varlistentry>
14993 <term><emphasis role="bold">queue_running</emphasis></term>
14996 <indexterm role="concept">
14997 <primary>queue runner</primary>
14998 <secondary>detecting when delivering from</secondary>
15000 <indexterm role="concept">
15001 <primary>expansion</primary>
15002 <secondary>queue runner test</secondary>
15004 <indexterm role="concept">
15005 <primary><option>queue_runnint</option> expansion condition</primary>
15007 This condition, which has no data, is true during delivery attempts that are
15008 initiated by queue runner processes, and false otherwise.
15010 </listitem></varlistentry>
15012 <term><emphasis role="bold">radius {</emphasis><<emphasis>authentication string</emphasis>><emphasis role="bold">}</emphasis></term>
15015 <indexterm role="concept">
15016 <primary>Radius</primary>
15018 <indexterm role="concept">
15019 <primary>expansion</primary>
15020 <secondary>Radius authentication</secondary>
15022 <indexterm role="concept">
15023 <primary><option>radiu</option> expansion condition</primary>
15025 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
15026 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
15027 the Radius client configuration file in order to build Exim with Radius
15031 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
15032 library, using the original API. If you are using release 0.4.0 or later of
15033 this library, you need to set
15035 <literallayout class="monospaced">
15036 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
15039 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
15040 <option>libradius</option> library that comes with FreeBSD. To do this, set
15042 <literallayout class="monospaced">
15043 RADIUS_LIB_TYPE=RADLIB
15046 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
15047 You may also have to supply a suitable setting in EXTRALIBS so that the
15048 Radius library can be found when Exim is linked.
15051 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
15052 Radius client library, which calls the Radius server. The condition is true if
15053 the authentication is successful. For example:
15055 <literallayout class="monospaced">
15056 server_condition = ${if radius{<arguments>}}
15058 </listitem></varlistentry>
15060 <term><emphasis role="bold">saslauthd {{</emphasis><<emphasis>user</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>password</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>service</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>realm</emphasis>><emphasis role="bold">}}</emphasis></term>
15063 <indexterm role="concept">
15064 <primary><emphasis>saslauthd</emphasis> daemon</primary>
15066 <indexterm role="concept">
15067 <primary>Cyrus</primary>
15069 <indexterm role="concept">
15070 <primary>expansion</primary>
15071 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
15073 <indexterm role="concept">
15074 <primary><option>saslauthd</option> expansion condition</primary>
15076 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
15077 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
15078 Using this daemon is one way of making it possible for passwords to be checked
15079 by a process that is not running as root.
15082 The saslauthd support is not included in Exim by default. You need to specify
15083 the location of the saslauthd daemon’s socket in <filename>Local/Makefile</filename> before
15084 building Exim. For example:
15086 <literallayout class="monospaced">
15087 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
15090 You do not need to install the full Cyrus software suite in order to use
15091 the saslauthd daemon. You can compile and install just the daemon alone
15092 from the Cyrus SASL library.
15095 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
15096 two are mandatory. For example:
15098 <literallayout class="monospaced" revisionflag="changed">
15099 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
15102 The service and the realm are optional (which is why the arguments are enclosed
15103 in their own set of braces). For details of the meaning of the service and
15104 realm, and how to run the daemon, consult the Cyrus documentation.
15106 </listitem></varlistentry>
15110 <title>Combining expansion conditions</title>
15112 <indexterm role="concept">
15113 <primary>expansion</primary>
15114 <secondary>combining conditions</secondary>
15116 Several conditions can be tested at once by combining them using the <option>and</option>
15117 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
15118 conditions on their own, and precede their lists of sub-conditions. Each
15119 sub-condition must be enclosed in braces within the overall braces that contain
15120 the list. No repetition of <option>if</option> is used.
15124 <term><emphasis role="bold">or {{</emphasis><<emphasis>cond1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>cond2</emphasis>><emphasis role="bold">}...}</emphasis></term>
15127 <indexterm role="concept">
15128 <primary><quote>or</quote> expansion condition</primary>
15130 <indexterm role="concept">
15131 <primary>expansion</primary>
15132 <secondary><quote>or</quote> of conditions</secondary>
15134 The sub-conditions are evaluated from left to right. The condition is true if
15135 any one of the sub-conditions is true.
15138 <literallayout class="monospaced">
15139 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
15142 When a true sub-condition is found, the following ones are parsed but not
15143 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
15144 numeric variables afterwards are taken from the first one that succeeds.
15146 </listitem></varlistentry>
15148 <term><emphasis role="bold">and {{</emphasis><<emphasis>cond1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>cond2</emphasis>><emphasis role="bold">}...}</emphasis></term>
15151 <indexterm role="concept">
15152 <primary><quote>and</quote> expansion condition</primary>
15154 <indexterm role="concept">
15155 <primary>expansion</primary>
15156 <secondary><quote>and</quote> of conditions</secondary>
15158 The sub-conditions are evaluated from left to right. The condition is true if
15159 all of the sub-conditions are true. If there are several <quote>match</quote>
15160 sub-conditions, the values of the numeric variables afterwards are taken from
15161 the last one. When a false sub-condition is found, the following ones are
15162 parsed but not evaluated.
15164 </listitem></varlistentry>
15167 <section id="SECTexpvar">
15168 <title>Expansion variables</title>
15170 <indexterm role="concept">
15171 <primary>expansion variables</primary>
15172 <secondary>list of</secondary>
15174 This section contains an alphabetical list of all the expansion variables. Some
15175 of them are available only when Exim is compiled with specific options such as
15176 support for TLS or the content scanning extension.
15180 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
15183 <indexterm role="concept">
15184 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15186 When a <option>match</option> expansion condition succeeds, these variables contain the
15187 captured substrings identified by the regular expression during subsequent
15188 processing of the success string of the containing <option>if</option> expansion item. They
15189 may also be set externally by some other matching process which precedes the
15190 expansion of the string. For example, the commands available in Exim filter
15191 files include an <option>if</option> command with its own regular expression matching
15194 </listitem></varlistentry>
15196 <term><varname>$acl_c0</varname> – <varname>$acl_c19</varname></term>
15199 Values can be placed in these variables by the <option>set</option> modifier in an ACL. The
15200 values persist throughout the lifetime of an SMTP connection. They can be used
15201 to pass information between ACLs and between different invocations of the same
15202 ACL. When a message is received, the values of these variables are saved with
15203 the message, and can be accessed by filters, routers, and transports during
15204 subsequent delivery.
15206 </listitem></varlistentry>
15208 <term><varname>$acl_m0</varname> – <varname>$acl_m19</varname></term>
15211 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
15212 retain their values while a message is being received, but are reset
15213 afterwards. They are also reset by MAIL, RSET, EHLO, HELO, and after starting a
15214 TLS session. When a message is received, the values of these variables are
15215 saved with the message, and can be accessed by filters, routers, and transports
15216 during subsequent delivery.
15218 </listitem></varlistentry>
15220 <term><varname>$acl_verify_message</varname></term>
15223 <indexterm role="concept">
15224 <primary><varname>$acl_verify_message</varname></primary>
15226 After an address verification has failed, this variable contains the failure
15227 message. It retains its value for use in subsequent modifiers. The message can
15228 be preserved by coding like this:
15230 <literallayout class="monospaced">
15231 warn !verify = sender
15232 set acl_m0 = $acl_verify_message
15235 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
15236 <option>log_message</option> modifiers, to include information about the verification
15239 </listitem></varlistentry>
15241 <term><varname>$address_data</varname></term>
15244 <indexterm role="concept">
15245 <primary><varname>$address_data</varname></primary>
15247 This variable is set by means of the <option>address_data</option> option in routers. The
15248 value then remains with the address while it is processed by subsequent routers
15249 and eventually a transport. If the transport is handling multiple addresses,
15250 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
15251 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
15255 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
15256 a recipient address, the final value is still in the variable for subsequent
15257 conditions and modifiers of the ACL statement. If routing the address caused it
15258 to be redirected to just one address, the child address is also routed as part
15259 of the verification, and in this case the final value of <varname>$address_data</varname> is
15260 from the child’s routing.
15263 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
15264 sender address, the final value is also preserved, but this time in
15265 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
15269 In both cases (recipient and sender verification), the value does not persist
15270 after the end of the current ACL statement. If you want to preserve
15271 these values for longer, you can save them in ACL variables.
15273 </listitem></varlistentry>
15275 <term><varname>$address_file</varname></term>
15278 <indexterm role="concept">
15279 <primary><varname>$address_file</varname></primary>
15281 When, as a result of aliasing, forwarding, or filtering, a message is directed
15282 to a specific file, this variable holds the name of the file when the transport
15283 is running. At other times, the variable is empty. For example, using the
15284 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
15286 <literallayout class="monospaced">
15287 /home/r2d2/savemail
15290 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
15291 contains <quote>/home/r2d2/savemail</quote>.
15294 <indexterm role="concept">
15295 <primary>Sieve filter</primary>
15296 <secondary>value of <varname>$address_file</varname></secondary>
15298 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
15299 then up to the transport configuration to generate an appropriate absolute path
15300 to the relevant file.
15302 </listitem></varlistentry>
15304 <term><varname>$address_pipe</varname></term>
15307 <indexterm role="concept">
15308 <primary><varname>$address_pipe</varname></primary>
15310 When, as a result of aliasing or forwarding, a message is directed to a pipe,
15311 this variable holds the pipe command when the transport is running.
15313 </listitem></varlistentry>
15315 <term><varname>$auth1</varname> – <varname>$auth3</varname></term>
15318 <indexterm role="concept">
15319 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
15321 These variables are used in SMTP authenticators (see chapters
15322 <xref linkend="CHAPplaintext"/>–<xref linkend="CHAPspa"/>). Elsewhere, they are empty.
15324 </listitem></varlistentry>
15326 <term><varname>$authenticated_id</varname></term>
15329 <indexterm role="concept">
15330 <primary>authentication</primary>
15331 <secondary>id</secondary>
15333 <indexterm role="concept">
15334 <primary><varname>$authenticated_id</varname></primary>
15336 When a server successfully authenticates a client it may be configured to
15337 preserve some of the authentication information in the variable
15338 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
15339 user/password authenticator configuration might preserve the user name for use
15340 in the routers. Note that this is not the same information that is saved in
15341 <varname>$sender_host_authenticated</varname>.
15342 <phrase revisionflag="changed">When a message is submitted locally (that is, not over a TCP connection)
15343 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
15344 process. However, a trusted user can override this by means of the <option>-oMai</option>
15345 command line option.</phrase>
15347 </listitem></varlistentry>
15349 <term><varname>$authenticated_sender</varname></term>
15352 <indexterm role="concept">
15353 <primary>sender</primary>
15354 <secondary>authenticated</secondary>
15356 <indexterm role="concept">
15357 <primary>authentication</primary>
15358 <secondary>sender</secondary>
15360 <indexterm role="concept">
15361 <primary>AUTH</primary>
15362 <secondary>on MAIL command</secondary>
15364 <indexterm role="concept">
15365 <primary><varname>$authenticated_sender</varname></primary>
15367 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
15368 SMTP MAIL command if it believes the sender is sufficiently trusted, as
15369 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
15370 <quote><></quote>, it is set as the authenticated sender of the message, and the value is
15371 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
15372 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
15374 <para revisionflag="changed">
15375 <indexterm role="concept">
15376 <primary><varname>$qualify_domain</varname></primary>
15378 When a message is submitted locally (that is, not over a TCP connection), the
15379 value of <varname>$authenticated_sender</varname> is an address constructed from the login
15380 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
15381 can override this by means of the <option>-oMas</option> command line option.
15383 </listitem></varlistentry>
15385 <term><varname>$authentication_failed</varname></term>
15388 <indexterm role="concept">
15389 <primary>authentication</primary>
15390 <secondary>failure</secondary>
15392 <indexterm role="concept">
15393 <primary><varname>$authentication_failed</varname></primary>
15395 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
15396 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
15397 possible to distinguish between <quote>did not try to authenticate</quote>
15398 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
15399 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
15400 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
15401 negative response to an AUTH command, including (for example) an attempt to use
15402 an undefined mechanism.
15404 </listitem></varlistentry>
15406 <term><varname>$body_linecount</varname></term>
15409 <indexterm role="concept">
15410 <primary>message body</primary>
15411 <secondary>line count</secondary>
15413 <indexterm role="concept">
15414 <primary>body of message</primary>
15415 <secondary>line count</secondary>
15417 <indexterm role="concept">
15418 <primary><varname>$body_linecount</varname></primary>
15420 When a message is being received or delivered, this variable contains the
15421 number of lines in the message’s body. See also <varname>$message_linecount</varname>.
15423 </listitem></varlistentry>
15425 <term><varname>$body_zerocount</varname></term>
15428 <indexterm role="concept">
15429 <primary>message body</primary>
15430 <secondary>binary zero count</secondary>
15432 <indexterm role="concept">
15433 <primary>body of message</primary>
15434 <secondary>binary zero count</secondary>
15436 <indexterm role="concept">
15437 <primary>binary zero</primary>
15438 <secondary>in message body</secondary>
15440 <indexterm role="concept">
15441 <primary><varname>$body_zerocount</varname></primary>
15443 When a message is being received or delivered, this variable contains the
15444 number of binary zero bytes in the message’s body.
15446 </listitem></varlistentry>
15448 <term><varname>$bounce_recipient</varname></term>
15451 <indexterm role="concept">
15452 <primary><varname>$bounce_recipient</varname></primary>
15454 This is set to the recipient address of a bounce message while Exim is creating
15455 it. It is useful if a customized bounce message text file is in use (see
15456 chapter <xref linkend="CHAPemsgcust"/>).
15458 </listitem></varlistentry>
15460 <term><varname>$bounce_return_size_limit</varname></term>
15463 <indexterm role="concept">
15464 <primary><varname>$bounce_return_size_limit</varname></primary>
15466 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
15467 up to a multiple of 1000. It is useful when a customized error message text
15468 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
15470 </listitem></varlistentry>
15472 <term><varname>$caller_gid</varname></term>
15475 <indexterm role="concept">
15476 <primary>gid (group id)</primary>
15477 <secondary>caller</secondary>
15479 <indexterm role="concept">
15480 <primary><varname>$caller_gid</varname></primary>
15482 The real group id under which the process that called Exim was running. This is
15483 not the same as the group id of the originator of a message (see
15484 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
15485 incarnation normally contains the Exim gid.
15487 </listitem></varlistentry>
15489 <term><varname>$caller_uid</varname></term>
15492 <indexterm role="concept">
15493 <primary>uid (user id)</primary>
15494 <secondary>caller</secondary>
15496 <indexterm role="concept">
15497 <primary><varname>$caller_uid</varname></primary>
15499 The real user id under which the process that called Exim was running. This is
15500 not the same as the user id of the originator of a message (see
15501 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
15502 incarnation normally contains the Exim uid.
15504 </listitem></varlistentry>
15506 <term><varname>$compile_date</varname></term>
15509 <indexterm role="concept">
15510 <primary><varname>$compile_date</varname></primary>
15512 The date on which the Exim binary was compiled.
15514 </listitem></varlistentry>
15516 <term><varname>$compile_number</varname></term>
15519 <indexterm role="concept">
15520 <primary><varname>$compile_number</varname></primary>
15522 The building process for Exim keeps a count of the number
15523 of times it has been compiled. This serves to distinguish different
15524 compilations of the same version of the program.
15526 </listitem></varlistentry>
15528 <term><varname>$demime_errorlevel</varname></term>
15531 <indexterm role="concept">
15532 <primary><varname>$demime_errorlevel</varname></primary>
15534 This variable is available when Exim is compiled with
15535 the content-scanning extension and the obsolete <option>demime</option> condition. For
15536 details, see section <xref linkend="SECTdemimecond"/>.
15538 </listitem></varlistentry>
15540 <term><varname>$demime_reason</varname></term>
15543 <indexterm role="concept">
15544 <primary><varname>$demime_reason</varname></primary>
15546 This variable is available when Exim is compiled with the
15547 content-scanning extension and the obsolete <option>demime</option> condition. For details,
15548 see section <xref linkend="SECTdemimecond"/>.
15550 </listitem></varlistentry>
15552 <term><varname>$dnslist_domain</varname></term>
15555 <indexterm role="concept">
15556 <primary>black list (DNS)</primary>
15558 <indexterm role="concept">
15559 <primary><varname>$dnslist_domain</varname></primary>
15561 When a client host is found to be on a DNS (black) list,
15562 the list’s domain name is put into this variable so that it can be included in
15563 the rejection message.
15565 </listitem></varlistentry>
15567 <term><varname>$dnslist_text</varname></term>
15570 <indexterm role="concept">
15571 <primary><varname>$dnslist_text</varname></primary>
15573 When a client host is found to be on a DNS (black) list, the
15574 contents of any associated TXT record are placed in this variable.
15576 </listitem></varlistentry>
15578 <term><varname>$dnslist_value</varname></term>
15581 <indexterm role="concept">
15582 <primary><varname>$dnslist_value</varname></primary>
15584 When a client host is found to be on a DNS (black) list,
15585 the IP address from the resource record is placed in this variable.
15586 If there are multiple records, all the addresses are included, comma-space
15589 </listitem></varlistentry>
15591 <term><varname>$domain</varname></term>
15594 <indexterm role="concept">
15595 <primary><varname>$domain</varname></primary>
15597 When an address is being routed, or delivered on its own, this variable
15598 contains the domain. Global address rewriting happens when a message is
15599 received, so the value of <varname>$domain</varname> during routing and delivery is the value
15600 after rewriting. <varname>$domain</varname> is set during user filtering, but not during system
15601 filtering, because a message may have many recipients and the system filter is
15605 When more than one address is being delivered at once (for example, several
15606 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
15607 have the same domain. Transports can be restricted to handling only one domain
15608 at a time if the value of <varname>$domain</varname> is required at transport time – this is
15609 the default for local transports. For further details of the environment in
15610 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
15613 <indexterm role="concept">
15614 <primary><option>delay_warning_condition</option></primary>
15616 At the end of a delivery, if all deferred addresses have the same domain, it is
15617 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
15620 The <varname>$domain</varname> variable is also used in some other circumstances:
15625 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
15626 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
15627 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
15628 normally set during the running of the MAIL ACL. However, if the sender address
15629 is verified with a callout during the MAIL ACL, the sender domain is placed in
15630 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
15631 the <command>smtp</command> transport.
15636 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
15637 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
15638 it can be used in the expansion of the replacement address, for example, to
15639 rewrite domains by file lookup.
15644 With one important exception, whenever a domain list is being scanned,
15645 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
15646 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
15647 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
15648 that, in a RCPT ACL, the sender domain list can be dependent on the
15649 recipient domain (which is what is in <varname>$domain</varname> at this time).
15654 <indexterm role="concept">
15655 <primary>ETRN</primary>
15656 <secondary>value of <varname>$domain</varname></secondary>
15658 <indexterm role="concept">
15659 <primary><option>smtp_etrn_command</option></primary>
15661 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
15662 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
15666 </listitem></varlistentry>
15668 <term><varname>$domain_data</varname></term>
15671 <indexterm role="concept">
15672 <primary><varname>$domain_data</varname></primary>
15674 When the <option>domains</option> option on a router matches a domain by
15675 means of a lookup, the data read by the lookup is available during the running
15676 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
15677 address to a transport, the value is available in that transport. If the
15678 transport is handling multiple addresses, the value from the first address is
15682 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
15683 domain by means of a lookup. The data read by the lookup is available during
15684 the rest of the ACL statement. In all other situations, this variable expands
15687 </listitem></varlistentry>
15689 <term><varname>$exim_gid</varname></term>
15692 <indexterm role="concept">
15693 <primary><varname>$exim_gid</varname></primary>
15695 This variable contains the numerical value of the Exim group id.
15697 </listitem></varlistentry>
15699 <term><varname>$exim_path</varname></term>
15702 <indexterm role="concept">
15703 <primary><varname>$exim_path</varname></primary>
15705 This variable contains the path to the Exim binary.
15707 </listitem></varlistentry>
15709 <term><varname>$exim_uid</varname></term>
15712 <indexterm role="concept">
15713 <primary><varname>$exim_uid</varname></primary>
15715 This variable contains the numerical value of the Exim user id.
15717 </listitem></varlistentry>
15719 <term><varname>$found_extension</varname></term>
15722 <indexterm role="concept">
15723 <primary><varname>$found_extension</varname></primary>
15725 This variable is available when Exim is compiled with the
15726 content-scanning extension and the obsolete <option>demime</option> condition. For details,
15727 see section <xref linkend="SECTdemimecond"/>.
15729 </listitem></varlistentry>
15731 <term><varname>$header_</varname><<emphasis>name</emphasis>></term>
15734 This is not strictly an expansion variable. It is expansion syntax for
15735 inserting the message header line with the given name. Note that the name must
15736 be terminated by colon or white space, because it may contain a wide variety of
15737 characters. Note also that braces must <emphasis>not</emphasis> be used.
15739 </listitem></varlistentry>
15741 <term><varname>$home</varname></term>
15744 <indexterm role="concept">
15745 <primary><varname>$home</varname></primary>
15747 When the <option>check_local_user</option> option is set for a router, the user’s home
15748 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
15749 means it is set during the running of users’ filter files. A router may also
15750 explicitly set a home directory for use by a transport; this can be overridden
15751 by a setting on the transport itself.
15754 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
15755 of the environment variable HOME.
15757 </listitem></varlistentry>
15759 <term><varname>$host</varname></term>
15761 <para revisionflag="changed">
15762 <indexterm role="concept">
15763 <primary><varname>$host</varname></primary>
15765 If a router assigns an address to a transport (any transport), and passes a
15766 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
15767 to run is the name of the first host on the list. Note that this applies both
15768 to local and remote transports.
15770 <para revisionflag="changed">
15771 <indexterm role="concept">
15772 <primary>transport</primary>
15773 <secondary>filter</secondary>
15775 <indexterm role="concept">
15776 <primary>filter</primary>
15777 <secondary>transport filter</secondary>
15779 For the <command>smtp</command> transport, if there is more than one host, the value of
15780 <varname>$host</varname> changes as the transport works its way through the list. In
15781 particular, when the <command>smtp</command> transport is expanding its options for encryption
15782 using TLS, or for specifying a transport filter (see chapter
15783 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
15786 <para revisionflag="changed">
15787 When used in the client part of an authenticator configuration (see chapter
15788 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
15789 client is connected.
15791 </listitem></varlistentry>
15793 <term><varname>$host_address</varname></term>
15796 <indexterm role="concept">
15797 <primary><varname>$host_address</varname></primary>
15799 This variable is set to the remote host’s IP address whenever <varname>$host</varname> is set
15800 for a remote connection. It is also set to the IP address that is being checked
15801 when the <option>ignore_target_hosts</option> option is being processed.
15803 </listitem></varlistentry>
15805 <term><varname>$host_data</varname></term>
15808 <indexterm role="concept">
15809 <primary><varname>$host_data</varname></primary>
15811 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
15812 result of the lookup is made available in the <varname>$host_data</varname> variable. This
15813 allows you, for example, to do things like this:
15815 <literallayout class="monospaced">
15816 deny hosts = net-lsearch;/some/file
15817 message = $host_data
15819 </listitem></varlistentry>
15821 <term><varname>$host_lookup_deferred</varname></term>
15824 <indexterm role="concept">
15825 <primary>host name lookup</primary>
15826 <secondary>failure of</secondary>
15828 <indexterm role="concept">
15829 <primary><varname>$host_lookup_deferred</varname></primary>
15831 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
15832 message comes from a remote host and there is an attempt to look up the host’s
15833 name from its IP address, and the attempt is not successful, one of these
15834 variables is set to <quote>1</quote>.
15839 If the lookup receives a definite negative response (for example, a DNS lookup
15840 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
15845 If there is any kind of problem during the lookup, such that Exim cannot
15846 tell whether or not the host name is defined (for example, a timeout for a DNS
15847 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
15852 Looking up a host’s name from its IP address consists of more than just a
15853 single reverse lookup. Exim checks that a forward lookup of at least one of the
15854 names it receives from a reverse lookup yields the original IP address. If this
15855 is not the case, Exim does not accept the looked up name(s), and
15856 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
15857 IP address (for example, the existence of a PTR record in the DNS) is not
15858 sufficient on its own for the success of a host name lookup. If the reverse
15859 lookup succeeds, but there is a lookup problem such as a timeout when checking
15860 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
15861 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
15863 </listitem></varlistentry>
15865 <term><varname>$host_lookup_failed</varname></term>
15868 <indexterm role="concept">
15869 <primary><varname>$host_lookup_failed</varname></primary>
15871 See <varname>$host_lookup_deferred</varname>.
15873 </listitem></varlistentry>
15875 <term><varname>$inode</varname></term>
15878 <indexterm role="concept">
15879 <primary><varname>$inode</varname></primary>
15881 The only time this variable is set is while expanding the <option>directory_file</option>
15882 option in the <command>appendfile</command> transport. The variable contains the inode number
15883 of the temporary file which is about to be renamed. It can be used to construct
15884 a unique name for the file.
15886 </listitem></varlistentry>
15888 <term><varname>$interface_address</varname></term>
15891 <indexterm role="concept">
15892 <primary><varname>$interface_address</varname></primary>
15894 As soon as a server starts processing a TCP/IP connection, this variable is set
15895 to the address of the local IP interface, and <varname>$interface_port</varname> is set to the
15896 port number. These values are therefore available for use in the <quote>connect</quote>
15897 ACL. See also the <option>-oMi</option> command line option. As well as being used in ACLs,
15898 these variable could be used, for example, to make the file name for a TLS
15899 certificate depend on which interface and/or port is being used.
15901 </listitem></varlistentry>
15903 <term><varname>$interface_port</varname></term>
15906 <indexterm role="concept">
15907 <primary><varname>$interface_port</varname></primary>
15909 See <varname>$interface_address</varname>.
15911 </listitem></varlistentry>
15913 <term><varname>$ldap_dn</varname></term>
15916 <indexterm role="concept">
15917 <primary><varname>$ldap_dn</varname></primary>
15919 This variable, which is available only when Exim is compiled with LDAP support,
15920 contains the DN from the last entry in the most recently successful LDAP
15923 </listitem></varlistentry>
15925 <term><varname>$load_average</varname></term>
15928 <indexterm role="concept">
15929 <primary><varname>$load_average</varname></primary>
15931 This variable contains the system load average, multiplied by 1000 to that it
15932 is an integer. For example, if the load average is 0.21, the value of the
15933 variable is 210. The value is recomputed every time the variable is referenced.
15935 </listitem></varlistentry>
15937 <term><varname>$local_part</varname></term>
15940 <indexterm role="concept">
15941 <primary><varname>$local_part</varname></primary>
15943 When an address is being routed, or delivered on its own, this
15944 variable contains the local part. When a number of addresses are being
15945 delivered together (for example, multiple RCPT commands in an SMTP
15946 session), <varname>$local_part</varname> is not set.
15949 Global address rewriting happens when a message is received, so the value of
15950 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
15951 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
15952 because a message may have many recipients and the system filter is called just
15956 <indexterm role="concept">
15957 <primary><varname>$local_part_prefix</varname></primary>
15959 <indexterm role="concept">
15960 <primary><varname>$local_part_suffix</varname></primary>
15962 If a local part prefix or suffix has been recognized, it is not included in the
15963 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
15964 any prefix or suffix are in <varname>$local_part_prefix</varname> and
15965 <varname>$local_part_suffix</varname>, respectively.
15968 When a message is being delivered to a file, pipe, or autoreply transport as a
15969 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
15970 the parent address, not to the file name or command (see <varname>$address_file</varname> and
15971 <varname>$address_pipe</varname>).
15974 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
15975 local part of the recipient address.
15978 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
15979 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
15980 it can be used in the expansion of the replacement address, for example.
15983 In all cases, all quoting is removed from the local part. For example, for both
15986 <literallayout class="monospaced">
15987 "abc:xyz"@test.example
15988 abc\:xyz@test.example
15991 the value of <varname>$local_part</varname> is
15993 <literallayout class="monospaced">
15997 If you use <varname>$local_part</varname> to create another address, you should always wrap it
15998 inside a quoting operator. For example, in a <command>redirect</command> router you could
16001 <literallayout class="monospaced">
16002 data = ${quote_local_part:$local_part}@new.domain.example
16005 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
16006 to process local parts in a case-dependent manner in a router, you can set the
16007 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
16009 </listitem></varlistentry>
16011 <term><varname>$local_part_data</varname></term>
16014 <indexterm role="concept">
16015 <primary><varname>$local_part_data</varname></primary>
16017 When the <option>local_parts</option> option on a router matches a local part by means of a
16018 lookup, the data read by the lookup is available during the running of the
16019 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
16020 to a transport, the value is available in that transport. If the transport is
16021 handling multiple addresses, the value from the first address is used.
16024 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
16025 matches a local part by means of a lookup. The data read by the lookup is
16026 available during the rest of the ACL statement. In all other situations, this
16027 variable expands to nothing.
16029 </listitem></varlistentry>
16031 <term><varname>$local_part_prefix</varname></term>
16034 <indexterm role="concept">
16035 <primary><varname>$local_part_prefix</varname></primary>
16037 When an address is being routed or delivered, and a
16038 specific prefix for the local part was recognized, it is available in this
16039 variable, having been removed from <varname>$local_part</varname>.
16041 </listitem></varlistentry>
16043 <term><varname>$local_part_suffix</varname></term>
16046 <indexterm role="concept">
16047 <primary><varname>$local_part_suffix</varname></primary>
16049 When an address is being routed or delivered, and a
16050 specific suffix for the local part was recognized, it is available in this
16051 variable, having been removed from <varname>$local_part</varname>.
16053 </listitem></varlistentry>
16055 <term><varname>$local_scan_data</varname></term>
16058 <indexterm role="concept">
16059 <primary><varname>$local_scan_data</varname></primary>
16061 This variable contains the text returned by the <function>local_scan()</function> function when
16062 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
16064 </listitem></varlistentry>
16066 <term><varname>$local_user_gid</varname></term>
16069 <indexterm role="concept">
16070 <primary><varname>$local_user_gid</varname></primary>
16072 See <varname>$local_user_uid</varname>.
16074 </listitem></varlistentry>
16076 <term><varname>$local_user_uid</varname></term>
16079 <indexterm role="concept">
16080 <primary><varname>$local_user_uid</varname></primary>
16082 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
16083 <option>check_local_user</option> router precondition succeeds. This means that their values
16084 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
16085 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
16086 router-specific expansions. At all other times, the values in these variables
16087 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
16089 </listitem></varlistentry>
16091 <term><varname>$localhost_number</varname></term>
16094 <indexterm role="concept">
16095 <primary><varname>$localhost_number</varname></primary>
16097 This contains the expanded value of the
16098 <option>localhost_number</option> option. The expansion happens after the main options have
16101 </listitem></varlistentry>
16103 <term><varname>$log_inodes</varname></term>
16106 <indexterm role="concept">
16107 <primary><varname>$log_inodes</varname></primary>
16109 The number of free inodes in the disk partition where Exim’s
16110 log files are being written. The value is recalculated whenever the variable is
16111 referenced. If the relevant file system does not have the concept of inodes,
16112 the value of is -1. See also the <option>check_log_inodes</option> option.
16114 </listitem></varlistentry>
16116 <term><varname>$log_space</varname></term>
16119 <indexterm role="concept">
16120 <primary><varname>$log_space</varname></primary>
16122 The amount of free space (as a number of kilobytes) in the disk
16123 partition where Exim’s log files are being written. The value is recalculated
16124 whenever the variable is referenced. If the operating system does not have the
16125 ability to find the amount of free space (only true for experimental systems),
16126 the space value is -1. See also the <option>check_log_space</option> option.
16128 </listitem></varlistentry>
16130 <term><varname>$mailstore_basename</varname></term>
16133 <indexterm role="concept">
16134 <primary><varname>$mailstore_basename</varname></primary>
16136 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
16137 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
16138 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
16139 contains the basename of the files that are being written, that is, the name
16140 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
16143 </listitem></varlistentry>
16145 <term><varname>$malware_name</varname></term>
16148 <indexterm role="concept">
16149 <primary><varname>$malware_name</varname></primary>
16151 This variable is available when Exim is compiled with the
16152 content-scanning extension. It is set to the name of the virus that was found
16153 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
16155 </listitem></varlistentry>
16157 <term><varname>$message_age</varname></term>
16160 <indexterm role="concept">
16161 <primary>message</primary>
16162 <secondary>age of</secondary>
16164 <indexterm role="concept">
16165 <primary><varname>$message_age</varname></primary>
16167 This variable is set at the start of a delivery attempt to contain the number
16168 of seconds since the message was received. It does not change during a single
16171 </listitem></varlistentry>
16173 <term><varname>$message_body</varname></term>
16176 <indexterm role="concept">
16177 <primary>body of message</primary>
16178 <secondary>expansion variable</secondary>
16180 <indexterm role="concept">
16181 <primary>message body</primary>
16182 <secondary>in expansion</secondary>
16184 <indexterm role="concept">
16185 <primary>binary zero</primary>
16186 <secondary>in message body</secondary>
16188 <indexterm role="concept">
16189 <primary><varname>$message_body</varname></primary>
16191 This variable contains the initial portion of a message’s
16192 body while it is being delivered, and is intended mainly for use in filter
16193 files. The maximum number of characters of the body that are put into the
16194 variable is set by the <option>message_body_visible</option> configuration option; the
16195 default is 500. Newlines are converted into spaces to make it easier to search
16196 for phrases that might be split over a line break.
16197 Binary zeros are also converted into spaces.
16199 </listitem></varlistentry>
16201 <term><varname>$message_body_end</varname></term>
16204 <indexterm role="concept">
16205 <primary>body of message</primary>
16206 <secondary>expansion variable</secondary>
16208 <indexterm role="concept">
16209 <primary>message body</primary>
16210 <secondary>in expansion</secondary>
16212 <indexterm role="concept">
16213 <primary><varname>$message_body_end</varname></primary>
16215 This variable contains the final portion of a message’s
16216 body while it is being delivered. The format and maximum size are as for
16217 <varname>$message_body</varname>.
16219 </listitem></varlistentry>
16221 <term><varname>$message_body_size</varname></term>
16224 <indexterm role="concept">
16225 <primary>body of message</primary>
16226 <secondary>size</secondary>
16228 <indexterm role="concept">
16229 <primary>message body</primary>
16230 <secondary>size</secondary>
16232 <indexterm role="concept">
16233 <primary><varname>$message_body_size</varname></primary>
16235 When a message is being delivered, this variable contains the size of the body
16236 in bytes. The count starts from the character after the blank line that
16237 separates the body from the header. Newlines are included in the count. See
16238 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
16240 </listitem></varlistentry>
16242 <term><varname>$message_exim_id</varname></term>
16245 <indexterm role="concept">
16246 <primary><varname>$message_exim_id</varname></primary>
16248 When a message is being received or delivered, this variable contains the
16249 unique message id that is generated and used by Exim to identify the message.
16250 An id is not created for a message until after its header has been successfully
16251 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
16252 line; it is the local id that Exim assigns to the message, for example:
16253 <literal>1BXTIK-0001yO-VA</literal>.
16255 </listitem></varlistentry>
16257 <term><varname>$message_headers</varname></term>
16260 This variable contains a concatenation of all the header lines when a message
16261 is being processed, except for lines added by routers or transports. The header
16262 lines are separated by newline characters.
16264 </listitem></varlistentry>
16266 <term><varname>$message_id</varname></term>
16269 This is an old name for <varname>$message_exim_id</varname>, which is now deprecated.
16271 </listitem></varlistentry>
16273 <term><varname>$message_linecount</varname></term>
16276 <indexterm role="concept">
16277 <primary><varname>$message_linecount</varname></primary>
16279 This variable contains the total number of lines in the header and body of the
16280 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
16281 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
16282 number of lines received. Before delivery happens (that is, before filters,
16283 routers, and transports run) the count is increased to include the
16284 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
16285 lines that are added by ACLs. The blank line that separates the message header
16286 from the body is not counted. Here is an example of the use of this variable in
16289 <literallayout class="monospaced">
16290 deny message = Too many lines in message header
16292 ${if <{250}{${eval:$message_linecount - $body_linecount}}}
16295 In the MAIL and RCPT ACLs, the value is zero because at that stage the
16296 message has not yet been received.
16298 </listitem></varlistentry>
16300 <term><varname>$message_size</varname></term>
16303 <indexterm role="concept">
16304 <primary>size</primary>
16305 <secondary>of message</secondary>
16307 <indexterm role="concept">
16308 <primary>message</primary>
16309 <secondary>size</secondary>
16311 <indexterm role="concept">
16312 <primary><varname>$message_size</varname></primary>
16314 When a message is being processed, this variable contains its size in bytes. In
16315 most cases, the size includes those headers that were received with the
16316 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
16317 deliveries as they are written. However, there is one special case: during the
16318 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
16319 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
16320 precise size of the file that has been written. See also
16321 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
16324 <indexterm role="concept">
16325 <primary>RCPT</primary>
16326 <secondary>value of <varname>$message_size</varname></secondary>
16328 While running an ACL at the time of an SMTP RCPT command, <varname>$message_size</varname>
16329 contains the size supplied on the MAIL command, or -1 if no size was given. The
16330 value may not, of course, be truthful.
16332 </listitem></varlistentry>
16334 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
16337 A number of variables whose names start with <varname>$mime</varname> are
16338 available when Exim is compiled with the content-scanning extension. For
16339 details, see section <xref linkend="SECTscanmimepart"/>.
16341 </listitem></varlistentry>
16343 <term><varname>$n0</varname> – <varname>$n9</varname></term>
16346 These variables are counters that can be incremented by means
16347 of the <option>add</option> command in filter files.
16349 </listitem></varlistentry>
16351 <term><varname>$original_domain</varname></term>
16354 <indexterm role="concept">
16355 <primary><varname>$domain</varname></primary>
16357 <indexterm role="concept">
16358 <primary><varname>$original_domain</varname></primary>
16360 When a top-level address is being processed for delivery, this contains the
16361 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
16362 generated by an alias, forward, or filter file) is being processed, this
16363 variable contains the domain of the original address. This differs from
16364 <varname>$parent_domain</varname> only when there is more than one level of aliasing or
16365 forwarding. When more than one address is being delivered in a single transport
16366 run, <varname>$original_domain</varname> is not set.
16369 If a new address is created by means of a <option>deliver</option> command in a system
16370 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
16371 part <emphasis>system-filter</emphasis> and the default qualify domain.
16373 </listitem></varlistentry>
16375 <term><varname>$original_local_part</varname></term>
16378 <indexterm role="concept">
16379 <primary><varname>$local_part</varname></primary>
16381 <indexterm role="concept">
16382 <primary><varname>$original_local_part</varname></primary>
16384 When a top-level address is being processed for delivery, this contains the
16385 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
16386 local part, because <varname>$original_local_part</varname> always contains the full local
16387 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
16388 filter file) is being processed, this variable contains the full local part of
16389 the original address.
16392 If the router that did the redirection processed the local part
16393 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
16394 This variable differs from <varname>$parent_local_part</varname> only when there is more than
16395 one level of aliasing or forwarding. When more than one address is being
16396 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
16399 If a new address is created by means of a <option>deliver</option> command in a system
16400 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
16401 part <emphasis>system-filter</emphasis> and the default qualify domain.
16403 </listitem></varlistentry>
16405 <term><varname>$originator_gid</varname></term>
16408 <indexterm role="concept">
16409 <primary>gid (group id)</primary>
16410 <secondary>of originating user</secondary>
16412 <indexterm role="concept">
16413 <primary>sender</primary>
16414 <secondary>gid</secondary>
16416 <indexterm role="concept">
16417 <primary><varname>$caller_gid</varname></primary>
16419 <indexterm role="concept">
16420 <primary><varname>$originator_gid</varname></primary>
16422 This variable contains the value of <varname>$caller_gid</varname> that was set when the
16423 message was received. For messages received via the command line, this is the
16424 gid of the sending user. For messages received by SMTP over TCP/IP, this is
16425 normally the gid of the Exim user.
16427 </listitem></varlistentry>
16429 <term><varname>$originator_uid</varname></term>
16432 <indexterm role="concept">
16433 <primary>uid (user id)</primary>
16434 <secondary>of originating user</secondary>
16436 <indexterm role="concept">
16437 <primary>sender</primary>
16438 <secondary>uid</secondary>
16440 <indexterm role="concept">
16441 <primary><varname>$caller_uid</varname></primary>
16443 <indexterm role="concept">
16444 <primary><varname>$originaltor_uid</varname></primary>
16446 The value of <varname>$caller_uid</varname> that was set when the message was received. For
16447 messages received via the command line, this is the uid of the sending user.
16448 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
16451 </listitem></varlistentry>
16453 <term><varname>$parent_domain</varname></term>
16456 <indexterm role="concept">
16457 <primary><varname>$parent_domain</varname></primary>
16459 This variable is similar to <varname>$original_domain</varname> (see
16460 above), except that it refers to the immediately preceding parent address.
16462 </listitem></varlistentry>
16464 <term><varname>$parent_local_part</varname></term>
16467 <indexterm role="concept">
16468 <primary><varname>$parent_local_part</varname></primary>
16470 This variable is similar to <varname>$original_local_part</varname>
16471 (see above), except that it refers to the immediately preceding parent address.
16473 </listitem></varlistentry>
16475 <term><varname>$pid</varname></term>
16478 <indexterm role="concept">
16479 <primary>pid (process id)</primary>
16480 <secondary>of current process</secondary>
16482 <indexterm role="concept">
16483 <primary><varname>$pid</varname></primary>
16485 This variable contains the current process id.
16487 </listitem></varlistentry>
16489 <term><varname>$pipe_addresses</varname></term>
16492 <indexterm role="concept">
16493 <primary>filter</primary>
16494 <secondary>transport filter</secondary>
16496 <indexterm role="concept">
16497 <primary>transport</primary>
16498 <secondary>filter</secondary>
16500 <indexterm role="concept">
16501 <primary><varname>$pipe_addresses</varname></primary>
16503 This is not an expansion variable, but is mentioned here because the string
16504 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
16505 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
16506 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
16507 It cannot be used in general expansion strings, and provokes an <quote>unknown
16508 variable</quote> error if encountered.
16510 </listitem></varlistentry>
16512 <term><varname>$primary_hostname</varname></term>
16515 <indexterm role="concept">
16516 <primary><varname>$primary_hostname</varname></primary>
16518 This variable contains the value set by <option>primary_hostname</option> in the
16519 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
16520 a single-component name, Exim calls <function>gethostbyname()</function> (or
16521 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
16522 qualified host name. See also <varname>$smtp_active_hostname</varname>.
16524 </listitem></varlistentry>
16526 <term><varname>$prvscheck_address</varname></term>
16529 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
16530 which is described in sections <xref linkend="SECTexpansionitems"/> and
16531 <xref linkend="SECTverifyPRVS"/>.
16533 </listitem></varlistentry>
16535 <term><varname>$prvscheck_keynum</varname></term>
16538 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
16539 which is described in sections <xref linkend="SECTexpansionitems"/> and
16540 <xref linkend="SECTverifyPRVS"/>.
16542 </listitem></varlistentry>
16544 <term><varname>$prvscheck_result</varname></term>
16547 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
16548 which is described in sections <xref linkend="SECTexpansionitems"/> and
16549 <xref linkend="SECTverifyPRVS"/>.
16551 </listitem></varlistentry>
16553 <term><varname>$qualify_domain</varname></term>
16556 <indexterm role="concept">
16557 <primary><varname>$qualify_domain</varname></primary>
16559 The value set for the <option>qualify_domain</option> option in the configuration file.
16561 </listitem></varlistentry>
16563 <term><varname>$qualify_recipient</varname></term>
16566 <indexterm role="concept">
16567 <primary><varname>$qualify_recipient</varname></primary>
16569 The value set for the <option>qualify_recipient</option> option in the configuration file,
16570 or if not set, the value of <varname>$qualify_domain</varname>.
16572 </listitem></varlistentry>
16574 <term><varname>$rcpt_count</varname></term>
16577 <indexterm role="concept">
16578 <primary><varname>$rcpt_count</varname></primary>
16580 When a message is being received by SMTP, this variable contains the number of
16581 RCPT commands received for the current message. If this variable is used in a
16582 RCPT ACL, its value includes the current command.
16584 </listitem></varlistentry>
16586 <term><varname>$rcpt_defer_count</varname></term>
16589 <indexterm role="concept">
16590 <primary><varname>$rcpt_defer_count</varname></primary>
16592 When a message is being received by SMTP, this variable contains the number of
16593 RCPT commands in the current message that have previously been rejected with a
16594 temporary (4<emphasis>xx</emphasis>) response.
16596 </listitem></varlistentry>
16598 <term><varname>$rcpt_fail_count</varname></term>
16601 <indexterm role="concept">
16602 <primary><varname>$rcpt_fail_count</varname></primary>
16604 When a message is being received by SMTP, this variable contains the number of
16605 RCPT commands in the current message that have previously been rejected with a
16606 permanent (5<emphasis>xx</emphasis>) response.
16608 </listitem></varlistentry>
16610 <term><varname>$received_count</varname></term>
16613 <indexterm role="concept">
16614 <primary><varname>$received_count</varname></primary>
16616 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
16617 including the one added by Exim (so its value is always greater than zero). It
16618 is available in the DATA ACL, the non-SMTP ACL, and while routing and
16621 </listitem></varlistentry>
16623 <term><varname>$received_for</varname></term>
16626 <indexterm role="concept">
16627 <primary><varname>$received_for</varname></primary>
16629 If there is only a single recipient address in an incoming message, this
16630 variable contains that address when the <emphasis>Received:</emphasis> header line is being
16631 built. The value is copied after recipient rewriting has happened, but before
16632 the <function>local_scan()</function> function is run.
16634 </listitem></varlistentry>
16636 <term><varname>$received_protocol</varname></term>
16639 <indexterm role="concept">
16640 <primary><varname>$received_protocol</varname></primary>
16642 When a message is being processed, this variable contains the name of the
16643 protocol by which it was received. Most of the names used by Exim are defined
16644 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
16645 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
16646 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
16647 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
16648 connection and the client was successfully authenticated.
16651 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
16652 automatically set up on connection without the use of STARTTLS (see
16653 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
16654 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
16655 where the client initially uses EHLO, sets up an encrypted connection using
16656 STARTTLS, and then uses HELO afterwards.
16659 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
16660 messages that are injected locally by trusted callers. This is commonly used to
16661 identify messages that are being re-injected after some kind of scanning.
16663 </listitem></varlistentry>
16665 <term><varname>$received_time</varname></term>
16668 <indexterm role="concept">
16669 <primary><varname>$received_time</varname></primary>
16671 This variable contains the date and time when the current message was received,
16672 as a number of seconds since the start of the Unix epoch.
16674 </listitem></varlistentry>
16676 <term><varname>$recipient_data</varname></term>
16679 <indexterm role="concept">
16680 <primary><varname>$recipient_data</varname></primary>
16682 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
16683 condition. It contains the data from the lookup, and the value remains set
16684 until the next <option>recipients</option> test. Thus, you can do things like this:
16687 <literal>require recipients = cdb*@;/some/file</literal>
16688 <literal>deny </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
16691 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
16692 method in the address list, using the semicolon syntax as in the example above.
16693 The variable is not set for a lookup that is used as part of the string
16694 expansion that all such lists undergo before being interpreted.
16696 </listitem></varlistentry>
16698 <term><varname>$recipient_verify_failure</varname></term>
16701 <indexterm role="concept">
16702 <primary><varname>$recipient_verify_failure</varname></primary>
16704 In an ACL, when a recipient verification fails, this variable contains
16705 information about the failure. It is set to one of the following words:
16710 <quote>qualify</quote>: The address was unqualified (no domain), and the message
16711 was neither local nor came from an exempted host.
16716 <quote>route</quote>: Routing failed.
16721 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
16722 or before the MAIL command (that is, on initial connection, HELO, or
16728 <quote>recipient</quote>: The RCPT command in a callout was rejected.
16733 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
16738 The main use of this variable is expected to be to distinguish between
16739 rejections of MAIL and rejections of RCPT.
16741 </listitem></varlistentry>
16743 <term><varname>$recipients</varname></term>
16746 <indexterm role="concept">
16747 <primary><varname>$recipients</varname></primary>
16749 This variable contains a list of envelope recipients for a
16750 message. A comma and a space separate the addresses in the replacement text.
16751 However, the variable is not generally available, to prevent exposure of Bcc
16752 recipients in unprivileged users’ filter files. You can use <varname>$recipients</varname> only
16753 in these two cases:
16755 <orderedlist numeration="arabic">
16758 In a system filter file.
16762 <para revisionflag="changed">
16763 In the ACLs associated with the DATA command and with non-SMTP messages, that
16764 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
16765 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
16766 <option>acl_not_smtp_mime</option>.
16770 </listitem></varlistentry>
16772 <term><varname>$recipients_count</varname></term>
16775 <indexterm role="concept">
16776 <primary><varname>$recipients_count</varname></primary>
16778 When a message is being processed, this variable contains the number of
16779 envelope recipients that came with the message. Duplicates are not excluded
16780 from the count. While a message is being received over SMTP, the number
16781 increases for each accepted recipient. It can be referenced in an ACL.
16783 </listitem></varlistentry>
16784 <varlistentry revisionflag="changed">
16785 <term><varname>$regex_match_string</varname></term>
16787 <para revisionflag="changed">
16788 <indexterm role="concept">
16789 <primary><varname>$regex_match_string</varname></primary>
16791 This variable is set to contain the matching regular expression after a
16792 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
16794 </listitem></varlistentry>
16796 <term><varname>$reply_address</varname></term>
16799 <indexterm role="concept">
16800 <primary><varname>$reply_address</varname></primary>
16802 When a message is being processed, this variable contains the contents of the
16803 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
16804 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
16805 white space, the value is not processed in any way. In particular, no RFC 2047
16806 decoding or character code translation takes place.
16808 </listitem></varlistentry>
16810 <term><varname>$return_path</varname></term>
16813 <indexterm role="concept">
16814 <primary><varname>$return_path</varname></primary>
16816 When a message is being delivered, this variable contains the return path –
16817 the sender field that will be sent as part of the envelope. It is not enclosed
16818 in <> characters. At the start of routing an address, <varname>$return_path</varname> has the
16819 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
16820 mailing list has been expanded by a router which specifies a different address
16821 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
16822 address, whereas <varname>$sender_address</varname> always contains the original sender address
16823 that was received with the message. In other words, <varname>$sender_address</varname> contains
16824 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
16827 </listitem></varlistentry>
16829 <term><varname>$return_size_limit</varname></term>
16832 <indexterm role="concept">
16833 <primary><varname>$return_size_limit</varname></primary>
16835 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
16837 </listitem></varlistentry>
16839 <term><varname>$runrc</varname></term>
16842 <indexterm role="concept">
16843 <primary>return code</primary>
16844 <secondary>from <option>run</option> expansion</secondary>
16846 <indexterm role="concept">
16847 <primary><varname>$runrc</varname></primary>
16849 This variable contains the return code from a command that is run by the
16850 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
16851 assume the order in which option values are expanded, except for those
16852 preconditions whose order of testing is documented. Therefore, you cannot
16853 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
16856 </listitem></varlistentry>
16858 <term><varname>$self_hostname</varname></term>
16861 <indexterm role="concept">
16862 <primary><option>self</option> option</primary>
16863 <secondary>value of host name</secondary>
16865 <indexterm role="concept">
16866 <primary><varname>$self_hostname</varname></primary>
16868 When an address is routed to a supposedly remote host that turns out to be the
16869 local host, what happens is controlled by the <option>self</option> generic router option.
16870 One of its values causes the address to be passed to another router. When this
16871 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
16872 original router encountered. In other circumstances its contents are null.
16874 </listitem></varlistentry>
16876 <term><varname>$sender_address</varname></term>
16879 <indexterm role="concept">
16880 <primary><varname>$sender_address</varname></primary>
16882 When a message is being processed, this variable contains the sender’s address
16883 that was received in the message’s envelope. For bounce messages, the value of
16884 this variable is the empty string. See also <varname>$return_path</varname>.
16886 </listitem></varlistentry>
16888 <term><varname>$sender_address_data</varname></term>
16891 <indexterm role="concept">
16892 <primary><varname>$address_data</varname></primary>
16894 <indexterm role="concept">
16895 <primary><varname>$sender_address_data</varname></primary>
16897 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
16898 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
16899 distinguish it from data from a recipient address. The value does not persist
16900 after the end of the current ACL statement. If you want to preserve it for
16901 longer, you can save it in an ACL variable.
16903 </listitem></varlistentry>
16905 <term><varname>$sender_address_domain</varname></term>
16908 <indexterm role="concept">
16909 <primary><varname>$sender_address_domain</varname></primary>
16911 The domain portion of <varname>$sender_address</varname>.
16913 </listitem></varlistentry>
16915 <term><varname>$sender_address_local_part</varname></term>
16918 <indexterm role="concept">
16919 <primary><varname>$sender_address_local_part</varname></primary>
16921 The local part portion of <varname>$sender_address</varname>.
16923 </listitem></varlistentry>
16925 <term><varname>$sender_data</varname></term>
16928 <indexterm role="concept">
16929 <primary><varname>$sender_data</varname></primary>
16931 This variable is set after a lookup success in an ACL <option>senders</option> condition or
16932 in a router <option>senders</option> option. It contains the data from the lookup, and the
16933 value remains set until the next <option>senders</option> test. Thus, you can do things like
16937 <literal>require senders = cdb*@;/some/file</literal>
16938 <literal>deny </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
16941 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
16942 method in the address list, using the semicolon syntax as in the example above.
16943 The variable is not set for a lookup that is used as part of the string
16944 expansion that all such lists undergo before being interpreted.
16946 </listitem></varlistentry>
16948 <term><varname>$sender_fullhost</varname></term>
16951 <indexterm role="concept">
16952 <primary><varname>$sender_fullhost</varname></primary>
16954 When a message is received from a remote host, this variable contains the host
16955 name and IP address in a single string. It ends with the IP address in square
16956 brackets, followed by a colon and a port number if the logging of ports is
16957 enabled. The format of the rest of the string depends on whether the host
16958 issued a HELO or EHLO SMTP command, and whether the host name was verified by
16959 looking up its IP address. (Looking up the IP address can be forced by the
16960 <option>host_lookup</option> option, independent of verification.) A plain host name at the
16961 start of the string is a verified host name; if this is not present,
16962 verification either failed or was not requested. A host name in parentheses is
16963 the argument of a HELO or EHLO command. This is omitted if it is identical to
16964 the verified host name or to the host’s IP address in square brackets.
16966 </listitem></varlistentry>
16968 <term><varname>$sender_helo_name</varname></term>
16971 <indexterm role="concept">
16972 <primary><varname>$sender_helo_name</varname></primary>
16974 When a message is received from a remote host that has issued a HELO or EHLO
16975 command, the argument of that command is placed in this variable. It is also
16976 set if HELO or EHLO is used when a message is received using SMTP locally via
16977 the <option>-bs</option> or <option>-bS</option> options.
16979 </listitem></varlistentry>
16981 <term><varname>$sender_host_address</varname></term>
16984 <indexterm role="concept">
16985 <primary><varname>$sender_host_address</varname></primary>
16987 When a message is received from a remote host, this variable contains that
16988 host’s IP address. For locally submitted messages, it is empty.
16990 </listitem></varlistentry>
16992 <term><varname>$sender_host_authenticated</varname></term>
16995 <indexterm role="concept">
16996 <primary><varname>$sender_host_authenticated</varname></primary>
16998 This variable contains the name (not the public name) of the authenticator
16999 driver that successfully authenticated the client from which the message was
17000 received. It is empty if there was no successful authentication. See also
17001 <varname>$authenticated_id</varname>.
17003 </listitem></varlistentry>
17005 <term><varname>$sender_host_name</varname></term>
17008 <indexterm role="concept">
17009 <primary><varname>$sender_host_name</varname></primary>
17011 When a message is received from a remote host, this variable contains the
17012 host’s name as obtained by looking up its IP address. For messages received by
17013 other means, this variable is empty.
17016 <indexterm role="concept">
17017 <primary><varname>$host_lookup_failed</varname></primary>
17019 If the host name has not previously been looked up, a reference to
17020 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
17021 A looked up name is accepted only if it leads back to the original IP address
17022 via a forward lookup. If either the reverse or the forward lookup fails to find
17023 any data, or if the forward lookup does not yield the original IP address,
17024 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
17027 <indexterm role="concept">
17028 <primary><varname>$host_lookup_deferred</varname></primary>
17030 However, if either of the lookups cannot be completed (for example, there is a
17031 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
17032 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
17034 <para revisionflag="changed">
17035 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
17036 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
17037 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
17038 is set to <quote>1</quote>.
17041 Exim does not automatically look up every calling host’s name. If you want
17042 maximum efficiency, you should arrange your configuration so that it avoids
17043 these lookups altogether. The lookup happens only if one or more of the
17044 following are true:
17049 A string containing <varname>$sender_host_name</varname> is expanded.
17054 The calling host matches the list in <option>host_lookup</option>. In the default
17055 configuration, this option is set to *, so it must be changed if lookups are
17056 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
17061 Exim needs the host name in order to test an item in a host list. The items
17062 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
17063 <xref linkend="SECThoslispatnamsk"/>.
17068 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
17069 In this case, the host name is required to compare with the name quoted in any
17070 EHLO or HELO commands that the client issues.
17075 The remote host issues a EHLO or HELO command that quotes one of the
17076 domains in <option>helo_lookup_domains</option>. The default value of this option is
17078 <literallayout class="monospaced">
17079 helo_lookup_domains = @ : @[]
17082 which causes a lookup if a remote host (incorrectly) gives the server’s name or
17083 IP address in an EHLO or HELO command.
17087 </listitem></varlistentry>
17089 <term><varname>$sender_host_port</varname></term>
17092 <indexterm role="concept">
17093 <primary><varname>$sender_host_port</varname></primary>
17095 When a message is received from a remote host, this variable contains the port
17096 number that was used on the remote host.
17098 </listitem></varlistentry>
17100 <term><varname>$sender_ident</varname></term>
17103 <indexterm role="concept">
17104 <primary><varname>$sender_ident</varname></primary>
17106 When a message is received from a remote host, this variable contains the
17107 identification received in response to an RFC 1413 request. When a message has
17108 been received locally, this variable contains the login name of the user that
17111 </listitem></varlistentry>
17113 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
17116 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
17117 <option>ratelimit</option> ACL condition. Details are given in section
17118 <xref linkend="SECTratelimiting"/>.
17120 </listitem></varlistentry>
17122 <term><varname>$sender_rcvhost</varname></term>
17125 <indexterm role="concept">
17126 <primary>DNS</primary>
17127 <secondary>reverse lookup</secondary>
17129 <indexterm role="concept">
17130 <primary>reverse DNS lookup</primary>
17132 <indexterm role="concept">
17133 <primary><varname>$sender_rcvhost</varname></primary>
17135 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
17136 either the verified host name (as obtained from a reverse DNS lookup) or, if
17137 there is no verified host name, the IP address in square brackets. After that
17138 there may be text in parentheses. When the first item is a verified host name,
17139 the first thing in the parentheses is the IP address in square brackets,
17140 followed by a colon and a port number if port logging is enabled. When the
17141 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
17145 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
17146 was used and its argument was not identical to the real host name or IP
17147 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
17148 all three items are present in the parentheses, a newline and tab are inserted
17149 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
17151 </listitem></varlistentry>
17153 <term><varname>$sender_verify_failure</varname></term>
17156 <indexterm role="concept">
17157 <primary><varname>$sender_verify_failure</varname></primary>
17159 In an ACL, when a sender verification fails, this variable contains information
17160 about the failure. The details are the same as for
17161 <varname>$recipient_verify_failure</varname>.
17163 </listitem></varlistentry>
17165 <term><varname>$smtp_active_hostname</varname></term>
17168 <indexterm role="concept">
17169 <primary><varname>$smtp_active_hostname</varname></primary>
17171 During an SMTP session, this variable contains the value of the active host
17172 name, as specified by the <option>smtp_active_hostname</option> option. The value of
17173 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
17174 value can be consulted during routing and delivery.
17176 </listitem></varlistentry>
17178 <term><varname>$smtp_command</varname></term>
17181 <indexterm role="concept">
17182 <primary><varname>$smtp_command</varname></primary>
17184 During the processing of an incoming SMTP command, this variable contains the
17185 entire command. This makes it possible to distinguish between HELO and EHLO in
17186 the HELO ACL, and also to distinguish between commands such as these:
17188 <literallayout class="monospaced">
17190 MAIL FROM: <>
17193 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
17194 command, the address in <varname>$smtp_command</varname> is the original address before any
17195 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
17196 the address after SMTP-time rewriting.
17198 </listitem></varlistentry>
17200 <term><varname>$smtp_command_argument</varname></term>
17203 <indexterm role="concept">
17204 <primary>SMTP command</primary>
17205 <secondary>argument for</secondary>
17207 <indexterm role="concept">
17208 <primary><varname>$smtp_command_argument</varname></primary>
17210 While an ACL is running to check an SMTP command, this variable contains the
17211 argument, that is, the text that follows the command name, with leading white
17212 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
17213 somewhat redundant, but is retained for backwards compatibility.
17215 </listitem></varlistentry>
17217 <term><varname>$sn0</varname> – <varname>$sn9</varname></term>
17220 These variables are copies of the values of the <varname>$n0</varname> – <varname>$n9</varname> accumulators
17221 that were current at the end of the system filter file. This allows a system
17222 filter file to set values that can be tested in users’ filter files. For
17223 example, a system filter could set a value indicating how likely it is that a
17224 message is junk mail.
17226 </listitem></varlistentry>
17228 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
17231 A number of variables whose names start with <varname>$spam</varname> are available when Exim
17232 is compiled with the content-scanning extension. For details, see section
17233 <xref linkend="SECTscanspamass"/>.
17235 </listitem></varlistentry>
17237 <term><varname>$spool_directory</varname></term>
17240 <indexterm role="concept">
17241 <primary><varname>$spool_directory</varname></primary>
17243 The name of Exim’s spool directory.
17245 </listitem></varlistentry>
17247 <term><varname>$spool_inodes</varname></term>
17250 <indexterm role="concept">
17251 <primary><varname>$spool_inodes</varname></primary>
17253 The number of free inodes in the disk partition where Exim’s spool files are
17254 being written. The value is recalculated whenever the variable is referenced.
17255 If the relevant file system does not have the concept of inodes, the value of
17256 is -1. See also the <option>check_spool_inodes</option> option.
17258 </listitem></varlistentry>
17260 <term><varname>$spool_space</varname></term>
17263 <indexterm role="concept">
17264 <primary><varname>$spool_space</varname></primary>
17266 The amount of free space (as a number of kilobytes) in the disk partition where
17267 Exim’s spool files are being written. The value is recalculated whenever the
17268 variable is referenced. If the operating system does not have the ability to
17269 find the amount of free space (only true for experimental systems), the space
17270 value is -1. For example, to check in an ACL that there is at least 50
17271 megabytes free on the spool, you could write:
17273 <literallayout class="monospaced">
17274 condition = ${if > {$spool_space}{50000}}
17277 See also the <option>check_spool_space</option> option.
17279 </listitem></varlistentry>
17281 <term><varname>$thisaddress</varname></term>
17284 <indexterm role="concept">
17285 <primary><varname>$thisaddress</varname></primary>
17287 This variable is set only during the processing of the <option>foranyaddress</option>
17288 command in a filter file. Its use is explained in the description of that
17289 command, which can be found in the separate document entitled <emphasis>Exim’s
17290 interfaces to mail filtering</emphasis>.
17292 </listitem></varlistentry>
17294 <term><varname>$tls_certificate_verified</varname></term>
17297 <indexterm role="concept">
17298 <primary><varname>$tls_certificate_verified</varname></primary>
17300 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
17301 message was received, and <quote>0</quote> otherwise.
17303 </listitem></varlistentry>
17305 <term><varname>$tls_cipher</varname></term>
17308 <indexterm role="concept">
17309 <primary><varname>$tls_cipher</varname></primary>
17311 When a message is received from a remote host over an encrypted SMTP
17312 connection, this variable is set to the cipher suite that was negotiated, for
17313 example DES-CBC3-SHA. In other circumstances, in particular, for message
17314 received over unencrypted connections, the variable is empty. See chapter
17315 <xref linkend="CHAPTLS"/> for details of TLS support.
17317 </listitem></varlistentry>
17319 <term><varname>$tls_peerdn</varname></term>
17322 <indexterm role="concept">
17323 <primary><varname>$tls_peerdn</varname></primary>
17325 When a message is received from a remote host over an encrypted SMTP
17326 connection, and Exim is configured to request a certificate from the client,
17327 the value of the Distinguished Name of the certificate is made available in the
17328 <varname>$tls_peerdn</varname> during subsequent processing.
17330 </listitem></varlistentry>
17332 <term><varname>$tod_bsdinbox</varname></term>
17335 <indexterm role="concept">
17336 <primary><varname>$tod_bsdinbox</varname></primary>
17338 The time of day and the date, in the format required for BSD-style mailbox
17339 files, for example: Thu Oct 17 17:14:09 1995.
17341 </listitem></varlistentry>
17343 <term><varname>$tod_epoch</varname></term>
17346 <indexterm role="concept">
17347 <primary><varname>$tod_epoch</varname></primary>
17349 The time and date as a number of seconds since the start of the Unix epoch.
17351 </listitem></varlistentry>
17353 <term><varname>$tod_full</varname></term>
17356 <indexterm role="concept">
17357 <primary><varname>$tod_full</varname></primary>
17359 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
17360 +0100. The timezone is always given as a numerical offset from UTC, with
17361 positive values used for timezones that are ahead (east) of UTC, and negative
17362 values for those that are behind (west).
17364 </listitem></varlistentry>
17366 <term><varname>$tod_log</varname></term>
17369 <indexterm role="concept">
17370 <primary><varname>$tod_log</varname></primary>
17372 The time and date in the format used for writing Exim’s log files, for example:
17373 1995-10-12 15:32:29, but without a timezone.
17375 </listitem></varlistentry>
17377 <term><varname>$tod_logfile</varname></term>
17380 <indexterm role="concept">
17381 <primary><varname>$tod_logfile</varname></primary>
17383 This variable contains the date in the format yyyymmdd. This is the format that
17384 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
17387 </listitem></varlistentry>
17389 <term><varname>$tod_zone</varname></term>
17392 <indexterm role="concept">
17393 <primary><varname>$tod_zone</varname></primary>
17395 This variable contains the numerical value of the local timezone, for example:
17398 </listitem></varlistentry>
17400 <term><varname>$tod_zulu</varname></term>
17403 <indexterm role="concept">
17404 <primary><varname>$tod_zulu</varname></primary>
17406 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
17407 by ISO 8601, for example: 20030221154023Z.
17409 </listitem></varlistentry>
17411 <term><varname>$value</varname></term>
17414 <indexterm role="concept">
17415 <primary><varname>$value</varname></primary>
17417 This variable contains the result of an expansion lookup, extraction operation,
17418 or external command, as described above.
17420 </listitem></varlistentry>
17422 <term><varname>$version_number</varname></term>
17425 <indexterm role="concept">
17426 <primary><varname>$version_number</varname></primary>
17428 The version number of Exim.
17430 </listitem></varlistentry>
17432 <term><varname>$warn_message_delay</varname></term>
17435 <indexterm role="concept">
17436 <primary><varname>$warn_message_delay</varname></primary>
17438 This variable is set only during the creation of a message warning about a
17439 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
17441 </listitem></varlistentry>
17443 <term><varname>$warn_message_recipients</varname></term>
17446 <indexterm role="concept">
17447 <primary><varname>$warn_message_recipients</varname></primary>
17449 This variable is set only during the creation of a message warning about a
17450 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
17452 </listitem></varlistentry>
17455 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
17460 <chapter id="CHAPperl">
17461 <title>Embedded Perl</title>
17463 <indexterm role="concept" id="IIDperl" class="startofrange">
17464 <primary>Perl</primary>
17465 <secondary>calling from Exim</secondary>
17467 Exim can be built to include an embedded Perl interpreter. When this is done,
17468 Perl subroutines can be called as part of the string expansion process. To make
17469 use of the Perl support, you need version 5.004 or later of Perl installed on
17470 your system. To include the embedded interpreter in the Exim binary, include
17473 <literallayout class="monospaced">
17477 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
17480 <title>Setting up so Perl can be used</title>
17482 <indexterm role="concept">
17483 <primary><option>perl_startup</option></primary>
17485 Access to Perl subroutines is via a global configuration option called
17486 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
17487 no <option>perl_startup</option> option in the Exim configuration file then no Perl
17488 interpreter is started and there is almost no overhead for Exim (since none of
17489 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
17490 option then the associated value is taken to be Perl code which is executed in
17491 a newly created Perl interpreter.
17494 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
17495 need backslashes before any characters to escape special meanings. The option
17496 should usually be something like
17498 <literallayout class="monospaced">
17499 perl_startup = do '/etc/exim.pl'
17502 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
17503 use from Exim. Exim can be configured either to start up a Perl interpreter as
17504 soon as it is entered, or to wait until the first time it is needed. Starting
17505 the interpreter at the beginning ensures that it is done while Exim still has
17506 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
17507 fact used in a particular run. Also, note that this does not mean that Exim is
17508 necessarily running as root when Perl is called at a later time. By default,
17509 the interpreter is started only when it is needed, but this can be changed in
17515 <indexterm role="concept">
17516 <primary><option>perl_at_start</option></primary>
17518 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
17519 a startup when Exim is entered.
17524 The command line option <option>-ps</option> also requests a startup when Exim is entered,
17525 overriding the setting of <option>perl_at_start</option>.
17530 There is also a command line option <option>-pd</option> (for delay) which suppresses the
17531 initial startup, even if <option>perl_at_start</option> is set.
17535 <title>Calling Perl subroutines</title>
17537 When the configuration file includes a <option>perl_startup</option> option you can make use
17538 of the string expansion item to call the Perl subroutines that are defined
17539 by the <option>perl_startup</option> code. The operator is used in any of the following
17542 <literallayout class="monospaced">
17544 ${perl{foo}{argument}}
17545 ${perl{foo}{argument1}{argument2} ... }
17548 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
17549 arguments may be passed. Passing more than this results in an expansion failure
17550 with an error message of the form
17552 <literallayout class="monospaced">
17553 Too many arguments passed to Perl subroutine "foo" (max is 8)
17556 The return value of the Perl subroutine is evaluated in a scalar context before
17557 it is passed back to Exim to be inserted into the expanded string. If the
17558 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
17559 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
17560 by obeying Perl’s <option>die</option> function, the expansion fails with the error message
17561 that was passed to <option>die</option>.
17565 <title>Calling Exim functions from Perl</title>
17567 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
17568 is available to call back into Exim’s string expansion function. For example,
17571 <literallayout class="monospaced">
17572 my $lp = Exim::expand_string('$local_part');
17575 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
17576 Note those are single quotes and not double quotes to protect against
17577 <varname>$local_part</varname> being interpolated as a Perl variable.
17580 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
17581 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
17582 expansion string, the Perl call from the original expansion string fails with
17583 an appropriate error message, in the same way as if <option>die</option> were used.
17586 <indexterm role="concept">
17587 <primary>debugging</primary>
17588 <secondary>from embedded Perl</secondary>
17590 <indexterm role="concept">
17591 <primary>log</primary>
17592 <secondary>writing from embedded Perl</secondary>
17594 Two other Exim functions are available for use from within Perl code.
17595 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim’s
17596 debugging is enabled. If you want a newline at the end, you must supply it.
17597 <emphasis>Exim::log_write()</emphasis> writes a string to Exim’s main log, adding a leading
17598 timestamp. In this case, you should not supply a terminating newline.
17602 <title>Use of standard output and error by Perl</title>
17604 <indexterm role="concept">
17605 <primary>Perl</primary>
17606 <secondary>standard output and error</secondary>
17608 You should not write to the standard error or output streams from within your
17609 Perl code, as it is not defined how these are set up. In versions of Exim
17610 before 4.50, it is possible for the standard output or error to refer to the
17611 SMTP connection during message reception via the daemon. Writing to this stream
17612 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
17613 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
17614 avoided, but the output is lost.
17617 <indexterm role="concept">
17618 <primary>Perl</primary>
17619 <secondary>use of <option>warn</option></secondary>
17621 The Perl <option>warn</option> statement writes to the standard error stream by default.
17622 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
17623 you have no control. When Exim starts up the Perl interpreter, it arranges for
17624 output from the <option>warn</option> statement to be written to the Exim main log. You can
17625 change this by including appropriate Perl magic somewhere in your Perl code.
17626 For example, to discard <option>warn</option> output completely, you need this:
17628 <literallayout class="monospaced">
17629 $SIG{__WARN__} = sub { };
17632 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
17633 example, the code for the subroutine is empty, so it does nothing, but you can
17634 include any Perl code that you like. The text of the <option>warn</option> message is passed
17635 as the first subroutine argument.
17636 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
17641 <chapter id="CHAPinterfaces">
17642 <title>Starting the daemon and the use of network interfaces</title>
17643 <titleabbrev>Starting the daemon</titleabbrev>
17645 <indexterm role="concept">
17646 <primary>daemon</primary>
17647 <secondary>starting</secondary>
17649 <indexterm role="concept">
17650 <primary>interface</primary>
17651 <secondary>listening</secondary>
17653 <indexterm role="concept">
17654 <primary>network interface</primary>
17656 <indexterm role="concept">
17657 <primary>interface</primary>
17658 <secondary>network</secondary>
17660 <indexterm role="concept">
17661 <primary>IP address</primary>
17662 <secondary>for listening</secondary>
17664 <indexterm role="concept">
17665 <primary>daemon</primary>
17666 <secondary>listening IP addresses</secondary>
17668 <indexterm role="concept">
17669 <primary>TCP/IP</primary>
17670 <secondary>setting listening interfaces</secondary>
17672 <indexterm role="concept">
17673 <primary>TCP/IP</primary>
17674 <secondary>setting listening ports</secondary>
17676 A host that is connected to a TCP/IP network may have one or more physical
17677 hardware network interfaces. Each of these interfaces may be configured as one
17678 or more <quote>logical</quote> interfaces, which are the entities that a program actually
17679 works with. Each of these logical interfaces is associated with an IP address.
17680 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
17681 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
17682 knowledge about the host’s interfaces for use in three different circumstances:
17684 <orderedlist numeration="arabic">
17687 When a listening daemon is started, Exim needs to know which interfaces
17688 and ports to listen on.
17693 When Exim is routing an address, it needs to know which IP addresses
17694 are associated with local interfaces. This is required for the correct
17695 processing of MX lists by removing the local host and others with the
17696 same or higher priority values. Also, Exim needs to detect cases
17697 when an address is routed to an IP address that in fact belongs to the
17698 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
17699 option of the smtp transport is set (as appropriate), this is treated
17700 as an error situation.
17705 When Exim connects to a remote host, it may need to know which interface to use
17706 for the outgoing connection.
17711 Exim’s default behaviour is likely to be appropriate in the vast majority
17712 of cases. If your host has only one interface, and you want all its IP
17713 addresses to be treated in the same way, and you are using only the
17714 standard SMTP port, you should not need to take any special action. The
17715 rest of this chapter does not apply to you.
17718 In a more complicated situation you may want to listen only on certain
17719 interfaces, or on different ports, and for this reason there are a number of
17720 options that can be used to influence Exim’s behaviour. The rest of this
17721 chapter describes how they operate.
17724 When a message is received over TCP/IP, the interface and port that were
17725 actually used are set in <varname>$interface_address</varname> and <varname>$interface_port</varname>.
17728 <title>Starting a listening daemon</title>
17730 When a listening daemon is started (by means of the <option>-bd</option> command line
17731 option), the interfaces and ports on which it listens are controlled by the
17737 <option>daemon_smtp_ports</option> contains a list of default ports. (For backward
17738 compatibility, this option can also be specified in the singular.)
17743 <option>local_interfaces</option> contains list of interface IP addresses on which to
17744 listen. Each item may optionally also specify a port.
17749 The default list separator in both cases is a colon, but this can be changed as
17750 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
17751 it is usually best to change the separator to avoid having to double all the
17752 colons. For example:
17754 <literallayout class="monospaced">
17755 local_interfaces = <; 127.0.0.1 ; \
17758 3ffe:ffff:836f::fe86:a061
17761 There are two different formats for specifying a port along with an IP address
17762 in <option>local_interfaces</option>:
17764 <orderedlist numeration="arabic">
17767 The port is added onto the address with a dot separator. For example, to listen
17768 on port 1234 on two different IP addresses:
17770 <literallayout class="monospaced">
17771 local_interfaces = <; 192.168.23.65.1234 ; \
17772 3ffe:ffff:836f::fe86:a061.1234
17777 The IP address is enclosed in square brackets, and the port is added
17778 with a colon separator, for example:
17780 <literallayout class="monospaced">
17781 local_interfaces = <; [192.168.23.65]:1234 ; \
17782 [3ffe:ffff:836f::fe86:a061]:1234
17787 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
17788 default setting contains just one port:
17790 <literallayout class="monospaced">
17791 daemon_smtp_ports = smtp
17794 If more than one port is listed, each interface that does not have its own port
17795 specified listens on all of them. Ports that are listed in
17796 <option>daemon_smtp_ports</option> can be identified either by name (defined in
17797 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
17798 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
17802 <title>Special IP listening addresses</title>
17804 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
17805 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
17806 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
17807 instead of setting up separate listening sockets for each interface. The
17808 default value of <option>local_interfaces</option> is
17810 <literallayout class="monospaced">
17811 local_interfaces = 0.0.0.0
17814 when Exim is built without IPv6 support; otherwise it is:
17816 <literallayout class="monospaced">
17817 local_interfaces = <; ::0 ; 0.0.0.0
17820 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
17824 <title>Overriding local_interfaces and daemon_smtp_ports</title>
17826 The <option>-oX</option> command line option can be used to override the values of
17827 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
17828 instance. Another way of doing this would be to use macros and the <option>-D</option>
17829 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
17830 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
17834 The value of <option>-oX</option> is a list of items. The default colon separator can be
17835 changed in the usual way if required. If there are any items that do not
17836 contain dots or colons (that is, are not IP addresses), the value of
17837 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
17838 items that do contain dots or colons, the value of <option>local_interfaces</option> is
17839 replaced by those items. Thus, for example,
17841 <literallayout class="monospaced">
17845 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
17848 <literallayout class="monospaced">
17849 -oX 192.168.34.5.1125
17852 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
17853 (However, since <option>local_interfaces</option> now contains no items without ports, the
17854 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
17857 <section id="SECTsupobssmt">
17858 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
17860 <indexterm role="concept">
17861 <primary>ssmtp protocol</primary>
17863 <indexterm role="concept">
17864 <primary>smtps protocol</primary>
17866 <indexterm role="concept">
17867 <primary>SMTP</primary>
17868 <secondary>ssmtp protocol</secondary>
17870 <indexterm role="concept">
17871 <primary>SMTP</primary>
17872 <secondary>smtps protocol</secondary>
17874 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
17875 before the STARTTLS command was standardized for SMTP. Some legacy clients
17876 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
17877 list of port numbers, connections to those ports must use SSMTP. The most
17878 common use of this option is expected to be
17880 <literallayout class="monospaced">
17881 tls_on_connect_ports = 465
17884 because 465 is the usual port number used by the legacy clients. There is also
17885 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
17886 this way when a daemon is started.
17889 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
17890 daemon to listen on those ports. You must still specify them in
17891 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
17892 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
17893 connections via the daemon.)
17897 <title>IPv6 address scopes</title>
17899 <indexterm role="concept">
17900 <primary>IPv6</primary>
17901 <secondary>address scopes</secondary>
17903 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
17904 can, in principle, have the same link-local IPv6 address on different
17905 interfaces. Thus, additional information is needed, over and above the IP
17906 address, to distinguish individual interfaces. A convention of using a
17907 percent sign followed by something (often the interface name) has been
17908 adopted in some cases, leading to addresses like this:
17910 <literallayout class="monospaced">
17911 fe80::202:b3ff:fe03:45c1%eth0
17914 To accommodate this usage, a percent sign followed by an arbitrary string is
17915 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
17916 to convert a textual IPv6 address for actual use. This function recognizes the
17917 percent convention in operating systems that support it, and it processes the
17918 address appropriately. Unfortunately, some older libraries have problems with
17919 <function>getaddrinfo()</function>. If
17921 <literallayout class="monospaced">
17922 IPV6_USE_INET_PTON=yes
17925 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
17926 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
17927 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
17928 function.) Of course, this means that the additional functionality of
17929 <function>getaddrinfo()</function> – recognizing scoped addresses – is lost.
17933 <title>Disabling IPv6</title>
17935 <indexterm role="concept">
17936 <primary>IPv6</primary>
17937 <secondary>disabling</secondary>
17939 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
17940 run on a host whose kernel does not support IPv6. The binary will fall back to
17941 using IPv4, but it may waste resources looking up AAAA records, and trying to
17942 connect to IPv6 addresses, causing delays to mail delivery. If you set the
17943 <indexterm role="option">
17944 <primary><option>disable_ipv6</option></primary>
17946 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
17947 activities take place. AAAA records are never looked up, and any IPv6 addresses
17948 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
17949 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
17950 to handle IPv6 literal addresses.
17953 On the other hand, when IPv6 is in use, there may be times when you want to
17954 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
17955 option to globally suppress the lookup of AAAA records for specified domains,
17956 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
17957 IPv6 addresses in an individual router.
17961 <title>Examples of starting a listening daemon</title>
17963 The default case in an IPv6 environment is
17965 <literallayout class="monospaced">
17966 daemon_smtp_ports = smtp
17967 local_interfaces = <; ::0 ; 0.0.0.0
17970 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
17971 Either one or two sockets may be used, depending on the characteristics of
17972 the TCP/IP stack. (This is complicated and messy; for more information,
17973 read the comments in the <filename>daemon.c</filename> source file.)
17976 To specify listening on ports 25 and 26 on all interfaces:
17978 <literallayout class="monospaced">
17979 daemon_smtp_ports = 25 : 26
17982 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
17984 <literallayout class="monospaced">
17985 local_interfaces = <; ::0.25 ; ::0.26 \
17986 0.0.0.0.25 ; 0.0.0.0.26
17989 To listen on the default port on all IPv4 interfaces, and on port 26 on the
17990 IPv4 loopback address only:
17992 <literallayout class="monospaced">
17993 local_interfaces = 0.0.0.0 : 127.0.0.1.26
17996 To specify listening on the default port on specific interfaces only:
17998 <literallayout class="monospaced">
17999 local_interfaces = 192.168.34.67 : 192.168.34.67
18002 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
18005 <section id="SECTreclocipadd">
18006 <title>Recognising the local host</title>
18008 The <option>local_interfaces</option> option is also used when Exim needs to determine
18009 whether or not an IP address refers to the local host. That is, the IP
18010 addresses of all the interfaces on which a daemon is listening are always
18014 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
18015 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
18016 available interfaces from the operating system, and extracts the relevant
18017 (that is, IPv4 or IPv6) addresses to use for checking.
18020 Some systems set up large numbers of virtual interfaces in order to provide
18021 many virtual web servers. In this situation, you may want to listen for
18022 email on only a few of the available interfaces, but nevertheless treat all
18023 interfaces as local when routing. You can do this by setting
18024 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
18025 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
18026 used for listening. Consider this example:
18028 <literallayout class="monospaced">
18029 local_interfaces = <; 127.0.0.1 ; ::1 ; \
18031 3ffe:2101:12:1:a00:20ff:fe86:a061
18033 extra_local_interfaces = <; ::0 ; 0.0.0.0
18036 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
18037 address, but all available interface addresses are treated as local when
18041 In some environments the local host name may be in an MX list, but with an IP
18042 address that is not assigned to any local interface. In other cases it may be
18043 desirable to treat other host names as if they referred to the local host. Both
18044 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
18045 This contains host names rather than IP addresses. When a host is referenced
18046 during routing, either via an MX record or directly, it is treated as the local
18047 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
18048 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
18052 <title>Delivering to a remote host</title>
18054 Delivery to a remote host is handled by the smtp transport. By default, it
18055 allows the system’s TCP/IP functions to choose which interface to use (if
18056 there is more than one) when connecting to a remote host. However, the
18057 <option>interface</option> option can be set to specify which interface is used. See the
18058 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
18064 <chapter id="CHAPmainconfig">
18065 <title>Main configuration</title>
18067 <indexterm role="concept" id="IIDconfima" class="startofrange">
18068 <primary>configuration file</primary>
18069 <secondary>main section</secondary>
18071 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
18072 <primary>main configuration</primary>
18074 The first part of the run time configuration file contains three types of item:
18079 Macro definitions: These lines start with an upper case letter. See section
18080 <xref linkend="SECTmacrodefs"/> for details of macro processing.
18085 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
18086 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
18087 section <xref linkend="SECTnamedlists"/>.
18092 Main configuration settings: Each setting occupies one line of the file
18093 (with possible continuations). If any setting is preceded by the word
18094 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
18095 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
18101 This chapter specifies all the main configuration options, along with their
18102 types and default values. For ease of finding a particular option, they appear
18103 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
18104 are now so many options, they are first listed briefly in functional groups, as
18105 an aid to finding the name of the option you are looking for. Some options are
18106 listed in more than one group.
18109 <title>Miscellaneous</title>
18110 <informaltable frame="none">
18111 <tgroup cols="2" colsep="0" rowsep="0">
18112 <colspec colwidth="196pt" align="left"/>
18113 <colspec colwidth="254pt" align="left"/>
18116 <entry><option>bi_command</option></entry>
18117 <entry>to run for <option>-bi</option> command line option</entry>
18120 <entry><option>disable_ipv6</option></entry>
18121 <entry>do no IPv6 processing</entry>
18124 <entry><option>keep_malformed</option></entry>
18125 <entry>for broken files – should not happen</entry>
18128 <entry><option>localhost_number</option></entry>
18129 <entry>for unique message ids in clusters</entry>
18132 <entry><option>message_body_visible</option></entry>
18133 <entry>how much to show in <varname>$message_body</varname></entry>
18136 <entry><option>mua_wrapper</option></entry>
18137 <entry>run in <quote>MUA wrapper</quote> mode</entry>
18140 <entry><option>print_topbitchars</option></entry>
18141 <entry>top-bit characters are printing</entry>
18144 <entry><option>timezone</option></entry>
18145 <entry>force time zone</entry>
18152 <title>Exim parameters</title>
18153 <informaltable frame="none">
18154 <tgroup cols="2" colsep="0" rowsep="0">
18155 <colspec colwidth="196pt" align="left"/>
18156 <colspec colwidth="254pt" align="left"/>
18159 <entry><option>exim_group</option></entry>
18160 <entry>override compiled-in value</entry>
18163 <entry><option>exim_path</option></entry>
18164 <entry>override compiled-in value</entry>
18167 <entry><option>exim_user</option></entry>
18168 <entry>override compiled-in value</entry>
18171 <entry><option>primary_hostname</option></entry>
18172 <entry>default from <function>uname()</function></entry>
18175 <entry><option>split_spool_directory</option></entry>
18176 <entry>use multiple directories</entry>
18179 <entry><option>spool_directory</option></entry>
18180 <entry>override compiled-in value</entry>
18187 <title>Privilege controls</title>
18188 <informaltable frame="none">
18189 <tgroup cols="2" colsep="0" rowsep="0">
18190 <colspec colwidth="196pt" align="left"/>
18191 <colspec colwidth="254pt" align="left"/>
18194 <entry><option>admin_groups</option></entry>
18195 <entry>groups that are Exim admin users</entry>
18198 <entry><option>deliver_drop_privilege</option></entry>
18199 <entry>drop root for delivery processes</entry>
18202 <entry><option>local_from_check</option></entry>
18203 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
18206 <entry><option>local_from_prefix</option></entry>
18207 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
18210 <entry><option>local_from_suffix</option></entry>
18211 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
18214 <entry><option>local_sender_retain</option></entry>
18215 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
18218 <entry><option>never_users</option></entry>
18219 <entry>do not run deliveries as these</entry>
18222 <entry><option>prod_requires_admin</option></entry>
18223 <entry>forced delivery requires admin user</entry>
18226 <entry><option>queue_list_requires_admin</option></entry>
18227 <entry>queue listing requires admin user</entry>
18230 <entry><option>trusted_groups</option></entry>
18231 <entry>groups that are trusted</entry>
18234 <entry><option>trusted_users</option></entry>
18235 <entry>users that are trusted</entry>
18242 <title>Logging</title>
18243 <informaltable frame="none">
18244 <tgroup cols="2" colsep="0" rowsep="0">
18245 <colspec colwidth="196pt" align="left"/>
18246 <colspec colwidth="254pt" align="left"/>
18249 <entry><option>hosts_connection_nolog</option></entry>
18250 <entry>exemption from connect logging</entry>
18253 <entry><option>log_file_path</option></entry>
18254 <entry>override compiled-in value</entry>
18257 <entry><option>log_selector</option></entry>
18258 <entry>set/unset optional logging</entry>
18261 <entry><option>log_timezone</option></entry>
18262 <entry>add timezone to log lines</entry>
18265 <entry><option>message_logs</option></entry>
18266 <entry>create per-message logs</entry>
18269 <entry><option>preserve_message_logs</option></entry>
18270 <entry>after message completion</entry>
18273 <entry><option>process_log_path</option></entry>
18274 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
18277 <entry><option>syslog_duplication</option></entry>
18278 <entry>controls duplicate log lines on syslog</entry>
18281 <entry><option>syslog_facility</option></entry>
18282 <entry>set syslog <quote>facility</quote> field</entry>
18285 <entry><option>syslog_processname</option></entry>
18286 <entry>set syslog <quote>ident</quote> field</entry>
18289 <entry><option>syslog_timestamp</option></entry>
18290 <entry>timestamp syslog lines</entry>
18293 <entry><option>write_rejectlog</option></entry>
18294 <entry>control use of message log</entry>
18301 <title>Frozen messages</title>
18302 <informaltable frame="none">
18303 <tgroup cols="2" colsep="0" rowsep="0">
18304 <colspec colwidth="196pt" align="left"/>
18305 <colspec colwidth="254pt" align="left"/>
18308 <entry><option>auto_thaw</option></entry>
18309 <entry>sets time for retrying frozen messages</entry>
18312 <entry><option>freeze_tell</option></entry>
18313 <entry>send message when freezing</entry>
18316 <entry><option>move_frozen_messages</option></entry>
18317 <entry>to another directory</entry>
18320 <entry><option>timeout_frozen_after</option></entry>
18321 <entry>keep frozen messages only so long</entry>
18328 <title>Data lookups</title>
18329 <informaltable frame="none">
18330 <tgroup cols="2" colsep="0" rowsep="0">
18331 <colspec colwidth="196pt" align="left"/>
18332 <colspec colwidth="254pt" align="left"/>
18335 <entry><option>ldap_default_servers</option></entry>
18336 <entry>used if no server in query</entry>
18339 <entry><option>ldap_version</option></entry>
18340 <entry>set protocol version</entry>
18343 <entry><option>lookup_open_max</option></entry>
18344 <entry>lookup files held open</entry>
18347 <entry><option>mysql_servers</option></entry>
18348 <entry>as it says</entry>
18351 <entry><option>oracle_servers</option></entry>
18352 <entry>as it says</entry>
18355 <entry><option>pgsql_servers</option></entry>
18356 <entry>as it says</entry>
18359 <entry><option>sqlite_lock_timeout</option></entry>
18360 <entry>as it says</entry>
18367 <title>Message ids</title>
18368 <informaltable frame="none">
18369 <tgroup cols="2" colsep="0" rowsep="0">
18370 <colspec colwidth="196pt" align="left"/>
18371 <colspec colwidth="254pt" align="left"/>
18374 <entry><option>message_id_header_domain</option></entry>
18375 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
18378 <entry><option>message_id_header_text</option></entry>
18379 <entry>ditto</entry>
18386 <title>Embedded Perl Startup</title>
18387 <informaltable frame="none">
18388 <tgroup cols="2" colsep="0" rowsep="0">
18389 <colspec colwidth="196pt" align="left"/>
18390 <colspec colwidth="254pt" align="left"/>
18393 <entry><option>perl_at_start</option></entry>
18394 <entry>always start the interpreter</entry>
18397 <entry><option>perl_startup</option></entry>
18398 <entry>code to obey when starting Perl</entry>
18405 <title>Daemon</title>
18406 <informaltable frame="none">
18407 <tgroup cols="2" colsep="0" rowsep="0">
18408 <colspec colwidth="196pt" align="left"/>
18409 <colspec colwidth="254pt" align="left"/>
18412 <entry><option>daemon_smtp_ports</option></entry>
18413 <entry>default ports</entry>
18416 <entry><option>daemon_startup_retries</option></entry>
18417 <entry>number of times to retry</entry>
18420 <entry><option>daemon_startup_sleep</option></entry>
18421 <entry>time to sleep between tries</entry>
18424 <entry><option>extra_local_interfaces</option></entry>
18425 <entry>not necessarily listened on</entry>
18428 <entry><option>local_interfaces</option></entry>
18429 <entry>on which to listen, with optional ports</entry>
18432 <entry><option>pid_file_path</option></entry>
18433 <entry>override compiled-in value</entry>
18436 <entry><option>queue_run_max</option></entry>
18437 <entry>maximum simultaneous queue runners</entry>
18444 <title>Resource control</title>
18445 <informaltable frame="none">
18446 <tgroup cols="2" colsep="0" rowsep="0">
18447 <colspec colwidth="196pt" align="left"/>
18448 <colspec colwidth="254pt" align="left"/>
18451 <entry><option>check_log_inodes</option></entry>
18452 <entry>before accepting a message</entry>
18455 <entry><option>check_log_space</option></entry>
18456 <entry>before accepting a message</entry>
18459 <entry><option>check_spool_inodes</option></entry>
18460 <entry>before accepting a message</entry>
18463 <entry><option>check_spool_space</option></entry>
18464 <entry>before accepting a message</entry>
18467 <entry><option>deliver_queue_load_max</option></entry>
18468 <entry>no queue deliveries if load high</entry>
18471 <entry><option>queue_only_load</option></entry>
18472 <entry>queue incoming if load high</entry>
18475 <entry><option>queue_run_max</option></entry>
18476 <entry>maximum simultaneous queue runners</entry>
18479 <entry><option>remote_max_parallel</option></entry>
18480 <entry>parallel SMTP delivery per message</entry>
18483 <entry><option>smtp_accept_max</option></entry>
18484 <entry>simultaneous incoming connections</entry>
18487 <entry><option>smtp_accept_max_nommail</option></entry>
18488 <entry>non-mail commands</entry>
18491 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
18492 <entry>hosts to which the limit applies</entry>
18495 <entry><option>smtp_accept_max_per_connection</option></entry>
18496 <entry>messages per connection</entry>
18499 <entry><option>smtp_accept_max_per_host</option></entry>
18500 <entry>connections from one host</entry>
18503 <entry><option>smtp_accept_queue</option></entry>
18504 <entry>queue mail if more connections</entry>
18507 <entry><option>smtp_accept_queue_per_connection</option></entry>
18508 <entry>queue if more messages per connection</entry>
18511 <entry><option>smtp_accept_reserve</option></entry>
18512 <entry>only reserve hosts if more connections</entry>
18515 <entry><option>smtp_check_spool_space</option></entry>
18516 <entry>from SIZE on MAIL command</entry>
18519 <entry><option>smtp_connect_backlog</option></entry>
18520 <entry>passed to TCP/IP stack</entry>
18523 <entry><option>smtp_load_reserve</option></entry>
18524 <entry>SMTP from reserved hosts if load high</entry>
18527 <entry><option>smtp_reserve_hosts</option></entry>
18528 <entry>these are the reserve hosts</entry>
18535 <title>Policy controls</title>
18536 <informaltable frame="none">
18537 <tgroup cols="2" colsep="0" rowsep="0">
18538 <colspec colwidth="196pt" align="left"/>
18539 <colspec colwidth="254pt" align="left"/>
18542 <entry><option>acl_not_smtp</option></entry>
18543 <entry>ACL for non-SMTP messages</entry>
18546 <entry><option>acl_not_smtp_mime</option></entry>
18547 <entry>ACL for non-SMTP MIME parts</entry>
18549 <phrase revisionflag="changed"><row>
18550 <entry><option>acl_not_smtp_start</option></entry>
18551 <entry>ACL for start of non-SMTP message</entry>
18554 <entry><option>acl_smtp_auth</option></entry>
18555 <entry>ACL for AUTH</entry>
18558 <entry><option>acl_smtp_connect</option></entry>
18559 <entry>ACL for connection</entry>
18562 <entry><option>acl_smtp_data</option></entry>
18563 <entry>ACL for DATA</entry>
18566 <entry><option>acl_smtp_etrn</option></entry>
18567 <entry>ACL for ETRN</entry>
18570 <entry><option>acl_smtp_expn</option></entry>
18571 <entry>ACL for EXPN</entry>
18574 <entry><option>acl_smtp_helo</option></entry>
18575 <entry>ACL for EHLO or HELO</entry>
18578 <entry><option>acl_smtp_mail</option></entry>
18579 <entry>ACL for MAIL</entry>
18582 <entry><option>acl_smtp_mailauth</option></entry>
18583 <entry>ACL for AUTH on MAIL command</entry>
18586 <entry><option>acl_smtp_mime</option></entry>
18587 <entry>ACL for MIME parts</entry>
18590 <entry><option>acl_smtp_predata</option></entry>
18591 <entry>ACL for start of data</entry>
18594 <entry><option>acl_smtp_quit</option></entry>
18595 <entry>ACL for QUIT</entry>
18598 <entry><option>acl_smtp_rcpt</option></entry>
18599 <entry>ACL for RCPT</entry>
18602 <entry><option>acl_smtp_starttls</option></entry>
18603 <entry>ACL for STARTTLS</entry>
18606 <entry><option>acl_smtp_vrfy</option></entry>
18607 <entry>ACL for VRFY</entry>
18610 <entry><option>av_scanner</option></entry>
18611 <entry>specify virus scanner</entry>
18614 <entry><option>check_rfc2047_length</option></entry>
18615 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
18618 <entry><option>dns_csa_search_limit</option></entry>
18619 <entry>control CSA parent search depth</entry>
18622 <entry><option>dns_csa_use_reverse</option></entry>
18623 <entry>en/disable CSA IP reverse search</entry>
18626 <entry><option>header_maxsize</option></entry>
18627 <entry>total size of message header</entry>
18630 <entry><option>header_line_maxsize</option></entry>
18631 <entry>individual header line limit</entry>
18634 <entry><option>helo_accept_junk_hosts</option></entry>
18635 <entry>allow syntactic junk from these hosts</entry>
18638 <entry><option>helo_allow_chars</option></entry>
18639 <entry>allow illegal chars in HELO names</entry>
18642 <entry><option>helo_lookup_domains</option></entry>
18643 <entry>lookup hostname for these HELO names</entry>
18646 <entry><option>helo_try_verify_hosts</option></entry>
18647 <entry>HELO soft-checked for these hosts</entry>
18650 <entry><option>helo_verify_hosts</option></entry>
18651 <entry>HELO hard-checked for these hosts</entry>
18654 <entry><option>host_lookup</option></entry>
18655 <entry>host name looked up for these hosts</entry>
18658 <entry><option>host_lookup_order</option></entry>
18659 <entry>order of DNS and local name lookups</entry>
18662 <entry><option>host_reject_connection</option></entry>
18663 <entry>reject connection from these hosts</entry>
18666 <entry><option>hosts_treat_as_local</option></entry>
18667 <entry>useful in some cluster configurations</entry>
18670 <entry><option>local_scan_timeout</option></entry>
18671 <entry>timeout for <function>local_scan()</function></entry>
18674 <entry><option>message_size_limit</option></entry>
18675 <entry>for all messages</entry>
18678 <entry><option>percent_hack_domains</option></entry>
18679 <entry>recognize %-hack for these domains</entry>
18682 <entry><option>spamd_address</option></entry>
18683 <entry>set interface to SpamAssassin</entry>
18690 <title>Callout cache</title>
18691 <informaltable frame="none">
18692 <tgroup cols="2" colsep="0" rowsep="0">
18693 <colspec colwidth="196pt" align="left"/>
18694 <colspec colwidth="254pt" align="left"/>
18697 <entry><option>callout_domain_negative_expire</option></entry>
18698 <entry>timeout for negative domain cache item</entry>
18701 <entry><option>callout_domain_positive_expire</option></entry>
18702 <entry>timeout for positive domain cache item</entry>
18705 <entry><option>callout_negative_expire</option></entry>
18706 <entry>timeout for negative address cache item</entry>
18709 <entry><option>callout_positive_expire</option></entry>
18710 <entry>timeout for positive address cache item</entry>
18713 <entry><option>callout_random_local_part</option></entry>
18714 <entry>string to use for <quote>random</quote> testing</entry>
18722 <informaltable frame="none">
18723 <tgroup cols="2" colsep="0" rowsep="0">
18724 <colspec colwidth="196pt" align="left"/>
18725 <colspec colwidth="254pt" align="left"/>
18728 <entry><option>tls_advertise_hosts</option></entry>
18729 <entry>advertise TLS to these hosts</entry>
18732 <entry><option>tls_certificate</option></entry>
18733 <entry>location of server certificate</entry>
18736 <entry><option>tls_crl</option></entry>
18737 <entry>certificate revocation list</entry>
18740 <entry><option>tls_dhparam</option></entry>
18741 <entry>DH parameters for server</entry>
18744 <entry><option>tls_on_connect_ports</option></entry>
18745 <entry>specify SSMTP (SMTPS) ports</entry>
18748 <entry><option>tls_privatekey</option></entry>
18749 <entry>location of server private key</entry>
18752 <entry><option>tls_remember_esmtp</option></entry>
18753 <entry>don’t reset after starting TLS</entry>
18756 <entry><option>tls_require_ciphers</option></entry>
18757 <entry>specify acceptable cipers</entry>
18760 <entry><option>tls_try_verify_hosts</option></entry>
18761 <entry>try to verify client certificate</entry>
18764 <entry><option>tls_verify_certificates</option></entry>
18765 <entry>expected client certificates</entry>
18768 <entry><option>tls_verify_hosts</option></entry>
18769 <entry>insist on client certificate verify</entry>
18776 <title>Local user handling</title>
18777 <informaltable frame="none">
18778 <tgroup cols="2" colsep="0" rowsep="0">
18779 <colspec colwidth="196pt" align="left"/>
18780 <colspec colwidth="254pt" align="left"/>
18783 <entry><option>finduser_retries</option></entry>
18784 <entry>useful in NIS environments</entry>
18787 <entry><option>gecos_name</option></entry>
18788 <entry>used when creating <emphasis>Sender:</emphasis></entry>
18791 <entry><option>gecos_pattern</option></entry>
18792 <entry>ditto</entry>
18795 <entry><option>max_username_length</option></entry>
18796 <entry>for systems that truncate</entry>
18799 <entry><option>unknown_login</option></entry>
18800 <entry>used when no login name found</entry>
18803 <entry><option>unknown_username</option></entry>
18804 <entry>ditto</entry>
18807 <entry><option>uucp_from_pattern</option></entry>
18808 <entry>for recognizing <quote>From </quote> lines</entry>
18811 <entry><option>uucp_from_sender</option></entry>
18812 <entry>ditto</entry>
18819 <title>All incoming messages (SMTP and non-SMTP)</title>
18820 <informaltable frame="none">
18821 <tgroup cols="2" colsep="0" rowsep="0">
18822 <colspec colwidth="196pt" align="left"/>
18823 <colspec colwidth="254pt" align="left"/>
18826 <entry><option>header_maxsize</option></entry>
18827 <entry>total size of message header</entry>
18830 <entry><option>header_line_maxsize</option></entry>
18831 <entry>individual header line limit</entry>
18834 <entry><option>message_size_limit</option></entry>
18835 <entry>applies to all messages</entry>
18838 <entry><option>percent_hack_domains</option></entry>
18839 <entry>recognize %-hack for these domains</entry>
18842 <entry><option>received_header_text</option></entry>
18843 <entry>expanded to make <emphasis>Received:</emphasis></entry>
18846 <entry><option>received_headers_max</option></entry>
18847 <entry>for mail loop detection</entry>
18850 <entry><option>recipients_max</option></entry>
18851 <entry>limit per message</entry>
18854 <entry><option>recipients_max_reject</option></entry>
18855 <entry>permanently reject excess</entry>
18862 <title>Non-SMTP incoming messages</title>
18863 <informaltable frame="none">
18864 <tgroup cols="2" colsep="0" rowsep="0">
18865 <colspec colwidth="196pt" align="left"/>
18866 <colspec colwidth="254pt" align="left"/>
18869 <entry><option>receive_timeout</option></entry>
18870 <entry>for non-SMTP messages</entry>
18877 <title>Incoming SMTP messages</title>
18879 See also the <emphasis>Policy controls</emphasis> section above.
18881 <informaltable frame="none">
18882 <tgroup cols="2" colsep="0" rowsep="0">
18883 <colspec colwidth="196pt" align="left"/>
18884 <colspec colwidth="254pt" align="left"/>
18887 <entry><option>host_lookup</option></entry>
18888 <entry>host name looked up for these hosts</entry>
18891 <entry><option>host_lookup_order</option></entry>
18892 <entry>order of DNS and local name lookups</entry>
18895 <entry><option>recipient_unqualified_hosts</option></entry>
18896 <entry>may send unqualified recipients</entry>
18899 <entry><option>rfc1413_hosts</option></entry>
18900 <entry>make ident calls to these hosts</entry>
18903 <entry><option>rfc1413_query_timeout</option></entry>
18904 <entry>zero disables ident calls</entry>
18907 <entry><option>sender_unqualified_hosts</option></entry>
18908 <entry>may send unqualified senders</entry>
18911 <entry><option>smtp_accept_keepalive</option></entry>
18912 <entry>some TCP/IP magic</entry>
18915 <entry><option>smtp_accept_max</option></entry>
18916 <entry>simultaneous incoming connections</entry>
18919 <entry><option>smtp_accept_max_nonmail</option></entry>
18920 <entry>non-mail commands</entry>
18923 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
18924 <entry>hosts to which the limit applies</entry>
18927 <entry><option>smtp_accept_max_per_connection</option></entry>
18928 <entry>messages per connection</entry>
18931 <entry><option>smtp_accept_max_per_host</option></entry>
18932 <entry>connections from one host</entry>
18935 <entry><option>smtp_accept_queue</option></entry>
18936 <entry>queue mail if more connections</entry>
18939 <entry><option>smtp_accept_queue_per_connection</option></entry>
18940 <entry>queue if more messages per connection</entry>
18943 <entry><option>smtp_accept_reserve</option></entry>
18944 <entry>only reserve hosts if more connections</entry>
18947 <entry><option>smtp_active_hostname</option></entry>
18948 <entry>host name to use in messages</entry>
18951 <entry><option>smtp_banner</option></entry>
18952 <entry>text for welcome banner</entry>
18955 <entry><option>smtp_check_spool_space</option></entry>
18956 <entry>from SIZE on MAIL command</entry>
18959 <entry><option>smtp_connect_backlog</option></entry>
18960 <entry>passed to TCP/IP stack</entry>
18963 <entry><option>smtp_enforce_sync</option></entry>
18964 <entry>of SMTP command/responses</entry>
18967 <entry><option>smtp_etrn_command</option></entry>
18968 <entry>what to run for ETRN</entry>
18971 <entry><option>smtp_etrn_serialize</option></entry>
18972 <entry>only one at once</entry>
18975 <entry><option>smtp_load_reserve</option></entry>
18976 <entry>only reserve hosts if this load</entry>
18979 <entry><option>smtp_max_unknown_commands</option></entry>
18980 <entry>before dropping connection</entry>
18983 <entry><option>smtp_ratelimit_hosts</option></entry>
18984 <entry>apply ratelimiting to these hosts</entry>
18987 <entry><option>smtp_ratelimit_mail</option></entry>
18988 <entry>ratelimit for MAIL commands</entry>
18991 <entry><option>smtp_ratelimit_rcpt</option></entry>
18992 <entry>ratelimit for RCPT commands</entry>
18995 <entry><option>smtp_receive_timeout</option></entry>
18996 <entry>per command or data line</entry>
18999 <entry><option>smtp_reserve_hosts</option></entry>
19000 <entry>these are the reserve hosts</entry>
19003 <entry><option>smtp_return_error_details</option></entry>
19004 <entry>give detail on rejections</entry>
19011 <title>SMTP extensions</title>
19012 <informaltable frame="none">
19013 <tgroup cols="2" colsep="0" rowsep="0">
19014 <colspec colwidth="196pt" align="left"/>
19015 <colspec colwidth="254pt" align="left"/>
19018 <entry><option>accept_8bitmime</option></entry>
19019 <entry>advertise 8BITMIME</entry>
19022 <entry><option>auth_advertise_hosts</option></entry>
19023 <entry>advertise AUTH to these hosts</entry>
19026 <entry><option>ignore_fromline_hosts</option></entry>
19027 <entry>allow <quote>From </quote> from these hosts</entry>
19030 <entry><option>ignore_fromline_local</option></entry>
19031 <entry>allow <quote>From </quote> from local SMTP</entry>
19034 <entry><option>pipelining_advertise_hosts</option></entry>
19035 <entry>advertise pipelining to these hosts</entry>
19038 <entry><option>tls_advertise_hosts</option></entry>
19039 <entry>advertise TLS to these hosts</entry>
19046 <title>Processing messages</title>
19047 <informaltable frame="none">
19048 <tgroup cols="2" colsep="0" rowsep="0">
19049 <colspec colwidth="196pt" align="left"/>
19050 <colspec colwidth="254pt" align="left"/>
19053 <entry><option>allow_domain_literals</option></entry>
19054 <entry>recognize domain literal syntax</entry>
19057 <entry><option>allow_mx_to_ip</option></entry>
19058 <entry>allow MX to point to IP address</entry>
19061 <entry><option>allow_utf8_domains</option></entry>
19062 <entry>in addresses</entry>
19065 <entry><option>check_rfc2047_length</option></entry>
19066 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
19069 <entry><option>delivery_date_remove</option></entry>
19070 <entry>from incoming messages</entry>
19073 <entry><option>envelope_to_remove</option></entry>
19074 <entry>from incoming messages</entry>
19077 <entry><option>extract_addresses_remove_arguments</option></entry>
19078 <entry>affects <option>-t</option> processing</entry>
19081 <entry><option>headers_charset</option></entry>
19082 <entry>default for translations</entry>
19085 <entry><option>qualify_domain</option></entry>
19086 <entry>default for senders</entry>
19089 <entry><option>qualify_recipient</option></entry>
19090 <entry>default for recipients</entry>
19093 <entry><option>return_path_remove</option></entry>
19094 <entry>from incoming messages</entry>
19097 <entry><option>strip_excess_angle_brackets</option></entry>
19098 <entry>in addresses</entry>
19101 <entry><option>strip_trailing_dot</option></entry>
19102 <entry>at end of addresses</entry>
19105 <entry><option>untrusted_set_sender</option></entry>
19106 <entry>untrusted can set envelope sender</entry>
19113 <title>System filter</title>
19114 <informaltable frame="none">
19115 <tgroup cols="2" colsep="0" rowsep="0">
19116 <colspec colwidth="196pt" align="left"/>
19117 <colspec colwidth="254pt" align="left"/>
19120 <entry><option>system_filter</option></entry>
19121 <entry>locate system filter</entry>
19124 <entry><option>system_filter_directory_transport</option></entry>
19125 <entry>transport for delivery to a directory</entry>
19128 <entry><option>system_filter_file_transport</option></entry>
19129 <entry>transport for delivery to a file</entry>
19132 <entry><option>system_filter_group</option></entry>
19133 <entry>group for filter running</entry>
19136 <entry><option>system_filter_pipe_transport</option></entry>
19137 <entry>transport for delivery to a pipe</entry>
19140 <entry><option>system_filter_reply_transport</option></entry>
19141 <entry>transport for autoreply delivery</entry>
19144 <entry><option>system_filter_user</option></entry>
19145 <entry>user for filter running</entry>
19152 <title>Routing and delivery</title>
19153 <informaltable frame="none">
19154 <tgroup cols="2" colsep="0" rowsep="0">
19155 <colspec colwidth="196pt" align="left"/>
19156 <colspec colwidth="254pt" align="left"/>
19159 <entry><option>disable_ipv6</option></entry>
19160 <entry>do no IPv6 processing</entry>
19163 <entry><option>dns_again_means_nonexist</option></entry>
19164 <entry>for broken domains</entry>
19167 <entry><option>dns_check_names_pattern</option></entry>
19168 <entry>pre-DNS syntax check</entry>
19171 <entry><option>dns_ipv4_lookup</option></entry>
19172 <entry>only v4 lookup for these domains</entry>
19175 <entry><option>dns_retrans</option></entry>
19176 <entry>parameter for resolver</entry>
19179 <entry><option>dns_retry</option></entry>
19180 <entry>parameter for resolver</entry>
19183 <entry><option>hold_domains</option></entry>
19184 <entry>hold delivery for these domains</entry>
19187 <entry><option>local_interfaces</option></entry>
19188 <entry>for routing checks</entry>
19191 <entry><option>queue_domains</option></entry>
19192 <entry>no immediate delivery for these</entry>
19195 <entry><option>queue_only</option></entry>
19196 <entry>no immediate delivery at all</entry>
19199 <entry><option>queue_only_file</option></entry>
19200 <entry>no immediate delivery if file exists</entry>
19203 <entry><option>queue_only_load</option></entry>
19204 <entry>no immediate delivery if load is high</entry>
19207 <entry><option>queue_only_override</option></entry>
19208 <entry>allow command line to override</entry>
19211 <entry><option>queue_run_in_order</option></entry>
19212 <entry>order of arrival</entry>
19215 <entry><option>queue_run_max</option></entry>
19216 <entry>of simultaneous queue runners</entry>
19219 <entry><option>queue_smtp_domains</option></entry>
19220 <entry>no immediate SMTP delivery for these</entry>
19223 <entry><option>remote_max_parallel</option></entry>
19224 <entry>parallel SMTP delivery per message</entry>
19227 <entry><option>remote_sort_domains</option></entry>
19228 <entry>order of remote deliveries</entry>
19231 <entry><option>retry_data_expire</option></entry>
19232 <entry>timeout for retry data</entry>
19235 <entry><option>retry_interval_max</option></entry>
19236 <entry>safety net for retry rules</entry>
19243 <title>Bounce and warning messages</title>
19244 <informaltable frame="none">
19245 <tgroup cols="2" colsep="0" rowsep="0">
19246 <colspec colwidth="196pt" align="left"/>
19247 <colspec colwidth="254pt" align="left"/>
19250 <entry><option>bounce_message_file</option></entry>
19251 <entry>content of bounce</entry>
19254 <entry><option>bounce_message_text</option></entry>
19255 <entry>content of bounce</entry>
19258 <entry><option>bounce_return_body</option></entry>
19259 <entry>include body if returning message</entry>
19262 <entry><option>bounce_return_message</option></entry>
19263 <entry>include original message in bounce</entry>
19266 <entry><option>bounce_return_size_limit</option></entry>
19267 <entry>limit on returned message</entry>
19270 <entry><option>bounce_sender_authentication</option></entry>
19271 <entry>send authenticated sender with bounce</entry>
19274 <entry><option>errors_copy</option></entry>
19275 <entry>copy bounce messages</entry>
19278 <entry><option>errors_reply_to</option></entry>
19279 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
19282 <entry><option>delay_warning</option></entry>
19283 <entry>time schedule</entry>
19286 <entry><option>delay_warning_condition</option></entry>
19287 <entry>condition for warning messages</entry>
19290 <entry><option>ignore_bounce_errors_after</option></entry>
19291 <entry>discard undeliverable bounces</entry>
19294 <entry><option>smtp_return_error_details</option></entry>
19295 <entry>give detail on rejections</entry>
19298 <entry><option>warn_message_file</option></entry>
19299 <entry>content of warning message</entry>
19305 <section id="SECTalomo">
19306 <title>Alphabetical list of main options</title>
19308 Those options that undergo string expansion before use are marked with
19312 <indexterm role="option">
19313 <primary>accept_8bitmime</primary>
19316 <informaltable frame="all">
19317 <tgroup cols="4" colsep="0" rowsep="0">
19318 <colspec colwidth="8*" align="left"/>
19319 <colspec colwidth="5*" align="center"/>
19320 <colspec colwidth="5*" align="center"/>
19321 <colspec colwidth="6*" align="right"/>
19324 <entry><option>accept_8bitmime</option></entry>
19325 <entry>Use: <emphasis>main</emphasis></entry>
19326 <entry>Type: <emphasis>boolean</emphasis></entry>
19327 <entry>Default: <emphasis>false</emphasis></entry>
19333 <indexterm role="concept">
19334 <primary>8BITMIME</primary>
19336 <indexterm role="concept">
19337 <primary>8-bit characters</primary>
19339 This option causes Exim to send 8BITMIME in its response to an SMTP
19340 EHLO command, and to accept the BODY= parameter on MAIL commands.
19341 However, though Exim is 8-bit clean, it is not a protocol converter, and it
19342 takes no steps to do anything special with messages received by this route.
19343 Consequently, this option is turned off by default.
19346 <indexterm role="option">
19347 <primary>acl_not_smtp</primary>
19350 <informaltable frame="all">
19351 <tgroup cols="4" colsep="0" rowsep="0">
19352 <colspec colwidth="8*" align="left"/>
19353 <colspec colwidth="5*" align="center"/>
19354 <colspec colwidth="5*" align="center"/>
19355 <colspec colwidth="6*" align="right"/>
19358 <entry><option>acl_not_smtp</option></entry>
19359 <entry>Use: <emphasis>main</emphasis></entry>
19360 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19361 <entry>Default: <emphasis>unset</emphasis></entry>
19367 <indexterm role="concept">
19368 <primary>access control lists (ACLs)</primary>
19369 <secondary>for non-SMTP messages</secondary>
19371 <indexterm role="concept">
19372 <primary>non-SMTP messages</primary>
19373 <secondary>ACLs for</secondary>
19375 This option defines the ACL that is run when a non-SMTP message has been
19376 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
19380 <indexterm role="option">
19381 <primary>acl_not_smtp_mime</primary>
19384 <informaltable frame="all">
19385 <tgroup cols="4" colsep="0" rowsep="0">
19386 <colspec colwidth="8*" align="left"/>
19387 <colspec colwidth="5*" align="center"/>
19388 <colspec colwidth="5*" align="center"/>
19389 <colspec colwidth="6*" align="right"/>
19392 <entry><option>acl_not_smtp_mime</option></entry>
19393 <entry>Use: <emphasis>main</emphasis></entry>
19394 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19395 <entry>Default: <emphasis>unset</emphasis></entry>
19401 This option defines the ACL that is run for individual MIME parts of non-SMTP
19402 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
19405 <para revisionflag="changed">
19406 <indexterm role="option">
19407 <primary>acl_not_smtp_start</primary>
19410 <informaltable frame="all" revisionflag="changed">
19411 <tgroup cols="4" colsep="0" rowsep="0">
19412 <colspec colwidth="8*" align="left"/>
19413 <colspec colwidth="5*" align="center"/>
19414 <colspec colwidth="5*" align="center"/>
19415 <colspec colwidth="6*" align="right"/>
19418 <entry><option>acl_not_smtp_start</option></entry>
19419 <entry>Use: <emphasis>main</emphasis></entry>
19420 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19421 <entry>Default: <emphasis>unset</emphasis></entry>
19426 <para revisionflag="changed">
19427 <indexterm role="concept">
19428 <primary>access control lists (ACLs)</primary>
19429 <secondary>at start of non-SMTP message</secondary>
19431 <indexterm role="concept">
19432 <primary>non-SMTP messages</primary>
19433 <secondary>ACLs for</secondary>
19435 This option defines the ACL that is run before Exim starts reading a
19436 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
19439 <indexterm role="option">
19440 <primary>acl_smtp_auth</primary>
19443 <informaltable frame="all">
19444 <tgroup cols="4" colsep="0" rowsep="0">
19445 <colspec colwidth="8*" align="left"/>
19446 <colspec colwidth="5*" align="center"/>
19447 <colspec colwidth="5*" align="center"/>
19448 <colspec colwidth="6*" align="right"/>
19451 <entry><option>acl_smtp_auth</option></entry>
19452 <entry>Use: <emphasis>main</emphasis></entry>
19453 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19454 <entry>Default: <emphasis>unset</emphasis></entry>
19460 <indexterm role="concept">
19461 <primary>access control lists (ACLs)</primary>
19462 <secondary>setting up for SMTP commands</secondary>
19464 <indexterm role="concept">
19465 <primary>AUTH</primary>
19466 <secondary>ACL for</secondary>
19468 This option defines the ACL that is run when an SMTP AUTH command is
19469 received. See chapter <xref linkend="CHAPACL"/> for further details.
19472 <indexterm role="option">
19473 <primary>acl_smtp_connect</primary>
19476 <informaltable frame="all">
19477 <tgroup cols="4" colsep="0" rowsep="0">
19478 <colspec colwidth="8*" align="left"/>
19479 <colspec colwidth="5*" align="center"/>
19480 <colspec colwidth="5*" align="center"/>
19481 <colspec colwidth="6*" align="right"/>
19484 <entry><option>acl_smtp_connect</option></entry>
19485 <entry>Use: <emphasis>main</emphasis></entry>
19486 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19487 <entry>Default: <emphasis>unset</emphasis></entry>
19493 <indexterm role="concept">
19494 <primary>access control lists (ACLs)</primary>
19495 <secondary>on SMTP connection</secondary>
19497 This option defines the ACL that is run when an SMTP connection is received.
19498 See chapter <xref linkend="CHAPACL"/> for further details.
19501 <indexterm role="option">
19502 <primary>acl_smtp_data</primary>
19505 <informaltable frame="all">
19506 <tgroup cols="4" colsep="0" rowsep="0">
19507 <colspec colwidth="8*" align="left"/>
19508 <colspec colwidth="5*" align="center"/>
19509 <colspec colwidth="5*" align="center"/>
19510 <colspec colwidth="6*" align="right"/>
19513 <entry><option>acl_smtp_data</option></entry>
19514 <entry>Use: <emphasis>main</emphasis></entry>
19515 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19516 <entry>Default: <emphasis>unset</emphasis></entry>
19522 <indexterm role="concept">
19523 <primary>DATA</primary>
19524 <secondary>ACL for</secondary>
19526 This option defines the ACL that is run after an SMTP DATA command has been
19527 processed and the message itself has been received, but before the final
19528 acknowledgement is sent. See chapter <xref linkend="CHAPACL"/> for further details.
19531 <indexterm role="option">
19532 <primary>acl_smtp_etrn</primary>
19535 <informaltable frame="all">
19536 <tgroup cols="4" colsep="0" rowsep="0">
19537 <colspec colwidth="8*" align="left"/>
19538 <colspec colwidth="5*" align="center"/>
19539 <colspec colwidth="5*" align="center"/>
19540 <colspec colwidth="6*" align="right"/>
19543 <entry><option>acl_smtp_etrn</option></entry>
19544 <entry>Use: <emphasis>main</emphasis></entry>
19545 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19546 <entry>Default: <emphasis>unset</emphasis></entry>
19552 <indexterm role="concept">
19553 <primary>ETRN</primary>
19554 <secondary>ACL for</secondary>
19556 This option defines the ACL that is run when an SMTP ETRN command is
19557 received. See chapter <xref linkend="CHAPACL"/> for further details.
19560 <indexterm role="option">
19561 <primary>acl_smtp_expn</primary>
19564 <informaltable frame="all">
19565 <tgroup cols="4" colsep="0" rowsep="0">
19566 <colspec colwidth="8*" align="left"/>
19567 <colspec colwidth="5*" align="center"/>
19568 <colspec colwidth="5*" align="center"/>
19569 <colspec colwidth="6*" align="right"/>
19572 <entry><option>acl_smtp_expn</option></entry>
19573 <entry>Use: <emphasis>main</emphasis></entry>
19574 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19575 <entry>Default: <emphasis>unset</emphasis></entry>
19581 <indexterm role="concept">
19582 <primary>EXPN</primary>
19583 <secondary>ACL for</secondary>
19585 This option defines the ACL that is run when an SMTP EXPN command is
19586 received. See chapter <xref linkend="CHAPACL"/> for further details.
19589 <indexterm role="option">
19590 <primary>acl_smtp_helo</primary>
19593 <informaltable frame="all">
19594 <tgroup cols="4" colsep="0" rowsep="0">
19595 <colspec colwidth="8*" align="left"/>
19596 <colspec colwidth="5*" align="center"/>
19597 <colspec colwidth="5*" align="center"/>
19598 <colspec colwidth="6*" align="right"/>
19601 <entry><option>acl_smtp_helo</option></entry>
19602 <entry>Use: <emphasis>main</emphasis></entry>
19603 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19604 <entry>Default: <emphasis>unset</emphasis></entry>
19610 <indexterm role="concept">
19611 <primary>EHLO</primary>
19612 <secondary>ACL for</secondary>
19614 <indexterm role="concept">
19615 <primary>HELO</primary>
19616 <secondary>ACL for</secondary>
19618 This option defines the ACL that is run when an SMTP EHLO or HELO
19619 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
19622 <indexterm role="option">
19623 <primary>acl_smtp_mail</primary>
19626 <informaltable frame="all">
19627 <tgroup cols="4" colsep="0" rowsep="0">
19628 <colspec colwidth="8*" align="left"/>
19629 <colspec colwidth="5*" align="center"/>
19630 <colspec colwidth="5*" align="center"/>
19631 <colspec colwidth="6*" align="right"/>
19634 <entry><option>acl_smtp_mail</option></entry>
19635 <entry>Use: <emphasis>main</emphasis></entry>
19636 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19637 <entry>Default: <emphasis>unset</emphasis></entry>
19643 <indexterm role="concept">
19644 <primary>MAIL</primary>
19645 <secondary>ACL for</secondary>
19647 This option defines the ACL that is run when an SMTP MAIL command is
19648 received. See chapter <xref linkend="CHAPACL"/> for further details.
19651 <indexterm role="option">
19652 <primary>acl_smtp_mailauth</primary>
19655 <informaltable frame="all">
19656 <tgroup cols="4" colsep="0" rowsep="0">
19657 <colspec colwidth="8*" align="left"/>
19658 <colspec colwidth="5*" align="center"/>
19659 <colspec colwidth="5*" align="center"/>
19660 <colspec colwidth="6*" align="right"/>
19663 <entry><option>acl_smtp_mailauth</option></entry>
19664 <entry>Use: <emphasis>main</emphasis></entry>
19665 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19666 <entry>Default: <emphasis>unset</emphasis></entry>
19672 <indexterm role="concept">
19673 <primary>AUTH</primary>
19674 <secondary>on MAIL command</secondary>
19676 This option defines the ACL that is run when there is an AUTH parameter on
19677 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
19678 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
19681 <indexterm role="option">
19682 <primary>acl_smtp_mime</primary>
19685 <informaltable frame="all">
19686 <tgroup cols="4" colsep="0" rowsep="0">
19687 <colspec colwidth="8*" align="left"/>
19688 <colspec colwidth="5*" align="center"/>
19689 <colspec colwidth="5*" align="center"/>
19690 <colspec colwidth="6*" align="right"/>
19693 <entry><option>acl_smtp_mime</option></entry>
19694 <entry>Use: <emphasis>main</emphasis></entry>
19695 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19696 <entry>Default: <emphasis>unset</emphasis></entry>
19702 <indexterm role="concept">
19703 <primary>MIME content scanning</primary>
19704 <secondary>ACL for</secondary>
19706 This option is available when Exim is built with the content-scanning
19707 extension. It defines the ACL that is run for each MIME part in a message. See
19708 section <xref linkend="SECTscanmimepart"/> for details.
19711 <indexterm role="option">
19712 <primary>acl_smtp_predata</primary>
19715 <informaltable frame="all">
19716 <tgroup cols="4" colsep="0" rowsep="0">
19717 <colspec colwidth="8*" align="left"/>
19718 <colspec colwidth="5*" align="center"/>
19719 <colspec colwidth="5*" align="center"/>
19720 <colspec colwidth="6*" align="right"/>
19723 <entry><option>acl_smtp_predata</option></entry>
19724 <entry>Use: <emphasis>main</emphasis></entry>
19725 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19726 <entry>Default: <emphasis>unset</emphasis></entry>
19732 This option defines the ACL that is run when an SMTP DATA command is
19733 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
19737 <indexterm role="option">
19738 <primary>acl_smtp_quit</primary>
19741 <informaltable frame="all">
19742 <tgroup cols="4" colsep="0" rowsep="0">
19743 <colspec colwidth="8*" align="left"/>
19744 <colspec colwidth="5*" align="center"/>
19745 <colspec colwidth="5*" align="center"/>
19746 <colspec colwidth="6*" align="right"/>
19749 <entry><option>acl_smtp_quit</option></entry>
19750 <entry>Use: <emphasis>main</emphasis></entry>
19751 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19752 <entry>Default: <emphasis>unset</emphasis></entry>
19758 <indexterm role="concept">
19759 <primary>QUIT</primary>
19760 <secondary>ACL for</secondary>
19762 This option defines the ACL that is run when an SMTP QUIT command is
19763 received. See chapter <xref linkend="CHAPACL"/> for further details.
19766 <indexterm role="option">
19767 <primary>acl_smtp_rcpt</primary>
19770 <informaltable frame="all">
19771 <tgroup cols="4" colsep="0" rowsep="0">
19772 <colspec colwidth="8*" align="left"/>
19773 <colspec colwidth="5*" align="center"/>
19774 <colspec colwidth="5*" align="center"/>
19775 <colspec colwidth="6*" align="right"/>
19778 <entry><option>acl_smtp_rcpt</option></entry>
19779 <entry>Use: <emphasis>main</emphasis></entry>
19780 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19781 <entry>Default: <emphasis>unset</emphasis></entry>
19787 <indexterm role="concept">
19788 <primary>RCPT</primary>
19789 <secondary>ACL for</secondary>
19791 This option defines the ACL that is run when an SMTP RCPT command is
19792 received. See chapter <xref linkend="CHAPACL"/> for further details.
19795 <indexterm role="option">
19796 <primary>acl_smtp_starttls</primary>
19799 <informaltable frame="all">
19800 <tgroup cols="4" colsep="0" rowsep="0">
19801 <colspec colwidth="8*" align="left"/>
19802 <colspec colwidth="5*" align="center"/>
19803 <colspec colwidth="5*" align="center"/>
19804 <colspec colwidth="6*" align="right"/>
19807 <entry><option>acl_smtp_starttls</option></entry>
19808 <entry>Use: <emphasis>main</emphasis></entry>
19809 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19810 <entry>Default: <emphasis>unset</emphasis></entry>
19816 <indexterm role="concept">
19817 <primary>STARTTLS</primary>
19818 <secondary>ACL for</secondary>
19820 This option defines the ACL that is run when an SMTP STARTTLS command is
19821 received. See chapter <xref linkend="CHAPACL"/> for further details.
19824 <indexterm role="option">
19825 <primary>acl_smtp_vrfy</primary>
19828 <informaltable frame="all">
19829 <tgroup cols="4" colsep="0" rowsep="0">
19830 <colspec colwidth="8*" align="left"/>
19831 <colspec colwidth="5*" align="center"/>
19832 <colspec colwidth="5*" align="center"/>
19833 <colspec colwidth="6*" align="right"/>
19836 <entry><option>acl_smtp_vrfy</option></entry>
19837 <entry>Use: <emphasis>main</emphasis></entry>
19838 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19839 <entry>Default: <emphasis>unset</emphasis></entry>
19845 <indexterm role="concept">
19846 <primary>VRFY</primary>
19847 <secondary>ACL for</secondary>
19849 This option defines the ACL that is run when an SMTP VRFY command is
19850 received. See chapter <xref linkend="CHAPACL"/> for further details.
19853 <indexterm role="option">
19854 <primary>admin_groups</primary>
19857 <informaltable frame="all">
19858 <tgroup cols="4" colsep="0" rowsep="0">
19859 <colspec colwidth="8*" align="left"/>
19860 <colspec colwidth="5*" align="center"/>
19861 <colspec colwidth="5*" align="center"/>
19862 <colspec colwidth="6*" align="right"/>
19865 <entry><option>admin_groups</option></entry>
19866 <entry>Use: <emphasis>main</emphasis></entry>
19867 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
19868 <entry>Default: <emphasis>unset</emphasis></entry>
19874 <indexterm role="concept">
19875 <primary>admin user</primary>
19877 This option is expanded just once, at the start of Exim’s processing. If the
19878 current group or any of the supplementary groups of an Exim caller is in this
19879 colon-separated list, the caller has admin privileges. If all your system
19880 programmers are in a specific group, for example, you can give them all Exim
19881 admin privileges by putting that group in <option>admin_groups</option>. However, this does
19882 not permit them to read Exim’s spool files (whose group owner is the Exim gid).
19883 To permit this, you have to add individuals to the Exim group.
19886 <indexterm role="option">
19887 <primary>allow_domain_literals</primary>
19890 <informaltable frame="all">
19891 <tgroup cols="4" colsep="0" rowsep="0">
19892 <colspec colwidth="8*" align="left"/>
19893 <colspec colwidth="5*" align="center"/>
19894 <colspec colwidth="5*" align="center"/>
19895 <colspec colwidth="6*" align="right"/>
19898 <entry><option>allow_domain_literals</option></entry>
19899 <entry>Use: <emphasis>main</emphasis></entry>
19900 <entry>Type: <emphasis>boolean</emphasis></entry>
19901 <entry>Default: <emphasis>false</emphasis></entry>
19907 <indexterm role="concept">
19908 <primary>domain literal</primary>
19910 If this option is set, the RFC 2822 domain literal format is permitted in
19911 email addresses. The option is not set by default, because the domain literal
19912 format is not normally required these days, and few people know about it. It
19913 has, however, been exploited by mail abusers.
19916 Unfortunately, it seems that some DNS black list maintainers are using this
19917 format to report black listing to postmasters. If you want to accept messages
19918 addressed to your hosts by IP address, you need to set
19919 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
19920 domains (defined in the named domain list <option>local_domains</option> in the default
19921 configuration). This <quote>magic string</quote> matches the domain literal form of all
19922 the local host’s IP addresses.
19925 <indexterm role="option">
19926 <primary>allow_mx_to_ip</primary>
19929 <informaltable frame="all">
19930 <tgroup cols="4" colsep="0" rowsep="0">
19931 <colspec colwidth="8*" align="left"/>
19932 <colspec colwidth="5*" align="center"/>
19933 <colspec colwidth="5*" align="center"/>
19934 <colspec colwidth="6*" align="right"/>
19937 <entry><option>allow_mx_to_ip</option></entry>
19938 <entry>Use: <emphasis>main</emphasis></entry>
19939 <entry>Type: <emphasis>boolean</emphasis></entry>
19940 <entry>Default: <emphasis>false</emphasis></entry>
19946 <indexterm role="concept">
19947 <primary>MX record</primary>
19948 <secondary>pointing to IP address</secondary>
19950 It appears that more and more DNS zone administrators are breaking the rules
19951 and putting domain names that look like IP addresses on the right hand side of
19952 MX records. Exim follows the rules and rejects this, giving an error message
19953 that explains the mis-configuration. However, some other MTAs support this
19954 practice, so to avoid <quote>Why can’t Exim do this?</quote> complaints,
19955 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
19956 recommended, except when you have no other choice.
19959 <indexterm role="option">
19960 <primary>allow_utf8_domains</primary>
19963 <informaltable frame="all">
19964 <tgroup cols="4" colsep="0" rowsep="0">
19965 <colspec colwidth="8*" align="left"/>
19966 <colspec colwidth="5*" align="center"/>
19967 <colspec colwidth="5*" align="center"/>
19968 <colspec colwidth="6*" align="right"/>
19971 <entry><option>allow_utf8_domains</option></entry>
19972 <entry>Use: <emphasis>main</emphasis></entry>
19973 <entry>Type: <emphasis>boolean</emphasis></entry>
19974 <entry>Default: <emphasis>false</emphasis></entry>
19980 <indexterm role="concept">
19981 <primary>domain</primary>
19982 <secondary>UTF-8 characters in</secondary>
19984 <indexterm role="concept">
19985 <primary>UTF-8</primary>
19986 <secondary>in domain name</secondary>
19988 Lots of discussion is going on about internationalized domain names. One
19989 camp is strongly in favour of just using UTF-8 characters, and it seems
19990 that at least two other MTAs permit this. This option allows Exim users to
19991 experiment if they wish.
19994 If it is set true, Exim’s domain parsing function allows valid
19995 UTF-8 multicharacters to appear in domain name components, in addition to
19996 letters, digits, and hyphens. However, just setting this option is not
19997 enough; if you want to look up these domain names in the DNS, you must also
19998 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
19999 suitable setting is:
20001 <literallayout class="monospaced">
20002 dns_check_names_pattern = (?i)^(?>(?(1)\.|())[a-z0-9\xc0-\xff]\
20003 (?>[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
20006 Alternatively, you can just disable this feature by setting
20008 <literallayout class="monospaced">
20009 dns_check_names_pattern =
20012 That is, set the option to an empty string so that no check is done.
20015 <indexterm role="option">
20016 <primary>auth_advertise_hosts</primary>
20019 <informaltable frame="all">
20020 <tgroup cols="4" colsep="0" rowsep="0">
20021 <colspec colwidth="8*" align="left"/>
20022 <colspec colwidth="5*" align="center"/>
20023 <colspec colwidth="5*" align="center"/>
20024 <colspec colwidth="6*" align="right"/>
20027 <entry><option>auth_advertise_hosts</option></entry>
20028 <entry>Use: <emphasis>main</emphasis></entry>
20029 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
20030 <entry>Default: <emphasis>*</emphasis></entry>
20036 <indexterm role="concept">
20037 <primary>authentication</primary>
20038 <secondary>advertising</secondary>
20040 <indexterm role="concept">
20041 <primary>AUTH</primary>
20042 <secondary>advertising</secondary>
20044 If any server authentication mechanisms are configured, Exim advertises them in
20045 response to an EHLO command only if the calling host matches this list.
20046 Otherwise, Exim does not advertise AUTH.
20047 Exim does not accept AUTH commands from clients to which it has not
20048 advertised the availability of AUTH. The advertising of individual
20049 authentication mechanisms can be controlled by the use of the
20050 <option>server_advertise_condition</option> generic authenticator option on the individual
20051 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
20054 Certain mail clients (for example, Netscape) require the user to provide a name
20055 and password for authentication if AUTH is advertised, even though it may
20056 not be needed (the host may accept messages from hosts on its local LAN without
20057 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
20058 to make these clients more friendly by excluding them from the set of hosts to
20059 which Exim advertises AUTH.
20062 <indexterm role="concept">
20063 <primary>AUTH</primary>
20064 <secondary>advertising when encrypted</secondary>
20066 If you want to advertise the availability of AUTH only when the connection
20067 is encrypted using TLS, you can make use of the fact that the value of this
20068 option is expanded, with a setting like this:
20070 <literallayout class="monospaced">
20071 auth_advertise_hosts = ${if eq{$tls_cipher}{}{}{*}}
20074 <indexterm role="concept">
20075 <primary><varname>$tls_cipher</varname></primary>
20077 If <varname>$tls_cipher</varname> is empty, the session is not encrypted, and the result of
20078 the expansion is empty, thus matching no hosts. Otherwise, the result of the
20079 expansion is *, which matches all hosts.
20082 <indexterm role="option">
20083 <primary>auto_thaw</primary>
20086 <informaltable frame="all">
20087 <tgroup cols="4" colsep="0" rowsep="0">
20088 <colspec colwidth="8*" align="left"/>
20089 <colspec colwidth="5*" align="center"/>
20090 <colspec colwidth="5*" align="center"/>
20091 <colspec colwidth="6*" align="right"/>
20094 <entry><option>auto_thaw</option></entry>
20095 <entry>Use: <emphasis>main</emphasis></entry>
20096 <entry>Type: <emphasis>time</emphasis></entry>
20097 <entry>Default: <emphasis>0s</emphasis></entry>
20103 <indexterm role="concept">
20104 <primary>thawing messages</primary>
20106 <indexterm role="concept">
20107 <primary>unfreezing messages</primary>
20109 If this option is set to a time greater than zero, a queue runner will try a
20110 new delivery attempt on any frozen message, other than a bounce message, if
20111 this much time has passed since it was frozen. This may result in the message
20112 being re-frozen if nothing has changed since the last attempt. It is a way of
20113 saying <quote>keep on trying, even though there are big problems</quote>.
20116 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
20117 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
20118 thought to be very useful any more, and its use should probably be avoided.
20121 <indexterm role="option">
20122 <primary>av_scanner</primary>
20125 <informaltable frame="all">
20126 <tgroup cols="4" colsep="0" rowsep="0">
20127 <colspec colwidth="8*" align="left"/>
20128 <colspec colwidth="5*" align="center"/>
20129 <colspec colwidth="5*" align="center"/>
20130 <colspec colwidth="6*" align="right"/>
20133 <entry><option>av_scanner</option></entry>
20134 <entry>Use: <emphasis>main</emphasis></entry>
20135 <entry>Type: <emphasis>string</emphasis></entry>
20136 <entry>Default: <emphasis>see below</emphasis></entry>
20142 This option is available if Exim is built with the content-scanning extension.
20143 It specifies which anti-virus scanner to use. The default value is:
20145 <literallayout class="monospaced">
20146 sophie:/var/run/sophie
20149 If the value of <option>av_scanner</option> starts with dollar character, it is expanded
20150 before use. See section <xref linkend="SECTscanvirus"/> for further details.
20153 <indexterm role="option">
20154 <primary>bi_command</primary>
20157 <informaltable frame="all">
20158 <tgroup cols="4" colsep="0" rowsep="0">
20159 <colspec colwidth="8*" align="left"/>
20160 <colspec colwidth="5*" align="center"/>
20161 <colspec colwidth="5*" align="center"/>
20162 <colspec colwidth="6*" align="right"/>
20165 <entry><option>bi_command</option></entry>
20166 <entry>Use: <emphasis>main</emphasis></entry>
20167 <entry>Type: <emphasis>string</emphasis></entry>
20168 <entry>Default: <emphasis>unset</emphasis></entry>
20174 <indexterm role="concept">
20175 <primary><option>-bi</option> option</primary>
20177 This option supplies the name of a command that is run when Exim is called with
20178 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
20179 just the command name, it is not a complete command line. If an argument is
20180 required, it must come from the <option>-oA</option> command line option.
20183 <indexterm role="option">
20184 <primary>bounce_message_file</primary>
20187 <informaltable frame="all">
20188 <tgroup cols="4" colsep="0" rowsep="0">
20189 <colspec colwidth="8*" align="left"/>
20190 <colspec colwidth="5*" align="center"/>
20191 <colspec colwidth="5*" align="center"/>
20192 <colspec colwidth="6*" align="right"/>
20195 <entry><option>bounce_message_file</option></entry>
20196 <entry>Use: <emphasis>main</emphasis></entry>
20197 <entry>Type: <emphasis>string</emphasis></entry>
20198 <entry>Default: <emphasis>unset</emphasis></entry>
20204 <indexterm role="concept">
20205 <primary>bounce message</primary>
20206 <secondary>customizing</secondary>
20208 <indexterm role="concept">
20209 <primary>customizing</primary>
20210 <secondary>bounce message</secondary>
20212 This option defines a template file containing paragraphs of text to be used
20213 for constructing bounce messages. Details of the file’s contents are given in
20214 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
20217 <indexterm role="option">
20218 <primary>bounce_message_text</primary>
20221 <informaltable frame="all">
20222 <tgroup cols="4" colsep="0" rowsep="0">
20223 <colspec colwidth="8*" align="left"/>
20224 <colspec colwidth="5*" align="center"/>
20225 <colspec colwidth="5*" align="center"/>
20226 <colspec colwidth="6*" align="right"/>
20229 <entry><option>bounce_message_text</option></entry>
20230 <entry>Use: <emphasis>main</emphasis></entry>
20231 <entry>Type: <emphasis>string</emphasis></entry>
20232 <entry>Default: <emphasis>unset</emphasis></entry>
20238 When this option is set, its contents are included in the default bounce
20239 message immediately after <quote>This message was created automatically by mail
20240 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
20243 <indexterm role="option">
20244 <primary>bounce_return_body</primary>
20247 <informaltable frame="all">
20248 <tgroup cols="4" colsep="0" rowsep="0">
20249 <colspec colwidth="8*" align="left"/>
20250 <colspec colwidth="5*" align="center"/>
20251 <colspec colwidth="5*" align="center"/>
20252 <colspec colwidth="6*" align="right"/>
20255 <entry><option>bounce_return_body</option></entry>
20256 <entry>Use: <emphasis>main</emphasis></entry>
20257 <entry>Type: <emphasis>boolean</emphasis></entry>
20258 <entry>Default: <emphasis>true</emphasis></entry>
20264 <indexterm role="concept">
20265 <primary>bounce message</primary>
20266 <secondary>including body</secondary>
20268 This option controls whether the body of an incoming message is included in a
20269 bounce message when <option>bounce_return_message</option> is true. The default setting
20270 causes the entire message, both header and body, to be returned (subject to the
20271 value of <option>bounce_return_size_limit</option>). If this option is false, only the
20272 message header is included. In the case of a non-SMTP message containing an
20273 error that is detected during reception, only those header lines preceding the
20274 point at which the error was detected are returned.
20275 <indexterm role="concept">
20276 <primary>bounce message</primary>
20277 <secondary>including original</secondary>
20281 <indexterm role="option">
20282 <primary>bounce_return_message</primary>
20285 <informaltable frame="all">
20286 <tgroup cols="4" colsep="0" rowsep="0">
20287 <colspec colwidth="8*" align="left"/>
20288 <colspec colwidth="5*" align="center"/>
20289 <colspec colwidth="5*" align="center"/>
20290 <colspec colwidth="6*" align="right"/>
20293 <entry><option>bounce_return_message</option></entry>
20294 <entry>Use: <emphasis>main</emphasis></entry>
20295 <entry>Type: <emphasis>boolean</emphasis></entry>
20296 <entry>Default: <emphasis>true</emphasis></entry>
20302 If this option is set false, none of the original message is included in
20303 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
20304 <option>bounce_return_body</option>.
20307 <indexterm role="option">
20308 <primary>bounce_return_size_limit</primary>
20311 <informaltable frame="all">
20312 <tgroup cols="4" colsep="0" rowsep="0">
20313 <colspec colwidth="8*" align="left"/>
20314 <colspec colwidth="5*" align="center"/>
20315 <colspec colwidth="5*" align="center"/>
20316 <colspec colwidth="6*" align="right"/>
20319 <entry><option>bounce_return_size_limit</option></entry>
20320 <entry>Use: <emphasis>main</emphasis></entry>
20321 <entry>Type: <emphasis>integer</emphasis></entry>
20322 <entry>Default: <emphasis>100K</emphasis></entry>
20328 <indexterm role="concept">
20329 <primary>size limit</primary>
20330 <secondary>of bounce</secondary>
20332 <indexterm role="concept">
20333 <primary>bounce message</primary>
20334 <secondary>size limit</secondary>
20336 <indexterm role="concept">
20337 <primary>limit</primary>
20338 <secondary>bounce message size</secondary>
20340 This option sets a limit in bytes on the size of messages that are returned to
20341 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
20342 limit should be less than the value of the global <option>message_size_limit</option> and of
20343 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
20344 that Exim generates. If this option is set to zero there is no limit.
20347 When the body of any message that is to be included in a bounce message is
20348 greater than the limit, it is truncated, and a comment pointing this out is
20349 added at the top. The actual cutoff may be greater than the value given, owing
20350 to the use of buffering for transferring the message in chunks (typically 8K in
20351 size). The idea is to save bandwidth on those undeliverable 15-megabyte
20355 <indexterm role="option">
20356 <primary>bounce_sender_authentication</primary>
20359 <informaltable frame="all">
20360 <tgroup cols="4" colsep="0" rowsep="0">
20361 <colspec colwidth="8*" align="left"/>
20362 <colspec colwidth="5*" align="center"/>
20363 <colspec colwidth="5*" align="center"/>
20364 <colspec colwidth="6*" align="right"/>
20367 <entry><option>bounce_sender_authentication</option></entry>
20368 <entry>Use: <emphasis>main</emphasis></entry>
20369 <entry>Type: <emphasis>string</emphasis></entry>
20370 <entry>Default: <emphasis>unset</emphasis></entry>
20376 <indexterm role="concept">
20377 <primary>bounce message</primary>
20378 <secondary>sender authentication</secondary>
20380 <indexterm role="concept">
20381 <primary>authentication</primary>
20382 <secondary>bounce message</secondary>
20384 <indexterm role="concept">
20385 <primary>AUTH</primary>
20386 <secondary>on bounce message</secondary>
20388 This option provides an authenticated sender address that is sent with any
20389 bounce messages generated by Exim that are sent over an authenticated SMTP
20390 connection. A typical setting might be:
20392 <literallayout class="monospaced">
20393 bounce_sender_authentication = mailer-daemon@my.domain.example
20396 which would cause bounce messages to be sent using the SMTP command:
20398 <literallayout class="monospaced">
20399 MAIL FROM:<> AUTH=mailer-daemon@my.domain.example
20402 The value of <option>bounce_sender_authentication</option> must always be a complete email
20406 <indexterm role="option">
20407 <primary>callout_domain_negative_expire</primary>
20410 <informaltable frame="all">
20411 <tgroup cols="4" colsep="0" rowsep="0">
20412 <colspec colwidth="8*" align="left"/>
20413 <colspec colwidth="5*" align="center"/>
20414 <colspec colwidth="5*" align="center"/>
20415 <colspec colwidth="6*" align="right"/>
20418 <entry><option>callout_domain_negative_expire</option></entry>
20419 <entry>Use: <emphasis>main</emphasis></entry>
20420 <entry>Type: <emphasis>time</emphasis></entry>
20421 <entry>Default: <emphasis>3h</emphasis></entry>
20427 <indexterm role="concept">
20428 <primary>caching</primary>
20429 <secondary>callout timeouts</secondary>
20431 <indexterm role="concept">
20432 <primary>callout</primary>
20433 <secondary>caching timeouts</secondary>
20435 This option specifies the expiry time for negative callout cache data for a
20436 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
20437 section <xref linkend="SECTcallvercache"/> for details of the caching.
20440 <indexterm role="option">
20441 <primary>callout_domain_positive_expire</primary>
20444 <informaltable frame="all">
20445 <tgroup cols="4" colsep="0" rowsep="0">
20446 <colspec colwidth="8*" align="left"/>
20447 <colspec colwidth="5*" align="center"/>
20448 <colspec colwidth="5*" align="center"/>
20449 <colspec colwidth="6*" align="right"/>
20452 <entry><option>callout_domain_positive_expire</option></entry>
20453 <entry>Use: <emphasis>main</emphasis></entry>
20454 <entry>Type: <emphasis>time</emphasis></entry>
20455 <entry>Default: <emphasis>7d</emphasis></entry>
20461 This option specifies the expiry time for positive callout cache data for a
20462 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
20463 section <xref linkend="SECTcallvercache"/> for details of the caching.
20466 <indexterm role="option">
20467 <primary>callout_negative_expire</primary>
20470 <informaltable frame="all">
20471 <tgroup cols="4" colsep="0" rowsep="0">
20472 <colspec colwidth="8*" align="left"/>
20473 <colspec colwidth="5*" align="center"/>
20474 <colspec colwidth="5*" align="center"/>
20475 <colspec colwidth="6*" align="right"/>
20478 <entry><option>callout_negative_expire</option></entry>
20479 <entry>Use: <emphasis>main</emphasis></entry>
20480 <entry>Type: <emphasis>time</emphasis></entry>
20481 <entry>Default: <emphasis>2h</emphasis></entry>
20487 This option specifies the expiry time for negative callout cache data for an
20488 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
20489 section <xref linkend="SECTcallvercache"/> for details of the caching.
20492 <indexterm role="option">
20493 <primary>callout_positive_expire</primary>
20496 <informaltable frame="all">
20497 <tgroup cols="4" colsep="0" rowsep="0">
20498 <colspec colwidth="8*" align="left"/>
20499 <colspec colwidth="5*" align="center"/>
20500 <colspec colwidth="5*" align="center"/>
20501 <colspec colwidth="6*" align="right"/>
20504 <entry><option>callout_positive_expire</option></entry>
20505 <entry>Use: <emphasis>main</emphasis></entry>
20506 <entry>Type: <emphasis>time</emphasis></entry>
20507 <entry>Default: <emphasis>24h</emphasis></entry>
20513 This option specifies the expiry time for positive callout cache data for an
20514 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
20515 section <xref linkend="SECTcallvercache"/> for details of the caching.
20518 <indexterm role="option">
20519 <primary>callout_random_local_part</primary>
20522 <informaltable frame="all">
20523 <tgroup cols="4" colsep="0" rowsep="0">
20524 <colspec colwidth="8*" align="left"/>
20525 <colspec colwidth="5*" align="center"/>
20526 <colspec colwidth="5*" align="center"/>
20527 <colspec colwidth="6*" align="right"/>
20530 <entry><option>callout_random_local_part</option></entry>
20531 <entry>Use: <emphasis>main</emphasis></entry>
20532 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20533 <entry>Default: <emphasis>see below</emphasis></entry>
20539 This option defines the <quote>random</quote> local part that can be used as part of
20540 callout verification. The default value is
20542 <literallayout class="monospaced">
20543 $primary_host_name-$tod_epoch-testing
20546 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
20549 <indexterm role="option">
20550 <primary>check_log_inodes</primary>
20553 <informaltable frame="all">
20554 <tgroup cols="4" colsep="0" rowsep="0">
20555 <colspec colwidth="8*" align="left"/>
20556 <colspec colwidth="5*" align="center"/>
20557 <colspec colwidth="5*" align="center"/>
20558 <colspec colwidth="6*" align="right"/>
20561 <entry><option>check_log_inodes</option></entry>
20562 <entry>Use: <emphasis>main</emphasis></entry>
20563 <entry>Type: <emphasis>integer</emphasis></entry>
20564 <entry>Default: <emphasis>0</emphasis></entry>
20570 See <option>check_spool_space</option> below.
20573 <indexterm role="option">
20574 <primary>check_log_space</primary>
20577 <informaltable frame="all">
20578 <tgroup cols="4" colsep="0" rowsep="0">
20579 <colspec colwidth="8*" align="left"/>
20580 <colspec colwidth="5*" align="center"/>
20581 <colspec colwidth="5*" align="center"/>
20582 <colspec colwidth="6*" align="right"/>
20585 <entry><option>check_log_space</option></entry>
20586 <entry>Use: <emphasis>main</emphasis></entry>
20587 <entry>Type: <emphasis>integer</emphasis></entry>
20588 <entry>Default: <emphasis>0</emphasis></entry>
20594 See <option>check_spool_space</option> below.
20597 <indexterm role="option">
20598 <primary><option>check_rfc2047_length</option></primary>
20600 <indexterm role="concept">
20601 <primary>RFC 2047</primary>
20602 <secondary>disabling length check</secondary>
20604 <indexterm role="option">
20605 <primary>check_rfc2047_length</primary>
20608 <informaltable frame="all">
20609 <tgroup cols="4" colsep="0" rowsep="0">
20610 <colspec colwidth="8*" align="left"/>
20611 <colspec colwidth="5*" align="center"/>
20612 <colspec colwidth="5*" align="center"/>
20613 <colspec colwidth="6*" align="right"/>
20616 <entry><option>check_rfc2047_length</option></entry>
20617 <entry>Use: <emphasis> User: main</emphasis></entry>
20618 <entry>Type: <emphasis>boolean</emphasis></entry>
20619 <entry>Default: <emphasis>true</emphasis></entry>
20625 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
20626 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
20627 word; strings to be encoded that exceed this length are supposed to use
20628 multiple encoded words. By default, Exim does not recognize encoded words that
20629 exceed the maximum length. However, it seems that some software, in violation
20630 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
20631 set false, Exim recognizes encoded words of any length.
20634 <indexterm role="option">
20635 <primary>check_spool_inodes</primary>
20638 <informaltable frame="all">
20639 <tgroup cols="4" colsep="0" rowsep="0">
20640 <colspec colwidth="8*" align="left"/>
20641 <colspec colwidth="5*" align="center"/>
20642 <colspec colwidth="5*" align="center"/>
20643 <colspec colwidth="6*" align="right"/>
20646 <entry><option>check_spool_inodes</option></entry>
20647 <entry>Use: <emphasis>main</emphasis></entry>
20648 <entry>Type: <emphasis>integer</emphasis></entry>
20649 <entry>Default: <emphasis>0</emphasis></entry>
20655 See <option>check_spool_space</option> below.
20658 <indexterm role="option">
20659 <primary>check_spool_space</primary>
20662 <informaltable frame="all">
20663 <tgroup cols="4" colsep="0" rowsep="0">
20664 <colspec colwidth="8*" align="left"/>
20665 <colspec colwidth="5*" align="center"/>
20666 <colspec colwidth="5*" align="center"/>
20667 <colspec colwidth="6*" align="right"/>
20670 <entry><option>check_spool_space</option></entry>
20671 <entry>Use: <emphasis>main</emphasis></entry>
20672 <entry>Type: <emphasis>integer</emphasis></entry>
20673 <entry>Default: <emphasis>0</emphasis></entry>
20679 <indexterm role="concept">
20680 <primary>checking disk space</primary>
20682 <indexterm role="concept">
20683 <primary>disk space</primary>
20684 <secondary>checking</secondary>
20686 <indexterm role="concept">
20687 <primary>spool directory</primary>
20688 <secondary>checking space</secondary>
20690 The four <option>check_...</option> options allow for checking of disk resources before a
20691 message is accepted.
20694 <indexterm role="concept">
20695 <primary><varname>$log_inodes</varname></primary>
20697 <indexterm role="concept">
20698 <primary><varname>$log_space</varname></primary>
20700 <indexterm role="concept">
20701 <primary><varname>$spool_inodes</varname></primary>
20703 <indexterm role="concept">
20704 <primary><varname>$spool_space</varname></primary>
20706 When any of these options are set, they apply to all incoming messages. If you
20707 want to apply different checks to different kinds of message, you can do so by
20708 testing the the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
20709 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
20712 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
20713 either value is greater than zero, for example:
20715 <literallayout class="monospaced">
20716 check_spool_space = 10M
20717 check_spool_inodes = 100
20720 The spool partition is the one that contains the directory defined by
20721 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
20725 <option>check_log_space</option> and <option>check_log_inodes</option> check the partition in which log
20726 files are written if either is greater than zero. These should be set only if
20727 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
20730 If there is less space or fewer inodes than requested, Exim refuses to accept
20731 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
20732 error response to the MAIL command. If ESMTP is in use and there was a
20733 SIZE parameter on the MAIL command, its value is added to the
20734 <option>check_spool_space</option> value, and the check is performed even if
20735 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
20738 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
20739 number of kilobytes. If a non-multiple of 1024 is specified, it is rounded up.
20742 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
20743 failure a message is written to stderr and Exim exits with a non-zero code, as
20744 it obviously cannot send an error message of any kind.
20747 <indexterm role="option">
20748 <primary>daemon_smtp_ports</primary>
20751 <informaltable frame="all">
20752 <tgroup cols="4" colsep="0" rowsep="0">
20753 <colspec colwidth="8*" align="left"/>
20754 <colspec colwidth="5*" align="center"/>
20755 <colspec colwidth="5*" align="center"/>
20756 <colspec colwidth="6*" align="right"/>
20759 <entry><option>daemon_smtp_ports</option></entry>
20760 <entry>Use: <emphasis>main</emphasis></entry>
20761 <entry>Type: <emphasis>string</emphasis></entry>
20762 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
20768 <indexterm role="concept">
20769 <primary>port</primary>
20770 <secondary>for daemon</secondary>
20772 <indexterm role="concept">
20773 <primary>TCP/IP</primary>
20774 <secondary>setting listening ports</secondary>
20776 This option specifies one or more default SMTP ports on which the Exim daemon
20777 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
20778 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
20781 <indexterm role="option">
20782 <primary>daemon_startup_retries</primary>
20785 <informaltable frame="all">
20786 <tgroup cols="4" colsep="0" rowsep="0">
20787 <colspec colwidth="8*" align="left"/>
20788 <colspec colwidth="5*" align="center"/>
20789 <colspec colwidth="5*" align="center"/>
20790 <colspec colwidth="6*" align="right"/>
20793 <entry><option>daemon_startup_retries</option></entry>
20794 <entry>Use: <emphasis>main</emphasis></entry>
20795 <entry>Type: <emphasis>integer</emphasis></entry>
20796 <entry>Default: <emphasis>9</emphasis></entry>
20802 <indexterm role="concept">
20803 <primary>daemon startup</primary>
20804 <secondary>retrying</secondary>
20806 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
20807 the daemon at startup when it cannot immediately bind a listening socket
20808 (typically because the socket is already in use): <option>daemon_startup_retries</option>
20809 defines the number of retries after the first failure, and
20810 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
20813 <indexterm role="option">
20814 <primary>daemon_startup_sleep</primary>
20817 <informaltable frame="all">
20818 <tgroup cols="4" colsep="0" rowsep="0">
20819 <colspec colwidth="8*" align="left"/>
20820 <colspec colwidth="5*" align="center"/>
20821 <colspec colwidth="5*" align="center"/>
20822 <colspec colwidth="6*" align="right"/>
20825 <entry><option>daemon_startup_sleep</option></entry>
20826 <entry>Use: <emphasis>main</emphasis></entry>
20827 <entry>Type: <emphasis>time</emphasis></entry>
20828 <entry>Default: <emphasis>30s</emphasis></entry>
20834 See <option>daemon_startup_retries</option>.
20837 <indexterm role="option">
20838 <primary>delay_warning</primary>
20841 <informaltable frame="all">
20842 <tgroup cols="4" colsep="0" rowsep="0">
20843 <colspec colwidth="8*" align="left"/>
20844 <colspec colwidth="5*" align="center"/>
20845 <colspec colwidth="5*" align="center"/>
20846 <colspec colwidth="6*" align="right"/>
20849 <entry><option>delay_warning</option></entry>
20850 <entry>Use: <emphasis>main</emphasis></entry>
20851 <entry>Type: <emphasis>time list</emphasis></entry>
20852 <entry>Default: <emphasis>24h</emphasis></entry>
20858 <indexterm role="concept">
20859 <primary>warning of delay</primary>
20861 <indexterm role="concept">
20862 <primary>delay warning</primary>
20863 <secondary>specifying</secondary>
20865 When a message is delayed, Exim sends a warning message to the sender at
20866 intervals specified by this option. The data is a colon-separated list of times
20867 after which to send warning messages. If the value of the option is an empty
20868 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
20869 message has been on the queue for longer than the last time, the last interval
20870 between the times is used to compute subsequent warning times. For example,
20873 <literallayout class="monospaced">
20874 delay_warning = 4h:8h:24h
20877 the first message is sent after 4 hours, the second after 8 hours, and
20878 the third one after 24 hours. After that, messages are sent every 16 hours,
20879 because that is the interval between the last two times on the list. If you set
20880 just one time, it specifies the repeat interval. For example, with:
20882 <literallayout class="monospaced">
20886 messages are repeated every six hours. To stop warnings after a given time, set
20887 a very large time at the end of the list. For example:
20889 <literallayout class="monospaced">
20890 delay_warning = 2h:12h:99d
20893 <indexterm role="option">
20894 <primary>delay_warning_condition</primary>
20897 <informaltable frame="all">
20898 <tgroup cols="4" colsep="0" rowsep="0">
20899 <colspec colwidth="8*" align="left"/>
20900 <colspec colwidth="5*" align="center"/>
20901 <colspec colwidth="5*" align="center"/>
20902 <colspec colwidth="6*" align="right"/>
20905 <entry><option>delay_warning_condition</option></entry>
20906 <entry>Use: <emphasis>main</emphasis></entry>
20907 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20908 <entry>Default: <emphasis>see below</emphasis></entry>
20914 <indexterm role="concept">
20915 <primary><varname>$domain</varname></primary>
20917 The string is expanded at the time a warning message might be sent. If all the
20918 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
20919 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
20920 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
20921 <quote>false</quote> (the comparison being done caselessly) then the warning message is
20922 not sent. The default is:
20924 <literallayout class="monospaced" revisionflag="changed">
20925 delay_warning_condition = ${if or {\
20926 { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
20927 { match{$h_precedence:}{(?i)bulk|list|junk} }\
20928 { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
20931 <para revisionflag="changed">
20932 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
20933 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
20934 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
20935 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
20938 <indexterm role="option">
20939 <primary>deliver_drop_privilege</primary>
20942 <informaltable frame="all">
20943 <tgroup cols="4" colsep="0" rowsep="0">
20944 <colspec colwidth="8*" align="left"/>
20945 <colspec colwidth="5*" align="center"/>
20946 <colspec colwidth="5*" align="center"/>
20947 <colspec colwidth="6*" align="right"/>
20950 <entry><option>deliver_drop_privilege</option></entry>
20951 <entry>Use: <emphasis>main</emphasis></entry>
20952 <entry>Type: <emphasis>boolean</emphasis></entry>
20953 <entry>Default: <emphasis>false</emphasis></entry>
20959 <indexterm role="concept">
20960 <primary>unprivileged delivery</primary>
20962 <indexterm role="concept">
20963 <primary>delivery</primary>
20964 <secondary>unprivileged</secondary>
20966 If this option is set true, Exim drops its root privilege at the start of a
20967 delivery process, and runs as the Exim user throughout. This severely restricts
20968 the kinds of local delivery that are possible, but is viable in certain types
20969 of configuration. There is a discussion about the use of root privilege in
20970 chapter <xref linkend="CHAPsecurity"/>.
20973 <indexterm role="option">
20974 <primary>deliver_queue_load_max</primary>
20977 <informaltable frame="all">
20978 <tgroup cols="4" colsep="0" rowsep="0">
20979 <colspec colwidth="8*" align="left"/>
20980 <colspec colwidth="5*" align="center"/>
20981 <colspec colwidth="5*" align="center"/>
20982 <colspec colwidth="6*" align="right"/>
20985 <entry><option>deliver_queue_load_max</option></entry>
20986 <entry>Use: <emphasis>main</emphasis></entry>
20987 <entry>Type: <emphasis>fixed-point</emphasis></entry>
20988 <entry>Default: <emphasis>unset</emphasis></entry>
20994 <indexterm role="concept">
20995 <primary>load average</primary>
20997 <indexterm role="concept">
20998 <primary>queue runner</primary>
20999 <secondary>abandoning</secondary>
21001 When this option is set, a queue run is abandoned if the system load average
21002 becomes greater than the value of the option. The option has no effect on
21003 ancient operating systems on which Exim cannot determine the load average.
21004 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
21007 <indexterm role="option">
21008 <primary>delivery_date_remove</primary>
21011 <informaltable frame="all">
21012 <tgroup cols="4" colsep="0" rowsep="0">
21013 <colspec colwidth="8*" align="left"/>
21014 <colspec colwidth="5*" align="center"/>
21015 <colspec colwidth="5*" align="center"/>
21016 <colspec colwidth="6*" align="right"/>
21019 <entry><option>delivery_date_remove</option></entry>
21020 <entry>Use: <emphasis>main</emphasis></entry>
21021 <entry>Type: <emphasis>boolean</emphasis></entry>
21022 <entry>Default: <emphasis>true</emphasis></entry>
21028 <indexterm role="concept">
21029 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
21031 Exim’s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
21032 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
21033 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
21034 should not be present in incoming messages, and this option causes them to be
21035 removed at the time the message is received, to avoid any problems that might
21036 occur when a delivered message is subsequently sent on to some other recipient.
21039 <indexterm role="option">
21040 <primary>disable_ipv6</primary>
21043 <informaltable frame="all">
21044 <tgroup cols="4" colsep="0" rowsep="0">
21045 <colspec colwidth="8*" align="left"/>
21046 <colspec colwidth="5*" align="center"/>
21047 <colspec colwidth="5*" align="center"/>
21048 <colspec colwidth="6*" align="right"/>
21051 <entry><option>disable_ipv6</option></entry>
21052 <entry>Use: <emphasis>main</emphasis></entry>
21053 <entry>Type: <emphasis>boolean</emphasis></entry>
21054 <entry>Default: <emphasis>false</emphasis></entry>
21060 <indexterm role="concept">
21061 <primary>IPv6</primary>
21062 <secondary>disabling</secondary>
21064 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
21065 activities take place. AAAA records are never looked up, and any IPv6 addresses
21066 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
21067 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
21068 to handle IPv6 literal addresses.
21071 <indexterm role="option">
21072 <primary>dns_again_means_nonexist</primary>
21075 <informaltable frame="all">
21076 <tgroup cols="4" colsep="0" rowsep="0">
21077 <colspec colwidth="8*" align="left"/>
21078 <colspec colwidth="5*" align="center"/>
21079 <colspec colwidth="5*" align="center"/>
21080 <colspec colwidth="6*" align="right"/>
21083 <entry><option>dns_again_means_nonexist</option></entry>
21084 <entry>Use: <emphasis>main</emphasis></entry>
21085 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
21086 <entry>Default: <emphasis>unset</emphasis></entry>
21092 <indexterm role="concept">
21093 <primary>DNS</primary>
21094 <secondary><quote>try again</quote> response; overriding</secondary>
21096 DNS lookups give a <quote>try again</quote> response for the DNS errors
21097 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
21098 keep trying to deliver a message, or to give repeated temporary errors to
21099 incoming mail. Sometimes the effect is caused by a badly set up name server and
21100 may persist for a long time. If a domain which exhibits this problem matches
21101 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
21102 This option should be used with care. You can make it apply to reverse lookups
21103 by a setting such as this:
21105 <literallayout class="monospaced">
21106 dns_again_means_nonexist = *.in-addr.arpa
21109 This option applies to all DNS lookups that Exim does. It also applies when the
21110 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
21111 since these are most likely to be caused by DNS lookup problems. The
21112 <command>dnslookup</command> router has some options of its own for controlling what happens
21113 when lookups for MX or SRV records give temporary errors. These more specific
21114 options are applied after this global option.
21117 <indexterm role="option">
21118 <primary>dns_check_names_pattern</primary>
21121 <informaltable frame="all">
21122 <tgroup cols="4" colsep="0" rowsep="0">
21123 <colspec colwidth="8*" align="left"/>
21124 <colspec colwidth="5*" align="center"/>
21125 <colspec colwidth="5*" align="center"/>
21126 <colspec colwidth="6*" align="right"/>
21129 <entry><option>dns_check_names_pattern</option></entry>
21130 <entry>Use: <emphasis>main</emphasis></entry>
21131 <entry>Type: <emphasis>string</emphasis></entry>
21132 <entry>Default: <emphasis>see below</emphasis></entry>
21138 <indexterm role="concept">
21139 <primary>DNS</primary>
21140 <secondary>pre-check of name syntax</secondary>
21142 When this option is set to a non-empty string, it causes Exim to check domain
21143 names for characters that are not allowed in host names before handing them to
21144 the DNS resolver, because some resolvers give temporary errors for names that
21145 contain unusual characters. If a domain name contains any unwanted characters,
21146 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
21147 done by matching the domain name against a regular expression, which is the
21148 value of this option. The default pattern is
21150 <literallayout class="monospaced">
21151 dns_check_names_pattern = \
21152 (?i)^(?>(?(1)\.|())[^\W_](?>[a-z0-9/-]*[^\W_])?)+$
21155 which permits only letters, digits, slashes, and hyphens in components, but
21156 they must start and end with a letter or digit. Hyphens are not, in fact,
21157 permitted in host names, but they are found in certain NS records (which can be
21158 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
21159 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
21163 <indexterm role="option">
21164 <primary>dns_csa_search_limit</primary>
21167 <informaltable frame="all">
21168 <tgroup cols="4" colsep="0" rowsep="0">
21169 <colspec colwidth="8*" align="left"/>
21170 <colspec colwidth="5*" align="center"/>
21171 <colspec colwidth="5*" align="center"/>
21172 <colspec colwidth="6*" align="right"/>
21175 <entry><option>dns_csa_search_limit</option></entry>
21176 <entry>Use: <emphasis>main</emphasis></entry>
21177 <entry>Type: <emphasis>integer</emphasis></entry>
21178 <entry>Default: <emphasis>5</emphasis></entry>
21184 This option controls the depth of parental searching for CSA SRV records in the
21185 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
21188 <indexterm role="option">
21189 <primary>dns_csa_use_reverse</primary>
21192 <informaltable frame="all">
21193 <tgroup cols="4" colsep="0" rowsep="0">
21194 <colspec colwidth="8*" align="left"/>
21195 <colspec colwidth="5*" align="center"/>
21196 <colspec colwidth="5*" align="center"/>
21197 <colspec colwidth="6*" align="right"/>
21200 <entry><option>dns_csa_use_reverse</option></entry>
21201 <entry>Use: <emphasis>main</emphasis></entry>
21202 <entry>Type: <emphasis>boolean</emphasis></entry>
21203 <entry>Default: <emphasis>true</emphasis></entry>
21209 This option controls whether or not an IP address, given as a CSA domain, is
21210 reversed and looked up in the reverse DNS, as described in more detail in
21211 section <xref linkend="SECTverifyCSA"/>.
21214 <indexterm role="option">
21215 <primary>dns_ipv4_lookup</primary>
21218 <informaltable frame="all">
21219 <tgroup cols="4" colsep="0" rowsep="0">
21220 <colspec colwidth="8*" align="left"/>
21221 <colspec colwidth="5*" align="center"/>
21222 <colspec colwidth="5*" align="center"/>
21223 <colspec colwidth="6*" align="right"/>
21226 <entry><option>dns_ipv4_lookup</option></entry>
21227 <entry>Use: <emphasis>main</emphasis></entry>
21228 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
21229 <entry>Default: <emphasis>unset</emphasis></entry>
21235 <indexterm role="concept">
21236 <primary>IPv6</primary>
21237 <secondary>DNS lookup for AAAA records</secondary>
21239 <indexterm role="concept">
21240 <primary>DNS</primary>
21241 <secondary>IPv6 lookup for AAAA records</secondary>
21243 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
21244 looks for IPv6 address records (AAAA records) as well as IPv4 address records
21245 (A records) when trying to find IP addresses for hosts, unless the host’s
21246 domain matches this list.
21249 This is a fudge to help with name servers that give big delays or otherwise do
21250 not work for the AAAA record type. In due course, when the world’s name
21251 servers have all been upgraded, there should be no need for this option.
21254 <indexterm role="option">
21255 <primary>dns_retrans</primary>
21258 <informaltable frame="all">
21259 <tgroup cols="4" colsep="0" rowsep="0">
21260 <colspec colwidth="8*" align="left"/>
21261 <colspec colwidth="5*" align="center"/>
21262 <colspec colwidth="5*" align="center"/>
21263 <colspec colwidth="6*" align="right"/>
21266 <entry><option>dns_retrans</option></entry>
21267 <entry>Use: <emphasis>main</emphasis></entry>
21268 <entry>Type: <emphasis>time</emphasis></entry>
21269 <entry>Default: <emphasis>0s</emphasis></entry>
21275 <indexterm role="concept">
21276 <primary>DNS</primary>
21277 <secondary>resolver options</secondary>
21279 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
21280 retransmission and retry parameters for DNS lookups. Values of zero (the
21281 defaults) leave the system default settings unchanged. The first value is the
21282 time between retries, and the second is the number of retries. It isn’t
21283 totally clear exactly how these settings affect the total time a DNS lookup may
21284 take. I haven’t found any documentation about timeouts on DNS lookups; these
21285 parameter values are available in the external resolver interface structure,
21286 but nowhere does it seem to describe how they are used or what you might want
21290 <indexterm role="option">
21291 <primary>dns_retry</primary>
21294 <informaltable frame="all">
21295 <tgroup cols="4" colsep="0" rowsep="0">
21296 <colspec colwidth="8*" align="left"/>
21297 <colspec colwidth="5*" align="center"/>
21298 <colspec colwidth="5*" align="center"/>
21299 <colspec colwidth="6*" align="right"/>
21302 <entry><option>dns_retry</option></entry>
21303 <entry>Use: <emphasis>main</emphasis></entry>
21304 <entry>Type: <emphasis>integer</emphasis></entry>
21305 <entry>Default: <emphasis>0</emphasis></entry>
21311 See <option>dns_retrans</option> above.
21314 <indexterm role="option">
21315 <primary>drop_cr</primary>
21318 <informaltable frame="all">
21319 <tgroup cols="4" colsep="0" rowsep="0">
21320 <colspec colwidth="8*" align="left"/>
21321 <colspec colwidth="5*" align="center"/>
21322 <colspec colwidth="5*" align="center"/>
21323 <colspec colwidth="6*" align="right"/>
21326 <entry><option>drop_cr</option></entry>
21327 <entry>Use: <emphasis>main</emphasis></entry>
21328 <entry>Type: <emphasis>boolean</emphasis></entry>
21329 <entry>Default: <emphasis>false</emphasis></entry>
21335 This is an obsolete option that is now a no-op. It used to affect the way Exim
21336 handled CR and LF characters in incoming messages. What happens now is
21337 described in section <xref linkend="SECTlineendings"/>.
21340 <indexterm role="option">
21341 <primary>envelope_to_remove</primary>
21344 <informaltable frame="all">
21345 <tgroup cols="4" colsep="0" rowsep="0">
21346 <colspec colwidth="8*" align="left"/>
21347 <colspec colwidth="5*" align="center"/>
21348 <colspec colwidth="5*" align="center"/>
21349 <colspec colwidth="6*" align="right"/>
21352 <entry><option>envelope_to_remove</option></entry>
21353 <entry>Use: <emphasis>main</emphasis></entry>
21354 <entry>Type: <emphasis>boolean</emphasis></entry>
21355 <entry>Default: <emphasis>true</emphasis></entry>
21361 <indexterm role="concept">
21362 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
21364 Exim’s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
21365 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
21366 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
21367 messages’s envelope that caused the delivery to happen. Such headers should not
21368 be present in incoming messages, and this option causes them to be removed at
21369 the time the message is received, to avoid any problems that might occur when a
21370 delivered message is subsequently sent on to some other recipient.
21373 <indexterm role="option">
21374 <primary>errors_copy</primary>
21377 <informaltable frame="all">
21378 <tgroup cols="4" colsep="0" rowsep="0">
21379 <colspec colwidth="8*" align="left"/>
21380 <colspec colwidth="5*" align="center"/>
21381 <colspec colwidth="5*" align="center"/>
21382 <colspec colwidth="6*" align="right"/>
21385 <entry><option>errors_copy</option></entry>
21386 <entry>Use: <emphasis>main</emphasis></entry>
21387 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
21388 <entry>Default: <emphasis>unset</emphasis></entry>
21394 <indexterm role="concept">
21395 <primary>bounce message</primary>
21396 <secondary>copy to other address</secondary>
21398 <indexterm role="concept">
21399 <primary>copy of bounce message</primary>
21401 Setting this option causes Exim to send bcc copies of bounce messages that it
21402 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
21403 coming from elsewhere. The value of the option is a colon-separated list of
21404 items. Each item consists of a pattern, terminated by white space, followed by
21405 a comma-separated list of email addresses. If a pattern contains spaces, it
21406 must be enclosed in double quotes.
21409 Each pattern is processed in the same way as a single item in an address list
21410 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
21411 the bounce message, the message is copied to the addresses on the list. The
21412 items are scanned in order, and once a matching one is found, no further items
21413 are examined. For example:
21415 <literallayout class="monospaced">
21416 errors_copy = spqr@mydomain postmaster@mydomain.example :\
21417 rqps@mydomain hostmaster@mydomain.example,\
21418 postmaster@mydomain.example
21421 <indexterm role="concept">
21422 <primary><varname>$domain</varname></primary>
21424 <indexterm role="concept">
21425 <primary><varname>$local_part</varname></primary>
21427 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
21428 and <varname>$domain</varname> are set from the original recipient of the error message, and if
21429 there was any wildcard matching in the pattern, the expansion
21430 <indexterm role="concept">
21431 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
21432 <secondary>in <option>errors_copy</option></secondary>
21434 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
21437 <indexterm role="option">
21438 <primary>errors_reply_to</primary>
21441 <informaltable frame="all">
21442 <tgroup cols="4" colsep="0" rowsep="0">
21443 <colspec colwidth="8*" align="left"/>
21444 <colspec colwidth="5*" align="center"/>
21445 <colspec colwidth="5*" align="center"/>
21446 <colspec colwidth="6*" align="right"/>
21449 <entry><option>errors_reply_to</option></entry>
21450 <entry>Use: <emphasis>main</emphasis></entry>
21451 <entry>Type: <emphasis>string</emphasis></entry>
21452 <entry>Default: <emphasis>unset</emphasis></entry>
21458 <indexterm role="concept">
21459 <primary>bounce message</primary>
21460 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
21462 By default, Exim’s bounce and delivery warning messages contain the header line
21465 <literal>From: Mail Delivery System <Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>></literal>
21468 <indexterm role="option">
21469 <primary><option>quota_warn_message</option></primary>
21471 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
21472 A warning message that is generated by the <option>quota_warn_message</option> option in an
21473 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
21474 overrides the default.
21477 Experience shows that people reply to bounce messages. If the
21478 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
21479 and warning messages. For example:
21481 <literallayout class="monospaced">
21482 errors_reply_to = postmaster@my.domain.example
21485 The value of the option is not expanded. It must specify a valid RFC 2822
21486 address. However, if a warning message that is generated by the
21487 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
21488 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
21492 <indexterm role="option">
21493 <primary>exim_group</primary>
21496 <informaltable frame="all">
21497 <tgroup cols="4" colsep="0" rowsep="0">
21498 <colspec colwidth="8*" align="left"/>
21499 <colspec colwidth="5*" align="center"/>
21500 <colspec colwidth="5*" align="center"/>
21501 <colspec colwidth="6*" align="right"/>
21504 <entry><option>exim_group</option></entry>
21505 <entry>Use: <emphasis>main</emphasis></entry>
21506 <entry>Type: <emphasis>string</emphasis></entry>
21507 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
21513 <indexterm role="concept">
21514 <primary>gid (group id)</primary>
21515 <secondary>Exim’s own</secondary>
21517 <indexterm role="concept">
21518 <primary>Exim group</primary>
21520 This option changes the gid under which Exim runs when it gives up root
21521 privilege. The default value is compiled into the binary. The value of this
21522 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
21523 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
21524 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
21528 <indexterm role="option">
21529 <primary>exim_path</primary>
21532 <informaltable frame="all">
21533 <tgroup cols="4" colsep="0" rowsep="0">
21534 <colspec colwidth="8*" align="left"/>
21535 <colspec colwidth="5*" align="center"/>
21536 <colspec colwidth="5*" align="center"/>
21537 <colspec colwidth="6*" align="right"/>
21540 <entry><option>exim_path</option></entry>
21541 <entry>Use: <emphasis>main</emphasis></entry>
21542 <entry>Type: <emphasis>string</emphasis></entry>
21543 <entry>Default: <emphasis>see below</emphasis></entry>
21549 <indexterm role="concept">
21550 <primary>Exim binary</primary>
21551 <secondary>path name</secondary>
21553 This option specifies the path name of the Exim binary, which is used when Exim
21554 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
21555 the directory configured at compile time by the BIN_DIRECTORY setting. It
21556 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
21558 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
21559 you will break those Exim utilities that scan the configuration file to find
21560 where the binary is. (They then use the <option>-bP</option> option to extract option
21561 settings such as the value of <option>spool_directory</option>.)
21564 <indexterm role="option">
21565 <primary>exim_user</primary>
21568 <informaltable frame="all">
21569 <tgroup cols="4" colsep="0" rowsep="0">
21570 <colspec colwidth="8*" align="left"/>
21571 <colspec colwidth="5*" align="center"/>
21572 <colspec colwidth="5*" align="center"/>
21573 <colspec colwidth="6*" align="right"/>
21576 <entry><option>exim_user</option></entry>
21577 <entry>Use: <emphasis>main</emphasis></entry>
21578 <entry>Type: <emphasis>string</emphasis></entry>
21579 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
21585 <indexterm role="concept">
21586 <primary>uid (user id)</primary>
21587 <secondary>Exim’s own</secondary>
21589 <indexterm role="concept">
21590 <primary>Exim user</primary>
21592 This option changes the uid under which Exim runs when it gives up root
21593 privilege. The default value is compiled into the binary. Ownership of the run
21594 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
21595 options is checked against the values in the binary, not what is set here.
21598 Unless it consists entirely of digits, the string is looked up using
21599 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
21600 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
21601 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
21604 <indexterm role="option">
21605 <primary>extra_local_interfaces</primary>
21608 <informaltable frame="all">
21609 <tgroup cols="4" colsep="0" rowsep="0">
21610 <colspec colwidth="8*" align="left"/>
21611 <colspec colwidth="5*" align="center"/>
21612 <colspec colwidth="5*" align="center"/>
21613 <colspec colwidth="6*" align="right"/>
21616 <entry><option>extra_local_interfaces</option></entry>
21617 <entry>Use: <emphasis>main</emphasis></entry>
21618 <entry>Type: <emphasis>string list</emphasis></entry>
21619 <entry>Default: <emphasis>unset</emphasis></entry>
21625 This option defines network interfaces that are to be considered local when
21626 routing, but which are not used for listening by the daemon. See section
21627 <xref linkend="SECTreclocipadd"/> for details.
21630 <indexterm role="option">
21631 <primary>extract_addresses_remove_ arguments</primary>
21634 <informaltable frame="all">
21635 <tgroup cols="4" colsep="0" rowsep="0">
21636 <colspec colwidth="8*" align="left"/>
21637 <colspec colwidth="5*" align="center"/>
21638 <colspec colwidth="5*" align="center"/>
21639 <colspec colwidth="6*" align="right"/>
21642 <entry><option>extract_addresses_remove_ arguments</option></entry>
21643 <entry>Use: <emphasis>main</emphasis></entry>
21644 <entry>Type: <emphasis>boolean</emphasis></entry>
21645 <entry>Default: <emphasis>true</emphasis></entry>
21651 <indexterm role="concept">
21652 <primary><option>-t</option> option</primary>
21654 <indexterm role="concept">
21655 <primary>command line</primary>
21656 <secondary>addresses with <option>-t</option></secondary>
21658 <indexterm role="concept">
21659 <primary>Sendmail compatibility</primary>
21660 <secondary><option>-t</option> option</secondary>
21662 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
21663 are present on the command line when the <option>-t</option> option is used to build an
21664 envelope from a message’s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
21665 line addresses are removed from the recipients list. This is also how Smail
21666 behaves. However, other Sendmail documentation (the O’Reilly book) states that
21667 command line addresses are added to those obtained from the header lines. When
21668 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
21669 argument headers. If it is set false, Exim adds rather than removes argument
21673 <indexterm role="option">
21674 <primary>finduser_retries</primary>
21677 <informaltable frame="all">
21678 <tgroup cols="4" colsep="0" rowsep="0">
21679 <colspec colwidth="8*" align="left"/>
21680 <colspec colwidth="5*" align="center"/>
21681 <colspec colwidth="5*" align="center"/>
21682 <colspec colwidth="6*" align="right"/>
21685 <entry><option>finduser_retries</option></entry>
21686 <entry>Use: <emphasis>main</emphasis></entry>
21687 <entry>Type: <emphasis>integer</emphasis></entry>
21688 <entry>Default: <emphasis>0</emphasis></entry>
21694 <indexterm role="concept">
21695 <primary>NIS</primary>
21696 <secondary>looking up users; retrying</secondary>
21698 On systems running NIS or other schemes in which user and group information is
21699 distributed from a remote system, there can be times when <function>getpwnam()</function> and
21700 related functions fail, even when given valid data, because things time out.
21701 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
21702 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
21703 many extra times to find a user or a group, waiting for one second between
21707 <indexterm role="concept">
21708 <primary><filename>/etc/passwd</filename></primary>
21709 <secondary>multiple reading of</secondary>
21711 You should not set this option greater than zero if your user information is in
21712 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
21713 search the file multiple times for non-existent users, and also cause delay.
21716 <indexterm role="option">
21717 <primary>freeze_tell</primary>
21720 <informaltable frame="all">
21721 <tgroup cols="4" colsep="0" rowsep="0">
21722 <colspec colwidth="8*" align="left"/>
21723 <colspec colwidth="5*" align="center"/>
21724 <colspec colwidth="5*" align="center"/>
21725 <colspec colwidth="6*" align="right"/>
21728 <entry><option>freeze_tell</option></entry>
21729 <entry>Use: <emphasis>main</emphasis></entry>
21730 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
21731 <entry>Default: <emphasis>unset</emphasis></entry>
21737 <indexterm role="concept">
21738 <primary>freezing messages</primary>
21739 <secondary>sending a message when freezing</secondary>
21741 On encountering certain errors, or when configured to do so in a system filter,
21742 ACL, or special router, Exim freezes a message. This means that no further
21743 delivery attempts take place until an administrator thaws the message, or the
21744 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
21745 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
21746 warning message whenever it freezes something, unless the message it is
21747 freezing is a locally-generated bounce message. (Without this exception there
21748 is the possibility of looping.) The warning message is sent to the addresses
21749 supplied as the comma-separated value of this option. If several of the
21750 message’s addresses cause freezing, only a single message is sent. If the
21751 freezing was automatic, the reason(s) for freezing can be found in the message
21752 log. If you configure freezing in a filter or ACL, you must arrange for any
21753 logging that you require.
21756 <indexterm role="option">
21757 <primary>gecos_name</primary>
21760 <informaltable frame="all">
21761 <tgroup cols="4" colsep="0" rowsep="0">
21762 <colspec colwidth="8*" align="left"/>
21763 <colspec colwidth="5*" align="center"/>
21764 <colspec colwidth="5*" align="center"/>
21765 <colspec colwidth="6*" align="right"/>
21768 <entry><option>gecos_name</option></entry>
21769 <entry>Use: <emphasis>main</emphasis></entry>
21770 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
21771 <entry>Default: <emphasis>unset</emphasis></entry>
21777 <indexterm role="concept">
21778 <primary>HP-UX</primary>
21780 <indexterm role="concept">
21781 <primary><quote>gecos</quote> field</primary>
21782 <secondary>parsing</secondary>
21784 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
21785 password file to hold other information in addition to users’ real names. Exim
21786 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
21787 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
21788 of the field are used unchanged, except that, if an ampersand is encountered,
21789 it is replaced by the user’s login name with the first character forced to
21790 upper case, since this is a convention that is observed on many systems.
21793 When these options are set, <option>gecos_pattern</option> is treated as a regular
21794 expression that is to be applied to the field (again with & replaced by the
21795 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
21796 user’s name.
21799 <indexterm role="concept">
21800 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
21801 <secondary>in <option>gecos_name</option></secondary>
21803 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
21804 pick up sub-fields that were matched by the pattern. In HP-UX, where the user’s
21805 name terminates at the first comma, the following can be used:
21807 <literallayout class="monospaced">
21808 gecos_pattern = ([^,]*)
21812 <indexterm role="option">
21813 <primary>gecos_pattern</primary>
21816 <informaltable frame="all">
21817 <tgroup cols="4" colsep="0" rowsep="0">
21818 <colspec colwidth="8*" align="left"/>
21819 <colspec colwidth="5*" align="center"/>
21820 <colspec colwidth="5*" align="center"/>
21821 <colspec colwidth="6*" align="right"/>
21824 <entry><option>gecos_pattern</option></entry>
21825 <entry>Use: <emphasis>main</emphasis></entry>
21826 <entry>Type: <emphasis>string</emphasis></entry>
21827 <entry>Default: <emphasis>unset</emphasis></entry>
21833 See <option>gecos_name</option> above.
21836 <indexterm role="option">
21837 <primary>headers_charset</primary>
21840 <informaltable frame="all">
21841 <tgroup cols="4" colsep="0" rowsep="0">
21842 <colspec colwidth="8*" align="left"/>
21843 <colspec colwidth="5*" align="center"/>
21844 <colspec colwidth="5*" align="center"/>
21845 <colspec colwidth="6*" align="right"/>
21848 <entry><option>headers_charset</option></entry>
21849 <entry>Use: <emphasis>main</emphasis></entry>
21850 <entry>Type: <emphasis>string</emphasis></entry>
21851 <entry>Default: <emphasis>see below</emphasis></entry>
21857 This option sets a default character set for translating from encoded MIME
21858 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
21859 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
21860 ultimate default is ISO-8859-1. For more details see the description of header
21861 insertions in section <xref linkend="SECTexpansionitems"/>.
21864 <indexterm role="option">
21865 <primary>header_maxsize</primary>
21868 <informaltable frame="all">
21869 <tgroup cols="4" colsep="0" rowsep="0">
21870 <colspec colwidth="8*" align="left"/>
21871 <colspec colwidth="5*" align="center"/>
21872 <colspec colwidth="5*" align="center"/>
21873 <colspec colwidth="6*" align="right"/>
21876 <entry><option>header_maxsize</option></entry>
21877 <entry>Use: <emphasis>main</emphasis></entry>
21878 <entry>Type: <emphasis>integer</emphasis></entry>
21879 <entry>Default: <emphasis>see below</emphasis></entry>
21885 <indexterm role="concept">
21886 <primary>header section</primary>
21887 <secondary>maximum size of</secondary>
21889 <indexterm role="concept">
21890 <primary>limit</primary>
21891 <secondary>size of message header section</secondary>
21893 This option controls the overall maximum size of a message’s header
21894 section. The default is the value of HEADER_MAXSIZE in
21895 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
21896 sections are rejected.
21899 <indexterm role="option">
21900 <primary>header_line_maxsize</primary>
21903 <informaltable frame="all">
21904 <tgroup cols="4" colsep="0" rowsep="0">
21905 <colspec colwidth="8*" align="left"/>
21906 <colspec colwidth="5*" align="center"/>
21907 <colspec colwidth="5*" align="center"/>
21908 <colspec colwidth="6*" align="right"/>
21911 <entry><option>header_line_maxsize</option></entry>
21912 <entry>Use: <emphasis>main</emphasis></entry>
21913 <entry>Type: <emphasis>integer</emphasis></entry>
21914 <entry>Default: <emphasis>0</emphasis></entry>
21920 <indexterm role="concept">
21921 <primary>header lines</primary>
21922 <secondary>maximum size of</secondary>
21924 <indexterm role="concept">
21925 <primary>limit</primary>
21926 <secondary>size of one header line</secondary>
21928 This option limits the length of any individual header line in a message, after
21929 all the continuations have been joined together. Messages with individual
21930 header lines that are longer than the limit are rejected. The default value of
21931 zero means <quote>no limit</quote>.
21934 <indexterm role="option">
21935 <primary>helo_accept_junk_hosts</primary>
21938 <informaltable frame="all">
21939 <tgroup cols="4" colsep="0" rowsep="0">
21940 <colspec colwidth="8*" align="left"/>
21941 <colspec colwidth="5*" align="center"/>
21942 <colspec colwidth="5*" align="center"/>
21943 <colspec colwidth="6*" align="right"/>
21946 <entry><option>helo_accept_junk_hosts</option></entry>
21947 <entry>Use: <emphasis>main</emphasis></entry>
21948 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
21949 <entry>Default: <emphasis>unset</emphasis></entry>
21955 <indexterm role="concept">
21956 <primary>HELO</primary>
21957 <secondary>accepting junk data</secondary>
21959 <indexterm role="concept">
21960 <primary>EHLO</primary>
21961 <secondary>accepting junk data</secondary>
21963 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
21964 mail, and gives an error response for invalid data. Unfortunately, there are
21965 some SMTP clients that send syntactic junk. They can be accommodated by setting
21966 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
21967 if you want to do semantic checking.
21968 See also <option>helo_allow_chars</option> for a way of extending the permitted character
21972 <indexterm role="option">
21973 <primary>helo_allow_chars</primary>
21976 <informaltable frame="all">
21977 <tgroup cols="4" colsep="0" rowsep="0">
21978 <colspec colwidth="8*" align="left"/>
21979 <colspec colwidth="5*" align="center"/>
21980 <colspec colwidth="5*" align="center"/>
21981 <colspec colwidth="6*" align="right"/>
21984 <entry><option>helo_allow_chars</option></entry>
21985 <entry>Use: <emphasis>main</emphasis></entry>
21986 <entry>Type: <emphasis>string</emphasis></entry>
21987 <entry>Default: <emphasis>unset</emphasis></entry>
21993 <indexterm role="concept">
21994 <primary>HELO</primary>
21995 <secondary>underscores in</secondary>
21997 <indexterm role="concept">
21998 <primary>EHLO</primary>
21999 <secondary>underscores in</secondary>
22001 <indexterm role="concept">
22002 <primary>underscore in EHLO/HELO</primary>
22004 This option can be set to a string of rogue characters that are permitted in
22005 all EHLO and HELO names in addition to the standard letters, digits,
22006 hyphens, and dots. If you really must allow underscores, you can set
22008 <literallayout class="monospaced">
22009 helo_allow_chars = _
22012 Note that the value is one string, not a list.
22015 <indexterm role="option">
22016 <primary>helo_lookup_domains</primary>
22019 <informaltable frame="all">
22020 <tgroup cols="4" colsep="0" rowsep="0">
22021 <colspec colwidth="8*" align="left"/>
22022 <colspec colwidth="5*" align="center"/>
22023 <colspec colwidth="5*" align="center"/>
22024 <colspec colwidth="6*" align="right"/>
22027 <entry><option>helo_lookup_domains</option></entry>
22028 <entry>Use: <emphasis>main</emphasis></entry>
22029 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
22030 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
22036 <indexterm role="concept">
22037 <primary>HELO</primary>
22038 <secondary>forcing reverse lookup</secondary>
22040 <indexterm role="concept">
22041 <primary>EHLO</primary>
22042 <secondary>forcing reverse lookup</secondary>
22044 If the domain given by a client in a HELO or EHLO command matches this
22045 list, a reverse lookup is done in order to establish the host’s true name. The
22046 default forces a lookup if the client host gives the server’s name or any of
22047 its IP addresses (in brackets), something that broken clients have been seen to
22051 <indexterm role="option">
22052 <primary>helo_try_verify_hosts</primary>
22055 <informaltable frame="all">
22056 <tgroup cols="4" colsep="0" rowsep="0">
22057 <colspec colwidth="8*" align="left"/>
22058 <colspec colwidth="5*" align="center"/>
22059 <colspec colwidth="5*" align="center"/>
22060 <colspec colwidth="6*" align="right"/>
22063 <entry><option>helo_try_verify_hosts</option></entry>
22064 <entry>Use: <emphasis>main</emphasis></entry>
22065 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
22066 <entry>Default: <emphasis>unset</emphasis></entry>
22072 <indexterm role="concept">
22073 <primary>HELO verifying</primary>
22074 <secondary>optional</secondary>
22076 <indexterm role="concept">
22077 <primary>EHLO verifying</primary>
22078 <secondary>optional</secondary>
22080 By default, Exim just checks the syntax of HELO and EHLO commands (see
22081 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
22082 to do more extensive checking of the data supplied by these commands. The ACL
22083 condition <literal>verify</literal> <literal>=</literal> <literal>helo</literal> is provided to make this possible.
22084 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
22085 to force the check to occur. From release 4.53 onwards, this is no longer
22086 necessary. If the check has not been done before <literal>verify</literal> <literal>=</literal> <literal>helo</literal> is
22087 encountered, it is done at that time. Consequently, this option is obsolete.
22088 Its specification is retained here for backwards compatibility.
22091 When an EHLO or HELO command is received, if the calling host matches
22092 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
22093 EHLO command either:
22098 is an IP literal matching the calling address of the host, or
22103 <indexterm role="concept">
22104 <primary>DNS</primary>
22105 <secondary>reverse lookup</secondary>
22107 <indexterm role="concept">
22108 <primary>reverse DNS lookup</primary>
22110 matches the host name that Exim obtains by doing a reverse lookup of the
22111 calling host address, or
22116 when looked up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when
22117 available) yields the calling host address.
22122 However, the EHLO or HELO command is not rejected if any of the checks
22123 fail. Processing continues, but the result of the check is remembered, and can
22124 be detected later in an ACL by the <literal>verify</literal> <literal>=</literal> <literal>helo</literal> condition.
22127 <indexterm role="option">
22128 <primary>helo_verify_hosts</primary>
22131 <informaltable frame="all">
22132 <tgroup cols="4" colsep="0" rowsep="0">
22133 <colspec colwidth="8*" align="left"/>
22134 <colspec colwidth="5*" align="center"/>
22135 <colspec colwidth="5*" align="center"/>
22136 <colspec colwidth="6*" align="right"/>
22139 <entry><option>helo_verify_hosts</option></entry>
22140 <entry>Use: <emphasis>main</emphasis></entry>
22141 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
22142 <entry>Default: <emphasis>unset</emphasis></entry>
22148 <indexterm role="concept">
22149 <primary>HELO verifying</primary>
22150 <secondary>mandatory</secondary>
22152 <indexterm role="concept">
22153 <primary>EHLO verifying</primary>
22154 <secondary>mandatory</secondary>
22156 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
22157 backwards compatibility. For hosts that match this option, Exim checks the host
22158 name given in the HELO or EHLO in the same way as for
22159 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
22160 rejected with a 550 error, and entries are written to the main and reject logs.
22161 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
22165 <indexterm role="option">
22166 <primary>hold_domains</primary>
22169 <informaltable frame="all">
22170 <tgroup cols="4" colsep="0" rowsep="0">
22171 <colspec colwidth="8*" align="left"/>
22172 <colspec colwidth="5*" align="center"/>
22173 <colspec colwidth="5*" align="center"/>
22174 <colspec colwidth="6*" align="right"/>
22177 <entry><option>hold_domains</option></entry>
22178 <entry>Use: <emphasis>main</emphasis></entry>
22179 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
22180 <entry>Default: <emphasis>unset</emphasis></entry>
22186 <indexterm role="concept">
22187 <primary>domain</primary>
22188 <secondary>delaying delivery</secondary>
22190 <indexterm role="concept">
22191 <primary>delivery</primary>
22192 <secondary>delaying certain domains</secondary>
22194 This option allows mail for particular domains to be held on the queue
22195 manually. The option is overridden if a message delivery is forced with the
22196 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
22197 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
22198 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
22199 it is deferred every time the message is looked at.
22202 This option is intended as a temporary operational measure for delaying the
22203 delivery of mail while some problem is being sorted out, or some new
22204 configuration tested. If you just want to delay the processing of some
22205 domains until a queue run occurs, you should use <option>queue_domains</option> or
22206 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
22209 A setting of <option>hold_domains</option> does not override Exim’s code for removing
22210 messages from the queue if they have been there longer than the longest retry
22211 time in any retry rule. If you want to hold messages for longer than the normal
22212 retry times, insert a dummy retry rule with a long retry time.
22215 <indexterm role="option">
22216 <primary>host_lookup</primary>
22219 <informaltable frame="all">
22220 <tgroup cols="4" colsep="0" rowsep="0">
22221 <colspec colwidth="8*" align="left"/>
22222 <colspec colwidth="5*" align="center"/>
22223 <colspec colwidth="5*" align="center"/>
22224 <colspec colwidth="6*" align="right"/>
22227 <entry><option>host_lookup</option></entry>
22228 <entry>Use: <emphasis>main</emphasis></entry>
22229 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
22230 <entry>Default: <emphasis>unset</emphasis></entry>
22236 <indexterm role="concept">
22237 <primary>host name lookup</primary>
22238 <secondary>forcing</secondary>
22240 Exim does not look up the name of a calling host from its IP address unless it
22241 is required to compare against some host list, or the host matches
22242 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
22243 option (which normally contains IP addresses rather than host names). The
22244 default configuration file contains
22246 <literallayout class="monospaced">
22250 which causes a lookup to happen for all hosts. If the expense of these lookups
22251 is felt to be too great, the setting can be changed or removed.
22254 After a successful reverse lookup, Exim does a forward lookup on the name it
22255 has obtained, to verify that it yields the IP address that it started with. If
22256 this check fails, Exim behaves as if the name lookup failed.
22259 <indexterm role="concept">
22260 <primary><varname>$host_lookup_failed</varname></primary>
22262 <indexterm role="concept">
22263 <primary><varname>$sender_host_name</varname></primary>
22265 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
22266 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
22267 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and <literal>verify</literal> <literal>=</literal>
22268 <literal>reverse_host_lookup</literal> in ACLs.
22271 <indexterm role="option">
22272 <primary>host_lookup_order</primary>
22275 <informaltable frame="all">
22276 <tgroup cols="4" colsep="0" rowsep="0">
22277 <colspec colwidth="8*" align="left"/>
22278 <colspec colwidth="5*" align="center"/>
22279 <colspec colwidth="5*" align="center"/>
22280 <colspec colwidth="6*" align="right"/>
22283 <entry><option>host_lookup_order</option></entry>
22284 <entry>Use: <emphasis>main</emphasis></entry>
22285 <entry>Type: <emphasis>string list</emphasis></entry>
22286 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
22292 This option specifies the order of different lookup methods when Exim is trying
22293 to find a host name from an IP address. The default is to do a DNS lookup
22294 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
22295 if that fails. You can change the order of these lookups, or omit one entirely,
22299 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
22300 multiple PTR records in the DNS and the IP address is not listed in
22301 <filename>/etc/hosts</filename>. Different operating systems give different results in this
22302 case. That is why the default tries a DNS lookup first.
22305 <indexterm role="option">
22306 <primary>host_reject_connection</primary>
22309 <informaltable frame="all">
22310 <tgroup cols="4" colsep="0" rowsep="0">
22311 <colspec colwidth="8*" align="left"/>
22312 <colspec colwidth="5*" align="center"/>
22313 <colspec colwidth="5*" align="center"/>
22314 <colspec colwidth="6*" align="right"/>
22317 <entry><option>host_reject_connection</option></entry>
22318 <entry>Use: <emphasis>main</emphasis></entry>
22319 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
22320 <entry>Default: <emphasis>unset</emphasis></entry>
22326 <indexterm role="concept">
22327 <primary>host</primary>
22328 <secondary>rejecting connections from</secondary>
22330 If this option is set, incoming SMTP calls from the hosts listed are rejected
22331 as soon as the connection is made.
22332 This option is obsolete, and retained only for backward compatibility, because
22333 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
22334 connections immediately.
22337 The ability to give an immediate rejection (either by this option or using an
22338 ACL) is provided for use in unusual cases. Many hosts will just try again,
22339 sometimes without much delay. Normally, it is better to use an ACL to reject
22340 incoming messages at a later stage, such as after RCPT commands. See
22341 chapter <xref linkend="CHAPACL"/>.
22344 <indexterm role="option">
22345 <primary>hosts_connection_nolog</primary>
22348 <informaltable frame="all">
22349 <tgroup cols="4" colsep="0" rowsep="0">
22350 <colspec colwidth="8*" align="left"/>
22351 <colspec colwidth="5*" align="center"/>
22352 <colspec colwidth="5*" align="center"/>
22353 <colspec colwidth="6*" align="right"/>
22356 <entry><option>hosts_connection_nolog</option></entry>
22357 <entry>Use: <emphasis>main</emphasis></entry>
22358 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
22359 <entry>Default: <emphasis>unset</emphasis></entry>
22365 <indexterm role="concept">
22366 <primary>host</primary>
22367 <secondary>not logging connections from</secondary>
22369 This option defines a list of hosts for which connection logging does not
22370 happen, even though the <option>smtp_connection</option> log selector is set. For example,
22371 you might want not to log SMTP connections from local processes, or from
22372 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
22373 the daemon; you should therefore strive to restrict its value to a short inline
22374 list of IP addresses and networks. To disable logging SMTP connections from
22375 local processes, you must create a host list with an empty item. For example:
22377 <literallayout class="monospaced">
22378 hosts_connection_nolog = :
22381 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
22384 <indexterm role="option">
22385 <primary>hosts_treat_as_local</primary>
22388 <informaltable frame="all">
22389 <tgroup cols="4" colsep="0" rowsep="0">
22390 <colspec colwidth="8*" align="left"/>
22391 <colspec colwidth="5*" align="center"/>
22392 <colspec colwidth="5*" align="center"/>
22393 <colspec colwidth="6*" align="right"/>
22396 <entry><option>hosts_treat_as_local</option></entry>
22397 <entry>Use: <emphasis>main</emphasis></entry>
22398 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
22399 <entry>Default: <emphasis>unset</emphasis></entry>
22405 <indexterm role="concept">
22406 <primary>local host</primary>
22407 <secondary>domains treated as</secondary>
22409 <indexterm role="concept">
22410 <primary>host</primary>
22411 <secondary>treated as local</secondary>
22413 If this option is set, any host names that match the domain list are treated as
22414 if they were the local host when Exim is scanning host lists obtained from MX
22416 or other sources. Note that the value of this option is a domain list, not a
22417 host list, because it is always used to check host names, not IP addresses.
22420 This option also applies when Exim is matching the special items
22421 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
22422 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
22423 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
22424 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
22425 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
22426 interfaces and recognising the local host.
22429 <indexterm role="option">
22430 <primary>ignore_bounce_errors_after</primary>
22433 <informaltable frame="all">
22434 <tgroup cols="4" colsep="0" rowsep="0">
22435 <colspec colwidth="8*" align="left"/>
22436 <colspec colwidth="5*" align="center"/>
22437 <colspec colwidth="5*" align="center"/>
22438 <colspec colwidth="6*" align="right"/>
22441 <entry><option>ignore_bounce_errors_after</option></entry>
22442 <entry>Use: <emphasis>main</emphasis></entry>
22443 <entry>Type: <emphasis>time</emphasis></entry>
22444 <entry>Default: <emphasis>10w</emphasis></entry>
22450 <indexterm role="concept">
22451 <primary>bounce message</primary>
22452 <secondary>discarding</secondary>
22454 <indexterm role="concept">
22455 <primary>discarding bounce message</primary>
22457 This option affects the processing of bounce messages that cannot be delivered,
22458 that is, those that suffer a permanent delivery failure. (Bounce messages that
22459 suffer temporary delivery failures are of course retried in the usual way.)
22462 After a permanent delivery failure, bounce messages are frozen,
22463 because there is no sender to whom they can be returned. When a frozen bounce
22464 message has been on the queue for more than the given time, it is unfrozen at
22465 the next queue run, and a further delivery is attempted. If delivery fails
22466 again, the bounce message is discarded. This makes it possible to keep failed
22467 bounce messages around for a shorter time than the normal maximum retry time
22468 for frozen messages. For example,
22470 <literallayout class="monospaced">
22471 ignore_bounce_errors_after = 12h
22474 retries failed bounce message deliveries after 12 hours, discarding any further
22475 failures. If the value of this option is set to a zero time period, bounce
22476 failures are discarded immediately. Setting a very long time (as in the default
22477 value) has the effect of disabling this option. For ways of automatically
22478 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
22479 <option>timeout_frozen_after</option>.
22482 <indexterm role="option">
22483 <primary>ignore_fromline_hosts</primary>
22486 <informaltable frame="all">
22487 <tgroup cols="4" colsep="0" rowsep="0">
22488 <colspec colwidth="8*" align="left"/>
22489 <colspec colwidth="5*" align="center"/>
22490 <colspec colwidth="5*" align="center"/>
22491 <colspec colwidth="6*" align="right"/>
22494 <entry><option>ignore_fromline_hosts</option></entry>
22495 <entry>Use: <emphasis>main</emphasis></entry>
22496 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
22497 <entry>Default: <emphasis>unset</emphasis></entry>
22503 <indexterm role="concept">
22504 <primary><quote>From</quote> line</primary>
22506 <indexterm role="concept">
22507 <primary>UUCP</primary>
22508 <secondary><quote>From</quote> line</secondary>
22510 Some broken SMTP clients insist on sending a UUCP-like <quote>From </quote> line before
22511 the headers of a message. By default this is treated as the start of the
22512 message’s body, which means that any following headers are not recognized as
22513 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
22514 match those hosts that insist on sending it. If the sender is actually a local
22515 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
22516 <option>ignore_fromline_local</option> must be set to achieve this effect.
22519 <indexterm role="option">
22520 <primary>ignore_fromline_local</primary>
22523 <informaltable frame="all">
22524 <tgroup cols="4" colsep="0" rowsep="0">
22525 <colspec colwidth="8*" align="left"/>
22526 <colspec colwidth="5*" align="center"/>
22527 <colspec colwidth="5*" align="center"/>
22528 <colspec colwidth="6*" align="right"/>
22531 <entry><option>ignore_fromline_local</option></entry>
22532 <entry>Use: <emphasis>main</emphasis></entry>
22533 <entry>Type: <emphasis>boolean</emphasis></entry>
22534 <entry>Default: <emphasis>false</emphasis></entry>
22540 See <option>ignore_fromline_hosts</option> above.
22543 <indexterm role="option">
22544 <primary>keep_malformed</primary>
22547 <informaltable frame="all">
22548 <tgroup cols="4" colsep="0" rowsep="0">
22549 <colspec colwidth="8*" align="left"/>
22550 <colspec colwidth="5*" align="center"/>
22551 <colspec colwidth="5*" align="center"/>
22552 <colspec colwidth="6*" align="right"/>
22555 <entry><option>keep_malformed</option></entry>
22556 <entry>Use: <emphasis>main</emphasis></entry>
22557 <entry>Type: <emphasis>time</emphasis></entry>
22558 <entry>Default: <emphasis>4d</emphasis></entry>
22564 This option specifies the length of time to keep messages whose spool files
22565 have been corrupted in some way. This should, of course, never happen. At the
22566 next attempt to deliver such a message, it gets removed. The incident is
22570 <indexterm role="option">
22571 <primary>ldap_default_servers</primary>
22574 <informaltable frame="all">
22575 <tgroup cols="4" colsep="0" rowsep="0">
22576 <colspec colwidth="8*" align="left"/>
22577 <colspec colwidth="5*" align="center"/>
22578 <colspec colwidth="5*" align="center"/>
22579 <colspec colwidth="6*" align="right"/>
22582 <entry><option>ldap_default_servers</option></entry>
22583 <entry>Use: <emphasis>main</emphasis></entry>
22584 <entry>Type: <emphasis>string list</emphasis></entry>
22585 <entry>Default: <emphasis>unset</emphasis></entry>
22591 <indexterm role="concept">
22592 <primary>LDAP</primary>
22593 <secondary>default servers</secondary>
22595 This option provides a list of LDAP servers which are tried in turn when an
22596 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
22597 details of LDAP queries. This option is available only when Exim has been built
22601 <indexterm role="option">
22602 <primary>ldap_version</primary>
22605 <informaltable frame="all">
22606 <tgroup cols="4" colsep="0" rowsep="0">
22607 <colspec colwidth="8*" align="left"/>
22608 <colspec colwidth="5*" align="center"/>
22609 <colspec colwidth="5*" align="center"/>
22610 <colspec colwidth="6*" align="right"/>
22613 <entry><option>ldap_version</option></entry>
22614 <entry>Use: <emphasis>main</emphasis></entry>
22615 <entry>Type: <emphasis>integer</emphasis></entry>
22616 <entry>Default: <emphasis>unset</emphasis></entry>
22622 <indexterm role="concept">
22623 <primary>LDAP protocol version</primary>
22624 <secondary>forcing</secondary>
22626 This option can be used to force Exim to set a specific protocol version for
22627 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
22628 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
22629 the LDAP headers; otherwise it is 2. This option is available only when Exim
22630 has been built with LDAP support.
22633 <indexterm role="option">
22634 <primary>local_from_check</primary>
22637 <informaltable frame="all">
22638 <tgroup cols="4" colsep="0" rowsep="0">
22639 <colspec colwidth="8*" align="left"/>
22640 <colspec colwidth="5*" align="center"/>
22641 <colspec colwidth="5*" align="center"/>
22642 <colspec colwidth="6*" align="right"/>
22645 <entry><option>local_from_check</option></entry>
22646 <entry>Use: <emphasis>main</emphasis></entry>
22647 <entry>Type: <emphasis>boolean</emphasis></entry>
22648 <entry>Default: <emphasis>true</emphasis></entry>
22654 <indexterm role="concept">
22655 <primary><emphasis>Sender:</emphasis> header line</primary>
22656 <secondary>disabling addition of</secondary>
22658 <indexterm role="concept">
22659 <primary><emphasis>From:</emphasis> header line</primary>
22660 <secondary>disabling checking of</secondary>
22662 When a message is submitted locally (that is, not over a TCP/IP connection) by
22663 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
22664 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
22665 the domain specified by <option>qualify_domain</option>.
22668 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
22669 locally submitted message is automatically qualified by Exim, unless the
22670 <option>-bnq</option> command line option is used.
22673 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
22674 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
22675 <emphasis>Sender:</emphasis> header with an address constructed from the calling user’s login
22676 and the default qualify domain.
22679 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
22680 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
22681 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
22682 <option>local_sender_retain</option> to be true.
22685 <indexterm role="concept">
22686 <primary>envelope sender</primary>
22688 These options affect only the header lines in the message. The envelope sender
22689 is still forced to be the login id at the qualify domain unless
22690 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
22693 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
22694 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
22695 has more details about <emphasis>Sender:</emphasis> processing.
22698 <indexterm role="option">
22699 <primary>local_from_prefix</primary>
22702 <informaltable frame="all">
22703 <tgroup cols="4" colsep="0" rowsep="0">
22704 <colspec colwidth="8*" align="left"/>
22705 <colspec colwidth="5*" align="center"/>
22706 <colspec colwidth="5*" align="center"/>
22707 <colspec colwidth="6*" align="right"/>
22710 <entry><option>local_from_prefix</option></entry>
22711 <entry>Use: <emphasis>main</emphasis></entry>
22712 <entry>Type: <emphasis>string</emphasis></entry>
22713 <entry>Default: <emphasis>unset</emphasis></entry>
22719 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
22720 matching the login id (see <option>local_from_check</option> above), it can be configured to
22721 ignore certain prefixes and suffixes in the local part of the address. This is
22722 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
22723 appropriate lists, in the same form as the <option>local_part_prefix</option> and
22724 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
22727 <literallayout class="monospaced">
22728 local_from_prefix = *-
22731 is set, a <emphasis>From:</emphasis> line containing
22733 <literallayout class="monospaced">
22734 From: anything-user@your.domain.example
22737 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
22738 matches the actual sender address that is constructed from the login name and
22742 <indexterm role="option">
22743 <primary>local_from_suffix</primary>
22746 <informaltable frame="all">
22747 <tgroup cols="4" colsep="0" rowsep="0">
22748 <colspec colwidth="8*" align="left"/>
22749 <colspec colwidth="5*" align="center"/>
22750 <colspec colwidth="5*" align="center"/>
22751 <colspec colwidth="6*" align="right"/>
22754 <entry><option>local_from_suffix</option></entry>
22755 <entry>Use: <emphasis>main</emphasis></entry>
22756 <entry>Type: <emphasis>string</emphasis></entry>
22757 <entry>Default: <emphasis>unset</emphasis></entry>
22763 See <option>local_from_prefix</option> above.
22766 <indexterm role="option">
22767 <primary>local_interfaces</primary>
22770 <informaltable frame="all">
22771 <tgroup cols="4" colsep="0" rowsep="0">
22772 <colspec colwidth="8*" align="left"/>
22773 <colspec colwidth="5*" align="center"/>
22774 <colspec colwidth="5*" align="center"/>
22775 <colspec colwidth="6*" align="right"/>
22778 <entry><option>local_interfaces</option></entry>
22779 <entry>Use: <emphasis>main</emphasis></entry>
22780 <entry>Type: <emphasis>string list</emphasis></entry>
22781 <entry>Default: <emphasis>see below</emphasis></entry>
22787 This option controls which network interfaces are used by the daemon for
22788 listening; they are also used to identify the local host when routing. Chapter
22789 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
22790 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
22791 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
22792 <option>local_interfaces</option> is
22794 <literallayout class="monospaced">
22795 local_interfaces = 0.0.0.0
22798 when Exim is built without IPv6 support; otherwise it is
22800 <literallayout class="monospaced">
22801 local_interfaces = <; ::0 ; 0.0.0.0
22804 <indexterm role="option">
22805 <primary>local_scan_timeout</primary>
22808 <informaltable frame="all">
22809 <tgroup cols="4" colsep="0" rowsep="0">
22810 <colspec colwidth="8*" align="left"/>
22811 <colspec colwidth="5*" align="center"/>
22812 <colspec colwidth="5*" align="center"/>
22813 <colspec colwidth="6*" align="right"/>
22816 <entry><option>local_scan_timeout</option></entry>
22817 <entry>Use: <emphasis>main</emphasis></entry>
22818 <entry>Type: <emphasis>time</emphasis></entry>
22819 <entry>Default: <emphasis>5m</emphasis></entry>
22825 <indexterm role="concept">
22826 <primary>timeout</primary>
22827 <secondary>for <function>local_scan()</function> function</secondary>
22829 <indexterm role="concept">
22830 <primary><function>local_scan()</function> function</primary>
22831 <secondary>timeout</secondary>
22833 This timeout applies to the <function>local_scan()</function> function (see chapter
22834 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
22835 the incoming message is rejected with a temporary error if it is an SMTP
22836 message. For a non-SMTP message, the message is dropped and Exim ends with a
22837 non-zero code. The incident is logged on the main and reject logs.
22840 <indexterm role="option">
22841 <primary>local_sender_retain</primary>
22844 <informaltable frame="all">
22845 <tgroup cols="4" colsep="0" rowsep="0">
22846 <colspec colwidth="8*" align="left"/>
22847 <colspec colwidth="5*" align="center"/>
22848 <colspec colwidth="5*" align="center"/>
22849 <colspec colwidth="6*" align="right"/>
22852 <entry><option>local_sender_retain</option></entry>
22853 <entry>Use: <emphasis>main</emphasis></entry>
22854 <entry>Type: <emphasis>boolean</emphasis></entry>
22855 <entry>Default: <emphasis>false</emphasis></entry>
22861 <indexterm role="concept">
22862 <primary><emphasis>Sender:</emphasis> header line</primary>
22863 <secondary>retaining from local submission</secondary>
22865 When a message is submitted locally (that is, not over a TCP/IP connection) by
22866 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
22867 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
22868 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
22869 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
22870 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
22873 <indexterm role="option">
22874 <primary>localhost_number</primary>
22877 <informaltable frame="all">
22878 <tgroup cols="4" colsep="0" rowsep="0">
22879 <colspec colwidth="8*" align="left"/>
22880 <colspec colwidth="5*" align="center"/>
22881 <colspec colwidth="5*" align="center"/>
22882 <colspec colwidth="6*" align="right"/>
22885 <entry><option>localhost_number</option></entry>
22886 <entry>Use: <emphasis>main</emphasis></entry>
22887 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
22888 <entry>Default: <emphasis>unset</emphasis></entry>
22894 <indexterm role="concept">
22895 <primary>host</primary>
22896 <secondary>locally unique number for</secondary>
22898 <indexterm role="concept">
22899 <primary>message ids</primary>
22900 <secondary>with multiple hosts</secondary>
22902 <indexterm role="concept">
22903 <primary><varname>$localhost_number</varname></primary>
22905 Exim’s message ids are normally unique only within the local host. If
22906 uniqueness among a set of hosts is required, each host must set a different
22907 value for the <option>localhost_number</option> option. The string is expanded immediately
22908 after reading the configuration file (so that a number can be computed from the
22909 host name, for example) and the result of the expansion must be a number in the
22910 range 0–16 (or 0–10 on operating systems with case-insensitive file
22911 systems). This is available in subsequent string expansions via the variable
22912 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
22913 characters of the message id, instead of just being a fractional part of the
22914 time, are computed from the time and the local host number as described in
22915 section <xref linkend="SECTmessiden"/>.
22918 <indexterm role="option">
22919 <primary>log_file_path</primary>
22922 <informaltable frame="all">
22923 <tgroup cols="4" colsep="0" rowsep="0">
22924 <colspec colwidth="8*" align="left"/>
22925 <colspec colwidth="5*" align="center"/>
22926 <colspec colwidth="5*" align="center"/>
22927 <colspec colwidth="6*" align="right"/>
22930 <entry><option>log_file_path</option></entry>
22931 <entry>Use: <emphasis>main</emphasis></entry>
22932 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
22933 <entry>Default: <emphasis>set at compile time</emphasis></entry>
22939 <indexterm role="concept">
22940 <primary>log</primary>
22941 <secondary>file path for</secondary>
22943 This option sets the path which is used to determine the names of Exim’s log
22944 files, or indicates that logging is to be to syslog, or both. It is expanded
22945 when Exim is entered, so it can, for example, contain a reference to the host
22946 name. If no specific path is set for the log files at compile or run time, they
22947 are written in a sub-directory called <filename>log</filename> in Exim’s spool directory.
22948 Chapter <xref linkend="CHAPlog"/> contains further details about Exim’s logging, and
22949 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
22950 used. If this string is fixed at your installation (contains no expansion
22951 variables) it is recommended that you do not set this option in the
22952 configuration file, but instead supply the path using LOG_FILE_PATH in
22953 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
22954 early on – in particular, failure to read the configuration file.
22957 <indexterm role="option">
22958 <primary>log_selector</primary>
22961 <informaltable frame="all">
22962 <tgroup cols="4" colsep="0" rowsep="0">
22963 <colspec colwidth="8*" align="left"/>
22964 <colspec colwidth="5*" align="center"/>
22965 <colspec colwidth="5*" align="center"/>
22966 <colspec colwidth="6*" align="right"/>
22969 <entry><option>log_selector</option></entry>
22970 <entry>Use: <emphasis>main</emphasis></entry>
22971 <entry>Type: <emphasis>string</emphasis></entry>
22972 <entry>Default: <emphasis>unset</emphasis></entry>
22978 <indexterm role="concept">
22979 <primary>log</primary>
22980 <secondary>selectors</secondary>
22982 This option can be used to reduce or increase the number of things that Exim
22983 writes to its log files. Its argument is made up of names preceded by plus or
22984 minus characters. For example:
22986 <literallayout class="monospaced">
22987 log_selector = +arguments -retry_defer
22990 A list of possible names and what they control is given in the chapter on
22991 logging, in section <xref linkend="SECTlogselector"/>.
22994 <indexterm role="option">
22995 <primary>log_timezone</primary>
22998 <informaltable frame="all">
22999 <tgroup cols="4" colsep="0" rowsep="0">
23000 <colspec colwidth="8*" align="left"/>
23001 <colspec colwidth="5*" align="center"/>
23002 <colspec colwidth="5*" align="center"/>
23003 <colspec colwidth="6*" align="right"/>
23006 <entry><option>log_timezone</option></entry>
23007 <entry>Use: <emphasis>main</emphasis></entry>
23008 <entry>Type: <emphasis>boolean</emphasis></entry>
23009 <entry>Default: <emphasis>false</emphasis></entry>
23015 <indexterm role="concept">
23016 <primary>log</primary>
23017 <secondary>timezone for entries</secondary>
23019 <indexterm role="concept">
23020 <primary><varname>$tod_log</varname></primary>
23022 <indexterm role="concept">
23023 <primary><varname>$tod_zone</varname></primary>
23025 By default, the timestamps on log lines are in local time without the
23026 timezone. This means that if your timezone changes twice a year, the timestamps
23027 in log lines are ambiguous for an hour when the clocks go back. One way of
23028 avoiding this problem is to set the timezone to UTC. An alternative is to set
23029 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
23030 timestamps in log lines. Turning on this option can add quite a lot to the size
23031 of log files because each line is extended by 6 characters. Note that the
23032 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
23033 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
23036 <indexterm role="option">
23037 <primary>lookup_open_max</primary>
23040 <informaltable frame="all">
23041 <tgroup cols="4" colsep="0" rowsep="0">
23042 <colspec colwidth="8*" align="left"/>
23043 <colspec colwidth="5*" align="center"/>
23044 <colspec colwidth="5*" align="center"/>
23045 <colspec colwidth="6*" align="right"/>
23048 <entry><option>lookup_open_max</option></entry>
23049 <entry>Use: <emphasis>main</emphasis></entry>
23050 <entry>Type: <emphasis>integer</emphasis></entry>
23051 <entry>Default: <emphasis>25</emphasis></entry>
23057 <indexterm role="concept">
23058 <primary>too many open files</primary>
23060 <indexterm role="concept">
23061 <primary>open files</primary>
23062 <secondary>too many</secondary>
23064 <indexterm role="concept">
23065 <primary>file</primary>
23066 <secondary>too many open</secondary>
23068 <indexterm role="concept">
23069 <primary>lookup</primary>
23070 <secondary>maximum open files</secondary>
23072 <indexterm role="concept">
23073 <primary>limit</primary>
23074 <secondary>open files for lookups</secondary>
23076 This option limits the number of simultaneously open files for single-key
23077 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
23078 Exim normally keeps these files open during routing, because often the same
23079 file is required several times. If the limit is reached, Exim closes the least
23080 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
23081 actually opens two files for each logical DBM database, though it still counts
23082 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
23083 open files</quote> errors with NDBM, you need to reduce the value of
23084 <option>lookup_open_max</option>.
23087 <indexterm role="option">
23088 <primary>max_username_length</primary>
23091 <informaltable frame="all">
23092 <tgroup cols="4" colsep="0" rowsep="0">
23093 <colspec colwidth="8*" align="left"/>
23094 <colspec colwidth="5*" align="center"/>
23095 <colspec colwidth="5*" align="center"/>
23096 <colspec colwidth="6*" align="right"/>
23099 <entry><option>max_username_length</option></entry>
23100 <entry>Use: <emphasis>main</emphasis></entry>
23101 <entry>Type: <emphasis>integer</emphasis></entry>
23102 <entry>Default: <emphasis>0</emphasis></entry>
23108 <indexterm role="concept">
23109 <primary>length</primary>
23110 <secondary>of login name</secondary>
23112 <indexterm role="concept">
23113 <primary>user name</primary>
23114 <secondary>maximum length</secondary>
23116 <indexterm role="concept">
23117 <primary>limit</primary>
23118 <secondary>user name length</secondary>
23120 Some operating systems are broken in that they truncate long arguments to
23121 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
23122 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
23123 an argument that is longer behaves as if <function>getpwnam()</function> failed.
23126 <indexterm role="option">
23127 <primary>message_body_visible</primary>
23130 <informaltable frame="all">
23131 <tgroup cols="4" colsep="0" rowsep="0">
23132 <colspec colwidth="8*" align="left"/>
23133 <colspec colwidth="5*" align="center"/>
23134 <colspec colwidth="5*" align="center"/>
23135 <colspec colwidth="6*" align="right"/>
23138 <entry><option>message_body_visible</option></entry>
23139 <entry>Use: <emphasis>main</emphasis></entry>
23140 <entry>Type: <emphasis>integer</emphasis></entry>
23141 <entry>Default: <emphasis>500</emphasis></entry>
23147 <indexterm role="concept">
23148 <primary>body of message</primary>
23149 <secondary>visible size</secondary>
23151 <indexterm role="concept">
23152 <primary>message body</primary>
23153 <secondary>visible size</secondary>
23155 <indexterm role="concept">
23156 <primary><varname>$message_body</varname></primary>
23158 <indexterm role="concept">
23159 <primary><varname>$message_body_end</varname></primary>
23161 This option specifies how much of a message’s body is to be included in the
23162 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
23165 <indexterm role="option">
23166 <primary>message_id_header_domain</primary>
23169 <informaltable frame="all">
23170 <tgroup cols="4" colsep="0" rowsep="0">
23171 <colspec colwidth="8*" align="left"/>
23172 <colspec colwidth="5*" align="center"/>
23173 <colspec colwidth="5*" align="center"/>
23174 <colspec colwidth="6*" align="right"/>
23177 <entry><option>message_id_header_domain</option></entry>
23178 <entry>Use: <emphasis>main</emphasis></entry>
23179 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
23180 <entry>Default: <emphasis>unset</emphasis></entry>
23186 <indexterm role="concept">
23187 <primary><emphasis>Message-ID:</emphasis> header line</primary>
23189 If this option is set, the string is expanded and used as the right hand side
23190 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
23191 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
23192 means <quote>not received over TCP/IP.</quote>
23193 Otherwise, the primary host name is used.
23194 Only letters, digits, dot and hyphen are accepted; any other characters are
23195 replaced by hyphens. If the expansion is forced to fail, or if the result is an
23196 empty string, the option is ignored.
23199 <indexterm role="option">
23200 <primary>message_id_header_text</primary>
23203 <informaltable frame="all">
23204 <tgroup cols="4" colsep="0" rowsep="0">
23205 <colspec colwidth="8*" align="left"/>
23206 <colspec colwidth="5*" align="center"/>
23207 <colspec colwidth="5*" align="center"/>
23208 <colspec colwidth="6*" align="right"/>
23211 <entry><option>message_id_header_text</option></entry>
23212 <entry>Use: <emphasis>main</emphasis></entry>
23213 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
23214 <entry>Default: <emphasis>unset</emphasis></entry>
23220 If this variable is set, the string is expanded and used to augment the text of
23221 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
23222 message does not have one. The text of this header is required by RFC 2822 to
23223 take the form of an address. By default, Exim uses its internal message id as
23224 the local part, and the primary host name as the domain. If this option is set,
23225 it is expanded, and provided the expansion is not forced to fail, and does not
23226 yield an empty string, the result is inserted into the header immediately
23227 before the @, separated from the internal message id by a dot. Any characters
23228 that are illegal in an address are automatically converted into hyphens. This
23229 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
23230 colons will become hyphens.
23233 <indexterm role="option">
23234 <primary>message_logs</primary>
23237 <informaltable frame="all">
23238 <tgroup cols="4" colsep="0" rowsep="0">
23239 <colspec colwidth="8*" align="left"/>
23240 <colspec colwidth="5*" align="center"/>
23241 <colspec colwidth="5*" align="center"/>
23242 <colspec colwidth="6*" align="right"/>
23245 <entry><option>message_logs</option></entry>
23246 <entry>Use: <emphasis>main</emphasis></entry>
23247 <entry>Type: <emphasis>boolean</emphasis></entry>
23248 <entry>Default: <emphasis>true</emphasis></entry>
23254 <indexterm role="concept">
23255 <primary>message log</primary>
23256 <secondary>disabling</secondary>
23258 <indexterm role="concept">
23259 <primary>log</primary>
23260 <secondary>message log; disabling</secondary>
23262 If this option is turned off, per-message log files are not created in the
23263 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
23264 Exim, by reducing the number of files involved in handling a message from a
23265 minimum of four (header spool file, body spool file, delivery journal, and
23266 per-message log) to three. The other major I/O activity is Exim’s main log,
23267 which is not affected by this option.
23270 <indexterm role="option">
23271 <primary>message_size_limit</primary>
23274 <informaltable frame="all">
23275 <tgroup cols="4" colsep="0" rowsep="0">
23276 <colspec colwidth="8*" align="left"/>
23277 <colspec colwidth="5*" align="center"/>
23278 <colspec colwidth="5*" align="center"/>
23279 <colspec colwidth="6*" align="right"/>
23282 <entry><option>message_size_limit</option></entry>
23283 <entry>Use: <emphasis>main</emphasis></entry>
23284 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
23285 <entry>Default: <emphasis>50M</emphasis></entry>
23291 <indexterm role="concept">
23292 <primary>message</primary>
23293 <secondary>size limit</secondary>
23295 <indexterm role="concept">
23296 <primary>limit</primary>
23297 <secondary>message size</secondary>
23299 <indexterm role="concept">
23300 <primary>size of message</primary>
23301 <secondary>limit</secondary>
23303 This option limits the maximum size of message that Exim will process. The
23304 value is expanded for each incoming
23305 connection so, for example, it can be made to depend on the IP address of the
23306 remote host for messages arriving via TCP/IP. <emphasis role="bold">Note</emphasis>: This limit cannot be
23307 made to depend on a message’s sender or any other properties of an individual
23308 message, because it has to be advertised in the server’s response to EHLO.
23309 String expansion failure causes a temporary error. A value of zero means no
23310 limit, but its use is not recommended. See also <option>bounce_return_size_limit</option>.
23313 Incoming SMTP messages are failed with a 552 error if the limit is
23314 exceeded; locally-generated messages either get a stderr message or a delivery
23315 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
23316 an oversized message is logged in both the main and the reject logs. See also
23317 the generic transport option <option>message_size_limit</option>, which limits the size of
23318 message that an individual transport can process.
23321 <indexterm role="option">
23322 <primary>move_frozen_messages</primary>
23325 <informaltable frame="all">
23326 <tgroup cols="4" colsep="0" rowsep="0">
23327 <colspec colwidth="8*" align="left"/>
23328 <colspec colwidth="5*" align="center"/>
23329 <colspec colwidth="5*" align="center"/>
23330 <colspec colwidth="6*" align="right"/>
23333 <entry><option>move_frozen_messages</option></entry>
23334 <entry>Use: <emphasis>main</emphasis></entry>
23335 <entry>Type: <emphasis>boolean</emphasis></entry>
23336 <entry>Default: <emphasis>false</emphasis></entry>
23342 <indexterm role="concept">
23343 <primary>frozen messages</primary>
23344 <secondary>moving</secondary>
23346 This option, which is available only if Exim has been built with the setting
23348 <literallayout class="monospaced">
23349 SUPPORT_MOVE_FROZEN_MESSAGES=yes
23352 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
23353 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
23354 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
23355 standard utilities for handling such moved messages, and they do not show up in
23356 lists generated by <option>-bp</option> or by the Exim monitor.
23359 <indexterm role="option">
23360 <primary>mua_wrapper</primary>
23363 <informaltable frame="all">
23364 <tgroup cols="4" colsep="0" rowsep="0">
23365 <colspec colwidth="8*" align="left"/>
23366 <colspec colwidth="5*" align="center"/>
23367 <colspec colwidth="5*" align="center"/>
23368 <colspec colwidth="6*" align="right"/>
23371 <entry><option>mua_wrapper</option></entry>
23372 <entry>Use: <emphasis>main</emphasis></entry>
23373 <entry>Type: <emphasis>boolean</emphasis></entry>
23374 <entry>Default: <emphasis>false</emphasis></entry>
23380 Setting this option true causes Exim to run in a very restrictive mode in which
23381 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
23382 contains a full description of this facility.
23385 <indexterm role="option">
23386 <primary>mysql_servers</primary>
23389 <informaltable frame="all">
23390 <tgroup cols="4" colsep="0" rowsep="0">
23391 <colspec colwidth="8*" align="left"/>
23392 <colspec colwidth="5*" align="center"/>
23393 <colspec colwidth="5*" align="center"/>
23394 <colspec colwidth="6*" align="right"/>
23397 <entry><option>mysql_servers</option></entry>
23398 <entry>Use: <emphasis>main</emphasis></entry>
23399 <entry>Type: <emphasis>string list</emphasis></entry>
23400 <entry>Default: <emphasis>unset</emphasis></entry>
23406 <indexterm role="concept">
23407 <primary>MySQL</primary>
23408 <secondary>server list</secondary>
23410 This option provides a list of MySQL servers and associated connection data, to
23411 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECTsql"/>). The
23412 option is available only if Exim has been built with MySQL support.
23415 <indexterm role="option">
23416 <primary>never_users</primary>
23419 <informaltable frame="all">
23420 <tgroup cols="4" colsep="0" rowsep="0">
23421 <colspec colwidth="8*" align="left"/>
23422 <colspec colwidth="5*" align="center"/>
23423 <colspec colwidth="5*" align="center"/>
23424 <colspec colwidth="6*" align="right"/>
23427 <entry><option>never_users</option></entry>
23428 <entry>Use: <emphasis>main</emphasis></entry>
23429 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
23430 <entry>Default: <emphasis>unset</emphasis></entry>
23436 This option is expanded just once, at the start of Exim’s processing. Local
23437 message deliveries are normally run in processes that are setuid to the
23438 recipient, and remote deliveries are normally run under Exim’s own uid and gid.
23439 It is usually desirable to prevent any deliveries from running as root, as a
23443 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
23444 list of users that must not be used for local deliveries. This list is fixed in
23445 the binary and cannot be overridden by the configuration file. By default, it
23446 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
23447 can be used to add more users to the fixed list.
23450 If a message is to be delivered as one of the users on the fixed list or the
23451 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
23454 <literallayout class="monospaced">
23455 never_users = root:daemon:bin
23458 Including root is redundant if it is also on the fixed list, but it does no
23459 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
23463 <indexterm role="option">
23464 <primary>oracle_servers</primary>
23467 <informaltable frame="all">
23468 <tgroup cols="4" colsep="0" rowsep="0">
23469 <colspec colwidth="8*" align="left"/>
23470 <colspec colwidth="5*" align="center"/>
23471 <colspec colwidth="5*" align="center"/>
23472 <colspec colwidth="6*" align="right"/>
23475 <entry><option>oracle_servers</option></entry>
23476 <entry>Use: <emphasis>main</emphasis></entry>
23477 <entry>Type: <emphasis>string list</emphasis></entry>
23478 <entry>Default: <emphasis>unset</emphasis></entry>
23484 <indexterm role="concept">
23485 <primary>Oracle</primary>
23486 <secondary>server list</secondary>
23488 This option provides a list of Oracle servers and associated connection data,
23489 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECTsql"/>).
23490 The option is available only if Exim has been built with Oracle support.
23493 <indexterm role="option">
23494 <primary>percent_hack_domains</primary>
23497 <informaltable frame="all">
23498 <tgroup cols="4" colsep="0" rowsep="0">
23499 <colspec colwidth="8*" align="left"/>
23500 <colspec colwidth="5*" align="center"/>
23501 <colspec colwidth="5*" align="center"/>
23502 <colspec colwidth="6*" align="right"/>
23505 <entry><option>percent_hack_domains</option></entry>
23506 <entry>Use: <emphasis>main</emphasis></entry>
23507 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
23508 <entry>Default: <emphasis>unset</emphasis></entry>
23514 <indexterm role="concept">
23515 <primary><quote>percent hack</quote></primary>
23517 <indexterm role="concept">
23518 <primary>source routing</primary>
23519 <secondary>in email address</secondary>
23521 <indexterm role="concept">
23522 <primary>address</primary>
23523 <secondary>source-routed</secondary>
23525 The <quote>percent hack</quote> is the convention whereby a local part containing a
23526 percent sign is re-interpreted as a new email address, with the percent
23527 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
23528 also applied to RFC 2822 addresses that begin with an @ character. If this
23529 option is set, Exim implements the percent facility for those domains listed,
23530 but no others. This happens before an incoming SMTP address is tested against
23534 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
23535 trying to get round relaying restrictions. For this reason, it is best avoided
23536 if at all possible. Unfortunately, a number of less security-conscious MTAs
23537 implement it unconditionally. If you are running Exim on a gateway host, and
23538 routing mail through to internal MTAs without processing the local parts, it is
23539 a good idea to reject recipient addresses with percent characters in their
23540 local parts. Exim’s default configuration does this.
23543 <indexterm role="option">
23544 <primary>perl_at_start</primary>
23547 <informaltable frame="all">
23548 <tgroup cols="4" colsep="0" rowsep="0">
23549 <colspec colwidth="8*" align="left"/>
23550 <colspec colwidth="5*" align="center"/>
23551 <colspec colwidth="5*" align="center"/>
23552 <colspec colwidth="6*" align="right"/>
23555 <entry><option>perl_at_start</option></entry>
23556 <entry>Use: <emphasis>main</emphasis></entry>
23557 <entry>Type: <emphasis>boolean</emphasis></entry>
23558 <entry>Default: <emphasis>false</emphasis></entry>
23564 This option is available only when Exim is built with an embedded Perl
23565 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
23568 <indexterm role="option">
23569 <primary>perl_startup</primary>
23572 <informaltable frame="all">
23573 <tgroup cols="4" colsep="0" rowsep="0">
23574 <colspec colwidth="8*" align="left"/>
23575 <colspec colwidth="5*" align="center"/>
23576 <colspec colwidth="5*" align="center"/>
23577 <colspec colwidth="6*" align="right"/>
23580 <entry><option>perl_startup</option></entry>
23581 <entry>Use: <emphasis>main</emphasis></entry>
23582 <entry>Type: <emphasis>string</emphasis></entry>
23583 <entry>Default: <emphasis>unset</emphasis></entry>
23589 This option is available only when Exim is built with an embedded Perl
23590 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
23593 <indexterm role="option">
23594 <primary>pgsql_servers</primary>
23597 <informaltable frame="all">
23598 <tgroup cols="4" colsep="0" rowsep="0">
23599 <colspec colwidth="8*" align="left"/>
23600 <colspec colwidth="5*" align="center"/>
23601 <colspec colwidth="5*" align="center"/>
23602 <colspec colwidth="6*" align="right"/>
23605 <entry><option>pgsql_servers</option></entry>
23606 <entry>Use: <emphasis>main</emphasis></entry>
23607 <entry>Type: <emphasis>string list</emphasis></entry>
23608 <entry>Default: <emphasis>unset</emphasis></entry>
23614 <indexterm role="concept">
23615 <primary>PostgreSQL lookup type</primary>
23616 <secondary>server list</secondary>
23618 This option provides a list of PostgreSQL servers and associated connection
23619 data, to be used in conjunction with <command>pgsql</command> lookups (see section
23620 <xref linkend="SECTsql"/>). The option is available only if Exim has been built with
23621 PostgreSQL support.
23624 <indexterm role="option">
23625 <primary>pid_file_path</primary>
23628 <informaltable frame="all">
23629 <tgroup cols="4" colsep="0" rowsep="0">
23630 <colspec colwidth="8*" align="left"/>
23631 <colspec colwidth="5*" align="center"/>
23632 <colspec colwidth="5*" align="center"/>
23633 <colspec colwidth="6*" align="right"/>
23636 <entry><option>pid_file_path</option></entry>
23637 <entry>Use: <emphasis>main</emphasis></entry>
23638 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
23639 <entry>Default: <emphasis>set at compile time</emphasis></entry>
23645 <indexterm role="concept">
23646 <primary>daemon</primary>
23647 <secondary>pid file path</secondary>
23649 <indexterm role="concept">
23650 <primary>pid file</primary>
23651 <secondary>path for</secondary>
23653 This option sets the name of the file to which the Exim daemon writes its
23654 process id. The string is expanded, so it can contain, for example, references
23657 <literallayout class="monospaced">
23658 pid_file_path = /var/log/$primary_hostname/exim.pid
23661 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim’s
23663 The value set by the option can be overridden by the <option>-oP</option> command line
23664 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
23665 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
23668 <indexterm role="option">
23669 <primary>pipelining_advertise_hosts</primary>
23672 <informaltable frame="all">
23673 <tgroup cols="4" colsep="0" rowsep="0">
23674 <colspec colwidth="8*" align="left"/>
23675 <colspec colwidth="5*" align="center"/>
23676 <colspec colwidth="5*" align="center"/>
23677 <colspec colwidth="6*" align="right"/>
23680 <entry><option>pipelining_advertise_hosts</option></entry>
23681 <entry>Use: <emphasis>main</emphasis></entry>
23682 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
23683 <entry>Default: <emphasis>*</emphasis></entry>
23689 <indexterm role="concept">
23690 <primary>PIPELINING advertising</primary>
23691 <secondary>suppressing</secondary>
23693 This option can be used to suppress the advertisement of the SMTP
23694 PIPELINING extension to specific hosts. When PIPELINING is not
23695 advertised and <option>smtp_enforce_sync</option> is true, an Exim server enforces strict
23696 synchronization for each SMTP command and response.
23697 When PIPELINING is advertised, Exim assumes that clients will use it; <quote>out
23698 of order</quote> commands that are <quote>expected</quote> do not count as protocol errors (see
23699 <option>smtp_max_synprot_errors</option>).
23702 <indexterm role="option">
23703 <primary>preserve_message_logs</primary>
23706 <informaltable frame="all">
23707 <tgroup cols="4" colsep="0" rowsep="0">
23708 <colspec colwidth="8*" align="left"/>
23709 <colspec colwidth="5*" align="center"/>
23710 <colspec colwidth="5*" align="center"/>
23711 <colspec colwidth="6*" align="right"/>
23714 <entry><option>preserve_message_logs</option></entry>
23715 <entry>Use: <emphasis>main</emphasis></entry>
23716 <entry>Type: <emphasis>boolean</emphasis></entry>
23717 <entry>Default: <emphasis>false</emphasis></entry>
23723 <indexterm role="concept">
23724 <primary>message logs</primary>
23725 <secondary>preserving</secondary>
23727 If this option is set, message log files are not deleted when messages are
23728 completed. Instead, they are moved to a sub-directory of the spool directory
23729 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
23730 purposes. This is a dangerous option to set on systems with any appreciable
23731 volume of mail. Use with care!
23734 <indexterm role="option">
23735 <primary>primary_hostname</primary>
23738 <informaltable frame="all">
23739 <tgroup cols="4" colsep="0" rowsep="0">
23740 <colspec colwidth="8*" align="left"/>
23741 <colspec colwidth="5*" align="center"/>
23742 <colspec colwidth="5*" align="center"/>
23743 <colspec colwidth="6*" align="right"/>
23746 <entry><option>primary_hostname</option></entry>
23747 <entry>Use: <emphasis>main</emphasis></entry>
23748 <entry>Type: <emphasis>string</emphasis></entry>
23749 <entry>Default: <emphasis>see below</emphasis></entry>
23755 <indexterm role="concept">
23756 <primary>name</primary>
23757 <secondary>of local host</secondary>
23759 <indexterm role="concept">
23760 <primary>host</primary>
23761 <secondary>name of local</secondary>
23763 <indexterm role="concept">
23764 <primary>local host</primary>
23765 <secondary>name of</secondary>
23767 <indexterm role="concept">
23768 <primary><varname>$primary_hostname</varname></primary>
23770 This specifies the name of the current host. It is used in the default EHLO or
23771 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
23772 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
23773 The value is also used by default in some SMTP response messages from an Exim
23774 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
23777 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
23778 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
23779 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
23780 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
23781 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
23782 explicitly by this option, or defaulted.
23785 <indexterm role="option">
23786 <primary>print_topbitchars</primary>
23789 <informaltable frame="all">
23790 <tgroup cols="4" colsep="0" rowsep="0">
23791 <colspec colwidth="8*" align="left"/>
23792 <colspec colwidth="5*" align="center"/>
23793 <colspec colwidth="5*" align="center"/>
23794 <colspec colwidth="6*" align="right"/>
23797 <entry><option>print_topbitchars</option></entry>
23798 <entry>Use: <emphasis>main</emphasis></entry>
23799 <entry>Type: <emphasis>boolean</emphasis></entry>
23800 <entry>Default: <emphasis>false</emphasis></entry>
23806 <indexterm role="concept">
23807 <primary>printing characters</primary>
23809 <indexterm role="concept">
23810 <primary>8-bit characters</primary>
23812 By default, Exim considers only those characters whose codes lie in the range
23813 32–126 to be printing characters. In a number of circumstances (for example,
23814 when writing log entries) non-printing characters are converted into escape
23815 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
23816 is set, code values of 128 and above are also considered to be printing
23820 This option also affects the header syntax checks performed by the
23821 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
23822 the user’s full name when constructing From: and Sender: addresses (as
23823 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
23824 Exim to generate eight bit message headers that do not conform to the
23828 <indexterm role="option">
23829 <primary>process_log_path</primary>
23832 <informaltable frame="all">
23833 <tgroup cols="4" colsep="0" rowsep="0">
23834 <colspec colwidth="8*" align="left"/>
23835 <colspec colwidth="5*" align="center"/>
23836 <colspec colwidth="5*" align="center"/>
23837 <colspec colwidth="6*" align="right"/>
23840 <entry><option>process_log_path</option></entry>
23841 <entry>Use: <emphasis>main</emphasis></entry>
23842 <entry>Type: <emphasis>string</emphasis></entry>
23843 <entry>Default: <emphasis>unset</emphasis></entry>
23849 <indexterm role="concept">
23850 <primary>process log path</primary>
23852 <indexterm role="concept">
23853 <primary>log</primary>
23854 <secondary>process log</secondary>
23856 <indexterm role="concept">
23857 <primary><emphasis>exiwhat</emphasis></primary>
23859 This option sets the name of the file to which an Exim process writes its
23860 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
23861 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
23862 in Exim’s spool directory is used. The ability to specify the name explicitly
23863 can be useful in environments where two different Exims are running, using
23864 different spool directories.
23867 <indexterm role="option">
23868 <primary>prod_requires_admin</primary>
23871 <informaltable frame="all">
23872 <tgroup cols="4" colsep="0" rowsep="0">
23873 <colspec colwidth="8*" align="left"/>
23874 <colspec colwidth="5*" align="center"/>
23875 <colspec colwidth="5*" align="center"/>
23876 <colspec colwidth="6*" align="right"/>
23879 <entry><option>prod_requires_admin</option></entry>
23880 <entry>Use: <emphasis>main</emphasis></entry>
23881 <entry>Type: <emphasis>boolean</emphasis></entry>
23882 <entry>Default: <emphasis>true</emphasis></entry>
23888 <indexterm role="concept">
23889 <primary><option>-M</option> option</primary>
23891 <indexterm role="concept">
23892 <primary><option>-R</option> option</primary>
23894 <indexterm role="concept">
23895 <primary><option>-q</option> option</primary>
23897 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
23898 admin user unless <option>prod_requires_admin</option> is set false. See also
23899 <option>queue_list_requires_admin</option>.
23902 <indexterm role="option">
23903 <primary>qualify_domain</primary>
23906 <informaltable frame="all">
23907 <tgroup cols="4" colsep="0" rowsep="0">
23908 <colspec colwidth="8*" align="left"/>
23909 <colspec colwidth="5*" align="center"/>
23910 <colspec colwidth="5*" align="center"/>
23911 <colspec colwidth="6*" align="right"/>
23914 <entry><option>qualify_domain</option></entry>
23915 <entry>Use: <emphasis>main</emphasis></entry>
23916 <entry>Type: <emphasis>string</emphasis></entry>
23917 <entry>Default: <emphasis>see below</emphasis></entry>
23923 <indexterm role="concept">
23924 <primary>domain</primary>
23925 <secondary>for qualifying addresses</secondary>
23927 <indexterm role="concept">
23928 <primary>address</primary>
23929 <secondary>qualification</secondary>
23931 This option specifies the domain name that is added to any envelope sender
23932 addresses that do not have a domain qualification. It also applies to
23933 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
23934 are accepted by default only for locally-generated messages. Qualification is
23935 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
23936 locally-generated messages, unless the <option>-bnq</option> command line option is used.
23939 Messages from external sources must always contain fully qualified addresses,
23940 unless the sending host matches <option>sender_unqualified_hosts</option> or
23941 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
23942 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
23943 necessary. Internally, Exim always works with fully qualified envelope
23944 addresses. If <option>qualify_domain</option> is not set, it defaults to the
23945 <option>primary_hostname</option> value.
23948 <indexterm role="option">
23949 <primary>qualify_recipient</primary>
23952 <informaltable frame="all">
23953 <tgroup cols="4" colsep="0" rowsep="0">
23954 <colspec colwidth="8*" align="left"/>
23955 <colspec colwidth="5*" align="center"/>
23956 <colspec colwidth="5*" align="center"/>
23957 <colspec colwidth="6*" align="right"/>
23960 <entry><option>qualify_recipient</option></entry>
23961 <entry>Use: <emphasis>main</emphasis></entry>
23962 <entry>Type: <emphasis>string</emphasis></entry>
23963 <entry>Default: <emphasis>see below</emphasis></entry>
23969 This option allows you to specify a different domain for qualifying recipient
23970 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
23973 <indexterm role="option">
23974 <primary>queue_domains</primary>
23977 <informaltable frame="all">
23978 <tgroup cols="4" colsep="0" rowsep="0">
23979 <colspec colwidth="8*" align="left"/>
23980 <colspec colwidth="5*" align="center"/>
23981 <colspec colwidth="5*" align="center"/>
23982 <colspec colwidth="6*" align="right"/>
23985 <entry><option>queue_domains</option></entry>
23986 <entry>Use: <emphasis>main</emphasis></entry>
23987 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
23988 <entry>Default: <emphasis>unset</emphasis></entry>
23994 <indexterm role="concept">
23995 <primary>domain</primary>
23996 <secondary>specifying non-immediate delivery</secondary>
23998 <indexterm role="concept">
23999 <primary>queueing incoming messages</primary>
24001 <indexterm role="concept">
24002 <primary>message</primary>
24003 <secondary>queueing certain domains</secondary>
24005 This option lists domains for which immediate delivery is not required.
24006 A delivery process is started whenever a message is received, but only those
24007 domains that do not match are processed. All other deliveries wait until the
24008 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
24011 <indexterm role="option">
24012 <primary>queue_list_requires_admin</primary>
24015 <informaltable frame="all">
24016 <tgroup cols="4" colsep="0" rowsep="0">
24017 <colspec colwidth="8*" align="left"/>
24018 <colspec colwidth="5*" align="center"/>
24019 <colspec colwidth="5*" align="center"/>
24020 <colspec colwidth="6*" align="right"/>
24023 <entry><option>queue_list_requires_admin</option></entry>
24024 <entry>Use: <emphasis>main</emphasis></entry>
24025 <entry>Type: <emphasis>boolean</emphasis></entry>
24026 <entry>Default: <emphasis>true</emphasis></entry>
24032 <indexterm role="concept">
24033 <primary><option>-bp</option> option</primary>
24035 The <option>-bp</option> command-line option, which lists the messages that are on the
24036 queue, requires the caller to be an admin user unless
24037 <option>queue_list_requires_admin</option> is set false. See also <option>prod_requires_admin</option>.
24040 <indexterm role="option">
24041 <primary>queue_only</primary>
24044 <informaltable frame="all">
24045 <tgroup cols="4" colsep="0" rowsep="0">
24046 <colspec colwidth="8*" align="left"/>
24047 <colspec colwidth="5*" align="center"/>
24048 <colspec colwidth="5*" align="center"/>
24049 <colspec colwidth="6*" align="right"/>
24052 <entry><option>queue_only</option></entry>
24053 <entry>Use: <emphasis>main</emphasis></entry>
24054 <entry>Type: <emphasis>boolean</emphasis></entry>
24055 <entry>Default: <emphasis>false</emphasis></entry>
24061 <indexterm role="concept">
24062 <primary>queueing incoming messages</primary>
24064 <indexterm role="concept">
24065 <primary>message</primary>
24066 <secondary>queueing unconditionally</secondary>
24068 If <option>queue_only</option> is set, a delivery process is not automatically started
24069 whenever a message is received. Instead, the message waits on the queue for the
24070 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
24071 delivered immediately when certain conditions (such as heavy load) occur.
24074 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
24075 and <option>-odi</option> command line options override <option>queue_only</option> unless
24076 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
24077 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
24080 <indexterm role="option">
24081 <primary>queue_only_file</primary>
24084 <informaltable frame="all">
24085 <tgroup cols="4" colsep="0" rowsep="0">
24086 <colspec colwidth="8*" align="left"/>
24087 <colspec colwidth="5*" align="center"/>
24088 <colspec colwidth="5*" align="center"/>
24089 <colspec colwidth="6*" align="right"/>
24092 <entry><option>queue_only_file</option></entry>
24093 <entry>Use: <emphasis>main</emphasis></entry>
24094 <entry>Type: <emphasis>string</emphasis></entry>
24095 <entry>Default: <emphasis>unset</emphasis></entry>
24101 <indexterm role="concept">
24102 <primary>queueing incoming messages</primary>
24104 <indexterm role="concept">
24105 <primary>message</primary>
24106 <secondary>queueing by file existence</secondary>
24108 This option can be set to a colon-separated list of absolute path names, each
24109 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
24110 it tests for the existence of each listed path using a call to <function>stat()</function>. For
24111 each path that exists, the corresponding queuing option is set.
24112 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
24113 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
24115 <literallayout class="monospaced">
24116 queue_only_file = smtp/some/file
24119 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
24120 <filename>/some/file</filename> exists.
24123 <indexterm role="option">
24124 <primary>queue_only_load</primary>
24127 <informaltable frame="all">
24128 <tgroup cols="4" colsep="0" rowsep="0">
24129 <colspec colwidth="8*" align="left"/>
24130 <colspec colwidth="5*" align="center"/>
24131 <colspec colwidth="5*" align="center"/>
24132 <colspec colwidth="6*" align="right"/>
24135 <entry><option>queue_only_load</option></entry>
24136 <entry>Use: <emphasis>main</emphasis></entry>
24137 <entry>Type: <emphasis>fixed-point</emphasis></entry>
24138 <entry>Default: <emphasis>unset</emphasis></entry>
24144 <indexterm role="concept">
24145 <primary>load average</primary>
24147 <indexterm role="concept">
24148 <primary>queueing incoming messages</primary>
24150 <indexterm role="concept">
24151 <primary>message</primary>
24152 <secondary>queueing by load</secondary>
24154 If the system load average is higher than this value, incoming messages from
24155 all sources are queued, and no automatic deliveries are started. If this
24156 happens during local or remote SMTP input, all subsequent messages on the same
24157 connection are queued. Deliveries will subsequently be performed by queue
24158 runner processes. This option has no effect on ancient operating systems on
24159 which Exim cannot determine the load average. See also
24160 <option>deliver_queue_load_max</option> and <option>smtp_load_reserve</option>.
24163 <indexterm role="option">
24164 <primary>queue_only_override</primary>
24167 <informaltable frame="all">
24168 <tgroup cols="4" colsep="0" rowsep="0">
24169 <colspec colwidth="8*" align="left"/>
24170 <colspec colwidth="5*" align="center"/>
24171 <colspec colwidth="5*" align="center"/>
24172 <colspec colwidth="6*" align="right"/>
24175 <entry><option>queue_only_override</option></entry>
24176 <entry>Use: <emphasis>main</emphasis></entry>
24177 <entry>Type: <emphasis>boolean</emphasis></entry>
24178 <entry>Default: <emphasis>true</emphasis></entry>
24184 <indexterm role="concept">
24185 <primary>queueing incoming messages</primary>
24187 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
24188 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
24189 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
24190 to override; they are accepted, but ignored.
24193 <indexterm role="option">
24194 <primary>queue_run_in_order</primary>
24197 <informaltable frame="all">
24198 <tgroup cols="4" colsep="0" rowsep="0">
24199 <colspec colwidth="8*" align="left"/>
24200 <colspec colwidth="5*" align="center"/>
24201 <colspec colwidth="5*" align="center"/>
24202 <colspec colwidth="6*" align="right"/>
24205 <entry><option>queue_run_in_order</option></entry>
24206 <entry>Use: <emphasis>main</emphasis></entry>
24207 <entry>Type: <emphasis>boolean</emphasis></entry>
24208 <entry>Default: <emphasis>false</emphasis></entry>
24214 <indexterm role="concept">
24215 <primary>queue runner</primary>
24216 <secondary>processing messages in order</secondary>
24218 If this option is set, queue runs happen in order of message arrival instead of
24219 in an arbitrary order. For this to happen, a complete list of the entire queue
24220 must be set up before the deliveries start. When the queue is all held in a
24221 single directory (the default), a single list is created for both the ordered
24222 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
24223 single list is not created when <option>queue_run_in_order</option> is false. In this case,
24224 the sub-directories are processed one at a time (in a random order), and this
24225 avoids setting up one huge list for the whole queue. Thus, setting
24226 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
24227 when the queue is large, because of the extra work in setting up the single,
24228 large list. In most situations, <option>queue_run_in_order</option> should not be set.
24231 <indexterm role="option">
24232 <primary>queue_run_max</primary>
24235 <informaltable frame="all">
24236 <tgroup cols="4" colsep="0" rowsep="0">
24237 <colspec colwidth="8*" align="left"/>
24238 <colspec colwidth="5*" align="center"/>
24239 <colspec colwidth="5*" align="center"/>
24240 <colspec colwidth="6*" align="right"/>
24243 <entry><option>queue_run_max</option></entry>
24244 <entry>Use: <emphasis>main</emphasis></entry>
24245 <entry>Type: <emphasis>integer</emphasis></entry>
24246 <entry>Default: <emphasis>5</emphasis></entry>
24252 <indexterm role="concept">
24253 <primary>queue runner</primary>
24254 <secondary>maximum number of</secondary>
24256 This controls the maximum number of queue runner processes that an Exim daemon
24257 can run simultaneously. This does not mean that it starts them all at once,
24258 but rather that if the maximum number are still running when the time comes to
24259 start another one, it refrains from starting another one. This can happen with
24260 very large queues and/or very sluggish deliveries. This option does not,
24261 however, interlock with other processes, so additional queue runners can be
24262 started by other means, or by killing and restarting the daemon.
24265 Setting this option to zero does not suppress queue runs; rather, it disables
24266 the limit, allowing any number of simultaneous queue runner processes to be
24267 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
24268 the daemon’s command line.
24271 <indexterm role="option">
24272 <primary>queue_smtp_domains</primary>
24275 <informaltable frame="all">
24276 <tgroup cols="4" colsep="0" rowsep="0">
24277 <colspec colwidth="8*" align="left"/>
24278 <colspec colwidth="5*" align="center"/>
24279 <colspec colwidth="5*" align="center"/>
24280 <colspec colwidth="6*" align="right"/>
24283 <entry><option>queue_smtp_domains</option></entry>
24284 <entry>Use: <emphasis>main</emphasis></entry>
24285 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
24286 <entry>Default: <emphasis>unset</emphasis></entry>
24292 <indexterm role="concept">
24293 <primary>queueing incoming messages</primary>
24295 <indexterm role="concept">
24296 <primary>message</primary>
24297 <secondary>queueing remote deliveries</secondary>
24299 When this option is set, a delivery process is started whenever a message is
24300 received, routing is performed, and local deliveries take place.
24301 However, if any SMTP deliveries are required for domains that match
24302 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
24303 message waits on the queue for the next queue run. Since routing of the message
24304 has taken place, Exim knows to which remote hosts it must be delivered, and so
24305 when the queue run happens, multiple messages for the same host are delivered
24306 over a single SMTP connection. The <option>-odqs</option> command line option causes all
24307 SMTP deliveries to be queued in this way, and is equivalent to setting
24308 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
24309 <option>queue_domains</option>.
24312 <indexterm role="option">
24313 <primary>receive_timeout</primary>
24316 <informaltable frame="all">
24317 <tgroup cols="4" colsep="0" rowsep="0">
24318 <colspec colwidth="8*" align="left"/>
24319 <colspec colwidth="5*" align="center"/>
24320 <colspec colwidth="5*" align="center"/>
24321 <colspec colwidth="6*" align="right"/>
24324 <entry><option>receive_timeout</option></entry>
24325 <entry>Use: <emphasis>main</emphasis></entry>
24326 <entry>Type: <emphasis>time</emphasis></entry>
24327 <entry>Default: <emphasis>0s</emphasis></entry>
24333 <indexterm role="concept">
24334 <primary>timeout</primary>
24335 <secondary>for non-SMTP input</secondary>
24337 This option sets the timeout for accepting a non-SMTP message, that is, the
24338 maximum time that Exim waits when reading a message on the standard input. If
24339 the value is zero, it will wait for ever. This setting is overridden by the
24340 <option>-or</option> command line option. The timeout for incoming SMTP messages is
24341 controlled by <option>smtp_receive_timeout</option>.
24344 <indexterm role="option">
24345 <primary>received_header_text</primary>
24348 <informaltable frame="all">
24349 <tgroup cols="4" colsep="0" rowsep="0">
24350 <colspec colwidth="8*" align="left"/>
24351 <colspec colwidth="5*" align="center"/>
24352 <colspec colwidth="5*" align="center"/>
24353 <colspec colwidth="6*" align="right"/>
24356 <entry><option>received_header_text</option></entry>
24357 <entry>Use: <emphasis>main</emphasis></entry>
24358 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
24359 <entry>Default: <emphasis>see below</emphasis></entry>
24365 <indexterm role="concept">
24366 <primary>customizing</primary>
24367 <secondary><emphasis>Received:</emphasis> header</secondary>
24369 <indexterm role="concept">
24370 <primary><emphasis>Received:</emphasis> header line</primary>
24371 <secondary>customizing</secondary>
24373 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
24374 added to each message, except for the timestamp, which is automatically added
24375 on at the end (preceded by a semicolon). The string is expanded each time it is
24376 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
24377 added to the message. Otherwise, the string should start with the text
24378 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
24379 header lines. The default setting is:
24381 <literallayout class="monospaced">
24382 received_header_text = Received: \
24383 ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
24384 {${if def:sender_ident \
24385 {from ${quote_local_part:$sender_ident} }}\
24386 ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
24387 by $primary_hostname \
24388 ${if def:received_protocol {with $received_protocol}} \
24389 ${if def:tls_cipher {($tls_cipher)\n\t}}\
24390 (Exim $version_number)\n\t\
24391 ${if def:sender_address \
24392 {(envelope-from <$sender_address>)\n\t}}\
24393 id $message_exim_id\
24394 ${if def:received_for {\n\tfor $received_for}}
24397 The reference to the TLS cipher is omitted when Exim is built without TLS
24398 support. The use of conditional expansions ensures that this works for both
24399 locally generated messages and messages received from remote hosts, giving
24400 header lines such as the following:
24402 <literallayout class="monospaced">
24403 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
24404 by marley.carol.example with esmtp (Exim 4.00)
24405 (envelope-from <bob@carol.example>)
24406 id 16IOWa-00019l-00
24407 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
24408 Received: by scrooge.carol.example with local (Exim 4.00)
24409 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
24412 Until the body of the message has been received, the timestamp is the time when
24413 the message started to be received. Once the body has arrived, and all policy
24414 checks have taken place, the timestamp is updated to the time at which the
24415 message was accepted.
24418 <indexterm role="option">
24419 <primary>received_headers_max</primary>
24422 <informaltable frame="all">
24423 <tgroup cols="4" colsep="0" rowsep="0">
24424 <colspec colwidth="8*" align="left"/>
24425 <colspec colwidth="5*" align="center"/>
24426 <colspec colwidth="5*" align="center"/>
24427 <colspec colwidth="6*" align="right"/>
24430 <entry><option>received_headers_max</option></entry>
24431 <entry>Use: <emphasis>main</emphasis></entry>
24432 <entry>Type: <emphasis>integer</emphasis></entry>
24433 <entry>Default: <emphasis>30</emphasis></entry>
24439 <indexterm role="concept">
24440 <primary>loop</primary>
24441 <secondary>prevention</secondary>
24443 <indexterm role="concept">
24444 <primary>mail loop prevention</primary>
24446 <indexterm role="concept">
24447 <primary><emphasis>Received:</emphasis> header line</primary>
24448 <secondary>counting</secondary>
24450 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
24451 counted, and if it is greater than this parameter, a mail loop is assumed to
24452 have occurred, the delivery is abandoned, and an error message is generated.
24453 This applies to both local and remote deliveries.
24456 <indexterm role="option">
24457 <primary>recipient_unqualified_hosts</primary>
24460 <informaltable frame="all">
24461 <tgroup cols="4" colsep="0" rowsep="0">
24462 <colspec colwidth="8*" align="left"/>
24463 <colspec colwidth="5*" align="center"/>
24464 <colspec colwidth="5*" align="center"/>
24465 <colspec colwidth="6*" align="right"/>
24468 <entry><option>recipient_unqualified_hosts</option></entry>
24469 <entry>Use: <emphasis>main</emphasis></entry>
24470 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
24471 <entry>Default: <emphasis>unset</emphasis></entry>
24477 <indexterm role="concept">
24478 <primary>unqualified addresses</primary>
24480 <indexterm role="concept">
24481 <primary>host</primary>
24482 <secondary>unqualified addresses from</secondary>
24484 This option lists those hosts from which Exim is prepared to accept unqualified
24485 recipient addresses in message envelopes. The addresses are made fully
24486 qualified by the addition of the <option>qualify_recipient</option> value. This option also
24487 affects message header lines. Exim does not reject unqualified recipient
24488 addresses in headers, but it qualifies them only if the message came from a
24489 host that matches <option>recipient_unqualified_hosts</option>,
24490 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
24491 option was not set.
24494 <indexterm role="option">
24495 <primary>recipients_max</primary>
24498 <informaltable frame="all">
24499 <tgroup cols="4" colsep="0" rowsep="0">
24500 <colspec colwidth="8*" align="left"/>
24501 <colspec colwidth="5*" align="center"/>
24502 <colspec colwidth="5*" align="center"/>
24503 <colspec colwidth="6*" align="right"/>
24506 <entry><option>recipients_max</option></entry>
24507 <entry>Use: <emphasis>main</emphasis></entry>
24508 <entry>Type: <emphasis>integer</emphasis></entry>
24509 <entry>Default: <emphasis>0</emphasis></entry>
24515 <indexterm role="concept">
24516 <primary>limit</primary>
24517 <secondary>number of recipients</secondary>
24519 <indexterm role="concept">
24520 <primary>recipient</primary>
24521 <secondary>maximum number</secondary>
24523 If this option is set greater than zero, it specifies the maximum number of
24524 original recipients for any message. Additional recipients that are generated
24525 by aliasing or forwarding do not count. SMTP messages get a 452 response for
24526 all recipients over the limit; earlier recipients are delivered as normal.
24527 Non-SMTP messages with too many recipients are failed, and no deliveries are
24531 <indexterm role="concept">
24532 <primary>RCPT</primary>
24533 <secondary>maximum number of incoming</secondary>
24535 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
24536 RCPT commands in a single message.
24539 <indexterm role="option">
24540 <primary>recipients_max_reject</primary>
24543 <informaltable frame="all">
24544 <tgroup cols="4" colsep="0" rowsep="0">
24545 <colspec colwidth="8*" align="left"/>
24546 <colspec colwidth="5*" align="center"/>
24547 <colspec colwidth="5*" align="center"/>
24548 <colspec colwidth="6*" align="right"/>
24551 <entry><option>recipients_max_reject</option></entry>
24552 <entry>Use: <emphasis>main</emphasis></entry>
24553 <entry>Type: <emphasis>boolean</emphasis></entry>
24554 <entry>Default: <emphasis>false</emphasis></entry>
24560 If this option is set true, Exim rejects SMTP messages containing too many
24561 recipients by giving 552 errors to the surplus RCPT commands, and a 554
24562 error to the eventual DATA command. Otherwise (the default) it gives a 452
24563 error to the surplus RCPT commands and accepts the message on behalf of the
24564 initial set of recipients. The remote server should then re-send the message
24565 for the remaining recipients at a later time.
24568 <indexterm role="option">
24569 <primary>remote_max_parallel</primary>
24572 <informaltable frame="all">
24573 <tgroup cols="4" colsep="0" rowsep="0">
24574 <colspec colwidth="8*" align="left"/>
24575 <colspec colwidth="5*" align="center"/>
24576 <colspec colwidth="5*" align="center"/>
24577 <colspec colwidth="6*" align="right"/>
24580 <entry><option>remote_max_parallel</option></entry>
24581 <entry>Use: <emphasis>main</emphasis></entry>
24582 <entry>Type: <emphasis>integer</emphasis></entry>
24583 <entry>Default: <emphasis>2</emphasis></entry>
24589 <indexterm role="concept">
24590 <primary>delivery</primary>
24591 <secondary>parallelism for remote</secondary>
24593 This option controls parallel delivery of one message to a number of remote
24594 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
24595 does all the remote deliveries for a message one by one. Otherwise, if a single
24596 message has to be delivered to more than one remote host, or if several copies
24597 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
24598 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
24599 deliveries are required, the maximum number of processes are started, and as
24600 each one finishes, another is begun. The order of starting processes is the
24601 same as if sequential delivery were being done, and can be controlled by the
24602 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
24603 with debugging turned on, the debugging output from each delivery process is
24604 tagged with its process id.
24607 This option controls only the maximum number of parallel deliveries for one
24608 message in one Exim delivery process. Because Exim has no central queue
24609 manager, there is no way of controlling the total number of simultaneous
24610 deliveries if the configuration allows a delivery attempt as soon as a message
24614 <indexterm role="concept">
24615 <primary>number of deliveries</primary>
24617 <indexterm role="concept">
24618 <primary>delivery</primary>
24619 <secondary>maximum number of</secondary>
24621 If you want to control the total number of deliveries on the system, you
24622 need to set the <option>queue_only</option> option. This ensures that all incoming messages
24623 are added to the queue without starting a delivery process. Then set up an Exim
24624 daemon to start queue runner processes at appropriate intervals (probably
24625 fairly often, for example, every minute), and limit the total number of queue
24626 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
24627 delivers only one message at a time, the maximum number of deliveries that can
24628 then take place at once is <option>queue_run_max</option> multiplied by
24629 <option>remote_max_parallel</option>.
24632 If it is purely remote deliveries you want to control, use
24633 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
24634 doing the SMTP routing before queuing, so that several messages for the same
24635 host will eventually get delivered down the same connection.
24638 <indexterm role="option">
24639 <primary>remote_sort_domains</primary>
24642 <informaltable frame="all">
24643 <tgroup cols="4" colsep="0" rowsep="0">
24644 <colspec colwidth="8*" align="left"/>
24645 <colspec colwidth="5*" align="center"/>
24646 <colspec colwidth="5*" align="center"/>
24647 <colspec colwidth="6*" align="right"/>
24650 <entry><option>remote_sort_domains</option></entry>
24651 <entry>Use: <emphasis>main</emphasis></entry>
24652 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
24653 <entry>Default: <emphasis>unset</emphasis></entry>
24659 <indexterm role="concept">
24660 <primary>sorting remote deliveries</primary>
24662 <indexterm role="concept">
24663 <primary>delivery</primary>
24664 <secondary>sorting remote</secondary>
24666 When there are a number of remote deliveries for a message, they are sorted by
24667 domain into the order given by this list. For example,
24669 <literallayout class="monospaced">
24670 remote_sort_domains = *.cam.ac.uk:*.uk
24673 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
24674 then to those in the <option>uk</option> domain, then to any others.
24677 <indexterm role="option">
24678 <primary>retry_data_expire</primary>
24681 <informaltable frame="all">
24682 <tgroup cols="4" colsep="0" rowsep="0">
24683 <colspec colwidth="8*" align="left"/>
24684 <colspec colwidth="5*" align="center"/>
24685 <colspec colwidth="5*" align="center"/>
24686 <colspec colwidth="6*" align="right"/>
24689 <entry><option>retry_data_expire</option></entry>
24690 <entry>Use: <emphasis>main</emphasis></entry>
24691 <entry>Type: <emphasis>time</emphasis></entry>
24692 <entry>Default: <emphasis>7d</emphasis></entry>
24698 <indexterm role="concept">
24699 <primary>hints database</primary>
24700 <secondary>data expiry</secondary>
24702 This option sets a <quote>use before</quote> time on retry information in Exim’s hints
24703 database. Any older retry data is ignored. This means that, for example, once a
24704 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
24708 <indexterm role="option">
24709 <primary>retry_interval_max</primary>
24712 <informaltable frame="all">
24713 <tgroup cols="4" colsep="0" rowsep="0">
24714 <colspec colwidth="8*" align="left"/>
24715 <colspec colwidth="5*" align="center"/>
24716 <colspec colwidth="5*" align="center"/>
24717 <colspec colwidth="6*" align="right"/>
24720 <entry><option>retry_interval_max</option></entry>
24721 <entry>Use: <emphasis>main</emphasis></entry>
24722 <entry>Type: <emphasis>time</emphasis></entry>
24723 <entry>Default: <emphasis>24h</emphasis></entry>
24729 <indexterm role="concept">
24730 <primary>retry</primary>
24731 <secondary>limit on interval</secondary>
24733 <indexterm role="concept">
24734 <primary>limit</primary>
24735 <secondary>on retry interval</secondary>
24737 Chapter <xref linkend="CHAPretry"/> describes Exim’s mechanisms for controlling the
24738 intervals between delivery attempts for messages that cannot be delivered
24739 straight away. This option sets an overall limit to the length of time between
24740 retries. It cannot be set greater than 24 hours; any attempt to do so forces
24744 <indexterm role="option">
24745 <primary>return_path_remove</primary>
24748 <informaltable frame="all">
24749 <tgroup cols="4" colsep="0" rowsep="0">
24750 <colspec colwidth="8*" align="left"/>
24751 <colspec colwidth="5*" align="center"/>
24752 <colspec colwidth="5*" align="center"/>
24753 <colspec colwidth="6*" align="right"/>
24756 <entry><option>return_path_remove</option></entry>
24757 <entry>Use: <emphasis>main</emphasis></entry>
24758 <entry>Type: <emphasis>boolean</emphasis></entry>
24759 <entry>Default: <emphasis>true</emphasis></entry>
24765 <indexterm role="concept">
24766 <primary><emphasis>Return-path:</emphasis> header line</primary>
24767 <secondary>removing</secondary>
24769 RFC 2821, section 4.4, states that an SMTP server must insert a
24770 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
24771 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
24772 MAIL command. This description implies that this header should not be present
24773 in an incoming message. If <option>return_path_remove</option> is true, any existing
24774 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
24775 received. Exim’s transports have options for adding <emphasis>Return-path:</emphasis> headers at
24776 the time of delivery. They are normally used only for final local deliveries.
24779 <indexterm role="option">
24780 <primary>return_size_limit</primary>
24783 <informaltable frame="all">
24784 <tgroup cols="4" colsep="0" rowsep="0">
24785 <colspec colwidth="8*" align="left"/>
24786 <colspec colwidth="5*" align="center"/>
24787 <colspec colwidth="5*" align="center"/>
24788 <colspec colwidth="6*" align="right"/>
24791 <entry><option>return_size_limit</option></entry>
24792 <entry>Use: <emphasis>main</emphasis></entry>
24793 <entry>Type: <emphasis>integer</emphasis></entry>
24794 <entry>Default: <emphasis>100K</emphasis></entry>
24800 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
24803 <indexterm role="option">
24804 <primary>rfc1413_hosts</primary>
24807 <informaltable frame="all">
24808 <tgroup cols="4" colsep="0" rowsep="0">
24809 <colspec colwidth="8*" align="left"/>
24810 <colspec colwidth="5*" align="center"/>
24811 <colspec colwidth="5*" align="center"/>
24812 <colspec colwidth="6*" align="right"/>
24815 <entry><option>rfc1413_hosts</option></entry>
24816 <entry>Use: <emphasis>main</emphasis></entry>
24817 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
24818 <entry>Default: <emphasis>*</emphasis></entry>
24824 <indexterm role="concept">
24825 <primary>RFC 1413</primary>
24827 <indexterm role="concept">
24828 <primary>host</primary>
24829 <secondary>for RFC 1413 calls</secondary>
24831 RFC 1413 identification calls are made to any client host which matches an item
24835 <indexterm role="option">
24836 <primary>rfc1413_query_timeout</primary>
24839 <informaltable frame="all">
24840 <tgroup cols="4" colsep="0" rowsep="0">
24841 <colspec colwidth="8*" align="left"/>
24842 <colspec colwidth="5*" align="center"/>
24843 <colspec colwidth="5*" align="center"/>
24844 <colspec colwidth="6*" align="right"/>
24847 <entry><option>rfc1413_query_timeout</option></entry>
24848 <entry>Use: <emphasis>main</emphasis></entry>
24849 <entry>Type: <emphasis>time</emphasis></entry>
24850 <entry>Default: <emphasis>5s</emphasis></entry>
24856 <indexterm role="concept">
24857 <primary>RFC 1413</primary>
24858 <secondary>query timeout</secondary>
24860 <indexterm role="concept">
24861 <primary>timeout</primary>
24862 <secondary>for RFC 1413 call</secondary>
24864 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
24865 no RFC 1413 calls are ever made.
24868 <indexterm role="option">
24869 <primary>sender_unqualified_hosts</primary>
24872 <informaltable frame="all">
24873 <tgroup cols="4" colsep="0" rowsep="0">
24874 <colspec colwidth="8*" align="left"/>
24875 <colspec colwidth="5*" align="center"/>
24876 <colspec colwidth="5*" align="center"/>
24877 <colspec colwidth="6*" align="right"/>
24880 <entry><option>sender_unqualified_hosts</option></entry>
24881 <entry>Use: <emphasis>main</emphasis></entry>
24882 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
24883 <entry>Default: <emphasis>unset</emphasis></entry>
24889 <indexterm role="concept">
24890 <primary>unqualified addresses</primary>
24892 <indexterm role="concept">
24893 <primary>host</primary>
24894 <secondary>unqualified addresses from</secondary>
24896 This option lists those hosts from which Exim is prepared to accept unqualified
24897 sender addresses. The addresses are made fully qualified by the addition of
24898 <option>qualify_domain</option>. This option also affects message header lines. Exim does
24899 not reject unqualified addresses in headers that contain sender addresses, but
24900 it qualifies them only if the message came from a host that matches
24901 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
24902 using TCP/IP), and the <option>-bnq</option> option was not set.
24905 <indexterm role="option">
24906 <primary>smtp_accept_keepalive</primary>
24909 <informaltable frame="all">
24910 <tgroup cols="4" colsep="0" rowsep="0">
24911 <colspec colwidth="8*" align="left"/>
24912 <colspec colwidth="5*" align="center"/>
24913 <colspec colwidth="5*" align="center"/>
24914 <colspec colwidth="6*" align="right"/>
24917 <entry><option>smtp_accept_keepalive</option></entry>
24918 <entry>Use: <emphasis>main</emphasis></entry>
24919 <entry>Type: <emphasis>boolean</emphasis></entry>
24920 <entry>Default: <emphasis>true</emphasis></entry>
24926 <indexterm role="concept">
24927 <primary>keepalive</primary>
24928 <secondary>on incoming connection</secondary>
24930 This option controls the setting of the SO_KEEPALIVE option on incoming
24931 TCP/IP socket connections. When set, it causes the kernel to probe idle
24932 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
24933 other end of the connection should send an acknowledgement if the connection is
24934 still okay or a reset if the connection has been aborted. The reason for doing
24935 this is that it has the beneficial effect of freeing up certain types of
24936 connection that can get stuck when the remote host is disconnected without
24937 tidying up the TCP/IP call properly. The keepalive mechanism takes several
24938 hours to detect unreachable hosts.
24941 <indexterm role="option">
24942 <primary>smtp_accept_max</primary>
24945 <informaltable frame="all">
24946 <tgroup cols="4" colsep="0" rowsep="0">
24947 <colspec colwidth="8*" align="left"/>
24948 <colspec colwidth="5*" align="center"/>
24949 <colspec colwidth="5*" align="center"/>
24950 <colspec colwidth="6*" align="right"/>
24953 <entry><option>smtp_accept_max</option></entry>
24954 <entry>Use: <emphasis>main</emphasis></entry>
24955 <entry>Type: <emphasis>integer</emphasis></entry>
24956 <entry>Default: <emphasis>20</emphasis></entry>
24962 <indexterm role="concept">
24963 <primary>limit</primary>
24964 <secondary>incoming SMTP connections</secondary>
24966 <indexterm role="concept">
24967 <primary>SMTP</primary>
24968 <secondary>incoming connection count</secondary>
24970 <indexterm role="concept">
24971 <primary>inetd</primary>
24973 This option specifies the maximum number of simultaneous incoming SMTP calls
24974 that Exim will accept. It applies only to the listening daemon; there is no
24975 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
24976 value is set to zero, no limit is applied. However, it is required to be
24977 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
24978 set. See also <option>smtp_accept_reserve</option>.
24981 <indexterm role="option">
24982 <primary>smtp_accept_max_nonmail</primary>
24985 <informaltable frame="all">
24986 <tgroup cols="4" colsep="0" rowsep="0">
24987 <colspec colwidth="8*" align="left"/>
24988 <colspec colwidth="5*" align="center"/>
24989 <colspec colwidth="5*" align="center"/>
24990 <colspec colwidth="6*" align="right"/>
24993 <entry><option>smtp_accept_max_nonmail</option></entry>
24994 <entry>Use: <emphasis>main</emphasis></entry>
24995 <entry>Type: <emphasis>integer</emphasis></entry>
24996 <entry>Default: <emphasis>10</emphasis></entry>
25002 <indexterm role="concept">
25003 <primary>limit</primary>
25004 <secondary>non-mail SMTP commands</secondary>
25006 <indexterm role="concept">
25007 <primary>SMTP</primary>
25008 <secondary>limiting non-mail commands</secondary>
25010 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
25011 the connection if there are too many. This option defines <quote>too many</quote>. The
25012 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
25013 client looping sending EHLO, for example. The check is applied only if the
25014 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
25017 When a new message is expected, one occurrence of RSET is not counted. This
25018 allows a client to send one RSET between messages (this is not necessary,
25019 but some clients do it). Exim also allows one uncounted occurence of HELO
25020 or EHLO, and one occurrence of STARTTLS between messages. After
25021 starting up a TLS session, another EHLO is expected, and so it too is not
25022 counted. The first occurrence of AUTH in a connection, or immediately
25023 following STARTTLS is not counted. Otherwise, all commands other than
25024 MAIL, RCPT, DATA, and QUIT are counted.
25027 <indexterm role="option">
25028 <primary>smtp_accept_max_nonmail_hosts</primary>
25031 <informaltable frame="all">
25032 <tgroup cols="4" colsep="0" rowsep="0">
25033 <colspec colwidth="8*" align="left"/>
25034 <colspec colwidth="5*" align="center"/>
25035 <colspec colwidth="5*" align="center"/>
25036 <colspec colwidth="6*" align="right"/>
25039 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
25040 <entry>Use: <emphasis>main</emphasis></entry>
25041 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
25042 <entry>Default: <emphasis>*</emphasis></entry>
25048 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
25049 check by setting this option. The default value makes it apply to all hosts. By
25050 changing the value, you can exclude any badly-behaved hosts that you have to
25054 <indexterm role="option">
25055 <primary>smtp_accept_max_per_connection</primary>
25058 <informaltable frame="all">
25059 <tgroup cols="4" colsep="0" rowsep="0">
25060 <colspec colwidth="8*" align="left"/>
25061 <colspec colwidth="5*" align="center"/>
25062 <colspec colwidth="5*" align="center"/>
25063 <colspec colwidth="6*" align="right"/>
25066 <entry><option>smtp_accept_max_per_connection</option></entry>
25067 <entry>Use: <emphasis>main</emphasis></entry>
25068 <entry>Type: <emphasis>integer</emphasis></entry>
25069 <entry>Default: <emphasis>1000</emphasis></entry>
25075 <indexterm role="concept">
25076 <primary>SMTP incoming message count</primary>
25077 <secondary>limiting</secondary>
25079 <indexterm role="concept">
25080 <primary>limit</primary>
25081 <secondary>messages per SMTP connection</secondary>
25083 The value of this option limits the number of MAIL commands that Exim is
25084 prepared to accept over a single SMTP connection, whether or not each command
25085 results in the transfer of a message. After the limit is reached, a 421
25086 response is given to subsequent MAIL commands. This limit is a safety
25087 precaution against a client that goes mad (incidents of this type have been
25091 <indexterm role="option">
25092 <primary>smtp_accept_max_per_host</primary>
25095 <informaltable frame="all">
25096 <tgroup cols="4" colsep="0" rowsep="0">
25097 <colspec colwidth="8*" align="left"/>
25098 <colspec colwidth="5*" align="center"/>
25099 <colspec colwidth="5*" align="center"/>
25100 <colspec colwidth="6*" align="right"/>
25103 <entry><option>smtp_accept_max_per_host</option></entry>
25104 <entry>Use: <emphasis>main</emphasis></entry>
25105 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
25106 <entry>Default: <emphasis>unset</emphasis></entry>
25112 <indexterm role="concept">
25113 <primary>limit</primary>
25114 <secondary>SMTP connections from one host</secondary>
25116 <indexterm role="concept">
25117 <primary>host</primary>
25118 <secondary>limiting SMTP connections from</secondary>
25120 This option restricts the number of simultaneous IP connections from a single
25121 host (strictly, from a single IP address) to the Exim daemon. The option is
25122 expanded, to enable different limits to be applied to different hosts by
25123 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
25124 connection attempts from the same host are rejected with error code 421. The
25125 default value of zero imposes no limit. If this option is set, it is required
25126 that <option>smtp_accept_max</option> be non-zero.
25129 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
25130 constructions that take an appreciable amount of time. The expansion and test
25131 happen in the main daemon loop, in order to reject additional connections
25132 without forking additional processes (otherwise a denial-of-service attack
25133 could cause a vast number or processes to be created). While the daemon is
25134 doing this processing, it cannot accept any other incoming connections.
25137 <indexterm role="option">
25138 <primary>smtp_accept_queue</primary>
25141 <informaltable frame="all">
25142 <tgroup cols="4" colsep="0" rowsep="0">
25143 <colspec colwidth="8*" align="left"/>
25144 <colspec colwidth="5*" align="center"/>
25145 <colspec colwidth="5*" align="center"/>
25146 <colspec colwidth="6*" align="right"/>
25149 <entry><option>smtp_accept_queue</option></entry>
25150 <entry>Use: <emphasis>main</emphasis></entry>
25151 <entry>Type: <emphasis>integer</emphasis></entry>
25152 <entry>Default: <emphasis>0</emphasis></entry>
25158 <indexterm role="concept">
25159 <primary>SMTP</primary>
25160 <secondary>incoming connection count</secondary>
25162 <indexterm role="concept">
25163 <primary>queueing incoming messages</primary>
25165 <indexterm role="concept">
25166 <primary>message</primary>
25167 <secondary>queueing by SMTP connection count</secondary>
25169 If the number of simultaneous incoming SMTP calls handled via the listening
25170 daemon exceeds this value, messages received by SMTP are just placed on the
25171 queue; no delivery processes are started automatically. A value of zero implies
25172 no limit, and clearly any non-zero value is useful only if it is less than the
25173 <option>smtp_accept_max</option> value (unless that is zero). See also <option>queue_only</option>,
25174 <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the various <option>-od</option><emphasis>x</emphasis>
25175 command line options.
25178 <indexterm role="option">
25179 <primary>smtp_accept_queue_per_connection</primary>
25182 <informaltable frame="all">
25183 <tgroup cols="4" colsep="0" rowsep="0">
25184 <colspec colwidth="8*" align="left"/>
25185 <colspec colwidth="5*" align="center"/>
25186 <colspec colwidth="5*" align="center"/>
25187 <colspec colwidth="6*" align="right"/>
25190 <entry><option>smtp_accept_queue_per_connection</option></entry>
25191 <entry>Use: <emphasis>main</emphasis></entry>
25192 <entry>Type: <emphasis>integer</emphasis></entry>
25193 <entry>Default: <emphasis>10</emphasis></entry>
25199 <indexterm role="concept">
25200 <primary>queueing incoming messages</primary>
25202 <indexterm role="concept">
25203 <primary>message</primary>
25204 <secondary>queueing by message count</secondary>
25206 This option limits the number of delivery processes that Exim starts
25207 automatically when receiving messages via SMTP, whether via the daemon or by
25208 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
25209 and the number of messages received in a single SMTP session exceeds this
25210 number, subsequent messages are placed on the queue, but no delivery processes
25211 are started. This helps to limit the number of Exim processes when a server
25212 restarts after downtime and there is a lot of mail waiting for it on other
25213 systems. On large systems, the default should probably be increased, and on
25214 dial-in client systems it should probably be set to zero (that is, disabled).
25217 <indexterm role="option">
25218 <primary>smtp_accept_reserve</primary>
25221 <informaltable frame="all">
25222 <tgroup cols="4" colsep="0" rowsep="0">
25223 <colspec colwidth="8*" align="left"/>
25224 <colspec colwidth="5*" align="center"/>
25225 <colspec colwidth="5*" align="center"/>
25226 <colspec colwidth="6*" align="right"/>
25229 <entry><option>smtp_accept_reserve</option></entry>
25230 <entry>Use: <emphasis>main</emphasis></entry>
25231 <entry>Type: <emphasis>integer</emphasis></entry>
25232 <entry>Default: <emphasis>0</emphasis></entry>
25238 <indexterm role="concept">
25239 <primary>SMTP</primary>
25240 <secondary>incoming call count</secondary>
25242 <indexterm role="concept">
25243 <primary>host</primary>
25244 <secondary>reserved</secondary>
25246 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
25247 number of SMTP connections that are reserved for connections from the hosts
25248 that are specified in <option>smtp_reserve_hosts</option>. The value set in
25249 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
25250 restricted to this number of connections; the option specifies a minimum number
25251 of connection slots for them, not a maximum. It is a guarantee that that group
25252 of hosts can always get at least <option>smtp_accept_reserve</option> connections.
25255 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
25256 set to 5, once there are 45 active connections (from any hosts), new
25257 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>.
25258 See also <option>smtp_accept_max_per_host</option>.
25261 <indexterm role="option">
25262 <primary>smtp_active_hostname</primary>
25265 <informaltable frame="all">
25266 <tgroup cols="4" colsep="0" rowsep="0">
25267 <colspec colwidth="8*" align="left"/>
25268 <colspec colwidth="5*" align="center"/>
25269 <colspec colwidth="5*" align="center"/>
25270 <colspec colwidth="6*" align="right"/>
25273 <entry><option>smtp_active_hostname</option></entry>
25274 <entry>Use: <emphasis>main</emphasis></entry>
25275 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
25276 <entry>Default: <emphasis>unset</emphasis></entry>
25282 <indexterm role="concept">
25283 <primary>host</primary>
25284 <secondary>name in SMTP responses</secondary>
25286 <indexterm role="concept">
25287 <primary>SMTP</primary>
25288 <secondary>host name in responses</secondary>
25290 <indexterm role="concept">
25291 <primary><varname>$primary_hostname</varname></primary>
25293 This option is provided for multi-homed servers that want to masquerade as
25294 several different hosts. At the start of an SMTP connection, its value is
25295 expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
25296 responses. For example, it is used as domain name in the response to an
25297 incoming HELO or EHLO command.
25300 <indexterm role="concept">
25301 <primary><varname>$smtp_active_hostname</varname></primary>
25303 It is also used in HELO commands for callout verification. The active hostname
25304 is placed in the <varname>$smtp_active_hostname</varname> variable, which is saved with any
25305 messages that are received. It is therefore available for use in routers and
25306 transports when the message is later delivered.
25309 If this option is unset, or if its expansion is forced to fail, or if the
25310 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
25311 used. Other expansion failures cause a message to be written to the main and
25312 panic logs, and the SMTP command receives a temporary error. Typically, the
25313 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
25316 <literallayout class="monospaced">
25317 smtp_active_hostname = ${if eq{$interface_address}{10.0.0.1}\
25318 {cox.mydomain}{box.mydomain}}
25321 <indexterm role="option">
25322 <primary>smtp_banner</primary>
25325 <informaltable frame="all">
25326 <tgroup cols="4" colsep="0" rowsep="0">
25327 <colspec colwidth="8*" align="left"/>
25328 <colspec colwidth="5*" align="center"/>
25329 <colspec colwidth="5*" align="center"/>
25330 <colspec colwidth="6*" align="right"/>
25333 <entry><option>smtp_banner</option></entry>
25334 <entry>Use: <emphasis>main</emphasis></entry>
25335 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
25336 <entry>Default: <emphasis>see below</emphasis></entry>
25342 <indexterm role="concept">
25343 <primary>SMTP</primary>
25344 <secondary>welcome banner</secondary>
25346 <indexterm role="concept">
25347 <primary>banner for SMTP</primary>
25349 <indexterm role="concept">
25350 <primary>welcome banner for SMTP</primary>
25352 <indexterm role="concept">
25353 <primary>customizing</primary>
25354 <secondary>SMTP banner</secondary>
25356 This string, which is expanded every time it is used, is output as the initial
25357 positive response to an SMTP connection. The default setting is:
25359 <literallayout class="monospaced">
25360 smtp_banner = $smtp_active_hostname ESMTP Exim \
25361 $version_number $tod_full
25364 Failure to expand the string causes a panic error. If you want to create a
25365 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
25366 appropriate points, but not at the end. Note that the 220 code is not included
25367 in this string. Exim adds it automatically (several times in the case of a
25368 multiline response).
25371 <indexterm role="option">
25372 <primary>smtp_check_spool_space</primary>
25375 <informaltable frame="all">
25376 <tgroup cols="4" colsep="0" rowsep="0">
25377 <colspec colwidth="8*" align="left"/>
25378 <colspec colwidth="5*" align="center"/>
25379 <colspec colwidth="5*" align="center"/>
25380 <colspec colwidth="6*" align="right"/>
25383 <entry><option>smtp_check_spool_space</option></entry>
25384 <entry>Use: <emphasis>main</emphasis></entry>
25385 <entry>Type: <emphasis>boolean</emphasis></entry>
25386 <entry>Default: <emphasis>true</emphasis></entry>
25392 <indexterm role="concept">
25393 <primary>checking disk space</primary>
25395 <indexterm role="concept">
25396 <primary>disk space</primary>
25397 <secondary>checking</secondary>
25399 <indexterm role="concept">
25400 <primary>spool directory</primary>
25401 <secondary>checking space</secondary>
25403 When this option is set, if an incoming SMTP session encounters the SIZE
25404 option on a MAIL command, it checks that there is enough space in the
25405 spool directory’s partition to accept a message of that size, while still
25406 leaving free the amount specified by <option>check_spool_space</option> (even if that value
25407 is zero). If there isn’t enough space, a temporary error code is returned.
25410 <indexterm role="option">
25411 <primary>smtp_connect_backlog</primary>
25414 <informaltable frame="all">
25415 <tgroup cols="4" colsep="0" rowsep="0">
25416 <colspec colwidth="8*" align="left"/>
25417 <colspec colwidth="5*" align="center"/>
25418 <colspec colwidth="5*" align="center"/>
25419 <colspec colwidth="6*" align="right"/>
25422 <entry><option>smtp_connect_backlog</option></entry>
25423 <entry>Use: <emphasis>main</emphasis></entry>
25424 <entry>Type: <emphasis>integer</emphasis></entry>
25425 <entry>Default: <emphasis>20</emphasis></entry>
25431 <indexterm role="concept">
25432 <primary>connection backlog</primary>
25434 <indexterm role="concept">
25435 <primary>SMTP</primary>
25436 <secondary>connection backlog</secondary>
25438 <indexterm role="concept">
25439 <primary>backlog of connections</primary>
25441 This option specifies a maximum number of waiting SMTP connections. Exim passes
25442 this value to the TCP/IP system when it sets up its listener. Once this number
25443 of connections are waiting for the daemon’s attention, subsequent connection
25444 attempts are refused at the TCP/IP level. At least, that is what the manuals
25445 say; in some circumstances such connection attempts have been observed to time
25446 out instead. For large systems it is probably a good idea to increase the
25447 value (to 50, say). It also gives some protection against denial-of-service
25448 attacks by SYN flooding.
25451 <indexterm role="option">
25452 <primary>smtp_enforce_sync</primary>
25455 <informaltable frame="all">
25456 <tgroup cols="4" colsep="0" rowsep="0">
25457 <colspec colwidth="8*" align="left"/>
25458 <colspec colwidth="5*" align="center"/>
25459 <colspec colwidth="5*" align="center"/>
25460 <colspec colwidth="6*" align="right"/>
25463 <entry><option>smtp_enforce_sync</option></entry>
25464 <entry>Use: <emphasis>main</emphasis></entry>
25465 <entry>Type: <emphasis>boolean</emphasis></entry>
25466 <entry>Default: <emphasis>true</emphasis></entry>
25472 <indexterm role="concept">
25473 <primary>SMTP</primary>
25474 <secondary>synchronization checking</secondary>
25476 <indexterm role="concept">
25477 <primary>synchronization checking in SMTP</primary>
25479 The SMTP protocol specification requires the client to wait for a response from
25480 the server at certain points in the dialogue. Without PIPELINING these
25481 synchronization points are after every command; with PIPELINING they are
25482 fewer, but they still exist.
25485 Some spamming sites send out a complete set of SMTP commands without waiting
25486 for any response. Exim protects against this by rejecting a message if the
25487 client has sent further input when it should not have. The error response <quote>554
25488 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
25489 for this error cannot be perfect because of transmission delays (unexpected
25490 input may be on its way but not yet received when Exim checks). However, it
25491 does detect many instances.
25494 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
25495 If you want to disable the check selectively (for example, only for certain
25496 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
25497 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
25500 <indexterm role="option">
25501 <primary>smtp_etrn_command</primary>
25504 <informaltable frame="all">
25505 <tgroup cols="4" colsep="0" rowsep="0">
25506 <colspec colwidth="8*" align="left"/>
25507 <colspec colwidth="5*" align="center"/>
25508 <colspec colwidth="5*" align="center"/>
25509 <colspec colwidth="6*" align="right"/>
25512 <entry><option>smtp_etrn_command</option></entry>
25513 <entry>Use: <emphasis>main</emphasis></entry>
25514 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
25515 <entry>Default: <emphasis>unset</emphasis></entry>
25521 <indexterm role="concept">
25522 <primary>ETRN</primary>
25523 <secondary>command to be run</secondary>
25525 <indexterm role="concept">
25526 <primary><varname>$domain</varname></primary>
25528 If this option is set, the given command is run whenever an SMTP ETRN
25529 command is received from a host that is permitted to issue such commands (see
25530 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
25531 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
25532 argument of the ETRN command, and no syntax checking is done on it. For
25535 <literallayout class="monospaced">
25536 smtp_etrn_command = /etc/etrn_command $domain \
25537 $sender_host_address
25540 A new process is created to run the command, but Exim does not wait for it to
25541 complete. Consequently, its status cannot be checked. If the command cannot be
25542 run, a line is written to the panic log, but the ETRN caller still receives
25543 a 250 success response. Exim is normally running under its own uid when
25544 receiving SMTP, so it is not possible for it to change the uid before running
25548 <indexterm role="option">
25549 <primary>smtp_etrn_serialize</primary>
25552 <informaltable frame="all">
25553 <tgroup cols="4" colsep="0" rowsep="0">
25554 <colspec colwidth="8*" align="left"/>
25555 <colspec colwidth="5*" align="center"/>
25556 <colspec colwidth="5*" align="center"/>
25557 <colspec colwidth="6*" align="right"/>
25560 <entry><option>smtp_etrn_serialize</option></entry>
25561 <entry>Use: <emphasis>main</emphasis></entry>
25562 <entry>Type: <emphasis>boolean</emphasis></entry>
25563 <entry>Default: <emphasis>true</emphasis></entry>
25569 <indexterm role="concept">
25570 <primary>ETRN</primary>
25571 <secondary>serializing</secondary>
25573 When this option is set, it prevents the simultaneous execution of more than
25574 one identical command as a result of ETRN in an SMTP connection. See
25575 section <xref linkend="SECTETRN"/> for details.
25578 <indexterm role="option">
25579 <primary>smtp_load_reserve</primary>
25582 <informaltable frame="all">
25583 <tgroup cols="4" colsep="0" rowsep="0">
25584 <colspec colwidth="8*" align="left"/>
25585 <colspec colwidth="5*" align="center"/>
25586 <colspec colwidth="5*" align="center"/>
25587 <colspec colwidth="6*" align="right"/>
25590 <entry><option>smtp_load_reserve</option></entry>
25591 <entry>Use: <emphasis>main</emphasis></entry>
25592 <entry>Type: <emphasis>fixed-point</emphasis></entry>
25593 <entry>Default: <emphasis>unset</emphasis></entry>
25599 <indexterm role="concept">
25600 <primary>load average</primary>
25602 If the system load average ever gets higher than this, incoming SMTP calls are
25603 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
25604 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
25605 the load is over the limit. The option has no effect on ancient operating
25606 systems on which Exim cannot determine the load average. See also
25607 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
25610 <indexterm role="option">
25611 <primary>smtp_max_synprot_errors</primary>
25614 <informaltable frame="all">
25615 <tgroup cols="4" colsep="0" rowsep="0">
25616 <colspec colwidth="8*" align="left"/>
25617 <colspec colwidth="5*" align="center"/>
25618 <colspec colwidth="5*" align="center"/>
25619 <colspec colwidth="6*" align="right"/>
25622 <entry><option>smtp_max_synprot_errors</option></entry>
25623 <entry>Use: <emphasis>main</emphasis></entry>
25624 <entry>Type: <emphasis>integer</emphasis></entry>
25625 <entry>Default: <emphasis>3</emphasis></entry>
25631 <indexterm role="concept">
25632 <primary>SMTP</primary>
25633 <secondary>limiting syntax and protocol errors</secondary>
25635 <indexterm role="concept">
25636 <primary>limit</primary>
25637 <secondary>SMTP syntax and protocol errors</secondary>
25639 Exim rejects SMTP commands that contain syntax or protocol errors. In
25640 particular, a syntactically invalid email address, as in this command:
25642 <literallayout class="monospaced">
25643 RCPT TO:<abc xyz@a.b.c>
25646 causes immediate rejection of the command, before any other tests are done.
25647 (The ACL cannot be run if there is no valid address to set up for it.) An
25648 example of a protocol error is receiving RCPT before MAIL. If there are
25649 too many syntax or protocol errors in one SMTP session, the connection is
25650 dropped. The limit is set by this option.
25653 <indexterm role="concept">
25654 <primary>PIPELINING</primary>
25655 <secondary>expected errors</secondary>
25657 When the PIPELINING extension to SMTP is in use, some protocol errors are
25658 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
25659 Exim assumes that PIPELINING will be used if it advertises it (see
25660 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
25661 not count towards the limit.
25664 <indexterm role="option">
25665 <primary>smtp_max_unknown_commands</primary>
25668 <informaltable frame="all">
25669 <tgroup cols="4" colsep="0" rowsep="0">
25670 <colspec colwidth="8*" align="left"/>
25671 <colspec colwidth="5*" align="center"/>
25672 <colspec colwidth="5*" align="center"/>
25673 <colspec colwidth="6*" align="right"/>
25676 <entry><option>smtp_max_unknown_commands</option></entry>
25677 <entry>Use: <emphasis>main</emphasis></entry>
25678 <entry>Type: <emphasis>integer</emphasis></entry>
25679 <entry>Default: <emphasis>3</emphasis></entry>
25685 <indexterm role="concept">
25686 <primary>SMTP</primary>
25687 <secondary>limiting unknown commands</secondary>
25689 <indexterm role="concept">
25690 <primary>limit</primary>
25691 <secondary>unknown SMTP commands</secondary>
25693 If there are too many unrecognized commands in an incoming SMTP session, an
25694 Exim server drops the connection. This is a defence against some kinds of abuse
25697 into making connections to SMTP ports; in these circumstances, a number of
25698 non-SMTP command lines are sent first.
25701 <indexterm role="option">
25702 <primary>smtp_ratelimit_hosts</primary>
25705 <informaltable frame="all">
25706 <tgroup cols="4" colsep="0" rowsep="0">
25707 <colspec colwidth="8*" align="left"/>
25708 <colspec colwidth="5*" align="center"/>
25709 <colspec colwidth="5*" align="center"/>
25710 <colspec colwidth="6*" align="right"/>
25713 <entry><option>smtp_ratelimit_hosts</option></entry>
25714 <entry>Use: <emphasis>main</emphasis></entry>
25715 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
25716 <entry>Default: <emphasis>unset</emphasis></entry>
25722 <indexterm role="concept">
25723 <primary>SMTP</primary>
25724 <secondary>rate limiting</secondary>
25726 <indexterm role="concept">
25727 <primary>limit</primary>
25728 <secondary>rate of message arrival</secondary>
25730 <indexterm role="concept">
25731 <primary>RCPT</primary>
25732 <secondary>rate limiting</secondary>
25734 Some sites find it helpful to be able to limit the rate at which certain hosts
25735 can send them messages, and the rate at which an individual message can specify
25739 Exim has two rate-limiting facilities. This section describes the older
25740 facility, which can limit rates within a single connection. The newer
25741 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
25742 <xref linkend="SECTratelimiting"/> for details of the newer facility.
25745 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
25746 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
25747 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
25748 respectively. Each option, if set, must contain a set of four comma-separated
25754 A threshold, before which there is no rate limiting.
25759 An initial time delay. Unlike other times in Exim, numbers with decimal
25760 fractional parts are allowed here.
25765 A factor by which to increase the delay each time.
25770 A maximum value for the delay. This should normally be less than 5 minutes,
25771 because after that time, the client is liable to timeout the SMTP command.
25776 For example, these settings have been used successfully at the site which
25777 first suggested this feature, for controlling mail from their customers:
25779 <literallayout class="monospaced">
25780 smtp_ratelimit_mail = 2,0.5s,1.05,4m
25781 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
25784 The first setting specifies delays that are applied to MAIL commands after
25785 two have been received over a single connection. The initial delay is 0.5
25786 seconds, increasing by a factor of 1.05 each time. The second setting applies
25787 delays to RCPT commands when more than four occur in a single message.
25790 <indexterm role="option">
25791 <primary>smtp_ratelimit_mail</primary>
25794 <informaltable frame="all">
25795 <tgroup cols="4" colsep="0" rowsep="0">
25796 <colspec colwidth="8*" align="left"/>
25797 <colspec colwidth="5*" align="center"/>
25798 <colspec colwidth="5*" align="center"/>
25799 <colspec colwidth="6*" align="right"/>
25802 <entry><option>smtp_ratelimit_mail</option></entry>
25803 <entry>Use: <emphasis>main</emphasis></entry>
25804 <entry>Type: <emphasis>string</emphasis></entry>
25805 <entry>Default: <emphasis>unset</emphasis></entry>
25811 See <option>smtp_ratelimit_hosts</option> above.
25814 <indexterm role="option">
25815 <primary>smtp_ratelimit_rcpt</primary>
25818 <informaltable frame="all">
25819 <tgroup cols="4" colsep="0" rowsep="0">
25820 <colspec colwidth="8*" align="left"/>
25821 <colspec colwidth="5*" align="center"/>
25822 <colspec colwidth="5*" align="center"/>
25823 <colspec colwidth="6*" align="right"/>
25826 <entry><option>smtp_ratelimit_rcpt</option></entry>
25827 <entry>Use: <emphasis>main</emphasis></entry>
25828 <entry>Type: <emphasis>string</emphasis></entry>
25829 <entry>Default: <emphasis>unset</emphasis></entry>
25835 See <option>smtp_ratelimit_hosts</option> above.
25838 <indexterm role="option">
25839 <primary>smtp_receive_timeout</primary>
25842 <informaltable frame="all">
25843 <tgroup cols="4" colsep="0" rowsep="0">
25844 <colspec colwidth="8*" align="left"/>
25845 <colspec colwidth="5*" align="center"/>
25846 <colspec colwidth="5*" align="center"/>
25847 <colspec colwidth="6*" align="right"/>
25850 <entry><option>smtp_receive_timeout</option></entry>
25851 <entry>Use: <emphasis>main</emphasis></entry>
25852 <entry>Type: <emphasis>time</emphasis></entry>
25853 <entry>Default: <emphasis>5m</emphasis></entry>
25859 <indexterm role="concept">
25860 <primary>timeout</primary>
25861 <secondary>for SMTP input</secondary>
25863 <indexterm role="concept">
25864 <primary>SMTP timeout</primary>
25865 <secondary>input</secondary>
25867 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
25868 input, including batch SMTP. If a line of input (either an SMTP command or a
25869 data line) is not received within this time, the SMTP connection is dropped and
25870 the message is abandoned.
25871 A line is written to the log containing one of the following messages:
25873 <literallayout class="monospaced">
25874 SMTP command timeout on connection from...
25875 SMTP data timeout on connection from...
25878 The former means that Exim was expecting to read an SMTP command; the latter
25879 means that it was in the DATA phase, reading the contents of a message.
25882 <indexterm role="concept">
25883 <primary><option>-os</option> option</primary>
25885 The value set by this option can be overridden by the
25886 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
25887 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
25888 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
25889 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
25892 <indexterm role="option">
25893 <primary>smtp_reserve_hosts</primary>
25896 <informaltable frame="all">
25897 <tgroup cols="4" colsep="0" rowsep="0">
25898 <colspec colwidth="8*" align="left"/>
25899 <colspec colwidth="5*" align="center"/>
25900 <colspec colwidth="5*" align="center"/>
25901 <colspec colwidth="6*" align="right"/>
25904 <entry><option>smtp_reserve_hosts</option></entry>
25905 <entry>Use: <emphasis>main</emphasis></entry>
25906 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
25907 <entry>Default: <emphasis>unset</emphasis></entry>
25913 This option defines hosts for which SMTP connections are reserved; see
25914 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
25917 <indexterm role="option">
25918 <primary>smtp_return_error_details</primary>
25921 <informaltable frame="all">
25922 <tgroup cols="4" colsep="0" rowsep="0">
25923 <colspec colwidth="8*" align="left"/>
25924 <colspec colwidth="5*" align="center"/>
25925 <colspec colwidth="5*" align="center"/>
25926 <colspec colwidth="6*" align="right"/>
25929 <entry><option>smtp_return_error_details</option></entry>
25930 <entry>Use: <emphasis>main</emphasis></entry>
25931 <entry>Type: <emphasis>boolean</emphasis></entry>
25932 <entry>Default: <emphasis>false</emphasis></entry>
25938 <indexterm role="concept">
25939 <primary>SMTP</primary>
25940 <secondary>details policy failures</secondary>
25942 <indexterm role="concept">
25943 <primary>policy control rejection</primary>
25944 <secondary>returning details</secondary>
25946 In the default state, Exim uses bland messages such as
25947 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
25948 reasons. Many sysadmins like this because it gives away little information
25949 to spammers. However, some other syadmins who are applying strict checking
25950 policies want to give out much fuller information about failures. Setting
25951 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
25952 example, instead of <quote>Administrative prohibition</quote>, it might give:
25954 <literallayout class="monospaced">
25955 550-Rejected after DATA: '>' missing at end of address:
25956 550 failing address in "From" header is: <user@dom.ain
25959 <indexterm role="option">
25960 <primary>spamd_address</primary>
25963 <informaltable frame="all">
25964 <tgroup cols="4" colsep="0" rowsep="0">
25965 <colspec colwidth="8*" align="left"/>
25966 <colspec colwidth="5*" align="center"/>
25967 <colspec colwidth="5*" align="center"/>
25968 <colspec colwidth="6*" align="right"/>
25971 <entry><option>spamd_address</option></entry>
25972 <entry>Use: <emphasis>main</emphasis></entry>
25973 <entry>Type: <emphasis>string</emphasis></entry>
25974 <entry>Default: <emphasis>see below</emphasis></entry>
25980 This option is available when Exim is compiled with the content-scanning
25981 extension. It specifies how Exim connects to SpamAssassin’s <option>spamd</option> daemon.
25982 The default value is
25984 <literallayout class="monospaced">
25988 See section <xref linkend="SECTscanspamass"/> for more details.
25991 <indexterm role="option">
25992 <primary>split_spool_directory</primary>
25995 <informaltable frame="all">
25996 <tgroup cols="4" colsep="0" rowsep="0">
25997 <colspec colwidth="8*" align="left"/>
25998 <colspec colwidth="5*" align="center"/>
25999 <colspec colwidth="5*" align="center"/>
26000 <colspec colwidth="6*" align="right"/>
26003 <entry><option>split_spool_directory</option></entry>
26004 <entry>Use: <emphasis>main</emphasis></entry>
26005 <entry>Type: <emphasis>boolean</emphasis></entry>
26006 <entry>Default: <emphasis>false</emphasis></entry>
26012 <indexterm role="concept">
26013 <primary>multiple spool directories</primary>
26015 <indexterm role="concept">
26016 <primary>spool directory</primary>
26017 <secondary>split</secondary>
26019 <indexterm role="concept">
26020 <primary>directories</primary>
26021 <secondary>multiple</secondary>
26023 If this option is set, it causes Exim to split its input directory into 62
26024 subdirectories, each with a single alphanumeric character as its name. The
26025 sixth character of the message id is used to allocate messages to
26026 subdirectories; this is the least significant base-62 digit of the time of
26027 arrival of the message.
26030 Splitting up the spool in this way may provide better performance on systems
26031 where there are long mail queues, by reducing the number of files in any one
26032 directory. The msglog directory is also split up in a similar way to the input
26033 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
26034 are still placed in the single directory <filename>msglog.OLD</filename>.
26037 It is not necessary to take any special action for existing messages when
26038 changing <option>split_spool_directory</option>. Exim notices messages that are in the
26039 <quote>wrong</quote> place, and continues to process them. If the option is turned off
26040 after a period of being on, the subdirectories will eventually empty and be
26041 automatically deleted.
26044 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
26045 changes. Instead of creating a list of all messages in the queue, and then
26046 trying to deliver each one in turn, it constructs a list of those in one
26047 sub-directory and tries to deliver them, before moving on to the next
26048 sub-directory. The sub-directories are processed in a random order. This
26049 spreads out the scanning of the input directories, and uses less memory. It is
26050 particularly beneficial when there are lots of messages on the queue. However,
26051 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
26052 entire queue has to be scanned and sorted before any deliveries can start.
26055 <indexterm role="option">
26056 <primary>spool_directory</primary>
26059 <informaltable frame="all">
26060 <tgroup cols="4" colsep="0" rowsep="0">
26061 <colspec colwidth="8*" align="left"/>
26062 <colspec colwidth="5*" align="center"/>
26063 <colspec colwidth="5*" align="center"/>
26064 <colspec colwidth="6*" align="right"/>
26067 <entry><option>spool_directory</option></entry>
26068 <entry>Use: <emphasis>main</emphasis></entry>
26069 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26070 <entry>Default: <emphasis>set at compile time</emphasis></entry>
26076 <indexterm role="concept">
26077 <primary>spool directory</primary>
26078 <secondary>path to</secondary>
26080 This defines the directory in which Exim keeps its spool, that is, the messages
26081 it is waiting to deliver. The default value is taken from the compile-time
26082 configuration setting, if there is one. If not, this option must be set. The
26083 string is expanded, so it can contain, for example, a reference to
26084 <varname>$primary_hostname</varname>.
26087 If the spool directory name is fixed on your installation, it is recommended
26088 that you set it at build time rather than from this option, particularly if the
26089 log files are being written to the spool directory (see <option>log_file_path</option>).
26090 Otherwise log files cannot be used for errors that are detected early on, such
26091 as failures in the configuration file.
26094 By using this option to override the compiled-in path, it is possible to run
26095 tests of Exim without using the standard spool.
26098 <indexterm role="option">
26099 <primary>sqlite_lock_timeout</primary>
26102 <informaltable frame="all">
26103 <tgroup cols="4" colsep="0" rowsep="0">
26104 <colspec colwidth="8*" align="left"/>
26105 <colspec colwidth="5*" align="center"/>
26106 <colspec colwidth="5*" align="center"/>
26107 <colspec colwidth="6*" align="right"/>
26110 <entry><option>sqlite_lock_timeout</option></entry>
26111 <entry>Use: <emphasis>main</emphasis></entry>
26112 <entry>Type: <emphasis>time</emphasis></entry>
26113 <entry>Default: <emphasis>5s</emphasis></entry>
26119 <indexterm role="concept">
26120 <primary>sqlite</primary>
26121 <secondary>lock timeout</secondary>
26123 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
26124 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
26127 <indexterm role="option">
26128 <primary>strip_excess_angle_brackets</primary>
26131 <informaltable frame="all">
26132 <tgroup cols="4" colsep="0" rowsep="0">
26133 <colspec colwidth="8*" align="left"/>
26134 <colspec colwidth="5*" align="center"/>
26135 <colspec colwidth="5*" align="center"/>
26136 <colspec colwidth="6*" align="right"/>
26139 <entry><option>strip_excess_angle_brackets</option></entry>
26140 <entry>Use: <emphasis>main</emphasis></entry>
26141 <entry>Type: <emphasis>boolean</emphasis></entry>
26142 <entry>Default: <emphasis>false</emphasis></entry>
26148 <indexterm role="concept">
26149 <primary>angle brackets</primary>
26150 <secondary>excess</secondary>
26152 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
26153 items in addresses are stripped. For example, <emphasis><<xxx@a.b.c.d>></emphasis> is
26154 treated as <emphasis><xxx@a.b.c.d></emphasis>. If this is in the envelope and the message is
26155 passed on to another MTA, the excess angle brackets are not passed on. If this
26156 option is not set, multiple pairs of angle brackets cause a syntax error.
26159 <indexterm role="option">
26160 <primary>strip_trailing_dot</primary>
26163 <informaltable frame="all">
26164 <tgroup cols="4" colsep="0" rowsep="0">
26165 <colspec colwidth="8*" align="left"/>
26166 <colspec colwidth="5*" align="center"/>
26167 <colspec colwidth="5*" align="center"/>
26168 <colspec colwidth="6*" align="right"/>
26171 <entry><option>strip_trailing_dot</option></entry>
26172 <entry>Use: <emphasis>main</emphasis></entry>
26173 <entry>Type: <emphasis>boolean</emphasis></entry>
26174 <entry>Default: <emphasis>false</emphasis></entry>
26180 <indexterm role="concept">
26181 <primary>trailing dot on domain</primary>
26183 <indexterm role="concept">
26184 <primary>dot</primary>
26185 <secondary>trailing on domain</secondary>
26187 If this option is set, a trailing dot at the end of a domain in an address is
26188 ignored. If this is in the envelope and the message is passed on to another
26189 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
26190 domain causes a syntax error.
26191 However, addresses in header lines are checked only when an ACL requests header
26195 <indexterm role="option">
26196 <primary>syslog_duplication</primary>
26199 <informaltable frame="all">
26200 <tgroup cols="4" colsep="0" rowsep="0">
26201 <colspec colwidth="8*" align="left"/>
26202 <colspec colwidth="5*" align="center"/>
26203 <colspec colwidth="5*" align="center"/>
26204 <colspec colwidth="6*" align="right"/>
26207 <entry><option>syslog_duplication</option></entry>
26208 <entry>Use: <emphasis>main</emphasis></entry>
26209 <entry>Type: <emphasis>boolean</emphasis></entry>
26210 <entry>Default: <emphasis>true</emphasis></entry>
26216 <indexterm role="concept">
26217 <primary>syslog</primary>
26218 <secondary>duplicate log lines; suppressing</secondary>
26220 When Exim is logging to syslog, it writes the log lines for its three
26221 separate logs at different syslog priorities so that they can in principle
26222 be separated on the logging hosts. Some installations do not require this
26223 separation, and in those cases, the duplication of certain log lines is a
26224 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
26225 particular log line is written to syslog. For lines that normally go to
26226 both the main log and the reject log, the reject log version (possibly
26227 containing message header lines) is written, at LOG_NOTICE priority.
26228 Lines that normally go to both the main and the panic log are written at
26229 the LOG_ALERT priority.
26232 <indexterm role="option">
26233 <primary>syslog_facility</primary>
26236 <informaltable frame="all">
26237 <tgroup cols="4" colsep="0" rowsep="0">
26238 <colspec colwidth="8*" align="left"/>
26239 <colspec colwidth="5*" align="center"/>
26240 <colspec colwidth="5*" align="center"/>
26241 <colspec colwidth="6*" align="right"/>
26244 <entry><option>syslog_facility</option></entry>
26245 <entry>Use: <emphasis>main</emphasis></entry>
26246 <entry>Type: <emphasis>string</emphasis></entry>
26247 <entry>Default: <emphasis>unset</emphasis></entry>
26253 <indexterm role="concept">
26254 <primary>syslog</primary>
26255 <secondary>facility; setting</secondary>
26257 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
26258 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
26259 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
26260 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
26261 details of Exim’s logging.
26264 <indexterm role="option">
26265 <primary>syslog_processname</primary>
26268 <informaltable frame="all">
26269 <tgroup cols="4" colsep="0" rowsep="0">
26270 <colspec colwidth="8*" align="left"/>
26271 <colspec colwidth="5*" align="center"/>
26272 <colspec colwidth="5*" align="center"/>
26273 <colspec colwidth="6*" align="right"/>
26276 <entry><option>syslog_processname</option></entry>
26277 <entry>Use: <emphasis>main</emphasis></entry>
26278 <entry>Type: <emphasis>string</emphasis></entry>
26279 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
26285 <indexterm role="concept">
26286 <primary>syslog</primary>
26287 <secondary>process name; setting</secondary>
26289 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
26290 syslog. The value must be no longer than 32 characters. See chapter
26291 <xref linkend="CHAPlog"/> for details of Exim’s logging.
26294 <indexterm role="option">
26295 <primary>syslog_timestamp</primary>
26298 <informaltable frame="all">
26299 <tgroup cols="4" colsep="0" rowsep="0">
26300 <colspec colwidth="8*" align="left"/>
26301 <colspec colwidth="5*" align="center"/>
26302 <colspec colwidth="5*" align="center"/>
26303 <colspec colwidth="6*" align="right"/>
26306 <entry><option>syslog_timestamp</option></entry>
26307 <entry>Use: <emphasis>main</emphasis></entry>
26308 <entry>Type: <emphasis>boolean</emphasis></entry>
26309 <entry>Default: <emphasis>true</emphasis></entry>
26315 <indexterm role="concept">
26316 <primary>syslog</primary>
26317 <secondary>timestamps</secondary>
26319 If <option>syslog_timestamp</option> is set false, the timestamps on Exim’s log lines are
26320 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
26321 details of Exim’s logging.
26324 <indexterm role="option">
26325 <primary>system_filter</primary>
26328 <informaltable frame="all">
26329 <tgroup cols="4" colsep="0" rowsep="0">
26330 <colspec colwidth="8*" align="left"/>
26331 <colspec colwidth="5*" align="center"/>
26332 <colspec colwidth="5*" align="center"/>
26333 <colspec colwidth="6*" align="right"/>
26336 <entry><option>system_filter</option></entry>
26337 <entry>Use: <emphasis>main</emphasis></entry>
26338 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26339 <entry>Default: <emphasis>unset</emphasis></entry>
26345 <indexterm role="concept">
26346 <primary>filter</primary>
26347 <secondary>system filter</secondary>
26349 <indexterm role="concept">
26350 <primary>system filter</primary>
26351 <secondary>specifying</secondary>
26353 <indexterm role="concept">
26354 <primary>Sieve filter</primary>
26355 <secondary>not available for system filter</secondary>
26357 This option specifies an Exim filter file that is applied to all messages at
26358 the start of each delivery attempt, before any routing is done. System filters
26359 must be Exim filters; they cannot be Sieve filters. If the system filter
26360 generates any deliveries to files or pipes, or any new mail messages, the
26361 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
26362 which transports are to be used. Details of this facility are given in chapter
26363 <xref linkend="CHAPsystemfilter"/>.
26366 <indexterm role="option">
26367 <primary>system_filter_directory_transport</primary>
26370 <informaltable frame="all">
26371 <tgroup cols="4" colsep="0" rowsep="0">
26372 <colspec colwidth="8*" align="left"/>
26373 <colspec colwidth="5*" align="center"/>
26374 <colspec colwidth="5*" align="center"/>
26375 <colspec colwidth="6*" align="right"/>
26378 <entry><option>system_filter_directory_transport</option></entry>
26379 <entry>Use: <emphasis>main</emphasis></entry>
26380 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26381 <entry>Default: <emphasis>unset</emphasis></entry>
26387 <indexterm role="concept">
26388 <primary><varname>$address_file</varname></primary>
26390 This sets the name of the transport driver that is to be used when the
26391 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
26392 implying delivery of each message into a separate file in some directory.
26393 During the delivery, the variable <varname>$address_file</varname> contains the path name.
26396 <indexterm role="option">
26397 <primary>system_filter_file_transport</primary>
26400 <informaltable frame="all">
26401 <tgroup cols="4" colsep="0" rowsep="0">
26402 <colspec colwidth="8*" align="left"/>
26403 <colspec colwidth="5*" align="center"/>
26404 <colspec colwidth="5*" align="center"/>
26405 <colspec colwidth="6*" align="right"/>
26408 <entry><option>system_filter_file_transport</option></entry>
26409 <entry>Use: <emphasis>main</emphasis></entry>
26410 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26411 <entry>Default: <emphasis>unset</emphasis></entry>
26417 <indexterm role="concept">
26418 <primary>file</primary>
26419 <secondary>transport for system filter</secondary>
26421 This sets the name of the transport driver that is to be used when the <option>save</option>
26422 command in a system message filter specifies a path not ending in <quote>/</quote>. During
26423 the delivery, the variable <varname>$address_file</varname> contains the path name.
26426 <indexterm role="option">
26427 <primary>system_filter_group</primary>
26430 <informaltable frame="all">
26431 <tgroup cols="4" colsep="0" rowsep="0">
26432 <colspec colwidth="8*" align="left"/>
26433 <colspec colwidth="5*" align="center"/>
26434 <colspec colwidth="5*" align="center"/>
26435 <colspec colwidth="6*" align="right"/>
26438 <entry><option>system_filter_group</option></entry>
26439 <entry>Use: <emphasis>main</emphasis></entry>
26440 <entry>Type: <emphasis>string</emphasis></entry>
26441 <entry>Default: <emphasis>unset</emphasis></entry>
26447 <indexterm role="concept">
26448 <primary>gid (group id)</primary>
26449 <secondary>system filter</secondary>
26451 This option is used only when <option>system_filter_user</option> is also set. It sets the
26452 gid under which the system filter is run, overriding any gid that is associated
26453 with the user. The value may be numerical or symbolic.
26456 <indexterm role="option">
26457 <primary>system_filter_pipe_transport</primary>
26460 <informaltable frame="all">
26461 <tgroup cols="4" colsep="0" rowsep="0">
26462 <colspec colwidth="8*" align="left"/>
26463 <colspec colwidth="5*" align="center"/>
26464 <colspec colwidth="5*" align="center"/>
26465 <colspec colwidth="6*" align="right"/>
26468 <entry><option>system_filter_pipe_transport</option></entry>
26469 <entry>Use: <emphasis>main</emphasis></entry>
26470 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26471 <entry>Default: <emphasis>unset</emphasis></entry>
26477 <indexterm role="concept">
26478 <primary><command>pipe</command> transport</primary>
26479 <secondary>for system filter</secondary>
26481 <indexterm role="concept">
26482 <primary><varname>$address_pipe</varname></primary>
26484 This specifies the transport driver that is to be used when a <option>pipe</option> command
26485 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
26486 contains the pipe command.
26489 <indexterm role="option">
26490 <primary>system_filter_reply_transport</primary>
26493 <informaltable frame="all">
26494 <tgroup cols="4" colsep="0" rowsep="0">
26495 <colspec colwidth="8*" align="left"/>
26496 <colspec colwidth="5*" align="center"/>
26497 <colspec colwidth="5*" align="center"/>
26498 <colspec colwidth="6*" align="right"/>
26501 <entry><option>system_filter_reply_transport</option></entry>
26502 <entry>Use: <emphasis>main</emphasis></entry>
26503 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26504 <entry>Default: <emphasis>unset</emphasis></entry>
26510 <indexterm role="concept">
26511 <primary><command>autoreply</command> transport</primary>
26512 <secondary>for system filter</secondary>
26514 This specifies the transport driver that is to be used when a <option>mail</option> command
26515 is used in a system filter.
26518 <indexterm role="option">
26519 <primary>system_filter_user</primary>
26522 <informaltable frame="all">
26523 <tgroup cols="4" colsep="0" rowsep="0">
26524 <colspec colwidth="8*" align="left"/>
26525 <colspec colwidth="5*" align="center"/>
26526 <colspec colwidth="5*" align="center"/>
26527 <colspec colwidth="6*" align="right"/>
26530 <entry><option>system_filter_user</option></entry>
26531 <entry>Use: <emphasis>main</emphasis></entry>
26532 <entry>Type: <emphasis>string</emphasis></entry>
26533 <entry>Default: <emphasis>unset</emphasis></entry>
26539 <indexterm role="concept">
26540 <primary>uid (user id)</primary>
26541 <secondary>system filter</secondary>
26543 If this option is not set, the system filter is run in the main Exim delivery
26544 process, as root. When the option is set, the system filter runs in a separate
26545 process, as the given user. Unless the string consists entirely of digits, it
26546 is looked up in the password data. Failure to find the named user causes a
26547 configuration error. The gid is either taken from the password data, or
26548 specified by <option>system_filter_group</option>. When the uid is specified numerically,
26549 <option>system_filter_group</option> is required to be set.
26552 If the system filter generates any pipe, file, or reply deliveries, the uid
26553 under which the filter is run is used when transporting them, unless a
26554 transport option overrides. Normally you should set <option>system_filter_user</option> if
26555 your system filter generates these kinds of delivery.
26558 <indexterm role="option">
26559 <primary>tcp_nodelay</primary>
26562 <informaltable frame="all">
26563 <tgroup cols="4" colsep="0" rowsep="0">
26564 <colspec colwidth="8*" align="left"/>
26565 <colspec colwidth="5*" align="center"/>
26566 <colspec colwidth="5*" align="center"/>
26567 <colspec colwidth="6*" align="right"/>
26570 <entry><option>tcp_nodelay</option></entry>
26571 <entry>Use: <emphasis>main</emphasis></entry>
26572 <entry>Type: <emphasis>boolean</emphasis></entry>
26573 <entry>Default: <emphasis>true</emphasis></entry>
26579 <indexterm role="concept">
26580 <primary>daemon</primary>
26581 <secondary>TCP_NODELAY on sockets</secondary>
26583 <indexterm role="concept">
26584 <primary>Nagle algorithm</primary>
26586 <indexterm role="concept">
26587 <primary>TCP_NODELAY on listening sockets</primary>
26589 If this option is set false, it stops the Exim daemon setting the
26590 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
26591 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
26592 performance in interactive (character-by-character) situations. Turning it off
26593 should improve Exim’s performance a bit, so that is what happens by default.
26594 However, it appears that some broken clients cannot cope, and time out. Hence
26595 this option. It affects only those sockets that are set up for listening by the
26596 daemon. Sockets created by the smtp transport for delivering mail always set
26600 <indexterm role="option">
26601 <primary>timeout_frozen_after</primary>
26604 <informaltable frame="all">
26605 <tgroup cols="4" colsep="0" rowsep="0">
26606 <colspec colwidth="8*" align="left"/>
26607 <colspec colwidth="5*" align="center"/>
26608 <colspec colwidth="5*" align="center"/>
26609 <colspec colwidth="6*" align="right"/>
26612 <entry><option>timeout_frozen_after</option></entry>
26613 <entry>Use: <emphasis>main</emphasis></entry>
26614 <entry>Type: <emphasis>time</emphasis></entry>
26615 <entry>Default: <emphasis>0s</emphasis></entry>
26621 <indexterm role="concept">
26622 <primary>frozen messages</primary>
26623 <secondary>timing out</secondary>
26625 <indexterm role="concept">
26626 <primary>timeout</primary>
26627 <secondary>frozen messages</secondary>
26629 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
26630 message of any kind that has been on the queue for longer than the given
26631 time is automatically cancelled at the next queue run. If it is a bounce
26632 message, it is just discarded; otherwise, a bounce is sent to the sender, in a
26633 similar manner to cancellation by the <option>-Mg</option> command line option. If you want
26634 to timeout frozen bounce messages earlier than other kinds of frozen message,
26635 see <option>ignore_bounce_errors_after</option>.
26638 <indexterm role="option">
26639 <primary>timezone</primary>
26642 <informaltable frame="all">
26643 <tgroup cols="4" colsep="0" rowsep="0">
26644 <colspec colwidth="8*" align="left"/>
26645 <colspec colwidth="5*" align="center"/>
26646 <colspec colwidth="5*" align="center"/>
26647 <colspec colwidth="6*" align="right"/>
26650 <entry><option>timezone</option></entry>
26651 <entry>Use: <emphasis>main</emphasis></entry>
26652 <entry>Type: <emphasis>string</emphasis></entry>
26653 <entry>Default: <emphasis>unset</emphasis></entry>
26659 <indexterm role="concept">
26660 <primary>timezone</primary>
26661 <secondary>setting</secondary>
26663 The value of <option>timezone</option> is used to set the environment variable TZ while
26664 running Exim (if it is different on entry). This ensures that all timestamps
26665 created by Exim are in the required timezone. If you want all your timestamps
26666 to be in UTC (aka GMT) you should set
26668 <literallayout class="monospaced">
26672 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
26673 or, if that is not set, from the value of the TZ environment variable when Exim
26674 is built. If <option>timezone</option> is set to the empty string, either at build or run
26675 time, any existing TZ variable is removed from the environment when Exim
26676 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
26677 unfortunately not all, operating systems.
26680 <indexterm role="option">
26681 <primary>tls_advertise_hosts</primary>
26684 <informaltable frame="all">
26685 <tgroup cols="4" colsep="0" rowsep="0">
26686 <colspec colwidth="8*" align="left"/>
26687 <colspec colwidth="5*" align="center"/>
26688 <colspec colwidth="5*" align="center"/>
26689 <colspec colwidth="6*" align="right"/>
26692 <entry><option>tls_advertise_hosts</option></entry>
26693 <entry>Use: <emphasis>main</emphasis></entry>
26694 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
26695 <entry>Default: <emphasis>unset</emphasis></entry>
26701 <indexterm role="concept">
26702 <primary>TLS</primary>
26703 <secondary>advertising</secondary>
26705 <indexterm role="concept">
26706 <primary>encryption</primary>
26707 <secondary>on SMTP connection</secondary>
26709 <indexterm role="concept">
26710 <primary>SMTP</primary>
26711 <secondary>encrypted connection</secondary>
26713 When Exim is built with support for TLS encrypted connections, the availability
26714 of the STARTTLS command to set up an encrypted session is advertised in
26715 response to EHLO only to those client hosts that match this option. See
26716 chapter <xref linkend="CHAPTLS"/> for details of Exim’s support for TLS.
26719 <indexterm role="option">
26720 <primary>tls_certificate</primary>
26723 <informaltable frame="all">
26724 <tgroup cols="4" colsep="0" rowsep="0">
26725 <colspec colwidth="8*" align="left"/>
26726 <colspec colwidth="5*" align="center"/>
26727 <colspec colwidth="5*" align="center"/>
26728 <colspec colwidth="6*" align="right"/>
26731 <entry><option>tls_certificate</option></entry>
26732 <entry>Use: <emphasis>main</emphasis></entry>
26733 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26734 <entry>Default: <emphasis>unset</emphasis></entry>
26740 <indexterm role="concept">
26741 <primary>TLS</primary>
26742 <secondary>server certificate; location of</secondary>
26744 <indexterm role="concept">
26745 <primary>certificate for server</primary>
26746 <secondary>location of</secondary>
26748 The value of this option is expanded, and must then be the absolute path to a
26749 file which contains the server’s certificates. The server’s private key is also
26750 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
26751 <xref linkend="CHAPTLS"/> for further details.
26754 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
26755 receiving incoming messages as a server. If you want to supply certificates for
26756 use when sending messages as a client, you must set the <option>tls_certificate</option>
26757 option in the relevant <command>smtp</command> transport.
26760 <indexterm role="option">
26761 <primary>tls_crl</primary>
26764 <informaltable frame="all">
26765 <tgroup cols="4" colsep="0" rowsep="0">
26766 <colspec colwidth="8*" align="left"/>
26767 <colspec colwidth="5*" align="center"/>
26768 <colspec colwidth="5*" align="center"/>
26769 <colspec colwidth="6*" align="right"/>
26772 <entry><option>tls_crl</option></entry>
26773 <entry>Use: <emphasis>main</emphasis></entry>
26774 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26775 <entry>Default: <emphasis>unset</emphasis></entry>
26781 <indexterm role="concept">
26782 <primary>TLS</primary>
26783 <secondary>server certificate revocation list</secondary>
26785 <indexterm role="concept">
26786 <primary>certificate</primary>
26787 <secondary>revocation list for server</secondary>
26789 This option specifies a certificate revocation list. The expanded value must
26790 be the name of a file that contains a CRL in PEM format.
26793 <indexterm role="option">
26794 <primary>tls_dhparam</primary>
26797 <informaltable frame="all">
26798 <tgroup cols="4" colsep="0" rowsep="0">
26799 <colspec colwidth="8*" align="left"/>
26800 <colspec colwidth="5*" align="center"/>
26801 <colspec colwidth="5*" align="center"/>
26802 <colspec colwidth="6*" align="right"/>
26805 <entry><option>tls_dhparam</option></entry>
26806 <entry>Use: <emphasis>main</emphasis></entry>
26807 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26808 <entry>Default: <emphasis>unset</emphasis></entry>
26814 <indexterm role="concept">
26815 <primary>TLS</primary>
26816 <secondary>D-H parameters for server</secondary>
26818 The value of this option is expanded, and must then be the absolute path to
26819 a file which contains the server’s DH parameter values.
26820 This is used only for OpenSSL. When Exim is linked with GnuTLS, this option is
26821 ignored. See section <xref linkend="SECTopenvsgnu"/> for further details.
26824 <indexterm role="option">
26825 <primary>tls_on_connect_ports</primary>
26828 <informaltable frame="all">
26829 <tgroup cols="4" colsep="0" rowsep="0">
26830 <colspec colwidth="8*" align="left"/>
26831 <colspec colwidth="5*" align="center"/>
26832 <colspec colwidth="5*" align="center"/>
26833 <colspec colwidth="6*" align="right"/>
26836 <entry><option>tls_on_connect_ports</option></entry>
26837 <entry>Use: <emphasis>main</emphasis></entry>
26838 <entry>Type: <emphasis>string list</emphasis></entry>
26839 <entry>Default: <emphasis>unset</emphasis></entry>
26845 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
26846 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
26847 set up without waiting for the client to issue a STARTTLS command. For
26848 further details, see section <xref linkend="SECTsupobssmt"/>.
26851 <indexterm role="option">
26852 <primary>tls_privatekey</primary>
26855 <informaltable frame="all">
26856 <tgroup cols="4" colsep="0" rowsep="0">
26857 <colspec colwidth="8*" align="left"/>
26858 <colspec colwidth="5*" align="center"/>
26859 <colspec colwidth="5*" align="center"/>
26860 <colspec colwidth="6*" align="right"/>
26863 <entry><option>tls_privatekey</option></entry>
26864 <entry>Use: <emphasis>main</emphasis></entry>
26865 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26866 <entry>Default: <emphasis>unset</emphasis></entry>
26872 <indexterm role="concept">
26873 <primary>TLS</primary>
26874 <secondary>server private key; location of</secondary>
26876 The value of this option is expanded, and must then be the absolute path to a
26877 file which contains the server’s private key. If this option is unset, or if
26878 the expansion is forced to fail, or the result is an empty string, the private
26879 key is assumed to be in the same file as the server’s certificates. See chapter
26880 <xref linkend="CHAPTLS"/> for further details.
26883 <indexterm role="option">
26884 <primary>tls_remember_esmtp</primary>
26887 <informaltable frame="all">
26888 <tgroup cols="4" colsep="0" rowsep="0">
26889 <colspec colwidth="8*" align="left"/>
26890 <colspec colwidth="5*" align="center"/>
26891 <colspec colwidth="5*" align="center"/>
26892 <colspec colwidth="6*" align="right"/>
26895 <entry><option>tls_remember_esmtp</option></entry>
26896 <entry>Use: <emphasis>main</emphasis></entry>
26897 <entry>Type: <emphasis>boolean</emphasis></entry>
26898 <entry>Default: <emphasis>false</emphasis></entry>
26904 <indexterm role="concept">
26905 <primary>TLS</primary>
26906 <secondary>esmtp state; remembering</secondary>
26908 <indexterm role="concept">
26909 <primary>TLS</primary>
26910 <secondary>broken clients</secondary>
26912 If this option is set true, Exim violates the RFCs by remembering that it is in
26913 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
26914 support for broken clients that fail to send a new EHLO after starting a
26918 <indexterm role="option">
26919 <primary>tls_require_ciphers</primary>
26922 <informaltable frame="all">
26923 <tgroup cols="4" colsep="0" rowsep="0">
26924 <colspec colwidth="8*" align="left"/>
26925 <colspec colwidth="5*" align="center"/>
26926 <colspec colwidth="5*" align="center"/>
26927 <colspec colwidth="6*" align="right"/>
26930 <entry><option>tls_require_ciphers</option></entry>
26931 <entry>Use: <emphasis>main</emphasis></entry>
26932 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26933 <entry>Default: <emphasis>unset</emphasis></entry>
26939 <indexterm role="concept">
26940 <primary>TLS</primary>
26941 <secondary>requiring specific ciphers</secondary>
26943 <indexterm role="concept">
26944 <primary>cipher</primary>
26945 <secondary>requiring specific</secondary>
26947 This option controls which ciphers can be used for incoming TLS connections.
26948 The <command>smtp</command> transport has an option of the same name for controlling outgoing
26949 connections. This option is expanded for each connection, so can be varied for
26950 different clients if required. The value of this option must be a list of
26951 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
26952 in somewhat different ways. If GnuTLS is being used, the client controls the
26953 preference order of the available ciphers. Details are given in sections
26954 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
26957 <indexterm role="option">
26958 <primary>tls_try_verify_hosts</primary>
26961 <informaltable frame="all">
26962 <tgroup cols="4" colsep="0" rowsep="0">
26963 <colspec colwidth="8*" align="left"/>
26964 <colspec colwidth="5*" align="center"/>
26965 <colspec colwidth="5*" align="center"/>
26966 <colspec colwidth="6*" align="right"/>
26969 <entry><option>tls_try_verify_hosts</option></entry>
26970 <entry>Use: <emphasis>main</emphasis></entry>
26971 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
26972 <entry>Default: <emphasis>unset</emphasis></entry>
26978 <indexterm role="concept">
26979 <primary>TLS</primary>
26980 <secondary>client certificate verification</secondary>
26982 <indexterm role="concept">
26983 <primary>certificate</primary>
26984 <secondary>verification of client</secondary>
26986 See <option>tls_verify_hosts</option> below.
26989 <indexterm role="option">
26990 <primary>tls_verify_certificates</primary>
26993 <informaltable frame="all">
26994 <tgroup cols="4" colsep="0" rowsep="0">
26995 <colspec colwidth="8*" align="left"/>
26996 <colspec colwidth="5*" align="center"/>
26997 <colspec colwidth="5*" align="center"/>
26998 <colspec colwidth="6*" align="right"/>
27001 <entry><option>tls_verify_certificates</option></entry>
27002 <entry>Use: <emphasis>main</emphasis></entry>
27003 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27004 <entry>Default: <emphasis>unset</emphasis></entry>
27010 <indexterm role="concept">
27011 <primary>TLS</primary>
27012 <secondary>client certificate verification</secondary>
27014 <indexterm role="concept">
27015 <primary>certificate</primary>
27016 <secondary>verification of client</secondary>
27018 The value of this option is expanded, and must then be the absolute path to
27019 a file containing permitted certificates for clients that
27020 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>. Alternatively, if you
27021 are using OpenSSL, you can set <option>tls_verify_certificates</option> to the name of a
27022 directory containing certificate files. This does not work with GnuTLS; the
27023 option must be set to the name of a single file if you are using GnuTLS.
27026 <indexterm role="option">
27027 <primary>tls_verify_hosts</primary>
27030 <informaltable frame="all">
27031 <tgroup cols="4" colsep="0" rowsep="0">
27032 <colspec colwidth="8*" align="left"/>
27033 <colspec colwidth="5*" align="center"/>
27034 <colspec colwidth="5*" align="center"/>
27035 <colspec colwidth="6*" align="right"/>
27038 <entry><option>tls_verify_hosts</option></entry>
27039 <entry>Use: <emphasis>main</emphasis></entry>
27040 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
27041 <entry>Default: <emphasis>unset</emphasis></entry>
27047 <indexterm role="concept">
27048 <primary>TLS</primary>
27049 <secondary>client certificate verification</secondary>
27051 <indexterm role="concept">
27052 <primary>certificate</primary>
27053 <secondary>verification of client</secondary>
27055 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
27056 certificates from clients.
27057 The expected certificates are defined by <option>tls_verify_certificates</option>, which
27058 must be set. A configuration error occurs if either <option>tls_verify_hosts</option> or
27059 <option>tls_try_verify_hosts</option> is set and <option>tls_verify_certificates</option> is not set.
27062 Any client that matches <option>tls_verify_hosts</option> is constrained by
27063 <option>tls_verify_certificates</option>. The client must present one of the listed
27064 certificates. If it does not, the connection is aborted.
27067 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
27068 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
27069 certificate and checks it against <option>tls_verify_certificates</option>, but does not
27070 abort the connection if there is no certificate or if it does not match. This
27071 state can be detected in an ACL, which makes it possible to implement policies
27072 such as <quote>accept for relay only if a verified certificate has been received,
27073 but accept for local delivery if encrypted, even without a verified
27074 certificate</quote>.
27077 Client hosts that match neither of these lists are not asked to present
27081 <indexterm role="option">
27082 <primary>trusted_groups</primary>
27085 <informaltable frame="all">
27086 <tgroup cols="4" colsep="0" rowsep="0">
27087 <colspec colwidth="8*" align="left"/>
27088 <colspec colwidth="5*" align="center"/>
27089 <colspec colwidth="5*" align="center"/>
27090 <colspec colwidth="6*" align="right"/>
27093 <entry><option>trusted_groups</option></entry>
27094 <entry>Use: <emphasis>main</emphasis></entry>
27095 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
27096 <entry>Default: <emphasis>unset</emphasis></entry>
27102 <indexterm role="concept">
27103 <primary>trusted group</primary>
27105 <indexterm role="concept">
27106 <primary>group</primary>
27107 <secondary>trusted</secondary>
27109 This option is expanded just once, at the start of Exim’s processing. If this
27110 option is set, any process that is running in one of the listed groups, or
27111 which has one of them as a supplementary group, is trusted. The groups can be
27112 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
27113 details of what trusted callers are permitted to do. If neither
27114 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
27118 <indexterm role="option">
27119 <primary>trusted_users</primary>
27122 <informaltable frame="all">
27123 <tgroup cols="4" colsep="0" rowsep="0">
27124 <colspec colwidth="8*" align="left"/>
27125 <colspec colwidth="5*" align="center"/>
27126 <colspec colwidth="5*" align="center"/>
27127 <colspec colwidth="6*" align="right"/>
27130 <entry><option>trusted_users</option></entry>
27131 <entry>Use: <emphasis>main</emphasis></entry>
27132 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
27133 <entry>Default: <emphasis>unset</emphasis></entry>
27139 <indexterm role="concept">
27140 <primary>trusted user</primary>
27142 <indexterm role="concept">
27143 <primary>user</primary>
27144 <secondary>trusted</secondary>
27146 This option is expanded just once, at the start of Exim’s processing. If this
27147 option is set, any process that is running as one of the listed users is
27148 trusted. The users can be specified numerically or by name. See section
27149 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
27150 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
27151 Exim user are trusted.
27154 <indexterm role="option">
27155 <primary>unknown_login</primary>
27158 <informaltable frame="all">
27159 <tgroup cols="4" colsep="0" rowsep="0">
27160 <colspec colwidth="8*" align="left"/>
27161 <colspec colwidth="5*" align="center"/>
27162 <colspec colwidth="5*" align="center"/>
27163 <colspec colwidth="6*" align="right"/>
27166 <entry><option>unknown_login</option></entry>
27167 <entry>Use: <emphasis>main</emphasis></entry>
27168 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27169 <entry>Default: <emphasis>unset</emphasis></entry>
27175 <indexterm role="concept">
27176 <primary>uid (user id)</primary>
27177 <secondary>unknown caller</secondary>
27179 <indexterm role="concept">
27180 <primary><varname>$caller_uid</varname></primary>
27182 This is a specialized feature for use in unusual configurations. By default, if
27183 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
27184 gives up. The <option>unknown_login</option> option can be used to set a login name to be
27185 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
27186 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
27187 is used for the user’s real name (gecos field), unless this has been set by the
27188 <option>-F</option> option.
27191 <indexterm role="option">
27192 <primary>unknown_username</primary>
27195 <informaltable frame="all">
27196 <tgroup cols="4" colsep="0" rowsep="0">
27197 <colspec colwidth="8*" align="left"/>
27198 <colspec colwidth="5*" align="center"/>
27199 <colspec colwidth="5*" align="center"/>
27200 <colspec colwidth="6*" align="right"/>
27203 <entry><option>unknown_username</option></entry>
27204 <entry>Use: <emphasis>main</emphasis></entry>
27205 <entry>Type: <emphasis>string</emphasis></entry>
27206 <entry>Default: <emphasis>unset</emphasis></entry>
27212 See <option>unknown_login</option>.
27215 <indexterm role="option">
27216 <primary>untrusted_set_sender</primary>
27219 <informaltable frame="all">
27220 <tgroup cols="4" colsep="0" rowsep="0">
27221 <colspec colwidth="8*" align="left"/>
27222 <colspec colwidth="5*" align="center"/>
27223 <colspec colwidth="5*" align="center"/>
27224 <colspec colwidth="6*" align="right"/>
27227 <entry><option>untrusted_set_sender</option></entry>
27228 <entry>Use: <emphasis>main</emphasis></entry>
27229 <entry>Type: <emphasis>address list</emphasis>†<emphasis></emphasis></entry>
27230 <entry>Default: <emphasis>unset</emphasis></entry>
27236 <indexterm role="concept">
27237 <primary>trusted user</primary>
27239 <indexterm role="concept">
27240 <primary>sender</primary>
27241 <secondary>setting by untrusted user</secondary>
27243 <indexterm role="concept">
27244 <primary>untrusted user</primary>
27245 <secondary>setting sender</secondary>
27247 <indexterm role="concept">
27248 <primary>user</primary>
27249 <secondary>untrusted setting sender</secondary>
27251 <indexterm role="concept">
27252 <primary>envelope sender</primary>
27254 When an untrusted user submits a message to Exim using the standard input, Exim
27255 normally creates an envelope sender address from the user’s login and the
27256 default qualification domain. Data from the <option>-f</option> option (for setting envelope
27257 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
27258 is used) is ignored.
27261 However, untrusted users are permitted to set an empty envelope sender address,
27262 to declare that a message should never generate any bounces. For example:
27264 <literallayout class="monospaced">
27265 exim -f '<>' user@domain.example
27268 <indexterm role="concept">
27269 <primary><varname>$sender_ident</varname></primary>
27271 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
27272 other envelope sender addresses in a controlled way. When it is set, untrusted
27273 users are allowed to set envelope sender addresses that match any of the
27274 patterns in the list. Like all address lists, the string is expanded. The
27275 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
27276 users to setting senders that start with their login ids
27277 followed by a hyphen
27278 by a setting like this:
27280 <literallayout class="monospaced">
27281 untrusted_set_sender = ^$sender_ident-
27284 If you want to allow untrusted users to set envelope sender addresses without
27285 restriction, you can use
27287 <literallayout class="monospaced">
27288 untrusted_set_sender = *
27291 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
27292 only to the setting of the envelope sender. It does not permit untrusted users
27293 to use the other options which trusted user can use to override message
27294 parameters. Furthermore, it does not stop Exim from removing an existing
27295 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
27296 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
27297 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
27298 described in section <xref linkend="SECTthesenhea"/>.
27301 The log line for a message’s arrival shows the envelope sender following
27302 <quote><=</quote>. For local messages, the user’s login always follows, after <quote>U=</quote>. In
27303 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
27304 envelope sender address, the user’s login is shown in parentheses after the
27308 <indexterm role="option">
27309 <primary>uucp_from_pattern</primary>
27312 <informaltable frame="all">
27313 <tgroup cols="4" colsep="0" rowsep="0">
27314 <colspec colwidth="8*" align="left"/>
27315 <colspec colwidth="5*" align="center"/>
27316 <colspec colwidth="5*" align="center"/>
27317 <colspec colwidth="6*" align="right"/>
27320 <entry><option>uucp_from_pattern</option></entry>
27321 <entry>Use: <emphasis>main</emphasis></entry>
27322 <entry>Type: <emphasis>string</emphasis></entry>
27323 <entry>Default: <emphasis>see below</emphasis></entry>
27329 <indexterm role="concept">
27330 <primary><quote>From</quote> line</primary>
27332 <indexterm role="concept">
27333 <primary>UUCP</primary>
27334 <secondary><quote>From</quote> line</secondary>
27336 Some applications that pass messages to an MTA via a command line interface use
27337 an initial line starting with <quote>From </quote> to pass the envelope sender. In
27338 particular, this is used by UUCP software. Exim recognizes such a line by means
27339 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
27340 matches, the sender address is constructed by expanding the contents of
27341 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
27342 default pattern recognizes lines in the following two forms:
27344 <literallayout class="monospaced">
27345 From ph10 Fri Jan 5 12:35 GMT 1996
27346 From ph10 Fri, 7 Jan 97 14:00:00 GMT
27349 The pattern can be seen by running
27351 <literallayout class="monospaced">
27352 exim -bP uucp_from_pattern
27355 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
27356 year in the second case. The first word after <quote>From </quote> is matched in the
27357 regular expression by a parenthesized subpattern. The default value for
27358 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
27359 (<quote>ph10</quote> in the example above) as the message’s sender. See also
27360 <option>ignore_fromline_hosts</option>.
27363 <indexterm role="option">
27364 <primary>uucp_from_sender</primary>
27367 <informaltable frame="all">
27368 <tgroup cols="4" colsep="0" rowsep="0">
27369 <colspec colwidth="8*" align="left"/>
27370 <colspec colwidth="5*" align="center"/>
27371 <colspec colwidth="5*" align="center"/>
27372 <colspec colwidth="6*" align="right"/>
27375 <entry><option>uucp_from_sender</option></entry>
27376 <entry>Use: <emphasis>main</emphasis></entry>
27377 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27378 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
27384 See <option>uucp_from_pattern</option> above.
27387 <indexterm role="option">
27388 <primary>warn_message_file</primary>
27391 <informaltable frame="all">
27392 <tgroup cols="4" colsep="0" rowsep="0">
27393 <colspec colwidth="8*" align="left"/>
27394 <colspec colwidth="5*" align="center"/>
27395 <colspec colwidth="5*" align="center"/>
27396 <colspec colwidth="6*" align="right"/>
27399 <entry><option>warn_message_file</option></entry>
27400 <entry>Use: <emphasis>main</emphasis></entry>
27401 <entry>Type: <emphasis>string</emphasis></entry>
27402 <entry>Default: <emphasis>unset</emphasis></entry>
27408 <indexterm role="concept">
27409 <primary>warning of delay</primary>
27410 <secondary>customizing the message</secondary>
27412 <indexterm role="concept">
27413 <primary>customizing</primary>
27414 <secondary>warning message</secondary>
27416 This option defines a template file containing paragraphs of text to be used
27417 for constructing the warning message which is sent by Exim when a message has
27418 been on the queue for a specified amount of time, as specified by
27419 <option>delay_warning</option>. Details of the file’s contents are given in chapter
27420 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
27423 <indexterm role="option">
27424 <primary>write_rejectlog</primary>
27427 <informaltable frame="all">
27428 <tgroup cols="4" colsep="0" rowsep="0">
27429 <colspec colwidth="8*" align="left"/>
27430 <colspec colwidth="5*" align="center"/>
27431 <colspec colwidth="5*" align="center"/>
27432 <colspec colwidth="6*" align="right"/>
27435 <entry><option>write_rejectlog</option></entry>
27436 <entry>Use: <emphasis>main</emphasis></entry>
27437 <entry>Type: <emphasis>boolean</emphasis></entry>
27438 <entry>Default: <emphasis>true</emphasis></entry>
27444 <indexterm role="concept">
27445 <primary>reject log</primary>
27446 <secondary>disabling</secondary>
27448 If this option is set false, Exim no longer writes anything to the reject log.
27449 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
27450 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
27451 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
27456 <chapter id="CHAProutergeneric">
27457 <title>Generic options for routers</title>
27459 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
27460 <primary>options</primary>
27461 <secondary>generic; for routers</secondary>
27463 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
27464 <primary>generic options</primary>
27465 <secondary>router</secondary>
27467 This chapter describes the generic options that apply to all routers.
27468 Those that are preconditions are marked with ‡ in the <quote>use</quote> field.
27471 For a general description of how a router operates, see sections
27472 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
27473 which the preconditions are tested. The order of expansion of the options that
27474 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
27475 <option>headers_remove</option>, <option>transport</option>.
27478 <indexterm role="option">
27479 <primary>address_data</primary>
27482 <informaltable frame="all">
27483 <tgroup cols="4" colsep="0" rowsep="0">
27484 <colspec colwidth="8*" align="left"/>
27485 <colspec colwidth="5*" align="center"/>
27486 <colspec colwidth="5*" align="center"/>
27487 <colspec colwidth="6*" align="right"/>
27490 <entry><option>address_data</option></entry>
27491 <entry>Use: <emphasis>routers</emphasis></entry>
27492 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27493 <entry>Default: <emphasis>unset</emphasis></entry>
27499 <indexterm role="concept">
27500 <primary>router</primary>
27501 <secondary>data attached to address</secondary>
27503 The string is expanded just before the router is run, that is, after all the
27504 precondition tests have succeeded. If the expansion is forced to fail, the
27505 router declines, the value of <option>address_data</option> remains unchanged, and the
27506 <option>more</option> option controls what happens next. Other expansion failures cause
27507 delivery of the address to be deferred.
27510 <indexterm role="concept">
27511 <primary><varname>$address_data</varname></primary>
27513 When the expansion succeeds, the value is retained with the address, and can be
27514 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
27515 routers, and the eventual transport.
27518 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
27519 that runs a user’s filter file, the contents of <varname>$address_data</varname> are accessible
27520 in the filter. This is not normally a problem, because such data is usually
27521 either not confidential or it <quote>belongs</quote> to the current user, but if you do
27522 put confidential data into <varname>$address_data</varname> you need to remember this point.
27525 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
27526 with the address, though it can be changed by another <option>address_data</option> setting
27527 on a subsequent router. If a router generates child addresses, the value of
27528 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
27529 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
27532 The idea of <option>address_data</option> is that you can use it to look up a lot of data
27533 for the address once, and then pick out parts of the data later. For example,
27534 you could use a single LDAP lookup to return a string of the form
27536 <literallayout class="monospaced">
27537 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
27540 In the transport you could pick out the mailbox by a setting such as
27542 <literallayout class="monospaced">
27543 file = ${extract{mailbox}{$address_data}}
27546 This makes the configuration file less messy, and also reduces the number of
27547 lookups (though Exim does cache lookups).
27550 The <option>address_data</option> facility is also useful as a means of passing information
27551 from one router to another, and from a router to a transport. In addition, if
27554 <indexterm role="concept">
27555 <primary><varname>$sender_address_data</varname></primary>
27557 <indexterm role="concept">
27558 <primary><varname>$address_data</varname></primary>
27560 When <varname>$address_data</varname> is set by a router when verifying a recipient address
27561 from an ACL, it remains available for use in the rest of the ACL statement.
27562 After verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
27565 <indexterm role="option">
27566 <primary>address_test</primary>
27569 <informaltable frame="all">
27570 <tgroup cols="4" colsep="0" rowsep="0">
27571 <colspec colwidth="8*" align="left"/>
27572 <colspec colwidth="5*" align="center"/>
27573 <colspec colwidth="5*" align="center"/>
27574 <colspec colwidth="6*" align="right"/>
27577 <entry><option>address_test</option></entry>
27578 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
27579 <entry>Type: <emphasis>boolean</emphasis></entry>
27580 <entry>Default: <emphasis>true</emphasis></entry>
27586 <indexterm role="concept">
27587 <primary><option>-bt</option> option</primary>
27589 <indexterm role="concept">
27590 <primary>router</primary>
27591 <secondary>skipping when address testing</secondary>
27593 If this option is set false, the router is skipped when routing is being tested
27594 by means of the <option>-bt</option> command line option. This can be a convenience when
27595 your first router sends messages to an external scanner, because it saves you
27596 having to set the <quote>already scanned</quote> indicator when testing real address
27600 <indexterm role="option">
27601 <primary>cannot_route_message</primary>
27604 <informaltable frame="all">
27605 <tgroup cols="4" colsep="0" rowsep="0">
27606 <colspec colwidth="8*" align="left"/>
27607 <colspec colwidth="5*" align="center"/>
27608 <colspec colwidth="5*" align="center"/>
27609 <colspec colwidth="6*" align="right"/>
27612 <entry><option>cannot_route_message</option></entry>
27613 <entry>Use: <emphasis>routers</emphasis></entry>
27614 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27615 <entry>Default: <emphasis>unset</emphasis></entry>
27621 <indexterm role="concept">
27622 <primary>router</primary>
27623 <secondary>customizing <quote>cannot route</quote> message</secondary>
27625 <indexterm role="concept">
27626 <primary>customizing</primary>
27627 <secondary><quote>cannot route</quote> message</secondary>
27629 This option specifies a text message that is used when an address cannot be
27630 routed because Exim has run out of routers. The default message is
27631 <quote>Unrouteable address</quote>. This option is useful only on routers that have
27632 <option>more</option> set false, or on the very last router in a configuration, because the
27633 value that is used is taken from the last router that is considered. This
27634 includes a router that is skipped because its preconditions are not met, as
27635 well as a router that declines. For example, using the default configuration,
27638 <literallayout class="monospaced">
27639 cannot_route_message = Remote domain not found in DNS
27642 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
27645 <literallayout class="monospaced">
27646 cannot_route_message = Unknown local user
27649 on the final router that checks for local users. If string expansion fails for
27650 this option, the default message is used. Unless the expansion failure was
27651 explicitly forced, a message about the failure is written to the main and panic
27652 logs, in addition to the normal message about the routing failure.
27655 <indexterm role="option">
27656 <primary>caseful_local_part</primary>
27659 <informaltable frame="all">
27660 <tgroup cols="4" colsep="0" rowsep="0">
27661 <colspec colwidth="8*" align="left"/>
27662 <colspec colwidth="5*" align="center"/>
27663 <colspec colwidth="5*" align="center"/>
27664 <colspec colwidth="6*" align="right"/>
27667 <entry><option>caseful_local_part</option></entry>
27668 <entry>Use: <emphasis>routers</emphasis></entry>
27669 <entry>Type: <emphasis>boolean</emphasis></entry>
27670 <entry>Default: <emphasis>false</emphasis></entry>
27676 <indexterm role="concept">
27677 <primary>case of local parts</primary>
27679 <indexterm role="concept">
27680 <primary>router</primary>
27681 <secondary>case of local parts</secondary>
27683 By default, routers handle the local parts of addresses in a case-insensitive
27684 manner, though the actual case is preserved for transmission with the message.
27685 If you want the case of letters to be significant in a router, you must set
27686 this option true. For individual router options that contain address or local
27687 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
27688 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
27692 <indexterm role="concept">
27693 <primary><varname>$local_part</varname></primary>
27695 <indexterm role="concept">
27696 <primary><varname>$original_local_part</varname></primary>
27698 <indexterm role="concept">
27699 <primary><varname>$parent_local_part</varname></primary>
27701 The value of the <varname>$local_part</varname> variable is forced to lower case while a
27702 router is running unless <option>caseful_local_part</option> is set. When a router assigns
27703 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
27704 is the same as it was in the router. Similarly, when a router generates child
27705 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
27706 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
27709 This option applies to the processing of an address by a router. When a
27710 recipient address is being processed in an ACL, there is a separate <option>control</option>
27711 modifier that can be used to specify case-sensitive processing within the ACL
27712 (see section <xref linkend="SECTcontrols"/>).
27715 <indexterm role="option">
27716 <primary>check_local_user</primary>
27719 <informaltable frame="all">
27720 <tgroup cols="4" colsep="0" rowsep="0">
27721 <colspec colwidth="8*" align="left"/>
27722 <colspec colwidth="5*" align="center"/>
27723 <colspec colwidth="5*" align="center"/>
27724 <colspec colwidth="6*" align="right"/>
27727 <entry><option>check_local_user</option></entry>
27728 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
27729 <entry>Type: <emphasis>boolean</emphasis></entry>
27730 <entry>Default: <emphasis>false</emphasis></entry>
27736 <indexterm role="concept">
27737 <primary>local user</primary>
27738 <secondary>checking in router</secondary>
27740 <indexterm role="concept">
27741 <primary>router</primary>
27742 <secondary>checking for local user</secondary>
27744 <indexterm role="concept">
27745 <primary><filename>/etc/passwd</filename></primary>
27747 <indexterm role="concept">
27748 <primary><varname>$home</varname></primary>
27750 When this option is true, Exim checks that the local part of the recipient
27751 address (with affixes removed if relevant) is the name of an account on the
27752 local system. The check is done by calling the <function>getpwnam()</function> function rather
27753 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
27754 holding password data (such as NIS) are supported. If the local part is a local
27755 user, <varname>$home</varname> is set from the password data, and can be tested in other
27756 preconditions that are evaluated after this one (the order of evaluation is
27757 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
27758 overridden by <option>router_home_directory</option>. If the local part is not a local user,
27759 the router is skipped.
27762 If you want to check that the local part is either the name of a local user
27763 or matches something else, you cannot combine <option>check_local_user</option> with a
27764 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
27765 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
27766 setting to achieve this. For example:
27768 <literallayout class="monospaced">
27769 local_parts = passwd;$local_part : lsearch;/etc/other/users
27772 Note, however, that the side effects of <option>check_local_user</option> (such as setting
27773 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
27774 <option>local_parts</option> (or any other) precondition.
27777 <indexterm role="option">
27778 <primary>condition</primary>
27781 <informaltable frame="all">
27782 <tgroup cols="4" colsep="0" rowsep="0">
27783 <colspec colwidth="8*" align="left"/>
27784 <colspec colwidth="5*" align="center"/>
27785 <colspec colwidth="5*" align="center"/>
27786 <colspec colwidth="6*" align="right"/>
27789 <entry><option>condition</option></entry>
27790 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
27791 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27792 <entry>Default: <emphasis>unset</emphasis></entry>
27798 <indexterm role="concept">
27799 <primary>router</primary>
27800 <secondary>customized precondition</secondary>
27802 This option specifies a general precondition test that has to succeed for the
27803 router to be called. The <option>condition</option> option is the last precondition to be
27804 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
27805 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
27806 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
27807 router is skipped, and the address is offered to the next one.
27810 If the result is any other value, the router is run (as this is the last
27811 precondition to be evaluated, all the other preconditions must be true).
27814 The <option>condition</option> option provides a means of applying custom conditions to the
27815 running of routers. Note that in the case of a simple conditional expansion,
27816 the default expansion values are exactly what is wanted. For example:
27818 <literallayout class="monospaced">
27819 condition = ${if >{$message_age}{600}}
27822 Because of the default behaviour of the string expansion, this is equivalent to
27824 <literallayout class="monospaced">
27825 condition = ${if >{$message_age}{600}{true}{}}
27828 If the expansion fails (other than forced failure) delivery is deferred. Some
27829 of the other precondition options are common special cases that could in fact
27830 be specified using <option>condition</option>.
27833 <indexterm role="option">
27834 <primary>debug_print</primary>
27837 <informaltable frame="all">
27838 <tgroup cols="4" colsep="0" rowsep="0">
27839 <colspec colwidth="8*" align="left"/>
27840 <colspec colwidth="5*" align="center"/>
27841 <colspec colwidth="5*" align="center"/>
27842 <colspec colwidth="6*" align="right"/>
27845 <entry><option>debug_print</option></entry>
27846 <entry>Use: <emphasis>routers</emphasis></entry>
27847 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27848 <entry>Default: <emphasis>unset</emphasis></entry>
27854 <indexterm role="concept">
27855 <primary>testing</primary>
27856 <secondary>variables in drivers</secondary>
27858 If this option is set and debugging is enabled (see the <option>-d</option> command line
27859 option), the string is expanded and included in the debugging output.
27860 If expansion of the string fails, the error message is written to the debugging
27861 output, and Exim carries on processing.
27862 This option is provided to help with checking out the values of variables and
27863 so on when debugging router configurations. For example, if a <option>condition</option>
27864 option appears not to be working, <option>debug_print</option> can be used to output the
27865 variables it references. The output happens after checks for <option>domains</option>,
27866 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
27867 are tested. A newline is added to the text if it does not end with one.
27870 <indexterm role="option">
27871 <primary>disable_logging</primary>
27874 <informaltable frame="all">
27875 <tgroup cols="4" colsep="0" rowsep="0">
27876 <colspec colwidth="8*" align="left"/>
27877 <colspec colwidth="5*" align="center"/>
27878 <colspec colwidth="5*" align="center"/>
27879 <colspec colwidth="6*" align="right"/>
27882 <entry><option>disable_logging</option></entry>
27883 <entry>Use: <emphasis>routers</emphasis></entry>
27884 <entry>Type: <emphasis>boolean</emphasis></entry>
27885 <entry>Default: <emphasis>false</emphasis></entry>
27891 If this option is set true, nothing is logged for any routing errors
27892 or for any deliveries caused by this router. You should not set this option
27893 unless you really, really know what you are doing. See also the generic
27894 transport option of the same name.
27897 <indexterm role="option">
27898 <primary>domains</primary>
27901 <informaltable frame="all">
27902 <tgroup cols="4" colsep="0" rowsep="0">
27903 <colspec colwidth="8*" align="left"/>
27904 <colspec colwidth="5*" align="center"/>
27905 <colspec colwidth="5*" align="center"/>
27906 <colspec colwidth="6*" align="right"/>
27909 <entry><option>domains</option></entry>
27910 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
27911 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
27912 <entry>Default: <emphasis>unset</emphasis></entry>
27918 <indexterm role="concept">
27919 <primary>router</primary>
27920 <secondary>restricting to specific domains</secondary>
27922 <indexterm role="concept">
27923 <primary><varname>$domain_data</varname></primary>
27925 If this option is set, the router is skipped unless the current domain matches
27926 the list. If the match is achieved by means of a file lookup, the data that the
27927 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
27928 expansions of the driver’s private options. See section <xref linkend="SECTrouprecon"/> for
27929 a list of the order in which preconditions are evaluated.
27932 <indexterm role="option">
27933 <primary>driver</primary>
27936 <informaltable frame="all">
27937 <tgroup cols="4" colsep="0" rowsep="0">
27938 <colspec colwidth="8*" align="left"/>
27939 <colspec colwidth="5*" align="center"/>
27940 <colspec colwidth="5*" align="center"/>
27941 <colspec colwidth="6*" align="right"/>
27944 <entry><option>driver</option></entry>
27945 <entry>Use: <emphasis>routers</emphasis></entry>
27946 <entry>Type: <emphasis>string</emphasis></entry>
27947 <entry>Default: <emphasis>unset</emphasis></entry>
27953 This option must always be set. It specifies which of the available routers is
27957 <indexterm role="option">
27958 <primary>errors_to</primary>
27961 <informaltable frame="all">
27962 <tgroup cols="4" colsep="0" rowsep="0">
27963 <colspec colwidth="8*" align="left"/>
27964 <colspec colwidth="5*" align="center"/>
27965 <colspec colwidth="5*" align="center"/>
27966 <colspec colwidth="6*" align="right"/>
27969 <entry><option>errors_to</option></entry>
27970 <entry>Use: <emphasis>routers</emphasis></entry>
27971 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27972 <entry>Default: <emphasis>unset</emphasis></entry>
27978 <indexterm role="concept">
27979 <primary>envelope sender</primary>
27981 <indexterm role="concept">
27982 <primary>router</primary>
27983 <secondary>changing address for errors</secondary>
27985 If a router successfully handles an address, it may assign the address to a
27986 transport for delivery or it may generate child addresses. In both cases, if
27987 there is a delivery problem during later processing, the resulting bounce
27988 message is sent to the address that results from expanding this string,
27989 provided that the address verifies successfully. The <option>errors_to</option> option is
27990 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
27993 The <option>errors_to</option> setting associated with an address can be overridden if it
27994 subsequently passes through other routers that have their own <option>errors_to</option>
27995 settings, or if the message is delivered by a transport with a <option>return_path</option>
27999 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
28000 the expansion fails to verify, the errors address associated with the incoming
28001 address is used. At top level, this is the envelope sender. A non-forced
28002 expansion failure causes delivery to be deferred.
28005 If an address for which <option>errors_to</option> has been set ends up being delivered over
28006 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
28007 any bounces that are generated by other MTAs on the delivery route are also
28008 sent there. You can set <option>errors_to</option> to the empty string by either of these
28011 <literallayout class="monospaced">
28016 An expansion item that yields an empty string has the same effect. If you do
28017 this, a locally detected delivery error for addresses processed by this router
28018 no longer gives rise to a bounce message; the error is discarded. If the
28019 address is delivered to a remote host, the return path is set to <literal><></literal>, unless
28020 overridden by the <option>return_path</option> option on the transport.
28023 <indexterm role="concept">
28024 <primary><varname>$address_data</varname></primary>
28026 If for some reason you want to discard local errors, but use a non-empty
28027 MAIL command for remote delivery, you can preserve the original return
28028 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
28029 setting <option>return_path</option>.
28032 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
28033 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
28034 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
28037 <indexterm role="option">
28038 <primary>expn</primary>
28041 <informaltable frame="all">
28042 <tgroup cols="4" colsep="0" rowsep="0">
28043 <colspec colwidth="8*" align="left"/>
28044 <colspec colwidth="5*" align="center"/>
28045 <colspec colwidth="5*" align="center"/>
28046 <colspec colwidth="6*" align="right"/>
28049 <entry><option>expn</option></entry>
28050 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
28051 <entry>Type: <emphasis>boolean</emphasis></entry>
28052 <entry>Default: <emphasis>true</emphasis></entry>
28058 <indexterm role="concept">
28059 <primary>address</primary>
28060 <secondary>testing</secondary>
28062 <indexterm role="concept">
28063 <primary>testing</primary>
28064 <secondary>addresses</secondary>
28066 <indexterm role="concept">
28067 <primary>EXPN</primary>
28068 <secondary>router skipping</secondary>
28070 <indexterm role="concept">
28071 <primary>router</primary>
28072 <secondary>skipping for EXPN</secondary>
28074 If this option is turned off, the router is skipped when testing an address
28075 as a result of processing an SMTP EXPN command. You might, for example,
28076 want to turn it off on a router for users’ <filename>.forward</filename> files, while leaving it
28077 on for the system alias file.
28078 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
28082 The use of the SMTP EXPN command is controlled by an ACL (see chapter
28083 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
28084 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
28087 <indexterm role="option">
28088 <primary>fail_verify</primary>
28091 <informaltable frame="all">
28092 <tgroup cols="4" colsep="0" rowsep="0">
28093 <colspec colwidth="8*" align="left"/>
28094 <colspec colwidth="5*" align="center"/>
28095 <colspec colwidth="5*" align="center"/>
28096 <colspec colwidth="6*" align="right"/>
28099 <entry><option>fail_verify</option></entry>
28100 <entry>Use: <emphasis>routers</emphasis></entry>
28101 <entry>Type: <emphasis>boolean</emphasis></entry>
28102 <entry>Default: <emphasis>false</emphasis></entry>
28108 <indexterm role="concept">
28109 <primary>router</primary>
28110 <secondary>forcing verification failure</secondary>
28112 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
28113 <option>fail_verify_recipient</option> to the same value.
28116 <indexterm role="option">
28117 <primary>fail_verify_recipient</primary>
28120 <informaltable frame="all">
28121 <tgroup cols="4" colsep="0" rowsep="0">
28122 <colspec colwidth="8*" align="left"/>
28123 <colspec colwidth="5*" align="center"/>
28124 <colspec colwidth="5*" align="center"/>
28125 <colspec colwidth="6*" align="right"/>
28128 <entry><option>fail_verify_recipient</option></entry>
28129 <entry>Use: <emphasis>routers</emphasis></entry>
28130 <entry>Type: <emphasis>boolean</emphasis></entry>
28131 <entry>Default: <emphasis>false</emphasis></entry>
28137 If this option is true and an address is accepted by this router when
28138 verifying a recipient, verification fails.
28141 <indexterm role="option">
28142 <primary>fail_verify_sender</primary>
28145 <informaltable frame="all">
28146 <tgroup cols="4" colsep="0" rowsep="0">
28147 <colspec colwidth="8*" align="left"/>
28148 <colspec colwidth="5*" align="center"/>
28149 <colspec colwidth="5*" align="center"/>
28150 <colspec colwidth="6*" align="right"/>
28153 <entry><option>fail_verify_sender</option></entry>
28154 <entry>Use: <emphasis>routers</emphasis></entry>
28155 <entry>Type: <emphasis>boolean</emphasis></entry>
28156 <entry>Default: <emphasis>false</emphasis></entry>
28162 If this option is true and an address is accepted by this router when
28163 verifying a sender, verification fails.
28166 <indexterm role="option">
28167 <primary>fallback_hosts</primary>
28170 <informaltable frame="all">
28171 <tgroup cols="4" colsep="0" rowsep="0">
28172 <colspec colwidth="8*" align="left"/>
28173 <colspec colwidth="5*" align="center"/>
28174 <colspec colwidth="5*" align="center"/>
28175 <colspec colwidth="6*" align="right"/>
28178 <entry><option>fallback_hosts</option></entry>
28179 <entry>Use: <emphasis>routers</emphasis></entry>
28180 <entry>Type: <emphasis>string list</emphasis></entry>
28181 <entry>Default: <emphasis>unset</emphasis></entry>
28187 <indexterm role="concept">
28188 <primary>router</primary>
28189 <secondary>fallback hosts</secondary>
28191 <indexterm role="concept">
28192 <primary>fallback</primary>
28193 <secondary>hosts specified on router</secondary>
28195 String expansion is not applied to this option. The argument must be a
28196 colon-separated list of host names or IP addresses. The list separator can be
28197 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
28198 each name or address. In fact, the format of each item is exactly the same as
28199 defined for the list of hosts in a <command>manualroute</command> router (see section
28200 <xref linkend="SECTformatonehostitem"/>).
28203 If a router queues an address for a remote transport, this host list is
28204 associated with the address, and used instead of the transport’s fallback host
28205 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
28206 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
28207 transport for further details.
28210 <indexterm role="option">
28211 <primary>group</primary>
28214 <informaltable frame="all">
28215 <tgroup cols="4" colsep="0" rowsep="0">
28216 <colspec colwidth="8*" align="left"/>
28217 <colspec colwidth="5*" align="center"/>
28218 <colspec colwidth="5*" align="center"/>
28219 <colspec colwidth="6*" align="right"/>
28222 <entry><option>group</option></entry>
28223 <entry>Use: <emphasis>routers</emphasis></entry>
28224 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28225 <entry>Default: <emphasis>see below</emphasis></entry>
28231 <indexterm role="concept">
28232 <primary>gid (group id)</primary>
28233 <secondary>local delivery</secondary>
28235 <indexterm role="concept">
28236 <primary>local transports</primary>
28237 <secondary>uid and gid</secondary>
28239 <indexterm role="concept">
28240 <primary>transport</primary>
28241 <secondary>local</secondary>
28243 <indexterm role="concept">
28244 <primary>router</primary>
28245 <secondary>setting group</secondary>
28247 When a router queues an address for a transport, and the transport does not
28248 specify a group, the group given here is used when running the delivery
28250 The group may be specified numerically or by name. If expansion fails, the
28251 error is logged and delivery is deferred.
28252 The default is unset, unless <option>check_local_user</option> is set, when the default
28253 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
28254 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
28257 <indexterm role="option">
28258 <primary>headers_add</primary>
28261 <informaltable frame="all">
28262 <tgroup cols="4" colsep="0" rowsep="0">
28263 <colspec colwidth="8*" align="left"/>
28264 <colspec colwidth="5*" align="center"/>
28265 <colspec colwidth="5*" align="center"/>
28266 <colspec colwidth="6*" align="right"/>
28269 <entry><option>headers_add</option></entry>
28270 <entry>Use: <emphasis>routers</emphasis></entry>
28271 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28272 <entry>Default: <emphasis>unset</emphasis></entry>
28278 <indexterm role="concept">
28279 <primary>header lines</primary>
28280 <secondary>adding</secondary>
28282 <indexterm role="concept">
28283 <primary>router</primary>
28284 <secondary>adding header lines</secondary>
28286 This option specifies a string of text that is expanded at routing time, and
28287 associated with any addresses that are accepted by the router. However, this
28288 option has no effect when an address is just being verified. The way in which
28289 the text is used to add header lines at transport time is described in section
28290 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
28291 message is in the process of being transported. This means that references to
28292 header lines in string expansions in the transport’s configuration do not
28293 <quote>see</quote> the added header lines.
28296 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
28297 <option>headers_remove</option> and <option>transport</option>. If the expanded string is empty, or if
28298 the expansion is forced to fail, the option has no effect. Other expansion
28299 failures are treated as configuration errors.
28302 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
28303 router that has the <option>one_time</option> option set.
28306 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
28307 additions are deleted when the address is passed on to subsequent routers.
28310 <indexterm role="option">
28311 <primary>headers_remove</primary>
28314 <informaltable frame="all">
28315 <tgroup cols="4" colsep="0" rowsep="0">
28316 <colspec colwidth="8*" align="left"/>
28317 <colspec colwidth="5*" align="center"/>
28318 <colspec colwidth="5*" align="center"/>
28319 <colspec colwidth="6*" align="right"/>
28322 <entry><option>headers_remove</option></entry>
28323 <entry>Use: <emphasis>routers</emphasis></entry>
28324 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28325 <entry>Default: <emphasis>unset</emphasis></entry>
28331 <indexterm role="concept">
28332 <primary>header lines</primary>
28333 <secondary>removing</secondary>
28335 <indexterm role="concept">
28336 <primary>router</primary>
28337 <secondary>removing header lines</secondary>
28339 This option specifies a string of text that is expanded at routing time, and
28340 associated with any addresses that are accepted by the router. However, this
28341 option has no effect when an address is just being verified. The way in which
28342 the text is used to remove header lines at transport time is described in
28343 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
28344 the message is in the process of being transported. This means that references
28345 to header lines in string expansions in the transport’s configuration still
28346 <quote>see</quote> the original header lines.
28349 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
28350 <option>headers_add</option>, but before <option>transport</option>. If the expansion is forced to fail,
28351 the option has no effect. Other expansion failures are treated as configuration
28355 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
28356 router that has the <option>one_time</option> option set.
28359 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
28360 removal requests are deleted when the address is passed on to subsequent
28364 <indexterm role="option">
28365 <primary>ignore_target_hosts</primary>
28368 <informaltable frame="all">
28369 <tgroup cols="4" colsep="0" rowsep="0">
28370 <colspec colwidth="8*" align="left"/>
28371 <colspec colwidth="5*" align="center"/>
28372 <colspec colwidth="5*" align="center"/>
28373 <colspec colwidth="6*" align="right"/>
28376 <entry><option>ignore_target_hosts</option></entry>
28377 <entry>Use: <emphasis>routers</emphasis></entry>
28378 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
28379 <entry>Default: <emphasis>unset</emphasis></entry>
28385 <indexterm role="concept">
28386 <primary>IP address</primary>
28387 <secondary>discarding</secondary>
28389 <indexterm role="concept">
28390 <primary>router</primary>
28391 <secondary>discarding IP addresses</secondary>
28393 Although this option is a host list, it should normally contain IP address
28394 entries rather than names. If any host that is looked up by the router has an
28395 IP address that matches an item in this list, Exim behaves as if that IP
28396 address did not exist. This option allows you to cope with rogue DNS entries
28399 <literallayout class="monospaced">
28400 remote.domain.example. A 127.0.0.1
28405 <literallayout class="monospaced">
28406 ignore_target_hosts = 127.0.0.1
28409 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
28410 discarded in this way, the router declines. In a conventional configuration, an
28411 attempt to mail to such a domain would normally provoke the <quote>unrouteable
28412 domain</quote> error, and an attempt to verify an address in the domain would fail.
28413 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
28414 router declines if presented with one of the listed addresses.
28417 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
28418 means of the first or the second of the following settings, respectively:
28420 <literallayout class="monospaced">
28421 ignore_target_hosts = 0.0.0.0/0
28422 ignore_target_hosts = <; 0::0/0
28425 The pattern in the first line matches all IPv4 addresses, whereas the pattern
28426 in the second line matches all IPv6 addresses.
28429 This option may also be useful for ignoring link-local and site-local IPv6
28430 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
28431 is expanded before use as a list, it is possible to make it dependent on the
28432 domain that is being routed.
28435 <indexterm role="concept">
28436 <primary><varname>$host_address</varname></primary>
28438 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
28442 <indexterm role="option">
28443 <primary>initgroups</primary>
28446 <informaltable frame="all">
28447 <tgroup cols="4" colsep="0" rowsep="0">
28448 <colspec colwidth="8*" align="left"/>
28449 <colspec colwidth="5*" align="center"/>
28450 <colspec colwidth="5*" align="center"/>
28451 <colspec colwidth="6*" align="right"/>
28454 <entry><option>initgroups</option></entry>
28455 <entry>Use: <emphasis>routers</emphasis></entry>
28456 <entry>Type: <emphasis>boolean</emphasis></entry>
28457 <entry>Default: <emphasis>false</emphasis></entry>
28463 <indexterm role="concept">
28464 <primary>additional groups</primary>
28466 <indexterm role="concept">
28467 <primary>groups</primary>
28468 <secondary>additional</secondary>
28470 <indexterm role="concept">
28471 <primary>local transports</primary>
28472 <secondary>uid and gid</secondary>
28474 <indexterm role="concept">
28475 <primary>transport</primary>
28476 <secondary>local</secondary>
28478 If the router queues an address for a transport, and this option is true, and
28479 the uid supplied by the router is not overridden by the transport, the
28480 <function>initgroups()</function> function is called when running the transport to ensure that
28481 any additional groups associated with the uid are set up. See also <option>group</option>
28482 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
28485 <indexterm role="option">
28486 <primary>local_part_prefix</primary>
28489 <informaltable frame="all">
28490 <tgroup cols="4" colsep="0" rowsep="0">
28491 <colspec colwidth="8*" align="left"/>
28492 <colspec colwidth="5*" align="center"/>
28493 <colspec colwidth="5*" align="center"/>
28494 <colspec colwidth="6*" align="right"/>
28497 <entry><option>local_part_prefix</option></entry>
28498 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
28499 <entry>Type: <emphasis>string list</emphasis></entry>
28500 <entry>Default: <emphasis>unset</emphasis></entry>
28506 <indexterm role="concept">
28507 <primary>router</primary>
28508 <secondary>prefix for local part</secondary>
28510 <indexterm role="concept">
28511 <primary>prefix</primary>
28512 <secondary>for local part; used in router</secondary>
28514 If this option is set, the router is skipped unless the local part starts with
28515 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
28516 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
28520 The list is scanned from left to right, and the first prefix that matches is
28521 used. A limited form of wildcard is available; if the prefix begins with an
28522 asterisk, it matches the longest possible sequence of arbitrary characters at
28523 the start of the local part. An asterisk should therefore always be followed by
28524 some character that does not occur in normal local parts.
28525 <indexterm role="concept">
28526 <primary>multiple mailboxes</primary>
28528 <indexterm role="concept">
28529 <primary>mailbox</primary>
28530 <secondary>multiple</secondary>
28532 Wildcarding can be used to set up multiple user mailboxes, as described in
28533 section <xref linkend="SECTmulbox"/>.
28536 <indexterm role="concept">
28537 <primary><varname>$local_part</varname></primary>
28539 <indexterm role="concept">
28540 <primary><varname>$local_part_prefix</varname></primary>
28542 During the testing of the <option>local_parts</option> option, and while the router is
28543 running, the prefix is removed from the local part, and is available in the
28544 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
28545 the router accepts the address, this remains true during subsequent delivery by
28546 a transport. In particular, the local part that is transmitted in the RCPT
28547 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
28548 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
28549 the relevant transport.
28552 When an address is being verified, <option>local_part_prefix</option> affects only the
28553 behaviour of the router. If the callout feature of verification is in use, this
28554 means that the full address, including the prefix, will be used during the
28558 The prefix facility is commonly used to handle local parts of the form
28559 <option>owner-something</option>. Another common use is to support local parts of the form
28560 <option>real-username</option> to bypass a user’s <filename>.forward</filename> file – helpful when trying
28561 to tell a user their forwarding is broken – by placing a router like this one
28562 immediately before the router that handles <filename>.forward</filename> files:
28564 <literallayout class="monospaced">
28567 local_part_prefix = real-
28569 transport = local_delivery
28572 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
28573 both conditions must be met if not optional. Care must be taken if wildcards
28574 are used in both a prefix and a suffix on the same router. Different
28575 separator characters must be used to avoid ambiguity.
28578 <indexterm role="option">
28579 <primary>local_part_prefix_optional</primary>
28582 <informaltable frame="all">
28583 <tgroup cols="4" colsep="0" rowsep="0">
28584 <colspec colwidth="8*" align="left"/>
28585 <colspec colwidth="5*" align="center"/>
28586 <colspec colwidth="5*" align="center"/>
28587 <colspec colwidth="6*" align="right"/>
28590 <entry><option>local_part_prefix_optional</option></entry>
28591 <entry>Use: <emphasis>routers</emphasis></entry>
28592 <entry>Type: <emphasis>boolean</emphasis></entry>
28593 <entry>Default: <emphasis>false</emphasis></entry>
28599 See <option>local_part_prefix</option> above.
28602 <indexterm role="option">
28603 <primary>local_part_suffix</primary>
28606 <informaltable frame="all">
28607 <tgroup cols="4" colsep="0" rowsep="0">
28608 <colspec colwidth="8*" align="left"/>
28609 <colspec colwidth="5*" align="center"/>
28610 <colspec colwidth="5*" align="center"/>
28611 <colspec colwidth="6*" align="right"/>
28614 <entry><option>local_part_suffix</option></entry>
28615 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
28616 <entry>Type: <emphasis>string list</emphasis></entry>
28617 <entry>Default: <emphasis>unset</emphasis></entry>
28623 <indexterm role="concept">
28624 <primary>router</primary>
28625 <secondary>suffix for local part</secondary>
28627 <indexterm role="concept">
28628 <primary>suffix for local part</primary>
28629 <secondary>used in router</secondary>
28631 This option operates in the same way as <option>local_part_prefix</option>, except that the
28632 local part must end (rather than start) with the given string, the
28633 <option>local_part_suffix_optional</option> option determines whether the suffix is
28634 mandatory, and the wildcard * character, if present, must be the last
28635 character of the suffix. This option facility is commonly used to handle local
28636 parts of the form <option>something-request</option> and multiple user mailboxes of the form
28637 <option>username-foo</option>.
28640 <indexterm role="option">
28641 <primary>local_part_suffix_optional</primary>
28644 <informaltable frame="all">
28645 <tgroup cols="4" colsep="0" rowsep="0">
28646 <colspec colwidth="8*" align="left"/>
28647 <colspec colwidth="5*" align="center"/>
28648 <colspec colwidth="5*" align="center"/>
28649 <colspec colwidth="6*" align="right"/>
28652 <entry><option>local_part_suffix_optional</option></entry>
28653 <entry>Use: <emphasis>routers</emphasis></entry>
28654 <entry>Type: <emphasis>boolean</emphasis></entry>
28655 <entry>Default: <emphasis>false</emphasis></entry>
28661 See <option>local_part_suffix</option> above.
28664 <indexterm role="option">
28665 <primary>local_parts</primary>
28668 <informaltable frame="all">
28669 <tgroup cols="4" colsep="0" rowsep="0">
28670 <colspec colwidth="8*" align="left"/>
28671 <colspec colwidth="5*" align="center"/>
28672 <colspec colwidth="5*" align="center"/>
28673 <colspec colwidth="6*" align="right"/>
28676 <entry><option>local_parts</option></entry>
28677 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
28678 <entry>Type: <emphasis>local part list</emphasis>†<emphasis></emphasis></entry>
28679 <entry>Default: <emphasis>unset</emphasis></entry>
28685 <indexterm role="concept">
28686 <primary>router</primary>
28687 <secondary>restricting to specific local parts</secondary>
28689 <indexterm role="concept">
28690 <primary>local part</primary>
28691 <secondary>checking in router</secondary>
28693 The router is run only if the local part of the address matches the list.
28694 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
28696 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
28697 string is expanded, it is possible to make it depend on the domain, for
28700 <literallayout class="monospaced">
28701 local_parts = dbm;/usr/local/specials/$domain
28704 <indexterm role="concept">
28705 <primary><varname>$local_part_data</varname></primary>
28707 If the match is achieved by a lookup, the data that the lookup returned
28708 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
28709 expansions of the router’s private options. You might use this option, for
28710 example, if you have a large number of local virtual domains, and you want to
28711 send all postmaster mail to the same place without having to set up an alias in
28712 each virtual domain:
28714 <literallayout class="monospaced">
28717 local_parts = postmaster
28718 data = postmaster@real.domain.example
28721 <indexterm role="option">
28722 <primary>log_as_local</primary>
28725 <informaltable frame="all">
28726 <tgroup cols="4" colsep="0" rowsep="0">
28727 <colspec colwidth="8*" align="left"/>
28728 <colspec colwidth="5*" align="center"/>
28729 <colspec colwidth="5*" align="center"/>
28730 <colspec colwidth="6*" align="right"/>
28733 <entry><option>log_as_local</option></entry>
28734 <entry>Use: <emphasis>routers</emphasis></entry>
28735 <entry>Type: <emphasis>boolean</emphasis></entry>
28736 <entry>Default: <emphasis>see below</emphasis></entry>
28742 <indexterm role="concept">
28743 <primary>log</primary>
28744 <secondary>delivery line</secondary>
28746 <indexterm role="concept">
28747 <primary>delivery</primary>
28748 <secondary>log line format</secondary>
28750 Exim has two logging styles for delivery, the idea being to make local
28751 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
28752 recipient address is given just as the local part, without a domain. The use of
28753 this style is controlled by this option. It defaults to true for the <command>accept</command>
28754 router, and false for all the others. This option applies only when a
28755 router assigns an address to a transport. It has no effect on routers that
28756 redirect addresses.
28759 <indexterm role="option">
28760 <primary>more</primary>
28763 <informaltable frame="all">
28764 <tgroup cols="4" colsep="0" rowsep="0">
28765 <colspec colwidth="8*" align="left"/>
28766 <colspec colwidth="5*" align="center"/>
28767 <colspec colwidth="5*" align="center"/>
28768 <colspec colwidth="6*" align="right"/>
28771 <entry><option>more</option></entry>
28772 <entry>Use: <emphasis>routers</emphasis></entry>
28773 <entry>Type: <emphasis>boolean</emphasis>†<emphasis></emphasis></entry>
28774 <entry>Default: <emphasis>true</emphasis></entry>
28780 The result of string expansion for this option must be a valid boolean value,
28781 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
28782 result causes an error, and delivery is deferred. If the expansion is forced to
28783 fail, the default value for the option (true) is used. Other failures cause
28784 delivery to be deferred.
28787 If this option is set false, and the router declines to handle the address, no
28788 further routers are tried, routing fails, and the address is bounced.
28789 <indexterm role="concept">
28790 <primary><option>self</option> option</primary>
28792 However, if the router explicitly passes an address to the following router by
28793 means of the setting
28795 <literallayout class="monospaced">
28799 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
28800 does not affect the behaviour if one of the precondition tests fails. In that
28801 case, the address is always passed to the next router.
28804 Note that <option>address_data</option> is not considered to be a precondition. If its
28805 expansion is forced to fail, the router declines, and the value of <option>more</option>
28806 controls what happens next.
28809 <indexterm role="option">
28810 <primary>pass_on_timeout</primary>
28813 <informaltable frame="all">
28814 <tgroup cols="4" colsep="0" rowsep="0">
28815 <colspec colwidth="8*" align="left"/>
28816 <colspec colwidth="5*" align="center"/>
28817 <colspec colwidth="5*" align="center"/>
28818 <colspec colwidth="6*" align="right"/>
28821 <entry><option>pass_on_timeout</option></entry>
28822 <entry>Use: <emphasis>routers</emphasis></entry>
28823 <entry>Type: <emphasis>boolean</emphasis></entry>
28824 <entry>Default: <emphasis>false</emphasis></entry>
28830 <indexterm role="concept">
28831 <primary>timeout</primary>
28832 <secondary>of router</secondary>
28834 <indexterm role="concept">
28835 <primary>router</primary>
28836 <secondary>timeout</secondary>
28838 If a router times out during a host lookup, it normally causes deferral of the
28839 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
28840 router, overriding <option>no_more</option>. This may be helpful for systems that are
28841 intermittently connected to the Internet, or those that want to pass to a smart
28842 host any messages that cannot immediately be delivered.
28845 There are occasional other temporary errors that can occur while doing DNS
28846 lookups. They are treated in the same way as a timeout, and this option
28847 applies to all of them.
28850 <indexterm role="option">
28851 <primary>pass_router</primary>
28854 <informaltable frame="all">
28855 <tgroup cols="4" colsep="0" rowsep="0">
28856 <colspec colwidth="8*" align="left"/>
28857 <colspec colwidth="5*" align="center"/>
28858 <colspec colwidth="5*" align="center"/>
28859 <colspec colwidth="6*" align="right"/>
28862 <entry><option>pass_router</option></entry>
28863 <entry>Use: <emphasis>routers</emphasis></entry>
28864 <entry>Type: <emphasis>string</emphasis></entry>
28865 <entry>Default: <emphasis>unset</emphasis></entry>
28871 <indexterm role="concept">
28872 <primary>router</primary>
28873 <secondary>go to after <quote>pass</quote></secondary>
28875 When a router returns <quote>pass</quote>, the address is normally handed on to the next
28876 router in sequence. This can be changed by setting <option>pass_router</option> to the name
28877 of another router. However (unlike <option>redirect_router</option>) the named router must
28878 be below the current router, to avoid loops. Note that this option applies only
28879 to the special case of <quote>pass</quote>. It does not apply when a router returns
28880 <quote>decline</quote>.
28883 <indexterm role="option">
28884 <primary>redirect_router</primary>
28887 <informaltable frame="all">
28888 <tgroup cols="4" colsep="0" rowsep="0">
28889 <colspec colwidth="8*" align="left"/>
28890 <colspec colwidth="5*" align="center"/>
28891 <colspec colwidth="5*" align="center"/>
28892 <colspec colwidth="6*" align="right"/>
28895 <entry><option>redirect_router</option></entry>
28896 <entry>Use: <emphasis>routers</emphasis></entry>
28897 <entry>Type: <emphasis>string</emphasis></entry>
28898 <entry>Default: <emphasis>unset</emphasis></entry>
28904 <indexterm role="concept">
28905 <primary>router</primary>
28906 <secondary>start at after redirection</secondary>
28908 Sometimes an administrator knows that it is pointless to reprocess addresses
28909 generated from alias or forward files with the same router again. For
28910 example, if an alias file translates real names into login ids there is no
28911 point searching the alias file a second time, especially if it is a large file.
28914 The <option>redirect_router</option> option can be set to the name of any router instance.
28915 It causes the routing of any generated addresses to start at the named router
28916 instead of at the first router. This option has no effect if the router in
28917 which it is set does not generate new addresses.
28920 <indexterm role="option">
28921 <primary>require_files</primary>
28924 <informaltable frame="all">
28925 <tgroup cols="4" colsep="0" rowsep="0">
28926 <colspec colwidth="8*" align="left"/>
28927 <colspec colwidth="5*" align="center"/>
28928 <colspec colwidth="5*" align="center"/>
28929 <colspec colwidth="6*" align="right"/>
28932 <entry><option>require_files</option></entry>
28933 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
28934 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
28935 <entry>Default: <emphasis>unset</emphasis></entry>
28941 <indexterm role="concept">
28942 <primary>file</primary>
28943 <secondary>requiring for router</secondary>
28945 <indexterm role="concept">
28946 <primary>router</primary>
28947 <secondary>requiring file existence</secondary>
28949 This option provides a general mechanism for predicating the running of a
28950 router on the existence or non-existence of certain files or directories.
28951 Before running a router, as one of its precondition tests, Exim works its way
28952 through the <option>require_files</option> list, expanding each item separately.
28955 Because the list is split before expansion, any colons in expansion items must
28956 be doubled, or the facility for using a different list separator must be used.
28957 If any expansion is forced to fail, the item is ignored. Other expansion
28958 failures cause routing of the address to be deferred.
28961 If any expanded string is empty, it is ignored. Otherwise, except as described
28962 below, each string must be a fully qualified file path, optionally preceded by
28963 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
28964 existence of the files or directories. The router is skipped if any paths not
28965 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
28968 <indexterm role="concept">
28969 <primary>NFS</primary>
28971 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
28972 the message is deferred. This can happen when NFS-mounted filesystems are
28976 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
28977 options, so you cannot use it to check for the existence of a file in which to
28978 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
28979 full list of the order in which preconditions are evaluated.) However, as
28980 these options are all expanded, you can use the <option>exists</option> expansion condition
28981 to make such tests. The <option>require_files</option> option is intended for checking files
28982 that the router may be going to use internally, or which are needed by a
28983 transport (for example <filename>.procmailrc</filename>).
28986 During delivery, the <function>stat()</function> function is run as root, but there is a
28987 facility for some checking of the accessibility of a file by another user.
28988 This is not a proper permissions check, but just a <quote>rough</quote> check that
28989 operates as follows:
28992 If an item in a <option>require_files</option> list does not contain any forward slash
28993 characters, it is taken to be the user (and optional group, separated by a
28994 comma) to be checked for subsequent files in the list. If no group is specified
28995 but the user is specified symbolically, the gid associated with the uid is
28998 <literallayout class="monospaced">
28999 require_files = mail:/some/file
29000 require_files = $local_part:$home/.procmailrc
29003 If a user or group name in a <option>require_files</option> list does not exist, the
29004 <option>require_files</option> condition fails.
29007 Exim performs the check by scanning along the components of the file path, and
29008 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
29009 directories, and <quote>r</quote> access on the final file. Note that this means that file
29010 access control lists, if the operating system has them, are ignored.
29013 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
29014 incoming SMTP message, Exim is not running as root, but under its own uid. This
29015 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
29016 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
29017 user is not permitted to read one of the directories on the file’s path.
29020 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
29021 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
29022 without root access. In this case, if a check for access by a particular user
29023 is requested, Exim creates a subprocess that runs as that user, and tries the
29024 check again in that process.
29027 The default action for handling an unresolved EACCES is to consider it to
29028 be caused by a configuration error, and routing is deferred because the
29029 existence or non-existence of the file cannot be determined. However, in some
29030 circumstances it may be desirable to treat this condition as if the file did
29031 not exist. If the file name (or the exclamation mark that precedes the file
29032 name for non-existence) is preceded by a plus sign, the EACCES error is treated
29033 as if the file did not exist. For example:
29035 <literallayout class="monospaced">
29036 require_files = +/some/file
29039 If the router is not an essential part of verification (for example, it
29040 handles users’ <filename>.forward</filename> files), another solution is to set the <option>verify</option>
29041 option false so that the router is skipped when verifying.
29044 <indexterm role="option">
29045 <primary>retry_use_local_part</primary>
29048 <informaltable frame="all">
29049 <tgroup cols="4" colsep="0" rowsep="0">
29050 <colspec colwidth="8*" align="left"/>
29051 <colspec colwidth="5*" align="center"/>
29052 <colspec colwidth="5*" align="center"/>
29053 <colspec colwidth="6*" align="right"/>
29056 <entry><option>retry_use_local_part</option></entry>
29057 <entry>Use: <emphasis>routers</emphasis></entry>
29058 <entry>Type: <emphasis>boolean</emphasis></entry>
29059 <entry>Default: <emphasis>see below</emphasis></entry>
29065 <indexterm role="concept">
29066 <primary>hints database</primary>
29067 <secondary>retry keys</secondary>
29069 <indexterm role="concept">
29070 <primary>local part</primary>
29071 <secondary>in retry keys</secondary>
29073 When a delivery suffers a temporary routing failure, a retry record is created
29074 in Exim’s hints database. For addresses whose routing depends only on the
29075 domain, the key for the retry record should not involve the local part, but for
29076 other addresses, both the domain and the local part should be included.
29077 Usually, remote routing is of the former kind, and local routing is of the
29081 This option controls whether the local part is used to form the key for retry
29082 hints for addresses that suffer temporary errors while being handled by this
29083 router. The default value is true for any router that has <option>check_local_user</option>
29084 set, and false otherwise. Note that this option does not apply to hints keys
29085 for transport delays; they are controlled by a generic transport option of the
29089 The setting of <option>retry_use_local_part</option> applies only to the router on which it
29090 appears. If the router generates child addresses, they are routed
29091 independently; this setting does not become attached to them.
29094 <indexterm role="option">
29095 <primary>router_home_directory</primary>
29098 <informaltable frame="all">
29099 <tgroup cols="4" colsep="0" rowsep="0">
29100 <colspec colwidth="8*" align="left"/>
29101 <colspec colwidth="5*" align="center"/>
29102 <colspec colwidth="5*" align="center"/>
29103 <colspec colwidth="6*" align="right"/>
29106 <entry><option>router_home_directory</option></entry>
29107 <entry>Use: <emphasis>routers</emphasis></entry>
29108 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29109 <entry>Default: <emphasis>unset</emphasis></entry>
29115 <indexterm role="concept">
29116 <primary>router</primary>
29117 <secondary>home directory for</secondary>
29119 <indexterm role="concept">
29120 <primary>home directory</primary>
29121 <secondary>for router</secondary>
29123 <indexterm role="concept">
29124 <primary><varname>$home</varname></primary>
29126 This option sets a home directory for use while the router is running. (Compare
29127 <option>transport_home_directory</option>, which sets a home directory for later
29128 transporting.) In particular, if used on a <command>redirect</command> router, this option
29129 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
29130 forced expansion failure causes the option to be ignored – other failures
29131 cause the router to defer.
29134 Expansion of <option>router_home_directory</option> happens immediately after the
29135 <option>check_local_user</option> test (if configured), before any further expansions take
29137 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29139 While the router is running, <option>router_home_directory</option> overrides the value of
29140 <varname>$home</varname> that came from <option>check_local_user</option>.
29143 When a router accepts an address and assigns it to a local transport (including
29144 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
29145 delivery), the home directory setting for the transport is taken from the first
29146 of these values that is set:
29151 The <option>home_directory</option> option on the transport;
29156 The <option>transport_home_directory</option> option on the router;
29161 The password data if <option>check_local_user</option> is set on the router;
29166 The <option>router_home_directory</option> option on the router.
29171 In other words, <option>router_home_directory</option> overrides the password data for the
29172 router, but not for the transport.
29175 <indexterm role="option">
29176 <primary>self</primary>
29179 <informaltable frame="all">
29180 <tgroup cols="4" colsep="0" rowsep="0">
29181 <colspec colwidth="8*" align="left"/>
29182 <colspec colwidth="5*" align="center"/>
29183 <colspec colwidth="5*" align="center"/>
29184 <colspec colwidth="6*" align="right"/>
29187 <entry><option>self</option></entry>
29188 <entry>Use: <emphasis>routers</emphasis></entry>
29189 <entry>Type: <emphasis>string</emphasis></entry>
29190 <entry>Default: <emphasis>freeze</emphasis></entry>
29196 <indexterm role="concept">
29197 <primary>MX record</primary>
29198 <secondary>pointing to local host</secondary>
29200 <indexterm role="concept">
29201 <primary>local host</primary>
29202 <secondary>MX pointing to</secondary>
29204 This option applies to those routers that use a recipient address to find a
29205 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
29206 and <command>manualroute</command> routers.
29207 Certain configurations of the <command>queryprogram</command> router can also specify a list
29209 Usually such routers are configured to send the message to a remote host via an
29210 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
29211 host on the list turns out to be the local host.
29212 The way in which Exim checks for the local host is described in section
29213 <xref linkend="SECTreclocipadd"/>.
29216 Normally this situation indicates either an error in Exim’s configuration (for
29217 example, the router should be configured not to process this domain), or an
29218 error in the DNS (for example, the MX should not point to this host). For this
29219 reason, the default action is to log the incident, defer the address, and
29220 freeze the message. The following alternatives are provided for use in special
29225 <term><option>defer</option></term>
29228 Delivery of the message is tried again later, but the message is not frozen.
29230 </listitem></varlistentry>
29232 <term><option>reroute</option>: <<emphasis>domain</emphasis>></term>
29235 The domain is changed to the given domain, and the address is passed back to
29236 be reprocessed by the routers. No rewriting of headers takes place. This
29237 behaviour is essentially a redirection.
29239 </listitem></varlistentry>
29241 <term><option>reroute: rewrite:</option> <<emphasis>domain</emphasis>></term>
29244 The domain is changed to the given domain, and the address is passed back to be
29245 reprocessed by the routers. Any headers that contain the original domain are
29248 </listitem></varlistentry>
29250 <term><option>pass</option></term>
29253 <indexterm role="concept">
29254 <primary><option>more</option> option</primary>
29256 <indexterm role="concept">
29257 <primary><varname>$self_hostname</varname></primary>
29259 The router passes the address to the next router, or to the router named in the
29260 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
29261 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
29262 name of the local host that the router encountered. This can be used to
29263 distinguish between different cases for hosts with multiple names. The
29266 <literallayout class="monospaced">
29271 ensures that only those addresses that routed to the local host are passed on.
29272 Without <option>no_more</option>, addresses that were declined for other reasons would also
29273 be passed to the next router.
29275 </listitem></varlistentry>
29277 <term><option>fail</option></term>
29280 Delivery fails and an error report is generated.
29282 </listitem></varlistentry>
29284 <term><option>send</option></term>
29287 <indexterm role="concept">
29288 <primary>local host</primary>
29289 <secondary>sending to</secondary>
29291 The anomaly is ignored and the address is queued for the transport. This
29292 setting should be used with extreme caution. For an <command>smtp</command> transport, it
29293 makes sense only in cases where the program that is listening on the SMTP port
29294 is not this version of Exim. That is, it must be some other MTA, or Exim with a
29295 different configuration file that handles the domain in another way.
29297 </listitem></varlistentry>
29300 <indexterm role="option">
29301 <primary>senders</primary>
29304 <informaltable frame="all">
29305 <tgroup cols="4" colsep="0" rowsep="0">
29306 <colspec colwidth="8*" align="left"/>
29307 <colspec colwidth="5*" align="center"/>
29308 <colspec colwidth="5*" align="center"/>
29309 <colspec colwidth="6*" align="right"/>
29312 <entry><option>senders</option></entry>
29313 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29314 <entry>Type: <emphasis>address list</emphasis>†<emphasis></emphasis></entry>
29315 <entry>Default: <emphasis>unset</emphasis></entry>
29321 <indexterm role="concept">
29322 <primary>router</primary>
29323 <secondary>checking senders</secondary>
29325 If this option is set, the router is skipped unless the message’s sender
29326 address matches something on the list.
29327 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29331 There are issues concerning verification when the running of routers is
29332 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
29333 setting, it sets the sender to the null string. When using the <option>-bt</option> option
29334 to check a configuration file, it is necessary also to use the <option>-f</option> option to
29335 set an appropriate sender. For incoming mail, the sender is unset when
29336 verifying the sender, but is available when verifying any recipients. If the
29337 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
29341 <indexterm role="option">
29342 <primary>translate_ip_address</primary>
29345 <informaltable frame="all">
29346 <tgroup cols="4" colsep="0" rowsep="0">
29347 <colspec colwidth="8*" align="left"/>
29348 <colspec colwidth="5*" align="center"/>
29349 <colspec colwidth="5*" align="center"/>
29350 <colspec colwidth="6*" align="right"/>
29353 <entry><option>translate_ip_address</option></entry>
29354 <entry>Use: <emphasis>routers</emphasis></entry>
29355 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29356 <entry>Default: <emphasis>unset</emphasis></entry>
29362 <indexterm role="concept">
29363 <primary>IP address</primary>
29364 <secondary>translating</secondary>
29366 <indexterm role="concept">
29367 <primary>packet radio</primary>
29369 <indexterm role="concept">
29370 <primary>router</primary>
29371 <secondary>IP address translation</secondary>
29373 There exist some rare networking situations (for example, packet radio) where
29374 it is helpful to be able to translate IP addresses generated by normal routing
29375 mechanisms into other IP addresses, thus performing a kind of manual IP
29376 routing. This should be done only if the normal IP routing of the TCP/IP stack
29377 is inadequate or broken. Because this is an extremely uncommon requirement, the
29378 code to support this option is not included in the Exim binary unless
29379 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
29382 <indexterm role="concept">
29383 <primary><varname>$host_address</varname></primary>
29385 The <option>translate_ip_address</option> string is expanded for every IP address generated
29386 by the router, with the generated address set in <varname>$host_address</varname>. If the
29387 expansion is forced to fail, no action is taken.
29388 For any other expansion error, delivery of the message is deferred.
29389 If the result of the expansion is an IP address, that replaces the original
29390 address; otherwise the result is assumed to be a host name – this is looked
29391 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
29392 produce one or more replacement IP addresses. For example, to subvert all IP
29393 addresses in some specific networks, this could be added to a router:
29395 <literallayout class="monospaced">
29396 translate_ip_address = \
29397 ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
29401 The file would contain lines like
29403 <literallayout class="monospaced">
29404 10.2.3.128/26 some.host
29405 10.8.4.34/26 10.44.8.15
29408 You should not make use of this facility unless you really understand what you
29412 <indexterm role="option">
29413 <primary>transport</primary>
29416 <informaltable frame="all">
29417 <tgroup cols="4" colsep="0" rowsep="0">
29418 <colspec colwidth="8*" align="left"/>
29419 <colspec colwidth="5*" align="center"/>
29420 <colspec colwidth="5*" align="center"/>
29421 <colspec colwidth="6*" align="right"/>
29424 <entry><option>transport</option></entry>
29425 <entry>Use: <emphasis>routers</emphasis></entry>
29426 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29427 <entry>Default: <emphasis>unset</emphasis></entry>
29433 This option specifies the transport to be used when a router accepts an address
29434 and sets it up for delivery. A transport is never needed if a router is used
29435 only for verification. The value of the option is expanded at routing time,
29436 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
29437 and result must be the name of one of the configured transports. If it is not,
29438 delivery is deferred.
29441 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
29442 have some private options that set up transports for pipe and file deliveries
29443 (see chapter <xref linkend="CHAPredirect"/>).
29446 <indexterm role="option">
29447 <primary>transport_current_directory</primary>
29450 <informaltable frame="all">
29451 <tgroup cols="4" colsep="0" rowsep="0">
29452 <colspec colwidth="8*" align="left"/>
29453 <colspec colwidth="5*" align="center"/>
29454 <colspec colwidth="5*" align="center"/>
29455 <colspec colwidth="6*" align="right"/>
29458 <entry><option>transport_current_directory</option></entry>
29459 <entry>Use: <emphasis>routers</emphasis></entry>
29460 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29461 <entry>Default: <emphasis>unset</emphasis></entry>
29467 <indexterm role="concept">
29468 <primary>current directory for local transport</primary>
29470 This option associates a current directory with any address that is routed
29471 to a local transport. This can happen either because a transport is
29472 explicitly configured for the router, or because it generates a delivery to a
29473 file or a pipe. During the delivery process (that is, at transport time), this
29474 option string is expanded and is set as the current directory, unless
29475 overridden by a setting on the transport.
29476 If the expansion fails for any reason, including forced failure, an error is
29477 logged, and delivery is deferred.
29478 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
29482 <indexterm role="option">
29483 <primary>transport_home_directory</primary>
29486 <informaltable frame="all">
29487 <tgroup cols="4" colsep="0" rowsep="0">
29488 <colspec colwidth="8*" align="left"/>
29489 <colspec colwidth="5*" align="center"/>
29490 <colspec colwidth="5*" align="center"/>
29491 <colspec colwidth="6*" align="right"/>
29494 <entry><option>transport_home_directory</option></entry>
29495 <entry>Use: <emphasis>routers</emphasis></entry>
29496 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29497 <entry>Default: <emphasis>see below</emphasis></entry>
29503 <indexterm role="concept">
29504 <primary>home directory</primary>
29505 <secondary>for local transport</secondary>
29507 This option associates a home directory with any address that is routed to a
29508 local transport. This can happen either because a transport is explicitly
29509 configured for the router, or because it generates a delivery to a file or a
29510 pipe. During the delivery process (that is, at transport time), the option
29511 string is expanded and is set as the home directory, unless overridden by a
29512 setting of <option>home_directory</option> on the transport.
29513 If the expansion fails for any reason, including forced failure, an error is
29514 logged, and delivery is deferred.
29517 If the transport does not specify a home directory, and
29518 <option>transport_home_directory</option> is not set for the router, the home directory for
29519 the tranport is taken from the password data if <option>check_local_user</option> is set for
29520 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
29521 is set; if not, no home directory is set for the transport.
29524 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
29528 <indexterm role="option">
29529 <primary>unseen</primary>
29532 <informaltable frame="all">
29533 <tgroup cols="4" colsep="0" rowsep="0">
29534 <colspec colwidth="8*" align="left"/>
29535 <colspec colwidth="5*" align="center"/>
29536 <colspec colwidth="5*" align="center"/>
29537 <colspec colwidth="6*" align="right"/>
29540 <entry><option>unseen</option></entry>
29541 <entry>Use: <emphasis>routers</emphasis></entry>
29542 <entry>Type: <emphasis>boolean</emphasis>†<emphasis></emphasis></entry>
29543 <entry>Default: <emphasis>false</emphasis></entry>
29549 <indexterm role="concept">
29550 <primary>router</primary>
29551 <secondary>carrying on after success</secondary>
29553 The result of string expansion for this option must be a valid boolean value,
29554 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
29555 result causes an error, and delivery is deferred. If the expansion is forced to
29556 fail, the default value for the option (false) is used. Other failures cause
29557 delivery to be deferred.
29560 When this option is set true, routing does not cease if the router accepts the
29561 address. Instead, a copy of the incoming address is passed to the next router,
29562 overriding a false setting of <option>more</option>. There is little point in setting
29563 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
29564 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
29565 sometimes true and sometimes false).
29568 <indexterm role="concept">
29569 <primary>copy of message (<option>unseen</option> option)</primary>
29571 The <option>unseen</option> option can be used to cause copies of messages to be delivered
29572 to some other destination, while also carrying out a normal delivery. In
29573 effect, the current address is made into a <quote>parent</quote> that has two children –
29574 one that is delivered as specified by this router, and a clone that goes on to
29575 be routed further. For this reason, <option>unseen</option> may not be combined with the
29576 <option>one_time</option> option in a <command>redirect</command> router.
29579 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
29580 this router or by previous routers affect the <quote>unseen</quote> copy of the message
29581 only. The clone that continues to be processed by further routers starts with
29582 no added headers and none specified for removal. However, any data that was set
29583 by the <option>address_data</option> option in the current or previous routers is passed on.
29584 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
29585 qualifier in filter files.
29588 <indexterm role="option">
29589 <primary>user</primary>
29592 <informaltable frame="all">
29593 <tgroup cols="4" colsep="0" rowsep="0">
29594 <colspec colwidth="8*" align="left"/>
29595 <colspec colwidth="5*" align="center"/>
29596 <colspec colwidth="5*" align="center"/>
29597 <colspec colwidth="6*" align="right"/>
29600 <entry><option>user</option></entry>
29601 <entry>Use: <emphasis>routers</emphasis></entry>
29602 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29603 <entry>Default: <emphasis>see below</emphasis></entry>
29609 <indexterm role="concept">
29610 <primary>uid (user id)</primary>
29611 <secondary>local delivery</secondary>
29613 <indexterm role="concept">
29614 <primary>local transports</primary>
29615 <secondary>uid and gid</secondary>
29617 <indexterm role="concept">
29618 <primary>transport</primary>
29619 <secondary>local</secondary>
29621 <indexterm role="concept">
29622 <primary>router</primary>
29623 <secondary>user for filter processing</secondary>
29625 <indexterm role="concept">
29626 <primary>filter</primary>
29627 <secondary>user for processing</secondary>
29629 When a router queues an address for a transport, and the transport does not
29630 specify a user, the user given here is used when running the delivery process.
29631 The user may be specified numerically or by name. If expansion fails, the
29632 error is logged and delivery is deferred.
29633 This user is also used by the <command>redirect</command> router when running a filter file.
29634 The default is unset, except when <option>check_local_user</option> is set. In this case,
29635 the default is taken from the password information. If the user is specified as
29636 a name, and <option>group</option> is not set, the group associated with the user is used.
29637 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
29638 <xref linkend="CHAPenvironment"/>.
29641 <indexterm role="option">
29642 <primary>verify</primary>
29645 <informaltable frame="all">
29646 <tgroup cols="4" colsep="0" rowsep="0">
29647 <colspec colwidth="8*" align="left"/>
29648 <colspec colwidth="5*" align="center"/>
29649 <colspec colwidth="5*" align="center"/>
29650 <colspec colwidth="6*" align="right"/>
29653 <entry><option>verify</option></entry>
29654 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29655 <entry>Type: <emphasis>boolean</emphasis></entry>
29656 <entry>Default: <emphasis>true</emphasis></entry>
29662 Setting this option has the effect of setting <option>verify_sender</option> and
29663 <option>verify_recipient</option> to the same value.
29666 <indexterm role="option">
29667 <primary>verify_only</primary>
29670 <informaltable frame="all">
29671 <tgroup cols="4" colsep="0" rowsep="0">
29672 <colspec colwidth="8*" align="left"/>
29673 <colspec colwidth="5*" align="center"/>
29674 <colspec colwidth="5*" align="center"/>
29675 <colspec colwidth="6*" align="right"/>
29678 <entry><option>verify_only</option></entry>
29679 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29680 <entry>Type: <emphasis>boolean</emphasis></entry>
29681 <entry>Default: <emphasis>false</emphasis></entry>
29687 <indexterm role="concept">
29688 <primary>EXPN</primary>
29689 <secondary>with <option>verify_only</option></secondary>
29691 <indexterm role="concept">
29692 <primary><option>-bv</option> option</primary>
29694 <indexterm role="concept">
29695 <primary>router</primary>
29696 <secondary>used only when verifying</secondary>
29698 If this option is set, the router is used only when verifying an address or
29699 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
29700 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
29701 restricted to verifying only senders or recipients by means of
29702 <option>verify_sender</option> and <option>verify_recipient</option>.
29705 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
29706 SMTP message, Exim is not running as root, but under its own uid. If the router
29707 accesses any files, you need to make sure that they are accessible to the Exim
29711 <indexterm role="option">
29712 <primary>verify_recipient</primary>
29715 <informaltable frame="all">
29716 <tgroup cols="4" colsep="0" rowsep="0">
29717 <colspec colwidth="8*" align="left"/>
29718 <colspec colwidth="5*" align="center"/>
29719 <colspec colwidth="5*" align="center"/>
29720 <colspec colwidth="6*" align="right"/>
29723 <entry><option>verify_recipient</option></entry>
29724 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29725 <entry>Type: <emphasis>boolean</emphasis></entry>
29726 <entry>Default: <emphasis>true</emphasis></entry>
29732 If this option is false, the router is skipped when verifying recipient
29734 or testing recipient verification using <option>-bv</option>.
29735 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29739 <indexterm role="option">
29740 <primary>verify_sender</primary>
29743 <informaltable frame="all">
29744 <tgroup cols="4" colsep="0" rowsep="0">
29745 <colspec colwidth="8*" align="left"/>
29746 <colspec colwidth="5*" align="center"/>
29747 <colspec colwidth="5*" align="center"/>
29748 <colspec colwidth="6*" align="right"/>
29751 <entry><option>verify_sender</option></entry>
29752 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29753 <entry>Type: <emphasis>boolean</emphasis></entry>
29754 <entry>Default: <emphasis>true</emphasis></entry>
29760 If this option is false, the router is skipped when verifying sender addresses
29761 or testing sender verification using <option>-bvs</option>.
29762 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29764 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
29765 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
29770 <title>The accept router</title>
29772 <indexterm role="concept">
29773 <primary><command>accept</command> router</primary>
29775 <indexterm role="concept">
29776 <primary>routers</primary>
29777 <secondary><command>accept</command></secondary>
29779 The <command>accept</command> router has no private options of its own. Unless it is being
29780 used purely for verification (see <option>verify_only</option>) a transport is required to
29781 be defined by the generic <option>transport</option> option. If the preconditions that are
29782 specified by generic options are met, the router accepts the address and queues
29783 it for the given transport. The most common use of this router is for setting
29784 up deliveries to local mailboxes. For example:
29786 <literallayout class="monospaced">
29789 domains = mydomain.example
29791 transport = local_delivery
29794 The <option>domains</option> condition in this example checks the domain of the address, and
29795 <option>check_local_user</option> checks that the local part is the login of a local user.
29796 When both preconditions are met, the <command>accept</command> router runs, and queues the
29797 address for the <command>local_delivery</command> transport.
29801 <chapter id="CHAPdnslookup">
29802 <title>The dnslookup router</title>
29804 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
29805 <primary><command>dnslookup</command> router</primary>
29807 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
29808 <primary>routers</primary>
29809 <secondary><command>dnslookup</command></secondary>
29811 The <command>dnslookup</command> router looks up the hosts that handle mail for the
29812 recipient’s domain in the DNS. A transport must always be set for this router,
29813 unless <option>verify_only</option> is set.
29816 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
29817 SRV records. If none are found, or if SRV support is not configured,
29818 MX records are looked up. If no MX records exist, address records are sought.
29819 However, <option>mx_domains</option> can be set to disable the direct use of address
29823 MX records of equal priority are sorted by Exim into a random order. Exim then
29824 looks for address records for the host names obtained from MX or SRV records.
29825 When a host has more than one IP address, they are sorted into a random order,
29826 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
29827 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
29828 generic option, the router declines.
29831 Unless they have the highest priority (lowest MX value), MX records that point
29832 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
29833 are discarded, together with any other MX records of equal or lower priority.
29836 <indexterm role="concept">
29837 <primary>MX record</primary>
29838 <secondary>pointing to local host</secondary>
29840 <indexterm role="concept">
29841 <primary>local host</primary>
29842 <secondary>MX pointing to</secondary>
29844 <indexterm role="concept">
29845 <primary><option>self</option> option</primary>
29846 <secondary>in <command>dnslookup</command> router</secondary>
29848 If the host pointed to by the highest priority MX record, or looked up as an
29849 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
29850 happens is controlled by the generic <option>self</option> option.
29852 <section id="SECTprowitdnsloo">
29853 <title>Problems with DNS lookups</title>
29855 There have been problems with DNS servers when SRV records are looked up.
29856 Some mis-behaving servers return a DNS error or timeout when a non-existent
29857 SRV record is sought. Similar problems have in the past been reported for
29858 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
29859 problem, but it is heavy-handed because it is a global option.
29862 For this reason, there are two options, <option>srv_fail_domains</option> and
29863 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
29864 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
29865 an attempt to look up an SRV or MX record causes one of these results, and the
29866 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
29867 such record</quote>. In the case of an SRV lookup, this means that the router
29868 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
29869 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
29870 case routing fails.
29874 <title>Private options for dnslookup</title>
29876 <indexterm role="concept">
29877 <primary>options</primary>
29878 <secondary><command>dnslookup</command> router</secondary>
29880 The private options for the <command>dnslookup</command> router are as follows:
29883 <indexterm role="option">
29884 <primary>check_secondary_mx</primary>
29887 <informaltable frame="all">
29888 <tgroup cols="4" colsep="0" rowsep="0">
29889 <colspec colwidth="8*" align="left"/>
29890 <colspec colwidth="5*" align="center"/>
29891 <colspec colwidth="5*" align="center"/>
29892 <colspec colwidth="6*" align="right"/>
29895 <entry><option>check_secondary_mx</option></entry>
29896 <entry>Use: <emphasis>dnslookup</emphasis></entry>
29897 <entry>Type: <emphasis>boolean</emphasis></entry>
29898 <entry>Default: <emphasis>false</emphasis></entry>
29904 <indexterm role="concept">
29905 <primary>MX record</primary>
29906 <secondary>checking for secondary</secondary>
29908 If this option is set, the router declines unless the local host is found in
29909 (and removed from) the list of hosts obtained by MX lookup. This can be used to
29910 process domains for which the local host is a secondary mail exchanger
29911 differently to other domains. The way in which Exim decides whether a host is
29912 the local host is described in section <xref linkend="SECTreclocipadd"/>.
29915 <indexterm role="option">
29916 <primary>check_srv</primary>
29919 <informaltable frame="all">
29920 <tgroup cols="4" colsep="0" rowsep="0">
29921 <colspec colwidth="8*" align="left"/>
29922 <colspec colwidth="5*" align="center"/>
29923 <colspec colwidth="5*" align="center"/>
29924 <colspec colwidth="6*" align="right"/>
29927 <entry><option>check_srv</option></entry>
29928 <entry>Use: <emphasis>dnslookup</emphasis></entry>
29929 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29930 <entry>Default: <emphasis>unset</emphasis></entry>
29936 <indexterm role="concept">
29937 <primary>SRV record</primary>
29938 <secondary>enabling use of</secondary>
29940 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
29941 addition to MX and address records. The support is disabled by default. To
29942 enable SRV support, set the <option>check_srv</option> option to the name of the service
29943 required. For example,
29945 <literallayout class="monospaced">
29949 looks for SRV records that refer to the normal smtp service. The option is
29950 expanded, so the service name can vary from message to message or address
29951 to address. This might be helpful if SRV records are being used for a
29952 submission service. If the expansion is forced to fail, the <option>check_srv</option>
29953 option is ignored, and the router proceeds to look for MX records in the
29957 When the expansion succeeds, the router searches first for SRV records for
29958 the given service (it assumes TCP protocol). A single SRV record with a
29959 host name that consists of just a single dot indicates <quote>no such service for
29960 this domain</quote>; if this is encountered, the router declines. If other kinds of
29961 SRV record are found, they are used to construct a host list for delivery
29962 according to the rules of RFC 2782. MX records are not sought in this case.
29965 When no SRV records are found, MX records (and address records) are sought in
29966 the traditional way. In other words, SRV records take precedence over MX
29967 records, just as MX records take precedence over address records. Note that
29968 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
29969 defined it. It is apparently believed that MX records are sufficient for email
29970 and that SRV records should not be used for this purpose. However, SRV records
29971 have an additional <quote>weight</quote> feature which some people might find useful when
29972 trying to split an SMTP load between hosts of different power.
29975 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim’s behaviour
29976 when there is a DNS lookup error.
29979 <indexterm role="option">
29980 <primary>mx_domains</primary>
29983 <informaltable frame="all">
29984 <tgroup cols="4" colsep="0" rowsep="0">
29985 <colspec colwidth="8*" align="left"/>
29986 <colspec colwidth="5*" align="center"/>
29987 <colspec colwidth="5*" align="center"/>
29988 <colspec colwidth="6*" align="right"/>
29991 <entry><option>mx_domains</option></entry>
29992 <entry>Use: <emphasis>dnslookup</emphasis></entry>
29993 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
29994 <entry>Default: <emphasis>unset</emphasis></entry>
30000 <indexterm role="concept">
30001 <primary>MX record</primary>
30002 <secondary>required to exist</secondary>
30004 <indexterm role="concept">
30005 <primary>SRV record</primary>
30006 <secondary>required to exist</secondary>
30008 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
30009 record in order to be recognised. (The name of this option could be improved.)
30010 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
30011 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
30014 <literallayout class="monospaced">
30015 mx_domains = ! *.discworld.fict.example : *.fict.example
30018 This specifies that messages addressed to a domain that matches the list but
30019 has no MX record should be bounced immediately instead of being routed using
30020 the address record.
30023 <indexterm role="option">
30024 <primary>mx_fail_domains</primary>
30027 <informaltable frame="all">
30028 <tgroup cols="4" colsep="0" rowsep="0">
30029 <colspec colwidth="8*" align="left"/>
30030 <colspec colwidth="5*" align="center"/>
30031 <colspec colwidth="5*" align="center"/>
30032 <colspec colwidth="6*" align="right"/>
30035 <entry><option>mx_fail_domains</option></entry>
30036 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30037 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
30038 <entry>Default: <emphasis>unset</emphasis></entry>
30044 If the DNS lookup for MX records for one of the domains in this list causes a
30045 DNS lookup error, Exim behaves as if no MX records were found. See section
30046 <xref linkend="SECTprowitdnsloo"/> for more discussion.
30049 <indexterm role="option">
30050 <primary>qualify_single</primary>
30053 <informaltable frame="all">
30054 <tgroup cols="4" colsep="0" rowsep="0">
30055 <colspec colwidth="8*" align="left"/>
30056 <colspec colwidth="5*" align="center"/>
30057 <colspec colwidth="5*" align="center"/>
30058 <colspec colwidth="6*" align="right"/>
30061 <entry><option>qualify_single</option></entry>
30062 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30063 <entry>Type: <emphasis>boolean</emphasis></entry>
30064 <entry>Default: <emphasis>true</emphasis></entry>
30070 <indexterm role="concept">
30071 <primary>DNS</primary>
30072 <secondary>resolver options</secondary>
30074 <indexterm role="concept">
30075 <primary>DNS</primary>
30076 <secondary>qualifying single-component names</secondary>
30078 When this option is true, the resolver option RES_DEFNAMES is set for DNS
30079 lookups. Typically, but not standardly, this causes the resolver to qualify
30080 single-component names with the default domain. For example, on a machine
30081 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
30082 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
30083 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
30084 <emphasis>resolv.conf</emphasis>.
30087 <indexterm role="option">
30088 <primary>rewrite_headers</primary>
30091 <informaltable frame="all">
30092 <tgroup cols="4" colsep="0" rowsep="0">
30093 <colspec colwidth="8*" align="left"/>
30094 <colspec colwidth="5*" align="center"/>
30095 <colspec colwidth="5*" align="center"/>
30096 <colspec colwidth="6*" align="right"/>
30099 <entry><option>rewrite_headers</option></entry>
30100 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30101 <entry>Type: <emphasis>boolean</emphasis></entry>
30102 <entry>Default: <emphasis>true</emphasis></entry>
30108 <indexterm role="concept">
30109 <primary>rewriting</primary>
30110 <secondary>header lines</secondary>
30112 <indexterm role="concept">
30113 <primary>header lines</primary>
30114 <secondary>rewriting</secondary>
30116 If the domain name in the address that is being processed is not fully
30117 qualified, it may be expanded to its full form by a DNS lookup. For example, if
30118 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
30119 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
30120 occur as a result of setting the <option>widen_domains</option> option. If
30121 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
30122 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
30123 header lines of the message are rewritten with the full domain name.
30126 This option should be turned off only when it is known that no message is
30127 ever going to be sent outside an environment where the abbreviation makes
30131 When an MX record is looked up in the DNS and matches a wildcard record, name
30132 servers normally return a record containing the name that has been looked up,
30133 making it impossible to detect whether a wildcard was present or not. However,
30134 some name servers have recently been seen to return the wildcard entry. If the
30135 name returned by a DNS lookup begins with an asterisk, it is not used for
30139 <indexterm role="option">
30140 <primary>same_domain_copy_routing</primary>
30143 <informaltable frame="all">
30144 <tgroup cols="4" colsep="0" rowsep="0">
30145 <colspec colwidth="8*" align="left"/>
30146 <colspec colwidth="5*" align="center"/>
30147 <colspec colwidth="5*" align="center"/>
30148 <colspec colwidth="6*" align="right"/>
30151 <entry><option>same_domain_copy_routing</option></entry>
30152 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30153 <entry>Type: <emphasis>boolean</emphasis></entry>
30154 <entry>Default: <emphasis>false</emphasis></entry>
30160 <indexterm role="concept">
30161 <primary>address</primary>
30162 <secondary>copying routing</secondary>
30164 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
30165 to the same list of hosts. However, this cannot be presumed, because the router
30166 options and preconditions may refer to the local part of the address. By
30167 default, therefore, Exim routes each address in a message independently. DNS
30168 servers run caches, so repeated DNS lookups are not normally expensive, and in
30169 any case, personal messages rarely have more than a few recipients.
30172 If you are running mailing lists with large numbers of subscribers at the same
30173 domain, and you are using a <command>dnslookup</command> router which is independent of the
30174 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
30175 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
30176 routes an address to a remote transport, any other unrouted addresses in the
30177 message that have the same domain are automatically given the same routing
30178 without processing them independently,
30179 provided the following conditions are met:
30184 No router that processed the address specified <option>headers_add</option> or
30185 <option>headers_remove</option>.
30190 The router did not change the address in any way, for example, by <quote>widening</quote>
30196 <indexterm role="option">
30197 <primary>search_parents</primary>
30200 <informaltable frame="all">
30201 <tgroup cols="4" colsep="0" rowsep="0">
30202 <colspec colwidth="8*" align="left"/>
30203 <colspec colwidth="5*" align="center"/>
30204 <colspec colwidth="5*" align="center"/>
30205 <colspec colwidth="6*" align="right"/>
30208 <entry><option>search_parents</option></entry>
30209 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30210 <entry>Type: <emphasis>boolean</emphasis></entry>
30211 <entry>Default: <emphasis>false</emphasis></entry>
30217 <indexterm role="concept">
30218 <primary>DNS</primary>
30219 <secondary>resolver options</secondary>
30221 When this option is true, the resolver option RES_DNSRCH is set for DNS
30222 lookups. This is different from the <option>qualify_single</option> option in that it
30223 applies to domains containing dots. Typically, but not standardly, it causes
30224 the resolver to search for the name in the current domain and in parent
30225 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
30226 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
30227 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
30228 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
30231 Setting this option true can cause problems in domains that have a wildcard MX
30232 record, because any domain that does not have its own MX record matches the
30236 <indexterm role="option">
30237 <primary>srv_fail_domains</primary>
30240 <informaltable frame="all">
30241 <tgroup cols="4" colsep="0" rowsep="0">
30242 <colspec colwidth="8*" align="left"/>
30243 <colspec colwidth="5*" align="center"/>
30244 <colspec colwidth="5*" align="center"/>
30245 <colspec colwidth="6*" align="right"/>
30248 <entry><option>srv_fail_domains</option></entry>
30249 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30250 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
30251 <entry>Default: <emphasis>unset</emphasis></entry>
30257 If the DNS lookup for SRV records for one of the domains in this list causes a
30258 DNS lookup error, Exim behaves as if no SRV records were found. See section
30259 <xref linkend="SECTprowitdnsloo"/> for more discussion.
30262 <indexterm role="option">
30263 <primary>widen_domains</primary>
30266 <informaltable frame="all">
30267 <tgroup cols="4" colsep="0" rowsep="0">
30268 <colspec colwidth="8*" align="left"/>
30269 <colspec colwidth="5*" align="center"/>
30270 <colspec colwidth="5*" align="center"/>
30271 <colspec colwidth="6*" align="right"/>
30274 <entry><option>widen_domains</option></entry>
30275 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30276 <entry>Type: <emphasis>string list</emphasis></entry>
30277 <entry>Default: <emphasis>unset</emphasis></entry>
30283 <indexterm role="concept">
30284 <primary>domain</primary>
30285 <secondary>partial; widening</secondary>
30287 If a DNS lookup fails and this option is set, each of its strings in turn is
30288 added onto the end of the domain, and the lookup is tried again. For example,
30291 <literallayout class="monospaced">
30292 widen_domains = fict.example:ref.example
30295 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
30296 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
30297 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
30298 and <option>search_parents</option> options can cause some widening to be undertaken inside
30299 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
30300 when verifying, unless <option>rewrite_headers</option> is false (not the default).
30304 <title>Effect of qualify_single and search_parents</title>
30306 When a domain from an envelope recipient is changed by the resolver as a result
30307 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
30308 corresponding address in the message’s header lines unless <option>rewrite_headers</option>
30309 is set false. Exim then re-routes the address, using the full domain.
30312 These two options affect only the DNS lookup that takes place inside the router
30313 for the domain of the address that is being routed. They do not affect lookups
30314 such as that implied by
30316 <literallayout class="monospaced">
30320 that may happen while processing a router precondition before the router is
30321 entered. No widening ever takes place for these lookups.
30322 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
30323 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
30329 <title>The ipliteral router</title>
30331 <indexterm role="concept">
30332 <primary><command>ipliteral</command> router</primary>
30334 <indexterm role="concept">
30335 <primary>domain literal</primary>
30336 <secondary>routing</secondary>
30338 <indexterm role="concept">
30339 <primary>routers</primary>
30340 <secondary><command>ipliteral</command></secondary>
30342 This router has no private options. Unless it is being used purely for
30343 verification (see <option>verify_only</option>) a transport is required to be defined by the
30344 generic <option>transport</option> option. The router accepts the address if its domain part
30345 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
30346 router handles the address
30348 <literallayout class="monospaced">
30352 by setting up delivery to the host with that IP address. IPv4 domain literals
30353 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
30354 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
30356 <literallayout class="monospaced">
30357 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
30360 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
30361 grounds that sooner or later somebody will try it.
30364 <indexterm role="concept">
30365 <primary><option>self</option> option</primary>
30366 <secondary>in <command>ipliteral</command> router</secondary>
30368 If the IP address matches something in <option>ignore_target_hosts</option>, the router
30369 declines. If an IP literal turns out to refer to the local host, the generic
30370 <option>self</option> option determines what happens.
30373 The RFCs require support for domain literals; however, their use is
30374 controversial in today’s Internet. If you want to use this router, you must
30375 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
30376 Exim will not recognize the domain literal syntax in addresses.
30381 <title>The iplookup router</title>
30383 <indexterm role="concept">
30384 <primary><command>iplookup</command> router</primary>
30386 <indexterm role="concept">
30387 <primary>routers</primary>
30388 <secondary><command>iplookup</command></secondary>
30390 The <command>iplookup</command> router was written to fulfil a specific requirement in
30391 Cambridge University (which in fact no longer exists). For this reason, it is
30392 not included in the binary of Exim by default. If you want to include it, you
30395 <literallayout class="monospaced">
30396 ROUTER_IPLOOKUP=yes
30399 in your <filename>Local/Makefile</filename> configuration file.
30402 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
30403 connection to one or more specific hosts. The host can then return the same or
30404 a different address – in effect rewriting the recipient address in the
30405 message’s envelope. The new address is then passed on to subsequent routers. If
30406 this process fails, the address can be passed on to other routers, or delivery
30407 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
30408 must not be specified for it.
30411 <indexterm role="concept">
30412 <primary>options</primary>
30413 <secondary><command>iplookup</command> router</secondary>
30415 <indexterm role="option">
30416 <primary>hosts</primary>
30419 <informaltable frame="all">
30420 <tgroup cols="4" colsep="0" rowsep="0">
30421 <colspec colwidth="8*" align="left"/>
30422 <colspec colwidth="5*" align="center"/>
30423 <colspec colwidth="5*" align="center"/>
30424 <colspec colwidth="6*" align="right"/>
30427 <entry><option>hosts</option></entry>
30428 <entry>Use: <emphasis>iplookup</emphasis></entry>
30429 <entry>Type: <emphasis>string</emphasis></entry>
30430 <entry>Default: <emphasis>unset</emphasis></entry>
30436 This option must be supplied. Its value is a colon-separated list of host
30437 names. The hosts are looked up using <function>gethostbyname()</function>
30438 (or <function>getipnodebyname()</function> when available)
30439 and are tried in order until one responds to the query. If none respond, what
30440 happens is controlled by <option>optional</option>.
30443 <indexterm role="option">
30444 <primary>optional</primary>
30447 <informaltable frame="all">
30448 <tgroup cols="4" colsep="0" rowsep="0">
30449 <colspec colwidth="8*" align="left"/>
30450 <colspec colwidth="5*" align="center"/>
30451 <colspec colwidth="5*" align="center"/>
30452 <colspec colwidth="6*" align="right"/>
30455 <entry><option>optional</option></entry>
30456 <entry>Use: <emphasis>iplookup</emphasis></entry>
30457 <entry>Type: <emphasis>boolean</emphasis></entry>
30458 <entry>Default: <emphasis>false</emphasis></entry>
30464 If <option>optional</option> is true, if no response is obtained from any host, the address
30465 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
30466 delivery to the address is deferred.
30469 <indexterm role="option">
30470 <primary>port</primary>
30473 <informaltable frame="all">
30474 <tgroup cols="4" colsep="0" rowsep="0">
30475 <colspec colwidth="8*" align="left"/>
30476 <colspec colwidth="5*" align="center"/>
30477 <colspec colwidth="5*" align="center"/>
30478 <colspec colwidth="6*" align="right"/>
30481 <entry><option>port</option></entry>
30482 <entry>Use: <emphasis>iplookup</emphasis></entry>
30483 <entry>Type: <emphasis>integer</emphasis></entry>
30484 <entry>Default: <emphasis>0</emphasis></entry>
30490 <indexterm role="concept">
30491 <primary>port</primary>
30492 <secondary><command>iplookup</command> router</secondary>
30494 This option must be supplied. It specifies the port number for the TCP or UDP
30498 <indexterm role="option">
30499 <primary>protocol</primary>
30502 <informaltable frame="all">
30503 <tgroup cols="4" colsep="0" rowsep="0">
30504 <colspec colwidth="8*" align="left"/>
30505 <colspec colwidth="5*" align="center"/>
30506 <colspec colwidth="5*" align="center"/>
30507 <colspec colwidth="6*" align="right"/>
30510 <entry><option>protocol</option></entry>
30511 <entry>Use: <emphasis>iplookup</emphasis></entry>
30512 <entry>Type: <emphasis>string</emphasis></entry>
30513 <entry>Default: <emphasis>udp</emphasis></entry>
30519 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
30520 protocols is to be used.
30523 <indexterm role="option">
30524 <primary>query</primary>
30527 <informaltable frame="all">
30528 <tgroup cols="4" colsep="0" rowsep="0">
30529 <colspec colwidth="8*" align="left"/>
30530 <colspec colwidth="5*" align="center"/>
30531 <colspec colwidth="5*" align="center"/>
30532 <colspec colwidth="6*" align="right"/>
30535 <entry><option>query</option></entry>
30536 <entry>Use: <emphasis>iplookup</emphasis></entry>
30537 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30538 <entry>Default: <emphasis><literal>$local_part@$domain $local_part@$domain</literal></emphasis></entry>
30544 This defines the content of the query that is sent to the remote hosts. The
30545 repetition serves as a way of checking that a response is to the correct query
30546 in the default case (see <option>response_pattern</option> below).
30549 <indexterm role="option">
30550 <primary>reroute</primary>
30553 <informaltable frame="all">
30554 <tgroup cols="4" colsep="0" rowsep="0">
30555 <colspec colwidth="8*" align="left"/>
30556 <colspec colwidth="5*" align="center"/>
30557 <colspec colwidth="5*" align="center"/>
30558 <colspec colwidth="6*" align="right"/>
30561 <entry><option>reroute</option></entry>
30562 <entry>Use: <emphasis>iplookup</emphasis></entry>
30563 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30564 <entry>Default: <emphasis>unset</emphasis></entry>
30570 If this option is not set, the rerouted address is precisely the byte string
30571 returned by the remote host, up to the first white space, if any. If set, the
30572 string is expanded to form the rerouted address. It can include parts matched
30573 in the response by <option>response_pattern</option> by means of numeric variables such as
30574 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
30575 whether or not a pattern is in use. In all cases, the rerouted address must end
30576 up in the form <emphasis>local_part@domain</emphasis>.
30579 <indexterm role="option">
30580 <primary>response_pattern</primary>
30583 <informaltable frame="all">
30584 <tgroup cols="4" colsep="0" rowsep="0">
30585 <colspec colwidth="8*" align="left"/>
30586 <colspec colwidth="5*" align="center"/>
30587 <colspec colwidth="5*" align="center"/>
30588 <colspec colwidth="6*" align="right"/>
30591 <entry><option>response_pattern</option></entry>
30592 <entry>Use: <emphasis>iplookup</emphasis></entry>
30593 <entry>Type: <emphasis>string</emphasis></entry>
30594 <entry>Default: <emphasis>unset</emphasis></entry>
30600 This option can be set to a regular expression that is applied to the string
30601 returned from the remote host. If the pattern does not match the response, the
30602 router declines. If <option>response_pattern</option> is not set, no checking of the
30603 response is done, unless the query was defaulted, in which case there is a
30604 check that the text returned after the first white space is the original
30605 address. This checks that the answer that has been received is in response to
30606 the correct question. For example, if the response is just a new domain, the
30607 following could be used:
30609 <literallayout class="monospaced">
30610 response_pattern = ^([^@]+)$
30611 reroute = $local_part@$1
30614 <indexterm role="option">
30615 <primary>timeout</primary>
30618 <informaltable frame="all">
30619 <tgroup cols="4" colsep="0" rowsep="0">
30620 <colspec colwidth="8*" align="left"/>
30621 <colspec colwidth="5*" align="center"/>
30622 <colspec colwidth="5*" align="center"/>
30623 <colspec colwidth="6*" align="right"/>
30626 <entry><option>timeout</option></entry>
30627 <entry>Use: <emphasis>iplookup</emphasis></entry>
30628 <entry>Type: <emphasis>time</emphasis></entry>
30629 <entry>Default: <emphasis>5s</emphasis></entry>
30635 This specifies the amount of time to wait for a response from the remote
30636 machine. The same timeout is used for the <function>connect()</function> function for a TCP
30637 call. It does not apply to UDP.
30642 <title>The manualroute router</title>
30644 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
30645 <primary><command>manualroute</command> router</primary>
30647 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
30648 <primary>routers</primary>
30649 <secondary><command>manualroute</command></secondary>
30651 <indexterm role="concept">
30652 <primary>domain</primary>
30653 <secondary>manually routing</secondary>
30655 The <command>manualroute</command> router is so-called because it provides a way of manually
30656 routing an address according to its domain. It is mainly used when you want to
30657 route addresses to remote hosts according to your own rules, bypassing the
30658 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
30659 route to local transports, a facility that may be useful if you want to save
30660 messages for dial-in hosts in local files.
30663 The <command>manualroute</command> router compares a list of domain patterns with the domain
30664 it is trying to route. If there is no match, the router declines. Each pattern
30665 has associated with it a list of hosts and some other optional data, which may
30666 include a transport. The combination of a pattern and its data is called a
30667 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
30668 generic <option>transport</option> option must specify a transport, unless the router is
30669 being used purely for verification (see <option>verify_only</option>).
30672 <indexterm role="concept">
30673 <primary><varname>$host</varname></primary>
30675 In the case of verification, matching the domain pattern is sufficient for the
30676 router to accept the address. When actually routing an address for delivery,
30677 an address that matches a domain pattern is queued for the associated
30678 transport. If the transport is not a local one, a host list must be associated
30679 with the pattern; IP addresses are looked up for the hosts, and these are
30680 passed to the transport along with the mail address. For local transports, a
30681 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
30685 The list of routing rules can be provided as an inline string in
30686 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
30687 or database by setting <option>route_data</option>. Only one of these settings may appear in
30688 any one instance of <command>manualroute</command>. The format of routing rules is described
30689 below, following the list of private options.
30691 <section id="SECTprioptman">
30692 <title>Private options for manualroute</title>
30694 <indexterm role="concept">
30695 <primary>options</primary>
30696 <secondary><command>manualroute</command> router</secondary>
30698 The private options for the <command>manualroute</command> router are as follows:
30701 <indexterm role="option">
30702 <primary>host_find_failed</primary>
30705 <informaltable frame="all">
30706 <tgroup cols="4" colsep="0" rowsep="0">
30707 <colspec colwidth="8*" align="left"/>
30708 <colspec colwidth="5*" align="center"/>
30709 <colspec colwidth="5*" align="center"/>
30710 <colspec colwidth="6*" align="right"/>
30713 <entry><option>host_find_failed</option></entry>
30714 <entry>Use: <emphasis>manualroute</emphasis></entry>
30715 <entry>Type: <emphasis>string</emphasis></entry>
30716 <entry>Default: <emphasis>freeze</emphasis></entry>
30722 This option controls what happens when <command>manualroute</command> tries to find an IP
30723 address for a host, and the host does not exist. The option can be set to one
30726 <literallayout class="monospaced">
30734 The default assumes that this state is a serious configuration error. The
30735 difference between <quote>pass</quote> and <quote>decline</quote> is that the former forces the
30736 address to be passed to the next router (or the router defined by
30737 <option>pass_router</option>),
30738 <indexterm role="concept">
30739 <primary><option>more</option> option</primary>
30741 overriding <option>no_more</option>, whereas the latter passes the address to the next
30742 router only if <option>more</option> is true.
30745 This option applies only to a definite <quote>does not exist</quote> state; if a host
30746 lookup gets a temporary error, delivery is deferred unless the generic
30747 <option>pass_on_timeout</option> option is set.
30750 <indexterm role="option">
30751 <primary>hosts_randomize</primary>
30754 <informaltable frame="all">
30755 <tgroup cols="4" colsep="0" rowsep="0">
30756 <colspec colwidth="8*" align="left"/>
30757 <colspec colwidth="5*" align="center"/>
30758 <colspec colwidth="5*" align="center"/>
30759 <colspec colwidth="6*" align="right"/>
30762 <entry><option>hosts_randomize</option></entry>
30763 <entry>Use: <emphasis>manualroute</emphasis></entry>
30764 <entry>Type: <emphasis>boolean</emphasis></entry>
30765 <entry>Default: <emphasis>false</emphasis></entry>
30771 <indexterm role="concept">
30772 <primary>randomized host list</primary>
30774 <indexterm role="concept">
30775 <primary>host</primary>
30776 <secondary>list of; randomized</secondary>
30778 If this option is set, the order of the items in a host list in a routing rule
30779 is randomized each time the list is used, unless an option in the routing rule
30780 overrides (see below). Randomizing the order of a host list can be used to do
30781 crude load sharing. However, if more than one mail address is routed by the
30782 same router to the same host list, the host lists are considered to be the same
30783 (even though they may be randomized into different orders) for the purpose of
30784 deciding whether to batch the deliveries into a single SMTP transaction.
30787 When <option>hosts_randomize</option> is true, a host list may be split
30788 into groups whose order is separately randomized. This makes it possible to
30789 set up MX-like behaviour. The boundaries between groups are indicated by an
30790 item that is just <literal>+</literal> in the host list. For example:
30792 <literallayout class="monospaced">
30793 route_list = * host1:host2:host3:+:host4:host5
30796 The order of the first three hosts and the order of the last two hosts is
30797 randomized for each use, but the first three always end up before the last two.
30798 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
30799 randomized host list is passed to an <command>smtp</command> transport that also has
30800 <option>hosts_randomize set</option>, the list is not re-randomized.
30803 <indexterm role="option">
30804 <primary>route_data</primary>
30807 <informaltable frame="all">
30808 <tgroup cols="4" colsep="0" rowsep="0">
30809 <colspec colwidth="8*" align="left"/>
30810 <colspec colwidth="5*" align="center"/>
30811 <colspec colwidth="5*" align="center"/>
30812 <colspec colwidth="6*" align="right"/>
30815 <entry><option>route_data</option></entry>
30816 <entry>Use: <emphasis>manualroute</emphasis></entry>
30817 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30818 <entry>Default: <emphasis>unset</emphasis></entry>
30824 If this option is set, it must expand to yield the data part of a routing rule.
30825 Typically, the expansion string includes a lookup based on the domain. For
30828 <literallayout class="monospaced">
30829 route_data = ${lookup{$domain}dbm{/etc/routes}}
30832 If the expansion is forced to fail, or the result is an empty string, the
30833 router declines. Other kinds of expansion failure cause delivery to be
30837 <indexterm role="option">
30838 <primary>route_list</primary>
30841 <informaltable frame="all">
30842 <tgroup cols="4" colsep="0" rowsep="0">
30843 <colspec colwidth="8*" align="left"/>
30844 <colspec colwidth="5*" align="center"/>
30845 <colspec colwidth="5*" align="center"/>
30846 <colspec colwidth="6*" align="right"/>
30849 <entry><option>route_list</option></entry>
30850 <entry>Use: <emphasis>manualroute</emphasis></entry>
30851 <entry>Type: <emphasis> </emphasis></entry>
30852 <entry>Default: <emphasis>string</emphasis></entry>
30858 This string is a list of routing rules, in the form defined below. Note that,
30859 unlike most string lists, the items are separated by semicolons. This is so
30860 that they may contain colon-separated host lists.
30863 <indexterm role="option">
30864 <primary>same_domain_copy_routing</primary>
30867 <informaltable frame="all">
30868 <tgroup cols="4" colsep="0" rowsep="0">
30869 <colspec colwidth="8*" align="left"/>
30870 <colspec colwidth="5*" align="center"/>
30871 <colspec colwidth="5*" align="center"/>
30872 <colspec colwidth="6*" align="right"/>
30875 <entry><option>same_domain_copy_routing</option></entry>
30876 <entry>Use: <emphasis>manualroute</emphasis></entry>
30877 <entry>Type: <emphasis>boolean</emphasis></entry>
30878 <entry>Default: <emphasis>false</emphasis></entry>
30884 <indexterm role="concept">
30885 <primary>address</primary>
30886 <secondary>copying routing</secondary>
30888 Addresses with the same domain are normally routed by the <command>manualroute</command>
30889 router to the same list of hosts. However, this cannot be presumed, because the
30890 router options and preconditions may refer to the local part of the address. By
30891 default, therefore, Exim routes each address in a message independently. DNS
30892 servers run caches, so repeated DNS lookups are not normally expensive, and in
30893 any case, personal messages rarely have more than a few recipients.
30896 If you are running mailing lists with large numbers of subscribers at the same
30897 domain, and you are using a <command>manualroute</command> router which is independent of the
30898 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
30899 lookups for identical domains in one message. In this case, when
30900 <command>manualroute</command> routes an address to a remote transport, any other unrouted
30901 addresses in the message that have the same domain are automatically given the
30902 same routing without processing them independently. However, this is only done
30903 if <option>headers_add</option> and <option>headers_remove</option> are unset.
30907 <title>Routing rules in route_list</title>
30909 The value of <option>route_list</option> is a string consisting of a sequence of routing
30910 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
30911 entered as two semicolons. Alternatively, the list separator can be changed as
30912 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
30913 Empty rules are ignored. The format of each rule is
30916 <<emphasis>domain pattern</emphasis>> <<emphasis>list of hosts</emphasis>> <<emphasis>options</emphasis>>
30919 The following example contains two rules, each with a simple domain pattern and
30922 <literallayout class="monospaced">
30924 dict.ref.example mail-1.ref.example:mail-2.ref.example ; \
30925 thes.ref.example mail-3.ref.example:mail-4.ref.example
30928 The three parts of a rule are separated by white space. The pattern and the
30929 list of hosts can be enclosed in quotes if necessary, and if they are, the
30930 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
30931 single domain pattern, which is the only mandatory item in the rule. The
30932 pattern is in the same format as one item in a domain list (see section
30933 <xref linkend="SECTdomainlist"/>),
30934 except that it may not be the name of an interpolated file.
30935 That is, it may be wildcarded, or a regular expression, or a file or database
30936 lookup (with semicolons doubled, because of the use of semicolon as a separator
30937 in a <option>route_list</option>).
30940 The rules in <option>route_list</option> are searched in order until one of the patterns
30941 matches the domain that is being routed. The list of hosts and then options are
30942 then used as described below. If there is no match, the router declines. When
30943 <option>route_list</option> is set, <option>route_data</option> must not be set.
30947 <title>Routing rules in route_data</title>
30949 The use of <option>route_list</option> is convenient when there are only a small number of
30950 routing rules. For larger numbers, it is easier to use a file or database to
30951 hold the routing information, and use the <option>route_data</option> option instead.
30952 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
30953 Most commonly, <option>route_data</option> is set as a string that contains an
30954 expansion lookup. For example, suppose we place two routing rules in a file
30957 <literallayout class="monospaced">
30958 dict.ref.example: mail-1.ref.example:mail-2.ref.example
30959 thes.ref.example: mail-3.ref.example:mail-4.ref.example
30962 This data can be accessed by setting
30964 <literallayout class="monospaced">
30965 route_data = ${lookup{$domain}lsearch{/the/file/name}}
30968 Failure of the lookup results in an empty string, causing the router to
30969 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
30970 requirement is that the result of expanding the string is a list of hosts,
30971 possibly followed by options, separated by white space. The list of hosts must
30972 be enclosed in quotes if it contains white space.
30976 <title>Format of the list of hosts</title>
30978 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
30979 always separately expanded before use. If the expansion fails, the router
30980 declines. The result of the expansion must be a colon-separated list of names
30981 and/or IP addresses, optionally also including ports. The format of each item
30982 in the list is described in the next section. The list separator can be changed
30983 as described in section <xref linkend="SECTlistconstruct"/>.
30986 If the list of hosts was obtained from a <option>route_list</option> item, the following
30987 variables are set during its expansion:
30992 <indexterm role="concept">
30993 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
30994 <secondary>in <command>manualroute</command> router</secondary>
30996 If the domain was matched against a regular expression, the numeric variables
30997 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
30999 <literallayout class="monospaced">
31000 route_list = ^domain(\d+) host-$1.text.example
31005 <varname>$0</varname> is always set to the entire domain.
31010 <varname>$1</varname> is also set when partial matching is done in a file lookup.
31015 <indexterm role="concept">
31016 <primary><varname>$value</varname></primary>
31018 If the pattern that matched the domain was a lookup item, the data that was
31019 looked up is available in the expansion variable <varname>$value</varname>. For example:
31021 <literallayout class="monospaced">
31022 route_list = lsearch;;/some/file.routes $value
31027 Note the doubling of the semicolon in the pattern that is necessary because
31028 semicolon is the default route list separator.
31031 <section id="SECTformatonehostitem">
31032 <title>Format of one host item</title>
31034 Each item in the list of hosts is either a host name or an IP address,
31035 optionally with an attached port number. When no port is given, an IP address
31036 is not enclosed in brackets. When a port is specified, it overrides the port
31037 specification on the transport. The port is separated from the name or address
31038 by a colon. This leads to some complications:
31043 Because colon is the default separator for the list of hosts, either
31044 the colon that specifies a port must be doubled, or the list separator must
31045 be changed. The following two examples have the same effect:
31047 <literallayout class="monospaced">
31048 route_list = * "host1.tld::1225 : host2.tld::1226"
31049 route_list = * "<+ host1.tld:1225 + host2.tld:1226"
31054 When IPv6 addresses are involved, it gets worse, because they contain
31055 colons of their own. To make this case easier, it is permitted to
31056 enclose an IP address (either v4 or v6) in square brackets if a port
31057 number follows. For example:
31059 <literallayout class="monospaced">
31060 route_list = * "</ [10.1.1.1]:1225 / [::1]:1226"
31065 <section id="SECThostshowused">
31066 <title>How the list of hosts is used</title>
31068 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
31069 the hosts is tried, in the order specified, when carrying out the SMTP
31070 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
31071 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
31075 Hosts may be listed by name or by IP address. An unadorned name in the list of
31076 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
31077 interpreted as an indirection to a sublist of hosts obtained by looking up MX
31078 records in the DNS. For example:
31080 <literallayout class="monospaced">
31081 route_list = * x.y.z:p.q.r/MX:e.f.g
31084 If this feature is used with a port specifier, the port must come last. For
31087 <literallayout class="monospaced">
31088 route_list = * dom1.tld/mx::1225
31091 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
31092 randomized before any lookups are done. Exim then scans the list; for any name
31093 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
31094 be an interface on the local host and the item is not the first in the list,
31095 Exim discards it and any subsequent items. If it is the first item, what
31096 happens is controlled by the
31097 <indexterm role="concept">
31098 <primary><option>self</option> option</primary>
31099 <secondary>in <command>manualroute</command> router</secondary>
31101 <option>self</option> option of the router.
31104 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
31105 hosts obtained by looking up MX records for the name. This is always a DNS
31106 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
31107 below) are not relevant here. The order of these hosts is determined by the
31108 preference values in the MX records, according to the usual rules. Because
31109 randomizing happens before the MX lookup, it does not affect the order that is
31110 defined by MX preferences.
31113 If the local host is present in the sublist obtained from MX records, but is
31114 not the most preferred host in that list, it and any equally or less
31115 preferred hosts are removed before the sublist is inserted into the main list.
31118 If the local host is the most preferred host in the MX list, what happens
31119 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
31120 is not the first item (that is, there are previous hosts in the main list),
31121 Exim discards this name and any subsequent items in the main list.
31124 If the MX item is first in the list of hosts, and the local host is the
31125 most preferred host, what happens is controlled by the <option>self</option> option of the
31129 DNS failures when lookup up the MX records are treated in the same way as DNS
31130 failures when looking up IP addresses: <option>pass_on_timeout</option> and
31131 <option>host_find_failed</option> are used when relevant.
31134 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
31135 whether obtained from an MX lookup or not.
31138 <section id="SECThowoptused">
31139 <title>How the options are used</title>
31141 The options are a sequence of words; in practice no more than three are ever
31142 present. One of the words can be the name of a transport; this overrides the
31143 <option>transport</option> option on the router for this particular routing rule only. The
31144 other words (if present) control randomization of the list of hosts on a
31145 per-rule basis, and how the IP addresses of the hosts are to be found when
31146 routing to a remote transport. These options are as follows:
31151 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
31152 setting of <option>hosts_randomize</option> for this routing rule only.
31157 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
31158 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
31163 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
31164 find IP addresses. This function may ultimately cause a DNS lookup, but it may
31165 also look in <filename>/etc/hosts</filename> or other sources of information.
31170 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
31171 no address records are found. If there is a temporary DNS error (such as a
31172 timeout), delivery is deferred.
31179 <literallayout class="monospaced">
31180 route_list = domain1 host1:host2:host3 randomize bydns;\
31181 domain2 host4:host5
31184 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
31185 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
31186 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
31187 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
31191 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
31192 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
31193 instead of TRY_AGAIN. That is why the default action is to try a DNS
31194 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
31198 If no IP address for a host can be found, what happens is controlled by the
31199 <option>host_find_failed</option> option.
31202 <indexterm role="concept">
31203 <primary><varname>$host</varname></primary>
31205 When an address is routed to a local transport, IP addresses are not looked up.
31206 The host list is passed to the transport in the <varname>$host</varname> variable.
31210 <title>Manualroute examples</title>
31212 In some of the examples that follow, the presence of the <option>remote_smtp</option>
31213 transport, as defined in the default configuration file, is assumed:
31218 <indexterm role="concept">
31219 <primary>smart host</primary>
31220 <secondary>example router</secondary>
31222 The <command>manualroute</command> router can be used to forward all external mail to a
31223 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
31224 named domain list that contains your local domains, for example:
31226 <literallayout class="monospaced">
31227 domainlist local_domains = my.domain.example
31230 You can arrange for all other domains to be routed to a smart host by making
31231 your first router something like this:
31233 <literallayout class="monospaced">
31235 driver = manualroute
31236 domains = !+local_domains
31237 transport = remote_smtp
31238 route_list = * smarthost.ref.example
31241 This causes all non-local addresses to be sent to the single host
31242 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
31243 they are tried in order
31244 (but you can use <option>hosts_randomize</option> to vary the order each time).
31245 Another way of configuring the same thing is this:
31247 <literallayout class="monospaced">
31249 driver = manualroute
31250 transport = remote_smtp
31251 route_list = !+local_domains smarthost.ref.example
31254 There is no difference in behaviour between these two routers as they stand.
31255 However, they behave differently if <option>no_more</option> is added to them. In the first
31256 example, the router is skipped if the domain does not match the <option>domains</option>
31257 precondition; the following router is always tried. If the router runs, it
31258 always matches the domain and so can never decline. Therefore, <option>no_more</option>
31259 would have no effect. In the second case, the router is never skipped; it
31260 always runs. However, if it doesn’t match the domain, it declines. In this case
31261 <option>no_more</option> would prevent subsequent routers from running.
31266 <indexterm role="concept">
31267 <primary>mail hub example</primary>
31269 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
31270 records in the DNS and delivers it via its own private routing mechanism. Often
31271 the final destinations are behind a firewall, with the mail hub being the one
31272 machine that can connect to machines both inside and outside the firewall. The
31273 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
31274 to the correct hosts. For a small number of domains, the routing can be inline,
31275 using the <option>route_list</option> option, but for a larger number a file or database
31276 lookup is easier to manage.
31279 If the domain names are in fact the names of the machines to which the mail is
31280 to be sent by the mail hub, the configuration can be quite simple. For
31283 <literallayout class="monospaced">
31285 driver = manualroute
31286 transport = remote_smtp
31287 route_list = *.rhodes.tvs.example $domain
31290 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
31291 whose names are the same as the mail domains. A similar approach can be taken
31292 if the host name can be obtained from the domain name by a string manipulation
31293 that the expansion facilities can handle. Otherwise, a lookup based on the
31294 domain can be used to find the host:
31296 <literallayout class="monospaced">
31298 driver = manualroute
31299 transport = remote_smtp
31300 route_data = ${lookup {$domain} cdb {/internal/host/routes}}
31303 The result of the lookup must be the name or IP address of the host (or
31304 hosts) to which the address is to be routed. If the lookup fails, the route
31305 data is empty, causing the router to decline. The address then passes to the
31311 <indexterm role="concept">
31312 <primary>batched SMTP output example</primary>
31314 <indexterm role="concept">
31315 <primary>SMTP</primary>
31316 <secondary>batched outgoing; example</secondary>
31318 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
31319 SMTP format for onward transportation by some other means. This is one way of
31320 storing mail for a dial-up host when it is not connected. The route list entry
31321 can be as simple as a single domain name in a configuration like this:
31323 <literallayout class="monospaced">
31325 driver = manualroute
31326 transport = batchsmtp_appendfile
31327 route_list = saved.domain.example
31330 though often a pattern is used to pick up more than one domain. If there are
31331 several domains or groups of domains with different transport requirements,
31332 different transports can be listed in the routing information:
31334 <literallayout class="monospaced">
31336 driver = manualroute
31338 *.saved.domain1.example $domain batch_appendfile; \
31339 *.saved.domain2.example \
31340 ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
31344 <indexterm role="concept">
31345 <primary><varname>$domain</varname></primary>
31347 <indexterm role="concept">
31348 <primary><varname>$host</varname></primary>
31350 The first of these just passes the domain in the <varname>$host</varname> variable, which
31351 doesn’t achieve much (since it is also in <varname>$domain</varname>), but the second does a
31352 file lookup to find a value to pass, causing the router to decline to handle
31353 the address if the lookup fails.
31358 <indexterm role="concept">
31359 <primary>UUCP</primary>
31360 <secondary>example of router for</secondary>
31362 Routing mail directly to UUCP software is a specific case of the use of
31363 <command>manualroute</command> in a gateway to another mail environment. This is an example of
31364 one way it can be done:
31366 <literallayout class="monospaced">
31371 command = /usr/local/bin/uux -r - \
31372 ${substr_-5:$host}!rmail ${local_part}
31373 return_fail_output = true
31378 driver = manualroute
31380 ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
31383 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
31385 <literallayout class="monospaced">
31386 darksite.ethereal.example: darksite.UUCP
31389 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
31390 makes clear the distinction between the domain name
31391 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
31396 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
31397 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
31402 <chapter id="CHAPdriverlast">
31403 <title>The queryprogram router</title>
31405 <indexterm role="concept" id="IIDquerou1" class="startofrange">
31406 <primary><command>queryprogram</command> router</primary>
31408 <indexterm role="concept" id="IIDquerou2" class="startofrange">
31409 <primary>routers</primary>
31410 <secondary><command>queryprogram</command></secondary>
31412 <indexterm role="concept">
31413 <primary>routing</primary>
31414 <secondary>by external program</secondary>
31416 The <command>queryprogram</command> router routes an address by running an external command
31417 and acting on its output. This is an expensive way to route, and is intended
31418 mainly for use in lightly-loaded systems, or for performing experiments.
31419 However, if it is possible to use the precondition options (<option>domains</option>,
31420 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
31421 be used in special cases, even on a busy host. There are the following private
31423 <indexterm role="concept">
31424 <primary>options</primary>
31425 <secondary><command>queryprogram</command> router</secondary>
31429 <indexterm role="option">
31430 <primary>command</primary>
31433 <informaltable frame="all">
31434 <tgroup cols="4" colsep="0" rowsep="0">
31435 <colspec colwidth="8*" align="left"/>
31436 <colspec colwidth="5*" align="center"/>
31437 <colspec colwidth="5*" align="center"/>
31438 <colspec colwidth="6*" align="right"/>
31441 <entry><option>command</option></entry>
31442 <entry>Use: <emphasis>queryprogram</emphasis></entry>
31443 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
31444 <entry>Default: <emphasis>unset</emphasis></entry>
31450 This option must be set. It specifies the command that is to be run. The
31451 command is split up into a command name and arguments, and then each is
31452 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
31453 <xref linkend="CHAPpipetransport"/>).
31456 <indexterm role="option">
31457 <primary>command_group</primary>
31460 <informaltable frame="all">
31461 <tgroup cols="4" colsep="0" rowsep="0">
31462 <colspec colwidth="8*" align="left"/>
31463 <colspec colwidth="5*" align="center"/>
31464 <colspec colwidth="5*" align="center"/>
31465 <colspec colwidth="6*" align="right"/>
31468 <entry><option>command_group</option></entry>
31469 <entry>Use: <emphasis>queryprogram</emphasis></entry>
31470 <entry>Type: <emphasis>string</emphasis></entry>
31471 <entry>Default: <emphasis>unset</emphasis></entry>
31477 <indexterm role="concept">
31478 <primary>gid (group id)</primary>
31479 <secondary>in <command>queryprogram</command> router</secondary>
31481 This option specifies a gid to be set when running the command while routing an
31482 address for deliver. It must be set if <option>command_user</option> specifies a numerical
31483 uid. If it begins with a digit, it is interpreted as the numerical value of the
31484 gid. Otherwise it is looked up using <function>getgrnam()</function>.
31487 <indexterm role="option">
31488 <primary>command_user</primary>
31491 <informaltable frame="all">
31492 <tgroup cols="4" colsep="0" rowsep="0">
31493 <colspec colwidth="8*" align="left"/>
31494 <colspec colwidth="5*" align="center"/>
31495 <colspec colwidth="5*" align="center"/>
31496 <colspec colwidth="6*" align="right"/>
31499 <entry><option>command_user</option></entry>
31500 <entry>Use: <emphasis>queryprogram</emphasis></entry>
31501 <entry>Type: <emphasis>string</emphasis></entry>
31502 <entry>Default: <emphasis>unset</emphasis></entry>
31508 <indexterm role="concept">
31509 <primary>uid (user id)</primary>
31510 <secondary>for <command>queryprogram</command></secondary>
31512 This option must be set. It specifies the uid which is set when running the
31513 command while routing an address for delivery. If the value begins with a digit,
31514 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
31515 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
31516 not set, a value for the gid also.
31519 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
31520 root, which it does during a normal delivery in a conventional configuration.
31521 However, when an address is being verified during message reception, Exim is
31522 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
31523 is called from a non-root process, Exim cannot change uid or gid before running
31524 the command. In this circumstance the command runs under the current uid and
31528 <indexterm role="option">
31529 <primary>current_directory</primary>
31532 <informaltable frame="all">
31533 <tgroup cols="4" colsep="0" rowsep="0">
31534 <colspec colwidth="8*" align="left"/>
31535 <colspec colwidth="5*" align="center"/>
31536 <colspec colwidth="5*" align="center"/>
31537 <colspec colwidth="6*" align="right"/>
31540 <entry><option>current_directory</option></entry>
31541 <entry>Use: <emphasis>queryprogram</emphasis></entry>
31542 <entry>Type: <emphasis>string</emphasis></entry>
31543 <entry>Default: <emphasis>/</emphasis></entry>
31549 This option specifies an absolute path which is made the current directory
31550 before running the command.
31553 <indexterm role="option">
31554 <primary>timeout</primary>
31557 <informaltable frame="all">
31558 <tgroup cols="4" colsep="0" rowsep="0">
31559 <colspec colwidth="8*" align="left"/>
31560 <colspec colwidth="5*" align="center"/>
31561 <colspec colwidth="5*" align="center"/>
31562 <colspec colwidth="6*" align="right"/>
31565 <entry><option>timeout</option></entry>
31566 <entry>Use: <emphasis>queryprogram</emphasis></entry>
31567 <entry>Type: <emphasis>time</emphasis></entry>
31568 <entry>Default: <emphasis>1h</emphasis></entry>
31574 If the command does not complete within the timeout period, its process group
31575 is killed and the message is frozen. A value of zero time specifies no
31579 The standard output of the command is connected to a pipe, which is read when
31580 the command terminates. It should consist of a single line of output,
31581 containing up to five fields, separated by white space. The maximum length of
31582 the line is 1023 characters. Longer lines are silently truncated. The first
31583 field is one of the following words (case-insensitive):
31588 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
31594 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
31595 <option>no_more</option> is set.
31600 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
31601 subsequent text on the line is an error message. If the router is run as part
31602 of address verification during an incoming SMTP message, the message is
31603 included in the SMTP response.
31608 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
31609 subsequent text on the line is an error message which is logged. It is not
31610 included in any SMTP response.
31615 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
31620 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
31621 <option>pass_router</option>), overriding <option>no_more</option>.
31626 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
31627 new addresses, which are routed independently, starting with the first router,
31628 or the router specified by <option>redirect_router</option>, if set.
31633 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
31634 number of keyed data values, as follows (split into two lines here, to fit on
31637 <literallayout class="monospaced">
31638 ACCEPT TRANSPORT=<transport> HOSTS=<list of hosts>
31639 LOOKUP=byname|bydns DATA=<text>
31642 The data items can be given in any order, and all are optional. If no transport
31643 is included, the transport specified by the generic <option>transport</option> option is
31644 used. The list of hosts and the lookup type are needed only if the transport is
31645 an <command>smtp</command> transport that does not itself supply a list of hosts.
31648 The format of the list of hosts is the same as for the <command>manualroute</command> router.
31649 As well as host names and IP addresses with optional port numbers, as described
31650 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
31651 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
31652 (see section <xref linkend="SECThostshowused"/>).
31655 If the lookup type is not specified, Exim behaves as follows when trying to
31656 find an IP address for each host: First, a DNS lookup is done. If this yields
31657 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
31658 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
31659 result of the lookup is the result of that call.
31662 <indexterm role="concept">
31663 <primary><varname>$address_data</varname></primary>
31665 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
31666 variable. For example, this return line
31668 <literallayout class="monospaced">
31669 accept hosts=x1.y.example:x2.y.example data="rule1"
31672 routes the address to the default transport, passing a list of two hosts. When
31673 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
31674 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
31675 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
31679 <chapter id="CHAPredirect">
31680 <title>The redirect router</title>
31682 <indexterm role="concept" id="IIDredrou1" class="startofrange">
31683 <primary><command>redirect</command> router</primary>
31685 <indexterm role="concept" id="IIDredrou2" class="startofrange">
31686 <primary>routers</primary>
31687 <secondary><command>redirect</command></secondary>
31689 <indexterm role="concept">
31690 <primary>alias file</primary>
31691 <secondary>in a <command>redirect</command> router</secondary>
31693 <indexterm role="concept">
31694 <primary>address redirection</primary>
31695 <secondary><command>redirect</command> router</secondary>
31697 The <command>redirect</command> router handles several kinds of address redirection. Its most
31698 common uses are for resolving local part aliases from a central alias file
31699 (usually called <filename>/etc/aliases</filename>) and for handling users’ personal <filename>.forward</filename>
31700 files, but it has many other potential uses. The incoming address can be
31701 redirected in several different ways:
31706 It can be replaced by one or more new addresses which are themselves routed
31712 It can be routed to be delivered to a given file or directory.
31717 It can be routed to be delivered to a specified pipe command.
31722 It can cause an automatic reply to be generated.
31727 It can be forced to fail, with a custom error message.
31732 It can be temporarily deferred.
31737 It can be discarded.
31742 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
31743 However, there are some private options which define transports for delivery to
31744 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
31745 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
31748 <title>Redirection data</title>
31750 The router operates by interpreting a text string which it obtains either by
31751 expanding the contents of the <option>data</option> option, or by reading the entire
31752 contents of a file whose name is given in the <option>file</option> option. These two
31753 options are mutually exclusive. The first is commonly used for handling system
31754 aliases, in a configuration like this:
31756 <literallayout class="monospaced">
31759 data = ${lookup{$local_part}lsearch{/etc/aliases}}
31762 If the lookup fails, the expanded string in this example is empty. When the
31763 expansion of <option>data</option> results in an empty string, the router declines. A forced
31764 expansion failure also causes the router to decline; other expansion failures
31765 cause delivery to be deferred.
31768 A configuration using <option>file</option> is commonly used for handling users’
31769 <filename>.forward</filename> files, like this:
31771 <literallayout class="monospaced">
31775 file = $home/.forward
31779 If the file does not exist, or causes no action to be taken (for example, it is
31780 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
31781 is not the case when the file contains syntactically valid items that happen to
31782 yield empty addresses, for example, items containing only RFC 2822 address
31787 <title>Forward files and address verification</title>
31789 <indexterm role="concept">
31790 <primary>address redirection</primary>
31791 <secondary>while verifying</secondary>
31793 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users’
31794 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
31799 When Exim is receiving an incoming SMTP message from a remote host, it is
31800 running under the Exim uid, not as root. Exim is unable to change uid to read
31801 the file as the user, and it may not be able to read it as the Exim user. So in
31802 practice the router may not be able to operate.
31807 However, even when the router can operate, the existence of a <filename>.forward</filename> file
31808 is unimportant when verifying an address. What should be checked is whether the
31809 local part is a valid user name or not. Cutting out the redirection processing
31810 saves some resources.
31816 <title>Interpreting redirection data</title>
31818 <indexterm role="concept">
31819 <primary>Sieve filter</primary>
31820 <secondary>specifying in redirection data</secondary>
31822 <indexterm role="concept">
31823 <primary>filter</primary>
31824 <secondary>specifying in redirection data</secondary>
31826 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
31827 can be interpreted in two different ways:
31832 If the <option>allow_filter</option> option is set true, and the data begins with the text
31833 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
31834 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
31835 respectively. Details of the syntax and semantics of filter files are described
31836 in a separate document entitled <emphasis>Exim’s interfaces to mail filtering</emphasis>; this
31837 document is intended for use by end users.
31842 Otherwise, the data must be a comma-separated list of redirection items, as
31843 described in the next section.
31848 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
31849 in a non-filter redirection list must always be an absolute path. A filter may
31850 generate a relative path – how this is handled depends on the transport’s
31851 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
31852 for the <command>appendfile</command> transport.
31855 <section id="SECTitenonfilred">
31856 <title>Items in a non-filter redirection list</title>
31858 <indexterm role="concept">
31859 <primary>address redirection</primary>
31860 <secondary>non-filter list items</secondary>
31862 When the redirection data is not an Exim or Sieve filter, for example, if it
31863 comes from a conventional alias or forward file, it consists of a list of
31864 addresses, file names, pipe commands, or certain special items (see section
31865 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
31866 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
31867 depending on their default values. The items in the list are separated by
31868 commas or newlines.
31869 If a comma is required in an item, the entire item must be enclosed in double
31873 Lines starting with a # character are comments, and are ignored, and # may
31874 also appear following a comma, in which case everything between the # and the
31875 next newline character is ignored.
31878 If an item is entirely enclosed in double quotes, these are removed. Otherwise
31879 double quotes are retained because some forms of mail address require their use
31880 (but never to enclose the entire address). In the following description,
31881 <quote>item</quote> refers to what remains after any surrounding double quotes have been
31885 <indexterm role="concept">
31886 <primary><varname>$local_part</varname></primary>
31888 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
31889 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
31890 of the <option>quote_local_part</option> expansion operator, in case the local part contains
31891 special characters. For example, to redirect all mail for the domain
31892 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
31895 <literallayout class="monospaced">
31896 data = ${quote_local_part:$local_part}@newdomain.example
31899 <section id="SECTredlocmai">
31900 <title>Redirecting to a local mailbox</title>
31902 <indexterm role="concept">
31903 <primary>routing</primary>
31904 <secondary>loops in</secondary>
31906 <indexterm role="concept">
31907 <primary>loop while routing</primary>
31908 <secondary>avoidance of</secondary>
31910 <indexterm role="concept">
31911 <primary>address redirection</primary>
31912 <secondary>to local mailbox</secondary>
31914 A redirection item may safely be the same as the address currently under
31915 consideration. This does not cause a routing loop, because a router is
31916 automatically skipped if any ancestor of the address that is being processed
31917 is the same as the current address and was processed by the current router.
31918 Such an address is therefore passed to the following routers, so it is handled
31919 as if there were no redirection. When making this loop-avoidance test, the
31920 complete local part, including any prefix or suffix, is used.
31923 <indexterm role="concept">
31924 <primary>address redirection</primary>
31925 <secondary>local part without domain</secondary>
31927 Specifying the same local part without a domain is a common usage in personal
31928 filter files when the user wants to have messages delivered to the local
31929 mailbox and also forwarded elsewhere. For example, the user whose login is
31930 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
31932 <literallayout class="monospaced">
31933 cleo, cleopatra@egypt.example
31936 <indexterm role="concept">
31937 <primary>backslash in alias file</primary>
31939 <indexterm role="concept">
31940 <primary>alias file</primary>
31941 <secondary>backslash in</secondary>
31943 For compatibility with other MTAs, such unqualified local parts may be
31944 preceeded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
31945 it does make a difference if more than one domain is being handled
31949 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
31950 2822 address that does not include a domain, the item is qualified using the
31951 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
31952 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
31953 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
31956 Care must be taken if there are alias names for local users.
31957 Consider an MTA handling a single local domain where the system alias file
31960 <literallayout class="monospaced">
31964 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
31965 messages in the local mailbox, and also forward copies elsewhere. He creates
31968 <literallayout class="monospaced">
31969 Sam.Reman, spqr@reme.elsewhere.example
31972 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
31973 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
31974 second time round, because it has previously routed it,
31975 and the following routers presumably cannot handle the alias. The forward file
31976 should really contain
31978 <literallayout class="monospaced">
31979 spqr, spqr@reme.elsewhere.example
31982 but because this is such a common error, the <option>check_ancestor</option> option (see
31983 below) exists to provide a way to get round it. This is normally set on a
31984 <command>redirect</command> router that is handling users’ <filename>.forward</filename> files.
31987 <section id="SECTspecitredli">
31988 <title>Special items in redirection lists</title>
31990 In addition to addresses, the following types of item may appear in redirection
31991 lists (that is, in non-filter redirection data):
31996 <indexterm role="concept">
31997 <primary>pipe</primary>
31998 <secondary>in redirection list</secondary>
32000 <indexterm role="concept">
32001 <primary>address redirection</primary>
32002 <secondary>to pipe</secondary>
32004 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
32005 as a valid RFC 2822 address that includes a domain. A transport for running the
32006 command must be specified by the <option>pipe_transport</option> option.
32007 Normally, either the router or the transport specifies a user and a group under
32008 which to run the delivery. The default is to use the Exim user and group.
32011 Single or double quotes can be used for enclosing the individual arguments of
32012 the pipe command; no interpretation of escapes is done for single quotes. If
32013 the command contains a comma character, it is necessary to put the whole item
32014 in double quotes, for example:
32016 <literallayout class="monospaced">
32017 "|/some/command ready,steady,go"
32020 since items in redirection lists are terminated by commas. Do not, however,
32021 quote just the command. An item such as
32023 <literallayout class="monospaced">
32024 |"/some/command ready,steady,go"
32027 is interpreted as a pipe with a rather strange command name, and no arguments.
32032 <indexterm role="concept">
32033 <primary>file</primary>
32034 <secondary>in redirection list</secondary>
32036 <indexterm role="concept">
32037 <primary>address redirection</primary>
32038 <secondary>to file</secondary>
32040 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
32041 parse as a valid RFC 2822 address that includes a domain. For example,
32043 <literallayout class="monospaced">
32044 /home/world/minbari
32047 is treated as a file name, but
32049 <literallayout class="monospaced">
32050 /s=molari/o=babylon/@x400gate.way
32053 is treated as an address. For a file name, a transport must be specified using
32054 the <option>file_transport</option> option. However, if the generated path name ends with a
32055 forward slash character, it is interpreted as a directory name rather than a
32056 file name, and <option>directory_transport</option> is used instead.
32059 Normally, either the router or the transport specifies a user and a group under
32060 which to run the delivery. The default is to use the Exim user and group.
32063 <indexterm role="concept">
32064 <primary><filename>/dev/null</filename></primary>
32066 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
32067 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
32068 instead of a transport name. In this case the user and group are not used.
32073 <indexterm role="concept">
32074 <primary>included address list</primary>
32076 <indexterm role="concept">
32077 <primary>address redirection</primary>
32078 <secondary>included external list</secondary>
32080 If an item is of the form
32082 <literallayout class="monospaced">
32083 :include:<path name>
32086 a list of further items is taken from the given file and included at that
32087 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
32088 out-of-line addition to the list. The items in the included list are separated
32089 by commas or newlines and are not subject to expansion. If this is the first
32090 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
32091 the alias name. This example is incorrect:
32093 <literallayout class="monospaced">
32094 list1 :include:/opt/lists/list1
32097 It must be given as
32099 <literallayout class="monospaced">
32100 list1: :include:/opt/lists/list1
32105 <indexterm role="concept">
32106 <primary>address redirection</primary>
32107 <secondary>to black hole</secondary>
32109 Sometimes you want to throw away mail to a particular local part. Making the
32110 <option>data</option> option expand to an empty string does not work, because that causes
32111 the router to decline. Instead, the alias item
32112 <indexterm role="concept">
32113 <primary>black hole</primary>
32115 <indexterm role="concept">
32116 <primary>abandoning mail</primary>
32119 <literallayout class="monospaced">
32123 can be used. It does what its name implies. No delivery is done, and no error
32124 message is generated. This has the same effect as specifing <filename>/dev/null</filename>, but
32125 can be independently disabled.
32128 <emphasis role="bold">Warning</emphasis>: If <literal>:blackhole:</literal> appears anywhere in a redirection list, no
32129 delivery is done for the original local part, even if other redirection items
32130 are present. If you are generating a multi-item list (for example, by reading a
32131 database) and need the ability to provide a no-op item, you must use
32132 <filename>/dev/null</filename>.
32137 <indexterm role="concept">
32138 <primary>delivery</primary>
32139 <secondary>forcing failure</secondary>
32141 <indexterm role="concept">
32142 <primary>delivery</primary>
32143 <secondary>forcing deferral</secondary>
32145 <indexterm role="concept">
32146 <primary>failing delivery</primary>
32147 <secondary>forcing</secondary>
32149 <indexterm role="concept">
32150 <primary>deferred delivery</primary>
32151 <secondary>forcing</secondary>
32153 <indexterm role="concept">
32154 <primary>customizing</primary>
32155 <secondary>failure message</secondary>
32157 An attempt to deliver a particular address can be deferred or forced to fail by
32158 redirection items of the form
32160 <literallayout class="monospaced">
32165 respectively. When a redirection list contains such an item, it applies to the
32166 entire redirection; any other items in the list are ignored (<emphasis>:blackhole:</emphasis> is
32167 different). Any text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error
32168 text associated with the failure. For example, an alias file might contain:
32170 <literallayout class="monospaced">
32171 X.Employee: :fail: Gone away, no forwarding address
32173 <para revisionflag="changed">
32174 In the case of an address that is being verified from an ACL or as the subject
32176 <indexterm role="concept">
32177 <primary>VRFY error text</primary>
32178 <secondary>display of</secondary>
32180 VRFY command, the text is included in the SMTP error response by
32182 <indexterm role="concept">
32183 <primary>EXPN error text</primary>
32184 <secondary>display of</secondary>
32186 The text is not included in the response to an EXPN command. In non-SMTP cases
32187 the text is included in the error message that Exim generates.
32189 <para revisionflag="changed">
32190 <indexterm role="concept">
32191 <primary>SMTP</primary>
32192 <secondary>error codes</secondary>
32194 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
32195 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
32196 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
32197 followed by a space, and the very first digit is the same as the default error
32198 code, the code from the message is used instead. If the very first digit is
32199 incorrect, a panic error is logged, and the default code is used. You can
32200 suppress the use of the supplied code in a redirect router by setting the
32201 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
32204 <para revisionflag="changed">
32205 <indexterm role="concept">
32206 <primary><varname>$acl_verify_message</varname></primary>
32208 In an ACL, an explicitly provided message overrides the default, but the
32209 default message is available in the variable <varname>$acl_verify_message</varname> and can
32210 therefore be included in a custom message if this is desired.
32213 Normally the error text is the rest of the redirection list – a comma does
32214 not terminate it – but a newline does act as a terminator. Newlines are not
32215 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
32216 as part of the continuation process, but they may exist in other kinds of
32217 lookup and in <emphasis>:include:</emphasis> files.
32220 During routing for message delivery (as opposed to verification), a redirection
32221 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
32222 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
32223 subsequent delivery attempt can happen at a later time. If an address is
32224 deferred for too long, it will ultimately fail, because the normal retry
32230 <indexterm role="concept">
32231 <primary>alias file</primary>
32232 <secondary>exception to default</secondary>
32234 Sometimes it is useful to use a single-key search type with a default (see
32235 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
32236 for exceptions to the default. These can be handled by aliasing them to
32238 <literallayout class="monospaced">
32242 This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command> router to
32243 decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which results in
32244 an empty redirection list has the same effect.
32250 <title>Duplicate addresses</title>
32252 <indexterm role="concept">
32253 <primary>duplicate addresses</primary>
32255 <indexterm role="concept">
32256 <primary>address duplicate</primary>
32257 <secondary>discarding</secondary>
32259 <indexterm role="concept">
32260 <primary>pipe</primary>
32261 <secondary>duplicated</secondary>
32263 Exim removes duplicate addresses from the list to which it is delivering, so as
32264 to deliver just one copy to each address. This does not apply to deliveries
32265 routed to pipes by different immediate parent addresses, but an indirect
32266 aliasing scheme of the type
32268 <literallayout class="monospaced">
32269 pipe: |/some/command $local_part
32274 does not work with a message that is addressed to both local parts, because
32275 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
32276 discarded as being the same as a previously handled address. However, a scheme
32279 <literallayout class="monospaced">
32280 localpart1: |/some/command $local_part
32281 localpart2: |/some/command $local_part
32284 does result in two different pipe deliveries, because the immediate parents of
32285 the pipes are distinct.
32289 <title>Repeated redirection expansion</title>
32291 <indexterm role="concept">
32292 <primary>repeated redirection expansion</primary>
32294 <indexterm role="concept">
32295 <primary>address redirection</primary>
32296 <secondary>repeated for each delivery attempt</secondary>
32298 When a message cannot be delivered to all of its recipients immediately,
32299 leading to two or more delivery attempts, redirection expansion is carried out
32300 afresh each time for those addresses whose children were not all previously
32301 delivered. If redirection is being used as a mailing list, this can lead to new
32302 members of the list receiving copies of old messages. The <option>one_time</option> option
32303 can be used to avoid this.
32307 <title>Errors in redirection lists</title>
32309 <indexterm role="concept">
32310 <primary>address redirection</primary>
32311 <secondary>errors</secondary>
32313 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
32314 error is skipped, and an entry is written to the main log. This may be useful
32315 for mailing lists that are automatically managed. Otherwise, if an error is
32316 detected while generating the list of new addresses, the original address is
32317 deferred. See also <option>syntax_errors_to</option>.
32321 <title>Private options for the redirect router</title>
32323 <indexterm role="concept">
32324 <primary>options</primary>
32325 <secondary><command>redirect</command> router</secondary>
32327 The private options for the <command>redirect</command> router are as follows:
32330 <indexterm role="option">
32331 <primary>allow_defer</primary>
32334 <informaltable frame="all">
32335 <tgroup cols="4" colsep="0" rowsep="0">
32336 <colspec colwidth="8*" align="left"/>
32337 <colspec colwidth="5*" align="center"/>
32338 <colspec colwidth="5*" align="center"/>
32339 <colspec colwidth="6*" align="right"/>
32342 <entry><option>allow_defer</option></entry>
32343 <entry>Use: <emphasis>redirect</emphasis></entry>
32344 <entry>Type: <emphasis>boolean</emphasis></entry>
32345 <entry>Default: <emphasis>false</emphasis></entry>
32351 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
32352 data, or the <option>defer</option> command in an Exim filter file.
32355 <indexterm role="option">
32356 <primary>allow_fail</primary>
32359 <informaltable frame="all">
32360 <tgroup cols="4" colsep="0" rowsep="0">
32361 <colspec colwidth="8*" align="left"/>
32362 <colspec colwidth="5*" align="center"/>
32363 <colspec colwidth="5*" align="center"/>
32364 <colspec colwidth="6*" align="right"/>
32367 <entry><option>allow_fail</option></entry>
32368 <entry>Use: <emphasis>redirect</emphasis></entry>
32369 <entry>Type: <emphasis>boolean</emphasis></entry>
32370 <entry>Default: <emphasis>false</emphasis></entry>
32376 <indexterm role="concept">
32377 <primary>failing delivery</primary>
32378 <secondary>from filter</secondary>
32380 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
32381 and the <option>fail</option> command may be used in an Exim filter file.
32384 <indexterm role="option">
32385 <primary>allow_filter</primary>
32388 <informaltable frame="all">
32389 <tgroup cols="4" colsep="0" rowsep="0">
32390 <colspec colwidth="8*" align="left"/>
32391 <colspec colwidth="5*" align="center"/>
32392 <colspec colwidth="5*" align="center"/>
32393 <colspec colwidth="6*" align="right"/>
32396 <entry><option>allow_filter</option></entry>
32397 <entry>Use: <emphasis>redirect</emphasis></entry>
32398 <entry>Type: <emphasis>boolean</emphasis></entry>
32399 <entry>Default: <emphasis>false</emphasis></entry>
32405 <indexterm role="concept">
32406 <primary>filter</primary>
32407 <secondary>enabling use of</secondary>
32409 <indexterm role="concept">
32410 <primary>Sieve filter</primary>
32411 <secondary>enabling use of</secondary>
32413 Setting this option allows Exim to interpret redirection data that starts with
32414 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
32415 are some features of Exim filter files that some administrators may wish to
32416 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
32419 It is also possible to lock out Exim filters or Sieve filters while allowing
32420 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
32423 The filter is run using the uid and gid set by the generic <option>user</option> and
32424 <option>group</option> options. These take their defaults from the password data if
32425 <option>check_local_user</option> is set, so in the normal case of users’ personal filter
32426 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
32427 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
32430 <indexterm role="option">
32431 <primary>allow_freeze</primary>
32434 <informaltable frame="all">
32435 <tgroup cols="4" colsep="0" rowsep="0">
32436 <colspec colwidth="8*" align="left"/>
32437 <colspec colwidth="5*" align="center"/>
32438 <colspec colwidth="5*" align="center"/>
32439 <colspec colwidth="6*" align="right"/>
32442 <entry><option>allow_freeze</option></entry>
32443 <entry>Use: <emphasis>redirect</emphasis></entry>
32444 <entry>Type: <emphasis>boolean</emphasis></entry>
32445 <entry>Default: <emphasis>false</emphasis></entry>
32451 <indexterm role="concept">
32452 <primary>freezing messages</primary>
32453 <secondary>allowing in filter</secondary>
32455 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
32456 This command is more normally encountered in system filters, and is disabled by
32457 default for redirection filters because it isn’t something you usually want to
32458 let ordinary users do.
32461 <indexterm role="option">
32462 <primary>check_ancestor</primary>
32465 <informaltable frame="all">
32466 <tgroup cols="4" colsep="0" rowsep="0">
32467 <colspec colwidth="8*" align="left"/>
32468 <colspec colwidth="5*" align="center"/>
32469 <colspec colwidth="5*" align="center"/>
32470 <colspec colwidth="6*" align="right"/>
32473 <entry><option>check_ancestor</option></entry>
32474 <entry>Use: <emphasis>redirect</emphasis></entry>
32475 <entry>Type: <emphasis>boolean</emphasis></entry>
32476 <entry>Default: <emphasis>false</emphasis></entry>
32482 This option is concerned with handling generated addresses that are the same
32483 as some address in the list of redirection ancestors of the current address.
32484 Although it is turned off by default in the code, it is set in the default
32485 configuration file for handling users’ <filename>.forward</filename> files. It is recommended
32486 for this use of the <command>redirect</command> router.
32489 When <option>check_ancestor</option> is set, if a generated address (including the domain)
32490 is the same as any ancestor of the current address, it is replaced by a copy of
32491 the current address. This helps in the case where local part A is aliased to B,
32492 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
32493 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
32494 <filename> jb/.forward</filename> contains:
32496 <literallayout class="monospaced">
32497 \Joe.Bloggs, <other item(s)>
32500 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
32501 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
32502 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
32503 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
32504 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
32505 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
32506 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
32507 original address. See also the <option>repeat_use</option> option below.
32510 <indexterm role="option">
32511 <primary>check_group</primary>
32514 <informaltable frame="all">
32515 <tgroup cols="4" colsep="0" rowsep="0">
32516 <colspec colwidth="8*" align="left"/>
32517 <colspec colwidth="5*" align="center"/>
32518 <colspec colwidth="5*" align="center"/>
32519 <colspec colwidth="6*" align="right"/>
32522 <entry><option>check_group</option></entry>
32523 <entry>Use: <emphasis>redirect</emphasis></entry>
32524 <entry>Type: <emphasis>boolean</emphasis></entry>
32525 <entry>Default: <emphasis>see below</emphasis></entry>
32531 When the <option>file</option> option is used, the group owner of the file is checked only
32532 when this option is set. The permitted groups are those listed in the
32533 <option>owngroups</option> option, together with the user’s default group if
32534 <option>check_local_user</option> is set. If the file has the wrong group, routing is
32535 deferred. The default setting for this option is true if <option>check_local_user</option>
32536 is set and the <option>modemask</option> option permits the group write bit, or if the
32537 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
32540 <indexterm role="option">
32541 <primary>check_owner</primary>
32544 <informaltable frame="all">
32545 <tgroup cols="4" colsep="0" rowsep="0">
32546 <colspec colwidth="8*" align="left"/>
32547 <colspec colwidth="5*" align="center"/>
32548 <colspec colwidth="5*" align="center"/>
32549 <colspec colwidth="6*" align="right"/>
32552 <entry><option>check_owner</option></entry>
32553 <entry>Use: <emphasis>redirect</emphasis></entry>
32554 <entry>Type: <emphasis>boolean</emphasis></entry>
32555 <entry>Default: <emphasis>see below</emphasis></entry>
32561 When the <option>file</option> option is used, the owner of the file is checked only when
32562 this option is set. If <option>check_local_user</option> is set, the local user is
32563 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
32564 option. The default value for this option is true if <option>check_local_user</option> or
32565 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
32568 <indexterm role="option">
32569 <primary>data</primary>
32572 <informaltable frame="all">
32573 <tgroup cols="4" colsep="0" rowsep="0">
32574 <colspec colwidth="8*" align="left"/>
32575 <colspec colwidth="5*" align="center"/>
32576 <colspec colwidth="5*" align="center"/>
32577 <colspec colwidth="6*" align="right"/>
32580 <entry><option>data</option></entry>
32581 <entry>Use: <emphasis>redirect</emphasis></entry>
32582 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
32583 <entry>Default: <emphasis>unset</emphasis></entry>
32589 This option is mutually exclusive with <option>file</option>. One or other of them must be
32590 set, but not both. The contents of <option>data</option> are expanded, and then used as the
32591 list of forwarding items, or as a set of filtering instructions. If the
32592 expansion is forced to fail, or the result is an empty string or a string that
32593 has no effect (consists entirely of comments), the router declines.
32596 When filtering instructions are used, the string must begin with <quote>#Exim
32597 filter</quote>, and all comments in the string, including this initial one, must be
32598 terminated with newline characters. For example:
32600 <literallayout class="monospaced">
32601 data = #Exim filter\n\
32602 if $h_to: contains Exim then save $home/mail/exim endif
32605 If you are reading the data from a database where newlines cannot be included,
32606 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
32607 choice into a newline.
32610 <indexterm role="option">
32611 <primary>directory_transport</primary>
32614 <informaltable frame="all">
32615 <tgroup cols="4" colsep="0" rowsep="0">
32616 <colspec colwidth="8*" align="left"/>
32617 <colspec colwidth="5*" align="center"/>
32618 <colspec colwidth="5*" align="center"/>
32619 <colspec colwidth="6*" align="right"/>
32622 <entry><option>directory_transport</option></entry>
32623 <entry>Use: <emphasis>redirect</emphasis></entry>
32624 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
32625 <entry>Default: <emphasis>unset</emphasis></entry>
32631 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
32632 ending with a slash is specified as a new <quote>address</quote>. The transport used is
32633 specified by this option, which, after expansion, must be the name of a
32634 configured transport. This should normally be an <command>appendfile</command> transport.
32637 <indexterm role="option">
32638 <primary>file</primary>
32641 <informaltable frame="all">
32642 <tgroup cols="4" colsep="0" rowsep="0">
32643 <colspec colwidth="8*" align="left"/>
32644 <colspec colwidth="5*" align="center"/>
32645 <colspec colwidth="5*" align="center"/>
32646 <colspec colwidth="6*" align="right"/>
32649 <entry><option>file</option></entry>
32650 <entry>Use: <emphasis>redirect</emphasis></entry>
32651 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
32652 <entry>Default: <emphasis>unset</emphasis></entry>
32658 This option specifies the name of a file that contains the redirection data. It
32659 is mutually exclusive with the <option>data</option> option. The string is expanded before
32660 use; if the expansion is forced to fail, the router declines. Other expansion
32661 failures cause delivery to be deferred. The result of a successful expansion
32662 must be an absolute path. The entire file is read and used as the redirection
32663 data. If the data is an empty string or a string that has no effect (consists
32664 entirely of comments), the router declines.
32667 <indexterm role="concept">
32668 <primary>NFS</primary>
32669 <secondary>checking for file existence</secondary>
32671 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
32672 runs a check on the containing directory,
32673 unless <option>ignore_enotdir</option> is true (see below).
32674 If the directory does not appear to exist, delivery is deferred. This can
32675 happen when users’ <filename>.forward</filename> files are in NFS-mounted directories, and there
32676 is a mount problem. If the containing directory does exist, but the file does
32677 not, the router declines.
32680 <indexterm role="option">
32681 <primary>file_transport</primary>
32684 <informaltable frame="all">
32685 <tgroup cols="4" colsep="0" rowsep="0">
32686 <colspec colwidth="8*" align="left"/>
32687 <colspec colwidth="5*" align="center"/>
32688 <colspec colwidth="5*" align="center"/>
32689 <colspec colwidth="6*" align="right"/>
32692 <entry><option>file_transport</option></entry>
32693 <entry>Use: <emphasis>redirect</emphasis></entry>
32694 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
32695 <entry>Default: <emphasis>unset</emphasis></entry>
32701 <indexterm role="concept">
32702 <primary><varname>$address_file</varname></primary>
32704 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
32705 ending in a slash is specified as a new <quote>address</quote>. The transport used is
32706 specified by this option, which, after expansion, must be the name of a
32707 configured transport. This should normally be an <command>appendfile</command> transport. When
32708 it is running, the file name is in <varname>$address_file</varname>.
32710 <para revisionflag="changed">
32711 <indexterm role="option">
32712 <primary>filter_prepend_home</primary>
32715 <informaltable frame="all" revisionflag="changed">
32716 <tgroup cols="4" colsep="0" rowsep="0">
32717 <colspec colwidth="8*" align="left"/>
32718 <colspec colwidth="5*" align="center"/>
32719 <colspec colwidth="5*" align="center"/>
32720 <colspec colwidth="6*" align="right"/>
32723 <entry><option>filter_prepend_home</option></entry>
32724 <entry>Use: <emphasis>redirect</emphasis></entry>
32725 <entry>Type: <emphasis>boolean</emphasis></entry>
32726 <entry>Default: <emphasis>true</emphasis></entry>
32731 <para revisionflag="changed">
32732 When this option is true, if a <command>save</command> command in an Exim filter specifies a
32733 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
32734 relative path. If this option is set false, this action does not happen. The
32735 relative path is then passed to the transport unmodified.
32738 <indexterm role="option">
32739 <primary>forbid_blackhole</primary>
32742 <informaltable frame="all">
32743 <tgroup cols="4" colsep="0" rowsep="0">
32744 <colspec colwidth="8*" align="left"/>
32745 <colspec colwidth="5*" align="center"/>
32746 <colspec colwidth="5*" align="center"/>
32747 <colspec colwidth="6*" align="right"/>
32750 <entry><option>forbid_blackhole</option></entry>
32751 <entry>Use: <emphasis>redirect</emphasis></entry>
32752 <entry>Type: <emphasis>boolean</emphasis></entry>
32753 <entry>Default: <emphasis>false</emphasis></entry>
32759 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
32763 <indexterm role="option">
32764 <primary>forbid_exim_filter</primary>
32767 <informaltable frame="all">
32768 <tgroup cols="4" colsep="0" rowsep="0">
32769 <colspec colwidth="8*" align="left"/>
32770 <colspec colwidth="5*" align="center"/>
32771 <colspec colwidth="5*" align="center"/>
32772 <colspec colwidth="6*" align="right"/>
32775 <entry><option>forbid_exim_filter</option></entry>
32776 <entry>Use: <emphasis>redirect</emphasis></entry>
32777 <entry>Type: <emphasis>boolean</emphasis></entry>
32778 <entry>Default: <emphasis>false</emphasis></entry>
32784 If this option is set true, only Sieve filters are permitted when
32785 <option>allow_filter</option> is true.
32788 <indexterm role="option">
32789 <primary>forbid_file</primary>
32792 <informaltable frame="all">
32793 <tgroup cols="4" colsep="0" rowsep="0">
32794 <colspec colwidth="8*" align="left"/>
32795 <colspec colwidth="5*" align="center"/>
32796 <colspec colwidth="5*" align="center"/>
32797 <colspec colwidth="6*" align="right"/>
32800 <entry><option>forbid_file</option></entry>
32801 <entry>Use: <emphasis>redirect</emphasis></entry>
32802 <entry>Type: <emphasis>boolean</emphasis></entry>
32803 <entry>Default: <emphasis>false</emphasis></entry>
32809 <indexterm role="concept">
32810 <primary>delivery</primary>
32811 <secondary>to file; forbidding</secondary>
32813 <indexterm role="concept">
32814 <primary>Sieve filter</primary>
32815 <secondary>forbidding delivery to a file</secondary>
32817 <indexterm role="concept">
32818 <primary>Sieve filter</primary>
32819 <secondary><quote>keep</quote> facility; disabling</secondary>
32821 If this option is true, this router may not generate a new address that
32822 specifies delivery to a local file or directory, either from a filter or from a
32823 conventional forward file. This option is forced to be true if <option>one_time</option> is
32824 set. It applies to Sieve filters as well as to Exim filters, but if true, it
32825 locks out the Sieve’s <quote>keep</quote> facility.
32828 <indexterm role="option">
32829 <primary>forbid_filter_dlfunc</primary>
32832 <informaltable frame="all">
32833 <tgroup cols="4" colsep="0" rowsep="0">
32834 <colspec colwidth="8*" align="left"/>
32835 <colspec colwidth="5*" align="center"/>
32836 <colspec colwidth="5*" align="center"/>
32837 <colspec colwidth="6*" align="right"/>
32840 <entry><option>forbid_filter_dlfunc</option></entry>
32841 <entry>Use: <emphasis>redirect</emphasis></entry>
32842 <entry>Type: <emphasis>boolean</emphasis></entry>
32843 <entry>Default: <emphasis>false</emphasis></entry>
32849 <indexterm role="concept">
32850 <primary>filter</primary>
32851 <secondary>locking out certain features</secondary>
32853 If this option is true, string expansions in Exim filters are not allowed to
32854 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
32858 <indexterm role="option">
32859 <primary>forbid_filter_existstest</primary>
32862 <informaltable frame="all">
32863 <tgroup cols="4" colsep="0" rowsep="0">
32864 <colspec colwidth="8*" align="left"/>
32865 <colspec colwidth="5*" align="center"/>
32866 <colspec colwidth="5*" align="center"/>
32867 <colspec colwidth="6*" align="right"/>
32870 <entry><option>forbid_filter_existstest</option></entry>
32871 <entry>Use: <emphasis>redirect</emphasis></entry>
32872 <entry>Type: <emphasis>boolean</emphasis></entry>
32873 <entry>Default: <emphasis>false</emphasis></entry>
32879 <indexterm role="concept">
32880 <primary>expansion</primary>
32881 <secondary>statting a file</secondary>
32883 If this option is true, string expansions in Exim filters are not allowed to
32884 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
32887 <indexterm role="option">
32888 <primary>forbid_filter_logwrite</primary>
32891 <informaltable frame="all">
32892 <tgroup cols="4" colsep="0" rowsep="0">
32893 <colspec colwidth="8*" align="left"/>
32894 <colspec colwidth="5*" align="center"/>
32895 <colspec colwidth="5*" align="center"/>
32896 <colspec colwidth="6*" align="right"/>
32899 <entry><option>forbid_filter_logwrite</option></entry>
32900 <entry>Use: <emphasis>redirect</emphasis></entry>
32901 <entry>Type: <emphasis>boolean</emphasis></entry>
32902 <entry>Default: <emphasis>false</emphasis></entry>
32908 If this option is true, use of the logging facility in Exim filters is not
32909 permitted. Logging is in any case available only if the filter is being run
32910 under some unprivileged uid (which is normally the case for ordinary users’
32911 <filename>.forward</filename> files).
32914 <indexterm role="option">
32915 <primary>forbid_filter_lookup</primary>
32918 <informaltable frame="all">
32919 <tgroup cols="4" colsep="0" rowsep="0">
32920 <colspec colwidth="8*" align="left"/>
32921 <colspec colwidth="5*" align="center"/>
32922 <colspec colwidth="5*" align="center"/>
32923 <colspec colwidth="6*" align="right"/>
32926 <entry><option>forbid_filter_lookup</option></entry>
32927 <entry>Use: <emphasis>redirect</emphasis></entry>
32928 <entry>Type: <emphasis>boolean</emphasis></entry>
32929 <entry>Default: <emphasis>false</emphasis></entry>
32935 If this option is true, string expansions in Exim filter files are not allowed
32936 to make use of <option>lookup</option> items.
32939 <indexterm role="option">
32940 <primary>forbid_filter_perl</primary>
32943 <informaltable frame="all">
32944 <tgroup cols="4" colsep="0" rowsep="0">
32945 <colspec colwidth="8*" align="left"/>
32946 <colspec colwidth="5*" align="center"/>
32947 <colspec colwidth="5*" align="center"/>
32948 <colspec colwidth="6*" align="right"/>
32951 <entry><option>forbid_filter_perl</option></entry>
32952 <entry>Use: <emphasis>redirect</emphasis></entry>
32953 <entry>Type: <emphasis>boolean</emphasis></entry>
32954 <entry>Default: <emphasis>false</emphasis></entry>
32960 This option has an effect only if Exim is built with embedded Perl support. If
32961 it is true, string expansions in Exim filter files are not allowed to make use
32962 of the embedded Perl support.
32965 <indexterm role="option">
32966 <primary>forbid_filter_readfile</primary>
32969 <informaltable frame="all">
32970 <tgroup cols="4" colsep="0" rowsep="0">
32971 <colspec colwidth="8*" align="left"/>
32972 <colspec colwidth="5*" align="center"/>
32973 <colspec colwidth="5*" align="center"/>
32974 <colspec colwidth="6*" align="right"/>
32977 <entry><option>forbid_filter_readfile</option></entry>
32978 <entry>Use: <emphasis>redirect</emphasis></entry>
32979 <entry>Type: <emphasis>boolean</emphasis></entry>
32980 <entry>Default: <emphasis>false</emphasis></entry>
32986 If this option is true, string expansions in Exim filter files are not allowed
32987 to make use of <option>readfile</option> items.
32990 <indexterm role="option">
32991 <primary>forbid_filter_readsocket</primary>
32994 <informaltable frame="all">
32995 <tgroup cols="4" colsep="0" rowsep="0">
32996 <colspec colwidth="8*" align="left"/>
32997 <colspec colwidth="5*" align="center"/>
32998 <colspec colwidth="5*" align="center"/>
32999 <colspec colwidth="6*" align="right"/>
33002 <entry><option>forbid_filter_readsocket</option></entry>
33003 <entry>Use: <emphasis>redirect</emphasis></entry>
33004 <entry>Type: <emphasis>boolean</emphasis></entry>
33005 <entry>Default: <emphasis>false</emphasis></entry>
33011 If this option is true, string expansions in Exim filter files are not allowed
33012 to make use of <option>readsocket</option> items.
33015 <indexterm role="option">
33016 <primary>forbid_filter_reply</primary>
33019 <informaltable frame="all">
33020 <tgroup cols="4" colsep="0" rowsep="0">
33021 <colspec colwidth="8*" align="left"/>
33022 <colspec colwidth="5*" align="center"/>
33023 <colspec colwidth="5*" align="center"/>
33024 <colspec colwidth="6*" align="right"/>
33027 <entry><option>forbid_filter_reply</option></entry>
33028 <entry>Use: <emphasis>redirect</emphasis></entry>
33029 <entry>Type: <emphasis>boolean</emphasis></entry>
33030 <entry>Default: <emphasis>false</emphasis></entry>
33036 If this option is true, this router may not generate an automatic reply
33037 message. Automatic replies can be generated only from Exim or Sieve filter
33038 files, not from traditional forward files. This option is forced to be true if
33039 <option>one_time</option> is set.
33042 <indexterm role="option">
33043 <primary>forbid_filter_run</primary>
33046 <informaltable frame="all">
33047 <tgroup cols="4" colsep="0" rowsep="0">
33048 <colspec colwidth="8*" align="left"/>
33049 <colspec colwidth="5*" align="center"/>
33050 <colspec colwidth="5*" align="center"/>
33051 <colspec colwidth="6*" align="right"/>
33054 <entry><option>forbid_filter_run</option></entry>
33055 <entry>Use: <emphasis>redirect</emphasis></entry>
33056 <entry>Type: <emphasis>boolean</emphasis></entry>
33057 <entry>Default: <emphasis>false</emphasis></entry>
33063 If this option is true, string expansions in Exim filter files are not allowed
33064 to make use of <option>run</option> items.
33067 <indexterm role="option">
33068 <primary>forbid_include</primary>
33071 <informaltable frame="all">
33072 <tgroup cols="4" colsep="0" rowsep="0">
33073 <colspec colwidth="8*" align="left"/>
33074 <colspec colwidth="5*" align="center"/>
33075 <colspec colwidth="5*" align="center"/>
33076 <colspec colwidth="6*" align="right"/>
33079 <entry><option>forbid_include</option></entry>
33080 <entry>Use: <emphasis>redirect</emphasis></entry>
33081 <entry>Type: <emphasis>boolean</emphasis></entry>
33082 <entry>Default: <emphasis>false</emphasis></entry>
33088 If this option is true, items of the form
33090 <literallayout class="monospaced">
33091 :include:<path name>
33094 are not permitted in non-filter redirection lists.
33097 <indexterm role="option">
33098 <primary>forbid_pipe</primary>
33101 <informaltable frame="all">
33102 <tgroup cols="4" colsep="0" rowsep="0">
33103 <colspec colwidth="8*" align="left"/>
33104 <colspec colwidth="5*" align="center"/>
33105 <colspec colwidth="5*" align="center"/>
33106 <colspec colwidth="6*" align="right"/>
33109 <entry><option>forbid_pipe</option></entry>
33110 <entry>Use: <emphasis>redirect</emphasis></entry>
33111 <entry>Type: <emphasis>boolean</emphasis></entry>
33112 <entry>Default: <emphasis>false</emphasis></entry>
33118 <indexterm role="concept">
33119 <primary>delivery</primary>
33120 <secondary>to pipe; forbidding</secondary>
33122 If this option is true, this router may not generate a new address which
33123 specifies delivery to a pipe, either from an Exim filter or from a conventional
33124 forward file. This option is forced to be true if <option>one_time</option> is set.
33127 <indexterm role="option">
33128 <primary>forbid_sieve_filter</primary>
33131 <informaltable frame="all">
33132 <tgroup cols="4" colsep="0" rowsep="0">
33133 <colspec colwidth="8*" align="left"/>
33134 <colspec colwidth="5*" align="center"/>
33135 <colspec colwidth="5*" align="center"/>
33136 <colspec colwidth="6*" align="right"/>
33139 <entry><option>forbid_sieve_filter</option></entry>
33140 <entry>Use: <emphasis>redirect</emphasis></entry>
33141 <entry>Type: <emphasis>boolean</emphasis></entry>
33142 <entry>Default: <emphasis>false</emphasis></entry>
33148 If this option is set true, only Exim filters are permitted when
33149 <option>allow_filter</option> is true.
33151 <para revisionflag="changed">
33152 <indexterm role="concept">
33153 <primary>SMTP</primary>
33154 <secondary>error codes</secondary>
33156 <indexterm role="option">
33157 <primary>forbid_smtp_code</primary>
33160 <informaltable frame="all" revisionflag="changed">
33161 <tgroup cols="4" colsep="0" rowsep="0">
33162 <colspec colwidth="8*" align="left"/>
33163 <colspec colwidth="5*" align="center"/>
33164 <colspec colwidth="5*" align="center"/>
33165 <colspec colwidth="6*" align="right"/>
33168 <entry><option>forbid_smtp_code</option></entry>
33169 <entry>Use: <emphasis>redirect</emphasis></entry>
33170 <entry>Type: <emphasis>boolean</emphasis></entry>
33171 <entry>Default: <emphasis>false</emphasis></entry>
33176 <para revisionflag="changed">
33177 If this option is set true, any SMTP error codes that are present at the start
33178 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
33179 the default codes (451 and 550, respectively) are always used.
33182 <indexterm role="option">
33183 <primary>hide_child_in_errmsg</primary>
33186 <informaltable frame="all">
33187 <tgroup cols="4" colsep="0" rowsep="0">
33188 <colspec colwidth="8*" align="left"/>
33189 <colspec colwidth="5*" align="center"/>
33190 <colspec colwidth="5*" align="center"/>
33191 <colspec colwidth="6*" align="right"/>
33194 <entry><option>hide_child_in_errmsg</option></entry>
33195 <entry>Use: <emphasis>redirect</emphasis></entry>
33196 <entry>Type: <emphasis>boolean</emphasis></entry>
33197 <entry>Default: <emphasis>false</emphasis></entry>
33203 <indexterm role="concept">
33204 <primary>bounce message</primary>
33205 <secondary>redirection details; suppressing</secondary>
33207 If this option is true, it prevents Exim from quoting a child address if it
33208 generates a bounce or delay message for it. Instead it says <quote>an address
33209 generated from <<emphasis>the top level address</emphasis>></quote>. Of course, this applies only to
33210 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
33211 bounce may well quote the generated address.
33214 <indexterm role="option">
33215 <primary>ignore_eacces</primary>
33218 <informaltable frame="all">
33219 <tgroup cols="4" colsep="0" rowsep="0">
33220 <colspec colwidth="8*" align="left"/>
33221 <colspec colwidth="5*" align="center"/>
33222 <colspec colwidth="5*" align="center"/>
33223 <colspec colwidth="6*" align="right"/>
33226 <entry><option>ignore_eacces</option></entry>
33227 <entry>Use: <emphasis>redirect</emphasis></entry>
33228 <entry>Type: <emphasis>boolean</emphasis></entry>
33229 <entry>Default: <emphasis>false</emphasis></entry>
33235 <indexterm role="concept">
33236 <primary>EACCES</primary>
33238 If this option is set and an attempt to open a redirection file yields the
33239 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
33240 file did not exist.
33243 <indexterm role="option">
33244 <primary>ignore_enotdir</primary>
33247 <informaltable frame="all">
33248 <tgroup cols="4" colsep="0" rowsep="0">
33249 <colspec colwidth="8*" align="left"/>
33250 <colspec colwidth="5*" align="center"/>
33251 <colspec colwidth="5*" align="center"/>
33252 <colspec colwidth="6*" align="right"/>
33255 <entry><option>ignore_enotdir</option></entry>
33256 <entry>Use: <emphasis>redirect</emphasis></entry>
33257 <entry>Type: <emphasis>boolean</emphasis></entry>
33258 <entry>Default: <emphasis>false</emphasis></entry>
33264 <indexterm role="concept">
33265 <primary>ENOTDIR</primary>
33267 If this option is set and an attempt to open a redirection file yields the
33268 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
33269 router behaves as if the file did not exist.
33272 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
33273 router that has the <option>file</option> option set discovers that the file does not exist
33274 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
33275 against unmounted NFS directories. If the parent can not be statted, delivery
33276 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
33277 is set, because that option tells Exim to ignore <quote>something on the path is not
33278 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
33279 that some operating systems give ENOENT where others give ENOTDIR.
33282 <indexterm role="option">
33283 <primary>include_directory</primary>
33286 <informaltable frame="all">
33287 <tgroup cols="4" colsep="0" rowsep="0">
33288 <colspec colwidth="8*" align="left"/>
33289 <colspec colwidth="5*" align="center"/>
33290 <colspec colwidth="5*" align="center"/>
33291 <colspec colwidth="6*" align="right"/>
33294 <entry><option>include_directory</option></entry>
33295 <entry>Use: <emphasis>redirect</emphasis></entry>
33296 <entry>Type: <emphasis>string</emphasis></entry>
33297 <entry>Default: <emphasis>unset</emphasis></entry>
33303 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
33304 redirection list must start with this directory.
33307 <indexterm role="option">
33308 <primary>modemask</primary>
33311 <informaltable frame="all">
33312 <tgroup cols="4" colsep="0" rowsep="0">
33313 <colspec colwidth="8*" align="left"/>
33314 <colspec colwidth="5*" align="center"/>
33315 <colspec colwidth="5*" align="center"/>
33316 <colspec colwidth="6*" align="right"/>
33319 <entry><option>modemask</option></entry>
33320 <entry>Use: <emphasis>redirect</emphasis></entry>
33321 <entry>Type: <emphasis>octal integer</emphasis></entry>
33322 <entry>Default: <emphasis>022</emphasis></entry>
33328 This specifies mode bits which must not be set for a file specified by the
33329 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
33332 <indexterm role="option">
33333 <primary>one_time</primary>
33336 <informaltable frame="all">
33337 <tgroup cols="4" colsep="0" rowsep="0">
33338 <colspec colwidth="8*" align="left"/>
33339 <colspec colwidth="5*" align="center"/>
33340 <colspec colwidth="5*" align="center"/>
33341 <colspec colwidth="6*" align="right"/>
33344 <entry><option>one_time</option></entry>
33345 <entry>Use: <emphasis>redirect</emphasis></entry>
33346 <entry>Type: <emphasis>boolean</emphasis></entry>
33347 <entry>Default: <emphasis>false</emphasis></entry>
33353 <indexterm role="concept">
33354 <primary>one-time aliasing/forwarding expansion</primary>
33356 <indexterm role="concept">
33357 <primary>alias file</primary>
33358 <secondary>one-time expansion</secondary>
33360 <indexterm role="concept">
33361 <primary>forward file</primary>
33362 <secondary>one-time expansion</secondary>
33364 <indexterm role="concept">
33365 <primary>mailing lists</primary>
33366 <secondary>one-time expansion</secondary>
33368 <indexterm role="concept">
33369 <primary>address redirection</primary>
33370 <secondary>one-time expansion</secondary>
33372 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
33373 files each time it tries to deliver a message causes a problem when one or more
33374 of the generated addresses fails be delivered at the first attempt. The problem
33375 is not one of duplicate delivery – Exim is clever enough to handle that –
33376 but of what happens when the redirection list changes during the time that the
33377 message is on Exim’s queue. This is particularly true in the case of mailing
33378 lists, where new subscribers might receive copies of messages that were posted
33379 before they subscribed.
33382 If <option>one_time</option> is set and any addresses generated by the router fail to
33383 deliver at the first attempt, the failing addresses are added to the message as
33384 <quote>top level</quote> addresses, and the parent address that generated them is marked
33385 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
33389 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
33390 router would be lost if delivery did not succeed at the first attempt. For this
33391 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
33392 permitted when <option>one_time</option> is set.
33395 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
33396 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
33397 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
33400 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
33401 <option>one_time</option>.
33404 The original top-level address is remembered with each of the generated
33405 addresses, and is output in any log messages. However, any intermediate parent
33406 addresses are not recorded. This makes a difference to the log only if
33407 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
33408 typically be used for mailing lists, where there is normally just one level of
33412 <indexterm role="option">
33413 <primary>owners</primary>
33416 <informaltable frame="all">
33417 <tgroup cols="4" colsep="0" rowsep="0">
33418 <colspec colwidth="8*" align="left"/>
33419 <colspec colwidth="5*" align="center"/>
33420 <colspec colwidth="5*" align="center"/>
33421 <colspec colwidth="6*" align="right"/>
33424 <entry><option>owners</option></entry>
33425 <entry>Use: <emphasis>redirect</emphasis></entry>
33426 <entry>Type: <emphasis>string list</emphasis></entry>
33427 <entry>Default: <emphasis>unset</emphasis></entry>
33433 <indexterm role="concept">
33434 <primary>ownership</primary>
33435 <secondary>alias file</secondary>
33437 <indexterm role="concept">
33438 <primary>ownership</primary>
33439 <secondary>forward file</secondary>
33441 <indexterm role="concept">
33442 <primary>alias file</primary>
33443 <secondary>ownership</secondary>
33445 <indexterm role="concept">
33446 <primary>forward file</primary>
33447 <secondary>ownership</secondary>
33449 This specifies a list of permitted owners for the file specified by <option>file</option>.
33450 This list is in addition to the local user when <option>check_local_user</option> is set.
33451 See <option>check_owner</option> above.
33454 <indexterm role="option">
33455 <primary>owngroups</primary>
33458 <informaltable frame="all">
33459 <tgroup cols="4" colsep="0" rowsep="0">
33460 <colspec colwidth="8*" align="left"/>
33461 <colspec colwidth="5*" align="center"/>
33462 <colspec colwidth="5*" align="center"/>
33463 <colspec colwidth="6*" align="right"/>
33466 <entry><option>owngroups</option></entry>
33467 <entry>Use: <emphasis>redirect</emphasis></entry>
33468 <entry>Type: <emphasis>string list</emphasis></entry>
33469 <entry>Default: <emphasis>unset</emphasis></entry>
33475 This specifies a list of permitted groups for the file specified by <option>file</option>.
33476 The list is in addition to the local user’s primary group when
33477 <option>check_local_user</option> is set. See <option>check_group</option> above.
33480 <indexterm role="option">
33481 <primary>pipe_transport</primary>
33484 <informaltable frame="all">
33485 <tgroup cols="4" colsep="0" rowsep="0">
33486 <colspec colwidth="8*" align="left"/>
33487 <colspec colwidth="5*" align="center"/>
33488 <colspec colwidth="5*" align="center"/>
33489 <colspec colwidth="6*" align="right"/>
33492 <entry><option>pipe_transport</option></entry>
33493 <entry>Use: <emphasis>redirect</emphasis></entry>
33494 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33495 <entry>Default: <emphasis>unset</emphasis></entry>
33501 <indexterm role="concept">
33502 <primary><varname>$address_pipe</varname></primary>
33504 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
33505 starting with a vertical bar character is specified as a new <quote>address</quote>. The
33506 transport used is specified by this option, which, after expansion, must be the
33507 name of a configured transport. This should normally be a <command>pipe</command> transport.
33508 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
33511 <indexterm role="option">
33512 <primary>qualify_domain</primary>
33515 <informaltable frame="all">
33516 <tgroup cols="4" colsep="0" rowsep="0">
33517 <colspec colwidth="8*" align="left"/>
33518 <colspec colwidth="5*" align="center"/>
33519 <colspec colwidth="5*" align="center"/>
33520 <colspec colwidth="6*" align="right"/>
33523 <entry><option>qualify_domain</option></entry>
33524 <entry>Use: <emphasis>redirect</emphasis></entry>
33525 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33526 <entry>Default: <emphasis>unset</emphasis></entry>
33532 <indexterm role="concept">
33533 <primary><varname>$qualify_recipient</varname></primary>
33535 If this option is set, and an unqualified address (one without a domain) is
33536 generated, and that address would normally be qualified by the global setting
33537 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
33538 expanding this string. If the expansion fails, the router declines. If you want
33539 to revert to the default, you can have the expansion generate
33540 <varname>$qualify_recipient</varname>.
33543 This option applies to all unqualified addresses generated by Exim filters,
33544 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
33545 not preceded by a backslash. Sieve filters cannot generate unqualified
33549 <indexterm role="option">
33550 <primary>qualify_preserve_domain</primary>
33553 <informaltable frame="all">
33554 <tgroup cols="4" colsep="0" rowsep="0">
33555 <colspec colwidth="8*" align="left"/>
33556 <colspec colwidth="5*" align="center"/>
33557 <colspec colwidth="5*" align="center"/>
33558 <colspec colwidth="6*" align="right"/>
33561 <entry><option>qualify_preserve_domain</option></entry>
33562 <entry>Use: <emphasis>redirect</emphasis></entry>
33563 <entry>Type: <emphasis>boolean</emphasis></entry>
33564 <entry>Default: <emphasis>false</emphasis></entry>
33570 <indexterm role="concept">
33571 <primary>domain</primary>
33572 <secondary>in redirection; preserving</secondary>
33574 <indexterm role="concept">
33575 <primary>preserving domain in redirection</primary>
33577 <indexterm role="concept">
33578 <primary>address redirection</primary>
33579 <secondary>domain; preserving</secondary>
33581 If this option is set, the router’s local <option>qualify_domain</option> option must not be
33582 set (a configuration error occurs if it is). If an unqualified address (one
33583 without a domain) is generated, it is qualified with the domain of the parent
33584 address (the immediately preceding ancestor) instead of the global
33585 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
33586 this applies whether or not the address is preceded by a backslash.
33589 <indexterm role="option">
33590 <primary>repeat_use</primary>
33593 <informaltable frame="all">
33594 <tgroup cols="4" colsep="0" rowsep="0">
33595 <colspec colwidth="8*" align="left"/>
33596 <colspec colwidth="5*" align="center"/>
33597 <colspec colwidth="5*" align="center"/>
33598 <colspec colwidth="6*" align="right"/>
33601 <entry><option>repeat_use</option></entry>
33602 <entry>Use: <emphasis>redirect</emphasis></entry>
33603 <entry>Type: <emphasis>boolean</emphasis></entry>
33604 <entry>Default: <emphasis>true</emphasis></entry>
33610 If this option is set false, the router is skipped for a child address that has
33611 any ancestor that was routed by this router. This test happens before any of
33612 the other preconditions are tested. Exim’s default anti-looping rules skip
33613 only when the ancestor is the same as the current address. See also
33614 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
33617 <indexterm role="option">
33618 <primary>reply_transport</primary>
33621 <informaltable frame="all">
33622 <tgroup cols="4" colsep="0" rowsep="0">
33623 <colspec colwidth="8*" align="left"/>
33624 <colspec colwidth="5*" align="center"/>
33625 <colspec colwidth="5*" align="center"/>
33626 <colspec colwidth="6*" align="right"/>
33629 <entry><option>reply_transport</option></entry>
33630 <entry>Use: <emphasis>redirect</emphasis></entry>
33631 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33632 <entry>Default: <emphasis>unset</emphasis></entry>
33638 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
33639 <option>vacation</option> command is used in a filter file. The transport used is specified
33640 by this option, which, after expansion, must be the name of a configured
33641 transport. This should normally be an <command>autoreply</command> transport. Other transports
33642 are unlikely to do anything sensible or useful.
33645 <indexterm role="option">
33646 <primary>rewrite</primary>
33649 <informaltable frame="all">
33650 <tgroup cols="4" colsep="0" rowsep="0">
33651 <colspec colwidth="8*" align="left"/>
33652 <colspec colwidth="5*" align="center"/>
33653 <colspec colwidth="5*" align="center"/>
33654 <colspec colwidth="6*" align="right"/>
33657 <entry><option>rewrite</option></entry>
33658 <entry>Use: <emphasis>redirect</emphasis></entry>
33659 <entry>Type: <emphasis>boolean</emphasis></entry>
33660 <entry>Default: <emphasis>true</emphasis></entry>
33666 <indexterm role="concept">
33667 <primary>address redirection</primary>
33668 <secondary>disabling rewriting</secondary>
33670 If this option is set false, addresses generated by the router are not
33671 subject to address rewriting. Otherwise, they are treated like new addresses
33672 and are rewritten according to the global rewriting rules.
33675 <indexterm role="option">
33676 <primary>sieve_subaddress</primary>
33679 <informaltable frame="all">
33680 <tgroup cols="4" colsep="0" rowsep="0">
33681 <colspec colwidth="8*" align="left"/>
33682 <colspec colwidth="5*" align="center"/>
33683 <colspec colwidth="5*" align="center"/>
33684 <colspec colwidth="6*" align="right"/>
33687 <entry><option>sieve_subaddress</option></entry>
33688 <entry>Use: <emphasis>redirect</emphasis></entry>
33689 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33690 <entry>Default: <emphasis>unset</emphasis></entry>
33696 The value of this option is passed to a Sieve filter to specify the
33697 :subaddress part of an address.
33700 <indexterm role="option">
33701 <primary>sieve_useraddress</primary>
33704 <informaltable frame="all">
33705 <tgroup cols="4" colsep="0" rowsep="0">
33706 <colspec colwidth="8*" align="left"/>
33707 <colspec colwidth="5*" align="center"/>
33708 <colspec colwidth="5*" align="center"/>
33709 <colspec colwidth="6*" align="right"/>
33712 <entry><option>sieve_useraddress</option></entry>
33713 <entry>Use: <emphasis>redirect</emphasis></entry>
33714 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33715 <entry>Default: <emphasis>unset</emphasis></entry>
33721 The value of this option is passed to a Sieve filter to specify the :user part
33722 of an address. However, if it is unset, the entire original local part
33723 (including any prefix or suffix) is used for :user.
33726 <indexterm role="option">
33727 <primary>sieve_vacation_directory</primary>
33730 <informaltable frame="all">
33731 <tgroup cols="4" colsep="0" rowsep="0">
33732 <colspec colwidth="8*" align="left"/>
33733 <colspec colwidth="5*" align="center"/>
33734 <colspec colwidth="5*" align="center"/>
33735 <colspec colwidth="6*" align="right"/>
33738 <entry><option>sieve_vacation_directory</option></entry>
33739 <entry>Use: <emphasis>redirect</emphasis></entry>
33740 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33741 <entry>Default: <emphasis>unset</emphasis></entry>
33747 <indexterm role="concept">
33748 <primary>Sieve filter</primary>
33749 <secondary>vacation directory</secondary>
33751 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
33752 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
33753 (do not put anything else in that directory), and ensure that the
33754 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
33755 needs their own directory; Exim will create it if necessary.
33758 <indexterm role="option">
33759 <primary>skip_syntax_errors</primary>
33762 <informaltable frame="all">
33763 <tgroup cols="4" colsep="0" rowsep="0">
33764 <colspec colwidth="8*" align="left"/>
33765 <colspec colwidth="5*" align="center"/>
33766 <colspec colwidth="5*" align="center"/>
33767 <colspec colwidth="6*" align="right"/>
33770 <entry><option>skip_syntax_errors</option></entry>
33771 <entry>Use: <emphasis>redirect</emphasis></entry>
33772 <entry>Type: <emphasis>boolean</emphasis></entry>
33773 <entry>Default: <emphasis>false</emphasis></entry>
33779 <indexterm role="concept">
33780 <primary>forward file</primary>
33781 <secondary>broken</secondary>
33783 <indexterm role="concept">
33784 <primary>address redirection</primary>
33785 <secondary>broken files</secondary>
33787 <indexterm role="concept">
33788 <primary>alias file</primary>
33789 <secondary>broken</secondary>
33791 <indexterm role="concept">
33792 <primary>broken alias or forward files</primary>
33794 <indexterm role="concept">
33795 <primary>ignoring faulty addresses</primary>
33797 <indexterm role="concept">
33798 <primary>skipping faulty addresses</primary>
33800 <indexterm role="concept">
33801 <primary>error</primary>
33802 <secondary>skipping bad syntax</secondary>
33804 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
33805 non-filter redirection data are skipped, and each failing address is logged. If
33806 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
33807 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
33808 are expanded and placed at the head of the error message generated by
33809 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
33810 be the same address as the generic <option>errors_to</option> option. The
33811 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
33814 If all the addresses in a redirection list are skipped because of syntax
33815 errors, the router declines to handle the original address, and it is passed to
33816 the following routers.
33819 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
33820 error in the filter causes filtering to be abandoned without any action being
33821 taken. The incident is logged, and the router declines to handle the address,
33822 so it is passed to the following routers.
33825 <indexterm role="concept">
33826 <primary>Sieve filter</primary>
33827 <secondary>syntax errors in</secondary>
33829 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
33830 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
33831 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
33834 <option>skip_syntax_errors</option> can be used to specify that errors in users’ forward
33835 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
33836 option, used with an address that does not get redirected, can be used to
33837 notify users of these errors, by means of a router like this:
33839 <literallayout class="monospaced">
33844 file = $home/.forward
33845 file_transport = address_file
33846 pipe_transport = address_pipe
33847 reply_transport = address_reply
33850 syntax_errors_to = real-$local_part@$domain
33851 syntax_errors_text = \
33852 This is an automatically generated message. An error has\n\
33853 been found in your .forward file. Details of the error are\n\
33854 reported below. While this error persists, you will receive\n\
33855 a copy of this message for every message that is addressed\n\
33856 to you. If your .forward file is a filter file, or if it is\n\
33857 a non-filter file containing no valid forwarding addresses,\n\
33858 a copy of each incoming message will be put in your normal\n\
33859 mailbox. If a non-filter file contains at least one valid\n\
33860 forwarding address, forwarding to the valid addresses will\n\
33861 happen, and those will be the only deliveries that occur.
33864 You also need a router to ensure that local addresses that are prefixed by
33865 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
33866 put this immediately before the <command>userforward</command> router:
33868 <literallayout class="monospaced">
33872 local_part_prefix = real-
33873 transport = local_delivery
33876 <indexterm role="option">
33877 <primary>syntax_errors_text</primary>
33880 <informaltable frame="all">
33881 <tgroup cols="4" colsep="0" rowsep="0">
33882 <colspec colwidth="8*" align="left"/>
33883 <colspec colwidth="5*" align="center"/>
33884 <colspec colwidth="5*" align="center"/>
33885 <colspec colwidth="6*" align="right"/>
33888 <entry><option>syntax_errors_text</option></entry>
33889 <entry>Use: <emphasis>redirect</emphasis></entry>
33890 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33891 <entry>Default: <emphasis>unset</emphasis></entry>
33897 See <option>skip_syntax_errors</option> above.
33900 <indexterm role="option">
33901 <primary>syntax_errors_to</primary>
33904 <informaltable frame="all">
33905 <tgroup cols="4" colsep="0" rowsep="0">
33906 <colspec colwidth="8*" align="left"/>
33907 <colspec colwidth="5*" align="center"/>
33908 <colspec colwidth="5*" align="center"/>
33909 <colspec colwidth="6*" align="right"/>
33912 <entry><option>syntax_errors_to</option></entry>
33913 <entry>Use: <emphasis>redirect</emphasis></entry>
33914 <entry>Type: <emphasis>string</emphasis></entry>
33915 <entry>Default: <emphasis>unset</emphasis></entry>
33921 See <option>skip_syntax_errors</option> above.
33922 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
33923 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
33928 <chapter id="CHAPenvironment">
33929 <title>Environment for running local transports</title>
33930 <titleabbrev>Environment for local transports</titleabbrev>
33932 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
33933 <primary>local transports</primary>
33934 <secondary>environment for</secondary>
33936 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
33937 <primary>environment for local transports</primary>
33939 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
33940 <primary>transport</primary>
33941 <secondary>local; environment for</secondary>
33943 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
33944 transport can be thought of as similar to a pipe.) Exim always runs transports
33945 in subprocesses, under specified uids and gids. Typical deliveries to local
33946 mailboxes run under the uid and gid of the local user.
33949 Exim also sets a specific current directory while running the transport; for
33950 some transports a home directory setting is also relevant. The <command>pipe</command>
33951 transport is the only one that sets up environment variables; see section
33952 <xref linkend="SECTpipeenv"/> for details.
33955 The values used for the uid, gid, and the directories may come from several
33956 different places. In many cases, the router that handles the address associates
33957 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
33958 or <option>user</option> options. However, values may also be given in the transport’s own
33959 configuration, and these override anything that comes from the router.
33962 <title>Concurrent deliveries</title>
33964 <indexterm role="concept">
33965 <primary>concurrent deliveries</primary>
33967 <indexterm role="concept">
33968 <primary>simultaneous deliveries</primary>
33970 If two different messages for the same local recpient arrive more or less
33971 simultaneously, the two delivery processes are likely to run concurrently. When
33972 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
33973 rules to stop concurrent processes from writing to the same file at the same
33977 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
33978 locking that is needed. Here is a silly example:
33980 <literallayout class="monospaced">
33983 command = /bin/sh -c 'cat >>/some/file'
33986 This is supposed to write the message at the end of the file. However, if two
33987 messages arrive at the same time, the file will be scrambled. You can use the
33988 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
33989 file using the same algorithm that Exim itself uses.
33992 <section id="SECTenvuidgid">
33993 <title>Uids and gids</title>
33995 <indexterm role="concept">
33996 <primary>local transports</primary>
33997 <secondary>uid and gid</secondary>
33999 <indexterm role="concept">
34000 <primary>transport</primary>
34001 <secondary>local; uid and gid</secondary>
34003 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
34004 overrides any group that the router set in the address, even if <option>user</option> is not
34005 set for the transport. This makes it possible, for example, to run local mail
34006 delivery under the uid of the recipient (set by the router), but in a special
34007 group (set by the transport). For example:
34009 <literallayout class="monospaced">
34011 # User/group are set by check_local_user in this router
34015 transport = group_delivery
34018 # This transport overrides the group
34020 driver = appendfile
34021 file = /var/spool/mail/$local_part
34025 If <option>user</option> is set for a transport, its value overrides what is set in the
34026 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
34027 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
34031 <indexterm role="concept">
34032 <primary><option>initgroups</option> option</primary>
34034 When the uid is taken from the transport’s configuration, the <function>initgroups()</function>
34035 function is called for the groups associated with that uid if the
34036 <option>initgroups</option> option is set for the transport. When the uid is not specified
34037 by the transport, but is associated with the address by a router, the option
34038 for calling <function>initgroups()</function> is taken from the router configuration.
34041 <indexterm role="concept">
34042 <primary><command>pipe</command> transport</primary>
34043 <secondary>uid for</secondary>
34045 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
34046 is set and <option>user</option> is not set, the uid of the process that called Exim to
34047 receive the message is used, and if <option>group</option> is not set, the corresponding
34048 original gid is also used.
34051 This is the detailed preference order for obtaining a gid; the first of the
34052 following that is set is used:
34057 A <option>group</option> setting of the transport;
34062 A <option>group</option> setting of the router;
34067 A gid associated with a user setting of the router, either as a result of
34068 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
34073 The group associated with a non-numeric <option>user</option> setting of the transport;
34078 In a <command>pipe</command> transport, the creator’s gid if <option>deliver_as_creator</option> is set and
34079 the uid is the creator’s uid;
34084 The Exim gid if the Exim uid is being used as a default.
34089 If, for example, the user is specified numerically on the router and there are
34090 no group settings, no gid is available. In this situation, an error occurs.
34091 This is different for the uid, for which there always is an ultimate default.
34092 The first of the following that is set is used:
34097 A <option>user</option> setting of the transport;
34102 In a <command>pipe</command> transport, the creator’s uid if <option>deliver_as_creator</option> is set;
34107 A <option>user</option> setting of the router;
34112 A <option>check_local_user</option> setting of the router;
34122 Of course, an error will still occur if the uid that is chosen is on the
34123 <option>never_users</option> list.
34127 <title>Current and home directories</title>
34129 <indexterm role="concept">
34130 <primary>current directory for local transport</primary>
34132 <indexterm role="concept">
34133 <primary>home directory</primary>
34134 <secondary>for local transport</secondary>
34136 <indexterm role="concept">
34137 <primary>transport</primary>
34138 <secondary>local; home directory for</secondary>
34140 <indexterm role="concept">
34141 <primary>transport</primary>
34142 <secondary>local; current directory for</secondary>
34144 Routers may set current and home directories for local transports by means of
34145 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
34146 However, if the transport’s <option>current_directory</option> or <option>home_directory</option> options
34147 are set, they override the router’s values. In detail, the home directory
34148 for a local transport is taken from the first of these values that is set:
34153 The <option>home_directory</option> option on the transport;
34158 The <option>transport_home_directory</option> option on the router;
34163 The password data if <option>check_local_user</option> is set on the router;
34168 The <option>router_home_directory</option> option on the router.
34173 The current directory is taken from the first of these values that is set:
34178 The <option>current_directory</option> option on the transport;
34183 The <option>transport_current_directory</option> option on the router.
34188 If neither the router nor the transport sets a current directory, Exim uses the
34189 value of the home directory, if it is set. Otherwise it sets the current
34190 directory to <filename>/</filename> before running a local transport.
34194 <title>Expansion variables derived from the address</title>
34196 <indexterm role="concept">
34197 <primary><varname>$domain</varname></primary>
34199 <indexterm role="concept">
34200 <primary><varname>$local_part</varname></primary>
34202 <indexterm role="concept">
34203 <primary><varname>$original_domain</varname></primary>
34205 Normally a local delivery is handling a single address, and in that case the
34206 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
34207 deliveries. However, in some circumstances more than one address may be handled
34208 at once (for example, while writing batch SMTP for onward transmission by some
34209 other means). In this case, the variables associated with the local part are
34210 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
34211 and <varname>$original_domain</varname> is never set.
34212 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
34213 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
34214 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
34219 <chapter id="CHAPtransportgeneric">
34220 <title>Generic options for transports</title>
34222 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
34223 <primary>generic options</primary>
34224 <secondary>transport</secondary>
34226 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
34227 <primary>options</primary>
34228 <secondary>generic; for transports</secondary>
34230 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
34231 <primary>transport</primary>
34232 <secondary>generic options for</secondary>
34234 The following generic options apply to all transports:
34237 <indexterm role="option">
34238 <primary>body_only</primary>
34241 <informaltable frame="all">
34242 <tgroup cols="4" colsep="0" rowsep="0">
34243 <colspec colwidth="8*" align="left"/>
34244 <colspec colwidth="5*" align="center"/>
34245 <colspec colwidth="5*" align="center"/>
34246 <colspec colwidth="6*" align="right"/>
34249 <entry><option>body_only</option></entry>
34250 <entry>Use: <emphasis>transports</emphasis></entry>
34251 <entry>Type: <emphasis>boolean</emphasis></entry>
34252 <entry>Default: <emphasis>false</emphasis></entry>
34258 <indexterm role="concept">
34259 <primary>transport</primary>
34260 <secondary>body only</secondary>
34262 <indexterm role="concept">
34263 <primary>message</primary>
34264 <secondary>transporting body only</secondary>
34266 <indexterm role="concept">
34267 <primary>body of message</primary>
34268 <secondary>transporting</secondary>
34270 If this option is set, the message’s headers are not transported. It is
34271 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
34272 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
34273 <option>message_suffix</option> should be checked, because this option does not
34274 automatically suppress them.
34277 <indexterm role="option">
34278 <primary>current_directory</primary>
34281 <informaltable frame="all">
34282 <tgroup cols="4" colsep="0" rowsep="0">
34283 <colspec colwidth="8*" align="left"/>
34284 <colspec colwidth="5*" align="center"/>
34285 <colspec colwidth="5*" align="center"/>
34286 <colspec colwidth="6*" align="right"/>
34289 <entry><option>current_directory</option></entry>
34290 <entry>Use: <emphasis>transports</emphasis></entry>
34291 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34292 <entry>Default: <emphasis>unset</emphasis></entry>
34298 <indexterm role="concept">
34299 <primary>transport</primary>
34300 <secondary>current directory for</secondary>
34302 This specifies the current directory that is to be set while running the
34303 transport, overriding any value that may have been set by the router.
34304 If the expansion fails for any reason, including forced failure, an error is
34305 logged, and delivery is deferred.
34308 <indexterm role="option">
34309 <primary>disable_logging</primary>
34312 <informaltable frame="all">
34313 <tgroup cols="4" colsep="0" rowsep="0">
34314 <colspec colwidth="8*" align="left"/>
34315 <colspec colwidth="5*" align="center"/>
34316 <colspec colwidth="5*" align="center"/>
34317 <colspec colwidth="6*" align="right"/>
34320 <entry><option>disable_logging</option></entry>
34321 <entry>Use: <emphasis>transports</emphasis></entry>
34322 <entry>Type: <emphasis>boolean</emphasis></entry>
34323 <entry>Default: <emphasis>false</emphasis></entry>
34329 If this option is set true, nothing is logged for any
34330 deliveries by the transport or for any
34331 transport errors. You should not set this option unless you really, really know
34332 what you are doing.
34335 <indexterm role="option">
34336 <primary>debug_print</primary>
34339 <informaltable frame="all">
34340 <tgroup cols="4" colsep="0" rowsep="0">
34341 <colspec colwidth="8*" align="left"/>
34342 <colspec colwidth="5*" align="center"/>
34343 <colspec colwidth="5*" align="center"/>
34344 <colspec colwidth="6*" align="right"/>
34347 <entry><option>debug_print</option></entry>
34348 <entry>Use: <emphasis>transports</emphasis></entry>
34349 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34350 <entry>Default: <emphasis>unset</emphasis></entry>
34356 <indexterm role="concept">
34357 <primary>testing</primary>
34358 <secondary>variables in drivers</secondary>
34360 If this option is set and debugging is enabled (see the <option>-d</option> command line
34361 option), the string is expanded and included in the debugging output when the
34363 If expansion of the string fails, the error message is written to the debugging
34364 output, and Exim carries on processing.
34365 This facility is provided to help with checking out the values of variables and
34366 so on when debugging driver configurations. For example, if a <option>headers_add</option>
34367 option is not working properly, <option>debug_print</option> could be used to output the
34368 variables it references. A newline is added to the text if it does not end with
34372 <indexterm role="option">
34373 <primary>delivery_date_add</primary>
34376 <informaltable frame="all">
34377 <tgroup cols="4" colsep="0" rowsep="0">
34378 <colspec colwidth="8*" align="left"/>
34379 <colspec colwidth="5*" align="center"/>
34380 <colspec colwidth="5*" align="center"/>
34381 <colspec colwidth="6*" align="right"/>
34384 <entry><option>delivery_date_add</option></entry>
34385 <entry>Use: <emphasis>transports</emphasis></entry>
34386 <entry>Type: <emphasis>boolean</emphasis></entry>
34387 <entry>Default: <emphasis>false</emphasis></entry>
34393 <indexterm role="concept">
34394 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
34396 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
34397 This gives the actual time the delivery was made. As this is not a standard
34398 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
34399 requests its removal from incoming messages, so that delivered messages can
34400 safely be resent to other recipients.
34403 <indexterm role="option">
34404 <primary>driver</primary>
34407 <informaltable frame="all">
34408 <tgroup cols="4" colsep="0" rowsep="0">
34409 <colspec colwidth="8*" align="left"/>
34410 <colspec colwidth="5*" align="center"/>
34411 <colspec colwidth="5*" align="center"/>
34412 <colspec colwidth="6*" align="right"/>
34415 <entry><option>driver</option></entry>
34416 <entry>Use: <emphasis>transports</emphasis></entry>
34417 <entry>Type: <emphasis>string</emphasis></entry>
34418 <entry>Default: <emphasis>unset</emphasis></entry>
34424 This specifies which of the available transport drivers is to be used.
34425 There is no default, and this option must be set for every transport.
34428 <indexterm role="option">
34429 <primary>envelope_to_add</primary>
34432 <informaltable frame="all">
34433 <tgroup cols="4" colsep="0" rowsep="0">
34434 <colspec colwidth="8*" align="left"/>
34435 <colspec colwidth="5*" align="center"/>
34436 <colspec colwidth="5*" align="center"/>
34437 <colspec colwidth="6*" align="right"/>
34440 <entry><option>envelope_to_add</option></entry>
34441 <entry>Use: <emphasis>transports</emphasis></entry>
34442 <entry>Type: <emphasis>boolean</emphasis></entry>
34443 <entry>Default: <emphasis>false</emphasis></entry>
34449 <indexterm role="concept">
34450 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
34452 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
34453 This gives the original address(es) in the incoming envelope that caused this
34454 delivery to happen. More than one address may be present if the transport is
34455 configured to handle several addresses at once, or if more than one original
34456 address was redirected to the same final address. As this is not a standard
34457 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
34458 its removal from incoming messages, so that delivered messages can safely be
34459 resent to other recipients.
34462 <indexterm role="option">
34463 <primary>group</primary>
34466 <informaltable frame="all">
34467 <tgroup cols="4" colsep="0" rowsep="0">
34468 <colspec colwidth="8*" align="left"/>
34469 <colspec colwidth="5*" align="center"/>
34470 <colspec colwidth="5*" align="center"/>
34471 <colspec colwidth="6*" align="right"/>
34474 <entry><option>group</option></entry>
34475 <entry>Use: <emphasis>transports</emphasis></entry>
34476 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34477 <entry>Default: <emphasis>Exim group</emphasis></entry>
34483 <indexterm role="concept">
34484 <primary>transport</primary>
34485 <secondary>group; specifying</secondary>
34487 This option specifies a gid for running the transport process, overriding any
34488 value that the router supplies, and also overriding any value associated with
34489 <option>user</option> (see below).
34492 <indexterm role="option">
34493 <primary>headers_add</primary>
34496 <informaltable frame="all">
34497 <tgroup cols="4" colsep="0" rowsep="0">
34498 <colspec colwidth="8*" align="left"/>
34499 <colspec colwidth="5*" align="center"/>
34500 <colspec colwidth="5*" align="center"/>
34501 <colspec colwidth="6*" align="right"/>
34504 <entry><option>headers_add</option></entry>
34505 <entry>Use: <emphasis>transports</emphasis></entry>
34506 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34507 <entry>Default: <emphasis>unset</emphasis></entry>
34513 <indexterm role="concept">
34514 <primary>header lines</primary>
34515 <secondary>adding in transport</secondary>
34517 <indexterm role="concept">
34518 <primary>transport</primary>
34519 <secondary>header lines; adding</secondary>
34521 This option specifies a string of text that is expanded and added to the header
34522 portion of a message as it is transported, as described in section
34523 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
34524 routers. If the result of the expansion is an empty string, or if the expansion
34525 is forced to fail, no action is taken. Other expansion failures are treated as
34526 errors and cause the delivery to be deferred.
34529 <indexterm role="option">
34530 <primary>headers_only</primary>
34533 <informaltable frame="all">
34534 <tgroup cols="4" colsep="0" rowsep="0">
34535 <colspec colwidth="8*" align="left"/>
34536 <colspec colwidth="5*" align="center"/>
34537 <colspec colwidth="5*" align="center"/>
34538 <colspec colwidth="6*" align="right"/>
34541 <entry><option>headers_only</option></entry>
34542 <entry>Use: <emphasis>transports</emphasis></entry>
34543 <entry>Type: <emphasis>boolean</emphasis></entry>
34544 <entry>Default: <emphasis>false</emphasis></entry>
34550 <indexterm role="concept">
34551 <primary>transport</primary>
34552 <secondary>header lines only</secondary>
34554 <indexterm role="concept">
34555 <primary>message</primary>
34556 <secondary>transporting headers only</secondary>
34558 <indexterm role="concept">
34559 <primary>header lines</primary>
34560 <secondary>transporting</secondary>
34562 If this option is set, the message’s body is not transported. It is mutually
34563 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
34564 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
34565 checked, since this option does not automatically suppress them.
34568 <indexterm role="option">
34569 <primary>headers_remove</primary>
34572 <informaltable frame="all">
34573 <tgroup cols="4" colsep="0" rowsep="0">
34574 <colspec colwidth="8*" align="left"/>
34575 <colspec colwidth="5*" align="center"/>
34576 <colspec colwidth="5*" align="center"/>
34577 <colspec colwidth="6*" align="right"/>
34580 <entry><option>headers_remove</option></entry>
34581 <entry>Use: <emphasis>transports</emphasis></entry>
34582 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34583 <entry>Default: <emphasis>unset</emphasis></entry>
34589 <indexterm role="concept">
34590 <primary>header lines</primary>
34591 <secondary>removing</secondary>
34593 <indexterm role="concept">
34594 <primary>transport</primary>
34595 <secondary>header lines; removing</secondary>
34597 This option specifies a string that is expanded into a list of header names;
34598 these headers are omitted from the message as it is transported, as described
34599 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
34600 routers. If the result of the expansion is an empty string, or if the expansion
34601 is forced to fail, no action is taken. Other expansion failures are treated as
34602 errors and cause the delivery to be deferred.
34605 <indexterm role="option">
34606 <primary>headers_rewrite</primary>
34609 <informaltable frame="all">
34610 <tgroup cols="4" colsep="0" rowsep="0">
34611 <colspec colwidth="8*" align="left"/>
34612 <colspec colwidth="5*" align="center"/>
34613 <colspec colwidth="5*" align="center"/>
34614 <colspec colwidth="6*" align="right"/>
34617 <entry><option>headers_rewrite</option></entry>
34618 <entry>Use: <emphasis>transports</emphasis></entry>
34619 <entry>Type: <emphasis>string</emphasis></entry>
34620 <entry>Default: <emphasis>unset</emphasis></entry>
34626 <indexterm role="concept">
34627 <primary>transport</primary>
34628 <secondary>header lines; rewriting</secondary>
34630 <indexterm role="concept">
34631 <primary>rewriting</primary>
34632 <secondary>at transport time</secondary>
34634 This option allows addresses in header lines to be rewritten at transport time,
34635 that is, as the message is being copied to its destination. The contents of the
34636 option are a colon-separated list of rewriting rules. Each rule is in exactly
34637 the same form as one of the general rewriting rules that are applied when a
34638 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
34641 <literallayout class="monospaced">
34642 headers_rewrite = a@b c@d f : \
34646 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
34647 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
34648 header lines just before they are written out at transport time, so they affect
34649 only those copies of the message that pass through the transport. However, only
34650 the message’s original header lines, and any that were added by a system
34651 filter, are rewritten. If a router or transport adds header lines, they are not
34652 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
34653 envelope. You can change the return path using <option>return_path</option>, but you cannot
34654 change envelope recipients at this time.
34657 <indexterm role="option">
34658 <primary>home_directory</primary>
34661 <informaltable frame="all">
34662 <tgroup cols="4" colsep="0" rowsep="0">
34663 <colspec colwidth="8*" align="left"/>
34664 <colspec colwidth="5*" align="center"/>
34665 <colspec colwidth="5*" align="center"/>
34666 <colspec colwidth="6*" align="right"/>
34669 <entry><option>home_directory</option></entry>
34670 <entry>Use: <emphasis>transports</emphasis></entry>
34671 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34672 <entry>Default: <emphasis>unset</emphasis></entry>
34678 <indexterm role="concept">
34679 <primary>transport</primary>
34680 <secondary>home directory for</secondary>
34682 <indexterm role="concept">
34683 <primary><varname>$home</varname></primary>
34685 This option specifies a home directory setting for a local transport,
34686 overriding any value that may be set by the router. The home directory is
34687 placed in <varname>$home</varname> while expanding the transport’s private options. It is also
34688 used as the current directory if no current directory is set by the
34689 <option>current_directory</option> option on the transport or the
34690 <option>transport_current_directory</option> option on the router. If the expansion fails
34691 for any reason, including forced failure, an error is logged, and delivery is
34695 <indexterm role="option">
34696 <primary>initgroups</primary>
34699 <informaltable frame="all">
34700 <tgroup cols="4" colsep="0" rowsep="0">
34701 <colspec colwidth="8*" align="left"/>
34702 <colspec colwidth="5*" align="center"/>
34703 <colspec colwidth="5*" align="center"/>
34704 <colspec colwidth="6*" align="right"/>
34707 <entry><option>initgroups</option></entry>
34708 <entry>Use: <emphasis>transports</emphasis></entry>
34709 <entry>Type: <emphasis>boolean</emphasis></entry>
34710 <entry>Default: <emphasis>false</emphasis></entry>
34716 <indexterm role="concept">
34717 <primary>additional groups</primary>
34719 <indexterm role="concept">
34720 <primary>groups</primary>
34721 <secondary>additional</secondary>
34723 <indexterm role="concept">
34724 <primary>transport</primary>
34725 <secondary>group; additional</secondary>
34727 If this option is true and the uid for the delivery process is provided by the
34728 transport, the <function>initgroups()</function> function is called when running the transport
34729 to ensure that any additional groups associated with the uid are set up.
34732 <indexterm role="option">
34733 <primary>message_size_limit</primary>
34736 <informaltable frame="all">
34737 <tgroup cols="4" colsep="0" rowsep="0">
34738 <colspec colwidth="8*" align="left"/>
34739 <colspec colwidth="5*" align="center"/>
34740 <colspec colwidth="5*" align="center"/>
34741 <colspec colwidth="6*" align="right"/>
34744 <entry><option>message_size_limit</option></entry>
34745 <entry>Use: <emphasis>transports</emphasis></entry>
34746 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34747 <entry>Default: <emphasis>0</emphasis></entry>
34753 <indexterm role="concept">
34754 <primary>limit</primary>
34755 <secondary>message size per transport</secondary>
34757 <indexterm role="concept">
34758 <primary>size of message</primary>
34759 <secondary>limit</secondary>
34761 <indexterm role="concept">
34762 <primary>transport</primary>
34763 <secondary>message size; limiting</secondary>
34765 This option controls the size of messages passed through the transport. It is
34766 expanded before use; the result of the expansion must be a sequence of digits,
34767 optionally followed by K or M.
34768 If the expansion fails for any reason, including forced failure, or if the
34769 result is not of the required form, delivery is deferred.
34770 If the value is greater than zero and the size of a message exceeds this
34771 limit, the address is failed. If there is any chance that the resulting bounce
34772 message could be routed to the same transport, you should ensure that
34773 <option>return_size_limit</option> is less than the transport’s <option>message_size_limit</option>, as
34774 otherwise the bounce message will fail to get delivered.
34777 <indexterm role="option">
34778 <primary>rcpt_include_affixes</primary>
34781 <informaltable frame="all">
34782 <tgroup cols="4" colsep="0" rowsep="0">
34783 <colspec colwidth="8*" align="left"/>
34784 <colspec colwidth="5*" align="center"/>
34785 <colspec colwidth="5*" align="center"/>
34786 <colspec colwidth="6*" align="right"/>
34789 <entry><option>rcpt_include_affixes</option></entry>
34790 <entry>Use: <emphasis>transports</emphasis></entry>
34791 <entry>Type: <emphasis>boolean</emphasis></entry>
34792 <entry>Default: <emphasis>false</emphasis></entry>
34798 <indexterm role="concept">
34799 <primary>prefix</primary>
34800 <secondary>for local part; including in envelope</secondary>
34802 <indexterm role="concept">
34803 <primary>suffix</primary>
34804 <secondary>for local part; including in envelope</secondary>
34806 <indexterm role="concept">
34807 <primary>local part</primary>
34808 <secondary>prefix</secondary>
34810 <indexterm role="concept">
34811 <primary>local part</primary>
34812 <secondary>suffix</secondary>
34814 When this option is false (the default), and an address that has had any
34815 affixes (prefixes or suffixes) removed from the local part is delivered by any
34816 form of SMTP or LMTP, the affixes are not included. For example, if a router
34819 <literallayout class="monospaced">
34820 local_part_prefix = *-
34823 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
34826 <literallayout class="monospaced">
34827 RCPT TO:<xyz@some.domain>
34830 This is also the case when an ACL-time callout is being used to verify a
34831 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
34832 whole local part is included in the RCPT command. This option applies to BSMTP
34833 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
34834 <command>lmtp</command> and <command>smtp</command> transports.
34837 <indexterm role="option">
34838 <primary>retry_use_local_part</primary>
34841 <informaltable frame="all">
34842 <tgroup cols="4" colsep="0" rowsep="0">
34843 <colspec colwidth="8*" align="left"/>
34844 <colspec colwidth="5*" align="center"/>
34845 <colspec colwidth="5*" align="center"/>
34846 <colspec colwidth="6*" align="right"/>
34849 <entry><option>retry_use_local_part</option></entry>
34850 <entry>Use: <emphasis>transports</emphasis></entry>
34851 <entry>Type: <emphasis>boolean</emphasis></entry>
34852 <entry>Default: <emphasis>see below</emphasis></entry>
34858 <indexterm role="concept">
34859 <primary>hints database</primary>
34860 <secondary>retry keys</secondary>
34862 When a delivery suffers a temporary failure, a retry record is created
34863 in Exim’s hints database. For remote deliveries, the key for the retry record
34864 is based on the name and/or IP address of the failing remote host. For local
34865 deliveries, the key is normally the entire address, including both the local
34866 part and the domain. This is suitable for most common cases of local delivery
34867 temporary failure – for example, exceeding a mailbox quota should delay only
34868 deliveries to that mailbox, not to the whole domain.
34871 However, in some special cases you may want to treat a temporary local delivery
34872 as a failure associated with the domain, and not with a particular local part.
34873 (For example, if you are storing all mail for some domain in files.) You can do
34874 this by setting <option>retry_use_local_part</option> false.
34877 For all the local transports, its default value is true. For remote transports,
34878 the default value is false for tidiness, but changing the value has no effect
34879 on a remote transport in the current implementation.
34882 <indexterm role="option">
34883 <primary>return_path</primary>
34886 <informaltable frame="all">
34887 <tgroup cols="4" colsep="0" rowsep="0">
34888 <colspec colwidth="8*" align="left"/>
34889 <colspec colwidth="5*" align="center"/>
34890 <colspec colwidth="5*" align="center"/>
34891 <colspec colwidth="6*" align="right"/>
34894 <entry><option>return_path</option></entry>
34895 <entry>Use: <emphasis>transports</emphasis></entry>
34896 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34897 <entry>Default: <emphasis>unset</emphasis></entry>
34903 <indexterm role="concept">
34904 <primary>envelope sender</primary>
34906 <indexterm role="concept">
34907 <primary>transport</primary>
34908 <secondary>return path; changing</secondary>
34910 <indexterm role="concept">
34911 <primary>return path</primary>
34912 <secondary>changing in transport</secondary>
34914 If this option is set, the string is expanded at transport time and replaces
34915 the existing return path (envelope sender) value in the copy of the message
34916 that is being delivered. An empty return path is permitted. This feature is
34917 designed for remote deliveries, where the value of this option is used in the
34918 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
34919 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
34920 header line, if one is added to the message (see the next option).
34922 <para revisionflag="changed">
34923 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
34924 <option>return_path_on_delivery</option> to the log selector.
34927 <indexterm role="concept">
34928 <primary><varname>$return_path</varname></primary>
34930 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
34931 either the message’s envelope sender, or an address set by the
34932 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
34933 replacement occurs; if it fails for another reason, delivery is deferred. This
34934 option can be used to support VERP (Variable Envelope Return Paths) – see
34935 section <xref linkend="SECTverp"/>.
34938 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
34939 remote server rejects a message at SMTP time, the bounce message is not sent to
34940 the value of this option. It is sent to the previously set errors address.
34941 This defaults to the incoming sender address, but can be changed by setting
34942 <option>errors_to</option> in a router.
34945 <indexterm role="option">
34946 <primary>return_path_add</primary>
34949 <informaltable frame="all">
34950 <tgroup cols="4" colsep="0" rowsep="0">
34951 <colspec colwidth="8*" align="left"/>
34952 <colspec colwidth="5*" align="center"/>
34953 <colspec colwidth="5*" align="center"/>
34954 <colspec colwidth="6*" align="right"/>
34957 <entry><option>return_path_add</option></entry>
34958 <entry>Use: <emphasis>transports</emphasis></entry>
34959 <entry>Type: <emphasis>boolean</emphasis></entry>
34960 <entry>Default: <emphasis>false</emphasis></entry>
34966 <indexterm role="concept">
34967 <primary><emphasis>Return-path:</emphasis> header line</primary>
34969 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
34970 Although the return path is normally available in the prefix line of BSD
34971 mailboxes, this is commonly not displayed by MUAs, and so the user does not
34972 have easy access to it.
34975 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
34976 the delivery SMTP server makes the final delivery</quote>. This implies that this
34977 header should not be present in incoming messages. Exim has a configuration
34978 option, <option>return_path_remove</option>, which requests removal of this header from
34979 incoming messages, so that delivered messages can safely be resent to other
34983 <indexterm role="option">
34984 <primary>shadow_condition</primary>
34987 <informaltable frame="all">
34988 <tgroup cols="4" colsep="0" rowsep="0">
34989 <colspec colwidth="8*" align="left"/>
34990 <colspec colwidth="5*" align="center"/>
34991 <colspec colwidth="5*" align="center"/>
34992 <colspec colwidth="6*" align="right"/>
34995 <entry><option>shadow_condition</option></entry>
34996 <entry>Use: <emphasis>transports</emphasis></entry>
34997 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34998 <entry>Default: <emphasis>unset</emphasis></entry>
35004 See <option>shadow_transport</option> below.
35007 <indexterm role="option">
35008 <primary>shadow_transport</primary>
35011 <informaltable frame="all">
35012 <tgroup cols="4" colsep="0" rowsep="0">
35013 <colspec colwidth="8*" align="left"/>
35014 <colspec colwidth="5*" align="center"/>
35015 <colspec colwidth="5*" align="center"/>
35016 <colspec colwidth="6*" align="right"/>
35019 <entry><option>shadow_transport</option></entry>
35020 <entry>Use: <emphasis>transports</emphasis></entry>
35021 <entry>Type: <emphasis>string</emphasis></entry>
35022 <entry>Default: <emphasis>unset</emphasis></entry>
35028 <indexterm role="concept">
35029 <primary>shadow transport</primary>
35031 <indexterm role="concept">
35032 <primary>transport</primary>
35033 <secondary>shadow</secondary>
35035 A local transport may set the <option>shadow_transport</option> option to the name of
35036 another local transport. Shadow remote transports are not supported.
35039 Whenever a delivery to the main transport succeeds, and either
35040 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
35041 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
35042 passed to the shadow transport, with the same delivery address or addresses. If
35043 expansion fails, no action is taken except that non-forced expansion failures
35044 cause a log line to be written.
35047 The result of the shadow transport is discarded and does not affect the
35048 subsequent processing of the message. Only a single level of shadowing is
35049 provided; the <option>shadow_transport</option> option is ignored on any transport when it
35050 is running as a shadow. Options concerned with output from pipes are also
35051 ignored. The log line for the successful delivery has an item added on the end,
35054 <literallayout class="monospaced">
35055 ST=<shadow transport name>
35058 If the shadow transport did not succeed, the error message is put in
35059 parentheses afterwards. Shadow transports can be used for a number of different
35060 purposes, including keeping more detailed log information than Exim normally
35061 provides, and implementing automatic acknowledgement policies based on message
35062 headers that some sites insist on.
35065 <indexterm role="option">
35066 <primary>transport_filter</primary>
35069 <informaltable frame="all">
35070 <tgroup cols="4" colsep="0" rowsep="0">
35071 <colspec colwidth="8*" align="left"/>
35072 <colspec colwidth="5*" align="center"/>
35073 <colspec colwidth="5*" align="center"/>
35074 <colspec colwidth="6*" align="right"/>
35077 <entry><option>transport_filter</option></entry>
35078 <entry>Use: <emphasis>transports</emphasis></entry>
35079 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35080 <entry>Default: <emphasis>unset</emphasis></entry>
35086 <indexterm role="concept">
35087 <primary>transport</primary>
35088 <secondary>filter</secondary>
35090 <indexterm role="concept">
35091 <primary>filter</primary>
35092 <secondary>transport filter</secondary>
35094 This option sets up a filtering (in the Unix shell sense) process for messages
35095 at transport time. It should not be confused with mail filtering as set up by
35096 individual users or via a system filter.
35099 When the message is about to be written out, the command specified by
35100 <option>transport_filter</option> is started up in a separate, parallel process, and
35101 the entire message, including the header lines, is passed to it on its standard
35102 input (this in fact is done from a third process, to avoid deadlock). The
35103 command must be specified as an absolute path.
35106 The lines of the message that are written to the transport filter are
35107 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
35108 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
35109 lines beginning with a dot, and also before any processing implied by the
35110 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
35111 <command>pipe</command> transports.
35114 The standard error for the filter process is set to the same destination as its
35115 standard output; this is read and written to the message’s ultimate
35116 destination. The process that writes the message to the filter, the
35117 filter itself, and the original process that reads the result and delivers it
35118 are all run in parallel, like a shell pipeline.
35121 The filter can perform any transformations it likes, but of course should take
35122 care not to break RFC 2822 syntax. A demonstration Perl script is provided in
35123 <filename>util/transport-filter.pl</filename>; this makes a few arbitrary modifications just to
35124 show the possibilities. Exim does not check the result, except to test for a
35125 final newline when SMTP is in use. All messages transmitted over SMTP must end
35126 with a newline, so Exim supplies one if it is missing.
35129 <indexterm role="concept">
35130 <primary>content scanning</primary>
35131 <secondary>per user</secondary>
35133 A transport filter can be used to provide content-scanning on a per-user basis
35134 at delivery time if the only required effect of the scan is to modify the
35135 message. For example, a content scan could insert a new header line containing
35136 a spam score. This could be interpreted by a filter in the user’s MUA. It is
35137 not possible to discard a message at this stage.
35140 <indexterm role="concept">
35141 <primary>SMTP</primary>
35142 <secondary>SIZE</secondary>
35144 A problem might arise if the filter increases the size of a message that is
35145 being sent down an SMTP connection. If the receiving SMTP server has indicated
35146 support for the SIZE parameter, Exim will have sent the size of the message
35147 at the start of the SMTP session. If what is actually sent is substantially
35148 more, the server might reject the message. This can be worked round by setting
35149 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
35150 additions to the message, or to disable the use of SIZE altogether.
35153 <indexterm role="concept">
35154 <primary><varname>$pipe_addresses</varname></primary>
35156 The value of the <option>transport_filter</option> option is the command string for starting
35157 the filter, which is run directly from Exim, not under a shell. The string is
35158 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
35159 Exim breaks it up into arguments and then expands each argument separately (see
35160 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
35161 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
35162 of arguments, one for each address that applies to this delivery. (This isn’t
35163 an ideal name for this feature here, but as it was already implemented for the
35164 <command>pipe</command> transport, it seemed sensible not to change it.)
35167 <indexterm role="concept">
35168 <primary><varname>$host</varname></primary>
35170 <indexterm role="concept">
35171 <primary><varname>$host_address</varname></primary>
35173 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
35174 transport is a remote one. They contain the name and IP address of the host to
35175 which the message is being sent. For example:
35177 <literallayout class="monospaced">
35178 transport_filter = /some/directory/transport-filter.pl \
35179 $host $host_address $sender_address $pipe_addresses
35182 Two problems arise if you want to use more complicated expansion items to
35183 generate transport filter commands, both of which due to the fact that the
35184 command is split up <emphasis>before</emphasis> expansion.
35189 If an expansion item contains white space, you must quote it, so that it is all
35190 part of the same command item. If the entire option setting is one such
35191 expansion item, you have to take care what kind of quoting you use. For
35194 <literallayout class="monospaced">
35195 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
35198 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
35199 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
35200 stripped by Exim when it read the option’s value. When the value is used, if
35201 the single quotes were missing, the line would be split into two items,
35202 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
35203 Exim tried to expand the first one.
35208 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
35209 expansion cannot generate multiple arguments, or a command name followed by
35210 arguments. Consider this example:
35212 <literallayout class="monospaced">
35213 transport_filter = ${lookup{$host}lsearch{/some/file}\
35214 {$value}{/bin/cat}}
35217 The result of the lookup is interpreted as the name of the command, even
35218 if it contains white space. The simplest way round this is to use a shell:
35220 <literallayout class="monospaced">
35221 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/some/file}\
35222 {$value}{/bin/cat}}
35227 The filter process is run under the same uid and gid as the normal delivery.
35228 For remote deliveries this is the Exim uid/gid by default. The command should
35229 normally yield a zero return code. Transport filters are not supposed to fail.
35230 A non-zero code is taken to mean that the transport filter encountered some
35231 serious problem. Delivery of the message is deferred; the message remains on
35232 the queue and is tried again later. It is not possible to cause a message to be
35233 bounced from a transport filter.
35236 If a transport filter is set on an autoreply transport, the original message is
35237 passed through the filter as it is being copied into the newly generated
35238 message, which happens if the <option>return_message</option> option is set.
35241 <indexterm role="option">
35242 <primary>transport_filter_timeout</primary>
35245 <informaltable frame="all">
35246 <tgroup cols="4" colsep="0" rowsep="0">
35247 <colspec colwidth="8*" align="left"/>
35248 <colspec colwidth="5*" align="center"/>
35249 <colspec colwidth="5*" align="center"/>
35250 <colspec colwidth="6*" align="right"/>
35253 <entry><option>transport_filter_timeout</option></entry>
35254 <entry>Use: <emphasis>transports</emphasis></entry>
35255 <entry>Type: <emphasis>time</emphasis></entry>
35256 <entry>Default: <emphasis>5m</emphasis></entry>
35262 <indexterm role="concept">
35263 <primary>transport filter</primary>
35264 <secondary>timeout</secondary>
35266 When Exim is reading the output of a transport filter, it a applies a timeout
35267 that can be set by this option. Exceeding the timeout is normally treated as a
35268 temporary delivery failure. However, if a transport filter is used with a
35269 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
35270 way as a timeout in the pipe command itself. By default, a timeout is a hard
35271 error, but if the <command>pipe</command> transport’s <option>timeout_defer</option> option is set true, it
35272 becomes a temporary error.
35275 <indexterm role="option">
35276 <primary>user</primary>
35279 <informaltable frame="all">
35280 <tgroup cols="4" colsep="0" rowsep="0">
35281 <colspec colwidth="8*" align="left"/>
35282 <colspec colwidth="5*" align="center"/>
35283 <colspec colwidth="5*" align="center"/>
35284 <colspec colwidth="6*" align="right"/>
35287 <entry><option>user</option></entry>
35288 <entry>Use: <emphasis>transports</emphasis></entry>
35289 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35290 <entry>Default: <emphasis>Exim user</emphasis></entry>
35296 <indexterm role="concept">
35297 <primary>uid (user id)</primary>
35298 <secondary>local delivery</secondary>
35300 <indexterm role="concept">
35301 <primary>transport user</primary>
35302 <secondary>specifying</secondary>
35304 This option specifies the user under whose uid the delivery process is to be
35305 run, overriding any uid that may have been set by the router. If the user is
35306 given as a name, the uid is looked up from the password data, and the
35307 associated group is taken as the value of the gid to be used if the <option>group</option>
35311 For deliveries that use local transports, a user and group are normally
35312 specified explicitly or implicitly (for example, as a result of
35313 <option>check_local_user</option>) by the router or transport.
35316 <indexterm role="concept">
35317 <primary>hints database</primary>
35318 <secondary>access by remote transport</secondary>
35320 For remote transports, you should leave this option unset unless you really are
35321 sure you know what you are doing. When a remote transport is running, it needs
35322 to be able to access Exim’s hints databases, because each host may have its own
35324 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
35325 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
35326 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
35330 <chapter id="CHAPbatching">
35331 <title>Address batching in local transports</title>
35332 <titleabbrev>Address batching</titleabbrev>
35334 <indexterm role="concept">
35335 <primary>transport</primary>
35336 <secondary>local; address batching in</secondary>
35338 The only remote transport (<command>smtp</command>) is normally configured to handle more than
35339 one address at a time, so that when several addresses are routed to the same
35340 remote host, just one copy of the message is sent. Local transports, however,
35341 normally handle one address at a time. That is, a separate instance of the
35342 transport is run for each address that is routed to the transport. A separate
35343 copy of the message is delivered each time.
35346 <indexterm role="concept">
35347 <primary>batched local delivery</primary>
35349 <indexterm role="concept">
35350 <primary><option>batch_max</option></primary>
35352 <indexterm role="concept">
35353 <primary><option>batch_id</option></primary>
35355 In special cases, it may be desirable to handle several addresses at once in a
35356 local transport, for example:
35361 In an <command>appendfile</command> transport, when storing messages in files for later
35362 delivery by some other means, a single copy of the message with multiple
35363 recipients saves space.
35368 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
35369 a single copy saves time, and is the normal way LMTP is expected to work.
35374 In a <command>pipe</command> transport, when passing the message
35375 to a scanner program or
35376 to some other delivery mechanism such as UUCP, multiple recipients may be
35382 These three local transports all have the same options for controlling multiple
35383 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
35384 repeating the information for each transport, these options are described here.
35387 The <option>batch_max</option> option specifies the maximum number of addresses that can be
35388 delivered together in a single run of the transport. Its default value is one
35389 (no batching). When more than one address is routed to a transport that has a
35390 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
35391 (that is, in a single run of the transport with multiple recipients), subject
35392 to certain conditions:
35397 <indexterm role="concept">
35398 <primary><varname>$local_part</varname></primary>
35400 If any of the transport’s options contain a reference to <varname>$local_part</varname>, no
35401 batching is possible.
35406 <indexterm role="concept">
35407 <primary><varname>$domain</varname></primary>
35409 If any of the transport’s options contain a reference to <varname>$domain</varname>, only
35410 addresses with the same domain are batched.
35415 <indexterm role="concept">
35416 <primary>customizing</primary>
35417 <secondary>batching condition</secondary>
35419 If <option>batch_id</option> is set, it is expanded for each address, and only those
35420 addresses with the same expanded value are batched. This allows you to specify
35421 customized batching conditions. Failure of the expansion for any reason,
35422 including forced failure, disables batching, but it does not stop the delivery
35428 Batched addresses must also have the same errors address (where to send
35429 delivery errors), the same header additions and removals, the same user and
35430 group for the transport, and if a host list is present, the first host must
35436 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
35437 both when the file or pipe command is specified in the transport, and when it
35438 is specified by a <command>redirect</command> router, but all the batched addresses must of
35439 course be routed to the same file or pipe command. These two transports have an
35440 option called <option>use_bsmtp</option>, which causes them to deliver the message in
35441 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
35442 <option>check_string</option> and <option>escape_string</option> options are forced to the values
35444 <literallayout class="monospaced">
35446 escape_string = ".."
35449 when batched SMTP is in use. A full description of the batch SMTP mechanism is
35450 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
35451 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
35454 <indexterm role="concept">
35455 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
35457 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
35458 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
35459 that are being processed together. If you are using a batching <command>appendfile</command>
35460 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
35461 addresses is to set the <option>envelope_to_add</option> option.
35464 <indexterm role="concept">
35465 <primary><command>pipe</command> transport</primary>
35466 <secondary>with multiple addresses</secondary>
35468 <indexterm role="concept">
35469 <primary><varname>$pipe_addresses</varname></primary>
35471 If you are using a <command>pipe</command> transport without BSMTP, and setting the
35472 transport’s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
35473 the command. This is not a true variable; it is a bit of magic that causes each
35474 of the recipient addresses to be inserted into the command as a separate
35475 argument. This provides a way of accessing all the addresses that are being
35476 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
35477 are specififed by a <command>redirect</command> router.
35481 <chapter id="CHAPappendfile">
35482 <title>The appendfile transport</title>
35484 <indexterm role="concept" id="IIDapptra1" class="startofrange">
35485 <primary><command>appendfile</command> transport</primary>
35487 <indexterm role="concept" id="IIDapptra2" class="startofrange">
35488 <primary>transports</primary>
35489 <secondary><command>appendfile</command></secondary>
35491 <indexterm role="concept">
35492 <primary>directory creation</primary>
35494 <indexterm role="concept">
35495 <primary>creating directories</primary>
35497 The <command>appendfile</command> transport delivers a message by appending it to an existing
35498 file, or by creating an entirely new file in a specified directory. Single
35499 files to which messages are appended can be in the traditional Unix mailbox
35500 format, or optionally in the MBX format supported by the Pine MUA and
35501 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
35502 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
35503 to give added protection against failures that happen part-way through the
35504 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
35505 supported. For all file formats, Exim attempts to create as many levels of
35506 directory as necessary, provided that <option>create_directory</option> is set.
35509 The code for the optional formats is not included in the Exim binary by
35510 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
35511 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
35515 <indexterm role="concept">
35516 <primary>quota</primary>
35517 <secondary>system</secondary>
35519 Exim recognises system quota errors, and generates an appropriate message. Exim
35520 also supports its own quota control within the transport, for use when the
35521 system facility is unavailable or cannot be used for some reason.
35524 If there is an error while appending to a file (for example, quota exceeded or
35525 partition filled), Exim attempts to reset the file’s length and last
35526 modification time back to what they were before. If there is an error while
35527 creating an entirely new file, the new file is removed.
35530 Before appending to a file, a number of security checks are made, and the
35531 file is locked. A detailed description is given below, after the list of
35535 The <command>appendfile</command> transport is most commonly used for local deliveries to
35536 users’ mailboxes. However, it can also be used as a pseudo-remote transport for
35537 putting messages into files for remote delivery by some means other than Exim.
35538 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
35541 <section id="SECTfildiropt">
35542 <title>The file and directory options</title>
35544 The <option>file</option> option specifies a single file, to which the message is appended;
35545 the <option>directory</option> option specifies a directory, in which a new file containing
35546 the message is created. Only one of these two options can be set, and for
35547 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
35550 <indexterm role="concept">
35551 <primary><varname>$address_file</varname></primary>
35553 <indexterm role="concept">
35554 <primary><varname>$local_part</varname></primary>
35556 However, <command>appendfile</command> is also used for delivering messages to files or
35557 directories whose names (or parts of names) are obtained from alias,
35558 forwarding, or filtering operations (for example, a <option>save</option> command in a
35559 user’s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
35560 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
35561 name (or partial name) of the file or directory generated by the redirection
35562 operation. There are two cases:
35567 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
35568 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
35569 common case when users with local accounts use filtering to sort mail into
35570 different folders. See for example, the <command>address_file</command> transport in the
35571 default configuration. If the path ends with a slash, it is assumed to be the
35572 name of a directory. A delivery to a directory can also be forced by setting
35573 <option>maildir_format</option> or <option>mailstore_format</option>.
35578 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
35579 used to determine the file or directory name for the delivery. Normally, the
35580 contents of <varname>$address_file</varname> are used in some way in the string expansion.
35585 <indexterm role="concept">
35586 <primary>Sieve filter</primary>
35587 <secondary>configuring <command>appendfile</command></secondary>
35589 <indexterm role="concept">
35590 <primary>Sieve filter</primary>
35591 <secondary>relative mailbox path handling</secondary>
35593 As an example of the second case, consider an environment where users do not
35594 have home directories. They may be permitted to use Exim filter commands of the
35597 <literallayout class="monospaced">
35601 or Sieve filter commands of the form:
35603 <literallayout class="monospaced">
35604 require "fileinto";
35605 fileinto "folder23";
35608 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
35609 must transform the relative path into an appropriate absolute file name. In the
35610 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
35611 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
35612 way of handling this requirement:
35614 <literallayout class="monospaced">
35615 file = ${if eq{$address_file}{inbox} \
35616 {/var/mail/$local_part} \
35617 {${if eq{${substr_0_1:$address_file}}{/} \
35619 {$home/mail/$address_file} \
35624 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
35625 location, absolute paths are used without change, and other folders are in the
35626 <filename>mail</filename> directory within the home directory.
35629 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
35630 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
35631 the router. In particular, this is the case if <option>check_local_user</option> is set. If
35632 you want to prevent this happening at routing time, you can set
35633 <option>router_home_directory</option> empty. This forces the router to pass the relative
35634 path to the transport.
35637 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
35638 the <option>file</option> or <option>directory</option> option is still used if it is set.
35642 <title>Private options for appendfile</title>
35644 <indexterm role="concept">
35645 <primary>options</primary>
35646 <secondary><command>appendfile</command> transport</secondary>
35650 <indexterm role="option">
35651 <primary>allow_fifo</primary>
35654 <informaltable frame="all">
35655 <tgroup cols="4" colsep="0" rowsep="0">
35656 <colspec colwidth="8*" align="left"/>
35657 <colspec colwidth="5*" align="center"/>
35658 <colspec colwidth="5*" align="center"/>
35659 <colspec colwidth="6*" align="right"/>
35662 <entry><option>allow_fifo</option></entry>
35663 <entry>Use: <emphasis>appendfile</emphasis></entry>
35664 <entry>Type: <emphasis>boolean</emphasis></entry>
35665 <entry>Default: <emphasis>false</emphasis></entry>
35671 <indexterm role="concept">
35672 <primary>fifo (named pipe)</primary>
35674 <indexterm role="concept">
35675 <primary>named pipe (fifo)</primary>
35677 <indexterm role="concept">
35678 <primary>pipe</primary>
35679 <secondary>named (fifo)</secondary>
35681 Setting this option permits delivery to named pipes (FIFOs) as well as to
35682 regular files. If no process is reading the named pipe at delivery time, the
35683 delivery is deferred.
35686 <indexterm role="option">
35687 <primary>allow_symlink</primary>
35690 <informaltable frame="all">
35691 <tgroup cols="4" colsep="0" rowsep="0">
35692 <colspec colwidth="8*" align="left"/>
35693 <colspec colwidth="5*" align="center"/>
35694 <colspec colwidth="5*" align="center"/>
35695 <colspec colwidth="6*" align="right"/>
35698 <entry><option>allow_symlink</option></entry>
35699 <entry>Use: <emphasis>appendfile</emphasis></entry>
35700 <entry>Type: <emphasis>boolean</emphasis></entry>
35701 <entry>Default: <emphasis>false</emphasis></entry>
35707 <indexterm role="concept">
35708 <primary>symbolic link</primary>
35709 <secondary>to mailbox</secondary>
35711 <indexterm role="concept">
35712 <primary>mailbox</primary>
35713 <secondary>symbolic link</secondary>
35715 By default, <command>appendfile</command> will not deliver if the path name for the file is
35716 that of a symbolic link. Setting this option relaxes that constraint, but there
35717 are security issues involved in the use of symbolic links. Be sure you know
35718 what you are doing if you set this. Details of exactly what this option affects
35719 are included in the discussion which follows this list of options.
35722 <indexterm role="option">
35723 <primary>batch_id</primary>
35726 <informaltable frame="all">
35727 <tgroup cols="4" colsep="0" rowsep="0">
35728 <colspec colwidth="8*" align="left"/>
35729 <colspec colwidth="5*" align="center"/>
35730 <colspec colwidth="5*" align="center"/>
35731 <colspec colwidth="6*" align="right"/>
35734 <entry><option>batch_id</option></entry>
35735 <entry>Use: <emphasis>appendfile</emphasis></entry>
35736 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35737 <entry>Default: <emphasis>unset</emphasis></entry>
35743 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
35744 However, batching is automatically disabled for <command>appendfile</command> deliveries that
35745 happen as a result of forwarding or aliasing or other redirection directly to a
35749 <indexterm role="option">
35750 <primary>batch_max</primary>
35753 <informaltable frame="all">
35754 <tgroup cols="4" colsep="0" rowsep="0">
35755 <colspec colwidth="8*" align="left"/>
35756 <colspec colwidth="5*" align="center"/>
35757 <colspec colwidth="5*" align="center"/>
35758 <colspec colwidth="6*" align="right"/>
35761 <entry><option>batch_max</option></entry>
35762 <entry>Use: <emphasis>appendfile</emphasis></entry>
35763 <entry>Type: <emphasis>integer</emphasis></entry>
35764 <entry>Default: <emphasis>1</emphasis></entry>
35770 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
35773 <indexterm role="option">
35774 <primary>check_group</primary>
35777 <informaltable frame="all">
35778 <tgroup cols="4" colsep="0" rowsep="0">
35779 <colspec colwidth="8*" align="left"/>
35780 <colspec colwidth="5*" align="center"/>
35781 <colspec colwidth="5*" align="center"/>
35782 <colspec colwidth="6*" align="right"/>
35785 <entry><option>check_group</option></entry>
35786 <entry>Use: <emphasis>appendfile</emphasis></entry>
35787 <entry>Type: <emphasis>boolean</emphasis></entry>
35788 <entry>Default: <emphasis>false</emphasis></entry>
35794 When this option is set, the group owner of the file defined by the <option>file</option>
35795 option is checked to see that it is the same as the group under which the
35796 delivery process is running. The default setting is false because the default
35797 file mode is 0600, which means that the group is irrelevant.
35800 <indexterm role="option">
35801 <primary>check_owner</primary>
35804 <informaltable frame="all">
35805 <tgroup cols="4" colsep="0" rowsep="0">
35806 <colspec colwidth="8*" align="left"/>
35807 <colspec colwidth="5*" align="center"/>
35808 <colspec colwidth="5*" align="center"/>
35809 <colspec colwidth="6*" align="right"/>
35812 <entry><option>check_owner</option></entry>
35813 <entry>Use: <emphasis>appendfile</emphasis></entry>
35814 <entry>Type: <emphasis>boolean</emphasis></entry>
35815 <entry>Default: <emphasis>true</emphasis></entry>
35821 When this option is set, the owner of the file defined by the <option>file</option> option
35822 is checked to ensure that it is the same as the user under which the delivery
35823 process is running.
35826 <indexterm role="option">
35827 <primary>check_string</primary>
35830 <informaltable frame="all">
35831 <tgroup cols="4" colsep="0" rowsep="0">
35832 <colspec colwidth="8*" align="left"/>
35833 <colspec colwidth="5*" align="center"/>
35834 <colspec colwidth="5*" align="center"/>
35835 <colspec colwidth="6*" align="right"/>
35838 <entry><option>check_string</option></entry>
35839 <entry>Use: <emphasis>appendfile</emphasis></entry>
35840 <entry>Type: <emphasis>string</emphasis></entry>
35841 <entry>Default: <emphasis>see below</emphasis></entry>
35847 <indexterm role="concept">
35848 <primary><quote>From</quote> line</primary>
35850 As <command>appendfile</command> writes the message, the start of each line is tested for
35851 matching <option>check_string</option>, and if it does, the initial matching characters are
35852 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
35853 a literal string, not a regular expression, and the case of any letters it
35854 contains is significant.
35857 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
35858 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
35859 configuration are ignored. Otherwise, they default to <quote>From </quote> and
35860 <quote>>From </quote> when the <option>file</option> option is set, and unset when any of the
35861 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
35864 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
35865 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
35866 <quote>From </quote> indicates the start of a new message. All four options need changing
35867 if another format is used. For example, to deliver to mailboxes in MMDF format:
35868 <indexterm role="concept">
35869 <primary>MMDF format mailbox</primary>
35871 <indexterm role="concept">
35872 <primary>mailbox</primary>
35873 <secondary>MMDF format</secondary>
35876 <literallayout class="monospaced">
35877 check_string = "\1\1\1\1\n"
35878 escape_string = "\1\1\1\1 \n"
35879 message_prefix = "\1\1\1\1\n"
35880 message_suffix = "\1\1\1\1\n"
35883 <indexterm role="option">
35884 <primary>create_directory</primary>
35887 <informaltable frame="all">
35888 <tgroup cols="4" colsep="0" rowsep="0">
35889 <colspec colwidth="8*" align="left"/>
35890 <colspec colwidth="5*" align="center"/>
35891 <colspec colwidth="5*" align="center"/>
35892 <colspec colwidth="6*" align="right"/>
35895 <entry><option>create_directory</option></entry>
35896 <entry>Use: <emphasis>appendfile</emphasis></entry>
35897 <entry>Type: <emphasis>boolean</emphasis></entry>
35898 <entry>Default: <emphasis>true</emphasis></entry>
35904 <indexterm role="concept">
35905 <primary>directory creation</primary>
35907 When this option is true, Exim attempts to create any missing superior
35908 directories for the file that it is about to write. A created directory’s mode
35909 is given by the <option>directory_mode</option> option.
35912 The group ownership of a newly created directory is highly dependent on the
35913 operating system (and possibly the file system) that is being used. For
35914 example, in Solaris, if the parent directory has the setgid bit set, its group
35915 is propagated to the child; if not, the currently set group is used. However,
35916 in FreeBSD, the parent’s group is always used.
35919 <indexterm role="option">
35920 <primary>create_file</primary>
35923 <informaltable frame="all">
35924 <tgroup cols="4" colsep="0" rowsep="0">
35925 <colspec colwidth="8*" align="left"/>
35926 <colspec colwidth="5*" align="center"/>
35927 <colspec colwidth="5*" align="center"/>
35928 <colspec colwidth="6*" align="right"/>
35931 <entry><option>create_file</option></entry>
35932 <entry>Use: <emphasis>appendfile</emphasis></entry>
35933 <entry>Type: <emphasis>string</emphasis></entry>
35934 <entry>Default: <emphasis>anywhere</emphasis></entry>
35940 This option constrains the location of files and directories that are created
35941 by this transport. It applies to files defined by the <option>file</option> option and
35942 directories defined by the <option>directory</option> option. In the case of maildir
35943 delivery, it applies to the top level directory, not the maildir directories
35947 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
35948 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
35949 set for the transport. This option is not useful when an explicit file name is
35950 given for normal mailbox deliveries. It is intended for the case when file
35951 names are generated from users’ <filename>.forward</filename> files. These are usually handled
35952 by an <command>appendfile</command> transport called <option>address_file</option>. See also
35953 <option>file_must_exist</option>.
35956 <indexterm role="option">
35957 <primary>directory</primary>
35960 <informaltable frame="all">
35961 <tgroup cols="4" colsep="0" rowsep="0">
35962 <colspec colwidth="8*" align="left"/>
35963 <colspec colwidth="5*" align="center"/>
35964 <colspec colwidth="5*" align="center"/>
35965 <colspec colwidth="6*" align="right"/>
35968 <entry><option>directory</option></entry>
35969 <entry>Use: <emphasis>appendfile</emphasis></entry>
35970 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35971 <entry>Default: <emphasis>unset</emphasis></entry>
35977 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
35978 or <option>directory</option> must be set, unless the delivery is the direct result of a
35979 redirection (see section <xref linkend="SECTfildiropt"/>).
35982 When <option>directory</option> is set, the string is expanded, and the message is delivered
35983 into a new file or files in or below the given directory, instead of being
35984 appended to a single mailbox file. A number of different formats are provided
35985 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
35986 <xref linkend="SECTopdir"/> for further details of this form of delivery.
35989 <indexterm role="option">
35990 <primary>directory_file</primary>
35993 <informaltable frame="all">
35994 <tgroup cols="4" colsep="0" rowsep="0">
35995 <colspec colwidth="8*" align="left"/>
35996 <colspec colwidth="5*" align="center"/>
35997 <colspec colwidth="5*" align="center"/>
35998 <colspec colwidth="6*" align="right"/>
36001 <entry><option>directory_file</option></entry>
36002 <entry>Use: <emphasis>appendfile</emphasis></entry>
36003 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36004 <entry>Default: <emphasis><literal>q${base62:$tod_epoch}-$inode</literal></emphasis></entry>
36010 <indexterm role="concept">
36011 <primary>base62</primary>
36013 <indexterm role="concept">
36014 <primary><varname>$inode</varname></primary>
36016 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
36017 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
36018 whose name is obtained by expanding this string. The default value generates a
36019 unique name from the current time, in base 62 form, and the inode of the file.
36020 The variable <varname>$inode</varname> is available only when expanding this option.
36023 <indexterm role="option">
36024 <primary>directory_mode</primary>
36027 <informaltable frame="all">
36028 <tgroup cols="4" colsep="0" rowsep="0">
36029 <colspec colwidth="8*" align="left"/>
36030 <colspec colwidth="5*" align="center"/>
36031 <colspec colwidth="5*" align="center"/>
36032 <colspec colwidth="6*" align="right"/>
36035 <entry><option>directory_mode</option></entry>
36036 <entry>Use: <emphasis>appendfile</emphasis></entry>
36037 <entry>Type: <emphasis>octal integer</emphasis></entry>
36038 <entry>Default: <emphasis>0700</emphasis></entry>
36044 If <command>appendfile</command> creates any directories as a result of the
36045 <option>create_directory</option> option, their mode is specified by this option.
36048 <indexterm role="option">
36049 <primary>escape_string</primary>
36052 <informaltable frame="all">
36053 <tgroup cols="4" colsep="0" rowsep="0">
36054 <colspec colwidth="8*" align="left"/>
36055 <colspec colwidth="5*" align="center"/>
36056 <colspec colwidth="5*" align="center"/>
36057 <colspec colwidth="6*" align="right"/>
36060 <entry><option>escape_string</option></entry>
36061 <entry>Use: <emphasis>appendfile</emphasis></entry>
36062 <entry>Type: <emphasis>string</emphasis></entry>
36063 <entry>Default: <emphasis>see description</emphasis></entry>
36069 See <option>check_string</option> above.
36072 <indexterm role="option">
36073 <primary>file</primary>
36076 <informaltable frame="all">
36077 <tgroup cols="4" colsep="0" rowsep="0">
36078 <colspec colwidth="8*" align="left"/>
36079 <colspec colwidth="5*" align="center"/>
36080 <colspec colwidth="5*" align="center"/>
36081 <colspec colwidth="6*" align="right"/>
36084 <entry><option>file</option></entry>
36085 <entry>Use: <emphasis>appendfile</emphasis></entry>
36086 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36087 <entry>Default: <emphasis>unset</emphasis></entry>
36093 This option is mutually exclusive with the <option>directory</option> option, but one of
36094 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
36095 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
36096 specifies a single file, to which the message is appended. One or more of
36097 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
36098 <option>file</option>.
36101 <indexterm role="concept">
36102 <primary>NFS</primary>
36103 <secondary>lock file</secondary>
36105 <indexterm role="concept">
36106 <primary>locking files</primary>
36108 <indexterm role="concept">
36109 <primary>lock files</primary>
36111 If you are using more than one host to deliver over NFS into the same
36112 mailboxes, you should always use lock files.
36115 The string value is expanded for each delivery, and must yield an absolute
36116 path. The most common settings of this option are variations on one of these
36119 <literallayout class="monospaced">
36120 file = /var/spool/mail/$local_part
36121 file = /home/$local_part/inbox
36125 <indexterm role="concept">
36126 <primary><quote>sticky</quote> bit</primary>
36128 In the first example, all deliveries are done into the same directory. If Exim
36129 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
36130 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
36131 deliveries to be possible, or alternatively the <option>group</option> option can be used to
36132 run the delivery under a group id which has write access to the directory.
36135 <indexterm role="option">
36136 <primary>file_format</primary>
36139 <informaltable frame="all">
36140 <tgroup cols="4" colsep="0" rowsep="0">
36141 <colspec colwidth="8*" align="left"/>
36142 <colspec colwidth="5*" align="center"/>
36143 <colspec colwidth="5*" align="center"/>
36144 <colspec colwidth="6*" align="right"/>
36147 <entry><option>file_format</option></entry>
36148 <entry>Use: <emphasis>appendfile</emphasis></entry>
36149 <entry>Type: <emphasis>string</emphasis></entry>
36150 <entry>Default: <emphasis>unset</emphasis></entry>
36156 <indexterm role="concept">
36157 <primary>file</primary>
36158 <secondary>mailbox; checking existing format</secondary>
36160 This option requests the transport to check the format of an existing file
36161 before adding to it. The check consists of matching a specific string at the
36162 start of the file. The value of the option consists of an even number of
36163 colon-separated strings. The first of each pair is the test string, and the
36164 second is the name of a transport. If the transport associated with a matched
36165 string is not the current transport, control is passed over to the other
36166 transport. For example, suppose the standard <command>local_delivery</command> transport has
36169 <literallayout class="monospaced">
36170 file_format = "From : local_delivery :\
36171 \1\1\1\1\n : local_mmdf_delivery"
36174 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
36175 a mailbox begins with four binary ones followed by a newline, control is passed
36176 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
36177 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
36178 is assumed to match the current transport. If the start of a mailbox doesn’t
36179 match any string, or if the transport named for a given string is not defined,
36180 delivery is deferred.
36183 <indexterm role="option">
36184 <primary>file_must_exist</primary>
36187 <informaltable frame="all">
36188 <tgroup cols="4" colsep="0" rowsep="0">
36189 <colspec colwidth="8*" align="left"/>
36190 <colspec colwidth="5*" align="center"/>
36191 <colspec colwidth="5*" align="center"/>
36192 <colspec colwidth="6*" align="right"/>
36195 <entry><option>file_must_exist</option></entry>
36196 <entry>Use: <emphasis>appendfile</emphasis></entry>
36197 <entry>Type: <emphasis>boolean</emphasis></entry>
36198 <entry>Default: <emphasis>false</emphasis></entry>
36203 <para revisionflag="changed">
36204 If this option is true, the file specified by the <option>file</option> option must exist.
36205 A temporary error occurs if it does not, causing delivery to be deferred.
36206 If this option is false, the file is created if it does not exist.
36209 <indexterm role="option">
36210 <primary>lock_fcntl_timeout</primary>
36213 <informaltable frame="all">
36214 <tgroup cols="4" colsep="0" rowsep="0">
36215 <colspec colwidth="8*" align="left"/>
36216 <colspec colwidth="5*" align="center"/>
36217 <colspec colwidth="5*" align="center"/>
36218 <colspec colwidth="6*" align="right"/>
36221 <entry><option>lock_fcntl_timeout</option></entry>
36222 <entry>Use: <emphasis>appendfile</emphasis></entry>
36223 <entry>Type: <emphasis>time</emphasis></entry>
36224 <entry>Default: <emphasis>0s</emphasis></entry>
36230 <indexterm role="concept">
36231 <primary>timeout</primary>
36232 <secondary>mailbox locking</secondary>
36234 <indexterm role="concept">
36235 <primary>mailbox locking</primary>
36236 <secondary>blocking and non-blocking</secondary>
36238 <indexterm role="concept">
36239 <primary>locking files</primary>
36241 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
36242 when locking an open mailbox file. If the call fails, the delivery process
36243 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
36244 Non-blocking calls are used so that the file is not kept open during the wait
36245 for the lock; the reason for this is to make it as safe as possible for
36246 deliveries over NFS in the case when processes might be accessing an NFS
36247 mailbox without using a lock file. This should not be done, but
36248 misunderstandings and hence misconfigurations are not unknown.
36251 On a busy system, however, the performance of a non-blocking lock approach is
36252 not as good as using a blocking lock with a timeout. In this case, the waiting
36253 is done inside the system call, and Exim’s delivery process acquires the lock
36254 and can proceed as soon as the previous lock holder releases it.
36257 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
36258 timeout, are used. There may still be some retrying: the maximum number of
36261 <literallayout class="monospaced">
36262 (lock_retries * lock_interval) / lock_fcntl_timeout
36265 rounded up to the next whole number. In other words, the total time during
36266 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
36267 <option>lock_fcntl_timeout</option> is set very large.
36270 You should consider setting this option if you are getting a lot of delayed
36271 local deliveries because of errors of the form
36273 <literallayout class="monospaced">
36274 failed to lock mailbox /some/file (fcntl)
36277 <indexterm role="option">
36278 <primary>lock_flock_timeout</primary>
36281 <informaltable frame="all">
36282 <tgroup cols="4" colsep="0" rowsep="0">
36283 <colspec colwidth="8*" align="left"/>
36284 <colspec colwidth="5*" align="center"/>
36285 <colspec colwidth="5*" align="center"/>
36286 <colspec colwidth="6*" align="right"/>
36289 <entry><option>lock_flock_timeout</option></entry>
36290 <entry>Use: <emphasis>appendfile</emphasis></entry>
36291 <entry>Type: <emphasis>time</emphasis></entry>
36292 <entry>Default: <emphasis>0s</emphasis></entry>
36298 This timeout applies to file locking when using <function>flock()</function> (see
36299 <option>use_flock</option>); the timeout operates in a similar manner to
36300 <option>lock_fcntl_timeout</option>.
36303 <indexterm role="option">
36304 <primary>lock_interval</primary>
36307 <informaltable frame="all">
36308 <tgroup cols="4" colsep="0" rowsep="0">
36309 <colspec colwidth="8*" align="left"/>
36310 <colspec colwidth="5*" align="center"/>
36311 <colspec colwidth="5*" align="center"/>
36312 <colspec colwidth="6*" align="right"/>
36315 <entry><option>lock_interval</option></entry>
36316 <entry>Use: <emphasis>appendfile</emphasis></entry>
36317 <entry>Type: <emphasis>time</emphasis></entry>
36318 <entry>Default: <emphasis>3s</emphasis></entry>
36324 This specifies the time to wait between attempts to lock the file. See below
36325 for details of locking.
36328 <indexterm role="option">
36329 <primary>lock_retries</primary>
36332 <informaltable frame="all">
36333 <tgroup cols="4" colsep="0" rowsep="0">
36334 <colspec colwidth="8*" align="left"/>
36335 <colspec colwidth="5*" align="center"/>
36336 <colspec colwidth="5*" align="center"/>
36337 <colspec colwidth="6*" align="right"/>
36340 <entry><option>lock_retries</option></entry>
36341 <entry>Use: <emphasis>appendfile</emphasis></entry>
36342 <entry>Type: <emphasis>integer</emphasis></entry>
36343 <entry>Default: <emphasis>10</emphasis></entry>
36349 This specifies the maximum number of attempts to lock the file. A value of zero
36350 is treated as 1. See below for details of locking.
36353 <indexterm role="option">
36354 <primary>lockfile_mode</primary>
36357 <informaltable frame="all">
36358 <tgroup cols="4" colsep="0" rowsep="0">
36359 <colspec colwidth="8*" align="left"/>
36360 <colspec colwidth="5*" align="center"/>
36361 <colspec colwidth="5*" align="center"/>
36362 <colspec colwidth="6*" align="right"/>
36365 <entry><option>lockfile_mode</option></entry>
36366 <entry>Use: <emphasis>appendfile</emphasis></entry>
36367 <entry>Type: <emphasis>octal integer</emphasis></entry>
36368 <entry>Default: <emphasis>0600</emphasis></entry>
36374 This specifies the mode of the created lock file, when a lock file is being
36375 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
36378 <indexterm role="option">
36379 <primary>lockfile_timeout</primary>
36382 <informaltable frame="all">
36383 <tgroup cols="4" colsep="0" rowsep="0">
36384 <colspec colwidth="8*" align="left"/>
36385 <colspec colwidth="5*" align="center"/>
36386 <colspec colwidth="5*" align="center"/>
36387 <colspec colwidth="6*" align="right"/>
36390 <entry><option>lockfile_timeout</option></entry>
36391 <entry>Use: <emphasis>appendfile</emphasis></entry>
36392 <entry>Type: <emphasis>time</emphasis></entry>
36393 <entry>Default: <emphasis>30m</emphasis></entry>
36399 <indexterm role="concept">
36400 <primary>timeout</primary>
36401 <secondary>mailbox locking</secondary>
36403 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
36404 exists and is older than this value, it is assumed to have been left behind by
36405 accident, and Exim attempts to remove it.
36408 <indexterm role="option">
36409 <primary>mailbox_filecount</primary>
36412 <informaltable frame="all">
36413 <tgroup cols="4" colsep="0" rowsep="0">
36414 <colspec colwidth="8*" align="left"/>
36415 <colspec colwidth="5*" align="center"/>
36416 <colspec colwidth="5*" align="center"/>
36417 <colspec colwidth="6*" align="right"/>
36420 <entry><option>mailbox_filecount</option></entry>
36421 <entry>Use: <emphasis>appendfile</emphasis></entry>
36422 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36423 <entry>Default: <emphasis>unset</emphasis></entry>
36429 <indexterm role="concept">
36430 <primary>mailbox</primary>
36431 <secondary>specifying size of</secondary>
36433 <indexterm role="concept">
36434 <primary>size</primary>
36435 <secondary>of mailbox</secondary>
36437 If this option is set, it is expanded, and the result is taken as the current
36438 number of files in the mailbox. It must be a decimal number, optionally
36439 followed by K or M. This provides a way of obtaining this information from an
36440 external source that maintains the data.
36443 <indexterm role="option">
36444 <primary>mailbox_size</primary>
36447 <informaltable frame="all">
36448 <tgroup cols="4" colsep="0" rowsep="0">
36449 <colspec colwidth="8*" align="left"/>
36450 <colspec colwidth="5*" align="center"/>
36451 <colspec colwidth="5*" align="center"/>
36452 <colspec colwidth="6*" align="right"/>
36455 <entry><option>mailbox_size</option></entry>
36456 <entry>Use: <emphasis>appendfile</emphasis></entry>
36457 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36458 <entry>Default: <emphasis>unset</emphasis></entry>
36464 <indexterm role="concept">
36465 <primary>mailbox</primary>
36466 <secondary>specifying size of</secondary>
36468 <indexterm role="concept">
36469 <primary>size</primary>
36470 <secondary>of mailbox</secondary>
36472 If this option is set, it is expanded, and the result is taken as the current
36473 size the mailbox. It must be a decimal number, optionally followed by K or M.
36474 This provides a way of obtaining this information from an external source that
36475 maintains the data. This is likely to be helpful for maildir deliveries where
36476 it is computationally expensive to compute the size of a mailbox.
36479 <indexterm role="option">
36480 <primary>maildir_format</primary>
36483 <informaltable frame="all">
36484 <tgroup cols="4" colsep="0" rowsep="0">
36485 <colspec colwidth="8*" align="left"/>
36486 <colspec colwidth="5*" align="center"/>
36487 <colspec colwidth="5*" align="center"/>
36488 <colspec colwidth="6*" align="right"/>
36491 <entry><option>maildir_format</option></entry>
36492 <entry>Use: <emphasis>appendfile</emphasis></entry>
36493 <entry>Type: <emphasis>boolean</emphasis></entry>
36494 <entry>Default: <emphasis>false</emphasis></entry>
36500 <indexterm role="concept">
36501 <primary>maildir format</primary>
36502 <secondary>specifying</secondary>
36504 If this option is set with the <option>directory</option> option, the delivery is into a new
36505 file, in the <quote>maildir</quote> format that is used by other mail software. When the
36506 transport is activated directly from a <command>redirect</command> router (for example, the
36507 <command>address_file</command> transport in the default configuration), setting
36508 <option>maildir_format</option> causes the path received from the router to be treated as a
36509 directory, whether or not it ends with <literal>/</literal>. This option is available only if
36510 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
36511 <xref linkend="SECTmaildirdelivery"/> below for further details.
36514 <indexterm role="option">
36515 <primary>maildir_quota_directory_regex</primary>
36518 <informaltable frame="all">
36519 <tgroup cols="4" colsep="0" rowsep="0">
36520 <colspec colwidth="8*" align="left"/>
36521 <colspec colwidth="5*" align="center"/>
36522 <colspec colwidth="5*" align="center"/>
36523 <colspec colwidth="6*" align="right"/>
36526 <entry><option>maildir_quota_directory_regex</option></entry>
36527 <entry>Use: <emphasis>appendfile</emphasis></entry>
36528 <entry>Type: <emphasis>string</emphasis></entry>
36529 <entry>Default: <emphasis>See below</emphasis></entry>
36535 <indexterm role="concept">
36536 <primary>maildir format</primary>
36537 <secondary>quota; directories included in</secondary>
36539 <indexterm role="concept">
36540 <primary>quota</primary>
36541 <secondary>maildir; directories included in</secondary>
36543 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
36544 a regular expression for specifying directories, relative to the quota
36545 directory (see <option>quota_directory</option>), that should be included in the quota
36546 calculation. The default value is:
36548 <literallayout class="monospaced">
36549 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
36552 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
36553 (directories whose names begin with a dot). If you want to exclude the
36554 <filename>Trash</filename>
36555 folder from the count (as some sites do), you need to change this setting to
36557 <literallayout class="monospaced">
36558 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
36561 This uses a negative lookahead in the regular expression to exclude the
36562 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
36563 calculations, quota processing is bypassed for any messages that are delivered
36564 directly into that directory.
36567 <indexterm role="option">
36568 <primary>maildir_retries</primary>
36571 <informaltable frame="all">
36572 <tgroup cols="4" colsep="0" rowsep="0">
36573 <colspec colwidth="8*" align="left"/>
36574 <colspec colwidth="5*" align="center"/>
36575 <colspec colwidth="5*" align="center"/>
36576 <colspec colwidth="6*" align="right"/>
36579 <entry><option>maildir_retries</option></entry>
36580 <entry>Use: <emphasis>appendfile</emphasis></entry>
36581 <entry>Type: <emphasis>integer</emphasis></entry>
36582 <entry>Default: <emphasis>10</emphasis></entry>
36588 This option specifies the number of times to retry when writing a file in
36589 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
36592 <indexterm role="option">
36593 <primary>maildir_tag</primary>
36596 <informaltable frame="all">
36597 <tgroup cols="4" colsep="0" rowsep="0">
36598 <colspec colwidth="8*" align="left"/>
36599 <colspec colwidth="5*" align="center"/>
36600 <colspec colwidth="5*" align="center"/>
36601 <colspec colwidth="6*" align="right"/>
36604 <entry><option>maildir_tag</option></entry>
36605 <entry>Use: <emphasis>appendfile</emphasis></entry>
36606 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36607 <entry>Default: <emphasis>unset</emphasis></entry>
36613 This option applies only to deliveries in maildir format, and is described in
36614 section <xref linkend="SECTmaildirdelivery"/> below.
36617 <indexterm role="option">
36618 <primary>maildir_use_size_file</primary>
36621 <informaltable frame="all">
36622 <tgroup cols="4" colsep="0" rowsep="0">
36623 <colspec colwidth="8*" align="left"/>
36624 <colspec colwidth="5*" align="center"/>
36625 <colspec colwidth="5*" align="center"/>
36626 <colspec colwidth="6*" align="right"/>
36629 <entry><option>maildir_use_size_file</option></entry>
36630 <entry>Use: <emphasis>appendfile</emphasis></entry>
36631 <entry>Type: <emphasis>boolean</emphasis></entry>
36632 <entry>Default: <emphasis>false</emphasis></entry>
36638 <indexterm role="concept">
36639 <primary>maildir format</primary>
36640 <secondary><filename>maildirsize</filename> file</secondary>
36642 Setting this option true enables support for <filename>maildirsize</filename> files. Exim
36643 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
36644 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
36645 value is zero. See <option>maildir_quota_directory_regex</option> above and section
36646 <xref linkend="SECTmaildirdelivery"/> below for further details.
36649 <indexterm role="option">
36650 <primary>maildirfolder_create_regex</primary>
36653 <informaltable frame="all">
36654 <tgroup cols="4" colsep="0" rowsep="0">
36655 <colspec colwidth="8*" align="left"/>
36656 <colspec colwidth="5*" align="center"/>
36657 <colspec colwidth="5*" align="center"/>
36658 <colspec colwidth="6*" align="right"/>
36661 <entry><option>maildirfolder_create_regex</option></entry>
36662 <entry>Use: <emphasis>appendfile</emphasis></entry>
36663 <entry>Type: <emphasis>string</emphasis></entry>
36664 <entry>Default: <emphasis>unset</emphasis></entry>
36670 <indexterm role="concept">
36671 <primary>maildir format</primary>
36672 <secondary><filename>maildirfolder</filename> file</secondary>
36674 <indexterm role="concept">
36675 <primary><filename>maildirfolder</filename>, creating</primary>
36677 The value of this option is a regular expression. If it is unset, it has no
36678 effect. Otherwise, before a maildir delivery takes place place, the pattern is
36679 matched against the name of the maildir directory, that is, the directory
36680 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
36681 delivery. If there is a match, Exim checks for the existence of a file called
36682 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
36683 See section <xref linkend="SECTmaildirdelivery"/> for more details.
36686 <indexterm role="option">
36687 <primary>mailstore_format</primary>
36690 <informaltable frame="all">
36691 <tgroup cols="4" colsep="0" rowsep="0">
36692 <colspec colwidth="8*" align="left"/>
36693 <colspec colwidth="5*" align="center"/>
36694 <colspec colwidth="5*" align="center"/>
36695 <colspec colwidth="6*" align="right"/>
36698 <entry><option>mailstore_format</option></entry>
36699 <entry>Use: <emphasis>appendfile</emphasis></entry>
36700 <entry>Type: <emphasis>boolean</emphasis></entry>
36701 <entry>Default: <emphasis>false</emphasis></entry>
36707 <indexterm role="concept">
36708 <primary>mailstore format</primary>
36709 <secondary>specifying</secondary>
36711 If this option is set with the <option>directory</option> option, the delivery is into two
36712 new files in <quote>mailstore</quote> format. The option is available only if
36713 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
36714 below for further details.
36717 <indexterm role="option">
36718 <primary>mailstore_prefix</primary>
36721 <informaltable frame="all">
36722 <tgroup cols="4" colsep="0" rowsep="0">
36723 <colspec colwidth="8*" align="left"/>
36724 <colspec colwidth="5*" align="center"/>
36725 <colspec colwidth="5*" align="center"/>
36726 <colspec colwidth="6*" align="right"/>
36729 <entry><option>mailstore_prefix</option></entry>
36730 <entry>Use: <emphasis>appendfile</emphasis></entry>
36731 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36732 <entry>Default: <emphasis>unset</emphasis></entry>
36738 This option applies only to deliveries in mailstore format, and is described in
36739 section <xref linkend="SECTopdir"/> below.
36742 <indexterm role="option">
36743 <primary>mailstore_suffix</primary>
36746 <informaltable frame="all">
36747 <tgroup cols="4" colsep="0" rowsep="0">
36748 <colspec colwidth="8*" align="left"/>
36749 <colspec colwidth="5*" align="center"/>
36750 <colspec colwidth="5*" align="center"/>
36751 <colspec colwidth="6*" align="right"/>
36754 <entry><option>mailstore_suffix</option></entry>
36755 <entry>Use: <emphasis>appendfile</emphasis></entry>
36756 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36757 <entry>Default: <emphasis>unset</emphasis></entry>
36763 This option applies only to deliveries in mailstore format, and is described in
36764 section <xref linkend="SECTopdir"/> below.
36767 <indexterm role="option">
36768 <primary>mbx_format</primary>
36771 <informaltable frame="all">
36772 <tgroup cols="4" colsep="0" rowsep="0">
36773 <colspec colwidth="8*" align="left"/>
36774 <colspec colwidth="5*" align="center"/>
36775 <colspec colwidth="5*" align="center"/>
36776 <colspec colwidth="6*" align="right"/>
36779 <entry><option>mbx_format</option></entry>
36780 <entry>Use: <emphasis>appendfile</emphasis></entry>
36781 <entry>Type: <emphasis>boolean</emphasis></entry>
36782 <entry>Default: <emphasis>false</emphasis></entry>
36788 <indexterm role="concept">
36789 <primary>locking files</primary>
36791 <indexterm role="concept">
36792 <primary>file</primary>
36793 <secondary>locking</secondary>
36795 <indexterm role="concept">
36796 <primary>file</primary>
36797 <secondary>MBX format</secondary>
36799 <indexterm role="concept">
36800 <primary>MBX format</primary>
36801 <secondary>specifying</secondary>
36803 This option is available only if Exim has been compiled with SUPPORT_MBX
36804 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
36805 the message is appended to the mailbox file in MBX format instead of
36806 traditional Unix format. This format is supported by Pine4 and its associated
36807 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
36810 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
36811 automatically changed by the use of <option>mbx_format</option>. They should normally be set
36812 empty when using MBX format, so this option almost always appears in this
36815 <literallayout class="monospaced">
36821 If none of the locking options are mentioned in the configuration,
36822 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
36823 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
36824 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
36825 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
36826 should not be used if any program that does not use this form of locking is
36827 going to access the mailbox, nor should it be used if the mailbox file is NFS
36828 mounted, because it works only when the mailbox is accessed from a single host.
36831 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
36832 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
36833 (this means for the whole of a Pine or IMAP session), Exim will not be able to
36834 append messages to it.
36837 <indexterm role="option">
36838 <primary>message_prefix</primary>
36841 <informaltable frame="all">
36842 <tgroup cols="4" colsep="0" rowsep="0">
36843 <colspec colwidth="8*" align="left"/>
36844 <colspec colwidth="5*" align="center"/>
36845 <colspec colwidth="5*" align="center"/>
36846 <colspec colwidth="6*" align="right"/>
36849 <entry><option>message_prefix</option></entry>
36850 <entry>Use: <emphasis>appendfile</emphasis></entry>
36851 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36852 <entry>Default: <emphasis>see below</emphasis></entry>
36858 <indexterm role="concept">
36859 <primary><quote>From</quote> line</primary>
36861 The string specified here is expanded and output at the start of every message.
36862 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
36863 in which case it is:
36865 <literallayout class="monospaced">
36866 message_prefix = "From ${if def:return_path{$return_path}\
36867 {MAILER-DAEMON}} $tod_bsdinbox\n"
36870 <indexterm role="option">
36871 <primary>message_suffix</primary>
36874 <informaltable frame="all">
36875 <tgroup cols="4" colsep="0" rowsep="0">
36876 <colspec colwidth="8*" align="left"/>
36877 <colspec colwidth="5*" align="center"/>
36878 <colspec colwidth="5*" align="center"/>
36879 <colspec colwidth="6*" align="right"/>
36882 <entry><option>message_suffix</option></entry>
36883 <entry>Use: <emphasis>appendfile</emphasis></entry>
36884 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36885 <entry>Default: <emphasis>see below</emphasis></entry>
36891 The string specified here is expanded and output at the end of every message.
36892 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
36893 in which case it is a single newline character. The suffix can be suppressed by
36896 <literallayout class="monospaced">
36900 <indexterm role="option">
36901 <primary>mode</primary>
36904 <informaltable frame="all">
36905 <tgroup cols="4" colsep="0" rowsep="0">
36906 <colspec colwidth="8*" align="left"/>
36907 <colspec colwidth="5*" align="center"/>
36908 <colspec colwidth="5*" align="center"/>
36909 <colspec colwidth="6*" align="right"/>
36912 <entry><option>mode</option></entry>
36913 <entry>Use: <emphasis>appendfile</emphasis></entry>
36914 <entry>Type: <emphasis>octal integer</emphasis></entry>
36915 <entry>Default: <emphasis>0600</emphasis></entry>
36921 If the output file is created, it is given this mode. If it already exists and
36922 has wider permissions, they are reduced to this mode. If it has narrower
36923 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
36924 if the delivery is the result of a <option>save</option> command in a filter file specifing
36925 a particular mode, the mode of the output file is always forced to take that
36926 value, and this option is ignored.
36929 <indexterm role="option">
36930 <primary>mode_fail_narrower</primary>
36933 <informaltable frame="all">
36934 <tgroup cols="4" colsep="0" rowsep="0">
36935 <colspec colwidth="8*" align="left"/>
36936 <colspec colwidth="5*" align="center"/>
36937 <colspec colwidth="5*" align="center"/>
36938 <colspec colwidth="6*" align="right"/>
36941 <entry><option>mode_fail_narrower</option></entry>
36942 <entry>Use: <emphasis>appendfile</emphasis></entry>
36943 <entry>Type: <emphasis>boolean</emphasis></entry>
36944 <entry>Default: <emphasis>true</emphasis></entry>
36950 This option applies in the case when an existing mailbox file has a narrower
36951 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
36952 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
36953 continues with the delivery attempt, using the existing mode of the file.
36956 <indexterm role="option">
36957 <primary>notify_comsat</primary>
36960 <informaltable frame="all">
36961 <tgroup cols="4" colsep="0" rowsep="0">
36962 <colspec colwidth="8*" align="left"/>
36963 <colspec colwidth="5*" align="center"/>
36964 <colspec colwidth="5*" align="center"/>
36965 <colspec colwidth="6*" align="right"/>
36968 <entry><option>notify_comsat</option></entry>
36969 <entry>Use: <emphasis>appendfile</emphasis></entry>
36970 <entry>Type: <emphasis>boolean</emphasis></entry>
36971 <entry>Default: <emphasis>false</emphasis></entry>
36977 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
36978 successful delivery to a user mailbox. This is the daemon that notifies logged
36979 on users about incoming mail.
36982 <indexterm role="option">
36983 <primary>quota</primary>
36986 <informaltable frame="all">
36987 <tgroup cols="4" colsep="0" rowsep="0">
36988 <colspec colwidth="8*" align="left"/>
36989 <colspec colwidth="5*" align="center"/>
36990 <colspec colwidth="5*" align="center"/>
36991 <colspec colwidth="6*" align="right"/>
36994 <entry><option>quota</option></entry>
36995 <entry>Use: <emphasis>appendfile</emphasis></entry>
36996 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36997 <entry>Default: <emphasis>unset</emphasis></entry>
37003 <indexterm role="concept">
37004 <primary>quota</primary>
37005 <secondary>imposed by Exim</secondary>
37007 This option imposes a limit on the size of the file to which Exim is appending,
37008 or to the total space used in the directory tree when the <option>directory</option> option
37009 is set. In the latter case, computation of the space used is expensive, because
37010 all the files in the directory (and any sub-directories) have to be
37011 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
37012 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
37013 have no shell access to their mailboxes).
37016 As there is no interlock against two simultaneous deliveries into a
37017 multi-file mailbox, it is possible for the quota to be overrun in this case.
37018 For single-file mailboxes, of course, an interlock is a necessity.
37021 A file’s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
37022 may be a lot less than the actual amount of disk space allocated to the file.
37023 If the sizes of a number of files are being added up, the rounding effect can
37024 become quite noticeable, especially on systems that have large block sizes.
37025 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
37026 the obvious value which users understand most easily.
37029 The value of the option is expanded, and must then be a numerical value
37030 (decimal point allowed), optionally followed by one of the letters K, M, or G,
37031 for kilobytes, megabytes, or gigabytes. If Exim is running on a system with
37032 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
37036 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
37039 The expansion happens while Exim is running as root, before it changes uid for
37040 the delivery. This means that files that are inaccessible to the end user can
37041 be used to hold quota values that are looked up in the expansion. When delivery
37042 fails because this quota is exceeded, the handling of the error is as for
37043 system quota failures.
37046 By default, Exim’s quota checking mimics system quotas, and restricts the
37047 mailbox to the specified maximum size, though the value is not accurate to the
37048 last byte, owing to separator lines and additional headers that may get added
37049 during message delivery. When a mailbox is nearly full, large messages may get
37050 refused even though small ones are accepted, because the size of the current
37051 message is added to the quota when the check is made. This behaviour can be
37052 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
37053 for exceeding the quota does not include the current message. Thus, deliveries
37054 continue until the quota has been exceeded; thereafter, no further messages are
37055 delivered. See also <option>quota_warn_threshold</option>.
37058 <indexterm role="option">
37059 <primary>quota_directory</primary>
37062 <informaltable frame="all">
37063 <tgroup cols="4" colsep="0" rowsep="0">
37064 <colspec colwidth="8*" align="left"/>
37065 <colspec colwidth="5*" align="center"/>
37066 <colspec colwidth="5*" align="center"/>
37067 <colspec colwidth="6*" align="right"/>
37070 <entry><option>quota_directory</option></entry>
37071 <entry>Use: <emphasis>appendfile</emphasis></entry>
37072 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37073 <entry>Default: <emphasis>unset</emphasis></entry>
37079 This option defines the directory to check for quota purposes when delivering
37080 into individual files. The default is the delivery directory, or, if a file
37081 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
37082 delivery directory.
37085 <indexterm role="option">
37086 <primary>quota_filecount</primary>
37089 <informaltable frame="all">
37090 <tgroup cols="4" colsep="0" rowsep="0">
37091 <colspec colwidth="8*" align="left"/>
37092 <colspec colwidth="5*" align="center"/>
37093 <colspec colwidth="5*" align="center"/>
37094 <colspec colwidth="6*" align="right"/>
37097 <entry><option>quota_filecount</option></entry>
37098 <entry>Use: <emphasis>appendfile</emphasis></entry>
37099 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37100 <entry>Default: <emphasis>0</emphasis></entry>
37106 This option applies when the <option>directory</option> option is set. It limits the total
37107 number of files in the directory (compare the inode limit in system quotas). It
37108 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
37109 failure causes delivery to be deferred. A value of zero is interpreted as
37110 <quote>no quota</quote>.
37113 <indexterm role="option">
37114 <primary>quota_is_inclusive</primary>
37117 <informaltable frame="all">
37118 <tgroup cols="4" colsep="0" rowsep="0">
37119 <colspec colwidth="8*" align="left"/>
37120 <colspec colwidth="5*" align="center"/>
37121 <colspec colwidth="5*" align="center"/>
37122 <colspec colwidth="6*" align="right"/>
37125 <entry><option>quota_is_inclusive</option></entry>
37126 <entry>Use: <emphasis>appendfile</emphasis></entry>
37127 <entry>Type: <emphasis>boolean</emphasis></entry>
37128 <entry>Default: <emphasis>true</emphasis></entry>
37134 See <option>quota</option> above.
37137 <indexterm role="option">
37138 <primary>quota_size_regex</primary>
37141 <informaltable frame="all">
37142 <tgroup cols="4" colsep="0" rowsep="0">
37143 <colspec colwidth="8*" align="left"/>
37144 <colspec colwidth="5*" align="center"/>
37145 <colspec colwidth="5*" align="center"/>
37146 <colspec colwidth="6*" align="right"/>
37149 <entry><option>quota_size_regex</option></entry>
37150 <entry>Use: <emphasis>appendfile</emphasis></entry>
37151 <entry>Type: <emphasis>string</emphasis></entry>
37152 <entry>Default: <emphasis>unset</emphasis></entry>
37158 This option applies when one of the delivery modes that writes a separate file
37159 for each message is being used. When Exim wants to find the size of one of
37160 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
37161 If this is set to a regular expression that matches the file name, and it
37162 captures one string, that string is interpreted as a representation of the
37163 file’s size. The value of <option>quota_size_regex</option> is not expanded.
37166 This feature is useful only when users have no shell access to their mailboxes
37167 – otherwise they could defeat the quota simply by renaming the files. This
37168 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
37169 the file length to the file name. For example:
37171 <literallayout class="monospaced">
37172 maildir_tag = ,S=$message_size
37173 quota_size_regex = ,S=(\d+)
37176 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
37177 number of lines in the message.
37180 The regular expression should not assume that the length is at the end of the
37181 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
37182 sometimes add other information onto the ends of message file names.
37185 <indexterm role="option">
37186 <primary>quota_warn_message</primary>
37189 <informaltable frame="all">
37190 <tgroup cols="4" colsep="0" rowsep="0">
37191 <colspec colwidth="8*" align="left"/>
37192 <colspec colwidth="5*" align="center"/>
37193 <colspec colwidth="5*" align="center"/>
37194 <colspec colwidth="6*" align="right"/>
37197 <entry><option>quota_warn_message</option></entry>
37198 <entry>Use: <emphasis>appendfile</emphasis></entry>
37199 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37200 <entry>Default: <emphasis>see below</emphasis></entry>
37206 See below for the use of this option. If it is not set when
37207 <option>quota_warn_threshold</option> is set, it defaults to
37209 <literallayout class="monospaced">
37210 quota_warn_message = "\
37211 To: $local_part@$domain\n\
37212 Subject: Your mailbox\n\n\
37213 This message is automatically created \
37214 by mail delivery software.\n\n\
37215 The size of your mailbox has exceeded \
37216 a warning threshold that is\n\
37217 set by the system administrator.\n"
37220 <indexterm role="option">
37221 <primary>quota_warn_threshold</primary>
37224 <informaltable frame="all">
37225 <tgroup cols="4" colsep="0" rowsep="0">
37226 <colspec colwidth="8*" align="left"/>
37227 <colspec colwidth="5*" align="center"/>
37228 <colspec colwidth="5*" align="center"/>
37229 <colspec colwidth="6*" align="right"/>
37232 <entry><option>quota_warn_threshold</option></entry>
37233 <entry>Use: <emphasis>appendfile</emphasis></entry>
37234 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37235 <entry>Default: <emphasis>0</emphasis></entry>
37241 <indexterm role="concept">
37242 <primary>quota</primary>
37243 <secondary>warning threshold</secondary>
37245 <indexterm role="concept">
37246 <primary>mailbox</primary>
37247 <secondary>size warning</secondary>
37249 <indexterm role="concept">
37250 <primary>size</primary>
37251 <secondary>of mailbox</secondary>
37253 This option is expanded in the same way as <option>quota</option> (see above). If the
37254 resulting value is greater than zero, and delivery of the message causes the
37255 size of the file or total space in the directory tree to cross the given
37256 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
37257 may be specified as a percentage of it by following the value with a percent
37260 <literallayout class="monospaced">
37262 quota_warn_threshold = 75%
37265 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
37266 percent sign is ignored.
37269 The warning message itself is specified by the <option>quota_warn_message</option> option,
37270 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
37271 warning message. These do not necessarily have to include the recipient(s) of
37272 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
37273 can include any other header lines that you want. If you do not include a
37274 <emphasis>From:</emphasis> line, the default is:
37276 <literallayout class="monospaced">
37277 From: Mail Delivery System <mailer-daemon@$qualify_domain_sender>
37280 <indexterm role="option">
37281 <primary><option>errors_reply_to</option></primary>
37283 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
37287 The <option>quota</option> option does not have to be set in order to use this option; they
37288 are independent of one another except when the threshold is specified as a
37292 <indexterm role="option">
37293 <primary>use_bsmtp</primary>
37296 <informaltable frame="all">
37297 <tgroup cols="4" colsep="0" rowsep="0">
37298 <colspec colwidth="8*" align="left"/>
37299 <colspec colwidth="5*" align="center"/>
37300 <colspec colwidth="5*" align="center"/>
37301 <colspec colwidth="6*" align="right"/>
37304 <entry><option>use_bsmtp</option></entry>
37305 <entry>Use: <emphasis>appendfile</emphasis></entry>
37306 <entry>Type: <emphasis>boolean</emphasis></entry>
37307 <entry>Default: <emphasis>false</emphasis></entry>
37313 <indexterm role="concept">
37314 <primary>envelope sender</primary>
37316 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
37317 format, with the envelope sender and recipient(s) included as SMTP commands. If
37318 you want to include a leading HELO command with such messages, you can do
37319 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
37320 for details of batch SMTP.
37323 <indexterm role="option">
37324 <primary>use_crlf</primary>
37327 <informaltable frame="all">
37328 <tgroup cols="4" colsep="0" rowsep="0">
37329 <colspec colwidth="8*" align="left"/>
37330 <colspec colwidth="5*" align="center"/>
37331 <colspec colwidth="5*" align="center"/>
37332 <colspec colwidth="6*" align="right"/>
37335 <entry><option>use_crlf</option></entry>
37336 <entry>Use: <emphasis>appendfile</emphasis></entry>
37337 <entry>Type: <emphasis>boolean</emphasis></entry>
37338 <entry>Default: <emphasis>false</emphasis></entry>
37344 <indexterm role="concept">
37345 <primary>carriage return</primary>
37347 <indexterm role="concept">
37348 <primary>linefeed</primary>
37350 This option causes lines to be terminated with the two-character CRLF sequence
37351 (carriage return, linefeed) instead of just a linefeed character. In the case
37352 of batched SMTP, the byte sequence written to the file is then an exact image
37353 of what would be sent down a real SMTP connection.
37356 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
37357 written verbatim, so must contain their own carriage return characters if these
37358 are needed. In cases where these options have non-empty defaults, the values
37359 end with a single linefeed, so they must be changed to end with <literal>\r\n</literal> if
37360 <option>use_crlf</option> is set.
37363 <indexterm role="option">
37364 <primary>use_fcntl_lock</primary>
37367 <informaltable frame="all">
37368 <tgroup cols="4" colsep="0" rowsep="0">
37369 <colspec colwidth="8*" align="left"/>
37370 <colspec colwidth="5*" align="center"/>
37371 <colspec colwidth="5*" align="center"/>
37372 <colspec colwidth="6*" align="right"/>
37375 <entry><option>use_fcntl_lock</option></entry>
37376 <entry>Use: <emphasis>appendfile</emphasis></entry>
37377 <entry>Type: <emphasis>boolean</emphasis></entry>
37378 <entry>Default: <emphasis>see below</emphasis></entry>
37384 This option controls the use of the <function>fcntl()</function> function to lock a file for
37385 exclusive use when a message is being appended. It is set by default unless
37386 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
37387 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
37388 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
37391 <indexterm role="option">
37392 <primary>use_flock_lock</primary>
37395 <informaltable frame="all">
37396 <tgroup cols="4" colsep="0" rowsep="0">
37397 <colspec colwidth="8*" align="left"/>
37398 <colspec colwidth="5*" align="center"/>
37399 <colspec colwidth="5*" align="center"/>
37400 <colspec colwidth="6*" align="right"/>
37403 <entry><option>use_flock_lock</option></entry>
37404 <entry>Use: <emphasis>appendfile</emphasis></entry>
37405 <entry>Type: <emphasis>boolean</emphasis></entry>
37406 <entry>Default: <emphasis>false</emphasis></entry>
37412 This option is provided to support the use of <function>flock()</function> for file locking, for
37413 the few situations where it is needed. Most modern operating systems support
37414 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
37415 each other. Exim uses <function>fcntl()</function> locking by default.
37418 This option is required only if you are using an operating system where
37419 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
37420 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
37421 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
37424 <indexterm role="concept">
37425 <primary>Solaris</primary>
37426 <secondary><function>flock()</function> support</secondary>
37428 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
37429 have it (and some, I think, provide a not quite right version built on top of
37430 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
37431 the ability to use it, and any attempt to do so will cause a configuration
37435 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
37436 is just being mapped onto <function>fcntl()</function> by the OS).
37439 <indexterm role="option">
37440 <primary>use_lockfile</primary>
37443 <informaltable frame="all">
37444 <tgroup cols="4" colsep="0" rowsep="0">
37445 <colspec colwidth="8*" align="left"/>
37446 <colspec colwidth="5*" align="center"/>
37447 <colspec colwidth="5*" align="center"/>
37448 <colspec colwidth="6*" align="right"/>
37451 <entry><option>use_lockfile</option></entry>
37452 <entry>Use: <emphasis>appendfile</emphasis></entry>
37453 <entry>Type: <emphasis>boolean</emphasis></entry>
37454 <entry>Default: <emphasis>see below</emphasis></entry>
37460 If this option is turned off, Exim does not attempt to create a lock file when
37461 appending to a mailbox file. In this situation, the only locking is by
37462 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
37463 sure that every MUA that is ever going to look at your users’ mailboxes uses
37464 <function>fcntl()</function> rather than a lock file, and even then only when you are not
37465 delivering over NFS from more than one host.
37468 <indexterm role="concept">
37469 <primary>NFS</primary>
37470 <secondary>lock file</secondary>
37472 In order to append to an NFS file safely from more than one host, it is
37473 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
37474 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
37478 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
37479 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
37480 except when <option>mbx_format</option> is set.
37483 <indexterm role="option">
37484 <primary>use_mbx_lock</primary>
37487 <informaltable frame="all">
37488 <tgroup cols="4" colsep="0" rowsep="0">
37489 <colspec colwidth="8*" align="left"/>
37490 <colspec colwidth="5*" align="center"/>
37491 <colspec colwidth="5*" align="center"/>
37492 <colspec colwidth="6*" align="right"/>
37495 <entry><option>use_mbx_lock</option></entry>
37496 <entry>Use: <emphasis>appendfile</emphasis></entry>
37497 <entry>Type: <emphasis>boolean</emphasis></entry>
37498 <entry>Default: <emphasis>see below</emphasis></entry>
37504 This option is available only if Exim has been compiled with SUPPORT_MBX
37505 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
37506 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
37507 of the locking options are mentioned in the configuration. The locking rules
37508 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
37509 the IMAP4 and POP daemons that come with it (see the discussion below). The
37510 rules allow for shared access to the mailbox. However, this kind of locking
37511 does not work when the mailbox is NFS mounted.
37514 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
37515 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
37516 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
37517 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
37520 <section id="SECTopappend">
37521 <title>Operational details for appending</title>
37523 <indexterm role="concept">
37524 <primary>appending to a file</primary>
37526 <indexterm role="concept">
37527 <primary>file</primary>
37528 <secondary>appending</secondary>
37530 Before appending to a file, the following preparations are made:
37535 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
37541 <indexterm role="concept">
37542 <primary>directory creation</primary>
37544 If any directories on the file’s path are missing, Exim creates them if the
37545 <option>create_directory</option> option is set. A created directory’s mode is given by the
37546 <option>directory_mode</option> option.
37551 If <option>file_format</option> is set, the format of an existing file is checked. If this
37552 indicates that a different transport should be used, control is passed to that
37558 <indexterm role="concept">
37559 <primary>file</primary>
37560 <secondary>locking</secondary>
37562 <indexterm role="concept">
37563 <primary>locking files</primary>
37565 <indexterm role="concept">
37566 <primary>NFS</primary>
37567 <secondary>lock file</secondary>
37569 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
37570 reliably over NFS, as follows:
37572 <orderedlist numeration="arabic">
37575 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
37576 current time, primary host name, and process id added, by opening for writing
37577 as a new file. If this fails with an access error, delivery is deferred.
37582 Close the hitching post file, and hard link it to the lock file name.
37587 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
37588 Unlink the hitching post name.
37593 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
37594 then unlink hitching post name. If the number of links is exactly two, creation
37595 of the lock file succeeded but something (for example, an NFS server crash and
37596 restart) caused this fact not to be communicated to the <function>link()</function> call.
37601 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
37602 up to <option>lock_retries</option> times. However, since any program that writes to a
37603 mailbox should complete its task very quickly, it is reasonable to time out old
37604 lock files that are normally the result of user agent and system crashes. If an
37605 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
37606 it before trying again.
37613 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
37614 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
37615 than non-existence, delivery is deferred.
37620 <indexterm role="concept">
37621 <primary>symbolic link</primary>
37622 <secondary>to mailbox</secondary>
37624 <indexterm role="concept">
37625 <primary>mailbox</primary>
37626 <secondary>symbolic link</secondary>
37628 If the file does exist and is a symbolic link, delivery is deferred, unless the
37629 <option>allow_symlink</option> option is set, in which case the ownership of the link is
37630 checked, and then <function>stat()</function> is called to find out about the real file, which
37631 is then subjected to the checks below. The check on the top-level link
37632 ownership prevents one user creating a link for another’s mailbox in a sticky
37633 directory, though allowing symbolic links in this case is definitely not a good
37634 idea. If there is a chain of symbolic links, the intermediate ones are not
37640 If the file already exists but is not a regular file, or if the file’s owner
37641 and group (if the group is being checked – see <option>check_group</option> above) are
37642 different from the user and group under which the delivery is running,
37643 delivery is deferred.
37648 If the file’s permissions are more generous than specified, they are reduced.
37649 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
37650 is set false, in which case the delivery is tried using the existing
37656 The file’s inode number is saved, and the file is then opened for appending.
37657 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
37658 hadn’t existed (see below). For any other failures, delivery is deferred.
37663 If the file is opened successfully, check that the inode number hasn’t
37664 changed, that it is still a regular file, and that the owner and permissions
37665 have not changed. If anything is wrong, defer delivery and freeze the message.
37670 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
37671 option is set. Otherwise, check that the file is being created in a permitted
37672 directory if the <option>create_file</option> option is set (deferring on failure), and then
37673 open for writing as a new file, with the O_EXCL and O_CREAT options,
37674 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
37675 set). In this case, which can happen if the link points to a non-existent file,
37676 the file is opened for writing using O_CREAT but not O_EXCL, because
37677 that prevents link following.
37682 <indexterm role="concept">
37683 <primary>loop</primary>
37684 <secondary>while file testing</secondary>
37686 If opening fails because the file exists, obey the tests given above for
37687 existing files. However, to avoid looping in a situation where the file is
37688 being continuously created and destroyed, the exists/not-exists loop is broken
37689 after 10 repetitions, and the message is then frozen.
37694 If opening fails with any other error, defer delivery.
37699 <indexterm role="concept">
37700 <primary>file</primary>
37701 <secondary>locking</secondary>
37703 <indexterm role="concept">
37704 <primary>locking files</primary>
37706 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
37707 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
37708 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
37709 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
37710 file, and an exclusive lock on the file whose name is
37712 <literallayout class="monospaced">
37713 /tmp/.<device-number>.<inode-number>
37716 using the device and inode numbers of the open mailbox file, in accordance with
37717 the MBX locking rules. This file is created with a mode that is specified by
37718 the <option>lockfile_mode</option> option.
37721 If Exim fails to lock the file, there are two possible courses of action,
37722 depending on the value of the locking timeout. This is obtained from
37723 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
37726 If the timeout value is zero, the file is closed, Exim waits for
37727 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
37728 to lock it again. This happens up to <option>lock_retries</option> times, after which the
37729 delivery is deferred.
37732 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
37733 <function>flock()</function> are used (with the given timeout), so there has already been some
37734 waiting involved by the time locking fails. Nevertheless, Exim does not give up
37735 immediately. It retries up to
37737 <literallayout class="monospaced">
37738 (lock_retries * lock_interval) / <timeout>
37741 times (rounded up).
37746 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
37747 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
37750 <section id="SECTopdir">
37751 <title>Operational details for delivery to a new file</title>
37753 <indexterm role="concept">
37754 <primary>delivery</primary>
37755 <secondary>to single file</secondary>
37757 <indexterm role="concept">
37758 <primary><quote>From</quote> line</primary>
37760 When the <option>directory</option> option is set instead of <option>file</option>, each message is
37761 delivered into a newly-created file or set of files. When <command>appendfile</command> is
37762 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
37763 <option>directory</option> is normally set, because the path for delivery is supplied by the
37764 router. (See for example, the <command>address_file</command> transport in the default
37765 configuration.) In this case, delivery is to a new file if either the path name
37766 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
37769 No locking is required while writing the message to a new file, so the various
37770 locking options of the transport are ignored. The <quote>From</quote> line that by default
37771 separates messages in a single file is not normally needed, nor is the escaping
37772 of message lines that start with <quote>From</quote>, and there is no need to ensure a
37773 newline at the end of each message. Consequently, the default values for
37774 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
37775 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
37778 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
37779 the files in the delivery directory by default. However, you can specify a
37780 different directory by setting <option>quota_directory</option>. Also, for maildir
37781 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
37784 <indexterm role="concept">
37785 <primary>maildir format</primary>
37787 <indexterm role="concept">
37788 <primary>mailstore format</primary>
37790 There are three different ways in which delivery to individual files can be
37791 done, controlled by the settings of the <option>maildir_format</option> and
37792 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
37793 formats is not included in the binary unless SUPPORT_MAILDIR or
37794 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
37797 <indexterm role="concept">
37798 <primary>directory creation</primary>
37800 In all three cases an attempt is made to create the directory and any necessary
37801 sub-directories if they do not exist, provided that the <option>create_directory</option>
37802 option is set (the default). The location of a created directory can be
37803 constrained by setting <option>create_file</option>. A created directory’s mode is given by
37804 the <option>directory_mode</option> option. If creation fails, or if the
37805 <option>create_directory</option> option is not set when creation is required, delivery is
37809 <section id="SECTmaildirdelivery">
37810 <title>Maildir delivery</title>
37812 <indexterm role="concept">
37813 <primary>maildir format</primary>
37814 <secondary>description of</secondary>
37816 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
37817 it to a file whose name is <filename>tmp/<stime>.H<mtime>P<pid>.<host></filename> in the
37818 directory that is defined by the <option>directory</option> option (the <quote>delivery
37819 directory</quote>). If the delivery is successful, the file is renamed into the
37820 <filename>new</filename> subdirectory.
37823 In the file name, <<emphasis>stime</emphasis>> is the current time of day in seconds, and
37824 <<emphasis>mtime</emphasis>> is the microsecond fraction of the time. After a maildir delivery,
37825 Exim checks that the time-of-day clock has moved on by at least one microsecond
37826 before terminating the delivery process. This guarantees uniqueness for the
37827 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
37828 opening it. If any response other than ENOENT (does not exist) is given,
37829 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
37832 Before Exim carries out a maildir delivery, it ensures that subdirectories
37833 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
37834 do not exist, Exim tries to create them and any superior directories in their
37835 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
37836 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
37837 contains matches the delivery directory, Exim also ensures that a file called
37838 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
37839 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
37842 These features make it possible to use Exim to create all the necessary files
37843 and directories in a maildir mailbox, including subdirectories for maildir++
37844 folders. Consider this example:
37846 <literallayout class="monospaced">
37847 maildir_format = true
37848 directory = /var/mail/$local_part\
37849 ${if eq{$local_part_suffix}{}{}\
37850 {/.${substr_1:$local_part_suffix}}}
37851 maildirfolder_create_regex = /\.[^/]+$
37854 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
37855 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
37856 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
37857 not match this name, so Exim will not look for or create the file
37858 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
37859 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
37862 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
37863 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
37864 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
37865 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
37866 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
37869 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
37870 not inadvertently match the toplevel maildir directory, because a
37871 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
37874 <indexterm role="concept">
37875 <primary>quota</primary>
37876 <secondary>in maildir delivery</secondary>
37878 <indexterm role="concept">
37879 <primary>maildir++</primary>
37881 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
37882 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
37883 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
37884 Exim assumes the directory is a maildir++ folder directory, which is one level
37885 down from the user’s top level mailbox directory. This causes it to start at
37886 the parent directory instead of the current directory when calculating the
37887 amount of space used.
37890 One problem with delivering into a multi-file mailbox is that it is
37891 computationally expensive to compute the size of the mailbox for quota
37892 checking. Various approaches have been taken to reduce the amount of work
37893 needed. The next two sections describe two of them. A third alternative is to
37894 use some external process for maintaining the size data, and use the expansion
37895 of the <option>mailbox_size</option> option as a way of importing it into Exim.
37899 <title>Using tags to record message sizes</title>
37901 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
37902 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
37903 tag is added to its name. However, if adding the tag takes the length of the
37904 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
37905 the tag is dropped and the maildir file is created with no tag.
37908 <indexterm role="concept">
37909 <primary><varname>$message_size</varname></primary>
37911 Tags can be used to encode the size of files in their names; see
37912 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
37913 happens after the message has been written. The value of the <varname>$message_size</varname>
37914 variable is set to the number of bytes actually written. If the expansion is
37915 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
37916 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
37917 Non-printing characters in the string are ignored; if the resulting string is
37918 empty, it is ignored. If it starts with an alphanumeric character, a leading
37923 <title>Using a maildirsize file</title>
37925 <indexterm role="concept">
37926 <primary>quota</primary>
37927 <secondary>in maildir delivery</secondary>
37929 <indexterm role="concept">
37930 <primary>maildir format</primary>
37931 <secondary><filename>maildirsize</filename> file</secondary>
37933 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
37934 storing quota and message size information in a file called <filename>maildirsize</filename>
37935 within the toplevel maildir directory. If this file does not exist, Exim
37936 creates it, setting the quota from the <option>quota</option> option of the transport. If
37937 the maildir directory itself does not exist, it is created before any attempt
37938 to write a <filename>maildirsize</filename> file.
37941 The <filename>maildirsize</filename> file is used to hold information about the sizes of
37942 messages in the maildir, thus speeding up quota calculations. The quota value
37943 in the file is just a cache; if the quota is changed in the transport, the new
37944 value overrides the cached value when the next message is delivered. The cache
37945 is maintained for the benefit of other programs that access the maildir and
37946 need to know the quota.
37949 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
37950 file is maintained (with a zero quota setting), but no quota is imposed.
37953 A regular expression is available for controlling which directories in the
37954 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
37955 See the description of the <option>maildir_quota_directory_regex</option> option above for
37960 <title>Mailstore delivery</title>
37962 <indexterm role="concept">
37963 <primary>mailstore format</primary>
37964 <secondary>description of</secondary>
37966 If the <option>mailstore_format</option> option is true, each message is written as two
37967 files in the given directory. A unique base name is constructed from the
37968 message id and the current delivery process, and the files that are written use
37969 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
37970 contains the message’s envelope, and the <filename>.msg</filename> file contains the message
37971 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
37974 During delivery, the envelope is first written to a file with the suffix
37975 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
37976 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
37977 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
37978 file before accessing either of them. An alternative approach is to wait for
37979 the absence of a <filename>.tmp</filename> file.
37982 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
37983 option, expanded and terminated by a newline if there isn’t one. Then follows
37984 the sender address on one line, then all the recipient addresses, one per line.
37985 There can be more than one recipient only if the <option>batch_max</option> option is set
37986 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
37987 appended to the file, followed by a newline if it does not end with one.
37990 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
37991 failure, it is ignored. Other expansion errors are treated as serious
37992 configuration errors, and delivery is deferred. The variable
37993 <varname>$mailstore_basename</varname> is available for use during these expansions.
37997 <title>Non-special new file delivery</title>
37999 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
38000 file is created directly in the named directory. For example, when delivering
38001 messages into files in batched SMTP format for later delivery to some host (see
38002 section <xref linkend="SECTbatchSMTP"/>), a setting such as
38004 <literallayout class="monospaced">
38005 directory = /var/bsmtp/$host
38008 might be used. A message is written to a file with a temporary name, which is
38009 then renamed when the delivery is complete. The final name is obtained by
38010 expanding the contents of the <option>directory_file</option> option.
38011 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
38012 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
38018 <title>The autoreply transport</title>
38020 <indexterm role="concept" id="IIDauttra1" class="startofrange">
38021 <primary>transports</primary>
38022 <secondary><command>autoreply</command></secondary>
38024 <indexterm role="concept" id="IIDauttra2" class="startofrange">
38025 <primary><command>autoreply</command> transport</primary>
38027 The <command>autoreply</command> transport is not a true transport in that it does not cause
38028 the message to be transmitted. Instead, it generates a new mail message as an
38029 automatic reply to the incoming message. <emphasis>References:</emphasis> and
38030 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
38031 to the rules in RFCs 2822 and 3834, respectively.
38034 If the router that passes the message to this transport does not have the
38035 <option>unseen</option> option set, the original message (for the current recipient) is not
38036 delivered anywhere. However, when the <option>unseen</option> option is set on the router
38037 that passes the message to this transport, routing of the address continues, so
38038 another router can set up a normal message delivery.
38041 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
38042 <quote>vacation</quote> message being the standard example. However, it can also be run
38043 directly from a router like any other transport. To reduce the possibility of
38044 message cascades, messages created by the <command>autoreply</command> transport always have
38045 empty envelope sender addresses, like bounce messages.
38048 The parameters of the message to be sent can be specified in the configuration
38049 by options described below. However, these are used only when the address
38050 passed to the transport does not contain its own reply information. When the
38051 transport is run as a consequence of a
38052 <option>mail</option>
38053 or <option>vacation</option> command in a filter file, the parameters of the message are
38054 supplied by the filter, and passed with the address. The transport’s options
38055 that define the message are then ignored (so they are not usually set in this
38056 case). The message is specified entirely by the filter or by the transport; it
38057 is never built from a mixture of options. However, the <option>file_optional</option>,
38058 <option>mode</option>, and <option>return_message</option> options apply in all cases.
38061 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
38062 command in a user’s filter file, <command>autoreply</command> normally runs under the uid and
38063 gid of the user, and with appropriate current and home directories (see chapter
38064 <xref linkend="CHAPenvironment"/>).
38067 There is a subtle difference between routing a message to a <command>pipe</command> transport
38068 that generates some text to be returned to the sender, and routing it to an
38069 <command>autoreply</command> transport. This difference is noticeable only if more than one
38070 address from the same message is so handled. In the case of a pipe, the
38071 separate outputs from the different addresses are gathered up and returned to
38072 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
38073 message is generated for each address that is passed to it.
38076 Non-printing characters are not permitted in the header lines generated for the
38077 message that <command>autoreply</command> creates, with the exception of newlines that are
38078 immediately followed by white space. If any non-printing characters are found,
38079 the transport defers.
38080 Whether characters with the top bit set count as printing characters or not is
38081 controlled by the <option>print_topbitchars</option> global option.
38084 If any of the generic options for manipulating headers (for example,
38085 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
38086 of the original message that is included in the generated message when
38087 <option>return_message</option> is set. They do not apply to the generated message itself.
38090 <indexterm role="concept">
38091 <primary><varname>$sender_address</varname></primary>
38093 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
38094 the message, indicating that there were no recipients, it does not treat this
38095 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
38096 is empty (because the incoming message is a bounce message) do not cause
38097 problems. They are just discarded.
38100 <title>Private options for autoreply</title>
38102 <indexterm role="concept">
38103 <primary>options</primary>
38104 <secondary><command>autoreply</command> transport</secondary>
38108 <indexterm role="option">
38109 <primary>bcc</primary>
38112 <informaltable frame="all">
38113 <tgroup cols="4" colsep="0" rowsep="0">
38114 <colspec colwidth="8*" align="left"/>
38115 <colspec colwidth="5*" align="center"/>
38116 <colspec colwidth="5*" align="center"/>
38117 <colspec colwidth="6*" align="right"/>
38120 <entry><option>bcc</option></entry>
38121 <entry>Use: <emphasis>autoreply</emphasis></entry>
38122 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38123 <entry>Default: <emphasis>unset</emphasis></entry>
38129 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
38130 message when the message is specified by the transport.
38133 <indexterm role="option">
38134 <primary>cc</primary>
38137 <informaltable frame="all">
38138 <tgroup cols="4" colsep="0" rowsep="0">
38139 <colspec colwidth="8*" align="left"/>
38140 <colspec colwidth="5*" align="center"/>
38141 <colspec colwidth="5*" align="center"/>
38142 <colspec colwidth="6*" align="right"/>
38145 <entry><option>cc</option></entry>
38146 <entry>Use: <emphasis>autoreply</emphasis></entry>
38147 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38148 <entry>Default: <emphasis>unset</emphasis></entry>
38154 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
38155 when the message is specified by the transport.
38158 <indexterm role="option">
38159 <primary>file</primary>
38162 <informaltable frame="all">
38163 <tgroup cols="4" colsep="0" rowsep="0">
38164 <colspec colwidth="8*" align="left"/>
38165 <colspec colwidth="5*" align="center"/>
38166 <colspec colwidth="5*" align="center"/>
38167 <colspec colwidth="6*" align="right"/>
38170 <entry><option>file</option></entry>
38171 <entry>Use: <emphasis>autoreply</emphasis></entry>
38172 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38173 <entry>Default: <emphasis>unset</emphasis></entry>
38179 The contents of the file are sent as the body of the message when the message
38180 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
38181 string comes first.
38184 <indexterm role="option">
38185 <primary>file_expand</primary>
38188 <informaltable frame="all">
38189 <tgroup cols="4" colsep="0" rowsep="0">
38190 <colspec colwidth="8*" align="left"/>
38191 <colspec colwidth="5*" align="center"/>
38192 <colspec colwidth="5*" align="center"/>
38193 <colspec colwidth="6*" align="right"/>
38196 <entry><option>file_expand</option></entry>
38197 <entry>Use: <emphasis>autoreply</emphasis></entry>
38198 <entry>Type: <emphasis>boolean</emphasis></entry>
38199 <entry>Default: <emphasis>false</emphasis></entry>
38205 If this is set, the contents of the file named by the <option>file</option> option are
38206 subjected to string expansion as they are added to the message.
38209 <indexterm role="option">
38210 <primary>file_optional</primary>
38213 <informaltable frame="all">
38214 <tgroup cols="4" colsep="0" rowsep="0">
38215 <colspec colwidth="8*" align="left"/>
38216 <colspec colwidth="5*" align="center"/>
38217 <colspec colwidth="5*" align="center"/>
38218 <colspec colwidth="6*" align="right"/>
38221 <entry><option>file_optional</option></entry>
38222 <entry>Use: <emphasis>autoreply</emphasis></entry>
38223 <entry>Type: <emphasis>boolean</emphasis></entry>
38224 <entry>Default: <emphasis>false</emphasis></entry>
38230 If this option is true, no error is generated if the file named by the <option>file</option>
38231 option or passed with the address does not exist or cannot be read.
38234 <indexterm role="option">
38235 <primary>from</primary>
38238 <informaltable frame="all">
38239 <tgroup cols="4" colsep="0" rowsep="0">
38240 <colspec colwidth="8*" align="left"/>
38241 <colspec colwidth="5*" align="center"/>
38242 <colspec colwidth="5*" align="center"/>
38243 <colspec colwidth="6*" align="right"/>
38246 <entry><option>from</option></entry>
38247 <entry>Use: <emphasis>autoreply</emphasis></entry>
38248 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38249 <entry>Default: <emphasis>unset</emphasis></entry>
38255 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
38256 specified by the transport.
38259 <indexterm role="option">
38260 <primary>headers</primary>
38263 <informaltable frame="all">
38264 <tgroup cols="4" colsep="0" rowsep="0">
38265 <colspec colwidth="8*" align="left"/>
38266 <colspec colwidth="5*" align="center"/>
38267 <colspec colwidth="5*" align="center"/>
38268 <colspec colwidth="6*" align="right"/>
38271 <entry><option>headers</option></entry>
38272 <entry>Use: <emphasis>autoreply</emphasis></entry>
38273 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38274 <entry>Default: <emphasis>unset</emphasis></entry>
38280 This specifies additional RFC 2822 headers that are to be added to the message
38281 when the message is specified by the transport. Several can be given by using
38282 <quote>\n</quote> to separate them. There is no check on the format.
38285 <indexterm role="option">
38286 <primary>log</primary>
38289 <informaltable frame="all">
38290 <tgroup cols="4" colsep="0" rowsep="0">
38291 <colspec colwidth="8*" align="left"/>
38292 <colspec colwidth="5*" align="center"/>
38293 <colspec colwidth="5*" align="center"/>
38294 <colspec colwidth="6*" align="right"/>
38297 <entry><option>log</option></entry>
38298 <entry>Use: <emphasis>autoreply</emphasis></entry>
38299 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38300 <entry>Default: <emphasis>unset</emphasis></entry>
38306 This option names a file in which a record of every message sent is logged when
38307 the message is specified by the transport.
38310 <indexterm role="option">
38311 <primary>mode</primary>
38314 <informaltable frame="all">
38315 <tgroup cols="4" colsep="0" rowsep="0">
38316 <colspec colwidth="8*" align="left"/>
38317 <colspec colwidth="5*" align="center"/>
38318 <colspec colwidth="5*" align="center"/>
38319 <colspec colwidth="6*" align="right"/>
38322 <entry><option>mode</option></entry>
38323 <entry>Use: <emphasis>autoreply</emphasis></entry>
38324 <entry>Type: <emphasis>octal integer</emphasis></entry>
38325 <entry>Default: <emphasis>0600</emphasis></entry>
38331 If either the log file or the <quote>once</quote> file has to be created, this mode is
38335 <indexterm role="option">
38336 <primary>never_mail</primary>
38339 <informaltable frame="all">
38340 <tgroup cols="4" colsep="0" rowsep="0">
38341 <colspec colwidth="8*" align="left"/>
38342 <colspec colwidth="5*" align="center"/>
38343 <colspec colwidth="5*" align="center"/>
38344 <colspec colwidth="6*" align="right"/>
38347 <entry><option>never_mail</option></entry>
38348 <entry>Use: <emphasis>autoreply</emphasis></entry>
38349 <entry>Type: <emphasis>address list</emphasis>†<emphasis></emphasis></entry>
38350 <entry>Default: <emphasis>unset</emphasis></entry>
38356 If any run of the transport creates a message with a recipient that matches any
38357 item in the list, that recipient is quietly discarded. If all recipients are
38358 discarded, no message is created. This applies both when the recipients are
38359 generated by a filter and when they are specified in the transport.
38362 <indexterm role="option">
38363 <primary>once</primary>
38366 <informaltable frame="all">
38367 <tgroup cols="4" colsep="0" rowsep="0">
38368 <colspec colwidth="8*" align="left"/>
38369 <colspec colwidth="5*" align="center"/>
38370 <colspec colwidth="5*" align="center"/>
38371 <colspec colwidth="6*" align="right"/>
38374 <entry><option>once</option></entry>
38375 <entry>Use: <emphasis>autoreply</emphasis></entry>
38376 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38377 <entry>Default: <emphasis>unset</emphasis></entry>
38383 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
38384 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
38385 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
38388 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
38389 By default, if <option>once</option> is set to a non-empty file name, the message
38390 is not sent if a potential recipient is already listed in the database.
38391 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
38392 message is sent if that much time has elapsed since a message was last sent to
38393 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
38394 prevents a message from being sent a second time – in this case, zero means
38398 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
38399 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
38400 greater than zero, it changes the way Exim implements the <option>once</option> option.
38401 Instead of using a DBM file to record every recipient it sends to, it uses a
38402 regular file, whose size will never get larger than the given value.
38405 In the file, Exim keeps a linear list of recipient addresses and the times at
38406 which they were sent messages. If the file is full when a new address needs to
38407 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
38408 means that a given recipient may receive multiple messages, but at
38409 unpredictable intervals that depend on the rate of turnover of addresses in the
38410 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
38413 <indexterm role="option">
38414 <primary>once_file_size</primary>
38417 <informaltable frame="all">
38418 <tgroup cols="4" colsep="0" rowsep="0">
38419 <colspec colwidth="8*" align="left"/>
38420 <colspec colwidth="5*" align="center"/>
38421 <colspec colwidth="5*" align="center"/>
38422 <colspec colwidth="6*" align="right"/>
38425 <entry><option>once_file_size</option></entry>
38426 <entry>Use: <emphasis>autoreply</emphasis></entry>
38427 <entry>Type: <emphasis>integer</emphasis></entry>
38428 <entry>Default: <emphasis>0</emphasis></entry>
38434 See <option>once</option> above.
38437 <indexterm role="option">
38438 <primary>once_repeat</primary>
38441 <informaltable frame="all">
38442 <tgroup cols="4" colsep="0" rowsep="0">
38443 <colspec colwidth="8*" align="left"/>
38444 <colspec colwidth="5*" align="center"/>
38445 <colspec colwidth="5*" align="center"/>
38446 <colspec colwidth="6*" align="right"/>
38449 <entry><option>once_repeat</option></entry>
38450 <entry>Use: <emphasis>autoreply</emphasis></entry>
38451 <entry>Type: <emphasis>time</emphasis>†<emphasis></emphasis></entry>
38452 <entry>Default: <emphasis>0s</emphasis></entry>
38458 See <option>once</option> above.
38459 After expansion, the value of this option must be a valid time value.
38462 <indexterm role="option">
38463 <primary>reply_to</primary>
38466 <informaltable frame="all">
38467 <tgroup cols="4" colsep="0" rowsep="0">
38468 <colspec colwidth="8*" align="left"/>
38469 <colspec colwidth="5*" align="center"/>
38470 <colspec colwidth="5*" align="center"/>
38471 <colspec colwidth="6*" align="right"/>
38474 <entry><option>reply_to</option></entry>
38475 <entry>Use: <emphasis>autoreply</emphasis></entry>
38476 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38477 <entry>Default: <emphasis>unset</emphasis></entry>
38483 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
38484 specified by the transport.
38487 <indexterm role="option">
38488 <primary>return_message</primary>
38491 <informaltable frame="all">
38492 <tgroup cols="4" colsep="0" rowsep="0">
38493 <colspec colwidth="8*" align="left"/>
38494 <colspec colwidth="5*" align="center"/>
38495 <colspec colwidth="5*" align="center"/>
38496 <colspec colwidth="6*" align="right"/>
38499 <entry><option>return_message</option></entry>
38500 <entry>Use: <emphasis>autoreply</emphasis></entry>
38501 <entry>Type: <emphasis>boolean</emphasis></entry>
38502 <entry>Default: <emphasis>false</emphasis></entry>
38508 If this is set, a copy of the original message is returned with the new
38509 message, subject to the maximum size set in the <option>return_size_limit</option> global
38510 configuration option.
38513 <indexterm role="option">
38514 <primary>subject</primary>
38517 <informaltable frame="all">
38518 <tgroup cols="4" colsep="0" rowsep="0">
38519 <colspec colwidth="8*" align="left"/>
38520 <colspec colwidth="5*" align="center"/>
38521 <colspec colwidth="5*" align="center"/>
38522 <colspec colwidth="6*" align="right"/>
38525 <entry><option>subject</option></entry>
38526 <entry>Use: <emphasis>autoreply</emphasis></entry>
38527 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38528 <entry>Default: <emphasis>unset</emphasis></entry>
38534 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
38535 specified by the transport. It is tempting to quote the original subject in
38536 automatic responses. For example:
38538 <literallayout class="monospaced">
38539 subject = Re: $h_subject:
38542 There is a danger in doing this, however. It may allow a third party to
38543 subscribe your users to an opt-in mailing list, provided that the list accepts
38544 bounce messages as subscription confirmations. Well-managed lists require a
38545 non-bounce message to confirm a subscription, so the danger is relatively
38549 <indexterm role="option">
38550 <primary>text</primary>
38553 <informaltable frame="all">
38554 <tgroup cols="4" colsep="0" rowsep="0">
38555 <colspec colwidth="8*" align="left"/>
38556 <colspec colwidth="5*" align="center"/>
38557 <colspec colwidth="5*" align="center"/>
38558 <colspec colwidth="6*" align="right"/>
38561 <entry><option>text</option></entry>
38562 <entry>Use: <emphasis>autoreply</emphasis></entry>
38563 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38564 <entry>Default: <emphasis>unset</emphasis></entry>
38570 This specifies a single string to be used as the body of the message when the
38571 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
38572 the text comes first.
38575 <indexterm role="option">
38576 <primary>to</primary>
38579 <informaltable frame="all">
38580 <tgroup cols="4" colsep="0" rowsep="0">
38581 <colspec colwidth="8*" align="left"/>
38582 <colspec colwidth="5*" align="center"/>
38583 <colspec colwidth="5*" align="center"/>
38584 <colspec colwidth="6*" align="right"/>
38587 <entry><option>to</option></entry>
38588 <entry>Use: <emphasis>autoreply</emphasis></entry>
38589 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38590 <entry>Default: <emphasis>unset</emphasis></entry>
38596 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
38597 when the message is specified by the transport.
38598 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
38599 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
38604 <chapter id="CHAPLMTP">
38605 <title>The lmtp transport</title>
38607 <indexterm role="concept">
38608 <primary>transports</primary>
38609 <secondary><command>lmtp</command></secondary>
38611 <indexterm role="concept">
38612 <primary><command>lmtp</command> transport</primary>
38614 <indexterm role="concept">
38615 <primary>LMTP</primary>
38616 <secondary>over a pipe</secondary>
38618 <indexterm role="concept">
38619 <primary>LMTP</primary>
38620 <secondary>over a socket</secondary>
38622 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
38624 or by interacting with a Unix domain socket.
38625 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
38626 transports. Exim also has support for using LMTP over TCP/IP; this is
38627 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
38628 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
38629 has it commented out. You need to ensure that
38631 <literallayout class="monospaced">
38635 <indexterm role="concept">
38636 <primary>options</primary>
38637 <secondary><command>lmtp</command> transport</secondary>
38639 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
38640 included in the Exim binary. The private options of the <command>lmtp</command> transport are
38644 <indexterm role="option">
38645 <primary>batch_id</primary>
38648 <informaltable frame="all">
38649 <tgroup cols="4" colsep="0" rowsep="0">
38650 <colspec colwidth="8*" align="left"/>
38651 <colspec colwidth="5*" align="center"/>
38652 <colspec colwidth="5*" align="center"/>
38653 <colspec colwidth="6*" align="right"/>
38656 <entry><option>batch_id</option></entry>
38657 <entry>Use: <emphasis>lmtp</emphasis></entry>
38658 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38659 <entry>Default: <emphasis>unset</emphasis></entry>
38665 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
38668 <indexterm role="option">
38669 <primary>batch_max</primary>
38672 <informaltable frame="all">
38673 <tgroup cols="4" colsep="0" rowsep="0">
38674 <colspec colwidth="8*" align="left"/>
38675 <colspec colwidth="5*" align="center"/>
38676 <colspec colwidth="5*" align="center"/>
38677 <colspec colwidth="6*" align="right"/>
38680 <entry><option>batch_max</option></entry>
38681 <entry>Use: <emphasis>lmtp</emphasis></entry>
38682 <entry>Type: <emphasis>integer</emphasis></entry>
38683 <entry>Default: <emphasis>1</emphasis></entry>
38689 This limits the number of addresses that can be handled in a single delivery.
38690 Most LMTP servers can handle several addresses at once, so it is normally a
38691 good idea to increase this value. See the description of local delivery
38692 batching in chapter <xref linkend="CHAPbatching"/>.
38695 <indexterm role="option">
38696 <primary>command</primary>
38699 <informaltable frame="all">
38700 <tgroup cols="4" colsep="0" rowsep="0">
38701 <colspec colwidth="8*" align="left"/>
38702 <colspec colwidth="5*" align="center"/>
38703 <colspec colwidth="5*" align="center"/>
38704 <colspec colwidth="6*" align="right"/>
38707 <entry><option>command</option></entry>
38708 <entry>Use: <emphasis>lmtp</emphasis></entry>
38709 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38710 <entry>Default: <emphasis>unset</emphasis></entry>
38716 This option must be set if <option>socket</option> is not set. The string is a command which
38717 is run in a separate process. It is split up into a command name and list of
38718 arguments, each of which is separately expanded (so expansion cannot change the
38719 number of arguments). The command is run directly, not via a shell. The message
38720 is passed to the new process using the standard input and output to operate the
38724 <indexterm role="option">
38725 <primary>ignore_quota</primary>
38728 <informaltable frame="all">
38729 <tgroup cols="4" colsep="0" rowsep="0">
38730 <colspec colwidth="8*" align="left"/>
38731 <colspec colwidth="5*" align="center"/>
38732 <colspec colwidth="5*" align="center"/>
38733 <colspec colwidth="6*" align="right"/>
38736 <entry><option>ignore_quota</option></entry>
38737 <entry>Use: <emphasis>lmtp</emphasis></entry>
38738 <entry>Type: <emphasis>boolean</emphasis></entry>
38739 <entry>Default: <emphasis>false</emphasis></entry>
38745 <indexterm role="concept">
38746 <primary>LMTP</primary>
38747 <secondary>ignoring quota errors</secondary>
38749 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
38750 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
38751 in its response to the LHLO command.
38754 <indexterm role="option">
38755 <primary>socket</primary>
38758 <informaltable frame="all">
38759 <tgroup cols="4" colsep="0" rowsep="0">
38760 <colspec colwidth="8*" align="left"/>
38761 <colspec colwidth="5*" align="center"/>
38762 <colspec colwidth="5*" align="center"/>
38763 <colspec colwidth="6*" align="right"/>
38766 <entry><option>socket</option></entry>
38767 <entry>Use: <emphasis>lmtp</emphasis></entry>
38768 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38769 <entry>Default: <emphasis>unset</emphasis></entry>
38775 This option must be set if <option>command</option> is not set. The result of expansion must
38776 be the name of a Unix domain socket. The transport connects to the socket and
38777 delivers the message to it using the LMTP protocol.
38780 <indexterm role="option">
38781 <primary>timeout</primary>
38784 <informaltable frame="all">
38785 <tgroup cols="4" colsep="0" rowsep="0">
38786 <colspec colwidth="8*" align="left"/>
38787 <colspec colwidth="5*" align="center"/>
38788 <colspec colwidth="5*" align="center"/>
38789 <colspec colwidth="6*" align="right"/>
38792 <entry><option>timeout</option></entry>
38793 <entry>Use: <emphasis>lmtp</emphasis></entry>
38794 <entry>Type: <emphasis>time</emphasis></entry>
38795 <entry>Default: <emphasis>5m</emphasis></entry>
38801 The transport is aborted if the created process
38802 or Unix domain socket
38803 does not respond to LMTP commands or message input within this timeout.
38806 Here is an example of a typical LMTP transport:
38808 <literallayout class="monospaced">
38811 command = /some/local/lmtp/delivery/program
38816 This delivers up to 20 addresses at a time, in a mixture of domains if
38817 necessary, running as the user <emphasis>exim</emphasis>.
38821 <chapter id="CHAPpipetransport">
38822 <title>The pipe transport</title>
38824 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
38825 <primary>transports</primary>
38826 <secondary><command>pipe</command></secondary>
38828 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
38829 <primary><command>pipe</command> transport</primary>
38831 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
38832 running in another process. One example is the use of <command>pipe</command> as a
38833 pseudo-remote transport for passing messages to some other delivery mechanism
38834 (such as UUCP). Another is the use by individual users to automatically process
38835 their incoming messages. The <command>pipe</command> transport can be used in one of the
38841 <indexterm role="concept">
38842 <primary><varname>$local_part</varname></primary>
38844 A router routes one address to a transport in the normal way, and the
38845 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
38846 contains the local part of the address (as usual), and the command that is run
38847 is specified by the <option>command</option> option on the transport.
38852 <indexterm role="concept">
38853 <primary><varname>$pipe_addresses</varname></primary>
38855 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
38856 transport can handle more than one address in a single run. In this case, when
38857 more than one address is routed to the transport, <varname>$local_part</varname> is not set
38858 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
38859 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
38860 that are routed to the transport.
38865 <indexterm role="concept">
38866 <primary><varname>$address_pipe</varname></primary>
38868 A router redirects an address directly to a pipe command (for example, from an
38869 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
38870 pipe command, and the <option>command</option> option on the transport is ignored. If only
38871 one address is being transported (<option>batch_max</option> is not greater than one, or
38872 only one address was redirected to this pipe command), <varname>$local_part</varname> contains
38873 the local part that was redirected.
38878 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
38879 deliver messages over pipes using the LMTP interactive protocol. This is
38880 implemented by the <command>lmtp</command> transport.
38883 In the case when <command>pipe</command> is run as a consequence of an entry in a local user’s
38884 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
38885 other cases, the uid and gid have to be specified explicitly, either on the
38886 transport or on the router that handles the address. Current and <quote>home</quote>
38887 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
38888 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
38889 for a discussion of local delivery batching.
38892 <title>Concurrent delivery</title>
38894 If two messages arrive at almost the same time, and both are routed to a pipe
38895 delivery, the two pipe transports may be run concurrently. You must ensure that
38896 any pipe commands you set up are robust against this happening. If the commands
38897 write to a file, the <option>exim_lock</option> utility might be of use.
38901 <title>Returned status and data</title>
38903 <indexterm role="concept">
38904 <primary><command>pipe</command> transport</primary>
38905 <secondary>returned data</secondary>
38907 If the command exits with a non-zero return code, the delivery is deemed to
38908 have failed, unless either the <option>ignore_status</option> option is set (in which case
38909 the return code is treated as zero), or the return code is one of those listed
38910 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
38911 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
38912 logged, but are not included in the bounce message, which merely contains
38913 <quote>local delivery failed</quote>.
38916 If the return code is greater than 128 and the command being run is a shell
38917 script, it normally means that the script was terminated by a signal whose
38918 value is the return code minus 128.
38921 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
38922 return code is set to 127. This is the value that a shell returns if it is
38923 asked to run a non-existent command. The wording for the log line suggests that
38924 a non-existent command may be the problem.
38927 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
38928 set and the command produces any output on its standard output or standard
38929 error streams, the command is considered to have failed, even if it gave a zero
38930 return code or if <option>ignore_status</option> is set. The output from the command is
38931 included as part of the bounce message. The <option>return_fail_output</option> option is
38932 similar, except that output is returned only when the command exits with a
38933 failure return code, that is, a value other than zero or a code that matches
38934 <option>temp_errors</option>.
38937 <section id="SECThowcommandrun">
38938 <title>How the command is run</title>
38940 <indexterm role="concept">
38941 <primary><command>pipe</command> transport</primary>
38942 <secondary>path for command</secondary>
38944 The command line is (by default) broken down into a command name and arguments
38945 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
38946 <option>restrict_to_path</option> options can be used to restrict the commands that may be
38950 <indexterm role="concept">
38951 <primary>quoting</primary>
38952 <secondary>in pipe command</secondary>
38954 Unquoted arguments are delimited by white space. If an argument appears in
38955 double quotes, backslash is interpreted as an escape character in the usual
38956 way. If an argument appears in single quotes, no escaping is done.
38959 String expansion is applied to the command line except when it comes from a
38960 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
38961 expansion is applied to each argument in turn rather than to the whole line.
38962 For this reason, any string expansion item that contains white space must be
38963 quoted so as to be contained within a single argument. A setting such as
38965 <literallayout class="monospaced">
38966 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
38969 will not work, because the expansion item gets split between several
38970 arguments. You have to write
38972 <literallayout class="monospaced">
38973 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
38976 to ensure that it is all in one argument. The expansion is done in this way,
38977 argument by argument, so that the number of arguments cannot be changed as a
38978 result of expansion, and quotes or backslashes in inserted variables do not
38979 interact with external quoting. However, this leads to problems if you want to
38980 generate multiple arguments (or the command name plus arguments) from a single
38981 expansion. In this situation, the simplest solution is to use a shell. For
38984 <literallayout class="monospaced">
38985 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
38988 <indexterm role="concept">
38989 <primary>transport</primary>
38990 <secondary>filter</secondary>
38992 <indexterm role="concept">
38993 <primary>filter</primary>
38994 <secondary>transport filter</secondary>
38996 <indexterm role="concept">
38997 <primary><varname>$pipe_addresses</varname></primary>
38999 Special handling takes place when an argument consists of precisely the text
39000 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
39001 place this string is recognized is when it appears as an argument for a pipe or
39002 transport filter command. It causes each address that is being handled to be
39003 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
39004 avoids any problems with spaces or shell metacharacters, and is of use when a
39005 <command>pipe</command> transport is handling groups of addresses in a batch.
39008 After splitting up into arguments and expansion, the resulting command is run
39009 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
39010 message that is being delivered is supplied on the standard input, and the
39011 standard output and standard error are both connected to a single pipe that is
39012 read by Exim. The <option>max_output</option> option controls how much output the command
39013 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
39014 control what is done with it.
39017 Not running the command under a shell (by default) lessens the security risks
39018 in cases when a command from a user’s filter file is built out of data that was
39019 taken from an incoming message. If a shell is required, it can of course be
39020 explicitly specified as the command to be run. However, there are circumstances
39021 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
39022 under a shell and cannot easily be modified. To allow for these cases, there is
39023 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
39024 works. Instead of breaking up the command line as just described, it expands it
39025 as a single string and passes the result to <filename>/bin/sh</filename>. The
39026 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
39027 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
39030 <section id="SECTpipeenv">
39031 <title>Environment variables</title>
39033 <indexterm role="concept">
39034 <primary><command>pipe</command> transport</primary>
39035 <secondary>environment for command</secondary>
39037 <indexterm role="concept">
39038 <primary>environment for pipe transport</primary>
39040 The environment variables listed below are set up when the command is invoked.
39041 This list is a compromise for maximum compatibility with other MTAs. Note that
39042 the <option>environment</option> option can be used to add additional variables to this
39046 <literal>DOMAIN </literal> the domain of the address
39047 <literal>HOME </literal> the home directory, if set
39048 <literal>HOST </literal> the host name when called from a router (see below)
39049 <literal>LOCAL_PART </literal> see below
39050 <literal>LOCAL_PART_PREFIX </literal> see below
39051 <literal>LOCAL_PART_SUFFIX </literal> see below
39052 <literal>LOGNAME </literal> see below
39053 <literal>MESSAGE_ID </literal> Exim’s local ID for the message
39054 <literal>PATH </literal> as specified by the <option>path</option> option below
39055 <literal>QUALIFY_DOMAIN </literal> the sender qualification domain
39056 <literal>RECIPIENT </literal> the complete recipient address
39057 <literal>SENDER </literal> the sender of the message (empty if a bounce)
39058 <literal>SHELL </literal> <literal>/bin/sh</literal>
39059 <literal>TZ </literal> the value of the <option>timezone</option> option, if set
39060 <literal>USER </literal> see below
39063 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
39064 router, LOCAL_PART is set to the local part of the address. When it is
39065 called as a result of a forward or alias expansion, LOCAL_PART is set to
39066 the local part of the address that was expanded. In both cases, any affixes are
39067 removed from the local part, and made available in LOCAL_PART_PREFIX and
39068 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
39069 same value as LOCAL_PART for compatibility with other MTAs.
39072 <indexterm role="concept">
39073 <primary>HOST</primary>
39075 HOST is set only when a <command>pipe</command> transport is called from a router that
39076 associates hosts with an address, typically when using <command>pipe</command> as a
39077 pseudo-remote transport. HOST is set to the first host name specified by
39081 <indexterm role="concept">
39082 <primary>HOME</primary>
39084 If the transport’s generic <option>home_directory</option> option is set, its value is used
39085 for the HOME environment variable. Otherwise, a home directory may be set
39086 by the router’s <option>transport_home_directory</option> option, which defaults to the
39087 user’s home directory if <option>check_local_user</option> is set.
39091 <title>Private options for pipe</title>
39093 <indexterm role="concept">
39094 <primary>options</primary>
39095 <secondary><command>pipe</command> transport</secondary>
39099 <indexterm role="option">
39100 <primary>allow_commands</primary>
39103 <informaltable frame="all">
39104 <tgroup cols="4" colsep="0" rowsep="0">
39105 <colspec colwidth="8*" align="left"/>
39106 <colspec colwidth="5*" align="center"/>
39107 <colspec colwidth="5*" align="center"/>
39108 <colspec colwidth="6*" align="right"/>
39111 <entry><option>allow_commands</option></entry>
39112 <entry>Use: <emphasis>pipe</emphasis></entry>
39113 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
39114 <entry>Default: <emphasis>unset</emphasis></entry>
39120 <indexterm role="concept">
39121 <primary><command>pipe</command> transport</primary>
39122 <secondary>permitted commands</secondary>
39124 The string is expanded, and is then interpreted as a colon-separated list of
39125 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
39126 permitted are those in the <option>allow_commands</option> list. They need not be absolute
39127 paths; the <option>path</option> option is still used for relative paths. If
39128 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
39129 in the <option>allow_commands</option> list, or a name without any slashes that is found on
39130 the path. In other words, if neither <option>allow_commands</option> nor
39131 <option>restrict_to_path</option> is set, there is no restriction on the command, but
39132 otherwise only commands that are permitted by one or the other are allowed. For
39135 <literallayout class="monospaced">
39136 allow_commands = /usr/bin/vacation
39139 and <option>restrict_to_path</option> is not set, the only permitted command is
39140 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
39141 <option>use_shell</option> is set.
39144 <indexterm role="option">
39145 <primary>batch_id</primary>
39148 <informaltable frame="all">
39149 <tgroup cols="4" colsep="0" rowsep="0">
39150 <colspec colwidth="8*" align="left"/>
39151 <colspec colwidth="5*" align="center"/>
39152 <colspec colwidth="5*" align="center"/>
39153 <colspec colwidth="6*" align="right"/>
39156 <entry><option>batch_id</option></entry>
39157 <entry>Use: <emphasis>pipe</emphasis></entry>
39158 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39159 <entry>Default: <emphasis>unset</emphasis></entry>
39165 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
39168 <indexterm role="option">
39169 <primary>batch_max</primary>
39172 <informaltable frame="all">
39173 <tgroup cols="4" colsep="0" rowsep="0">
39174 <colspec colwidth="8*" align="left"/>
39175 <colspec colwidth="5*" align="center"/>
39176 <colspec colwidth="5*" align="center"/>
39177 <colspec colwidth="6*" align="right"/>
39180 <entry><option>batch_max</option></entry>
39181 <entry>Use: <emphasis>pipe</emphasis></entry>
39182 <entry>Type: <emphasis>integer</emphasis></entry>
39183 <entry>Default: <emphasis>1</emphasis></entry>
39189 This limits the number of addresses that can be handled in a single delivery.
39190 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
39193 <indexterm role="option">
39194 <primary>check_string</primary>
39197 <informaltable frame="all">
39198 <tgroup cols="4" colsep="0" rowsep="0">
39199 <colspec colwidth="8*" align="left"/>
39200 <colspec colwidth="5*" align="center"/>
39201 <colspec colwidth="5*" align="center"/>
39202 <colspec colwidth="6*" align="right"/>
39205 <entry><option>check_string</option></entry>
39206 <entry>Use: <emphasis>pipe</emphasis></entry>
39207 <entry>Type: <emphasis>string</emphasis></entry>
39208 <entry>Default: <emphasis>unset</emphasis></entry>
39214 As <command>pipe</command> writes the message, the start of each line is tested for matching
39215 <option>check_string</option>, and if it does, the initial matching characters are replaced
39216 by the contents of <option>escape_string</option>, provided both are set. The value of
39217 <option>check_string</option> is a literal string, not a regular expression, and the case of
39218 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
39219 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
39220 the SMTP escaping protocol. Any settings made in the configuration file are
39224 <indexterm role="option">
39225 <primary>command</primary>
39228 <informaltable frame="all">
39229 <tgroup cols="4" colsep="0" rowsep="0">
39230 <colspec colwidth="8*" align="left"/>
39231 <colspec colwidth="5*" align="center"/>
39232 <colspec colwidth="5*" align="center"/>
39233 <colspec colwidth="6*" align="right"/>
39236 <entry><option>command</option></entry>
39237 <entry>Use: <emphasis>pipe</emphasis></entry>
39238 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39239 <entry>Default: <emphasis>unset</emphasis></entry>
39245 This option need not be set when <command>pipe</command> is being used to deliver to pipes
39246 obtained directly from address redirections. In other cases, the option must be
39247 set, to provide a command to be run. It need not yield an absolute path (see
39248 the <option>path</option> option below). The command is split up into separate arguments by
39249 Exim, and each argument is separately expanded, as described in section
39250 <xref linkend="SECThowcommandrun"/> above.
39253 <indexterm role="option">
39254 <primary>environment</primary>
39257 <informaltable frame="all">
39258 <tgroup cols="4" colsep="0" rowsep="0">
39259 <colspec colwidth="8*" align="left"/>
39260 <colspec colwidth="5*" align="center"/>
39261 <colspec colwidth="5*" align="center"/>
39262 <colspec colwidth="6*" align="right"/>
39265 <entry><option>environment</option></entry>
39266 <entry>Use: <emphasis>pipe</emphasis></entry>
39267 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39268 <entry>Default: <emphasis>unset</emphasis></entry>
39274 <indexterm role="concept">
39275 <primary><command>pipe</command> transport</primary>
39276 <secondary>environment for command</secondary>
39278 <indexterm role="concept">
39279 <primary>environment for <command>pipe</command> transport</primary>
39281 This option is used to add additional variables to the environment in which the
39282 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
39283 a string which is expanded, and then interpreted as a colon-separated list of
39284 environment settings of the form <<emphasis>name</emphasis>>=<<emphasis>value</emphasis>>.
39287 <indexterm role="option">
39288 <primary>escape_string</primary>
39291 <informaltable frame="all">
39292 <tgroup cols="4" colsep="0" rowsep="0">
39293 <colspec colwidth="8*" align="left"/>
39294 <colspec colwidth="5*" align="center"/>
39295 <colspec colwidth="5*" align="center"/>
39296 <colspec colwidth="6*" align="right"/>
39299 <entry><option>escape_string</option></entry>
39300 <entry>Use: <emphasis>pipe</emphasis></entry>
39301 <entry>Type: <emphasis>string</emphasis></entry>
39302 <entry>Default: <emphasis>unset</emphasis></entry>
39308 See <option>check_string</option> above.
39311 <indexterm role="option">
39312 <primary>freeze_exec_fail</primary>
39315 <informaltable frame="all">
39316 <tgroup cols="4" colsep="0" rowsep="0">
39317 <colspec colwidth="8*" align="left"/>
39318 <colspec colwidth="5*" align="center"/>
39319 <colspec colwidth="5*" align="center"/>
39320 <colspec colwidth="6*" align="right"/>
39323 <entry><option>freeze_exec_fail</option></entry>
39324 <entry>Use: <emphasis>pipe</emphasis></entry>
39325 <entry>Type: <emphasis>boolean</emphasis></entry>
39326 <entry>Default: <emphasis>false</emphasis></entry>
39332 <indexterm role="concept">
39333 <primary>exec failure</primary>
39335 <indexterm role="concept">
39336 <primary>failure of exec</primary>
39338 <indexterm role="concept">
39339 <primary><command>pipe</command> transport</primary>
39340 <secondary>failure of exec</secondary>
39342 Failure to exec the command in a pipe transport is by default treated like
39343 any other failure while running the command. However, if <option>freeze_exec_fail</option>
39344 is set, failure to exec is treated specially, and causes the message to be
39345 frozen, whatever the setting of <option>ignore_status</option>.
39348 <indexterm role="option">
39349 <primary>ignore_status</primary>
39352 <informaltable frame="all">
39353 <tgroup cols="4" colsep="0" rowsep="0">
39354 <colspec colwidth="8*" align="left"/>
39355 <colspec colwidth="5*" align="center"/>
39356 <colspec colwidth="5*" align="center"/>
39357 <colspec colwidth="6*" align="right"/>
39360 <entry><option>ignore_status</option></entry>
39361 <entry>Use: <emphasis>pipe</emphasis></entry>
39362 <entry>Type: <emphasis>boolean</emphasis></entry>
39363 <entry>Default: <emphasis>false</emphasis></entry>
39369 If this option is true, the status returned by the subprocess that is set up to
39370 run the command is ignored, and Exim behaves as if zero had been returned.
39371 Otherwise, a non-zero status or termination by signal causes an error return
39372 from the transport unless the status value is one of those listed in
39373 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
39376 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
39377 See the <option>timeout_defer</option> option for how timeouts are handled.
39380 <indexterm role="option">
39381 <primary>log_defer_output</primary>
39384 <informaltable frame="all">
39385 <tgroup cols="4" colsep="0" rowsep="0">
39386 <colspec colwidth="8*" align="left"/>
39387 <colspec colwidth="5*" align="center"/>
39388 <colspec colwidth="5*" align="center"/>
39389 <colspec colwidth="6*" align="right"/>
39392 <entry><option>log_defer_output</option></entry>
39393 <entry>Use: <emphasis>pipe</emphasis></entry>
39394 <entry>Type: <emphasis>boolean</emphasis></entry>
39395 <entry>Default: <emphasis>false</emphasis></entry>
39401 <indexterm role="concept">
39402 <primary><command>pipe</command> transport</primary>
39403 <secondary>logging output</secondary>
39405 If this option is set, and the status returned by the command is
39406 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
39407 and any output was produced, the first line of it is written to the main log.
39410 <indexterm role="option">
39411 <primary>log_fail_output</primary>
39414 <informaltable frame="all">
39415 <tgroup cols="4" colsep="0" rowsep="0">
39416 <colspec colwidth="8*" align="left"/>
39417 <colspec colwidth="5*" align="center"/>
39418 <colspec colwidth="5*" align="center"/>
39419 <colspec colwidth="6*" align="right"/>
39422 <entry><option>log_fail_output</option></entry>
39423 <entry>Use: <emphasis>pipe</emphasis></entry>
39424 <entry>Type: <emphasis>boolean</emphasis></entry>
39425 <entry>Default: <emphasis>false</emphasis></entry>
39431 If this option is set, and the command returns any output, and also ends with a
39432 return code that is neither zero nor one of the return codes listed in
39433 <option>temp_errors</option> (that is, the delivery failed), the first line of output is
39434 written to the main log. This option and <option>log_output</option> are mutually exclusive.
39435 Only one of them may be set.
39438 <indexterm role="option">
39439 <primary>log_output</primary>
39442 <informaltable frame="all">
39443 <tgroup cols="4" colsep="0" rowsep="0">
39444 <colspec colwidth="8*" align="left"/>
39445 <colspec colwidth="5*" align="center"/>
39446 <colspec colwidth="5*" align="center"/>
39447 <colspec colwidth="6*" align="right"/>
39450 <entry><option>log_output</option></entry>
39451 <entry>Use: <emphasis>pipe</emphasis></entry>
39452 <entry>Type: <emphasis>boolean</emphasis></entry>
39453 <entry>Default: <emphasis>false</emphasis></entry>
39459 If this option is set and the command returns any output, the first line of
39460 output is written to the main log, whatever the return code. This option and
39461 <option>log_fail_output</option> are mutually exclusive. Only one of them may be set.
39464 <indexterm role="option">
39465 <primary>max_output</primary>
39468 <informaltable frame="all">
39469 <tgroup cols="4" colsep="0" rowsep="0">
39470 <colspec colwidth="8*" align="left"/>
39471 <colspec colwidth="5*" align="center"/>
39472 <colspec colwidth="5*" align="center"/>
39473 <colspec colwidth="6*" align="right"/>
39476 <entry><option>max_output</option></entry>
39477 <entry>Use: <emphasis>pipe</emphasis></entry>
39478 <entry>Type: <emphasis>integer</emphasis></entry>
39479 <entry>Default: <emphasis>20K</emphasis></entry>
39485 This specifies the maximum amount of output that the command may produce on its
39486 standard output and standard error file combined. If the limit is exceeded, the
39487 process running the command is killed. This is intended as a safety measure to
39488 catch runaway processes. The limit is applied independently of the settings of
39489 the options that control what is done with such output (for example,
39490 <option>return_output</option>). Because of buffering effects, the amount of output may
39491 exceed the limit by a small amount before Exim notices.
39494 <indexterm role="option">
39495 <primary>message_prefix</primary>
39498 <informaltable frame="all">
39499 <tgroup cols="4" colsep="0" rowsep="0">
39500 <colspec colwidth="8*" align="left"/>
39501 <colspec colwidth="5*" align="center"/>
39502 <colspec colwidth="5*" align="center"/>
39503 <colspec colwidth="6*" align="right"/>
39506 <entry><option>message_prefix</option></entry>
39507 <entry>Use: <emphasis>pipe</emphasis></entry>
39508 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39509 <entry>Default: <emphasis>see below</emphasis></entry>
39515 The string specified here is expanded and output at the start of every message.
39516 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
39518 <literallayout class="monospaced">
39520 From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
39524 <indexterm role="concept">
39525 <primary>Cyrus</primary>
39527 <indexterm role="concept">
39528 <primary><option>tmail</option></primary>
39530 <indexterm role="concept">
39531 <primary><quote>From</quote> line</primary>
39533 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
39534 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
39535 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
39538 <literallayout class="monospaced">
39542 <indexterm role="option">
39543 <primary>message_suffix</primary>
39546 <informaltable frame="all">
39547 <tgroup cols="4" colsep="0" rowsep="0">
39548 <colspec colwidth="8*" align="left"/>
39549 <colspec colwidth="5*" align="center"/>
39550 <colspec colwidth="5*" align="center"/>
39551 <colspec colwidth="6*" align="right"/>
39554 <entry><option>message_suffix</option></entry>
39555 <entry>Use: <emphasis>pipe</emphasis></entry>
39556 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39557 <entry>Default: <emphasis>see below</emphasis></entry>
39563 The string specified here is expanded and output at the end of every message.
39564 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
39565 The suffix can be suppressed by setting
39567 <literallayout class="monospaced">
39571 <indexterm role="option">
39572 <primary>path</primary>
39575 <informaltable frame="all">
39576 <tgroup cols="4" colsep="0" rowsep="0">
39577 <colspec colwidth="8*" align="left"/>
39578 <colspec colwidth="5*" align="center"/>
39579 <colspec colwidth="5*" align="center"/>
39580 <colspec colwidth="6*" align="right"/>
39583 <entry><option>path</option></entry>
39584 <entry>Use: <emphasis>pipe</emphasis></entry>
39585 <entry>Type: <emphasis>string</emphasis></entry>
39586 <entry>Default: <emphasis><literal>/bin:/usr/bin</literal></emphasis></entry>
39592 This option specifies the string that is set up in the PATH environment
39593 variable of the subprocess. If the <option>command</option> option does not yield an
39594 absolute path name, the command is sought in the PATH directories, in the usual
39595 way. <emphasis role="bold">Warning</emphasis>: This does not apply to a command specified as a transport
39599 <indexterm role="option">
39600 <primary>pipe_as_creator</primary>
39603 <informaltable frame="all">
39604 <tgroup cols="4" colsep="0" rowsep="0">
39605 <colspec colwidth="8*" align="left"/>
39606 <colspec colwidth="5*" align="center"/>
39607 <colspec colwidth="5*" align="center"/>
39608 <colspec colwidth="6*" align="right"/>
39611 <entry><option>pipe_as_creator</option></entry>
39612 <entry>Use: <emphasis>pipe</emphasis></entry>
39613 <entry>Type: <emphasis>boolean</emphasis></entry>
39614 <entry>Default: <emphasis>false</emphasis></entry>
39620 <indexterm role="concept">
39621 <primary>uid (user id)</primary>
39622 <secondary>local delivery</secondary>
39624 If the generic <option>user</option> option is not set and this option is true, the delivery
39625 process is run under the uid that was in force when Exim was originally called
39626 to accept the message. If the group id is not otherwise set (via the generic
39627 <option>group</option> option), the gid that was in force when Exim was originally called to
39628 accept the message is used.
39631 <indexterm role="option">
39632 <primary>restrict_to_path</primary>
39635 <informaltable frame="all">
39636 <tgroup cols="4" colsep="0" rowsep="0">
39637 <colspec colwidth="8*" align="left"/>
39638 <colspec colwidth="5*" align="center"/>
39639 <colspec colwidth="5*" align="center"/>
39640 <colspec colwidth="6*" align="right"/>
39643 <entry><option>restrict_to_path</option></entry>
39644 <entry>Use: <emphasis>pipe</emphasis></entry>
39645 <entry>Type: <emphasis>boolean</emphasis></entry>
39646 <entry>Default: <emphasis>false</emphasis></entry>
39652 When this option is set, any command name not listed in <option>allow_commands</option> must
39653 contain no slashes. The command is searched for only in the directories listed
39654 in the <option>path</option> option. This option is intended for use in the case when a pipe
39655 command has been generated from a user’s <filename>.forward</filename> file. This is usually
39656 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
39659 <indexterm role="option">
39660 <primary>return_fail_output</primary>
39663 <informaltable frame="all">
39664 <tgroup cols="4" colsep="0" rowsep="0">
39665 <colspec colwidth="8*" align="left"/>
39666 <colspec colwidth="5*" align="center"/>
39667 <colspec colwidth="5*" align="center"/>
39668 <colspec colwidth="6*" align="right"/>
39671 <entry><option>return_fail_output</option></entry>
39672 <entry>Use: <emphasis>pipe</emphasis></entry>
39673 <entry>Type: <emphasis>boolean</emphasis></entry>
39674 <entry>Default: <emphasis>false</emphasis></entry>
39680 If this option is true, and the command produced any output and ended with a
39681 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
39682 is, the delivery failed), the output is returned in the bounce message.
39683 However, if the message has a null sender (that is, it is itself a bounce
39684 message), output from the command is discarded. This option and
39685 <option>return_output</option> are mutually exclusive. Only one of them may be set.
39688 <indexterm role="option">
39689 <primary>return_output</primary>
39692 <informaltable frame="all">
39693 <tgroup cols="4" colsep="0" rowsep="0">
39694 <colspec colwidth="8*" align="left"/>
39695 <colspec colwidth="5*" align="center"/>
39696 <colspec colwidth="5*" align="center"/>
39697 <colspec colwidth="6*" align="right"/>
39700 <entry><option>return_output</option></entry>
39701 <entry>Use: <emphasis>pipe</emphasis></entry>
39702 <entry>Type: <emphasis>boolean</emphasis></entry>
39703 <entry>Default: <emphasis>false</emphasis></entry>
39709 If this option is true, and the command produced any output, the delivery is
39710 deemed to have failed whatever the return code from the command, and the output
39711 is returned in the bounce message. Otherwise, the output is just discarded.
39712 However, if the message has a null sender (that is, it is a bounce message),
39713 output from the command is always discarded, whatever the setting of this
39714 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
39715 of them may be set.
39718 <indexterm role="option">
39719 <primary>temp_errors</primary>
39722 <informaltable frame="all">
39723 <tgroup cols="4" colsep="0" rowsep="0">
39724 <colspec colwidth="8*" align="left"/>
39725 <colspec colwidth="5*" align="center"/>
39726 <colspec colwidth="5*" align="center"/>
39727 <colspec colwidth="6*" align="right"/>
39730 <entry><option>temp_errors</option></entry>
39731 <entry>Use: <emphasis>pipe</emphasis></entry>
39732 <entry>Type: <emphasis>string list</emphasis></entry>
39733 <entry>Default: <emphasis>see below</emphasis></entry>
39739 <indexterm role="concept">
39740 <primary><command>pipe</command> transport</primary>
39741 <secondary>temporary failure</secondary>
39743 This option contains either a colon-separated list of numbers, or a single
39744 asterisk. If <option>ignore_status</option> is false
39745 and <option>return_output</option> is not set,
39746 and the command exits with a non-zero return code, the failure is treated as
39747 temporary and the delivery is deferred if the return code matches one of the
39748 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
39749 codes are treated as permanent errors. The default setting contains the codes
39750 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
39751 compiled on a system that does not define these macros, it assumes values of 75
39752 and 73, respectively.
39755 <indexterm role="option">
39756 <primary>timeout</primary>
39759 <informaltable frame="all">
39760 <tgroup cols="4" colsep="0" rowsep="0">
39761 <colspec colwidth="8*" align="left"/>
39762 <colspec colwidth="5*" align="center"/>
39763 <colspec colwidth="5*" align="center"/>
39764 <colspec colwidth="6*" align="right"/>
39767 <entry><option>timeout</option></entry>
39768 <entry>Use: <emphasis>pipe</emphasis></entry>
39769 <entry>Type: <emphasis>time</emphasis></entry>
39770 <entry>Default: <emphasis>1h</emphasis></entry>
39776 If the command fails to complete within this time, it is killed. This normally
39777 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
39778 specifies no timeout. In order to ensure that any subprocesses created by the
39779 command are also killed, Exim makes the initial process a process group leader,
39780 and kills the whole process group on a timeout. However, this can be defeated
39781 if one of the processes starts a new process group.
39784 <indexterm role="option">
39785 <primary>timeout_defer</primary>
39788 <informaltable frame="all">
39789 <tgroup cols="4" colsep="0" rowsep="0">
39790 <colspec colwidth="8*" align="left"/>
39791 <colspec colwidth="5*" align="center"/>
39792 <colspec colwidth="5*" align="center"/>
39793 <colspec colwidth="6*" align="right"/>
39796 <entry><option>timeout_defer</option></entry>
39797 <entry>Use: <emphasis>pipe</emphasis></entry>
39798 <entry>Type: <emphasis>boolean</emphasis></entry>
39799 <entry>Default: <emphasis>false</emphasis></entry>
39805 A timeout in a <command>pipe</command> transport, either in the command that the transport
39806 runs, or in a transport filter that is associated with it, is by default
39807 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
39808 is set true, both kinds of timeout become temporary errors, causing the
39809 delivery to be deferred.
39812 <indexterm role="option">
39813 <primary>umask</primary>
39816 <informaltable frame="all">
39817 <tgroup cols="4" colsep="0" rowsep="0">
39818 <colspec colwidth="8*" align="left"/>
39819 <colspec colwidth="5*" align="center"/>
39820 <colspec colwidth="5*" align="center"/>
39821 <colspec colwidth="6*" align="right"/>
39824 <entry><option>umask</option></entry>
39825 <entry>Use: <emphasis>pipe</emphasis></entry>
39826 <entry>Type: <emphasis>octal integer</emphasis></entry>
39827 <entry>Default: <emphasis>022</emphasis></entry>
39833 This specifies the umask setting for the subprocess that runs the command.
39836 <indexterm role="option">
39837 <primary>use_bsmtp</primary>
39840 <informaltable frame="all">
39841 <tgroup cols="4" colsep="0" rowsep="0">
39842 <colspec colwidth="8*" align="left"/>
39843 <colspec colwidth="5*" align="center"/>
39844 <colspec colwidth="5*" align="center"/>
39845 <colspec colwidth="6*" align="right"/>
39848 <entry><option>use_bsmtp</option></entry>
39849 <entry>Use: <emphasis>pipe</emphasis></entry>
39850 <entry>Type: <emphasis>boolean</emphasis></entry>
39851 <entry>Default: <emphasis>false</emphasis></entry>
39857 <indexterm role="concept">
39858 <primary>envelope sender</primary>
39860 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
39861 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
39862 commands. If you want to include a leading HELO command with such messages,
39863 you can do so by setting the <option>message_prefix</option> option. See section
39864 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
39867 <indexterm role="option">
39868 <primary>use_classresources</primary>
39871 <informaltable frame="all">
39872 <tgroup cols="4" colsep="0" rowsep="0">
39873 <colspec colwidth="8*" align="left"/>
39874 <colspec colwidth="5*" align="center"/>
39875 <colspec colwidth="5*" align="center"/>
39876 <colspec colwidth="6*" align="right"/>
39879 <entry><option>use_classresources</option></entry>
39880 <entry>Use: <emphasis>pipe</emphasis></entry>
39881 <entry>Type: <emphasis>boolean</emphasis></entry>
39882 <entry>Default: <emphasis>false</emphasis></entry>
39888 <indexterm role="concept">
39889 <primary>class resources (BSD)</primary>
39891 This option is available only when Exim is running on FreeBSD, NetBSD, or
39892 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
39893 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
39894 limits for the uid under which the pipe is to run are obtained from the login
39898 <indexterm role="option">
39899 <primary>use_crlf</primary>
39902 <informaltable frame="all">
39903 <tgroup cols="4" colsep="0" rowsep="0">
39904 <colspec colwidth="8*" align="left"/>
39905 <colspec colwidth="5*" align="center"/>
39906 <colspec colwidth="5*" align="center"/>
39907 <colspec colwidth="6*" align="right"/>
39910 <entry><option>use_crlf</option></entry>
39911 <entry>Use: <emphasis>pipe</emphasis></entry>
39912 <entry>Type: <emphasis>boolean</emphasis></entry>
39913 <entry>Default: <emphasis>false</emphasis></entry>
39919 <indexterm role="concept">
39920 <primary>carriage return</primary>
39922 <indexterm role="concept">
39923 <primary>linefeed</primary>
39925 This option causes lines to be terminated with the two-character CRLF sequence
39926 (carriage return, linefeed) instead of just a linefeed character. In the case
39927 of batched SMTP, the byte sequence written to the pipe is then an exact image
39928 of what would be sent down a real SMTP connection.
39931 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
39932 written verbatim, so must contain their own carriage return characters if these
39933 are needed. Since the default values for both <option>message_prefix</option> and
39934 <option>message_suffix</option> end with a single linefeed, their values must be changed to
39935 end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
39938 <indexterm role="option">
39939 <primary>use_shell</primary>
39942 <informaltable frame="all">
39943 <tgroup cols="4" colsep="0" rowsep="0">
39944 <colspec colwidth="8*" align="left"/>
39945 <colspec colwidth="5*" align="center"/>
39946 <colspec colwidth="5*" align="center"/>
39947 <colspec colwidth="6*" align="right"/>
39950 <entry><option>use_shell</option></entry>
39951 <entry>Use: <emphasis>pipe</emphasis></entry>
39952 <entry>Type: <emphasis>boolean</emphasis></entry>
39953 <entry>Default: <emphasis>false</emphasis></entry>
39959 <indexterm role="concept">
39960 <primary><varname>$pipe_addresses</varname></primary>
39962 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
39963 instead of being run directly from the transport, as described in section
39964 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
39965 where the command is expected to be run under a shell and cannot easily be
39966 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
39967 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
39968 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
39969 its <option>-c</option> option.
39973 <title>Using an external local delivery agent</title>
39975 <indexterm role="concept">
39976 <primary>local delivery</primary>
39977 <secondary>using an external agent</secondary>
39979 <indexterm role="concept">
39980 <primary><emphasis>procmail</emphasis></primary>
39982 <indexterm role="concept">
39983 <primary>external local delivery</primary>
39985 <indexterm role="concept">
39986 <primary>delivery</primary>
39987 <secondary><emphasis>procmail</emphasis></secondary>
39989 <indexterm role="concept">
39990 <primary>delivery</primary>
39991 <secondary>by external agent</secondary>
39993 The <command>pipe</command> transport can be used to pass all messages that require local
39994 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
39995 this, care must be taken to ensure that the pipe is run under an appropriate
39996 uid and gid. In some configurations one wants this to be a uid that is trusted
39997 by the delivery agent to supply the correct sender of the message. It may be
39998 necessary to recompile or reconfigure the delivery agent so that it trusts an
39999 appropriate user. The following is an example transport and router
40000 configuration for <option>procmail</option>:
40002 <literallayout class="monospaced">
40006 command = /usr/local/bin/procmail -d $local_part
40010 check_string = "From "
40011 escape_string = ">From "
40019 transport = procmail_pipe
40022 In this example, the pipe is run as the local user, but with the group set to
40023 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
40024 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
40025 user to supply a correct sender address. If you do not specify either a
40026 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
40027 home directory is the user’s home directory by default.
40030 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
40032 <literallayout class="monospaced">
40036 as shown in some <option>procmail</option> documentation, because Exim does not by default
40037 use a shell to run pipe commands.
40040 <indexterm role="concept">
40041 <primary>Cyrus</primary>
40043 The next example shows a transport and a router for a system where local
40044 deliveries are handled by the Cyrus IMAP server.
40046 <literallayout class="monospaced">
40048 local_delivery_cyrus:
40050 command = /usr/cyrus/bin/deliver \
40051 -m ${substr_1:$local_part_suffix} -- $local_part
40063 local_part_suffix = .*
40064 transport = local_delivery_cyrus
40067 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
40068 <option>return_output</option> to cause any text written by Cyrus to be returned to the
40070 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
40071 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
40076 <chapter id="CHAPsmtptrans">
40077 <title>The smtp transport</title>
40079 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
40080 <primary>transports</primary>
40081 <secondary><command>smtp</command></secondary>
40083 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
40084 <primary><command>smtp</command> transport</primary>
40086 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
40087 or LMTP protocol. The list of hosts to try can either be taken from the address
40088 that is being processed (having been set up by the router), or specified
40089 explicitly for the transport. Timeout and retry processing (see chapter
40090 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
40093 <title>Multiple messages on a single connection</title>
40095 The sending of multiple messages over a single TCP/IP connection can arise in
40101 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
40102 routed to the same host, more than one copy of the message has to be sent to
40103 that host. In this situation, multiple copies may be sent in a single run of
40104 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
40105 does when it has too many addresses to send in one message also depends on the
40106 value of the global <option>remote_max_parallel</option> option. Details are given in
40107 section <xref linkend="SECToutSMTPTCP"/>.)
40112 <indexterm role="concept">
40113 <primary>hints database</primary>
40114 <secondary>remembering routing</secondary>
40116 When a message has been successfully delivered over a TCP/IP connection, Exim
40117 looks in its hints database to see if there are any other messages awaiting a
40118 connection to the same host. If there are, a new delivery process is started
40119 for one of them, and the current TCP/IP connection is passed on to it. The new
40120 process may in turn send multiple copies and possibly create yet another
40126 For each copy sent over the same TCP/IP connection, a sequence counter is
40127 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
40128 no further messages are sent over that connection.
40132 <title>Use of the $host variable</title>
40134 <indexterm role="concept">
40135 <primary><varname>$host</varname></primary>
40137 <indexterm role="concept">
40138 <primary><varname>$host_address</varname></primary>
40140 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
40141 <varname>$host_address</varname> are the name and IP address of the first host on the host list
40142 passed by the router. However, when the transport is about to connect to a
40143 specific host, and while it is connected to that host, <varname>$host</varname> and
40144 <varname>$host_address</varname> are set to the values for that host. These are the values
40145 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
40146 <option>serialize_hosts</option>, and the various TLS options are expanded.
40150 <title>Private options for smtp</title>
40152 <indexterm role="concept">
40153 <primary>options</primary>
40154 <secondary><command>smtp</command> transport</secondary>
40156 The private options of the <command>smtp</command> transport are as follows:
40159 <indexterm role="option">
40160 <primary>allow_localhost</primary>
40163 <informaltable frame="all">
40164 <tgroup cols="4" colsep="0" rowsep="0">
40165 <colspec colwidth="8*" align="left"/>
40166 <colspec colwidth="5*" align="center"/>
40167 <colspec colwidth="5*" align="center"/>
40168 <colspec colwidth="6*" align="right"/>
40171 <entry><option>allow_localhost</option></entry>
40172 <entry>Use: <emphasis>smtp</emphasis></entry>
40173 <entry>Type: <emphasis>boolean</emphasis></entry>
40174 <entry>Default: <emphasis>false</emphasis></entry>
40180 <indexterm role="concept">
40181 <primary>local host</primary>
40182 <secondary>sending to</secondary>
40184 <indexterm role="concept">
40185 <primary>fallback</primary>
40186 <secondary>hosts specified on transport</secondary>
40188 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
40189 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
40190 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
40191 the delivery anyway. This should be used only in special cases when the
40192 configuration ensures that no looping will result (for example, a differently
40193 configured Exim is listening on the port to which the message is sent).
40196 <indexterm role="option">
40197 <primary>authenticated_sender</primary>
40200 <informaltable frame="all">
40201 <tgroup cols="4" colsep="0" rowsep="0">
40202 <colspec colwidth="8*" align="left"/>
40203 <colspec colwidth="5*" align="center"/>
40204 <colspec colwidth="5*" align="center"/>
40205 <colspec colwidth="6*" align="right"/>
40208 <entry><option>authenticated_sender</option></entry>
40209 <entry>Use: <emphasis>smtp</emphasis></entry>
40210 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40211 <entry>Default: <emphasis>unset</emphasis></entry>
40217 <indexterm role="concept">
40218 <primary>Cyrus</primary>
40220 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
40221 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
40222 overriding any existing authenticated sender value. If the string expansion is
40223 forced to fail, the option is ignored. Other expansion failures cause delivery
40224 to be deferred. If the result of expansion is an empty string, that is also
40228 If the SMTP session is not authenticated, the expansion of
40229 <option>authenticated_sender</option> still happens (and can cause the delivery to be
40230 deferred if it fails), but no AUTH= item is added to MAIL commands
40231 unless <option>authenticated_sender_force</option> is true.
40234 This option allows you to use the <command>smtp</command> transport in LMTP mode to
40235 deliver mail to Cyrus IMAP and provide the proper local part as the
40236 <quote>authenticated sender</quote>, via a setting such as:
40238 <literallayout class="monospaced">
40239 authenticated_sender = $local_part
40242 This removes the need for IMAP subfolders to be assigned special ACLs to
40243 allow direct delivery to those subfolders.
40246 Because of expected uses such as that just described for Cyrus (when no
40247 domain is involved), there is no checking on the syntax of the provided
40251 <indexterm role="option">
40252 <primary>authenticated_sender_force</primary>
40255 <informaltable frame="all">
40256 <tgroup cols="4" colsep="0" rowsep="0">
40257 <colspec colwidth="8*" align="left"/>
40258 <colspec colwidth="5*" align="center"/>
40259 <colspec colwidth="5*" align="center"/>
40260 <colspec colwidth="6*" align="right"/>
40263 <entry><option>authenticated_sender_force</option></entry>
40264 <entry>Use: <emphasis>smtp</emphasis></entry>
40265 <entry>Type: <emphasis>boolean</emphasis></entry>
40266 <entry>Default: <emphasis>false</emphasis></entry>
40272 If this option is set true, the <option>authenticated_sender</option> option’s value
40273 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
40274 authenticated as a client.
40277 <indexterm role="option">
40278 <primary>command_timeout</primary>
40281 <informaltable frame="all">
40282 <tgroup cols="4" colsep="0" rowsep="0">
40283 <colspec colwidth="8*" align="left"/>
40284 <colspec colwidth="5*" align="center"/>
40285 <colspec colwidth="5*" align="center"/>
40286 <colspec colwidth="6*" align="right"/>
40289 <entry><option>command_timeout</option></entry>
40290 <entry>Use: <emphasis>smtp</emphasis></entry>
40291 <entry>Type: <emphasis>time</emphasis></entry>
40292 <entry>Default: <emphasis>5m</emphasis></entry>
40298 This sets a timeout for receiving a response to an SMTP command that has been
40299 sent out. It is also used when waiting for the initial banner line from the
40300 remote host. Its value must not be zero.
40303 <indexterm role="option">
40304 <primary>connect_timeout</primary>
40307 <informaltable frame="all">
40308 <tgroup cols="4" colsep="0" rowsep="0">
40309 <colspec colwidth="8*" align="left"/>
40310 <colspec colwidth="5*" align="center"/>
40311 <colspec colwidth="5*" align="center"/>
40312 <colspec colwidth="6*" align="right"/>
40315 <entry><option>connect_timeout</option></entry>
40316 <entry>Use: <emphasis>smtp</emphasis></entry>
40317 <entry>Type: <emphasis>time</emphasis></entry>
40318 <entry>Default: <emphasis>5m</emphasis></entry>
40324 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
40325 to a remote host. A setting of zero allows the system timeout (typically
40326 several minutes) to act. To have any effect, the value of this option must be
40327 less than the system timeout. However, it has been observed that on some
40328 systems there is no system timeout, which is why the default value for this
40329 option is 5 minutes, a value recommended by RFC 1123.
40332 <indexterm role="option">
40333 <primary>connection_max_messages</primary>
40336 <informaltable frame="all">
40337 <tgroup cols="4" colsep="0" rowsep="0">
40338 <colspec colwidth="8*" align="left"/>
40339 <colspec colwidth="5*" align="center"/>
40340 <colspec colwidth="5*" align="center"/>
40341 <colspec colwidth="6*" align="right"/>
40344 <entry><option>connection_max_messages</option></entry>
40345 <entry>Use: <emphasis>smtp</emphasis></entry>
40346 <entry>Type: <emphasis>integer</emphasis></entry>
40347 <entry>Default: <emphasis>500</emphasis></entry>
40353 <indexterm role="concept">
40354 <primary>SMTP</primary>
40355 <secondary>passed connection</secondary>
40357 <indexterm role="concept">
40358 <primary>SMTP</primary>
40359 <secondary>multiple deliveries</secondary>
40361 <indexterm role="concept">
40362 <primary>multiple SMTP deliveries</primary>
40364 This controls the maximum number of separate message deliveries that are sent
40365 over a single TCP/IP connection. If the value is zero, there is no limit.
40366 For testing purposes, this value can be overridden by the <option>-oB</option> command line
40370 <indexterm role="option">
40371 <primary>data_timeout</primary>
40374 <informaltable frame="all">
40375 <tgroup cols="4" colsep="0" rowsep="0">
40376 <colspec colwidth="8*" align="left"/>
40377 <colspec colwidth="5*" align="center"/>
40378 <colspec colwidth="5*" align="center"/>
40379 <colspec colwidth="6*" align="right"/>
40382 <entry><option>data_timeout</option></entry>
40383 <entry>Use: <emphasis>smtp</emphasis></entry>
40384 <entry>Type: <emphasis>time</emphasis></entry>
40385 <entry>Default: <emphasis>5m</emphasis></entry>
40391 This sets a timeout for the transmission of each block in the data portion of
40392 the message. As a result, the overall timeout for a message depends on the size
40393 of the message. Its value must not be zero. See also <option>final_timeout</option>.
40396 <indexterm role="option">
40397 <primary>delay_after_cutoff</primary>
40400 <informaltable frame="all">
40401 <tgroup cols="4" colsep="0" rowsep="0">
40402 <colspec colwidth="8*" align="left"/>
40403 <colspec colwidth="5*" align="center"/>
40404 <colspec colwidth="5*" align="center"/>
40405 <colspec colwidth="6*" align="right"/>
40408 <entry><option>delay_after_cutoff</option></entry>
40409 <entry>Use: <emphasis>smtp</emphasis></entry>
40410 <entry>Type: <emphasis>boolean</emphasis></entry>
40411 <entry>Default: <emphasis>true</emphasis></entry>
40417 This option controls what happens when all remote IP addresses for a given
40418 domain have been inaccessible for so long that they have passed their retry
40422 In the default state, if the next retry time has not been reached for any of
40423 them, the address is bounced without trying any deliveries. In other words,
40424 Exim delays retrying an IP address after the final cutoff time until a new
40425 retry time is reached, and can therefore bounce an address without ever trying
40426 a delivery, when machines have been down for a long time. Some people are
40427 unhappy at this prospect, so...
40430 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
40431 addresses are past their final cutoff time, Exim tries to deliver to those
40432 IP addresses that have not been tried since the message arrived. If there are
40433 none, of if they all fail, the address is bounced. In other words, it does not
40434 delay when a new message arrives, but immediately tries those expired IP
40435 addresses that haven’t been tried since the message arrived. If there is a
40436 continuous stream of messages for the dead hosts, unsetting
40437 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
40441 <indexterm role="option">
40442 <primary>dns_qualify_single</primary>
40445 <informaltable frame="all">
40446 <tgroup cols="4" colsep="0" rowsep="0">
40447 <colspec colwidth="8*" align="left"/>
40448 <colspec colwidth="5*" align="center"/>
40449 <colspec colwidth="5*" align="center"/>
40450 <colspec colwidth="6*" align="right"/>
40453 <entry><option>dns_qualify_single</option></entry>
40454 <entry>Use: <emphasis>smtp</emphasis></entry>
40455 <entry>Type: <emphasis>boolean</emphasis></entry>
40456 <entry>Default: <emphasis>true</emphasis></entry>
40462 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
40463 and the <option>gethostbyname</option> option is false,
40464 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
40465 in chapter <xref linkend="CHAPdnslookup"/> for more details.
40468 <indexterm role="option">
40469 <primary>dns_search_parents</primary>
40472 <informaltable frame="all">
40473 <tgroup cols="4" colsep="0" rowsep="0">
40474 <colspec colwidth="8*" align="left"/>
40475 <colspec colwidth="5*" align="center"/>
40476 <colspec colwidth="5*" align="center"/>
40477 <colspec colwidth="6*" align="right"/>
40480 <entry><option>dns_search_parents</option></entry>
40481 <entry>Use: <emphasis>smtp</emphasis></entry>
40482 <entry>Type: <emphasis>boolean</emphasis></entry>
40483 <entry>Default: <emphasis>false</emphasis></entry>
40489 <indexterm role="concept">
40490 <primary><option>search_parents</option></primary>
40492 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
40493 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
40494 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
40498 <indexterm role="option">
40499 <primary>fallback_hosts</primary>
40502 <informaltable frame="all">
40503 <tgroup cols="4" colsep="0" rowsep="0">
40504 <colspec colwidth="8*" align="left"/>
40505 <colspec colwidth="5*" align="center"/>
40506 <colspec colwidth="5*" align="center"/>
40507 <colspec colwidth="6*" align="right"/>
40510 <entry><option>fallback_hosts</option></entry>
40511 <entry>Use: <emphasis>smtp</emphasis></entry>
40512 <entry>Type: <emphasis>string list</emphasis></entry>
40513 <entry>Default: <emphasis>unset</emphasis></entry>
40519 <indexterm role="concept">
40520 <primary>fallback</primary>
40521 <secondary>hosts specified on transport</secondary>
40523 String expansion is not applied to this option. The argument must be a
40524 colon-separated list of host names or IP addresses, optionally also including
40525 port numbers, though the separator can be changed, as described in section
40526 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
40527 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
40528 in section <xref linkend="SECTformatonehostitem"/>.
40531 Fallback hosts can also be specified on routers, which associate them with the
40532 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
40533 <option>fallback_hosts</option> specified on the transport is used only if the address does
40534 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
40535 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
40536 However, <option>hosts_randomize</option> does apply to fallback host lists.
40539 If Exim is unable to deliver to any of the hosts for a particular address, and
40540 the errors are not permanent rejections, the address is put on a separate
40541 transport queue with its host list replaced by the fallback hosts, unless the
40542 address was routed via MX records and the current host was in the original MX
40543 list. In that situation, the fallback host list is not used.
40546 Once normal deliveries are complete, the fallback queue is delivered by
40547 re-running the same transports with the new host lists. If several failing
40548 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
40549 copy of the message is sent.
40552 The resolution of the host names on the fallback list is controlled by the
40553 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
40554 both to cases when the host list comes with the address and when it is taken
40555 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
40556 fails</quote> facility.
40559 <indexterm role="option">
40560 <primary>final_timeout</primary>
40563 <informaltable frame="all">
40564 <tgroup cols="4" colsep="0" rowsep="0">
40565 <colspec colwidth="8*" align="left"/>
40566 <colspec colwidth="5*" align="center"/>
40567 <colspec colwidth="5*" align="center"/>
40568 <colspec colwidth="6*" align="right"/>
40571 <entry><option>final_timeout</option></entry>
40572 <entry>Use: <emphasis>smtp</emphasis></entry>
40573 <entry>Type: <emphasis>time</emphasis></entry>
40574 <entry>Default: <emphasis>10m</emphasis></entry>
40580 This is the timeout that applies while waiting for the response to the final
40581 line containing just <quote>.</quote> that terminates a message. Its value must not be
40585 <indexterm role="option">
40586 <primary>gethostbyname</primary>
40589 <informaltable frame="all">
40590 <tgroup cols="4" colsep="0" rowsep="0">
40591 <colspec colwidth="8*" align="left"/>
40592 <colspec colwidth="5*" align="center"/>
40593 <colspec colwidth="5*" align="center"/>
40594 <colspec colwidth="6*" align="right"/>
40597 <entry><option>gethostbyname</option></entry>
40598 <entry>Use: <emphasis>smtp</emphasis></entry>
40599 <entry>Type: <emphasis>boolean</emphasis></entry>
40600 <entry>Default: <emphasis>false</emphasis></entry>
40606 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
40607 being used, names are looked up using <function>gethostbyname()</function>
40608 (or <function>getipnodebyname()</function> when available)
40609 instead of using the DNS. Of course, that function may in fact use the DNS, but
40610 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
40613 <indexterm role="option">
40614 <primary>helo_data</primary>
40617 <informaltable frame="all">
40618 <tgroup cols="4" colsep="0" rowsep="0">
40619 <colspec colwidth="8*" align="left"/>
40620 <colspec colwidth="5*" align="center"/>
40621 <colspec colwidth="5*" align="center"/>
40622 <colspec colwidth="6*" align="right"/>
40625 <entry><option>helo_data</option></entry>
40626 <entry>Use: <emphasis>smtp</emphasis></entry>
40627 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40628 <entry>Default: <emphasis><literal>$primary_hostname</literal></emphasis></entry>
40634 <indexterm role="concept">
40635 <primary>HELO argument</primary>
40636 <secondary>setting</secondary>
40638 <indexterm role="concept">
40639 <primary>EHLO argument</primary>
40640 <secondary>setting</secondary>
40642 <indexterm role="concept">
40643 <primary>LHLO argument</primary>
40644 <secondary>setting</secondary>
40646 The value of this option is expanded, and used as the argument for the EHLO,
40647 HELO, or LHLO command that starts the outgoing SMTP or LMTP session. The
40648 variables <varname>$host</varname> and <varname>$host_address</varname> are set to the identity of the remote
40649 host, and can be used to generate different values for different servers.
40652 <indexterm role="option">
40653 <primary>hosts</primary>
40656 <informaltable frame="all">
40657 <tgroup cols="4" colsep="0" rowsep="0">
40658 <colspec colwidth="8*" align="left"/>
40659 <colspec colwidth="5*" align="center"/>
40660 <colspec colwidth="5*" align="center"/>
40661 <colspec colwidth="6*" align="right"/>
40664 <entry><option>hosts</option></entry>
40665 <entry>Use: <emphasis>smtp</emphasis></entry>
40666 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
40667 <entry>Default: <emphasis>unset</emphasis></entry>
40673 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
40674 finds the hosts by looking up the address domain in the DNS, or by
40675 <command>manualroute</command>, which has lists of hosts in its configuration. However,
40676 email addresses can be passed to the <command>smtp</command> transport by any router, and not
40677 all of them can provide an associated list of hosts.
40680 The <option>hosts</option> option specifies a list of hosts to be used if the address being
40681 processed does not have any hosts associated with it. The hosts specified by
40682 <option>hosts</option> are also used, whether or not the address has its own hosts, if
40683 <option>hosts_override</option> is set.
40686 The string is first expanded, before being interpreted as a colon-separated
40687 list of host names or IP addresses, possibly including port numbers. The
40688 separator may be changed to something other than colon, as described in section
40689 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
40690 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
40691 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
40692 of the <command>manualroute</command> router is not available here.
40695 If the expansion fails, delivery is deferred. Unless the failure was caused by
40696 the inability to complete a lookup, the error is logged to the panic log as
40697 well as the main log. Host names are looked up either by searching directly for
40698 address records in the DNS or by calling <function>gethostbyname()</function> (or
40699 <function>getipnodebyname()</function> when available), depending on the setting of the
40700 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
40701 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
40705 During delivery, the hosts are tried in order, subject to their retry status,
40706 unless <option>hosts_randomize</option> is set.
40709 <indexterm role="option">
40710 <primary>hosts_avoid_esmtp</primary>
40713 <informaltable frame="all">
40714 <tgroup cols="4" colsep="0" rowsep="0">
40715 <colspec colwidth="8*" align="left"/>
40716 <colspec colwidth="5*" align="center"/>
40717 <colspec colwidth="5*" align="center"/>
40718 <colspec colwidth="6*" align="right"/>
40721 <entry><option>hosts_avoid_esmtp</option></entry>
40722 <entry>Use: <emphasis>smtp</emphasis></entry>
40723 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
40724 <entry>Default: <emphasis>unset</emphasis></entry>
40730 <indexterm role="concept">
40731 <primary>ESMTP</primary>
40732 <secondary>avoiding use of</secondary>
40734 <indexterm role="concept">
40735 <primary>HELO</primary>
40736 <secondary>forcing use of</secondary>
40738 <indexterm role="concept">
40739 <primary>EHLO</primary>
40740 <secondary>avoiding use of</secondary>
40742 <indexterm role="concept">
40743 <primary>PIPELINING</primary>
40744 <secondary>avoiding the use of</secondary>
40746 This option is for use with broken hosts that announce ESMTP facilities (for
40747 example, PIPELINING) and then fail to implement them properly. When a host
40748 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
40749 start of the SMTP session. This means that it cannot use any of the ESMTP
40750 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
40753 <indexterm role="option">
40754 <primary>hosts_avoid_tls</primary>
40757 <informaltable frame="all">
40758 <tgroup cols="4" colsep="0" rowsep="0">
40759 <colspec colwidth="8*" align="left"/>
40760 <colspec colwidth="5*" align="center"/>
40761 <colspec colwidth="5*" align="center"/>
40762 <colspec colwidth="6*" align="right"/>
40765 <entry><option>hosts_avoid_tls</option></entry>
40766 <entry>Use: <emphasis>smtp</emphasis></entry>
40767 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
40768 <entry>Default: <emphasis>unset</emphasis></entry>
40774 <indexterm role="concept">
40775 <primary>TLS</primary>
40776 <secondary>avoiding for certain hosts</secondary>
40778 Exim will not try to start a TLS session when delivering to any host that
40779 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
40782 <indexterm role="option">
40783 <primary>hosts_max_try</primary>
40786 <informaltable frame="all">
40787 <tgroup cols="4" colsep="0" rowsep="0">
40788 <colspec colwidth="8*" align="left"/>
40789 <colspec colwidth="5*" align="center"/>
40790 <colspec colwidth="5*" align="center"/>
40791 <colspec colwidth="6*" align="right"/>
40794 <entry><option>hosts_max_try</option></entry>
40795 <entry>Use: <emphasis>smtp</emphasis></entry>
40796 <entry>Type: <emphasis>integer</emphasis></entry>
40797 <entry>Default: <emphasis>5</emphasis></entry>
40803 <indexterm role="concept">
40804 <primary>host</primary>
40805 <secondary>maximum number to try</secondary>
40807 <indexterm role="concept">
40808 <primary>limit</primary>
40809 <secondary>number of hosts tried</secondary>
40811 <indexterm role="concept">
40812 <primary>limit</primary>
40813 <secondary>number of MX tried</secondary>
40815 <indexterm role="concept">
40816 <primary>MX record</primary>
40817 <secondary>maximum tried</secondary>
40819 This option limits the number of IP addresses that are tried for any one
40820 delivery in cases where there are temporary delivery errors. Section
40821 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
40824 <indexterm role="option">
40825 <primary>hosts_max_try_hardlimit</primary>
40828 <informaltable frame="all">
40829 <tgroup cols="4" colsep="0" rowsep="0">
40830 <colspec colwidth="8*" align="left"/>
40831 <colspec colwidth="5*" align="center"/>
40832 <colspec colwidth="5*" align="center"/>
40833 <colspec colwidth="6*" align="right"/>
40836 <entry><option>hosts_max_try_hardlimit</option></entry>
40837 <entry>Use: <emphasis>smtp</emphasis></entry>
40838 <entry>Type: <emphasis>integer</emphasis></entry>
40839 <entry>Default: <emphasis>50</emphasis></entry>
40845 This is an additional check on the maximum number of IP addresses that Exim
40846 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
40850 <indexterm role="option">
40851 <primary>hosts_nopass_tls</primary>
40854 <informaltable frame="all">
40855 <tgroup cols="4" colsep="0" rowsep="0">
40856 <colspec colwidth="8*" align="left"/>
40857 <colspec colwidth="5*" align="center"/>
40858 <colspec colwidth="5*" align="center"/>
40859 <colspec colwidth="6*" align="right"/>
40862 <entry><option>hosts_nopass_tls</option></entry>
40863 <entry>Use: <emphasis>smtp</emphasis></entry>
40864 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
40865 <entry>Default: <emphasis>unset</emphasis></entry>
40871 <indexterm role="concept">
40872 <primary>TLS</primary>
40873 <secondary>passing connection</secondary>
40875 <indexterm role="concept">
40876 <primary>multiple SMTP deliveries</primary>
40878 <indexterm role="concept">
40879 <primary>TLS</primary>
40880 <secondary>multiple message deliveries</secondary>
40882 For any host that matches this list, a connection on which a TLS session has
40883 been started will not be passed to a new delivery process for sending another
40884 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
40885 explanation of when this might be needed.
40888 <indexterm role="option">
40889 <primary>hosts_override</primary>
40892 <informaltable frame="all">
40893 <tgroup cols="4" colsep="0" rowsep="0">
40894 <colspec colwidth="8*" align="left"/>
40895 <colspec colwidth="5*" align="center"/>
40896 <colspec colwidth="5*" align="center"/>
40897 <colspec colwidth="6*" align="right"/>
40900 <entry><option>hosts_override</option></entry>
40901 <entry>Use: <emphasis>smtp</emphasis></entry>
40902 <entry>Type: <emphasis>boolean</emphasis></entry>
40903 <entry>Default: <emphasis>false</emphasis></entry>
40909 If this option is set and the <option>hosts</option> option is also set, any hosts that are
40910 attached to the address are ignored, and instead the hosts specified by the
40911 <option>hosts</option> option are always used. This option does not apply to
40912 <option>fallback_hosts</option>.
40915 <indexterm role="option">
40916 <primary>hosts_randomize</primary>
40919 <informaltable frame="all">
40920 <tgroup cols="4" colsep="0" rowsep="0">
40921 <colspec colwidth="8*" align="left"/>
40922 <colspec colwidth="5*" align="center"/>
40923 <colspec colwidth="5*" align="center"/>
40924 <colspec colwidth="6*" align="right"/>
40927 <entry><option>hosts_randomize</option></entry>
40928 <entry>Use: <emphasis>smtp</emphasis></entry>
40929 <entry>Type: <emphasis>boolean</emphasis></entry>
40930 <entry>Default: <emphasis>false</emphasis></entry>
40936 <indexterm role="concept">
40937 <primary>randomized host list</primary>
40939 <indexterm role="concept">
40940 <primary>host</primary>
40941 <secondary>list of; randomized</secondary>
40943 <indexterm role="concept">
40944 <primary>fallback</primary>
40945 <secondary>randomized hosts</secondary>
40947 If this option is set, and either the list of hosts is taken from the
40948 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
40949 were not obtained from MX records (this includes fallback hosts from the
40950 router), and were not randomizied by the router, the order of trying the hosts
40951 is randomized each time the transport runs. Randomizing the order of a host
40952 list can be used to do crude load sharing.
40955 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
40956 order is separately randomized. This makes it possible to set up MX-like
40957 behaviour. The boundaries between groups are indicated by an item that is just
40958 <literal>+</literal> in the host list. For example:
40960 <literallayout class="monospaced">
40961 hosts = host1:host2:host3:+:host4:host5
40964 The order of the first three hosts and the order of the last two hosts is
40965 randomized for each use, but the first three always end up before the last two.
40966 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
40969 <indexterm role="option">
40970 <primary>hosts_require_auth</primary>
40973 <informaltable frame="all">
40974 <tgroup cols="4" colsep="0" rowsep="0">
40975 <colspec colwidth="8*" align="left"/>
40976 <colspec colwidth="5*" align="center"/>
40977 <colspec colwidth="5*" align="center"/>
40978 <colspec colwidth="6*" align="right"/>
40981 <entry><option>hosts_require_auth</option></entry>
40982 <entry>Use: <emphasis>smtp</emphasis></entry>
40983 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
40984 <entry>Default: <emphasis>unset</emphasis></entry>
40990 <indexterm role="concept">
40991 <primary>authentication</primary>
40992 <secondary>required by client</secondary>
40994 This option provides a list of servers for which authentication must succeed
40995 before Exim will try to transfer a message. If authentication fails for
40996 servers which are not in this list, Exim tries to send unauthenticated. If
40997 authentication fails for one of these servers, delivery is deferred. This
40998 temporary error is detectable in the retry rules, so it can be turned into a
40999 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
41000 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
41003 <indexterm role="option">
41004 <primary>hosts_require_tls</primary>
41007 <informaltable frame="all">
41008 <tgroup cols="4" colsep="0" rowsep="0">
41009 <colspec colwidth="8*" align="left"/>
41010 <colspec colwidth="5*" align="center"/>
41011 <colspec colwidth="5*" align="center"/>
41012 <colspec colwidth="6*" align="right"/>
41015 <entry><option>hosts_require_tls</option></entry>
41016 <entry>Use: <emphasis>smtp</emphasis></entry>
41017 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
41018 <entry>Default: <emphasis>unset</emphasis></entry>
41024 <indexterm role="concept">
41025 <primary>TLS</primary>
41026 <secondary>requiring for certain servers</secondary>
41028 Exim will insist on using a TLS session when delivering to any host that
41029 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
41030 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
41031 incoming messages, use an appropriate ACL.
41034 <indexterm role="option">
41035 <primary>hosts_try_auth</primary>
41038 <informaltable frame="all">
41039 <tgroup cols="4" colsep="0" rowsep="0">
41040 <colspec colwidth="8*" align="left"/>
41041 <colspec colwidth="5*" align="center"/>
41042 <colspec colwidth="5*" align="center"/>
41043 <colspec colwidth="6*" align="right"/>
41046 <entry><option>hosts_try_auth</option></entry>
41047 <entry>Use: <emphasis>smtp</emphasis></entry>
41048 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
41049 <entry>Default: <emphasis>unset</emphasis></entry>
41055 <indexterm role="concept">
41056 <primary>authentication</primary>
41057 <secondary>optional in client</secondary>
41059 This option provides a list of servers to which, provided they announce
41060 authentication support, Exim will attempt to authenticate as a client when it
41061 connects. If authentication fails, Exim will try to transfer the message
41062 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
41063 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
41066 <indexterm role="option">
41067 <primary>interface</primary>
41070 <informaltable frame="all">
41071 <tgroup cols="4" colsep="0" rowsep="0">
41072 <colspec colwidth="8*" align="left"/>
41073 <colspec colwidth="5*" align="center"/>
41074 <colspec colwidth="5*" align="center"/>
41075 <colspec colwidth="6*" align="right"/>
41078 <entry><option>interface</option></entry>
41079 <entry>Use: <emphasis>smtp</emphasis></entry>
41080 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
41081 <entry>Default: <emphasis>unset</emphasis></entry>
41087 <indexterm role="concept">
41088 <primary>bind IP address</primary>
41090 <indexterm role="concept">
41091 <primary>IP address</primary>
41092 <secondary>binding</secondary>
41094 <indexterm role="concept">
41095 <primary><varname>$host</varname></primary>
41097 <indexterm role="concept">
41098 <primary><varname>$host_address</varname></primary>
41100 This option specifies which interface to bind to when making an outgoing SMTP
41101 call. The variables <varname>$host</varname> and <varname>$host_address</varname> refer to the host to which a
41102 connection is about to be made during the expansion of the string. Forced
41103 expansion failure, or an empty string result causes the option to be ignored.
41104 Otherwise, after expansion,
41105 the string must be a list of IP addresses, colon-separated by default, but the
41106 separator can be changed in the usual way.
41109 <literallayout class="monospaced">
41110 interface = <; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
41113 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
41114 connection. If none of them are the correct type, the option is ignored. If
41115 <option>interface</option> is not set, or is ignored, the system’s IP functions choose which
41116 interface to use if the host has more than one.
41119 <indexterm role="option">
41120 <primary>keepalive</primary>
41123 <informaltable frame="all">
41124 <tgroup cols="4" colsep="0" rowsep="0">
41125 <colspec colwidth="8*" align="left"/>
41126 <colspec colwidth="5*" align="center"/>
41127 <colspec colwidth="5*" align="center"/>
41128 <colspec colwidth="6*" align="right"/>
41131 <entry><option>keepalive</option></entry>
41132 <entry>Use: <emphasis>smtp</emphasis></entry>
41133 <entry>Type: <emphasis>boolean</emphasis></entry>
41134 <entry>Default: <emphasis>true</emphasis></entry>
41140 <indexterm role="concept">
41141 <primary>keepalive</primary>
41142 <secondary>on outgoing connection</secondary>
41144 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
41145 connections. When set, it causes the kernel to probe idle connections
41146 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
41147 of the connection should send a acknowledgement if the connection is still okay
41148 or a reset if the connection has been aborted. The reason for doing this is
41149 that it has the beneficial effect of freeing up certain types of connection
41150 that can get stuck when the remote host is disconnected without tidying up the
41151 TCP/IP call properly. The keepalive mechanism takes several hours to detect
41155 <indexterm role="option">
41156 <primary>lmtp_ignore_quota</primary>
41159 <informaltable frame="all">
41160 <tgroup cols="4" colsep="0" rowsep="0">
41161 <colspec colwidth="8*" align="left"/>
41162 <colspec colwidth="5*" align="center"/>
41163 <colspec colwidth="5*" align="center"/>
41164 <colspec colwidth="6*" align="right"/>
41167 <entry><option>lmtp_ignore_quota</option></entry>
41168 <entry>Use: <emphasis>smtp</emphasis></entry>
41169 <entry>Type: <emphasis>boolean</emphasis></entry>
41170 <entry>Default: <emphasis>false</emphasis></entry>
41176 <indexterm role="concept">
41177 <primary>LMTP</primary>
41178 <secondary>ignoring quota errors</secondary>
41180 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
41181 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
41182 has advertised support for IGNOREQUOTA in its response to the LHLO command.
41185 <indexterm role="option">
41186 <primary>max_rcpt</primary>
41189 <informaltable frame="all">
41190 <tgroup cols="4" colsep="0" rowsep="0">
41191 <colspec colwidth="8*" align="left"/>
41192 <colspec colwidth="5*" align="center"/>
41193 <colspec colwidth="5*" align="center"/>
41194 <colspec colwidth="6*" align="right"/>
41197 <entry><option>max_rcpt</option></entry>
41198 <entry>Use: <emphasis>smtp</emphasis></entry>
41199 <entry>Type: <emphasis>integer</emphasis></entry>
41200 <entry>Default: <emphasis>100</emphasis></entry>
41206 <indexterm role="concept">
41207 <primary>RCPT</primary>
41208 <secondary>maximum number of outgoing</secondary>
41210 This option limits the number of RCPT commands that are sent in a single
41211 SMTP message transaction. Each set of addresses is treated independently, and
41212 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
41216 <indexterm role="option">
41217 <primary>multi_domain</primary>
41220 <informaltable frame="all">
41221 <tgroup cols="4" colsep="0" rowsep="0">
41222 <colspec colwidth="8*" align="left"/>
41223 <colspec colwidth="5*" align="center"/>
41224 <colspec colwidth="5*" align="center"/>
41225 <colspec colwidth="6*" align="right"/>
41228 <entry><option>multi_domain</option></entry>
41229 <entry>Use: <emphasis>smtp</emphasis></entry>
41230 <entry>Type: <emphasis>boolean</emphasis></entry>
41231 <entry>Default: <emphasis>true</emphasis></entry>
41237 <indexterm role="concept">
41238 <primary><varname>$domain</varname></primary>
41240 When this option is set, the <command>smtp</command> transport can handle a number of
41241 addresses containing a mixture of different domains provided they all resolve
41242 to the same list of hosts. Turning the option off restricts the transport to
41243 handling only one domain at a time. This is useful if you want to use
41244 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
41245 is a single domain involved in a remote delivery.
41248 <indexterm role="option">
41249 <primary>port</primary>
41252 <informaltable frame="all">
41253 <tgroup cols="4" colsep="0" rowsep="0">
41254 <colspec colwidth="8*" align="left"/>
41255 <colspec colwidth="5*" align="center"/>
41256 <colspec colwidth="5*" align="center"/>
41257 <colspec colwidth="6*" align="right"/>
41260 <entry><option>port</option></entry>
41261 <entry>Use: <emphasis>smtp</emphasis></entry>
41262 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
41263 <entry>Default: <emphasis>see below</emphasis></entry>
41269 <indexterm role="concept">
41270 <primary>port</primary>
41271 <secondary>sending TCP/IP</secondary>
41273 <indexterm role="concept">
41274 <primary>TCP/IP</primary>
41275 <secondary>setting outgoing port</secondary>
41277 This option specifies the TCP/IP port on the server to which Exim connects. If
41278 it begins with a digit it is taken as a port number; otherwise it is looked up
41279 using <function>getservbyname()</function>. The default value is normally <quote>smtp</quote>, but if
41280 <option>protocol</option> is set to <quote>lmtp</quote>, the default is <quote>lmtp</quote>.
41281 If the expansion fails, or if a port number cannot be found, delivery is
41285 <indexterm role="option">
41286 <primary>protocol</primary>
41289 <informaltable frame="all">
41290 <tgroup cols="4" colsep="0" rowsep="0">
41291 <colspec colwidth="8*" align="left"/>
41292 <colspec colwidth="5*" align="center"/>
41293 <colspec colwidth="5*" align="center"/>
41294 <colspec colwidth="6*" align="right"/>
41297 <entry><option>protocol</option></entry>
41298 <entry>Use: <emphasis>smtp</emphasis></entry>
41299 <entry>Type: <emphasis>string</emphasis></entry>
41300 <entry>Default: <emphasis>smtp</emphasis></entry>
41306 <indexterm role="concept">
41307 <primary>LMTP</primary>
41308 <secondary>over TCP/IP</secondary>
41310 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
41311 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
41312 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
41313 deliveries into closed message stores. Exim also has support for running LMTP
41314 over a pipe to a local process – see chapter <xref linkend="CHAPLMTP"/>.
41317 <indexterm role="option">
41318 <primary>retry_include_ip_address</primary>
41321 <informaltable frame="all">
41322 <tgroup cols="4" colsep="0" rowsep="0">
41323 <colspec colwidth="8*" align="left"/>
41324 <colspec colwidth="5*" align="center"/>
41325 <colspec colwidth="5*" align="center"/>
41326 <colspec colwidth="6*" align="right"/>
41329 <entry><option>retry_include_ip_address</option></entry>
41330 <entry>Use: <emphasis>smtp</emphasis></entry>
41331 <entry>Type: <emphasis>boolean</emphasis></entry>
41332 <entry>Default: <emphasis>true</emphasis></entry>
41338 Exim normally includes both the host name and the IP address in the key it
41339 constructs for indexing retry data after a temporary delivery failure. This
41340 means that when one of several IP addresses for a host is failing, it gets
41341 tried periodically (controlled by the retry rules), but use of the other IP
41342 addresses is not affected.
41345 However, in some dialup environments hosts are assigned a different IP address
41346 each time they connect. In this situation the use of the IP address as part of
41347 the retry key leads to undesirable behaviour. Setting this option false causes
41348 Exim to use only the host name. This should normally be done on a separate
41349 instance of the <command>smtp</command> transport, set up specially to handle the dialup
41353 <indexterm role="option">
41354 <primary>serialize_hosts</primary>
41357 <informaltable frame="all">
41358 <tgroup cols="4" colsep="0" rowsep="0">
41359 <colspec colwidth="8*" align="left"/>
41360 <colspec colwidth="5*" align="center"/>
41361 <colspec colwidth="5*" align="center"/>
41362 <colspec colwidth="6*" align="right"/>
41365 <entry><option>serialize_hosts</option></entry>
41366 <entry>Use: <emphasis>smtp</emphasis></entry>
41367 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
41368 <entry>Default: <emphasis>unset</emphasis></entry>
41374 <indexterm role="concept">
41375 <primary>serializing connections</primary>
41377 <indexterm role="concept">
41378 <primary>host</primary>
41379 <secondary>serializing connections</secondary>
41381 Because Exim operates in a distributed manner, if several messages for the same
41382 host arrive at around the same time, more than one simultaneous connection to
41383 the remote host can occur. This is not usually a problem except when there is a
41384 slow link between the hosts. In that situation it may be helpful to restrict
41385 Exim to one connection at a time. This can be done by setting
41386 <option>serialize_hosts</option> to match the relevant hosts.
41389 <indexterm role="concept">
41390 <primary>hints database</primary>
41391 <secondary>serializing deliveries to a host</secondary>
41393 Exim implements serialization by means of a hints database in which a record is
41394 written whenever a process connects to one of the restricted hosts. The record
41395 is deleted when the connection is completed. Obviously there is scope for
41396 records to get left lying around if there is a system or program crash. To
41397 guard against this, Exim ignores any records that are more than six hours old.
41400 If you set up this kind of serialization, you should also arrange to delete the
41401 relevant hints database whenever your system reboots. The names of the files
41402 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
41403 may be one or two files, depending on the type of DBM in use. The same files
41404 are used for ETRN serialization.
41407 <indexterm role="option">
41408 <primary>size_addition</primary>
41411 <informaltable frame="all">
41412 <tgroup cols="4" colsep="0" rowsep="0">
41413 <colspec colwidth="8*" align="left"/>
41414 <colspec colwidth="5*" align="center"/>
41415 <colspec colwidth="5*" align="center"/>
41416 <colspec colwidth="6*" align="right"/>
41419 <entry><option>size_addition</option></entry>
41420 <entry>Use: <emphasis>smtp</emphasis></entry>
41421 <entry>Type: <emphasis>integer</emphasis></entry>
41422 <entry>Default: <emphasis>1024</emphasis></entry>
41428 <indexterm role="concept">
41429 <primary>SMTP</primary>
41430 <secondary>SIZE</secondary>
41432 <indexterm role="concept">
41433 <primary>message</primary>
41434 <secondary>size issue for transport filter</secondary>
41436 <indexterm role="concept">
41437 <primary>size</primary>
41438 <secondary>of message</secondary>
41440 <indexterm role="concept">
41441 <primary>transport</primary>
41442 <secondary>filter</secondary>
41444 <indexterm role="concept">
41445 <primary>filter</primary>
41446 <secondary>transport filter</secondary>
41448 If a remote SMTP server indicates that it supports the SIZE option of the
41449 MAIL command, Exim uses this to pass over the message size at the start of
41450 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
41451 sends, to allow for headers and other text that may be added during delivery by
41452 configuration options or in a transport filter. It may be necessary to increase
41453 this if a lot of text is added to messages.
41456 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
41457 the use of the SIZE option altogether.
41460 <indexterm role="option">
41461 <primary>tls_certificate</primary>
41464 <informaltable frame="all">
41465 <tgroup cols="4" colsep="0" rowsep="0">
41466 <colspec colwidth="8*" align="left"/>
41467 <colspec colwidth="5*" align="center"/>
41468 <colspec colwidth="5*" align="center"/>
41469 <colspec colwidth="6*" align="right"/>
41472 <entry><option>tls_certificate</option></entry>
41473 <entry>Use: <emphasis>smtp</emphasis></entry>
41474 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
41475 <entry>Default: <emphasis>unset</emphasis></entry>
41481 <indexterm role="concept">
41482 <primary>TLS client certificate</primary>
41483 <secondary>location of</secondary>
41485 <indexterm role="concept">
41486 <primary>certificate for client</primary>
41487 <secondary>location of</secondary>
41489 <indexterm role="concept">
41490 <primary><varname>$host</varname></primary>
41492 <indexterm role="concept">
41493 <primary><varname>$host_address</varname></primary>
41495 The value of this option must be the absolute path to a file which contains the
41496 client’s certificate, for possible use when sending a message over an encrypted
41497 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
41498 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
41502 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
41503 certificate when sending messages as a client. The global option of the same
41504 name specifies the certificate for Exim as a server; it is not automatically
41505 assumed that the same certificate should be used when Exim is operating as a
41509 <indexterm role="option">
41510 <primary>tls_crl</primary>
41513 <informaltable frame="all">
41514 <tgroup cols="4" colsep="0" rowsep="0">
41515 <colspec colwidth="8*" align="left"/>
41516 <colspec colwidth="5*" align="center"/>
41517 <colspec colwidth="5*" align="center"/>
41518 <colspec colwidth="6*" align="right"/>
41521 <entry><option>tls_crl</option></entry>
41522 <entry>Use: <emphasis>smtp</emphasis></entry>
41523 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
41524 <entry>Default: <emphasis>unset</emphasis></entry>
41530 <indexterm role="concept">
41531 <primary>TLS</primary>
41532 <secondary>client certificate revocation list</secondary>
41534 <indexterm role="concept">
41535 <primary>certificate</primary>
41536 <secondary>revocation list for client</secondary>
41538 This option specifies a certificate revocation list. The expanded value must
41539 be the name of a file that contains a CRL in PEM format.
41542 <indexterm role="option">
41543 <primary>tls_privatekey</primary>
41546 <informaltable frame="all">
41547 <tgroup cols="4" colsep="0" rowsep="0">
41548 <colspec colwidth="8*" align="left"/>
41549 <colspec colwidth="5*" align="center"/>
41550 <colspec colwidth="5*" align="center"/>
41551 <colspec colwidth="6*" align="right"/>
41554 <entry><option>tls_privatekey</option></entry>
41555 <entry>Use: <emphasis>smtp</emphasis></entry>
41556 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
41557 <entry>Default: <emphasis>unset</emphasis></entry>
41563 <indexterm role="concept">
41564 <primary>TLS client private key</primary>
41565 <secondary>location of</secondary>
41567 <indexterm role="concept">
41568 <primary><varname>$host</varname></primary>
41570 <indexterm role="concept">
41571 <primary><varname>$host_address</varname></primary>
41573 The value of this option must be the absolute path to a file which contains the
41574 client’s private key. This is used when sending a message over an encrypted
41575 connection using a client certificate. The values of <varname>$host</varname> and
41576 <varname>$host_address</varname> are set to the name and address of the server during the
41577 expansion. If this option is unset, or the expansion is forced to fail, or the
41578 result is an empty string, the private key is assumed to be in the same file as
41579 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
41582 <indexterm role="option">
41583 <primary>tls_require_ciphers</primary>
41586 <informaltable frame="all">
41587 <tgroup cols="4" colsep="0" rowsep="0">
41588 <colspec colwidth="8*" align="left"/>
41589 <colspec colwidth="5*" align="center"/>
41590 <colspec colwidth="5*" align="center"/>
41591 <colspec colwidth="6*" align="right"/>
41594 <entry><option>tls_require_ciphers</option></entry>
41595 <entry>Use: <emphasis>smtp</emphasis></entry>
41596 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
41597 <entry>Default: <emphasis>unset</emphasis></entry>
41603 <indexterm role="concept">
41604 <primary>TLS</primary>
41605 <secondary>requiring specific ciphers</secondary>
41607 <indexterm role="concept">
41608 <primary>cipher</primary>
41609 <secondary>requiring specific</secondary>
41611 <indexterm role="concept">
41612 <primary><varname>$host</varname></primary>
41614 <indexterm role="concept">
41615 <primary><varname>$host_address</varname></primary>
41617 The value of this option must be a list of permitted cipher suites, for use
41618 when setting up an outgoing encrypted connection. (There is a global option of
41619 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
41620 <varname>$host_address</varname> are set to the name and address of the server during the
41621 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
41622 is used in different ways by OpenSSL and GnuTLS (see sections
41623 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
41624 ciphers is a preference order.
41627 <indexterm role="option">
41628 <primary>tls_tempfail_tryclear</primary>
41631 <informaltable frame="all">
41632 <tgroup cols="4" colsep="0" rowsep="0">
41633 <colspec colwidth="8*" align="left"/>
41634 <colspec colwidth="5*" align="center"/>
41635 <colspec colwidth="5*" align="center"/>
41636 <colspec colwidth="6*" align="right"/>
41639 <entry><option>tls_tempfail_tryclear</option></entry>
41640 <entry>Use: <emphasis>smtp</emphasis></entry>
41641 <entry>Type: <emphasis>boolean</emphasis></entry>
41642 <entry>Default: <emphasis>true</emphasis></entry>
41648 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
41649 setting up a TLS session, this option determines whether or not Exim should try
41650 to deliver the message unencrypted. If it is set false, delivery to the
41651 current host is deferred; if there are other hosts, they are tried. If this
41652 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
41653 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
41654 TLS negotiation fails, Exim closes the current connection (because it is in an
41655 unknown state), opens a new one to the same host, and then tries the delivery
41659 <indexterm role="option">
41660 <primary>tls_verify_certificates</primary>
41663 <informaltable frame="all">
41664 <tgroup cols="4" colsep="0" rowsep="0">
41665 <colspec colwidth="8*" align="left"/>
41666 <colspec colwidth="5*" align="center"/>
41667 <colspec colwidth="5*" align="center"/>
41668 <colspec colwidth="6*" align="right"/>
41671 <entry><option>tls_verify_certificates</option></entry>
41672 <entry>Use: <emphasis>smtp</emphasis></entry>
41673 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
41674 <entry>Default: <emphasis>unset</emphasis></entry>
41680 <indexterm role="concept">
41681 <primary>TLS</primary>
41682 <secondary>server certificate verification</secondary>
41684 <indexterm role="concept">
41685 <primary>certificate</primary>
41686 <secondary>verification of server</secondary>
41688 <indexterm role="concept">
41689 <primary><varname>$host</varname></primary>
41691 <indexterm role="concept">
41692 <primary><varname>$host_address</varname></primary>
41694 The value of this option must be the absolute path to a file containing
41695 permitted server certificates, for use when setting up an encrypted connection.
41696 Alternatively, if you are using OpenSSL, you can set
41697 <option>tls_verify_certificates</option> to the name of a directory containing certificate
41698 files. This does not work with GnuTLS; the option must be set to the name of a
41699 single file if you are using GnuTLS. The values of <varname>$host</varname> and
41700 <varname>$host_address</varname> are set to the name and address of the server during the
41701 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
41704 <section id="SECTvalhosmax">
41705 <title>How the limits for the number of hosts to try are used</title>
41707 <indexterm role="concept">
41708 <primary>host</primary>
41709 <secondary>maximum number to try</secondary>
41711 <indexterm role="concept">
41712 <primary>limit</primary>
41713 <secondary>hosts; maximum number tried</secondary>
41715 There are two options that are concerned with the number of hosts that are
41716 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
41717 <option>hosts_max_try_hardlimit</option>.
41720 The <option>hosts_max_try</option> option limits the number of hosts that are tried
41721 for a single delivery. However, despite the term <quote>host</quote> in its name, the
41722 option actually applies to each IP address independently. In other words, a
41723 multihomed host is treated as several independent hosts, just as it is for
41727 Many of the larger ISPs have multiple MX records which often point to
41728 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
41729 created as a result of routing one of these domains.
41732 Trying every single IP address on such a long list does not seem sensible; if
41733 several at the top of the list fail, it is reasonable to assume there is some
41734 problem that is likely to affect all of them. Roughly speaking, the value of
41735 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
41736 delivery. However, the logic cannot be quite that simple.
41739 Firstly, IP addresses that are skipped because their retry times have not
41740 arrived do not count, and in addition, addresses that are past their retry
41741 limits are also not counted, even when they are tried. This means that when
41742 some IP addresses are past their retry limits, more than the value of
41743 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
41744 that all IP addresses are considered before timing out an email address (but
41745 see below for an exception).
41748 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
41749 list to see if there is a subsequent host with a different (higher valued) MX.
41750 If there is, that host is considered next, and the current IP address is used
41751 but not counted. This behaviour helps in the case of a domain with a retry rule
41752 that hardly ever delays any hosts, as is now explained:
41755 Consider the case of a long list of hosts with one MX value, and a few with a
41756 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
41757 hosts at the top of the list are tried at first. With the default retry rule,
41758 which specifies increasing retry times, the higher MX hosts are eventually
41759 tried when those at the top of the list are skipped because they have not
41760 reached their retry times.
41763 However, it is common practice to put a fixed short retry time on domains for
41764 large ISPs, on the grounds that their servers are rarely down for very long.
41765 Unfortunately, these are exactly the domains that tend to resolve to long lists
41766 of hosts. The short retry time means that the lowest MX hosts are tried every
41767 time. The attempts may be in a different order because of random sorting, but
41768 without the special MX check, the higher MX hosts would never be tried until
41769 all the lower MX hosts had timed out (which might be several days), because
41770 there are always some lower MX hosts that have reached their retry times. With
41771 the special check, Exim considers at least one IP address from each MX value at
41772 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
41776 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
41777 particular, Exim normally eventually tries all the IP addresses before timing
41778 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
41779 reasonable thing to do. Recently, however, some lunatic DNS configurations have
41780 been set up with hundreds of IP addresses for some domains. It can
41781 take a very long time indeed for an address to time out in these cases.
41784 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
41785 Exim never tries more than this number of IP addresses; if it hits this limit
41786 and they are all timed out, the email address is bounced, even though not all
41787 possible IP addresses have been tried.
41788 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
41789 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
41794 <chapter id="CHAPrewrite">
41795 <title>Address rewriting</title>
41797 <indexterm role="concept" id="IIDaddrew" class="startofrange">
41798 <primary>rewriting</primary>
41799 <secondary>addresses</secondary>
41801 There are some circumstances in which Exim automatically rewrites domains in
41802 addresses. The two most common are when an address is given without a domain
41803 (referred to as an <quote>unqualified address</quote>) or when an address contains an
41804 abbreviated domain that is expanded by DNS lookup.
41807 Unqualified envelope addresses are accepted only for locally submitted
41808 messages, or for messages that are received from hosts matching
41809 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
41810 appropriate. Unqualified addresses in header lines are qualified if they are in
41811 locally submitted messages, or messages from hosts that are permitted to send
41812 unqualified envelope addresses. Otherwise, unqualified addresses in header
41813 lines are neither qualified nor rewritten.
41816 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
41817 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
41818 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
41819 do this. The new RFCs do not contain this suggestion.
41822 <title>Explicitly configured address rewriting</title>
41824 This chapter describes the rewriting rules that can be used in the
41825 main rewrite section of the configuration file, and also in the generic
41826 <option>headers_rewrite</option> option that can be set on any transport.
41829 Some people believe that configured address rewriting is a Mortal Sin.
41830 Others believe that life is not possible without it. Exim provides the
41831 facility; you do not have to use it.
41834 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
41835 configuration file are applied to addresses in incoming messages, both envelope
41836 addresses and addresses in header lines. Each rule specifies the types of
41837 address to which it applies.
41839 <para revisionflag="changed">
41840 Whether or not addresses in header lines are rewritten depends on the origin of
41841 the headers and the type of rewriting. Global rewriting, that is, rewriting
41842 rules from the rewrite section of the configuration file, is applied only to
41843 those headers that were received with the message. Header lines that are added
41844 by ACLs or by a system filter or by individual routers or transports (which
41845 are specific to individual recipient addresses) are not rewritten by the global
41848 <para revisionflag="changed">
41849 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
41850 applies all headers except those added by routers and transports. That is, as
41851 well as the headers that were received with the message, it also applies to
41852 headers that were added by an ACL or a system filter.
41855 In general, rewriting addresses from your own system or domain has some
41856 legitimacy. Rewriting other addresses should be done only with great care and
41857 in special circumstances. The author of Exim believes that rewriting should be
41858 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
41859 Although it can sometimes be used as a routing tool, this is very strongly
41863 There are two commonly encountered circumstances where rewriting is used, as
41864 illustrated by these examples:
41869 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
41870 exchange mail with each other behind a firewall, but there is only a single
41871 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
41872 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
41877 A host rewrites the local parts of its own users so that, for example,
41878 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
41884 <title>When does rewriting happen?</title>
41886 <indexterm role="concept">
41887 <primary>rewriting</primary>
41888 <secondary>timing of</secondary>
41890 <indexterm role="concept">
41891 <primary>access control lists (ACLs)</primary>
41892 <secondary>rewriting addresses in</secondary>
41894 Configured address rewriting can take place at several different stages of a
41895 message’s processing.
41898 <indexterm role="concept">
41899 <primary><varname>$sender_address</varname></primary>
41901 At the start of an ACL for MAIL, the sender address may have been rewritten
41902 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
41903 ordinary rewrite rules have yet been applied. If, however, the sender address
41904 is verified in the ACL, it is rewritten before verification, and remains
41905 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
41906 rewritten address. This also applies if sender verification happens in a
41907 RCPT ACL. Otherwise, when the sender address is not verified, it is
41908 rewritten as soon as a message’s header lines have been received.
41911 <indexterm role="concept">
41912 <primary><varname>$domain</varname></primary>
41914 <indexterm role="concept">
41915 <primary><varname>$local_part</varname></primary>
41917 Similarly, at the start of an ACL for RCPT, the current recipient’s address
41918 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
41919 rewrite rules have yet been applied to it. However, the behaviour is different
41920 from the sender address when a recipient is verified. The address is rewritten
41921 for the verification, but the rewriting is not remembered at this stage. The
41922 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
41923 as they were before (that is, they contain the unrewritten – except for
41924 SMTP-time rewriting – address).
41927 As soon as a message’s header lines have been received, all the envelope
41928 recipient addresses are permanently rewritten, and rewriting is also applied to
41929 the addresses in the header lines (if configured). This happens before adding
41930 any header lines that were specified in MAIL or RCPT ACLs, and
41931 <indexterm role="concept">
41932 <primary><function>local_scan()</function> function</primary>
41933 <secondary>address rewriting; timing of</secondary>
41935 before the DATA ACL and <function>local_scan()</function> functions are run.
41938 When an address is being routed, either for delivery or for verification,
41939 rewriting is applied immediately to child addresses that are generated by
41940 redirection, unless <option>no_rewrite</option> is set on the router.
41943 <indexterm role="concept">
41944 <primary>envelope sender</primary>
41945 <secondary>rewriting at transport time</secondary>
41947 <indexterm role="concept">
41948 <primary>rewriting</primary>
41949 <secondary>at transport time</secondary>
41951 <indexterm role="concept">
41952 <primary>header lines</primary>
41953 <secondary>rewriting at transport time</secondary>
41955 At transport time, additional rewriting of addresses in header lines can be
41956 specified by setting the generic <option>headers_rewrite</option> option on a transport.
41957 This option contains rules that are identical in form to those in the rewrite
41958 section of the configuration file. They are applied to the original message
41959 header lines and any that were added by ACLs or a system filter. They are not
41960 applied to header lines that are added by routers or the transport.
41963 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
41964 transport option. However, it is not possible to rewrite envelope recipients at
41969 <title>Testing the rewriting rules that apply on input</title>
41971 <indexterm role="concept">
41972 <primary>rewriting</primary>
41973 <secondary>testing</secondary>
41975 <indexterm role="concept">
41976 <primary>testing</primary>
41977 <secondary>rewriting</secondary>
41979 Exim’s input rewriting configuration appears in a part of the run time
41980 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
41981 <option>-brw</option> command line option. This takes an address (which can be a full RFC
41982 2822 address) as its argument. The output is a list of how the address would be
41983 transformed by the rewriting rules for each of the different places it might
41984 appear in an incoming message, that is, for each different header and for the
41985 envelope sender and recipient fields. For example,
41987 <literallayout class="monospaced">
41988 exim -brw ph10@exim.workshop.example
41991 might produce the output
41993 <literallayout class="monospaced">
41994 sender: Philip.Hazel@exim.workshop.example
41995 from: Philip.Hazel@exim.workshop.example
41996 to: ph10@exim.workshop.example
41997 cc: ph10@exim.workshop.example
41998 bcc: ph10@exim.workshop.example
41999 reply-to: Philip.Hazel@exim.workshop.example
42000 env-from: Philip.Hazel@exim.workshop.example
42001 env-to: ph10@exim.workshop.example
42004 which shows that rewriting has been set up for that address when used in any of
42005 the source fields, but not when it appears as a recipient address. At the
42006 present time, there is no equivalent way of testing rewriting rules that are
42007 set for a particular transport.
42011 <title>Rewriting rules</title>
42013 <indexterm role="concept">
42014 <primary>rewriting</primary>
42015 <secondary>rules</secondary>
42017 The rewrite section of the configuration file consists of lines of rewriting
42021 <<emphasis>source pattern</emphasis>> <<emphasis>replacement</emphasis>> <<emphasis>flags</emphasis>>
42024 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
42025 transport option are given as a colon-separated list. Each item in the list
42026 takes the same form as a line in the main rewriting configuration (except that
42027 any colons must be doubled, of course).
42030 The formats of source patterns and replacement strings are described below.
42031 Each is terminated by white space, unless enclosed in double quotes, in which
42032 case normal quoting conventions apply inside the quotes. The flags are single
42033 characters which may appear in any order. Spaces and tabs between them are
42037 For each address that could potentially be rewritten, the rules are scanned in
42038 order, and replacements for the address from earlier rules can themselves be
42039 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
42042 The order in which addresses are rewritten is undefined, may change between
42043 releases, and must not be relied on, with one exception: when a message is
42044 received, the envelope sender is always rewritten first, before any header
42045 lines are rewritten. For example, the replacement string for a rewrite of an
42046 address in <emphasis>To:</emphasis> must not assume that the message’s address in <emphasis>From:</emphasis> has
42047 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
42048 that the envelope sender has already been rewritten.
42051 <indexterm role="concept">
42052 <primary><varname>$domain</varname></primary>
42054 <indexterm role="concept">
42055 <primary><varname>$local_part</varname></primary>
42057 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
42058 string to refer to the address that is being rewritten. Note that lookup-driven
42059 rewriting can be done by a rule of the form
42061 <literallayout class="monospaced">
42065 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
42066 refer to the address that is being rewritten.
42070 <title>Rewriting patterns</title>
42072 <indexterm role="concept">
42073 <primary>rewriting</primary>
42074 <secondary>patterns</secondary>
42076 <indexterm role="concept">
42077 <primary>address list</primary>
42078 <secondary>in a rewriting pattern</secondary>
42080 The source pattern in a rewriting rule is any item which may appear in an
42081 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
42082 single-item address list, which means that it is expanded before being tested
42083 against the address. As always, if you use a regular expression as a pattern,
42084 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
42085 facility to suppress string expansion within the regular expression.
42088 Domains in patterns should be given in lower case. Local parts in patterns are
42089 case-sensitive. If you want to do case-insensitive matching of local parts, you
42090 can use a regular expression that starts with <literal>^(?i)</literal>.
42093 <indexterm role="concept">
42094 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
42095 <secondary>in rewriting rules</secondary>
42097 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
42098 depending on the type of match which occurred. These can be used in the
42099 replacement string to insert portions of the incoming address. <varname>$0</varname> always
42100 refers to the complete incoming address. When a regular expression is used, the
42101 numerical variables are set from its capturing subexpressions. For other types
42102 of pattern they are set as follows:
42107 If a local part or domain starts with an asterisk, the numerical variables
42108 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
42109 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
42112 <literallayout class="monospaced">
42113 *queen@*.fict.example
42116 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
42118 <literallayout class="monospaced">
42119 $0 = hearts-queen@wonderland.fict.example
42124 Note that if the local part does not start with an asterisk, but the domain
42125 does, it is <varname>$1</varname> that contains the wild part of the domain.
42130 If the domain part of the pattern is a partial lookup, the wild and fixed parts
42131 of the domain are placed in the next available numerical variables. Suppose,
42132 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
42133 rewriting rule of the form
42136 <literal>*@partial-dbm;/some/dbm/file</literal> <<emphasis>replacement string</emphasis>>
42139 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
42141 <literallayout class="monospaced">
42147 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
42148 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
42149 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
42150 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
42151 whole domain. For non-partial domain lookups, no numerical variables are set.
42157 <title>Rewriting replacements</title>
42159 <indexterm role="concept">
42160 <primary>rewriting</primary>
42161 <secondary>replacements</secondary>
42163 If the replacement string for a rule is a single asterisk, addresses that
42164 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
42165 rewriting rules are scanned. For example,
42167 <literallayout class="monospaced">
42168 hatta@lookingglass.fict.example * f
42171 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
42172 <emphasis>From:</emphasis> headers.
42175 <indexterm role="concept">
42176 <primary><varname>$domain</varname></primary>
42178 <indexterm role="concept">
42179 <primary><varname>$local_part</varname></primary>
42181 If the replacement string is not a single asterisk, it is expanded, and must
42182 yield a fully qualified address. Within the expansion, the variables
42183 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
42184 Any letters they contain retain their original case – they are not lower
42185 cased. The numerical variables are set up according to the type of pattern that
42186 matched the address, as described above. If the expansion is forced to fail by
42187 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
42188 current rule is abandoned, but subsequent rules may take effect. Any other
42189 expansion failure causes the entire rewriting operation to be abandoned, and an
42190 entry written to the panic log.
42194 <title>Rewriting flags</title>
42196 There are three different kinds of flag that may appear on rewriting rules:
42201 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
42207 A flag that specifies rewriting at SMTP time: S.
42212 Flags that control the rewriting process: Q, q, R, w.
42217 For rules that are part of the <option>headers_rewrite</option> generic transport option,
42218 E, F, T, and S are not permitted.
42222 <title>Flags specifying which headers and envelope addresses to rewrite</title>
42224 <indexterm role="concept">
42225 <primary>rewriting</primary>
42226 <secondary>flags</secondary>
42228 If none of the following flag letters, nor the <quote>S</quote> flag (see section
42229 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
42230 and to both the sender and recipient fields of the envelope, whereas a
42231 transport-time rewriting rule just applies to all headers. Otherwise, the
42232 rewriting rule is skipped unless the relevant addresses are being processed.
42235 <literal>E</literal> rewrite all envelope fields
42236 <literal>F</literal> rewrite the envelope From field
42237 <literal>T</literal> rewrite the envelope To field
42238 <literal>b</literal> rewrite the <emphasis>Bcc:</emphasis> header
42239 <literal>c</literal> rewrite the <emphasis>Cc:</emphasis> header
42240 <literal>f</literal> rewrite the <emphasis>From:</emphasis> header
42241 <literal>h</literal> rewrite all headers
42242 <literal>r</literal> rewrite the <emphasis>Reply-To:</emphasis> header
42243 <literal>s</literal> rewrite the <emphasis>Sender:</emphasis> header
42244 <literal>t</literal> rewrite the <emphasis>To:</emphasis> header
42247 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
42248 restrict this to special known cases in your own domains.
42251 <section id="SECTrewriteS">
42252 <title>The SMTP-time rewriting flag</title>
42254 <indexterm role="concept">
42255 <primary>SMTP</primary>
42256 <secondary>rewriting malformed addresses</secondary>
42258 <indexterm role="concept">
42259 <primary>RCPT</primary>
42260 <secondary>rewriting argument of</secondary>
42262 <indexterm role="concept">
42263 <primary>MAIL</primary>
42264 <secondary>rewriting argument of</secondary>
42266 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
42267 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
42268 before any other processing; even before syntax checking. The pattern is
42269 required to be a regular expression, and it is matched against the whole of the
42270 data for the command, including any surrounding angle brackets.
42273 <indexterm role="concept">
42274 <primary><varname>$domain</varname></primary>
42276 <indexterm role="concept">
42277 <primary><varname>$local_part</varname></primary>
42279 This form of rewrite rule allows for the handling of addresses that are not
42280 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
42281 input). Because the input is not required to be a syntactically valid address,
42282 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
42283 expansion of the replacement string. The result of rewriting replaces the
42284 original address in the MAIL or RCPT command.
42288 <title>Flags controlling the rewriting process</title>
42290 There are four flags which control the way the rewriting process works. These
42291 take effect only when a rule is invoked, that is, when the address is of the
42292 correct type (matches the flags) and matches the pattern:
42297 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
42298 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
42299 absence of <quote>Q</quote> the rewritten address must always include a domain.
42304 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
42305 even if no rewriting actually takes place because of a <quote>fail</quote> in the
42306 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
42307 (does not match the flags) or does not match the pattern.
42312 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
42313 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
42314 rewriting once it fails to match (after at least one successful rewrite).
42319 <indexterm role="concept">
42320 <primary>rewriting</primary>
42321 <secondary>whole addresses</secondary>
42323 When an address in a header is rewritten, the rewriting normally applies only
42324 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
42325 left unchanged. For example, rewriting might change
42327 <literallayout class="monospaced">
42328 From: Ford Prefect <fp42@restaurant.hitch.fict.example>
42333 <literallayout class="monospaced">
42334 From: Ford Prefect <prefectf@hitch.fict.example>
42337 <indexterm role="concept">
42338 <primary>RFC 2047</primary>
42340 Sometimes there is a need to replace the whole address item, and this can be
42341 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
42342 causes an address in a header line to be rewritten, the entire address is
42343 replaced, not just the working part. The replacement must be a complete RFC
42344 2822 address, including the angle brackets if necessary. If text outside angle
42345 brackets contains a character whose value is greater than 126 or less than 32
42346 (except for tab), the text is encoded according to RFC 2047. The character set
42347 is taken from <option>headers_charset</option>, which defaults to ISO-8859-1.
42350 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
42351 rewritten, all but the working part of the replacement address is discarded.
42357 <title>Rewriting examples</title>
42359 Here is an example of the two common rewriting paradigms:
42361 <literallayout class="monospaced">
42362 *@*.hitch.fict.example $1@hitch.fict.example
42363 *@hitch.fict.example ${lookup{$1}dbm{/etc/realnames}\
42364 {$value}fail}@hitch.fict.example bctfrF
42367 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
42368 the string expansion to fail if the lookup does not succeed. In this context it
42369 has the effect of leaving the original address unchanged, but Exim goes on to
42370 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
42371 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
42372 explicitly, which would cause the rewritten address to be the same as before,
42373 at the cost of a small bit of processing. Not supplying either of these is an
42374 error, since the rewritten address would then contain no local part.
42377 The first example above replaces the domain with a superior, more general
42378 domain. This may not be desirable for certain local parts. If the rule
42380 <literallayout class="monospaced">
42381 root@*.hitch.fict.example *
42384 were inserted before the first rule, rewriting would be suppressed for the
42385 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
42388 Rewriting can be made conditional on a number of tests, by making use of
42389 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
42390 messages that originate outside the local host:
42392 <literallayout class="monospaced">
42393 *@*.hitch.fict.example "${if !eq {$sender_host_address}{}\
42394 {$1@hitch.fict.example}fail}"
42397 The replacement string is quoted in this example because it contains white
42401 <indexterm role="concept">
42402 <primary>rewriting</primary>
42403 <secondary>bang paths</secondary>
42405 <indexterm role="concept">
42406 <primary>bang paths</primary>
42407 <secondary>rewriting</secondary>
42409 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
42410 an address it treats it as an unqualified local part which it qualifies with
42411 the local qualification domain (if the source of the message is local or if the
42412 remote host is permitted to send unqualified addresses). Rewriting can
42413 sometimes be used to handle simple bang paths with a fixed number of
42414 components. For example, the rule
42416 <literallayout class="monospaced">
42417 \N^([^!]+)!(.*)@your.domain.example$\N $2@$1
42420 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
42421 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
42422 a global rewriting rule for envelope addresses. It can provide a backdoor
42423 method for using your system as a relay, because the incoming addresses appear
42424 to be local. If the bang path addresses are received via SMTP, it is safer to
42425 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
42426 can be done on the rewritten addresses.
42427 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
42432 <chapter id="CHAPretry">
42433 <title>Retry configuration</title>
42435 <indexterm role="concept" id="IIDretconf1" class="startofrange">
42436 <primary>retry configuration</primary>
42437 <secondary>description of</secondary>
42439 <indexterm role="concept" id="IIDregconf2" class="startofrange">
42440 <primary>configuration file</primary>
42441 <secondary>retry section</secondary>
42443 The <quote>retry</quote> section of the run time configuration file contains a list of
42444 retry rules that control how often Exim tries to deliver messages that cannot
42445 be delivered at the first attempt. If there are no retry rules, temporary
42446 errors are treated as permanent. The <option>-brt</option> command line option can be used
42447 to test which retry rule will be used for a given address, domain and error.
42450 The most common cause of retries is temporary failure to deliver to a remote
42451 host because the host is down, or inaccessible because of a network problem.
42452 Exim’s retry processing in this case is applied on a per-host (strictly, per IP
42453 address) basis, not on a per-message basis. Thus, if one message has recently
42454 been delayed, delivery of a new message to the same host is not immediately
42455 tried, but waits for the host’s retry time to arrive. If the <option>retry_defer</option>
42456 log selector is set, the message
42457 <indexterm role="concept">
42458 <primary>retry</primary>
42459 <secondary>time not reached</secondary>
42461 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
42462 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
42463 the handling of errors during remote deliveries.
42466 Retry processing applies to routing as well as to delivering, except as covered
42467 in the next paragraph. The retry rules do not distinguish between these
42468 actions. It is not possible, for example, to specify different behaviour for
42469 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
42470 the host <emphasis>snark.fict.example</emphasis>. I didn’t think anyone would ever need this
42471 added complication, so did not implement it. However, although they share the
42472 same retry rule, the actual retry times for routing and transporting a given
42473 domain are maintained independently.
42476 When a delivery is not part of a queue run (typically an immediate delivery on
42477 receipt of a message), the routers are always run, and local deliveries are
42478 always attempted, even if retry times are set for them. This makes for better
42479 behaviour if one particular message is causing problems (for example, causing
42480 quota overflow, or provoking an error in a filter file). If such a delivery
42481 suffers a temporary failure, the retry data is updated as normal, and
42482 subsequent delivery attempts from queue runs occur only when the retry time for
42483 the local address is reached.
42485 <section revisionflag="changed">
42486 <title>Changing retry rules</title>
42487 <para revisionflag="changed">
42488 If you change the retry rules in your configuration, you should consider
42489 whether or not to delete the retry data that is stored in Exim’s spool area in
42490 files with names like <filename>db/retry</filename>. Deleting any of Exim’s hints files is
42491 always safe; that is why they are called <quote>hints</quote>.
42493 <para revisionflag="changed">
42494 The hints retry data contains suggested retry times based on the previous
42495 rules. In the case of a long-running problem with a remote host, it might
42496 record the fact that the host has timed out. If your new rules increase the
42497 timeout time for such a host, you should definitely remove the old retry data
42498 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
42499 messages that it should now be retaining.
42503 <title>Format of retry rules</title>
42505 <indexterm role="concept">
42506 <primary>retry</primary>
42507 <secondary>rules</secondary>
42509 Each retry rule occupies one line and consists of three or four parts,
42510 separated by white space: a pattern, an error name, an optional list of sender
42511 addresses, and a list of retry parameters. The pattern and sender lists must be
42512 enclosed in double quotes if they contain white space. The rules are searched
42513 in order until one is found where the pattern, error name, and sender list (if
42514 present) match the failing host or address, the error that occurred, and the
42515 message’s sender, respectively.
42518 The pattern is any single item that may appear in an address list (see section
42519 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
42520 which means that it is expanded before being tested against the address that
42521 has been delayed. <phrase revisionflag="changed">A negated address list item is permitted.</phrase> Address
42522 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
42523 which makes it possible for many retry rules to start with just a domain. For
42526 <literallayout class="monospaced">
42527 lookingglass.fict.example * F,24h,30m;
42530 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
42533 <literallayout class="monospaced">
42534 alice@lookingglass.fict.example * F,24h,30m;
42537 applies only to temporary failures involving the local part <option>alice</option>.
42538 In practice, almost all rules start with a domain name pattern without a local
42542 <indexterm role="concept">
42543 <primary>regular expressions</primary>
42544 <secondary>in retry rules</secondary>
42546 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a routing rule pattern, it
42547 must match a complete address, not just a domain, because that is how regular
42548 expressions work in address lists.
42551 <literal>^\Nxyz\d+\.abc\.example$\N * G,1h,10m,2</literal> <option>Wrong</option>
42552 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N * G,1h,10m,2</literal> <option>Right</option>
42556 <title>Choosing which retry rule to use for address errors</title>
42558 When Exim is looking for a retry rule after a routing attempt has failed (for
42559 example, after a DNS timeout), each line in the retry configuration is tested
42560 against the complete address only if <option>retry_use_local_part</option> is set for the
42561 router. Otherwise, only the domain is used, except when matching against a
42562 regular expression, when the local part of the address is replaced with <quote>*</quote>.
42563 A domain on its own can match a domain pattern, or a pattern that starts with
42564 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
42565 <option>check_local_user</option> is true, and false for other routers.
42568 Similarly, when Exim is looking for a retry rule after a local delivery has
42569 failed (for example, after a mailbox full error), each line in the retry
42570 configuration is tested against the complete address only if
42571 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
42575 However, when Exim is looking for a retry rule after a remote delivery attempt
42576 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
42577 whole address is always used as the key when searching the retry rules. The
42578 rule that is found is used to create a retry time for the failing address.
42582 <title>Choosing which retry rule to use for host and message errors</title>
42584 For a temporary error that is not related to an individual address (for
42585 example, a connection timeout), each line in the retry configuration is checked
42586 twice. First, the name of the remote host is used as a domain name (preceded by
42587 <quote>*@</quote> when matching a regular expression). If this does not match the line,
42588 the domain from the email address is tried in a similar fashion. For example,
42589 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
42591 <literallayout class="monospaced">
42592 a.b.c.example MX 5 x.y.z.example
42597 and the retry rules are
42599 <literallayout class="monospaced">
42600 p.q.r.example * F,24h,30m;
42601 a.b.c.example * F,4d,45m;
42604 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
42605 first rule matches neither the host nor the domain, so Exim looks at the second
42606 rule. This does not match the host, but it does match the domain, so it is used
42607 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
42608 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
42609 first retry rule is used, because it matches the host.
42612 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
42613 first rule to determine retry times, but for all the other hosts for the domain
42614 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
42615 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
42618 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
42619 However, if a message is routed directly to an IP address without the use of a
42620 host name, for example, if a <command>manualroute</command> router contains a setting such as:
42622 <literallayout class="monospaced">
42623 route_list = *.a.example 192.168.34.23
42626 then the <quote>host name</quote> that is used when searching for a retry rule is the
42627 textual form of the IP address.
42631 <title>Retry rules for specific errors</title>
42633 <indexterm role="concept">
42634 <primary>retry</primary>
42635 <secondary>specific errors; specifying</secondary>
42637 The second field in a retry rule is the name of a particular error, or an
42638 asterisk, which matches any error. The errors that can be tested for are:
42642 <term><option>auth_failed</option></term>
42645 Authentication failed when trying to send to a host in the
42646 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
42648 </listitem></varlistentry>
42650 <term><option>data_4xx</option></term>
42653 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
42654 after the command, or after sending the message’s data.
42656 </listitem></varlistentry>
42658 <term><option>mail_4xx</option></term>
42661 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
42663 </listitem></varlistentry>
42665 <term><option>rcpt_4xx</option></term>
42668 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
42670 </listitem></varlistentry>
42673 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x’s can be given
42674 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
42675 recognize 452 errors given to RCPT commands for addresses in a certain domain,
42676 and have retries every ten minutes with a one-hour timeout, you could set up a
42677 retry rule of this form:
42679 <literallayout class="monospaced">
42680 the.domain.name rcpt_452 F,1h,10m
42683 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
42684 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
42688 <term><option>lost_connection</option></term>
42691 A server unexpectedly closed the SMTP connection. There may, of course,
42692 legitimate reasons for this (host died, network died), but if it repeats a lot
42693 for the same host, it indicates something odd.
42695 </listitem></varlistentry>
42697 <term><option>refused_MX</option></term>
42700 A connection to a host obtained from an MX record was refused.
42702 </listitem></varlistentry>
42704 <term><option>refused_A</option></term>
42707 A connection to a host not obtained from an MX record was refused.
42709 </listitem></varlistentry>
42711 <term><option>refused</option></term>
42714 A connection was refused.
42716 </listitem></varlistentry>
42718 <term><option>timeout_connect_MX</option></term>
42721 A connection attempt to a host obtained from an MX record timed out.
42723 </listitem></varlistentry>
42725 <term><option>timeout_connect_A</option></term>
42728 A connection attempt to a host not obtained from an MX record timed out.
42730 </listitem></varlistentry>
42732 <term><option>timeout_connect</option></term>
42735 A connection attempt timed out.
42737 </listitem></varlistentry>
42739 <term><option>timeout_MX</option></term>
42742 There was a timeout while connecting or during an SMTP session with a host
42743 obtained from an MX record.
42745 </listitem></varlistentry>
42747 <term><option>timeout_A</option></term>
42750 There was a timeout while connecting or during an SMTP session with a host not
42751 obtained from an MX record.
42753 </listitem></varlistentry>
42755 <term><option>timeout</option></term>
42758 There was a timeout while connecting or during an SMTP session.
42760 </listitem></varlistentry>
42762 <term><option>tls_required</option></term>
42765 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
42766 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
42767 to STARTTLS, or there was a problem setting up the TLS connection.
42769 </listitem></varlistentry>
42771 <term><option>quota</option></term>
42774 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
42777 </listitem></varlistentry>
42779 <term><option>quota_</option><<emphasis>time</emphasis>></term>
42782 <indexterm role="concept">
42783 <primary>quota</primary>
42784 <secondary>error testing in retry rule</secondary>
42786 <indexterm role="concept">
42787 <primary>retry</primary>
42788 <secondary>quota error testing</secondary>
42790 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
42791 transport, and the mailbox has not been accessed for <<emphasis>time</emphasis>>. For example,
42792 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
42795 </listitem></varlistentry>
42798 <indexterm role="concept">
42799 <primary>mailbox</primary>
42800 <secondary>time of last read</secondary>
42802 The idea of <option>quota_</option><<emphasis>time</emphasis>> is to make it possible to have shorter
42803 timeouts when the mailbox is full and is not being read by its owner. Ideally,
42804 it should be based on the last time that the user accessed the mailbox.
42805 However, it is not always possible to determine this. Exim uses the following
42811 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
42812 used. As no new messages are being delivered (because the mailbox is over
42813 quota), Exim does not access the file, so this is the time of last user access.
42818 <indexterm role="concept">
42819 <primary>maildir format</primary>
42820 <secondary>time of last read</secondary>
42822 For a maildir delivery, the time of last modification of the <filename>new</filename>
42823 subdirectory is used. As the mailbox is over quota, no new files are created in
42824 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
42825 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
42826 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
42827 time that is used is therefore the last time that the user read a new message.
42832 For other kinds of multi-file mailbox, the time of last access cannot be
42833 obtained, so a retry rule that uses this type of error field is never matched.
42838 The quota errors apply both to system-enforced quotas and to Exim’s own quota
42839 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
42840 when a local delivery is deferred because a partition is full (the ENOSPC
42845 <title>Retry rules for specified senders</title>
42847 <indexterm role="concept">
42848 <primary>retry</primary>
42849 <secondary>rules; sender-specific</secondary>
42851 You can specify retry rules that apply only when the failing message has a
42852 specific sender. In particular, this can be used to define retry rules that
42853 apply only to bounce messages. The third item in a retry rule can be of this
42857 <literal>senders=</literal><<emphasis>address list</emphasis>>
42860 The retry timings themselves are then the fourth item. For example:
42862 <literallayout class="monospaced">
42863 * rcpt_4xx senders=: F,1h,30m
42866 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
42867 host. If the address list contains white space, it must be enclosed in quotes.
42870 <literallayout class="monospaced">
42871 a.domain rcpt_452 senders="xb.dom : yc.dom" G,8h,10m,1.5
42874 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
42875 (which do not depend on the recipient). The reason is that the sender is used
42876 only to match the retry rule. Once the rule has been found for a host error,
42877 its contents are used to set a retry time for the host, and this will apply to
42878 all messages, not just those with specific senders.
42881 When testing retry rules using <option>-brt</option>, you can supply a sender using the
42882 <option>-f</option> command line option, like this:
42884 <literallayout class="monospaced">
42885 exim -f "" -brt user@dom.ain
42888 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
42889 list is never matched.
42893 <title>Retry parameters</title>
42895 <indexterm role="concept">
42896 <primary>retry</primary>
42897 <secondary>parameters in rules</secondary>
42899 The third (or fourth, if a senders list is present) field in a retry rule is a
42900 sequence of retry parameter sets, separated by semicolons. Each set consists of
42903 <<emphasis>letter</emphasis>>,<<emphasis>cutoff time</emphasis>>,<<emphasis>arguments</emphasis>>
42906 The letter identifies the algorithm for computing a new retry time; the cutoff
42907 time is the time beyond which this algorithm no longer applies, and the
42908 arguments vary the algorithm’s action. The cutoff time is measured from the
42909 time that the first failure for the domain (combined with the local part if
42910 relevant) was detected, not from the time the message was received.
42913 <indexterm role="concept">
42914 <primary>retry</primary>
42915 <secondary>algorithms</secondary>
42917 <indexterm role="concept">
42918 <primary>retry</primary>
42919 <secondary>fixed intervals</secondary>
42921 <indexterm role="concept">
42922 <primary>retry</primary>
42923 <secondary>increasing intervals</secondary>
42925 <indexterm role="concept">
42926 <primary>retry</primary>
42927 <secondary>random intervals</secondary>
42929 The available algorithms are:
42934 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
42940 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
42941 specifies a starting value for the interval, and the second a multiplier, which
42942 is used to increase the size of the interval at each retry.
42947 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
42948 retry, the previous interval is multiplied by the factor in order to get a
42949 maximum for the next interval. The mininum interval is the first argument of
42950 the parameter, and an actual interval is chosen randomly between them. Such a
42951 rule has been found to be helpful in cluster configurations when all the
42952 members of the cluster restart at once, and may therefore synchronize their
42953 queue processing times.
42958 When computing the next retry time, the algorithm definitions are scanned in
42959 order until one whose cutoff time has not yet passed is reached. This is then
42960 used to compute a new retry time that is later than the current time. In the
42961 case of fixed interval retries, this simply means adding the interval to the
42962 current time. For geometrically increasing intervals, retry intervals are
42963 computed from the rule’s parameters until one that is greater than the previous
42964 interval is found. The main configuration variable
42965 <indexterm role="concept">
42966 <primary>limit</primary>
42967 <secondary>retry interval</secondary>
42969 <indexterm role="concept">
42970 <primary>retry interval</primary>
42971 <secondary>maximum</secondary>
42973 <indexterm role="concept">
42974 <primary><option>retry_interval_max</option></primary>
42976 <option>retry_interval_max</option> limits the maximum interval between retries. It
42977 cannot be set greater than <literal>24h</literal>, which is its default value.
42980 A single remote domain may have a number of hosts associated with it, and each
42981 host may have more than one IP address. Retry algorithms are selected on the
42982 basis of the domain name, but are applied to each IP address independently. If,
42983 for example, a host has two IP addresses and one is unusable, Exim will
42984 generate retry times for it and will not try to use it until its next retry
42985 time comes. Thus the good IP address is likely to be tried first most of the
42989 <indexterm role="concept">
42990 <primary>hints database</primary>
42991 <secondary>use for retrying</secondary>
42993 Retry times are hints rather than promises. Exim does not make any attempt to
42994 run deliveries exactly at the computed times. Instead, a queue runner process
42995 starts delivery processes for delayed messages periodically, and these attempt
42996 new deliveries only for those addresses that have passed their next retry time.
42997 If a new message arrives for a deferred address, an immediate delivery attempt
42998 occurs only if the address has passed its retry time. In the absence of new
42999 messages, the minimum time between retries is the interval between queue runner
43000 processes. There is not much point in setting retry times of five minutes if
43001 your queue runners happen only once an hour, unless there are a significant
43002 number of incoming messages (which might be the case on a system that is
43003 sending everything to a smart host, for example).
43006 The data in the retry hints database can be inspected by using the
43007 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
43008 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
43009 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
43010 are for the hosts associated with a particular mail domain, and also for local
43011 deliveries that have been deferred.
43015 <title>Retry rule examples</title>
43017 Here are some example retry rules:
43019 <literallayout class="monospaced">
43020 alice@wonderland.fict.example quota_5d F,7d,3h
43021 wonderland.fict.example quota_5d
43022 wonderland.fict.example * F,1h,15m; G,2d,1h,2;
43023 lookingglass.fict.example * F,24h,30m;
43024 * refused_A F,2h,20m;
43025 * * F,2h,15m; G,16h,1h,1.5; F,5d,8h
43028 The first rule sets up special handling for mail to
43029 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
43030 mailbox has not been read for at least 5 days. Retries continue every three
43031 hours for 7 days. The second rule handles over-quota errors for all other local
43032 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
43033 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
43034 fail are bounced immediately if the mailbox has not been read for at least 5
43038 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
43039 happen every 15 minutes for an hour, then with geometrically increasing
43040 intervals until two days have passed since a delivery first failed. After the
43041 first hour there is a delay of one hour, then two hours, then four hours, and
43042 so on (this is a rather extreme example).
43045 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
43046 They happen every 30 minutes for 24 hours only. The remaining two rules handle
43047 all other domains, with special action for connection refusal from hosts that
43048 were not obtained from an MX record.
43051 The final rule in a retry configuration should always have asterisks in the
43052 first two fields so as to provide a general catch-all for any addresses that do
43053 not have their own special handling. This example tries every 15 minutes for 2
43054 hours, then with intervals starting at one hour and increasing by a factor of
43055 1.5 up to 16 hours, then every 8 hours up to 5 days.
43059 <title>Timeout of retry data</title>
43061 <indexterm role="concept">
43062 <primary>timeout</primary>
43063 <secondary>of retry data</secondary>
43065 <indexterm role="concept">
43066 <primary><option>retry_data_expire</option></primary>
43068 <indexterm role="concept">
43069 <primary>hints database</primary>
43070 <secondary>data expiry</secondary>
43072 <indexterm role="concept">
43073 <primary>retry</primary>
43074 <secondary>timeout of data</secondary>
43076 Exim timestamps the data that it writes to its retry hints database. When it
43077 consults the data during a delivery it ignores any that is older than the value
43078 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn’t
43079 been tried for 7 days, Exim will try to deliver to it immediately a message
43080 arrives, and if that fails, it will calculate a retry time as if it were
43081 failing for the first time.
43084 This improves the behaviour for messages routed to rarely-used hosts such as MX
43085 backups. If such a host was down at one time, and happens to be down again when
43086 Exim tries a month later, using the old retry data would imply that it had been
43087 down all the time, which is not a justified assumption.
43090 If a host really is permanently dead, this behaviour causes a burst of retries
43091 every now and again, but only if messages routed to it are rare. It there is a
43092 message at least once every 7 days the retry data never expires.
43096 <title>Long-term failures</title>
43098 <indexterm role="concept">
43099 <primary>delivery failure</primary>
43100 <secondary>long-term</secondary>
43102 <indexterm role="concept">
43103 <primary>retry</primary>
43104 <secondary>after long-term failure</secondary>
43106 Special processing happens when an email address has been failing for so long
43107 that the cutoff time for the last algorithm is reached. For example, using the
43108 default retry rule:
43110 <literallayout class="monospaced">
43111 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
43114 the cutoff time is four days. Reaching the retry cutoff is independent of how
43115 long any specific message has been failing; it is the length of continuous
43116 failure for the recipient address that counts.
43119 When the cutoff time is reached for a local delivery, or for all the IP
43120 addresses associated with a remote delivery, a subsequent delivery failure
43121 causes Exim to give up on the address, and a bounce message is generated.
43122 In order to cater for new messages that use the failing address, a next retry
43123 time is still computed from the final algorithm, and is used as follows:
43126 For local deliveries, one delivery attempt is always made for any subsequent
43127 messages. If this delivery fails, the address fails immediately. The
43128 post-cutoff retry time is not used.
43131 If the delivery is remote, there are two possibilities, controlled by the
43132 <indexterm role="concept">
43133 <primary><option>delay_after_cutoff</option></primary>
43135 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
43136 default. Until the post-cutoff retry time for one of the IP addresses is
43137 reached, the failing email address is bounced immediately, without a delivery
43138 attempt taking place. After that time, one new delivery attempt is made to
43139 those IP addresses that are past their retry times, and if that still fails,
43140 the address is bounced and new retry times are computed.
43143 In other words, when all the hosts for a given email address have been failing
43144 for a long time, Exim bounces rather then defers until one of the hosts’ retry
43145 times is reached. Then it tries once, and bounces if that attempt fails. This
43146 behaviour ensures that few resources are wasted in repeatedly trying to deliver
43147 to a broken destination, but if the host does recover, Exim will eventually
43151 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
43152 addresses are past their final cutoff time, Exim tries to deliver to those IP
43153 addresses that have not been tried since the message arrived. If there are
43154 no suitable IP addresses, or if they all fail, the address is bounced. In other
43155 words, it does not delay when a new message arrives, but tries the expired
43156 addresses immediately, unless they have been tried since the message arrived.
43157 If there is a continuous stream of messages for the failing domains, setting
43158 <option>delay_after_cutoff</option> false means that there will be many more attempts to
43159 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
43164 <title>Deliveries that work intermittently</title>
43166 <indexterm role="concept">
43167 <primary>retry</primary>
43168 <secondary>intermittently working deliveries</secondary>
43170 Some additional logic is needed to cope with cases where a host is
43171 intermittently available, or when a message has some attribute that prevents
43172 its delivery when others to the same address get through. In this situation,
43173 because some messages are successfully delivered, the <quote>retry clock</quote> for the
43174 host or address keeps getting reset by the successful deliveries, and so
43175 failing messages remain on the queue for ever because the cutoff time is never
43179 Two exceptional actions are applied to prevent this happening. The first
43180 applies to errors that are related to a message rather than a remote host.
43181 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
43182 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
43183 commands, and quota failures. For this type of error, if a message’s arrival
43184 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
43185 is used when scanning the retry rules to decide when to try next and when to
43186 time out the address.
43189 The exceptional second action applies in all cases. If a message has been on
43190 the queue for longer than the cutoff time of any applicable retry rule for a
43191 given address, a delivery is attempted for that address, even if it is not yet
43192 time, and if this delivery fails, the address is timed out. A new retry time is
43193 not computed in this case, so that other messages for the same address are
43194 considered immediately.
43195 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
43196 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
43201 <chapter id="CHAPSMTPAUTH">
43202 <title>SMTP authentication</title>
43204 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
43205 <primary>SMTP</primary>
43206 <secondary>authentication configuration</secondary>
43208 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
43209 <primary>authentication</primary>
43211 The <quote>authenticators</quote> section of Exim’s run time configuration is concerned
43212 with SMTP authentication. This facility is an extension to the SMTP protocol,
43213 described in RFC 2554, which allows a client SMTP host to authenticate itself
43214 to a server. This is a common way for a server to recognize clients that are
43215 permitted to use it as a relay. SMTP authentication is not of relevance to the
43216 transfer of mail between servers that have no managerial connection with each
43220 <indexterm role="concept">
43221 <primary>AUTH</primary>
43222 <secondary>description of</secondary>
43224 Very briefly, the way SMTP authentication works is as follows:
43229 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
43230 the client’s EHLO command.
43235 The client issues an AUTH command, naming a specific mechanism. The command
43236 may, optionally, contain some authentication data.
43241 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
43242 appropriate responses. In simple authentication mechanisms, the challenges are
43243 just prompts for user names and passwords. The server does not have to issue
43244 any challenges – in some mechanisms the relevant data may all be transmitted
43245 with the AUTH command.
43250 The server either accepts or denies authentication.
43255 If authentication succeeds, the client may optionally make use of the AUTH
43256 option on the MAIL command to pass an authenticated sender in subsequent
43257 mail transactions. Authentication lasts for the remainder of the SMTP
43263 If authentication fails, the client may give up, or it may try a different
43264 authentication mechanism, or it may try transferring mail over the
43265 unauthenticated connection.
43270 If you are setting up a client, and want to know which authentication
43271 mechanisms the server supports, you can use Telnet to connect to port 25 (the
43272 SMTP port) on the server, and issue an EHLO command. The response to this
43273 includes the list of supported mechanisms. For example:
43276 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
43277 <literal>Trying 192.168.34.25...</literal>
43278 <literal>Connected to server.example.</literal>
43279 <literal>Escape character is '^]'.</literal>
43280 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
43281 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
43282 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
43283 <literal>250-SIZE 52428800</literal>
43284 <literal>250-PIPELINING</literal>
43285 <literal>250-AUTH PLAIN</literal>
43286 <literal>250 HELP</literal>
43289 The second-last line of this example output shows that the server supports
43290 authentication using the PLAIN mechanism. In Exim, the different authentication
43291 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
43292 routers and transports, which authenticators are included in the binary is
43293 controlled by build-time definitions. The following are currently available,
43294 included by setting
43296 <literallayout class="monospaced">
43298 AUTH_CYRUS_SASL=yes
43303 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
43304 authentication mechanism (RFC 2195), and the second provides an interface to
43305 the Cyrus SASL authentication library. The third can be configured to support
43306 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
43307 not formally documented, but used by several MUAs. The fourth authenticator
43308 supports Microsoft’s <emphasis>Secure Password Authentication</emphasis> mechanism.
43311 The authenticators are configured using the same syntax as other drivers (see
43312 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
43313 authentication section need be present in the configuration file. Each
43314 authenticator can in principle have both server and client functions. When Exim
43315 is receiving SMTP mail, it is acting as a server; when it is sending out
43316 messages over SMTP, it is acting as a client. Authenticator configuration
43317 options are provided for use in both these circumstances.
43320 To make it clear which options apply to which situation, the prefixes
43321 <option>server_</option> and <option>client_</option> are used on option names that are specific to
43322 either the server or the client function, respectively. Server and client
43323 functions are disabled if none of their options are set. If an authenticator is
43324 to be used for both server and client functions, a single definition, using
43325 both sets of options, is required. For example:
43327 <literallayout class="monospaced">
43330 public_name = CRAM-MD5
43331 server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
43333 client_secret = secret2
43336 The <option>server_</option> option is used when Exim is acting as a server, and the
43337 <option>client_</option> options when it is acting as a client.
43340 Descriptions of the individual authenticators are given in subsequent chapters.
43341 The remainder of this chapter covers the generic options for the
43342 authenticators, followed by general discussion of the way authentication works
43346 <title>Generic options for authenticators</title>
43348 <indexterm role="concept">
43349 <primary>authentication</primary>
43350 <secondary>generic options</secondary>
43352 <indexterm role="concept">
43353 <primary>options</primary>
43354 <secondary>generic; for authenticators</secondary>
43358 <indexterm role="option">
43359 <primary>driver</primary>
43362 <informaltable frame="all">
43363 <tgroup cols="4" colsep="0" rowsep="0">
43364 <colspec colwidth="8*" align="left"/>
43365 <colspec colwidth="5*" align="center"/>
43366 <colspec colwidth="5*" align="center"/>
43367 <colspec colwidth="6*" align="right"/>
43370 <entry><option>driver</option></entry>
43371 <entry>Use: <emphasis>authenticators</emphasis></entry>
43372 <entry>Type: <emphasis>string</emphasis></entry>
43373 <entry>Default: <emphasis>unset</emphasis></entry>
43379 This option must always be set. It specifies which of the available
43380 authenticators is to be used.
43383 <indexterm role="option">
43384 <primary>public_name</primary>
43387 <informaltable frame="all">
43388 <tgroup cols="4" colsep="0" rowsep="0">
43389 <colspec colwidth="8*" align="left"/>
43390 <colspec colwidth="5*" align="center"/>
43391 <colspec colwidth="5*" align="center"/>
43392 <colspec colwidth="6*" align="right"/>
43395 <entry><option>public_name</option></entry>
43396 <entry>Use: <emphasis>authenticators</emphasis></entry>
43397 <entry>Type: <emphasis>string</emphasis></entry>
43398 <entry>Default: <emphasis>unset</emphasis></entry>
43404 This option specifies the name of the authentication mechanism that the driver
43405 implements, and by which it is known to the outside world. These names should
43406 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
43407 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
43408 defaults to the driver’s instance name.
43411 <indexterm role="option">
43412 <primary>server_advertise_condition</primary>
43415 <informaltable frame="all">
43416 <tgroup cols="4" colsep="0" rowsep="0">
43417 <colspec colwidth="8*" align="left"/>
43418 <colspec colwidth="5*" align="center"/>
43419 <colspec colwidth="5*" align="center"/>
43420 <colspec colwidth="6*" align="right"/>
43423 <entry><option>server_advertise_condition</option></entry>
43424 <entry>Use: <emphasis>authenticators</emphasis></entry>
43425 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43426 <entry>Default: <emphasis>unset</emphasis></entry>
43432 When a server is about to advertise an authentication mechanism, the condition
43433 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
43434 mechanism is not advertised.
43435 If the expansion fails, the mechanism is not advertised. If the failure was not
43436 forced, and was not caused by a lookup defer, the incident is logged.
43437 See section <xref linkend="SECTauthexiser"/> below for further discussion.
43440 <indexterm role="option">
43441 <primary>server_debug_print</primary>
43444 <informaltable frame="all">
43445 <tgroup cols="4" colsep="0" rowsep="0">
43446 <colspec colwidth="8*" align="left"/>
43447 <colspec colwidth="5*" align="center"/>
43448 <colspec colwidth="5*" align="center"/>
43449 <colspec colwidth="6*" align="right"/>
43452 <entry><option>server_debug_print</option></entry>
43453 <entry>Use: <emphasis>authenticators</emphasis></entry>
43454 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43455 <entry>Default: <emphasis>unset</emphasis></entry>
43461 If this option is set and authentication debugging is enabled (see the <option>-d</option>
43462 command line option), the string is expanded and included in the debugging
43463 output when the authenticator is run as a server. This can help with checking
43464 out the values of variables.
43465 If expansion of the string fails, the error message is written to the debugging
43466 output, and Exim carries on processing.
43469 <indexterm role="option">
43470 <primary>server_set_id</primary>
43473 <informaltable frame="all">
43474 <tgroup cols="4" colsep="0" rowsep="0">
43475 <colspec colwidth="8*" align="left"/>
43476 <colspec colwidth="5*" align="center"/>
43477 <colspec colwidth="5*" align="center"/>
43478 <colspec colwidth="6*" align="right"/>
43481 <entry><option>server_set_id</option></entry>
43482 <entry>Use: <emphasis>authenticators</emphasis></entry>
43483 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43484 <entry>Default: <emphasis>unset</emphasis></entry>
43490 <indexterm role="concept">
43491 <primary><varname>$authenticated_id</varname></primary>
43493 When an Exim server successfully authenticates a client, this string is
43494 expanded using data from the authentication, and preserved for any incoming
43495 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
43496 lines for incoming messages. For example, a user/password authenticator
43497 configuration might preserve the user name that was used to authenticate, and
43498 refer to it subsequently during delivery of the message.
43499 If expansion fails, the option is ignored.
43502 <indexterm role="option">
43503 <primary>server_mail_auth_condition</primary>
43506 <informaltable frame="all">
43507 <tgroup cols="4" colsep="0" rowsep="0">
43508 <colspec colwidth="8*" align="left"/>
43509 <colspec colwidth="5*" align="center"/>
43510 <colspec colwidth="5*" align="center"/>
43511 <colspec colwidth="6*" align="right"/>
43514 <entry><option>server_mail_auth_condition</option></entry>
43515 <entry>Use: <emphasis>authenticators</emphasis></entry>
43516 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43517 <entry>Default: <emphasis>unset</emphasis></entry>
43523 This option allows a server to discard authenticated sender addresses supplied
43524 as part of MAIL commands in SMTP connections that are authenticated by the
43525 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
43526 as part of the authentication process; instead its (unexpanded) value is
43527 remembered for later use.
43528 How it is used is described in the following section.
43531 <section id="SECTauthparamail">
43532 <title>The AUTH parameter on MAIL commands</title>
43534 <indexterm role="concept">
43535 <primary>authentication</primary>
43536 <secondary>sender; authenticated</secondary>
43538 <indexterm role="concept">
43539 <primary>AUTH</primary>
43540 <secondary>on MAIL command</secondary>
43542 When a client supplied an AUTH= item on a MAIL command, Exim applies
43543 the following checks before accepting it as the authenticated sender of the
43549 If the connection is not using extended SMTP (that is, HELO was used rather
43550 than EHLO), the use of AUTH= is a syntax error.
43555 If the value of the AUTH= parameter is <quote><></quote>, it is ignored.
43560 <indexterm role="concept">
43561 <primary><varname>$authenticated_sender</varname></primary>
43563 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
43564 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
43565 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
43566 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
43567 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
43568 given for the MAIL command.
43573 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
43574 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
43580 If the AUTH= value was accepted by either of the two previous rules, and
43581 the client has authenticated, and the authenticator has a setting for the
43582 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
43583 valued that was saved from the authenticator is expanded. If the expansion
43584 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
43585 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
43586 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
43592 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
43593 hosts to which Exim authenticates as a client. Do not confuse this value with
43594 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
43595 process, and which is not usually a complete email address.
43598 <indexterm role="concept">
43599 <primary><varname>$sender_address</varname></primary>
43601 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
43602 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
43603 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
43604 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
43608 <section id="SECTauthexiser">
43609 <title>Authentication on an Exim server</title>
43611 <indexterm role="concept">
43612 <primary>authentication</primary>
43613 <secondary>on an Exim server</secondary>
43615 When Exim receives an EHLO command, it advertises the public names of those
43616 authenticators that are configured as servers, subject to the following
43622 The client host must match <option>auth_advertise_hosts</option> (default *).
43627 It the <option>server_advertise_condition</option> option is set, its expansion must not
43628 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
43633 The order in which the authenticators are defined controls the order in which
43634 the mechanisms are advertised.
43637 Some mail clients (for example, some versions of Netscape) require the user to
43638 provide a name and password for authentication whenever AUTH is advertised,
43639 even though authentication may not in fact be needed (for example, Exim may be
43640 set up to allow unconditional relaying from the client by an IP address check).
43641 You can make such clients more friendly by not advertising AUTH to them.
43642 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
43643 that runs for RCPT) to relay without authentication, you should set
43645 <literallayout class="monospaced">
43646 auth_advertise_hosts = ! 10.9.8.0/24
43649 so that no authentication mechanisms are advertised to them.
43652 The <option>server_advertise_condition</option> controls the advertisement of individual
43653 authentication mechanisms. For example, it can be used to restrict the
43654 advertisement of a patricular mechanism to encrypted connections, by a setting
43657 <literallayout class="monospaced">
43658 server_advertise_condition = ${if eq{$tls_cipher}{}{no}{yes}}
43661 <indexterm role="concept">
43662 <primary><varname>$tls_cipher</varname></primary>
43664 If the session is encrypted, <varname>$tls_cipher</varname> is not empty, and so the expansion
43665 yields <quote>yes</quote>, which allows the advertisement to happen.
43668 When an Exim server receives an AUTH command from a client, it rejects it
43669 immediately if AUTH was not advertised in response to an earlier EHLO
43670 command. This is the case if
43675 The client host does not match <option>auth_advertise_hosts</option>; or
43680 No authenticators are configured with server options; or
43685 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
43686 server authenticators.
43691 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
43692 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
43693 AUTH is accepted from any client host.
43696 If AUTH is not rejected by the ACL, Exim searches its configuration for a
43697 server authentication mechanism that was advertised in response to EHLO and
43698 that matches the one named in the AUTH command. If it finds one, it runs
43699 the appropriate authentication protocol, and authentication either succeeds or
43700 fails. If there is no matching advertised mechanism, the AUTH command is
43701 rejected with a 504 error.
43704 <indexterm role="concept">
43705 <primary><varname>$received_protocol</varname></primary>
43707 <indexterm role="concept">
43708 <primary><varname>$sender_host_authenticated</varname></primary>
43710 When a message is received from an authenticated host, the value of
43711 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
43712 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
43713 public name) of the authenticator driver that successfully authenticated the
43714 client from which the message was received. This variable is empty if there was
43715 no successful authentication.
43719 <title>Testing server authentication</title>
43721 <indexterm role="concept">
43722 <primary>authentication</primary>
43723 <secondary>testing a server</secondary>
43725 <indexterm role="concept">
43726 <primary>AUTH</primary>
43727 <secondary>testing a server</secondary>
43729 <indexterm role="concept">
43730 <primary>base64 encoding</primary>
43731 <secondary>creating authentication test data</secondary>
43733 Exim’s <option>-bh</option> option can be useful for testing server authentication
43734 configurations. The data for the AUTH command has to be sent using base64
43735 encoding. A quick way to produce such data for testing is the following Perl
43738 <literallayout class="monospaced">
43740 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
43743 <indexterm role="concept">
43744 <primary>binary zero</primary>
43745 <secondary>in authentication data</secondary>
43747 This interprets its argument as a Perl string, and then encodes it. The
43748 interpretation as a Perl string allows binary zeros, which are required for
43749 some kinds of authentication, to be included in the data. For example, a
43750 command line to run this script on such data might be
43752 <literallayout class="monospaced">
43753 encode '\0user\0password'
43756 Note the use of single quotes to prevent the shell interpreting the
43757 backslashes, so that they can be interpreted by Perl to specify characters
43758 whose code value is zero.
43761 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
43762 digit, you must use three zeros instead of one after the leading backslash. If
43763 you do not, the octal digit that starts your string will be incorrectly
43764 interpreted as part of the code for the first character.
43767 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
43768 specially, you must use a Perl escape to prevent them being misinterpreted. For
43769 example, a command such as
43771 <literallayout class="monospaced">
43772 encode '\0user@domain.com\0pas$$word'
43775 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
43778 If you have the <option>mimencode</option> command installed, another way to do produce
43779 base64-encoded strings is to run the command
43781 <literallayout class="monospaced">
43782 echo -e -n `\0user\0password' | mimencode
43785 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
43786 in the argument, and the <option>-n</option> option specifies no newline at the end of its
43787 output. However, not all versions of <option>echo</option> recognize these options, so you
43788 should check your version before relying on this suggestion.
43792 <title>Authentication by an Exim client</title>
43794 <indexterm role="concept">
43795 <primary>authentication</primary>
43796 <secondary>on an Exim client</secondary>
43798 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
43799 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
43800 announces support for authentication, and the host matches an entry in either
43801 of these options, Exim (as a client) tries to authenticate as follows:
43806 For each authenticator that is configured as a client, it searches the
43807 authentication mechanisms announced by the server for one whose name
43808 matches the public name of the authenticator.
43813 <indexterm role="concept">
43814 <primary><varname>$host</varname></primary>
43816 <indexterm role="concept">
43817 <primary><varname>$host_address</varname></primary>
43819 When it finds one that matches, it runs the authenticator’s client code.
43820 The variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string
43821 expansions that the client might do. They are set to the server’s name and
43822 IP address. If any expansion is forced to fail, the authentication attempt
43824 and Exim moves on to the next authenticator.
43825 Otherwise an expansion failure causes delivery to be
43831 If the result of the authentication attempt is a temporary error or a timeout,
43832 Exim abandons trying to send the message to the host for the moment. It will
43833 try again later. If there are any backup hosts available, they are tried in the
43839 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
43840 carries on searching the list of authenticators and tries another one if
43841 possible. If all authentication attempts give permanent errors, or if there are
43842 no attempts because no mechanisms match (or option expansions force failure),
43843 what happens depends on whether the host matches <option>hosts_require_auth</option> or
43844 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
43845 delivery is deferred. The error can be detected in the retry rules, and thereby
43846 turned into a permanent error if you wish. In the second case, Exim tries to
43847 deliver the message unauthenticated.
43852 <indexterm role="concept">
43853 <primary>AUTH</primary>
43854 <secondary>on MAIL command</secondary>
43856 When Exim has authenticated itself to a remote server, it adds the AUTH
43857 parameter to the MAIL commands it sends, if it has an authenticated sender for
43858 the message. If the message came from a remote host, the authenticated sender
43859 is the one that was receiving on an incoming MAIL command, provided that the
43860 incoming connection was authenticated and the <option>server_mail_auth</option> condition
43861 allowed the authenticated sender to be retained. If a local process calls Exim
43862 to send a message, the sender address that is built from the login name and
43863 <option>qualify_domain</option> is treated as authenticated. However, if the
43864 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
43865 the authenticated sender that was received with the message.
43866 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
43867 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
43872 <chapter id="CHAPplaintext">
43873 <title>The plaintext authenticator</title>
43875 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
43876 <primary><command>plaintext</command> authenticator</primary>
43878 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
43879 <primary>authenticators</primary>
43880 <secondary><command>plaintext</command></secondary>
43882 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
43883 LOGIN authentication mechanisms, both of which transfer authentication data as
43884 plain (unencrypted) text (though base64 encoded). The use of plain text is a
43885 security risk; you are strongly advised to insist on the use of SMTP encryption
43886 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
43887 use unencrypted plain text, you should not use the same passwords for SMTP
43888 connections as you do for login accounts.
43891 <title>Using plaintext in a server</title>
43893 <indexterm role="concept">
43894 <primary>options</primary>
43895 <secondary><command>plaintext</command> authenticator (server)</secondary>
43897 When running as a server, <command>plaintext</command> performs the authentication test by
43898 expanding a string. It has the following options:
43901 <indexterm role="option">
43902 <primary>server_prompts</primary>
43905 <informaltable frame="all">
43906 <tgroup cols="4" colsep="0" rowsep="0">
43907 <colspec colwidth="8*" align="left"/>
43908 <colspec colwidth="5*" align="center"/>
43909 <colspec colwidth="5*" align="center"/>
43910 <colspec colwidth="6*" align="right"/>
43913 <entry><option>server_prompts</option></entry>
43914 <entry>Use: <emphasis>plaintext</emphasis></entry>
43915 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43916 <entry>Default: <emphasis>unset</emphasis></entry>
43922 The contents of this option, after expansion, must be a colon-separated list of
43923 prompt strings. If expansion fails, a temporary authentication rejection is
43927 <indexterm role="option">
43928 <primary>server_condition</primary>
43931 <informaltable frame="all">
43932 <tgroup cols="4" colsep="0" rowsep="0">
43933 <colspec colwidth="8*" align="left"/>
43934 <colspec colwidth="5*" align="center"/>
43935 <colspec colwidth="5*" align="center"/>
43936 <colspec colwidth="6*" align="right"/>
43939 <entry><option>server_condition</option></entry>
43940 <entry>Use: <emphasis>plaintext</emphasis></entry>
43941 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43942 <entry>Default: <emphasis>unset</emphasis></entry>
43948 This option must be set in order to configure the driver as a server. Its use
43949 is described below.
43952 <indexterm role="concept">
43953 <primary>AUTH</primary>
43954 <secondary>in <command>plaintext</command> authenticator</secondary>
43956 <indexterm role="concept">
43957 <primary>binary zero</primary>
43958 <secondary>in <command>plaintext</command> authenticator</secondary>
43960 <indexterm role="concept">
43961 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
43962 <secondary>in <command>plaintext</command> authenticator</secondary>
43964 <indexterm role="concept">
43965 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
43967 <indexterm role="concept">
43968 <primary>base64 encoding</primary>
43969 <secondary>in <command>plaintext</command> authenticator</secondary>
43971 The data sent by the client with the AUTH command, or in response to
43972 subsequent prompts, is base64 encoded, and so may contain any byte values
43973 when decoded. If any data is supplied with the command, it is treated as a
43974 list of strings, separated by NULs (binary zeros), the first three of which are
43975 placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname> (neither
43976 LOGIN nor PLAIN uses more than three strings).
43979 For compatibility with previous releases of Exim, the values are also placed in
43980 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
43981 variables for this purpose is now deprecated, as it can lead to confusion in
43982 string expansions that also use them for other things.
43985 If there are more strings in <option>server_prompts</option> than the number of strings
43986 supplied with the AUTH command, the remaining prompts are used to obtain more
43987 data. Each response from the client may be a list of NUL-separated strings.
43990 <indexterm role="concept">
43991 <primary><varname>$authenticated_id</varname></primary>
43993 Once a sufficient number of data strings have been received,
43994 <option>server_condition</option> is expanded. If the expansion is forced to fail,
43995 authentication fails. Any other expansion failure causes a temporary error code
43996 to be returned. If the result of a successful expansion is an empty string,
43997 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
43998 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
43999 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
44000 For any other result, a temporary error code is returned, with the expanded
44001 string as the error text.
44004 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user’s
44005 password, be sure to make the authentication fail if the user is unknown.
44006 There are good and bad examples at the end of the next section.
44010 <title>The PLAIN authentication mechanism</title>
44012 <indexterm role="concept">
44013 <primary>PLAIN authentication mechanism</primary>
44015 <indexterm role="concept">
44016 <primary>authentication</primary>
44017 <secondary>PLAIN mechanism</secondary>
44019 <indexterm role="concept">
44020 <primary>binary zero</primary>
44021 <secondary>in <command>plaintext</command> authenticator</secondary>
44023 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
44024 sent as one item of data (that is, one combined string containing two NUL
44025 separators). The data is sent either as part of the AUTH command, or
44026 subsequently in response to an empty prompt from the server.
44029 The second and third strings are a user name and a corresponding password.
44030 Using a single fixed user name and password as an example, this could be
44031 configured as follows:
44033 <literallayout class="monospaced">
44036 public_name = PLAIN
44038 server_condition = \
44039 ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
44040 server_set_id = $auth2
44042 <para revisionflag="changed">
44043 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
44044 are exactly what we want here, so they need not be specified. Obviously, if the
44045 password contains expansion-significant characters such as dollar, backslash,
44046 or closing brace, they have to be escaped.
44049 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
44050 the end of a string list are ignored). If all the data comes as part of the
44051 AUTH command, as is commonly the case, the prompt is not used. This
44052 authenticator is advertised in the response to EHLO as
44054 <literallayout class="monospaced">
44058 and a client host can authenticate itself by sending the command
44060 <literallayout class="monospaced">
44061 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
44064 As this contains three strings (more than the number of prompts), no further
44065 data is required from the client. Alternatively, the client may just send
44067 <literallayout class="monospaced">
44071 to initiate authentication, in which case the server replies with an empty
44072 prompt. The client must respond with the combined data string.
44075 The data string is base64 encoded, as required by the RFC. This example,
44076 when decoded, is <<emphasis>NUL</emphasis>><literal>username</literal><<emphasis>NUL</emphasis>><literal>mysecret</literal>, where <<emphasis>NUL</emphasis>>
44077 represents a zero byte. This is split up into three strings, the first of which
44078 is empty. The <option>server_condition</option> option in the authenticator checks that the
44079 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
44082 Having just one fixed user name and password, as in this example, is not very
44083 realistic, though for a small organization with only a handful of
44084 authenticating clients it could make sense.
44087 A more sophisticated instance of this authenticator could use the user name in
44088 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
44089 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
44090 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
44091 This is an incorrect example:
44093 <literallayout class="monospaced" revisionflag="changed">
44094 server_condition = \
44095 ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
44098 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
44099 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
44100 incorrect? It works fine for existing users, but consider what happens if a
44101 non-existent user name is given. The lookup fails, but as no success/failure
44102 strings are given for the lookup, it yields an empty string. Thus, to defeat
44103 the authentication, all a client has to do is to supply a non-existent user
44104 name and an empty password. The correct way of writing this test is:
44106 <literallayout class="monospaced" revisionflag="changed">
44107 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
44108 {${if eq{$value}{$auth3}}} {false}}
44110 <para revisionflag="changed">
44111 In this case, if the lookup succeeds, the result is checked; if the lookup
44112 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
44113 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
44114 always fails if its second argument is empty. However, the second way of
44115 writing the test makes the logic clearer.
44119 <title>The LOGIN authentication mechanism</title>
44121 <indexterm role="concept">
44122 <primary>LOGIN authentication mechanism</primary>
44124 <indexterm role="concept">
44125 <primary>authentication</primary>
44126 <secondary>LOGIN mechanism</secondary>
44128 The LOGIN authentication mechanism is not documented in any RFC, but is in use
44129 in a number of programs. No data is sent with the AUTH command. Instead, a
44130 user name and password are supplied separately, in response to prompts. The
44131 plaintext authenticator can be configured to support this as in this example:
44133 <literallayout class="monospaced">
44136 public_name = LOGIN
44137 server_prompts = User Name : Password
44138 server_condition = \
44139 ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
44140 server_set_id = $auth1
44143 Because of the way plaintext operates, this authenticator accepts data supplied
44144 with the AUTH command (in contravention of the specification of LOGIN), but
44145 if the client does not supply it (as is the case for LOGIN clients), the prompt
44146 strings are used to obtain two data items.
44149 Some clients are very particular about the precise text of the prompts. For
44150 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
44151 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
44152 strings. It uses the <option>ldapauth</option> expansion condition to check the user
44153 name and password by binding to an LDAP server:
44155 <literallayout class="monospaced">
44158 public_name = LOGIN
44159 server_prompts = Username:: : Password::
44160 server_condition = ${if ldapauth \
44161 {user="cn=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
44162 pass=${quote:$auth2} \
44163 ldap://ldap.example.org/}}
44164 server_set_id = uid=$auth1,ou=people,o=example.org
44167 Note the use of the <option>quote_ldap_dn</option> operator to correctly quote the DN for
44168 authentication. However, the basic <option>quote</option> operator, rather than any of the
44169 LDAP quoting operators, is the correct one to use for the password, because
44170 quoting is needed only to make the password conform to the Exim syntax. At the
44171 LDAP level, the password is an uninterpreted string.
44175 <title>Support for different kinds of authentication</title>
44177 A number of string expansion features are provided for the purpose of
44178 interfacing to different ways of user authentication. These include checking
44179 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
44180 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
44181 <xref linkend="SECTexpcond"/>.
44185 <title>Using plaintext in a client</title>
44187 <indexterm role="concept">
44188 <primary>options</primary>
44189 <secondary><command>plaintext</command> authenticator (client)</secondary>
44191 The <command>plaintext</command> authenticator has two client options:
44194 <indexterm role="option">
44195 <primary>client_ignore_invalid_base64</primary>
44198 <informaltable frame="all">
44199 <tgroup cols="4" colsep="0" rowsep="0">
44200 <colspec colwidth="8*" align="left"/>
44201 <colspec colwidth="5*" align="center"/>
44202 <colspec colwidth="5*" align="center"/>
44203 <colspec colwidth="6*" align="right"/>
44206 <entry><option>client_ignore_invalid_base64</option></entry>
44207 <entry>Use: <emphasis>plaintext</emphasis></entry>
44208 <entry>Type: <emphasis>boolean</emphasis></entry>
44209 <entry>Default: <emphasis>false</emphasis></entry>
44215 If the client receives a server prompt that is not a valid base64 string,
44216 authentication is abandoned by default. However, if this option is set true,
44217 the error in the challenge is ignored and the client sends the response as
44221 <indexterm role="option">
44222 <primary>client_send</primary>
44225 <informaltable frame="all">
44226 <tgroup cols="4" colsep="0" rowsep="0">
44227 <colspec colwidth="8*" align="left"/>
44228 <colspec colwidth="5*" align="center"/>
44229 <colspec colwidth="5*" align="center"/>
44230 <colspec colwidth="6*" align="right"/>
44233 <entry><option>client_send</option></entry>
44234 <entry>Use: <emphasis>plaintext</emphasis></entry>
44235 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44236 <entry>Default: <emphasis>unset</emphasis></entry>
44242 The string is a colon-separated list of authentication data strings. Each
44243 string is independently expanded before being sent to the server. The first
44244 string is sent with the AUTH command; any more strings are sent in response
44245 to prompts from the server. Before each string is expanded, the value of the
44246 most recent prompt is placed in the next <varname>$auth</varname><<emphasis>n</emphasis>> variable, starting
44247 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
44248 way. Thus, the prompt that is received in response to sending the first string
44249 (with the AUTH command) can be used in the expansion of the second string, and
44250 so on. If an invalid base64 string is received when
44251 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
44252 <varname>$auth</varname><<emphasis>n</emphasis>> variable.
44255 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
44256 splitting takes priority and happens first.
44259 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
44260 the data, further processing is applied to each string before it is sent. If
44261 there are any single circumflex characters in the string, they are converted to
44262 NULs. Should an actual circumflex be required as data, it must be doubled in
44266 This is an example of a client configuration that implements the PLAIN
44267 authentication mechanism with a fixed user name and password:
44269 <literallayout class="monospaced">
44272 public_name = PLAIN
44273 client_send = ^username^mysecret
44276 The lack of colons means that the entire text is sent with the AUTH
44277 command, with the circumflex characters converted to NULs. A similar example
44278 that uses the LOGIN mechanism is:
44280 <literallayout class="monospaced">
44283 public_name = LOGIN
44284 client_send = : username : mysecret
44287 The initial colon means that the first string is empty, so no data is sent with
44288 the AUTH command itself. The remaining strings are sent in response to
44290 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
44291 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
44297 <title>The cram_md5 authenticator</title>
44299 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
44300 <primary><command>cram_md5</command> authenticator</primary>
44302 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
44303 <primary>authenticators</primary>
44304 <secondary><command>cram_md5</command></secondary>
44306 <indexterm role="concept">
44307 <primary>CRAM-MD5 authentication mechanism</primary>
44309 <indexterm role="concept">
44310 <primary>authentication</primary>
44311 <secondary>CRAM-MD5 mechanism</secondary>
44313 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
44314 sends a challenge string to the client, and the response consists of a user
44315 name and the CRAM-MD5 digest of the challenge string combined with a secret
44316 string (password) which is known to both server and client. Thus, the secret
44317 is not sent over the network as plain text, which makes this authenticator more
44318 secure than <command>plaintext</command>. However, the downside is that the secret has to be
44319 available in plain text at either end.
44322 <title>Using cram_md5 as a server</title>
44324 <indexterm role="concept">
44325 <primary>options</primary>
44326 <secondary><command>cram_md5</command> authenticator (server)</secondary>
44328 This authenticator has one server option, which must be set to configure the
44329 authenticator as a server:
44332 <indexterm role="option">
44333 <primary>server_secret</primary>
44336 <informaltable frame="all">
44337 <tgroup cols="4" colsep="0" rowsep="0">
44338 <colspec colwidth="8*" align="left"/>
44339 <colspec colwidth="5*" align="center"/>
44340 <colspec colwidth="5*" align="center"/>
44341 <colspec colwidth="6*" align="right"/>
44344 <entry><option>server_secret</option></entry>
44345 <entry>Use: <emphasis>cram_md5</emphasis></entry>
44346 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44347 <entry>Default: <emphasis>unset</emphasis></entry>
44353 <indexterm role="concept">
44354 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
44355 <secondary>in <command>cram_md5</command> authenticator</secondary>
44357 When the server receives the client’s response, the user name is placed in
44358 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
44359 obtain the password for that user. The server then computes the CRAM-MD5 digest
44360 that the client should have sent, and checks that it received the correct
44361 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
44362 fails. If the expansion fails for some other reason, a temporary error code is
44363 returned to the client.
44366 For compatibility with previous releases of Exim, the user name is also placed
44367 in <varname>$1</varname>. However, the use of this variables for this purpose is now
44368 deprecated, as it can lead to confusion in string expansions that also use
44369 numeric variables for other things.
44372 For example, the following authenticator checks that the user name given by the
44373 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
44374 user name, authentication fails.
44376 <literallayout class="monospaced">
44379 public_name = CRAM-MD5
44380 server_secret = ${if eq{$auth1}{ph10}{secret}fail}
44381 server_set_id = $auth1
44384 <indexterm role="concept">
44385 <primary><varname>$authenticated_id</varname></primary>
44387 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
44388 name in <varname>$authenticated_id</varname>. A more tyical configuration might look up the
44389 secret string in a file, using the user name as the key. For example:
44391 <literallayout class="monospaced">
44394 public_name = CRAM-MD5
44395 server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}{$value}fail}
44396 server_set_id = $auth1
44399 Note that this expansion explicitly forces failure if the lookup fails
44400 because <varname>$1</varname> contains an unknown user name.
44404 <title>Using cram_md5 as a client</title>
44406 <indexterm role="concept">
44407 <primary>options</primary>
44408 <secondary><command>cram_md5</command> authenticator (client)</secondary>
44410 When used as a client, the <command>cram_md5</command> authenticator has two options:
44413 <indexterm role="option">
44414 <primary>client_name</primary>
44417 <informaltable frame="all">
44418 <tgroup cols="4" colsep="0" rowsep="0">
44419 <colspec colwidth="8*" align="left"/>
44420 <colspec colwidth="5*" align="center"/>
44421 <colspec colwidth="5*" align="center"/>
44422 <colspec colwidth="6*" align="right"/>
44425 <entry><option>client_name</option></entry>
44426 <entry>Use: <emphasis>cram_md5</emphasis></entry>
44427 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44428 <entry>Default: <emphasis>the primary host name</emphasis></entry>
44434 This string is expanded, and the result used as the user name data when
44435 computing the response to the server’s challenge.
44438 <indexterm role="option">
44439 <primary>client_secret</primary>
44442 <informaltable frame="all">
44443 <tgroup cols="4" colsep="0" rowsep="0">
44444 <colspec colwidth="8*" align="left"/>
44445 <colspec colwidth="5*" align="center"/>
44446 <colspec colwidth="5*" align="center"/>
44447 <colspec colwidth="6*" align="right"/>
44450 <entry><option>client_secret</option></entry>
44451 <entry>Use: <emphasis>cram_md5</emphasis></entry>
44452 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44453 <entry>Default: <emphasis>unset</emphasis></entry>
44459 This option must be set for the authenticator to work as a client. Its value is
44460 expanded and the result used as the secret string when computing the response.
44463 <indexterm role="concept">
44464 <primary><varname>$host</varname></primary>
44466 <indexterm role="concept">
44467 <primary><varname>$host_address</varname></primary>
44469 Different user names and secrets can be used for different servers by referring
44470 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
44471 expansion string is treated as an indication that this authenticator is not
44472 prepared to handle this case. Exim moves on to the next configured client
44473 authenticator. Any other expansion failure causes Exim to give up trying to
44474 send the message to the current server.
44477 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
44480 <literallayout class="monospaced">
44483 public_name = CRAM-MD5
44485 client_secret = secret
44488 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
44489 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
44495 <title>The cyrus_sasl authenticator</title>
44497 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
44498 <primary><command>cyrus_sasl</command> authenticator</primary>
44500 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
44501 <primary>authenticators</primary>
44502 <secondary><command>cyrus_sasl</command></secondary>
44504 <indexterm role="concept">
44505 <primary>Cyrus</primary>
44506 <secondary>SASL library</secondary>
44508 The code for this authenticator was provided by Matthew Byng-Maddick of A L
44509 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
44512 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
44513 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
44514 Layer</quote>). This library supports a number of authentication mechanisms,
44515 including PLAIN and LOGIN, but also several others that Exim does not support
44516 directly. In particular, there is support for Kerberos authentication.
44519 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
44520 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
44521 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
44522 name of the driver to determine which mechanism to support.
44525 Where access to some kind of secret file is required, for example in GSSAPI
44526 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
44527 user, and that the Cyrus SASL library has no way of escalating privileges
44528 by default. You may also find you need to set environment variables,
44529 depending on the driver you are using.
44532 <title>Using cyrus_sasl as a server</title>
44534 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
44535 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
44536 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
44537 use of this variable for this purpose is now deprecated, as it can lead to
44538 confusion in string expansions that also use numeric variables for other
44542 <indexterm role="option">
44543 <primary>server_hostname</primary>
44546 <informaltable frame="all">
44547 <tgroup cols="4" colsep="0" rowsep="0">
44548 <colspec colwidth="8*" align="left"/>
44549 <colspec colwidth="5*" align="center"/>
44550 <colspec colwidth="5*" align="center"/>
44551 <colspec colwidth="6*" align="right"/>
44554 <entry><option>server_hostname</option></entry>
44555 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
44556 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44557 <entry>Default: <emphasis><literal>$primary_hostname</literal></emphasis></entry>
44563 This option selects the hostname that is used when communicating with
44564 the library. It is up to the underlying SASL plug-in what it does with
44568 <indexterm role="option">
44569 <primary>server_mech</primary>
44572 <informaltable frame="all">
44573 <tgroup cols="4" colsep="0" rowsep="0">
44574 <colspec colwidth="8*" align="left"/>
44575 <colspec colwidth="5*" align="center"/>
44576 <colspec colwidth="5*" align="center"/>
44577 <colspec colwidth="6*" align="right"/>
44580 <entry><option>server_mech</option></entry>
44581 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
44582 <entry>Type: <emphasis>string</emphasis></entry>
44583 <entry>Default: <emphasis><literal>public_name</literal></emphasis></entry>
44589 This option selects the authentication mechanism this driver should
44590 use. It allows you to use a different underlying mechanism from the
44591 advertised name. For example:
44593 <literallayout class="monospaced">
44595 driver = cyrus_sasl
44596 public_name = X-ANYTHING
44597 server_mech = CRAM-MD5
44598 server_set_id = $auth1
44601 <indexterm role="option">
44602 <primary>server_realm</primary>
44605 <informaltable frame="all">
44606 <tgroup cols="4" colsep="0" rowsep="0">
44607 <colspec colwidth="8*" align="left"/>
44608 <colspec colwidth="5*" align="center"/>
44609 <colspec colwidth="5*" align="center"/>
44610 <colspec colwidth="6*" align="right"/>
44613 <entry><option>server_realm</option></entry>
44614 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
44615 <entry>Type: <emphasis>string</emphasis></entry>
44616 <entry>Default: <emphasis>unset</emphasis></entry>
44622 This specifies the SASL realm that the server claims to be in.
44625 <indexterm role="option">
44626 <primary>server_service</primary>
44629 <informaltable frame="all">
44630 <tgroup cols="4" colsep="0" rowsep="0">
44631 <colspec colwidth="8*" align="left"/>
44632 <colspec colwidth="5*" align="center"/>
44633 <colspec colwidth="5*" align="center"/>
44634 <colspec colwidth="6*" align="right"/>
44637 <entry><option>server_service</option></entry>
44638 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
44639 <entry>Type: <emphasis>string</emphasis></entry>
44640 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
44646 This is the SASL service that the server claims to implement.
44649 For straightforward cases, you do not need to set any of the authenticator’s
44650 private options. All you need to do is to specify an appropriate mechanism as
44651 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
44652 PLAIN, you could have two authenticators as follows:
44654 <literallayout class="monospaced">
44656 driver = cyrus_sasl
44657 public_name = CRAM-MD5
44658 server_set_id = $auth1
44661 driver = cyrus_sasl
44662 public_name = PLAIN
44663 server_set_id = $auth1
44666 Cyrus SASL does implement the LOGIN authentication method, even though it is
44667 not a standard method. It is disabled by default in the source distribution,
44668 but it is present in many binary distributions.
44669 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
44670 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
44675 <chapter id="CHAPspa">
44676 <title>The spa authenticator</title>
44678 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
44679 <primary><command>spa</command> authenticator</primary>
44681 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
44682 <primary>authenticators</primary>
44683 <secondary><command>spa</command></secondary>
44685 <indexterm role="concept">
44686 <primary>authentication</primary>
44687 <secondary>Microsoft Secure Password</secondary>
44689 <indexterm role="concept">
44690 <primary>authentication</primary>
44691 <secondary>NTLM</secondary>
44693 <indexterm role="concept">
44694 <primary>Microsoft Secure Password Authentication</primary>
44696 <indexterm role="concept">
44697 <primary>NTLM authentication</primary>
44699 The <command>spa</command> authenticator provides client support for Microsoft’s <emphasis>Secure
44700 Password Authentication</emphasis> mechanism,
44701 which is also sometimes known as NTLM (NT LanMan). The code for client side of
44702 this authenticator was contributed by Marc Prud’hommeaux, and much of it is
44703 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
44704 server side was subsequently contributed by Tom Kistner. The mechanism works as
44710 After the AUTH command has been accepted, the client sends an SPA
44711 authentication request based on the user name and optional domain.
44716 The server sends back a challenge.
44721 The client builds a challenge response which makes use of the user’s password
44722 and sends it to the server, which then accepts or rejects it.
44727 Encryption is used to protect the password in transit.
44730 <title>Using spa as a server</title>
44732 <indexterm role="concept">
44733 <primary>options</primary>
44734 <secondary><command>spa</command> authenticator (server)</secondary>
44736 The <command>spa</command> authenticator has just one server option:
44739 <indexterm role="option">
44740 <primary>server_password</primary>
44743 <informaltable frame="all">
44744 <tgroup cols="4" colsep="0" rowsep="0">
44745 <colspec colwidth="8*" align="left"/>
44746 <colspec colwidth="5*" align="center"/>
44747 <colspec colwidth="5*" align="center"/>
44748 <colspec colwidth="6*" align="right"/>
44751 <entry><option>server_password</option></entry>
44752 <entry>Use: <emphasis>spa</emphasis></entry>
44753 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44754 <entry>Default: <emphasis>unset</emphasis></entry>
44760 <indexterm role="concept">
44761 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
44762 <secondary>in <command>spa</command> authenticator</secondary>
44764 This option is expanded, and the result must be the cleartext password for the
44765 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
44766 compatibility with previous releases of Exim, the user name is also placed in
44767 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
44768 it can lead to confusion in string expansions that also use numeric variables
44769 for other things. For example:
44771 <literallayout class="monospaced">
44775 server_password = \
44776 ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
44779 If the expansion is forced to fail, authentication fails. Any other expansion
44780 failure causes a temporary error code to be returned.
44784 <title>Using spa as a client</title>
44786 <indexterm role="concept">
44787 <primary>options</primary>
44788 <secondary><command>spa</command> authenticator (client)</secondary>
44790 The <command>spa</command> authenticator has the following client options:
44793 <indexterm role="option">
44794 <primary>client_domain</primary>
44797 <informaltable frame="all">
44798 <tgroup cols="4" colsep="0" rowsep="0">
44799 <colspec colwidth="8*" align="left"/>
44800 <colspec colwidth="5*" align="center"/>
44801 <colspec colwidth="5*" align="center"/>
44802 <colspec colwidth="6*" align="right"/>
44805 <entry><option>client_domain</option></entry>
44806 <entry>Use: <emphasis>spa</emphasis></entry>
44807 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44808 <entry>Default: <emphasis>unset</emphasis></entry>
44814 This option specifies an optional domain for the authentication.
44817 <indexterm role="option">
44818 <primary>client_password</primary>
44821 <informaltable frame="all">
44822 <tgroup cols="4" colsep="0" rowsep="0">
44823 <colspec colwidth="8*" align="left"/>
44824 <colspec colwidth="5*" align="center"/>
44825 <colspec colwidth="5*" align="center"/>
44826 <colspec colwidth="6*" align="right"/>
44829 <entry><option>client_password</option></entry>
44830 <entry>Use: <emphasis>spa</emphasis></entry>
44831 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44832 <entry>Default: <emphasis>unset</emphasis></entry>
44838 This option specifies the user’s password, and must be set.
44841 <indexterm role="option">
44842 <primary>client_username</primary>
44845 <informaltable frame="all">
44846 <tgroup cols="4" colsep="0" rowsep="0">
44847 <colspec colwidth="8*" align="left"/>
44848 <colspec colwidth="5*" align="center"/>
44849 <colspec colwidth="5*" align="center"/>
44850 <colspec colwidth="6*" align="right"/>
44853 <entry><option>client_username</option></entry>
44854 <entry>Use: <emphasis>spa</emphasis></entry>
44855 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44856 <entry>Default: <emphasis>unset</emphasis></entry>
44862 This option specifies the user name, and must be set. Here is an example of a
44863 configuration of this authenticator for use with the mail servers at
44864 <emphasis>msn.com</emphasis>:
44866 <literallayout class="monospaced">
44870 client_username = msn/msn_username
44871 client_password = msn_plaintext_password
44872 client_domain = DOMAIN_OR_UNSET
44875 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
44876 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
44881 <chapter id="CHAPTLS">
44882 <title>Encrypted SMTP connections using TLS/SSL</title>
44883 <titleabbrev>Encrypted SMTP connections</titleabbrev>
44885 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
44886 <primary>encryption</primary>
44887 <secondary>on SMTP connection</secondary>
44889 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
44890 <primary>SMTP</primary>
44891 <secondary>encryption</secondary>
44893 <indexterm role="concept">
44894 <primary>TLS</primary>
44895 <secondary>on SMTP connection</secondary>
44897 <indexterm role="concept">
44898 <primary>OpenSSL</primary>
44900 <indexterm role="concept">
44901 <primary>GnuTLS</primary>
44903 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
44904 Sockets Layer), is implemented by making use of the OpenSSL library or the
44905 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
44906 cryptographic code in the Exim distribution itself for implementing TLS. In
44907 order to use this feature you must install OpenSSL or GnuTLS, and then build a
44908 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
44909 You also need to understand the basic concepts of encryption at a managerial
44910 level, and in particular, the way that public keys, private keys, and
44911 certificates are used.
44914 RFC 3207 defines how SMTP connections can make use of encryption. Once a
44915 connection is established, the client issues a STARTTLS command. If the
44916 server accepts this, the client and the server negotiate an encryption
44917 mechanism. If the negotiation succeeds, the data that subsequently passes
44918 between them is encrypted.
44921 Exim’s ACLs can detect whether the current SMTP session is encrypted or not,
44922 and if so, what cipher suite is in use, whether the client supplied a
44923 certificate, and whether or not that certificate was verified. This makes it
44924 possible for an Exim server to deny or accept certain commands based on the
44928 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
44929 disrupt TLS connections. You need to turn off SMTP scanning for these products
44930 in order to get TLS to work.
44933 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
44935 <indexterm role="concept">
44936 <primary>ssmtp protocol</primary>
44938 <indexterm role="concept">
44939 <primary>smtps protocol</primary>
44941 <indexterm role="concept">
44942 <primary>SMTP</primary>
44943 <secondary>ssmtp protocol</secondary>
44945 <indexterm role="concept">
44946 <primary>SMTP</primary>
44947 <secondary>smtps protocol</secondary>
44949 Early implementations of encrypted SMTP used a different TCP port from normal
44950 SMTP, and expected an encryption negotiation to start immediately, instead of
44951 waiting for a STARTTLS command from the client using the standard SMTP
44952 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
44953 allocated for this purpose.
44956 This approach was abandoned when encrypted SMTP was standardised, but there are
44957 still some legacy clients that use it. Exim supports these clients by means of
44958 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
44959 numbers; the most common use is expected to be:
44961 <literallayout class="monospaced">
44962 tls_on_connect_ports = 465
44965 The port numbers specified by this option apply to all SMTP connections, both
44966 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
44967 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
44968 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
44969 an extra port – rather, it specifies different behaviour on a port that is
44973 There is also a <option>-tls-on-connect</option> command line option. This overrides
44974 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
44977 <section id="SECTopenvsgnu">
44978 <title>OpenSSL vs GnuTLS</title>
44980 <indexterm role="concept">
44981 <primary>TLS</primary>
44982 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
44984 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
44985 followed later, when the first versions of GnuTLS were released. To build Exim
44986 to use GnuTLS, you need to set
44988 <literallayout class="monospaced">
44992 in Local/Makefile, in addition to
44994 <literallayout class="monospaced">
44998 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
44999 include files and libraries for GnuTLS can be found.
45002 There are some differences in usage when using GnuTLS instead of OpenSSL:
45007 The <option>tls_verify_certificates</option> option must contain the name of a file, not the
45008 name of a directory (for OpenSSL it can be either).
45013 The <option>tls_dhparam</option> option is ignored, because early versions of GnuTLS had no
45014 facility for varying its Diffie-Hellman parameters. I understand that this has
45015 changed, but Exim has not been updated to provide this facility.
45020 <indexterm role="concept">
45021 <primary><varname>$tls_peerdn</varname></primary>
45023 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
45024 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
45025 affects the value of the <varname>$tls_peerdn</varname> variable.
45030 OpenSSL identifies cipher suites using hyphens as separators, for example:
45031 DES-CBC3-SHA. GnuTLS uses underscores, for example: RSA_ARCFOUR_SHA. What is
45032 more, OpenSSL complains if underscores are present in a cipher list. To make
45033 life simpler, Exim changes underscores to hyhens for OpenSSL and hyphens to
45034 underscores for GnuTLS when processing lists of cipher suites in the
45035 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
45041 The <option>tls_require_ciphers</option> options operate differently, as described in the
45042 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
45048 <title>GnuTLS parameter computation</title>
45050 GnuTLS uses RSA and D-H parameters that take a substantial amount of time to
45051 compute. It is unreasonable to re-compute them for every TLS session.
45052 Therefore, Exim keeps this data in a file in its spool directory, called
45053 <filename>gnutls-params</filename>. The file is owned by the Exim user and is readable only by
45054 its owner. Every Exim process that start up GnuTLS reads the RSA and D-H
45055 parameters from this file. If the file does not exist, the first Exim process
45056 that needs it computes the data and writes it to a temporary file which is
45057 renamed once it is complete. It does not matter if several Exim processes do
45058 this simultaneously (apart from wasting a few resources). Once a file is in
45059 place, new Exim processes immediately start using it.
45062 For maximum security, the parameters that are stored in this file should be
45063 recalculated periodically, the frequency depending on your paranoia level.
45064 Arranging this is easy in principle; just delete the file when you want new
45065 values to be computed. However, there may be a problem. The calculation of new
45066 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
45067 If the system is not very active, <filename>/dev/random</filename> may delay returning data
45068 until enough randomness (entropy) is available. This may cause Exim to hang for
45069 a substantial amount of time, causing timeouts on incoming connections.
45072 The solution is to generate the parameters externally to Exim. They are stored
45073 in <filename>gnutls-params</filename> in PEM format, which means that they can be generated
45074 externally using the <command>certtool</command> command that is part of GnuTLS.
45077 To replace the parameters with new ones, instead of deleting the file
45078 and letting Exim re-create it, you can generate new parameters using
45079 <command>certtool</command> and, when this has been done, replace Exim’s cache file by
45080 renaming. The relevant commands are something like this:
45082 <literallayout class="monospaced">
45085 # chown exim:exim new-params
45086 # chmod 0400 new-params
45087 # certtool --generate-privkey --bits 512 >new-params
45088 # echo "" >>new-params
45089 # certtool --generate-dh-params --bits 1024 >> new-params
45090 # mv new-params gnutls-params
45093 If Exim never has to generate the parameters itself, the possibility of
45094 stalling is removed.
45097 <section id="SECTreqciphssl">
45098 <title>Requiring specific ciphers in OpenSSL</title>
45100 <indexterm role="concept">
45101 <primary>TLS</primary>
45102 <secondary>requiring specific ciphers (OpenSSL)</secondary>
45104 <indexterm role="concept">
45105 <primary><option>tls_require_ciphers</option></primary>
45106 <secondary>OpenSSL</secondary>
45108 There is a function in the OpenSSL library that can be passed a list of cipher
45109 suites before the cipher negotiation takes place. This specifies which ciphers
45110 are acceptable. The list is colon separated and may contain names like
45111 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
45112 directly to this function call. The following quotation from the OpenSSL
45113 documentation specifies what forms of item are allowed in the cipher string:
45118 It can consist of a single cipher suite such as RC4-SHA.
45123 It can represent a list of cipher suites containing a certain algorithm,
45124 or cipher suites of a certain type. For example SHA1 represents all
45125 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
45131 Lists of cipher suites can be combined in a single cipher string using
45132 the + character. This is used as a logical and operation. For example
45133 SHA1+DES represents all cipher suites containing the SHA1 and the DES
45139 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
45140 <literal>-</literal> or <literal>+</literal>.
45145 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
45146 ciphers deleted can never reappear in the list even if they are explicitly
45152 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
45153 of the ciphers can be added again by later options.
45158 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
45159 option does not add any new ciphers; it just moves matching existing ones.
45164 If none of these characters is present, the string is interpreted as
45165 a list of ciphers to be appended to the current preference list. If the list
45166 includes any ciphers already present they will be ignored: that is, they will
45167 not be moved to the end of the list.
45170 <section id="SECTreqciphgnu">
45171 <title>Requiring specific ciphers in GnuTLS</title>
45173 <indexterm role="concept">
45174 <primary>TLS</primary>
45175 <secondary>requiring specific ciphers (GnuTLS)</secondary>
45177 <indexterm role="concept">
45178 <primary><option>tls_require_ciphers</option></primary>
45179 <secondary>GnuTLS</secondary>
45181 The GnuTLS library does not have a combined function like OpenSSL. Instead,
45182 it allows the caller to specify separate lists of key-exchange methods,
45183 main cipher algorithms, and MAC algorithms. Unfortunately, these lists are
45184 numerical, and the library does not have a function for turning names into
45185 numbers. Consequently, the list of recognized names has to be built into
45189 At present, Exim permits only the list of main cipher algorithms to be
45190 changed. The <option>tls_require_ciphers</option> option is in the same format as for
45191 OpenSSL. Exim searches each item for the name of available algorithm. For
45192 example, if the list contains RSA_AES_SHA then AES is recognized.
45195 The cipher algorithms list starts out with a default set of algorithms. If
45196 the first item in <option>tls_require_ciphers</option> does <emphasis>not</emphasis> start with an
45197 exclamation mark, all the default items are deleted. Thus, only those specified
45198 can be used. If the first item in <option>tls_require_ciphers</option> <emphasis>does</emphasis> start with
45199 an exclamation mark, the defaults are left on the list.
45202 Then, any item that starts with an exclamation mark causes the relevant
45203 algorithms to be removed from the list, and any item that does not start
45204 with an exclamation mark causes the relevant algorithms to be added to the
45207 <literallayout class="monospaced">
45208 tls_require_ciphers = !RSA_ARCFOUR_SHA
45211 allows all the defaults except those that use ARCFOUR, whereas
45213 <literallayout class="monospaced">
45214 tls_require_ciphers = AES : 3DES
45217 allows only cipher suites that use AES and 3DES. The currently recognized
45218 algorithms are: AES_256, AES_128, AES (both of the preceding), 3DES, and
45219 ARCFOUR_128. Unrecognized algorithms are ignored. In a server, the order of the
45220 list is unimportant; the server will advertise the availability of all the
45221 relevant cipher suites. However, in a client, the order of the list specifies a
45222 preference order for the algorithms. The first one in the client’s list that is
45223 also advertised by the server is tried first. The default order is as listed
45228 <title>Configuring an Exim server to use TLS</title>
45230 <indexterm role="concept">
45231 <primary>TLS</primary>
45232 <secondary>configuring an Exim server</secondary>
45234 When Exim has been built with TLS support, it advertises the availability of
45235 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
45236 but not to any others. The default value of this option is unset, which means
45237 that STARTTLS is not advertised at all. This default is chosen because you
45238 need to set some other options in order to make TLS avaliable, and also it is
45239 sensible for systems that want to use TLS only as a client.
45242 If a client issues a STARTTLS command and there is some configuration
45243 problem in the server, the command is rejected with a 454 error. If the client
45244 persists in trying to issue SMTP commands, all except QUIT are rejected
45247 <literallayout class="monospaced">
45248 554 Security failure
45251 If a STARTTLS command is issued within an existing TLS session, it is
45252 rejected with a 554 error code.
45255 To enable TLS operations on a server, you must set <option>tls_advertise_hosts</option> to
45256 match some hosts. You can, of course, set it to * to match all hosts.
45257 However, this is not all you need to do. TLS sessions to a server won’t work
45258 without some further configuration at the server end.
45261 It is rumoured that all existing clients that support TLS/SSL use RSA
45262 encryption. To make this work you need to set, in the server,
45264 <literallayout class="monospaced">
45265 tls_certificate = /some/file/name
45266 tls_privatekey = /some/file/name
45269 These options are, in fact, expanded strings, so you can make them depend on
45270 the identity of the client that is connected if you wish. The first file
45271 contains the server’s X509 certificate, and the second contains the private key
45272 that goes with it. These files need to be readable by the Exim user, and must
45273 always be given as full path names. They can be the same file if both the
45274 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
45275 set, or if its expansion is forced to fail or results in an empty string, this
45276 is assumed to be the case. The certificate file may also contain intermediate
45277 certificates that need to be sent to the client to enable it to authenticate
45278 the server’s certificate.
45281 If you do not understand about certificates and keys, please try to find a
45282 source of this background information, which is not Exim-specific. (There are a
45283 few comments below in section <xref linkend="SECTcerandall"/>.)
45286 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client –
45287 they apply only in the case of a server. If you need to use a certificate in an
45288 Exim client, you must set the options of the same names in an <command>smtp</command>
45292 With just these options, an Exim server will be able to use TLS. It does not
45293 require the client to have a certificate (but see below for how to insist on
45294 this). There is one other option that may be needed in other situations. If
45296 <literallayout class="monospaced">
45297 tls_dhparam = /some/file/name
45300 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
45301 with the parameters contained in the file. This increases the set of cipher
45302 suites that the server supports. See the command
45304 <literallayout class="monospaced">
45308 for a way of generating this data. At present, <option>tls_dhparam</option> is used only
45309 when Exim is linked with OpenSSL. It is ignored if GnuTLS is being used.
45312 The strings supplied for these three options are expanded every time a client
45313 host connects. It is therefore possible to use different certificates and keys
45314 for different hosts, if you so wish, by making use of the client’s IP address
45315 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
45316 forced to fail, Exim behaves as if the option is not set.
45319 <indexterm role="concept">
45320 <primary>cipher</primary>
45321 <secondary>logging</secondary>
45323 <indexterm role="concept">
45324 <primary>log</primary>
45325 <secondary>TLS cipher</secondary>
45327 <indexterm role="concept">
45328 <primary><varname>$tls_cipher</varname></primary>
45330 The variable <varname>$tls_cipher</varname> is set to the cipher suite that was negotiated for
45331 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
45332 incoming message (by default – you can, of course, change this), and it is
45333 also included in the log line that records a message’s arrival, keyed by
45334 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
45335 condition can be used to test for specific cipher suites in ACLs.
45338 The ACLs that run for subsequent SMTP commands can check the name of the cipher
45339 suite and vary their actions accordingly. The cipher suite names are those used
45340 by OpenSSL. These may differ from the names used elsewhere. For example,
45341 OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other contexts
45342 is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL
45343 documentation for more details.
45347 <title>Requesting and verifying client certificates</title>
45349 <indexterm role="concept">
45350 <primary>certificate</primary>
45351 <secondary>verification of client</secondary>
45353 <indexterm role="concept">
45354 <primary>TLS</primary>
45355 <secondary>client certificate verification</secondary>
45357 If you want an Exim server to request a certificate when negotiating a TLS
45358 session with a client, you must set either <option>tls_verify_hosts</option> or
45359 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
45360 apply to all TLS connections. For any host that matches one of these options,
45361 Exim requests a certificate as part of the setup of the TLS session. The
45362 contents of the certificate are verified by comparing it with a list of
45363 expected certificates. These must be available in a file or,
45364 for OpenSSL only (not GnuTLS), a directory, identified by
45365 <option>tls_verify_certificates</option>.
45368 A file can contain multiple certificates, concatenated end to end. If a
45371 each certificate must be in a separate file, with a name (or a symbolic link)
45372 of the form <<emphasis>hash</emphasis>>.0, where <<emphasis>hash</emphasis>> is a hash value constructed from the
45373 certificate. You can compute the relevant hash by running the command
45375 <literallayout class="monospaced">
45376 openssl x509 -hash -noout -in /cert/file
45379 where <filename>/cert/file</filename> contains a single certificate.
45382 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
45383 what happens if the client does not supply a certificate, or if the certificate
45384 does not match any of the certificates in the collection named by
45385 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
45386 attempt to set up a TLS session is aborted, and the incoming connection is
45387 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
45388 session continues. ACLs that run for subsequent SMTP commands can detect the
45389 fact that no certificate was verified, and vary their actions accordingly. For
45390 example, you can insist on a certificate before accepting a message for
45391 relaying, but not when the message is destined for local delivery.
45394 <indexterm role="concept">
45395 <primary><varname>$tls_peerdn</varname></primary>
45397 When a client supplies a certificate (whether it verifies or not), the value of
45398 the Distinguished Name of the certificate is made available in the variable
45399 <varname>$tls_peerdn</varname> during subsequent processing of the message.
45402 <indexterm role="concept">
45403 <primary>log</primary>
45404 <secondary>distinguished name</secondary>
45406 Because it is often a long text string, it is not included in the log line or
45407 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
45408 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
45409 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
45410 certificate is supplied, <varname>$tls_peerdn</varname> is empty.
45414 <title>Revoked certificates</title>
45416 <indexterm role="concept">
45417 <primary>TLS</primary>
45418 <secondary>revoked certificates</secondary>
45420 <indexterm role="concept">
45421 <primary>revocation list</primary>
45423 <indexterm role="concept">
45424 <primary>certificate</primary>
45425 <secondary>revocation list</secondary>
45427 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
45428 certificates are revoked. If you have such a list, you can pass it to an Exim
45429 server using the global option called <option>tls_crl</option> and to an Exim client using
45430 an identically named option for the <command>smtp</command> transport. In each case, the value
45431 of the option is expanded and must then be the name of a file that contains a
45436 <title>Configuring an Exim client to use TLS</title>
45438 <indexterm role="concept">
45439 <primary>cipher</primary>
45440 <secondary>logging</secondary>
45442 <indexterm role="concept">
45443 <primary>log</primary>
45444 <secondary>TLS cipher</secondary>
45446 <indexterm role="concept">
45447 <primary>log</primary>
45448 <secondary>distinguished name</secondary>
45450 <indexterm role="concept">
45451 <primary>TLS</primary>
45452 <secondary>configuring an Exim client</secondary>
45454 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
45455 deliveries as well as to incoming, the latter one causing logging of the
45456 server certificate’s DN. The remaining client configuration for TLS is all
45457 within the <command>smtp</command> transport.
45460 It is not necessary to set any options to have TLS work in the <command>smtp</command>
45461 transport. If Exim is built with TLS support, and TLS is advertised by a
45462 server, the <command>smtp</command> transport always tries to start a TLS session. However,
45463 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
45464 transport) to a list of server hosts for which TLS should not be used.
45467 If you do not want Exim to attempt to send messages unencrypted when an attempt
45468 to set up an encrypted connection fails in any way, you can set
45469 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
45470 those hosts, delivery is always deferred if an encrypted connection cannot be
45471 set up. If there are any other hosts for the address, they are tried in the
45475 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
45476 the message unencrypted. It always does this if the response to STARTTLS is
45477 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
45478 session after a success response code, what happens is controlled by the
45479 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
45480 delivery to this host is deferred, and other hosts (if available) are tried. If
45481 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
45482 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
45483 negotiation fails, Exim closes the current connection (because it is in an
45484 unknown state), opens a new one to the same host, and then tries the delivery
45488 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
45489 transport provide the client with a certificate, which is passed to the server
45490 if it requests it. If the server is Exim, it will request a certificate only if
45491 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client. <emphasis role="bold">Note</emphasis>:
45492 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
45493 is operating as a client. Exim does not assume that a server certificate (set
45494 by the global options of the same name) should also be used when operating as a
45498 If <option>tls_verify_certificates</option> is set, it must name a file or,
45499 for OpenSSL only (not GnuTLS), a directory, that contains a collection of
45500 expected server certificates. The client verifies the server’s certificate
45501 against this collection, taking into account any revoked certificates that are
45502 in the list defined by <option>tls_crl</option>.
45506 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
45507 list of permitted cipher suites. If either of these checks fails, delivery to
45508 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
45509 alternative hosts, if any.
45512 <indexterm role="concept">
45513 <primary><varname>$host</varname></primary>
45515 <indexterm role="concept">
45516 <primary><varname>$host_address</varname></primary>
45518 All the TLS options in the <command>smtp</command> transport are expanded before use, with
45519 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
45520 which the client is connected. Forced failure of an expansion causes Exim to
45521 behave as if the relevant option were unset.
45524 <section id="SECTmulmessam">
45525 <title>Multiple messages on the same encrypted TCP/IP connection</title>
45527 <indexterm role="concept">
45528 <primary>multiple SMTP deliveries with TLS</primary>
45530 <indexterm role="concept">
45531 <primary>TLS</primary>
45532 <secondary>multiple message deliveries</secondary>
45534 Exim sends multiple messages down the same TCP/IP connection by starting up
45535 an entirely new delivery process for each message, passing the socket from
45536 one process to the next. This implementation does not fit well with the use
45537 of TLS, because there is quite a lot of state information associated with a TLS
45538 connection, not just a socket identification. Passing all the state information
45539 to a new process is not feasible. Consequently, Exim shuts down an existing TLS
45540 session before passing the socket to a new process. The new process may then
45541 try to start a new TLS session, and if successful, may try to re-authenticate
45542 if AUTH is in use, before sending the next message.
45545 The RFC is not clear as to whether or not an SMTP session continues in clear
45546 after TLS has been shut down, or whether TLS may be restarted again later, as
45547 just described. However, if the server is Exim, this shutdown and
45548 reinitialization works. It is not known which (if any) other servers operate
45549 successfully if the client closes a TLS session and continues with unencrypted
45550 SMTP, but there are certainly some that do not work. For such servers, Exim
45551 should not pass the socket to another process, because the failure of the
45552 subsequent attempt to use it would cause Exim to record a temporary host error,
45553 and delay other deliveries to that host.
45556 To test for this case, Exim sends an EHLO command to the server after
45557 closing down the TLS session. If this fails in any way, the connection is
45558 closed instead of being passed to a new delivery process, but no retry
45559 information is recorded.
45562 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
45563 <command>smtp</command> transport to match those hosts for which Exim should not pass
45564 connections to new processes if TLS has been used.
45567 <section id="SECTcerandall">
45568 <title>Certificates and all that</title>
45570 <indexterm role="concept">
45571 <primary>certificate</primary>
45572 <secondary>references to discussion</secondary>
45574 In order to understand fully how TLS works, you need to know about
45575 certificates, certificate signing, and certificate authorities. This is not the
45576 place to give a tutorial, especially as I do not know very much about it
45577 myself. Some helpful introduction can be found in the FAQ for the SSL addition
45578 to Apache, currently at
45581 <emphasis role="bold"><ulink url="http://www.modssl.org/docs/2.7/ssl_faq.html#ToC24">http://www.modssl.org/docs/2.7/ssl_faq.html#ToC24</ulink></emphasis>
45584 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
45585 links to further files.
45586 Eric Rescorla’s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
45587 0-201-61598-3), contains both introductory and more in-depth descriptions.
45588 Some sample programs taken from the book are available from
45591 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
45595 <title>Certificate chains</title>
45597 The file named by <option>tls_certificate</option> may contain more than one
45598 certificate. This is useful in the case where the certificate that is being
45599 sent is validated by an intermediate certificate which the other end does
45600 not have. Multiple certificates must be in the correct order in the file.
45601 First the host’s certificate itself, then the first intermediate
45602 certificate to validate the issuer of the host certificate, then the next
45603 intermediate certificate to validate the issuer of the first intermediate
45604 certificate, and so on, until finally (optionally) the root certificate.
45605 The root certificate must already be trusted by the recipient for
45606 validation to succeed, of course, but if it’s not preinstalled, sending the
45607 root certificate along with the rest makes it available for the user to
45608 install if the receiving end is a client MUA that can interact with a user.
45612 <title>Self-signed certificates</title>
45614 <indexterm role="concept">
45615 <primary>certificate</primary>
45616 <secondary>self-signed</secondary>
45618 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
45619 with OpenSSL, like this:
45621 <literallayout class="monospaced">
45622 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
45626 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
45627 delimited and so can be identified independently. The <option>-days</option> option
45628 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
45629 important: if you do not set it, the key is encrypted with a passphrase
45630 that you are prompted for, and any use that is made of the key causes more
45631 prompting for the passphrase. This is not helpful if you are going to use
45632 this certificate and key in an MTA, where prompting is not possible.
45635 A self-signed certificate made in this way is sufficient for testing, and
45636 may be adequate for all your requirements if you are mainly interested in
45637 encrypting transfers, and not in secure identification.
45640 However, many clients require that the certificate presented by the server be a
45641 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
45642 certificate. In this situation, the self-signed certificate described above
45643 must be installed on the client host as a trusted root <emphasis>certification
45644 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
45645 signed with that self-signed certificate.
45648 For information on creating self-signed CA certificates and using them to sign
45649 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
45650 Open-source PKI book, available online at
45651 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
45652 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
45653 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
45658 <chapter id="CHAPACL">
45659 <title>Access control lists</title>
45661 <indexterm role="concept" id="IIDacl" class="startofrange">
45662 <primary>access control lists (ACLs)</primary>
45663 <secondary>description</secondary>
45665 <indexterm role="concept">
45666 <primary>control of incoming mail</primary>
45668 <indexterm role="concept">
45669 <primary>message</primary>
45670 <secondary>controlling incoming</secondary>
45672 <indexterm role="concept">
45673 <primary>policy control</primary>
45674 <secondary>access control lists</secondary>
45676 Access Control Lists (ACLs) are defined in a separate section of the run time
45677 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
45678 name, terminated by a colon. Here is a complete ACL section that contains just
45679 one very small ACL:
45681 <literallayout class="monospaced">
45685 accept hosts = one.host.only
45688 You can have as many lists as you like in the ACL section, and the order in
45689 which they appear does not matter. The lists are self-terminating.
45692 The majority of ACLs are used to control Exim’s behaviour when it receives
45693 certain SMTP commands. This applies both to incoming TCP/IP connections, and
45694 when a local process submits a message using SMTP by specifying the <option>-bs</option>
45695 option. The most common use is for controlling which recipients are accepted
45696 in incoming messages. In addition, you can define an ACL that is used to check
45697 local non-SMTP messages. The default configuration file contains an example of
45698 a realistic ACL for checking RCPT commands. This is discussed in chapter
45699 <xref linkend="CHAPdefconfil"/>.
45702 <title>Testing ACLs</title>
45704 The <option>-bh</option> command line option provides a way of testing your ACL
45705 configuration locally by running a fake SMTP session with which you interact.
45706 The host <emphasis>relay-test.mail-abuse.org</emphasis> provides a service for checking your
45707 relaying configuration (see section <xref linkend="SECTcheralcon"/> for more details).
45711 <title>Specifying when ACLs are used</title>
45713 <indexterm role="concept">
45714 <primary>access control lists (ACLs)</primary>
45715 <secondary>options for specifying</secondary>
45717 In order to cause an ACL to be used, you have to name it in one of the relevant
45718 options in the main part of the configuration. These options are:
45719 <indexterm role="concept">
45720 <primary>AUTH</primary>
45721 <secondary>ACL for</secondary>
45723 <indexterm role="concept">
45724 <primary>DATA</primary>
45725 <secondary>ACLs for</secondary>
45727 <indexterm role="concept">
45728 <primary>ETRN</primary>
45729 <secondary>ACL for</secondary>
45731 <indexterm role="concept">
45732 <primary>EXPN</primary>
45733 <secondary>ACL for</secondary>
45735 <indexterm role="concept">
45736 <primary>HELO</primary>
45737 <secondary>ACL for</secondary>
45739 <indexterm role="concept">
45740 <primary>EHLO</primary>
45741 <secondary>ACL for</secondary>
45743 <indexterm role="concept">
45744 <primary>MAIL</primary>
45745 <secondary>ACL for</secondary>
45747 <indexterm role="concept">
45748 <primary>QUIT</primary>
45749 <secondary>ACL for</secondary>
45751 <indexterm role="concept">
45752 <primary>RCPT</primary>
45753 <secondary>ACL for</secondary>
45755 <indexterm role="concept">
45756 <primary>STARTTLS</primary>
45757 <secondary>ACL for</secondary>
45759 <indexterm role="concept">
45760 <primary>VRFY</primary>
45761 <secondary>ACL for</secondary>
45763 <indexterm role="concept">
45764 <primary>SMTP connection</primary>
45765 <secondary>ACL for</secondary>
45767 <indexterm role="concept">
45768 <primary>non-smtp message</primary>
45769 <secondary>ACLs for</secondary>
45771 <indexterm role="concept">
45772 <primary>MIME parts</primary>
45773 <secondary>ACL for</secondary>
45776 <informaltable frame="none">
45777 <tgroup cols="2" colsep="0" rowsep="0">
45778 <colspec colwidth="140pt" align="left"/>
45779 <colspec colwidth="254pt" align="left"/>
45782 <entry> <option>acl_not_smtp</option></entry>
45783 <entry>ACL for non-SMTP messages</entry>
45785 <phrase revisionflag="changed"><row>
45786 <entry> <option>acl_not_smtp_mime</option></entry>
45787 <entry>ACL for non-SMTP MIME parts</entry>
45790 <entry> <option>acl_not_smtp_start</option></entry>
45791 <entry>ACL at start of non-SMTP message</entry>
45794 <entry> <option>acl_smtp_auth</option></entry>
45795 <entry>ACL for AUTH</entry>
45798 <entry> <option>acl_smtp_connect</option></entry>
45799 <entry>ACL for start of SMTP connection</entry>
45802 <entry> <option>acl_smtp_data</option></entry>
45803 <entry>ACL after DATA is complete</entry>
45806 <entry> <option>acl_smtp_etrn</option></entry>
45807 <entry>ACL for ETRN</entry>
45810 <entry> <option>acl_smtp_expn</option></entry>
45811 <entry>ACL for EXPN</entry>
45814 <entry> <option>acl_smtp_helo</option></entry>
45815 <entry>ACL for HELO or EHLO</entry>
45818 <entry> <option>acl_smtp_mail</option></entry>
45819 <entry>ACL for MAIL</entry>
45822 <entry> <option>acl_smtp_mailauth</option></entry>
45823 <entry>ACL for the AUTH parameter of MAIL</entry>
45826 <entry> <option>acl_smtp_mime</option></entry>
45827 <entry>ACL for content-scanning MIME parts</entry>
45830 <entry> <option>acl_smtp_predata</option></entry>
45831 <entry>ACL at start of DATA command</entry>
45834 <entry> <option>acl_smtp_quit</option></entry>
45835 <entry>ACL for QUIT</entry>
45838 <entry> <option>acl_smtp_rcpt</option></entry>
45839 <entry>ACL for RCPT</entry>
45842 <entry> <option>acl_smtp_starttls</option></entry>
45843 <entry>ACL for STARTTLS</entry>
45846 <entry> <option>acl_smtp_vrfy</option></entry>
45847 <entry>ACL for VRFY</entry>
45853 For example, if you set
45855 <literallayout class="monospaced">
45856 acl_smtp_rcpt = small_acl
45859 the little ACL defined above is used whenever Exim receives a RCPT command
45860 in an SMTP dialogue. The majority of policy tests on incoming messages can be
45861 done when RCPT commands arrive. A rejection of RCPT should cause the
45862 sending MTA to give up on the recipient address contained in the RCPT
45863 command, whereas rejection at other times may cause the client MTA to keep on
45864 trying to deliver the message. It is therefore recommended that you do as much
45865 testing as possible at RCPT time.
45868 <section revisionflag="changed">
45869 <title>The non-SMTP ACLs</title>
45870 <para revisionflag="changed">
45871 <indexterm role="concept">
45872 <primary>non-smtp message</primary>
45873 <secondary>ACLs for</secondary>
45875 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
45876 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
45877 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
45878 the state of the SMTP connection such as encryption and authentication) are not
45879 relevant and are forbidden in these ACLs. However, the sender and recipients
45880 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
45881 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
45882 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
45883 in any of these ACLs.
45885 <para revisionflag="changed">
45886 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
45887 non-SMTP message, before any of the message has been read. (This is the
45888 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) The result of this
45889 ACL is ignored; it cannot be used to reject a message. If you really need to,
45890 you could set a value in an ACL variable here and reject based on that in the
45891 <option>acl_not_smtp</option> ACL. However, this ACL can be used to set controls, and in
45892 particular, it can be used to set
45894 <literallayout class="monospaced" revisionflag="changed">
45895 control = suppress_local_fixups
45897 <para revisionflag="changed">
45898 This cannot be used in the other non-SMTP ACLs because by the time they are
45899 run, it is too late.
45901 <para revisionflag="changed">
45902 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
45903 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
45905 <para revisionflag="changed">
45906 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
45907 kind of rejection is treated as permanent, because there is no way of sending a
45908 temporary error for these kinds of message.
45911 <section revisionflag="changed">
45912 <title>The SMTP connect ACL</title>
45913 <para revisionflag="changed">
45914 <indexterm role="concept">
45915 <primary>SMTP connection</primary>
45916 <secondary>ACL for</secondary>
45918 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
45919 session, after the test specified by <option>host_reject_connection</option> (which is now
45920 an anomaly) and any TCP Wrappers testing (if configured).
45924 <title>The DATA ACLs</title>
45926 <indexterm role="concept">
45927 <primary>DATA</primary>
45928 <secondary>ACLs for</secondary>
45930 Two ACLs are associated with the DATA command, because it is two-stage
45931 command, with two responses being sent to the client.
45932 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
45933 is obeyed. This gives you control after all the RCPT commands, but before
45934 the message itself is received. It offers the opportunity to give a negative
45935 response to the DATA command before the data is transmitted. Header lines
45936 added by MAIL or RCPT ACLs are not visible at this time, but any that
45937 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
45940 You cannot test the contents of the message, for example, to verify addresses
45941 in the headers, at RCPT time or when the DATA command is received. Such
45942 tests have to appear in the ACL that is run after the message itself has been
45943 received, before the final response to the DATA command is sent. This is
45944 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
45945 associated with the DATA command.
45948 For both of these ACLs, it is not possible to reject individual recipients. An
45949 error response rejects the entire message. Unfortunately, it is known that some
45950 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
45951 before or after the data) correctly – they keep the message on their queues
45952 and try again later, but that is their problem, though it does waste some of
45957 <title>The SMTP MIME ACL</title>
45959 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
45960 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
45963 <section id="SECTQUITACL">
45964 <title>The QUIT ACL</title>
45966 <indexterm role="concept">
45967 <primary>QUIT</primary>
45968 <secondary>ACL for</secondary>
45970 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
45971 does not affect the response code to QUIT, which is always 221. Thus, the ACL
45972 does not in fact control any access. For this reason, the only verbs that are
45973 permitted are <option>accept</option> and <option>warn</option>.
45976 This ACL can be used for tasks such as custom logging at the end of an SMTP
45977 session. For example, you can use ACL variables in other ACLs to count
45978 messages, recipients, etc., and log the totals at QUIT time using one or
45979 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
45982 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
45983 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
45986 You do not need to have a final <option>accept</option>, but if you do, you can use a
45987 <option>message</option> modifier to specify custom text that is sent as part of the 221
45991 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
45992 failure (for example, failure to open a log file, or when Exim is bombing out
45993 because it has detected an unrecoverable error), all SMTP commands from the
45994 client are given temporary error responses until QUIT is received or the
45995 connection is closed. In these special cases, the QUIT ACL does not run.
45999 <title>Finding an ACL to use</title>
46001 <indexterm role="concept">
46002 <primary>access control lists (ACLs)</primary>
46003 <secondary>finding which to use</secondary>
46005 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
46006 you can use different ACLs in different circumstances. For example,
46008 <literallayout class="monospaced">
46009 acl_smtp_rcpt = ${if ={25}{$interface_port} \
46010 {acl_check_rcpt} {acl_check_rcpt_submit} }
46013 In the default configuration file there are some example settings for
46014 providing an RFC 4409 message submission service on port 587 and a
46015 non-standard <quote>smtps</quote> service on port 465. You can use a string
46016 expansion like this to choose an ACL for MUAs on these ports which is
46017 more appropriate for this purpose than the default ACL on port 25.
46020 The expanded string does not have to be the name of an ACL in the
46021 configuration file; there are other possibilities. Having expanded the
46022 string, Exim searches for an ACL as follows:
46027 If the string begins with a slash, Exim uses it as a file name, and reads its
46028 contents as an ACL. The lines are processed in the same way as lines in the
46029 Exim configuration file. In particular, continuation lines are supported, blank
46030 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
46031 If the file does not exist or cannot be read, an error occurs (typically
46032 causing a temporary failure of whatever caused the ACL to be run). For example:
46034 <literallayout class="monospaced">
46035 acl_smtp_data = /etc/acls/\
46036 ${lookup{$sender_host_address}lsearch\
46037 {/etc/acllist}{$value}{default}}
46040 This looks up an ACL file to use on the basis of the host’s IP address, falling
46041 back to a default if the lookup fails. If an ACL is successfully read from a
46042 file, it is retained in memory for the duration of the Exim process, so that it
46043 can be re-used without having to re-read the file.
46048 If the string does not start with a slash, and does not contain any spaces,
46049 Exim searches the ACL section of the configuration for an ACL whose name
46050 matches the string.
46055 If no named ACL is found, or if the string contains spaces, Exim parses
46056 the string as an inline ACL. This can save typing in cases where you just
46057 want to have something like
46059 <literallayout class="monospaced">
46060 acl_smtp_vrfy = accept
46063 in order to allow free use of the VRFY command. Such a string may contain
46064 newlines; it is processed in the same way as an ACL that is read from a file.
46070 <title>ACL return codes</title>
46072 <indexterm role="concept">
46073 <primary>access control lists (ACLs)</primary>
46074 <secondary>return codes</secondary>
46076 Except for the QUIT ACL, which does not affect the SMTP return code (see
46077 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
46078 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
46079 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
46080 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
46081 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
46082 This also causes a 4<emphasis>xx</emphasis> return code.
46085 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
46086 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
46087 submitters of non-SMTP messages.
46090 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
46091 has the effect of <quote>accept</quote>, but causes either the entire message or an
46092 individual recipient address to be discarded. In other words, it is a
46093 blackholing facility. Use it with care.
46096 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
46097 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
46098 RCPT ACL is to discard just the one recipient address. If there are no
46099 recipients left when the message’s data is received, the DATA ACL is not
46100 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
46101 remaining recipients. The <quote>discard</quote> return is not permitted for the
46102 <option>acl_smtp_predata</option> ACL.
46105 <indexterm role="concept">
46106 <primary><function>local_scan()</function> function</primary>
46107 <secondary>when all recipients discarded</secondary>
46109 The <function>local_scan()</function> function is always run, even if there are no remaining
46110 recipients; it may create new recipients.
46114 <title>Unset ACL options</title>
46116 <indexterm role="concept">
46117 <primary>access control lists (ACLs)</primary>
46118 <secondary>unset options</secondary>
46120 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
46121 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
46122 not defined at all. For any defined ACL, the default action when control
46123 reaches the end of the ACL statements is <quote>deny</quote>.
46125 <para revisionflag="changed">
46126 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
46127 these two are ACLs that are used only for their side effects. They cannot be
46128 used to accept or reject anything.
46131 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
46132 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
46133 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
46134 when the ACL is not defined is <quote>accept</quote>.
46137 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
46138 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
46139 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
46140 messages over an SMTP connection. For an example, see the ACL in the default
46141 configuration file.
46145 <title>Data for message ACLs</title>
46147 <indexterm role="concept">
46148 <primary>access control lists (ACLs)</primary>
46149 <secondary>data for message ACL</secondary>
46151 <indexterm role="concept">
46152 <primary><varname>$domain</varname></primary>
46154 <indexterm role="concept">
46155 <primary><varname>$local_part</varname></primary>
46157 <indexterm role="concept">
46158 <primary><varname>$sender_address</varname></primary>
46160 <indexterm role="concept">
46161 <primary><varname>$sender_host_address</varname></primary>
46163 <indexterm role="concept">
46164 <primary><varname>$smtp_command</varname></primary>
46166 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
46167 that contain information about the host and the message’s sender (for example,
46168 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
46169 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
46170 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
46171 is available in <varname>$smtp_command</varname>.
46174 When an ACL for the AUTH parameter of MAIL is running, the variables that
46175 contain information about the host are set, but <varname>$sender_address</varname> is not yet
46176 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
46180 <indexterm role="concept">
46181 <primary><varname>$message_size</varname></primary>
46183 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
46184 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
46185 that parameter is not given. The value is updated to the true message size by
46186 the time the final DATA ACL is run (after the message data has been
46190 <indexterm role="concept">
46191 <primary><varname>$rcpt_count</varname></primary>
46193 <indexterm role="concept">
46194 <primary><varname>$recipients_count</varname></primary>
46196 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
46197 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
46198 accepted, so while an ACL for RCPT is being processed, it contains the number
46199 of previously accepted recipients. At DATA time (for both the DATA ACLs),
46200 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
46201 <varname>$recipients_count</varname> contains the total number of accepted recipients.
46204 <section id="SECTdatfornon">
46205 <title>Data for non-message ACLs</title>
46207 <indexterm role="concept">
46208 <primary>access control lists (ACLs)</primary>
46209 <secondary>data for non-message ACL</secondary>
46211 <indexterm role="concept">
46212 <primary><varname>$smtp_command_argument</varname></primary>
46214 <indexterm role="concept">
46215 <primary><varname>$smtp_command</varname></primary>
46217 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
46218 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
46219 and the entire SMTP command is available in <varname>$smtp_command</varname>.
46220 These variables can be tested using a <option>condition</option> condition. For example,
46221 here is an ACL for use with AUTH, which insists that either the session is
46222 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
46223 does not permit authentication methods that use cleartext passwords on
46224 unencrypted connections.
46226 <literallayout class="monospaced">
46228 accept encrypted = *
46229 accept condition = ${if eq{${uc:$smtp_command_argument}}\
46231 deny message = TLS encryption or CRAM-MD5 required
46234 (Another way of applying this restriction is to arrange for the authenticators
46235 that use cleartext passwords not to be advertised when the connection is not
46236 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
46237 option to do this.)
46241 <title>Format of an ACL</title>
46243 <indexterm role="concept">
46244 <primary>access control lists (ACLs)</primary>
46245 <secondary>format of</secondary>
46247 <indexterm role="concept">
46248 <primary>access control lists (ACLs)</primary>
46249 <secondary>verbs; definition of</secondary>
46251 An individual ACL consists of a number of statements. Each statement starts
46252 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
46253 Modifiers can change the way the verb operates, define error and log messages,
46254 set variables, insert delays, and vary the processing of accepted messages.
46257 If all the conditions are met, the verb is obeyed. The same condition may be
46258 used (with different arguments) more than once in the same statement. This
46259 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
46262 <literallayout class="monospaced">
46263 deny dnslists = list1.example
46264 dnslists = list2.example
46267 If there are no conditions, the verb is always obeyed. Exim stops evaluating
46268 the conditions and modifiers when it reaches a condition that fails. What
46269 happens then depends on the verb (and in one case, on a special modifier). Not
46270 all the conditions make sense at every testing point. For example, you cannot
46271 test a sender address in the ACL that is run for a VRFY command.
46275 <title>ACL verbs</title>
46277 The ACL verbs are as follows:
46282 <indexterm role="concept">
46283 <primary><option>accept</option></primary>
46284 <secondary>ACL verb</secondary>
46286 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
46287 of the conditions are not met, what happens depends on whether <option>endpass</option>
46288 appears among the conditions (for syntax see below). If the failing condition
46289 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
46290 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
46291 check a RCPT command:
46293 <literallayout class="monospaced">
46294 accept domains = +local_domains
46299 If the recipient domain does not match the <option>domains</option> condition, control
46300 passes to the next statement. If it does match, the recipient is verified, and
46301 the command is accepted if verification succeeds. However, if verification
46302 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
46303 <option>endpass</option>.
46308 <indexterm role="concept">
46309 <primary><option>defer</option></primary>
46310 <secondary>ACL verb</secondary>
46312 <option>defer</option>: If all the conditions are met, the ACL returns <quote>defer</quote> which, in
46313 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
46314 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
46315 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
46316 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
46317 be used in any ACL, and even for a recipient it might be a simpler approach.
46322 <indexterm role="concept">
46323 <primary><option>deny</option></primary>
46324 <secondary>ACL verb</secondary>
46326 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
46327 the conditions are not met, control is passed to the next ACL statement. For
46330 <literallayout class="monospaced">
46331 deny dnslists = blackholes.mail-abuse.org
46334 rejects commands from hosts that are on a DNS black list.
46339 <indexterm role="concept">
46340 <primary><option>discard</option></primary>
46341 <secondary>ACL verb</secondary>
46343 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
46344 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
46345 that are concerned with receiving messages, and it causes recipients to be
46346 discarded. If the <option>log_message</option> modifier is set when <option>discard</option> operates,
46347 its contents are added to the line that is automatically written to the log.
46350 If <option>discard</option> is used in an ACL for RCPT, just the one recipient is
46351 discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
46352 message’s recipients are discarded. Recipients that are discarded before
46353 DATA do not appear in the log line when the <option>log_recipients</option> log selector
46359 <indexterm role="concept">
46360 <primary><option>drop</option></primary>
46361 <secondary>ACL verb</secondary>
46363 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
46364 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
46366 <literallayout class="monospaced">
46367 drop message = I don't take more than 20 RCPTs
46368 condition = ${if > {$rcpt_count}{20}}
46371 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
46372 The connection is always dropped after sending a 550 response.
46377 <indexterm role="concept">
46378 <primary><option>require</option></primary>
46379 <secondary>ACL verb</secondary>
46381 <option>require</option>: If all the conditions are met, control is passed to the next ACL
46382 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
46383 example, when checking a RCPT command,
46385 <literallayout class="monospaced">
46386 require verify = sender
46389 passes control to subsequent statements only if the message’s sender can be
46390 verified. Otherwise, it rejects the command.
46394 <para revisionflag="changed">
46395 <indexterm role="concept">
46396 <primary><option>warn</option></primary>
46397 <secondary>ACL verb</secondary>
46399 <option>warn</option>: If all the conditions are true, a line specified by the
46400 <option>log_message</option> modifier is written to Exim’s main log. Control always passes
46401 to the next ACL statement. If any condition is false, the log line is not
46402 written. If an identical log line is requested several times in the same
46403 message, only one copy is actually written to the log. If you want to force
46404 duplicates to be written, use the <option>logwrite</option> modifier instead.
46406 <para revisionflag="changed">
46407 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
46408 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
46409 <option>logwrite</option>, and <option>add_header</option>) that appear before any failing conditions.
46410 There is more about adding header lines in section <xref linkend="SECTaddheadacl"/>.
46412 <para revisionflag="changed">
46413 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
46414 some sort of defer), the log line specified by <option>log_message</option> is not written.
46415 No further conditions or modifiers in the <option>warn</option> statement are processed. The
46416 incident is logged, and the ACL continues to be processed, from the next
46420 <indexterm role="concept">
46421 <primary><varname>$acl_verify_message</varname></primary>
46423 When one of the <option>warn</option> conditions is an address verification that fails, the
46424 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
46425 want this logged, you must set it up explicitly. For example:
46427 <literallayout class="monospaced">
46428 warn !verify = sender
46429 log_message = sender verify failed: $acl_verify_message
46434 At the end of each ACL there is an implicit unconditional <option>deny</option>.
46437 As you can see from the examples above, the conditions and modifiers are
46438 written one to a line, with the first one on the same line as the verb, and
46439 subsequent ones on following lines. If you have a very long condition, you can
46440 continue it onto several physical lines by the usual backslash continuation
46441 mechanism. It is conventional to align the conditions vertically.
46444 <section id="SECTaclvariables">
46445 <title>ACL variables</title>
46447 <indexterm role="concept">
46448 <primary>access control lists (ACLs)</primary>
46449 <secondary>variables</secondary>
46451 There are some special variables that can be set during ACL processing. They
46452 can be used to pass information between different ACLs, different invocations
46453 of the same ACL in the same SMTP connection, and between ACLs and the routers,
46454 transports, and filters that are used to deliver a message. There are two sets
46455 of these variables:
46460 The values of <varname>$acl_c0</varname> to <varname>$acl_c19</varname> persist throughout an SMTP
46461 connection. They are never reset. Thus, a value that is set while receiving one
46462 message is still available when receiving the next message on the same SMTP
46468 The values of <varname>$acl_m0</varname> to <varname>$acl_m19</varname> persist only while a message is
46469 being received. They are reset afterwards. They are also reset by MAIL, RSET,
46470 EHLO, HELO, and after starting up a TLS session.
46475 When a message is accepted, the current values of all the ACL variables are
46476 preserved with the message and are subsequently made available at delivery
46477 time. The ACL variables are set by a modifier called <option>set</option>. For example:
46479 <literallayout class="monospaced">
46480 accept hosts = whatever
46481 set acl_m4 = some value
46484 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
46485 be set. If you want to set a variable without taking any action, you can use a
46486 <option>warn</option> verb without any other modifiers or conditions.
46490 <title>Condition and modifier processing</title>
46492 <indexterm role="concept">
46493 <primary>access control lists (ACLs)</primary>
46494 <secondary>conditions; processing</secondary>
46496 <indexterm role="concept">
46497 <primary>access control lists (ACLs)</primary>
46498 <secondary>modifiers; processing</secondary>
46500 An exclamation mark preceding a condition negates its result. For example:
46502 <literallayout class="monospaced">
46503 deny domains = *.dom.example
46504 !verify = recipient
46507 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
46508 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
46509 negation can be used on the right-hand side of a condition. For example, these
46510 two statements are equivalent:
46512 <literallayout class="monospaced">
46513 deny hosts = !192.168.3.4
46514 deny !hosts = 192.168.3.4
46517 However, for many conditions (<option>verify</option> being a good example), only left-hand
46518 side negation of the whole condition is possible.
46521 The arguments of conditions and modifiers are expanded. A forced failure
46522 of an expansion causes a condition to be ignored, that is, it behaves as if the
46523 condition is true. Consider these two statements:
46525 <literallayout class="monospaced">
46526 accept senders = ${lookup{$host_name}lsearch\
46527 {/some/file}{$value}fail}
46528 accept senders = ${lookup{$host_name}lsearch\
46529 {/some/file}{$value}{}}
46532 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
46533 the returned list is searched, but if the lookup fails the behaviour is
46534 different in the two cases. The <option>fail</option> in the first statement causes the
46535 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
46536 therefore succeeds. The second statement, however, generates an empty list when
46537 the lookup fails. No sender can match an empty list, so the condition fails,
46538 and therefore the <option>accept</option> also fails.
46541 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
46542 specify actions that are taken as the conditions for a statement are checked;
46543 others specify text for messages that are used when access is denied or a
46544 warning is generated. The <option>control</option> modifier affects the way an incoming
46545 message is handled.
46548 The positioning of the modifiers in an ACL statement important, because the
46549 processing of a verb ceases as soon as its outcome is known. Only those
46550 modifiers that have already been encountered will take effect. For example,
46551 consider this use of the <option>message</option> modifier:
46553 <literallayout class="monospaced">
46554 require message = Can't verify sender
46556 message = Can't verify recipient
46558 message = This message cannot be used
46561 If sender verification fails, Exim knows that the result of the statement is
46562 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
46563 so its text is used as the error message. If sender verification succeeds, but
46564 recipient verification fails, the second message is used. If recipient
46565 verification succeeds, the third message becomes <quote>current</quote>, but is never used
46566 because there are no more conditions to cause failure.
46569 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
46570 modifier that is used, because all the conditions must be true for rejection to
46571 happen. Specifying more than one <option>message</option> modifier does not make sense, and
46572 the message can even be specified after all the conditions. For example:
46574 <literallayout class="monospaced">
46576 !senders = *@my.domain.example
46577 message = Invalid sender from client host
46580 The <quote>deny</quote> result does not happen until the end of the statement is reached,
46581 by which time Exim has set up the message.
46584 <section id="SECTACLmodi">
46585 <title>ACL modifiers</title>
46587 <indexterm role="concept">
46588 <primary>access control lists (ACLs)</primary>
46589 <secondary>modifiers; list of</secondary>
46591 The ACL modifiers are as follows:
46595 <term><emphasis role="bold">add_header</emphasis> = <<emphasis>text</emphasis>></term>
46598 This modifier specifies one or more header lines that are to be added to an
46599 incoming message, assuming, of course, that the message is ultimately
46600 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
46602 </listitem></varlistentry>
46604 <term><emphasis role="bold">control</emphasis> = <<emphasis>text</emphasis>></term>
46607 <indexterm role="concept">
46608 <primary><option>control</option></primary>
46609 <secondary>ACL modifier</secondary>
46611 This modifier affects the subsequent processing of the SMTP connection or of an
46612 incoming message that is accepted. The effect of the first type of control
46613 lasts for the duration of the connection, whereas the effect of the second type
46614 lasts only until the current message has been received. The message-specific
46615 controls always apply to the whole message, not to individual recipients,
46616 even if the <option>control</option> modifier appears in a RCPT ACL.
46619 As there are now quite a few controls that can be applied, they are described
46620 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
46621 in several different ways. For example:
46626 It can be at the end of an <option>accept</option> statement:
46628 <literallayout class="monospaced">
46629 accept ...some conditions
46630 control = queue_only
46633 In this case, the control is applied when this statement yields <quote>accept</quote>, in
46634 other words, when the conditions are all true.
46639 It can be in the middle of an <option>accept</option> statement:
46641 <literallayout class="monospaced">
46642 accept ...some conditions...
46643 control = queue_only
46644 ...some more conditions...
46647 If the first set of conditions are true, the control is applied, even if the
46648 statement does not accept because one of the second set of conditions is false.
46649 In this case, some subsequent statement must yield <quote>accept</quote> for the control
46655 It can be used with <option>warn</option> to apply the control, leaving the
46656 decision about accepting or denying to a subsequent verb. For
46659 <literallayout class="monospaced">
46660 warn ...some conditions...
46665 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
46666 <option>logwrite</option>, so it does not add anything to the message and does not write a
46672 If you want to apply a control unconditionally, you can use it with a
46673 <option>require</option> verb. For example:
46675 <literallayout class="monospaced">
46676 require control = no_multiline_response
46680 </listitem></varlistentry>
46682 <term><emphasis role="bold">delay</emphasis> = <<emphasis>time</emphasis>></term>
46685 <indexterm role="concept">
46686 <primary><option>delay</option></primary>
46687 <secondary>ACL modifier</secondary>
46689 <indexterm role="concept">
46690 <primary><option>-bh</option> option</primary>
46692 This modifier causes Exim to wait for the time interval before proceeding. The
46693 time is given in the usual Exim notation. This modifier may appear in any ACL.
46694 The delay happens as soon as the modifier is processed. However, when testing
46695 Exim using the <option>-bh</option> option, the delay is not actually imposed (an
46696 appropriate message is output instead).
46699 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
46702 <literallayout class="monospaced">
46703 deny ...some conditions...
46707 The delay happens if all the conditions are true, before the statement returns
46708 <quote>deny</quote>. Compare this with:
46710 <literallayout class="monospaced">
46712 ...some conditions...
46715 which waits for 30s before processing the conditions. The <option>delay</option> modifier
46716 can also be used with <option>warn</option> and together with <option>control</option>:
46718 <literallayout class="monospaced">
46719 warn ...some conditions...
46724 </listitem></varlistentry>
46726 <term><emphasis role="bold">endpass</emphasis></term>
46729 <indexterm role="concept">
46730 <primary><option>endpass</option></primary>
46731 <secondary>ACL modifier</secondary>
46733 This modifier, which has no argument, is recognized only in <option>accept</option>
46734 statements. It marks the boundary between the conditions whose failure causes
46735 control to pass to the next statement, and the conditions whose failure causes
46736 the ACL to return <quote>deny</quote>. See the description of <option>accept</option> above.
46738 </listitem></varlistentry>
46740 <term><emphasis role="bold">log_message</emphasis> = <<emphasis>text</emphasis>></term>
46743 <indexterm role="concept">
46744 <primary><option>log_message</option></primary>
46745 <secondary>ACL modifier</secondary>
46747 This modifier sets up a message that is used as part of the log message if the
46748 ACL denies access or a <option>warn</option> statement’s conditions are true. For example:
46750 <literallayout class="monospaced">
46751 require log_message = wrong cipher suite $tls_cipher
46752 encrypted = DES-CBC3-SHA
46755 <option>log_message</option> adds to any underlying error message that may exist because of
46756 the condition failure. For example, while verifying a recipient address, a
46757 <emphasis>:fail:</emphasis> redirection might have already set up a message. Although the
46758 message is usually defined before the conditions to which it applies, the
46759 expansion does not happen until Exim decides that access is to be denied. This
46760 means that any variables that are set by the condition are available for
46761 inclusion in the message. For example, the <varname>$dnslist_</varname><<emphasis>xxx</emphasis>> variables are
46762 set after a DNS black list lookup succeeds. If the expansion of <option>log_message</option>
46763 fails, or if the result is an empty string, the modifier is ignored.
46766 <indexterm role="concept">
46767 <primary><varname>$acl_verify_message</varname></primary>
46769 If you want to use a <option>warn</option> statement to log the result of an address
46770 verification, you can use <varname>$acl_verify_message</varname> to include the verification
46774 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
46775 the start of the logged message. If the same warning log message is requested
46776 more than once while receiving a single email message, only one copy is
46777 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
46778 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
46779 is logged for a succesful <option>warn</option> statement.
46782 If <option>log_message</option> is not present and there is no underlying error message (for
46783 example, from the failure of address verification), but <option>message</option> is present,
46784 the <option>message</option> text is used for logging rejections. However, if any text for
46785 logging contains newlines, only the first line is logged. In the absence of
46786 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
46787 logging rejections.
46789 </listitem></varlistentry>
46791 <term><emphasis role="bold">logwrite</emphasis> = <<emphasis>text</emphasis>></term>
46794 <indexterm role="concept">
46795 <primary><option>logwrite</option></primary>
46796 <secondary>ACL modifier</secondary>
46798 <indexterm role="concept">
46799 <primary>logging in ACL</primary>
46800 <secondary>immediate</secondary>
46802 This modifier writes a message to a log file as soon as it is encountered when
46803 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
46804 <option>warn</option>, is used only if the ACL statement denies access.) The <option>logwrite</option>
46805 modifier can be used to log special incidents in ACLs. For example:
46808 <literal>accept </literal><<emphasis>some special conditions</emphasis>>
46809 <literal> control = freeze</literal>
46810 <literal> logwrite = froze message because ...</literal>
46813 By default, the message is written to the main log. However, it may begin
46814 with a colon, followed by a comma-separated list of log names, and then
46815 another colon, to specify exactly which logs are to be written. For
46818 <literallayout class="monospaced">
46819 logwrite = :main,reject: text for main and reject logs
46820 logwrite = :panic: text for panic log only
46822 </listitem></varlistentry>
46824 <term><emphasis role="bold">message</emphasis> = <<emphasis>text</emphasis>></term>
46827 <indexterm role="concept">
46828 <primary><option>message</option></primary>
46829 <secondary>ACL modifier</secondary>
46831 This modifier sets up a text string that is expanded and used as an error
46832 message if the current statement causes the ACL to deny access. The expansion
46833 happens at the time Exim decides that access is to be denied, not at the time
46834 it processes <option>message</option>. If the expansion fails, or generates an empty string,
46835 the modifier is ignored. For ACLs that are triggered by SMTP commands, the
46836 message is returned as part of the SMTP error response.
46838 <para revisionflag="changed">
46839 <indexterm role="concept">
46840 <primary>SMTP</primary>
46841 <secondary>error codes</secondary>
46843 By default, Exim uses a 550 SMTP code when it denies access. However, if the
46844 message starts with three digits followed by a space, optionally followed by an
46845 extended code of the form <emphasis>n.n.n</emphasis>, also followed by a space, and the very
46846 first digit is the same as the default error code, the code from the message is
46847 used instead. If the very first digit is incorrect, a panic error is logged,
46848 and the default code is used.
46851 The text is literal; any quotes are taken as literals, but because the string
46852 is expanded, backslash escapes are processed anyway. If the message contains
46853 newlines, this gives rise to a multi-line SMTP response. Like <option>log_message</option>,
46854 the contents of <option>message</option> are not expanded until after a condition has
46858 <indexterm role="concept">
46859 <primary><varname>$acl_verify_message</varname></primary>
46861 If <option>message</option> is used on a statement that verifies an address, the message
46862 specified overrides any message that is generated by the verification process.
46863 However, the original message is available in the variable
46864 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
46865 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
46866 routers to be passed back as part of the SMTP response, you should either not
46867 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
46870 For compatibility with previous releases of Exim, a <option>message</option> modifier that
46871 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
46872 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
46873 all the conditions are true, wherever it appears in an ACL command, whereas
46874 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
46875 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
46878 </listitem></varlistentry>
46880 <term><emphasis role="bold">set</emphasis> <<emphasis>acl_name</emphasis>> = <<emphasis>value</emphasis>></term>
46883 <indexterm role="concept">
46884 <primary><option>set</option></primary>
46885 <secondary>ACL modifier</secondary>
46887 This modifier puts a value into one of the ACL variables (see section
46888 <xref linkend="SECTaclvariables"/>).
46890 </listitem></varlistentry>
46893 <section id="SECTcontrols">
46894 <title>Use of the control modifier</title>
46896 <indexterm role="concept">
46897 <primary><option>control</option></primary>
46898 <secondary>ACL modifier</secondary>
46900 The <option>control</option> modifier supports the following settings:
46904 <term><emphasis role="bold">control = allow_auth_unadvertised</emphasis></term>
46907 This modifier allows a client host to use the SMTP AUTH command even when it
46908 has not been advertised in response to EHLO. Furthermore, because there are
46909 apparently some really broken clients that do this, Exim will accept AUTH after
46910 HELO (rather than EHLO) when this control is set. It should be used only if you
46911 really need it, and you should limit its use to those broken clients that do
46912 not work without it. For example:
46914 <literallayout class="monospaced">
46915 warn hosts = 192.168.34.25
46916 control = allow_auth_unadvertised
46919 Normally, when an Exim server receives an AUTH command, it checks the name of
46920 the authentication mechanism that is given in the command to ensure that it
46921 matches an advertised mechanism. When this control is set, the check that a
46922 mechanism has been advertised is bypassed. Any configured mechanism can be used
46923 by the client. This control is permitted only in the connection and HELO ACLs.
46925 </listitem></varlistentry>
46927 <term><emphasis role="bold">control = caseful_local_part</emphasis></term>
46932 </listitem></varlistentry>
46934 <term><emphasis role="bold">control = caselower_local_part</emphasis></term>
46937 <indexterm role="concept">
46938 <primary>access control lists (ACLs)</primary>
46939 <secondary>case of local part in</secondary>
46941 <indexterm role="concept">
46942 <primary>case of local parts</primary>
46944 <indexterm role="concept">
46945 <primary><varname>$local_part</varname></primary>
46947 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
46948 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
46949 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
46950 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
46951 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
46955 These controls affect only the current recipient. Moreover, they apply only to
46956 local part handling that takes place directly in the ACL (for example, as a key
46957 in lookups). If a test to verify the recipient is obeyed, the case-related
46958 handling of the local part during the verification is controlled by the router
46959 configuration (see the <option>caseful_local_part</option> generic router option).
46962 This facility could be used, for example, to add a spam score to local parts
46963 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
46966 <literallayout class="monospaced">
46967 warn control = caseful_local_part
46968 set acl_m4 = ${eval:\
46970 ${if match{$local_part}{[A-Z]}{1}{0}}\
46972 control = caselower_local_part
46975 Notice that we put back the lower cased version afterwards, assuming that
46976 is what is wanted for subsequent tests.
46978 </listitem></varlistentry>
46980 <term><emphasis role="bold">control = enforce_sync</emphasis></term>
46985 </listitem></varlistentry>
46987 <term><emphasis role="bold">control = no_enforce_sync</emphasis></term>
46990 <indexterm role="concept">
46991 <primary>SMTP</primary>
46992 <secondary>synchronization checking</secondary>
46994 <indexterm role="concept">
46995 <primary>synchronization checking in SMTP</primary>
46997 These controls make it possible to be selective about when SMTP synchronization
46998 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
46999 state of the switch (it is true by default). See the description of this option
47000 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
47003 The effect of these two controls lasts for the remainder of the SMTP
47004 connection. They can appear in any ACL except the one for the non-SMTP
47005 messages. The most straightforward place to put them is in the ACL defined by
47006 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
47007 before the first synchronization check. The expected use is to turn off the
47008 synchronization checks for badly-behaved hosts that you nevertheless need to
47011 </listitem></varlistentry>
47013 <term><emphasis role="bold">control = fakedefer/</emphasis><<emphasis>message</emphasis>></term>
47016 <indexterm role="concept">
47017 <primary>fake defer</primary>
47019 <indexterm role="concept">
47020 <primary>defer</primary>
47021 <secondary>fake</secondary>
47023 This control works in exactly the same way as <option>fakereject</option> (described below)
47024 except that it causes an SMTP 450 response after the message data instead of a
47025 550 response. You must take care when using <option>fakedefer</option> because it causes the
47026 messages to be duplicated when the sender retries. Therefore, you should not
47027 use <option>fakedefer</option> if the message is to be delivered normally.
47029 </listitem></varlistentry>
47031 <term><emphasis role="bold">control = fakereject/</emphasis><<emphasis>message</emphasis>></term>
47034 <indexterm role="concept">
47035 <primary>fake rejection</primary>
47037 <indexterm role="concept">
47038 <primary>rejection</primary>
47039 <secondary>fake</secondary>
47041 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
47042 words, only when an SMTP message is being received. If Exim accepts the
47043 message, instead the final 250 response, a 550 rejection message is sent.
47044 However, Exim proceeds to deliver the message as normal. The control applies
47045 only to the current message, not to any subsequent ones that may be received in
47046 the same SMTP connection.
47049 The text for the 550 response is taken from the <option>control</option> modifier. If no
47050 message is supplied, the following is used:
47052 <literallayout class="monospaced">
47053 550-Your message has been rejected but is being
47054 550-kept for evaluation.
47055 550-If it was a legitimate message, it may still be
47056 550 delivered to the target recipient(s).
47059 This facilty should be used with extreme caution.
47061 </listitem></varlistentry>
47063 <term><emphasis role="bold">control = freeze</emphasis></term>
47066 <indexterm role="concept">
47067 <primary>frozen messages</primary>
47068 <secondary>forcing in ACL</secondary>
47070 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
47071 other words, only when a message is being received. If the message is accepted,
47072 it is placed on Exim’s queue and frozen. The control applies only to the
47073 current message, not to any subsequent ones that may be received in the same
47077 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
47078 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
47079 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
47080 are obeyed for the current message have the <literal>/no_tell</literal> option.
47082 </listitem></varlistentry>
47084 <term><emphasis role="bold">control = no_mbox_unspool</emphasis></term>
47087 This control is available when Exim is compiled with the content scanning
47088 extension. Content scanning may require a copy of the current message, or parts
47089 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
47090 or spam scanner. Normally, such copies are deleted when they are no longer
47091 needed. If this control is set, the copies are not deleted. The control applies
47092 only to the current message, not to any subsequent ones that may be received in
47093 the same SMTP connection. It is provided for debugging purposes and is unlikely
47094 to be useful in production.
47096 </listitem></varlistentry>
47098 <term><emphasis role="bold">control = no_multiline_response</emphasis></term>
47101 <indexterm role="concept">
47102 <primary>multiline responses</primary>
47103 <secondary>suppressing</secondary>
47105 This control is permitted for any ACL except the one for non-SMTP messages.
47106 It seems that there are broken clients in use that cannot handle multiline
47107 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
47110 If this control is set, multiline SMTP responses from ACL rejections are
47111 suppressed. One way of doing this would have been to put out these responses as
47112 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
47113 (<quote>use multiline responses for more</quote> it says – ha!), and some of the
47114 responses might get close to that. So this facility, which is after all only a
47115 sop to broken clients, is implemented by doing two very easy things:
47120 Extra information that is normally output as part of a rejection caused by
47121 sender verification failure is omitted. Only the final line (typically <quote>sender
47122 verification failed</quote>) is sent.
47127 If a <option>message</option> modifier supplies a multiline response, only the first
47133 The setting of the switch can, of course, be made conditional on the
47134 calling host. Its effect lasts until the end of the SMTP connection.
47136 </listitem></varlistentry>
47138 <term><emphasis role="bold">control = queue_only</emphasis></term>
47141 <indexterm role="concept">
47142 <primary><option>queue_only</option></primary>
47144 <indexterm role="concept">
47145 <primary>queueing incoming messages</primary>
47147 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
47148 other words, only when a message is being received. If the message is accepted,
47149 it is placed on Exim’s queue and left there for delivery by a subsequent queue
47150 runner. No immediate delivery process is started. In other words, it has the
47151 effect as the <option>queue_only</option> global option. However, the control applies only
47152 to the current message, not to any subsequent ones that may be received in the
47153 same SMTP connection.
47155 </listitem></varlistentry>
47157 <term><emphasis role="bold">control = submission/</emphasis><<emphasis>options</emphasis>></term>
47160 <indexterm role="concept">
47161 <primary>message</primary>
47162 <secondary>submission</secondary>
47164 <indexterm role="concept">
47165 <primary>submission mode</primary>
47167 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
47168 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
47169 the current message is a submission from a local MUA. In this case, Exim
47170 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
47171 necessary. For example, it add a <emphasis>Date:</emphasis> header line if one is not present.
47172 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
47173 late (the message has already been created).
47176 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
47177 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
47178 submission mode; the available options for this control are described there.
47179 The control applies only to the current message, not to any subsequent ones
47180 that may be received in the same SMTP connection.
47182 </listitem></varlistentry>
47184 <term><emphasis role="bold">control = suppress_local_fixups</emphasis></term>
47187 <indexterm role="concept">
47188 <primary>submission fixups</primary>
47189 <secondary>suppressing</secondary>
47191 This control applies to locally submitted (non TCP/IP) messages, and is the
47192 complement of <literal>control</literal> <literal>=</literal> <literal>submission</literal>. It disables the fixups that are
47193 normally applied to locally-submitted messages. Specifically:
47198 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
47199 dynamic version of <option>local_sender_retain</option>).
47204 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
47209 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
47213 <para revisionflag="changed">
47214 This control may be useful when a remotely-originated message is accepted,
47215 passed to some scanning program, and then re-submitted for delivery. It can be
47216 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
47217 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message’s
47220 </listitem></varlistentry>
47223 All four possibilities for message fixups can be specified:
47228 Locally submitted, fixups applied: the default.
47233 Locally submitted, no fixups applied: use <literal>control</literal> <literal>=</literal>
47234 <literal>suppress_local_fixups</literal>.
47239 Remotely submitted, no fixups applied: the default.
47244 Remotely submitted, fixups applied: use <literal>control</literal> <literal>=</literal> <literal>submission</literal>.
47249 <section id="SECTaddheadacl">
47250 <title>Adding header lines in ACLs</title>
47252 <indexterm role="concept">
47253 <primary>header lines</primary>
47254 <secondary>adding in an ACL</secondary>
47256 <indexterm role="concept">
47257 <primary>header lines</primary>
47258 <secondary>position of added lines</secondary>
47260 <indexterm role="concept">
47261 <primary><option>message</option></primary>
47262 <secondary>ACL modifier</secondary>
47264 The <option>add_header</option> modifier can be used to add one or more extra header lines
47265 to an incoming message, as in this example:
47267 <literallayout class="monospaced">
47268 warn dnslists = sbl.spamhaus.org : \
47269 dialup.mail-abuse.org
47270 add_header = X-blacklisted-at: $dnslist_domain
47273 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
47274 MIME, and non-SMTP ACLs (in other words, those that are concerned with
47275 receiving a message). The message must ultimately be accepted for
47276 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
47277 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
47281 If the data for the <option>add_header</option> modifier contains one or more newlines that
47282 are not followed by a space or a tab, it is assumed to contain multiple header
47283 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
47284 front of any line that is not a valid header line.
47287 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
47288 They are added to the message before processing the DATA and MIME ACLs.
47289 However, if an identical header line is requested more than once, only one copy
47290 is actually added to the message. Further header lines may be accumulated
47291 during the DATA and MIME ACLs, after which they are added to the message, again
47292 with duplicates suppressed. Thus, it is possible to add two identical header
47293 lines to an SMTP message, but only if one is added before DATA and one after.
47294 In the case of non-SMTP messages, new headers are accumulated during the
47295 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
47296 message is rejected after DATA or by the non-SMTP ACL, all added header lines
47297 are included in the entry that is written to the reject log.
47300 <indexterm role="concept">
47301 <primary>header lines</primary>
47302 <secondary>added; visibility of</secondary>
47304 Header lines are not visible in string expansions until they are added to the
47305 message. It follows that header lines defined in the MAIL, RCPT, and predata
47306 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
47307 header lines that are added by the DATA or MIME ACLs are not visible in those
47308 ACLs. Because of this restriction, you cannot use header lines as a way of
47309 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
47310 this, you can use ACL variables, as described in section
47311 <xref linkend="SECTaclvariables"/>.
47314 The <option>add_header</option> modifier acts immediately it is encountered during the
47315 processing of an ACL. Notice the difference between these two cases:
47318 <literal>accept add_header = ADDED: some text</literal>
47319 <literal> </literal><<emphasis>some condition</emphasis>>
47321 <literal>accept </literal><<emphasis>some condition</emphasis>>
47322 <literal> add_header = ADDED: some text</literal>
47325 In the first case, the header line is always added, whether or not the
47326 condition is true. In the second case, the header line is added only if the
47327 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
47328 ACL statement. All those that are encountered before a condition fails are
47332 <indexterm role="concept">
47333 <primary><option>warn</option></primary>
47334 <secondary>ACL verb</secondary>
47336 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
47337 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
47338 effect only if all the conditions are true, even if it appears before some of
47339 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
47340 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
47341 are present on a <option>warn</option> verb, both are processed according to their
47345 By default, new header lines are added to a message at the end of the existing
47346 header lines. However, you can specify that any particular header line should
47347 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
47348 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
47349 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
47352 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
47353 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
47354 header line, respectively. (Header text cannot start with a colon, as there has
47355 to be a header name first.) For example:
47357 <literallayout class="monospaced">
47358 warn add_header = \
47359 :after_received:X-My-Header: something or other...
47362 If more than one header line is supplied in a single <option>add_header</option> modifier,
47363 each one is treated independently and can therefore be placed differently. If
47364 you add more than one line at the start, or after the Received: block, they end
47365 up in reverse order.
47368 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
47369 added in an ACL. It does NOT work for header lines that are added in a
47370 system filter or in a router or transport.
47373 <section id="SECTaclconditions">
47374 <title>ACL conditions</title>
47376 <indexterm role="concept">
47377 <primary>access control lists (ACLs)</primary>
47378 <secondary>conditions; list of</secondary>
47380 Some of conditions listed in this section are available only when Exim is
47381 compiled with the content-scanning extension. They are included here briefly
47382 for completeness. More detailed descriptions can be found in the discussion on
47383 content scanning in chapter <xref linkend="CHAPexiscan"/>.
47386 Not all conditions are relevant in all circumstances. For example, testing
47387 senders and recipients does not make sense in an ACL that is being run as the
47388 result of the arrival of an ETRN command, and checks on message headers can be
47389 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
47390 can use the same condition (with different parameters) more than once in the
47391 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
47392 The conditions are as follows:
47396 <term><emphasis role="bold">acl = </emphasis><<emphasis>name of acl or ACL string or file name </emphasis>></term>
47399 <indexterm role="concept">
47400 <primary>access control lists (ACLs)</primary>
47401 <secondary>nested</secondary>
47403 <indexterm role="concept">
47404 <primary>access control lists (ACLs)</primary>
47405 <secondary>indirect</secondary>
47407 <indexterm role="concept">
47408 <primary><option>acl</option></primary>
47409 <secondary>ACL condition</secondary>
47411 The possible values of the argument are the same as for the
47412 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
47413 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
47414 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
47415 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
47416 condition false. This means that further processing of the <option>warn</option> verb
47417 ceases, but processing of the ACL continues.
47420 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
47421 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
47422 <option>accept</option> or <option>discard</option>, and the action is taken immediately – no further
47423 conditions are tested.
47426 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
47427 loops. This condition allows you to use different ACLs in different
47428 circumstances. For example, different ACLs can be used to handle RCPT commands
47429 for different local users or different local domains.
47431 </listitem></varlistentry>
47433 <term><emphasis role="bold">authenticated = </emphasis><<emphasis>string list</emphasis>></term>
47436 <indexterm role="concept">
47437 <primary><option>authenticated</option></primary>
47438 <secondary>ACL condition</secondary>
47440 <indexterm role="concept">
47441 <primary>authentication</primary>
47442 <secondary>ACL checking</secondary>
47444 <indexterm role="concept">
47445 <primary>access control lists (ACLs)</primary>
47446 <secondary>testing for authentication</secondary>
47448 If the SMTP connection is not authenticated, the condition is false. Otherwise,
47449 the name of the authenticator is tested against the list. To test for
47450 authentication by any authenticator, you can set
47452 <literallayout class="monospaced">
47455 </listitem></varlistentry>
47457 <term><emphasis role="bold">condition = </emphasis><<emphasis>string</emphasis>></term>
47460 <indexterm role="concept">
47461 <primary><option>condition</option></primary>
47462 <secondary>ACL condition</secondary>
47464 <indexterm role="concept">
47465 <primary>customizing</primary>
47466 <secondary>ACL condition</secondary>
47468 <indexterm role="concept">
47469 <primary>access control lists (ACLs)</primary>
47470 <secondary>customized test</secondary>
47472 <indexterm role="concept">
47473 <primary>access control lists (ACLs)</primary>
47474 <secondary>testing; customized</secondary>
47476 This feature allows you to make up custom conditions. If the result of
47477 expanding the string is an empty string, the number zero, or one of the strings
47478 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
47479 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
47480 any other value, some error is assumed to have occurred, and the ACL returns
47481 <quote>defer</quote>. <phrase revisionflag="changed">However, if the expansion is forced to fail, the condition is
47482 ignored. The effect is to treat it as true, whether it is positive or
47485 </listitem></varlistentry>
47487 <term><emphasis role="bold">decode = </emphasis><<emphasis>location</emphasis>></term>
47490 <indexterm role="concept">
47491 <primary><option>decode</option></primary>
47492 <secondary>ACL condition</secondary>
47494 This condition is available only when Exim is compiled with the
47495 content-scanning extension, and it is allowed only the the ACL defined by
47496 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
47497 For details, see chapter <xref linkend="CHAPexiscan"/>.
47499 </listitem></varlistentry>
47501 <term><emphasis role="bold">demime = </emphasis><<emphasis>extension list</emphasis>></term>
47504 <indexterm role="concept">
47505 <primary><option>demime</option></primary>
47506 <secondary>ACL condition</secondary>
47508 This condition is available only when Exim is compiled with the
47509 content-scanning extension. Its use is described in section
47510 <xref linkend="SECTdemimecond"/>.
47512 </listitem></varlistentry>
47514 <term><emphasis role="bold">dnslists = </emphasis><<emphasis>list of domain names and other data</emphasis>></term>
47517 <indexterm role="concept">
47518 <primary><option>dnslists</option></primary>
47519 <secondary>ACL condition</secondary>
47521 <indexterm role="concept">
47522 <primary>DNS list</primary>
47523 <secondary>in ACL</secondary>
47525 <indexterm role="concept">
47526 <primary>black list (DNS)</primary>
47528 <indexterm role="concept">
47529 <primary>access control lists (ACLs)</primary>
47530 <secondary>testing a DNS list</secondary>
47532 This condition checks for entries in DNS black lists. These are also known as
47533 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
47534 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
47535 different variants of this condition to describe briefly here. See sections
47536 <xref linkend="SECTmorednslists"/>--<xref linkend="SECTmorednslistslast"/> for details.
47538 </listitem></varlistentry>
47540 <term><emphasis role="bold">domains = </emphasis><<emphasis>domain list</emphasis>></term>
47543 <indexterm role="concept">
47544 <primary><option>domains</option></primary>
47545 <secondary>ACL condition</secondary>
47547 <indexterm role="concept">
47548 <primary>domain</primary>
47549 <secondary>ACL checking</secondary>
47551 <indexterm role="concept">
47552 <primary>access control lists (ACLs)</primary>
47553 <secondary>testing a recipient domain</secondary>
47555 <indexterm role="concept">
47556 <primary><varname>$domain_data</varname></primary>
47558 This condition is relevant only after a RCPT command. It checks that the domain
47559 of the recipient address is in the domain list. If percent-hack processing is
47560 enabled, it is done before this test is done. If the check succeeds with a
47561 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
47562 <option>domains</option> test.
47564 </listitem></varlistentry>
47566 <term><emphasis role="bold">encrypted = </emphasis><<emphasis>string list</emphasis>></term>
47569 <indexterm role="concept">
47570 <primary><option>encrypted</option></primary>
47571 <secondary>ACL condition</secondary>
47573 <indexterm role="concept">
47574 <primary>encryption</primary>
47575 <secondary>checking in an ACL</secondary>
47577 <indexterm role="concept">
47578 <primary>access control lists (ACLs)</primary>
47579 <secondary>testing for encryption</secondary>
47581 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
47582 name of the cipher suite in use is tested against the list. To test for
47583 encryption without testing for any specific cipher suite(s), set
47585 <literallayout class="monospaced">
47588 </listitem></varlistentry>
47590 <term><emphasis role="bold">hosts = </emphasis><<emphasis> host list</emphasis>></term>
47593 <indexterm role="concept">
47594 <primary><option>hosts</option></primary>
47595 <secondary>ACL condition</secondary>
47597 <indexterm role="concept">
47598 <primary>host</primary>
47599 <secondary>ACL checking</secondary>
47601 <indexterm role="concept">
47602 <primary>access control lists (ACLs)</primary>
47603 <secondary>testing the client host</secondary>
47605 This condition tests that the calling host matches the host list. If you have
47606 name lookups or wildcarded host names and IP addresses in the same host list,
47607 you should normally put the IP addresses first. For example, you could have:
47609 <literallayout class="monospaced">
47610 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
47613 The reason for this lies in the left-to-right way that Exim processes lists.
47614 It can test IP addresses without doing any DNS lookups, but when it reaches an
47615 item that requires a host name, it fails if it cannot find a host name to
47616 compare with the pattern. If the above list is given in the opposite order, the
47617 <option>accept</option> statement fails for a host whose name cannot be found, even if its
47618 IP address is 10.9.8.7.
47621 If you really do want to do the name check first, and still recognize the IP
47622 address even if the name lookup fails, you can rewrite the ACL like this:
47624 <literallayout class="monospaced">
47625 accept hosts = dbm;/etc/friendly/hosts
47626 accept hosts = 10.9.8.7
47629 The default action on failing to find the host name is to assume that the host
47630 is not in the list, so the first <option>accept</option> statement fails. The second
47631 statement can then check the IP address.
47634 <indexterm role="concept">
47635 <primary><varname>$host_data</varname></primary>
47637 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
47638 of the lookup is made available in the <varname>$host_data</varname> variable. This
47639 allows you, for example, to set up a statement like this:
47641 <literallayout class="monospaced">
47642 deny hosts = net-lsearch;/some/file
47643 message = $host_data
47646 which gives a custom error message for each denied host.
47648 </listitem></varlistentry>
47650 <term><emphasis role="bold">local_parts = </emphasis><<emphasis>local part list</emphasis>></term>
47653 <indexterm role="concept">
47654 <primary><option>local_parts</option></primary>
47655 <secondary>ACL condition</secondary>
47657 <indexterm role="concept">
47658 <primary>local part</primary>
47659 <secondary>ACL checking</secondary>
47661 <indexterm role="concept">
47662 <primary>access control lists (ACLs)</primary>
47663 <secondary>testing a local part</secondary>
47665 <indexterm role="concept">
47666 <primary><varname>$local_part_data</varname></primary>
47668 This condition is relevant only after a RCPT command. It checks that the local
47669 part of the recipient address is in the list. If percent-hack processing is
47670 enabled, it is done before this test. If the check succeeds with a lookup, the
47671 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
47672 the next <option>local_parts</option> test.
47674 </listitem></varlistentry>
47676 <term><emphasis role="bold">malware = </emphasis><<emphasis>option</emphasis>></term>
47679 <indexterm role="concept">
47680 <primary><option>malware</option></primary>
47681 <secondary>ACL condition</secondary>
47683 <indexterm role="concept">
47684 <primary>access control lists (ACLs)</primary>
47685 <secondary>virus scanning</secondary>
47687 <indexterm role="concept">
47688 <primary>access control lists (ACLs)</primary>
47689 <secondary>scanning for viruses</secondary>
47691 This condition is available only when Exim is compiled with the
47692 content-scanning extension. It causes the incoming message to be scanned for
47693 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
47695 </listitem></varlistentry>
47697 <term><emphasis role="bold">mime_regex = </emphasis><<emphasis>list of regular expressions</emphasis>></term>
47700 <indexterm role="concept">
47701 <primary><option>mime_regex</option></primary>
47702 <secondary>ACL condition</secondary>
47704 <indexterm role="concept">
47705 <primary>access control lists (ACLs)</primary>
47706 <secondary>testing by regex matching</secondary>
47708 This condition is available only when Exim is compiled with the
47709 content-scanning extension, and it is allowed only the the ACL defined by
47710 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
47711 with any of the regular expressions. For details, see chapter
47712 <xref linkend="CHAPexiscan"/>.
47714 </listitem></varlistentry>
47716 <term><emphasis role="bold">ratelimit = </emphasis><<emphasis>parameters</emphasis>></term>
47719 <indexterm role="concept">
47720 <primary>rate limiting</primary>
47722 This condition can be used to limit the rate at which a user or host submits
47723 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
47725 </listitem></varlistentry>
47727 <term><emphasis role="bold">recipients = </emphasis><<emphasis>address list</emphasis>></term>
47730 <indexterm role="concept">
47731 <primary><option>recipients</option></primary>
47732 <secondary>ACL condition</secondary>
47734 <indexterm role="concept">
47735 <primary>recipient</primary>
47736 <secondary>ACL checking</secondary>
47738 <indexterm role="concept">
47739 <primary>access control lists (ACLs)</primary>
47740 <secondary>testing a recipient</secondary>
47742 This condition is relevant only after a RCPT command. It checks the entire
47743 recipient address against a list of recipients.
47745 </listitem></varlistentry>
47747 <term><emphasis role="bold">regex = </emphasis><<emphasis>list of regular expressions</emphasis>></term>
47750 <indexterm role="concept">
47751 <primary><option>regex</option></primary>
47752 <secondary>ACL condition</secondary>
47754 <indexterm role="concept">
47755 <primary>access control lists (ACLs)</primary>
47756 <secondary>testing by regex matching</secondary>
47758 This condition is available only when Exim is compiled with the
47759 content-scanning extension, and is available only in the DATA, MIME, and
47760 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
47761 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
47763 </listitem></varlistentry>
47765 <term><emphasis role="bold">sender_domains = </emphasis><<emphasis>domain list</emphasis>></term>
47768 <indexterm role="concept">
47769 <primary><option>sender_domains</option></primary>
47770 <secondary>ACL condition</secondary>
47772 <indexterm role="concept">
47773 <primary>sender</primary>
47774 <secondary>ACL checking</secondary>
47776 <indexterm role="concept">
47777 <primary>access control lists (ACLs)</primary>
47778 <secondary>testing a sender domain</secondary>
47780 <indexterm role="concept">
47781 <primary><varname>$domain</varname></primary>
47783 <indexterm role="concept">
47784 <primary><varname>$sender_address_domain</varname></primary>
47786 This condition tests the domain of the sender of the message against the given
47787 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
47788 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
47789 of this condition. This is an exception to the general rule for testing domain
47790 lists. It is done this way so that, if this condition is used in an ACL for a
47791 RCPT command, the recipient’s domain (which is in <varname>$domain</varname>) can be used to
47792 influence the sender checking.
47795 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
47796 relaying, because sender addresses are easily, and commonly, forged.
47798 </listitem></varlistentry>
47800 <term><emphasis role="bold">senders = </emphasis><<emphasis>address list</emphasis>></term>
47803 <indexterm role="concept">
47804 <primary><option>senders</option></primary>
47805 <secondary>ACL condition</secondary>
47807 <indexterm role="concept">
47808 <primary>sender</primary>
47809 <secondary>ACL checking</secondary>
47811 <indexterm role="concept">
47812 <primary>access control lists (ACLs)</primary>
47813 <secondary>testing a sender</secondary>
47815 This condition tests the sender of the message against the given list. To test
47816 for a bounce message, which has an empty sender, set
47818 <literallayout class="monospaced">
47822 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
47823 relaying, because sender addresses are easily, and commonly, forged.
47825 </listitem></varlistentry>
47827 <term><emphasis role="bold">spam = </emphasis><<emphasis>username</emphasis>></term>
47830 <indexterm role="concept">
47831 <primary><option>spam</option></primary>
47832 <secondary>ACL condition</secondary>
47834 <indexterm role="concept">
47835 <primary>access control lists (ACLs)</primary>
47836 <secondary>scanning for spam</secondary>
47838 This condition is available only when Exim is compiled with the
47839 content-scanning extension. It causes the incoming message to be scanned by
47840 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
47842 </listitem></varlistentry>
47844 <term><emphasis role="bold">verify = certificate</emphasis></term>
47847 <indexterm role="concept">
47848 <primary><option>verify</option></primary>
47849 <secondary>ACL condition</secondary>
47851 <indexterm role="concept">
47852 <primary>TLS</primary>
47853 <secondary>client certificate verification</secondary>
47855 <indexterm role="concept">
47856 <primary>certificate</primary>
47857 <secondary>verification of client</secondary>
47859 <indexterm role="concept">
47860 <primary>access control lists (ACLs)</primary>
47861 <secondary>certificate verification</secondary>
47863 <indexterm role="concept">
47864 <primary>access control lists (ACLs)</primary>
47865 <secondary>testing a TLS certificate</secondary>
47867 This condition is true in an SMTP session if the session is encrypted, and a
47868 certificate was received from the client, and the certificate was verified. The
47869 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
47870 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
47872 </listitem></varlistentry>
47874 <term><emphasis role="bold">verify = csa</emphasis></term>
47877 <indexterm role="concept">
47878 <primary>CSA verification</primary>
47880 This condition checks whether the sending host (the client) is authorized to
47881 send email. Details of how this works are given in section
47882 <xref linkend="SECTverifyCSA"/>.
47884 </listitem></varlistentry>
47886 <term><emphasis role="bold">verify = header_sender/</emphasis><<emphasis>options</emphasis>></term>
47889 <indexterm role="concept">
47890 <primary><option>verify</option></primary>
47891 <secondary>ACL condition</secondary>
47893 <indexterm role="concept">
47894 <primary>access control lists (ACLs)</primary>
47895 <secondary>verifying sender in the header</secondary>
47897 <indexterm role="concept">
47898 <primary>header lines</primary>
47899 <secondary>verifying the sender in</secondary>
47901 <indexterm role="concept">
47902 <primary>sender</primary>
47903 <secondary>verifying in header</secondary>
47905 <indexterm role="concept">
47906 <primary>verifying</primary>
47907 <secondary>sender in header</secondary>
47909 This condition is relevant only in an ACL that is run after a message has been
47910 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
47911 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
47912 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
47913 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
47914 However, an address that appears in one of these headers need not be an address
47915 that accepts bounce messages; only sender addresses in envelopes are required
47916 to accept bounces. Therefore, if you use the callout option on this check, you
47917 might want to arrange for a non-empty address in the MAIL command.
47920 Details of address verification and the options are given later, starting at
47921 section <xref linkend="SECTaddressverification"/> (callouts are described in section
47922 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
47923 condition to restrict it to bounce messages only:
47925 <literallayout class="monospaced">
47927 message = A valid sender header is required for bounces
47928 !verify = header_sender
47930 </listitem></varlistentry>
47932 <term><emphasis role="bold">verify = header_syntax</emphasis></term>
47935 <indexterm role="concept">
47936 <primary><option>verify</option></primary>
47937 <secondary>ACL condition</secondary>
47939 <indexterm role="concept">
47940 <primary>access control lists (ACLs)</primary>
47941 <secondary>verifying header syntax</secondary>
47943 <indexterm role="concept">
47944 <primary>header lines</primary>
47945 <secondary>verifying syntax</secondary>
47947 <indexterm role="concept">
47948 <primary>verifying</primary>
47949 <secondary>header syntax</secondary>
47951 This condition is relevant only in an ACL that is run after a message has been
47952 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
47953 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
47954 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
47955 and <emphasis>Bcc:</emphasis>). Unqualified addresses (local parts without domains) are
47956 permitted only in locally generated messages and from hosts that match
47957 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
47961 Note that this condition is a syntax check only. However, a common spamming
47962 ploy used to be to send syntactically invalid headers such as
47964 <literallayout class="monospaced">
47968 and this condition can be used to reject such messages, though they are not as
47969 common as they used to be.
47971 </listitem></varlistentry>
47973 <term><emphasis role="bold">verify = helo</emphasis></term>
47976 <indexterm role="concept">
47977 <primary><option>verify</option></primary>
47978 <secondary>ACL condition</secondary>
47980 <indexterm role="concept">
47981 <primary>access control lists (ACLs)</primary>
47982 <secondary>verifying HELO/EHLO</secondary>
47984 <indexterm role="concept">
47985 <primary>HELO</primary>
47986 <secondary>verifying</secondary>
47988 <indexterm role="concept">
47989 <primary>EHLO</primary>
47990 <secondary>verifying</secondary>
47992 <indexterm role="concept">
47993 <primary>verifying</primary>
47994 <secondary>EHLO</secondary>
47996 <indexterm role="concept">
47997 <primary>verifying</primary>
47998 <secondary>HELO</secondary>
48000 This condition is true if a HELO or EHLO command has been received from the
48001 client host, and its contents have been verified. It there has been no previous
48002 attempt to verify the the HELO/EHLO contents, it is carried out when this
48003 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
48004 <option>helo_try_verify_hosts</option> options for details of how to request verification
48005 independently of this condition.
48007 </listitem></varlistentry>
48009 <term><emphasis role="bold">verify = not_blind</emphasis></term>
48012 <indexterm role="concept">
48013 <primary>verifying</primary>
48014 <secondary>not blind</secondary>
48016 <indexterm role="concept">
48017 <primary>bcc recipients</primary>
48018 <secondary>verifying none</secondary>
48020 This condition checks that there are no blind (bcc) recipients in the message.
48021 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
48022 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
48023 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
48024 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
48025 used only in a DATA or non-SMTP ACL.
48028 There are, of course, many legitimate messages that make use of blind (bcc)
48029 recipients. This check should not be used on its own for blocking messages.
48031 </listitem></varlistentry>
48033 <term><emphasis role="bold">verify = recipient/</emphasis><<emphasis>options</emphasis>></term>
48036 <indexterm role="concept">
48037 <primary><option>verify</option></primary>
48038 <secondary>ACL condition</secondary>
48040 <indexterm role="concept">
48041 <primary>access control lists (ACLs)</primary>
48042 <secondary>verifying recipient</secondary>
48044 <indexterm role="concept">
48045 <primary>recipient</primary>
48046 <secondary>verifying</secondary>
48048 <indexterm role="concept">
48049 <primary>verifying</primary>
48050 <secondary>recipient</secondary>
48052 <indexterm role="concept">
48053 <primary><varname>$address_data</varname></primary>
48055 This condition is relevant only after a RCPT command. It verifies the current
48056 recipient. Details of address verification are given later, starting at section
48057 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
48058 of <varname>$address_data</varname> is the last value that was set while routing the address.
48059 This applies even if the verification fails. When an address that is being
48060 verified is redirected to a single address, verification continues with the new
48061 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
48062 value for the child address.
48064 </listitem></varlistentry>
48066 <term><emphasis role="bold">verify = reverse_host_lookup</emphasis></term>
48069 <indexterm role="concept">
48070 <primary><option>verify</option></primary>
48071 <secondary>ACL condition</secondary>
48073 <indexterm role="concept">
48074 <primary>access control lists (ACLs)</primary>
48075 <secondary>verifying host reverse lookup</secondary>
48077 <indexterm role="concept">
48078 <primary>host</primary>
48079 <secondary>verifying reverse lookup</secondary>
48081 This condition ensures that a verified host name has been looked up from the IP
48082 address of the client host. (This may have happened already if the host name
48083 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
48084 Verification ensures that the host name obtained from a reverse DNS lookup, or
48085 one of its aliases, does, when it is itself looked up in the DNS, yield the
48086 original IP address.
48089 If this condition is used for a locally generated message (that is, when there
48090 is no client host involved), it always succeeds.
48092 </listitem></varlistentry>
48094 <term><emphasis role="bold">verify = sender/</emphasis><<emphasis>options</emphasis>></term>
48097 <indexterm role="concept">
48098 <primary><option>verify</option></primary>
48099 <secondary>ACL condition</secondary>
48101 <indexterm role="concept">
48102 <primary>access control lists (ACLs)</primary>
48103 <secondary>verifying sender</secondary>
48105 <indexterm role="concept">
48106 <primary>sender</primary>
48107 <secondary>verifying</secondary>
48109 <indexterm role="concept">
48110 <primary>verifying</primary>
48111 <secondary>sender</secondary>
48113 This condition is relevant only after a MAIL or RCPT command, or after a
48114 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
48115 the message’s sender is empty (that is, this is a bounce message), the
48116 condition is true. Otherwise, the sender address is verified.
48119 <indexterm role="concept">
48120 <primary><varname>$address_data</varname></primary>
48122 <indexterm role="concept">
48123 <primary><varname>$sender_address_data</varname></primary>
48125 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
48126 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
48127 value can be used in subsequent conditions and modifiers in the same ACL
48128 statement. It does not persist after the end of the current statement. If you
48129 want to preserve the value for longer, you can save it in an ACL variable.
48132 Details of verification are given later, starting at section
48133 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
48134 to avoid doing it more than once per message.
48136 </listitem></varlistentry>
48138 <term><emphasis role="bold">verify = sender=</emphasis><<emphasis>address</emphasis>><emphasis role="bold">/</emphasis><<emphasis>options</emphasis>></term>
48141 <indexterm role="concept">
48142 <primary><option>verify</option></primary>
48143 <secondary>ACL condition</secondary>
48145 This is a variation of the previous option, in which a modified address is
48146 verified as a sender.
48148 </listitem></varlistentry>
48151 <section id="SECTmorednslists">
48152 <title>Using DNS lists</title>
48154 <indexterm role="concept">
48155 <primary>DNS list</primary>
48156 <secondary>in ACL</secondary>
48158 <indexterm role="concept">
48159 <primary>black list (DNS)</primary>
48161 <indexterm role="concept">
48162 <primary>access control lists (ACLs)</primary>
48163 <secondary>testing a DNS list</secondary>
48165 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
48166 is on at least one of a number of DNS lists by looking up the inverted IP
48167 address in one or more DNS domains. For example, if the calling host’s IP
48168 address is 192.168.62.43, and the ACL statement is
48170 <literallayout class="monospaced">
48171 deny dnslists = blackholes.mail-abuse.org : \
48172 dialups.mail-abuse.org
48175 the following records are looked up:
48177 <literallayout class="monospaced">
48178 43.62.168.192.blackholes.mail-abuse.org
48179 43.62.168.192.dialups.mail-abuse.org
48182 As soon as Exim finds an existing DNS record, processing of the list stops.
48183 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
48184 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
48185 use two separate conditions:
48187 <literallayout class="monospaced">
48188 deny dnslists = blackholes.mail-abuse.org
48189 dnslists = dialups.mail-abuse.org
48192 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
48193 behaves as if the host does not match the list item, that is, as if the DNS
48194 record does not exist. If there are further items in the DNS list, they are
48198 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
48199 (which is the most common usage), because it prevents a DNS failure from
48200 blocking mail. However, you can change this behaviour by putting one of the
48201 following special items in the list:
48204 <literal>+include_unknown </literal> behave as if the item is on the list
48205 <literal>+exclude_unknown </literal> behave as if the item is not on the list (default)
48206 <literal>+defer_unknown </literal> give a temporary error
48209 <indexterm role="concept">
48210 <primary><literal>+include_unknown</literal></primary>
48212 <indexterm role="concept">
48213 <primary><literal>+exclude_unknown</literal></primary>
48215 <indexterm role="concept">
48216 <primary><literal>+defer_unknown</literal></primary>
48218 Each of these applies to any subsequent items on the list. For example:
48220 <literallayout class="monospaced">
48221 deny dnslists = +defer_unknown : foo.bar.example
48224 Testing the list of domains stops as soon as a match is found. If you want to
48225 warn for one list and block for another, you can use two different statements:
48227 <literallayout class="monospaced">
48228 deny dnslists = blackholes.mail-abuse.org
48229 warn message = X-Warn: sending host is on dialups list
48230 dnslists = dialups.mail-abuse.org
48233 DNS list lookups are cached by Exim for the duration of the SMTP session,
48234 so a lookup based on the IP address is done at most once for any incoming
48235 connection. Exim does not share information between multiple incoming
48236 connections (but your local name server cache should be active).
48240 <title>Specifying the IP address for a DNS list lookup</title>
48242 <indexterm role="concept">
48243 <primary>DNS list</primary>
48244 <secondary>keyed by explicit IP address</secondary>
48246 By default, the IP address that is used in a DNS list lookup is the IP address
48247 of the calling host. However, you can specify another IP address by listing it
48248 after the domain name, introduced by a slash. For example:
48250 <literallayout class="monospaced">
48251 deny dnslists = black.list.tld/192.168.1.2
48254 This feature is not very helpful with explicit IP addresses; it is intended for
48255 use with IP addresses that are looked up, for example, the IP addresses of the
48256 MX hosts or nameservers of an email sender address. For an example, see section
48257 <xref linkend="SECTmulkeyfor"/> below.
48261 <title>DNS lists keyed on domain names</title>
48263 <indexterm role="concept">
48264 <primary>DNS list</primary>
48265 <secondary>keyed by domain name</secondary>
48267 There are some lists that are keyed on domain names rather than inverted IP
48268 addresses (see for example the <emphasis>domain based zones</emphasis> link at
48269 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
48270 with these lists. You can change the name that is looked up in a DNS list by
48271 listing it after the domain name, introduced by a slash. For example,
48273 <literallayout class="monospaced">
48274 deny message = Sender's domain is listed at $dnslist_domain
48275 dnslists = dsn.rfc-ignorant.org/$sender_address_domain
48278 This particular example is useful only in ACLs that are obeyed after the
48279 RCPT or DATA commands, when a sender address is available. If (for
48280 example) the message’s sender is <emphasis>user@tld.example</emphasis> the name that is looked
48281 up by this example is
48283 <literallayout class="monospaced">
48284 tld.example.dsn.rfc-ignorant.org
48287 A single <option>dnslists</option> condition can contain entries for both names and IP
48288 addresses. For example:
48290 <literallayout class="monospaced">
48291 deny dnslists = sbl.spamhaus.org : \
48292 dsn.rfc-ignorant.org/$sender_address_domain
48295 The first item checks the sending host’s IP address; the second checks a domain
48296 name. The whole condition is true if either of the DNS lookups succeeds.
48299 <section id="SECTmulkeyfor">
48300 <title>Multiple explicit keys for a DNS list</title>
48302 <indexterm role="concept">
48303 <primary>DNS list</primary>
48304 <secondary>multiple keys for</secondary>
48306 The syntax described above for looking up explicitly-defined values (either
48307 names or IP addresses) in a DNS blacklist is a simplification. After the domain
48308 name for the DNS list, what follows the slash can in fact be a list of items.
48309 As with all lists in Exim, the default separator is a colon. However, because
48310 this is a sublist within the list of DNS blacklist domains, it is necessary
48311 either to double the separators like this:
48313 <literallayout class="monospaced">
48314 dnslists = black.list.tld/name.1::name.2
48317 or to change the separator character, like this:
48319 <literallayout class="monospaced">
48320 dnslists = black.list.tld/<;name.1;name.2
48323 If an item in the list is an IP address, it is inverted before the DNS
48324 blacklist domain is appended. If it is not an IP address, no inversion
48325 occurs. Consider this condition:
48327 <literallayout class="monospaced">
48328 dnslists = black.list.tld/<;192.168.1.2;a.domain
48331 The DNS lookups that occur are:
48333 <literallayout class="monospaced">
48334 2.1.168.192.black.list.tld
48335 a.domain.black.list.tld
48338 Once a DNS record has been found (that matches a specific IP return
48339 address, if specified – see section <xref linkend="SECTaddmatcon"/>), no further lookups
48340 are done. If there is a temporary DNS error, the rest of the sublist of domains
48341 or IP addresses is tried. A temporary error for the whole dnslists item occurs
48342 only if no other DNS lookup in this sublist succeeds. In other words, a
48343 successful lookup for any of the items in the sublist overrides a temporary
48344 error for a previous item.
48347 The ability to supply a list of items after the slash is in some sense just a
48348 syntactic convenience. These two examples have the same effect:
48350 <literallayout class="monospaced">
48351 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
48352 dnslists = black.list.tld/a.domain::b.domain
48355 However, when the data for the list is obtained from a lookup, the second form
48356 is usually much more convenient. Consider this example:
48358 <literallayout class="monospaced">
48359 deny message = The mail servers for the domain \
48360 $sender_address_domain \
48361 are listed at $dnslist_domain ($dnslist_value); \
48363 dnslists = sbl.spamhaus.org/<|${lookup dnsdb {>|a=<|\
48364 ${lookup dnsdb {>|mxh=\
48365 $sender_address_domain} }} }
48368 Note the use of <literal>>|</literal> in the dnsdb lookup to specify the separator for
48369 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
48370 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
48371 of expanding the condition might be something like this:
48373 <literallayout class="monospaced">
48374 dnslists = sbl.spahmaus.org/<|192.168.2.3|192.168.5.6|...
48377 Thus, this example checks whether or not the IP addresses of the sender
48378 domain’s mail servers are on the Spamhaus black list.
48382 <title>Data returned by DNS lists</title>
48384 <indexterm role="concept">
48385 <primary>DNS list</primary>
48386 <secondary>data returned from</secondary>
48388 DNS lists are constructed using address records in the DNS. The original RBL
48389 just used the address 127.0.0.1 on the right hand side of each record, but the
48390 RBL+ list and some other lists use a number of values with different meanings.
48391 The values used on the RBL+ list are:
48396 127.1.0.3 DUL and RBL
48398 127.1.0.5 RSS and RBL
48399 127.1.0.6 RSS and DUL
48400 127.1.0.7 RSS and DUL and RBL
48403 Some DNS lists may return more than one address record.
48407 <title>Variables set from DNS lists</title>
48409 <indexterm role="concept">
48410 <primary>DNS list</primary>
48411 <secondary>variables set from</secondary>
48413 <indexterm role="concept">
48414 <primary><varname>$dnslist_domain</varname></primary>
48416 <indexterm role="concept">
48417 <primary><varname>$dnslist_text</varname></primary>
48419 <indexterm role="concept">
48420 <primary><varname>$dnslist_value</varname></primary>
48422 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname>
48423 contains the name of the domain that matched, <varname>$dnslist_value</varname> contains the
48424 data from the entry, and <varname>$dnslist_text</varname> contains the contents of any
48425 associated TXT record. If more than one address record is returned by the DNS
48426 lookup, all the IP addresses are included in <varname>$dnslist_value</varname>, separated by
48430 You can use these variables in <option>message</option> or <option>log_message</option> modifiers –
48431 although these appear before the condition in the ACL, they are not expanded
48432 until after it has failed. For example:
48434 <literallayout class="monospaced">
48435 deny hosts = !+local_networks
48436 message = $sender_host_address is listed \
48438 dnslists = rbl-plus.mail-abuse.example
48441 <section id="SECTaddmatcon">
48442 <title>Additional matching conditions for DNS lists</title>
48444 <indexterm role="concept">
48445 <primary>DNS list</primary>
48446 <secondary>matching specific returned data</secondary>
48448 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
48449 in order to restrict its action to DNS records with a matching right hand side.
48452 <literallayout class="monospaced">
48453 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
48456 rejects only those hosts that yield 127.0.0.2. Without this additional data,
48457 any address record is considered to be a match. If more than one address record
48458 is found on the list, they are all checked for a matching right-hand side.
48461 More than one IP address may be given for checking, using a comma as a
48462 separator. These are alternatives – if any one of them matches, the
48463 <option>dnslists</option> condition is true. For example:
48465 <literallayout class="monospaced">
48466 deny dnslists = a.b.c=127.0.0.2,127.0.0.3
48469 If you want to specify a constraining address list and also specify names or IP
48470 addresses to be looked up, the constraining address list must be specified
48471 first. For example:
48473 <literallayout class="monospaced">
48474 deny dnslists = dsn.rfc-ignorant.org\
48475 =127.0.0.2/$sender_address_domain
48478 If the character <literal>&</literal> is used instead of <literal>=</literal>, the comparison for each
48479 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
48480 In other words, the listed addresses are used as bit masks. The comparison is
48481 true if all the bits in the mask are present in the address that is being
48482 tested. For example:
48484 <literallayout class="monospaced">
48485 dnslists = a.b.c&0.0.0.3
48488 matches if the address is <emphasis>x.x.x.</emphasis>3, <emphasis>x.x.x.</emphasis>7, <emphasis>x.x.x.</emphasis>11, etc. If you
48489 want to test whether one bit or another bit is present (as opposed to both
48490 being present), you must use multiple values. For example:
48492 <literallayout class="monospaced">
48493 dnslists = a.b.c&0.0.0.1,0.0.0.2
48496 matches if the final component of the address is an odd number or two times
48501 <title>Negated DNS matching conditions</title>
48503 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
48506 <literallayout class="monospaced">
48507 deny dnslists = a.b.c=127.0.0.2,127.0.0.3
48510 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
48511 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
48513 <literallayout class="monospaced">
48514 deny dnslists = a.b.c!=127.0.0.2,127.0.0.3
48517 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
48518 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
48519 words, the result of the test is inverted if an exclamation mark appears before
48520 the <literal>=</literal> (or the <literal>&</literal>) sign.
48523 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
48524 host, or address list (which is why the syntax is different).
48527 If you are using just one list, the negation syntax does not gain you much. The
48528 previous example is precisely equivalent to
48530 <literallayout class="monospaced">
48531 deny dnslists = a.b.c
48532 !dnslists = a.b.c=127.0.0.2,127.0.0.3
48535 However, if you are using multiple lists, the negation syntax is clearer.
48536 Consider this example:
48538 <literallayout class="monospaced">
48539 deny dnslists = sbl.spamhaus.org : \
48541 dnsbl.njabl.org!=127.0.0.3 : \
48545 Using only positive lists, this would have to be:
48547 <literallayout class="monospaced">
48548 deny dnslists = sbl.spamhaus.org : \
48550 deny dnslists = dnsbl.njabl.org
48551 !dnslists = dnsbl.njabl.org=127.0.0.3
48552 deny dnslists = relays.ordb.org
48555 which is less clear, and harder to maintain.
48558 <section id="SECTmorednslistslast">
48559 <title>DNS lists and IPv6</title>
48561 <indexterm role="concept">
48562 <primary>IPv6</primary>
48563 <secondary>DNS black lists</secondary>
48565 <indexterm role="concept">
48566 <primary>DNS list</primary>
48567 <secondary>IPv6 usage</secondary>
48569 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
48570 nibble by nibble. For example, if the calling host’s IP address is
48571 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
48573 <literallayout class="monospaced">
48574 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
48575 f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
48578 (split over two lines here to fit on the page). Unfortunately, some of the DNS
48579 lists contain wildcard records, intended for IPv4, that interact badly with
48580 IPv6. For example, the DNS entry
48582 <literallayout class="monospaced">
48583 *.3.some.list.example. A 127.0.0.1
48586 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
48587 Unfortunately, it also matches the entire 3::/4 IPv6 network.
48590 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
48591 <option>condition</option> condition, as in this example:
48593 <literallayout class="monospaced">
48594 deny condition = ${if isip4{$sender_host_address}}
48595 dnslists = some.list.example
48598 <section id="SECTratelimiting">
48599 <title>Rate limiting senders</title>
48601 <indexterm role="concept">
48602 <primary>rate limiting</primary>
48603 <secondary>client sending</secondary>
48605 <indexterm role="concept">
48606 <primary>limiting client sending rates</primary>
48608 <indexterm role="option">
48609 <primary><option>smpt_ratelimit_*</option></primary>
48611 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
48612 which clients can send email. This is more powerful than the
48613 <option>smtp_ratelimit_*</option> options, because those options control the rate of
48614 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
48615 works across all connections (concurrent and sequential) from the same client
48616 host. The syntax of the <option>ratelimit</option> condition is:
48619 <literal>ratelimit =</literal> <<emphasis>m</emphasis>> <literal>/</literal> <<emphasis>p</emphasis>> <literal>/</literal> <<emphasis>options</emphasis>> <literal>/</literal> <<emphasis>key</emphasis>>
48622 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
48623 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
48626 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
48627 <varname>$sender_rate</varname> to the client’s computed rate, <varname>$sender_rate_limit</varname> to the
48628 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
48629 of <emphasis>p</emphasis>.
48632 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
48633 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
48634 means that it takes Exim longer to forget a client’s past behaviour. The
48635 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
48636 send in each time interval. It also specifies the number of messages permitted
48637 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
48638 constant, you can allow a client to send more messages in a burst without
48639 changing its overall sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
48640 both small, messages must be sent at an even rate.
48643 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
48644 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
48645 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
48646 instructions when it is run with no arguments.
48649 The key is used to look up the data for calculating the client’s average
48650 sending rate. This data is stored in a database maintained by Exim in its spool
48651 directory, alongside the retry and other hints databases. The default key is
48652 <varname>$sender_host_address</varname>, which applies the limit to each client host IP address.
48653 By changing the key you can change how Exim identifies clients for the purpose
48654 of ratelimiting. For example, to limit the sending rate of each authenticated
48655 user, independent of the computer they are sending from, set the key to
48656 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
48657 example, <varname>$authenticated_id</varname> is only meaningful if the client has
48658 authenticated, and you can check with with the <option>authenticated</option> ACL condition.
48661 Internally, Exim includes the smoothing constant <emphasis>p</emphasis> and the options in the
48662 lookup key because they alter the meaning of the stored data. This is not true
48663 for the limit <emphasis>m</emphasis>, so you can alter the configured maximum rate and Exim will
48664 still remember clients’ past behaviour, but if you alter the other ratelimit
48665 parameters Exim forgets past behaviour.
48668 Each <option>ratelimit</option> condition can have up to two options. The first option
48669 specifies what Exim measures the rate of, and the second specifies how Exim
48670 handles excessively fast clients. The options are separated by a slash, like
48671 the other parameters.
48674 The <option>per_conn</option> option limits the client’s connection rate.
48677 The <option>per_mail</option> option limits the client’s rate of sending messages. This is
48678 the default if none of the <option>per_*</option> options is specified.
48681 The <option>per_byte</option> option limits the sender’s email bandwidth. Note that it is
48682 best to use this option in the DATA ACL; if it is used in an earlier ACL it
48683 relies on the SIZE parameter on the MAIL command, which may be inaccurate or
48684 completely missing. You can follow the limit <emphasis>m</emphasis> in the configuration with K,
48685 M, or G to specify limits in kilobytes, megabytes, or gigabytes, respectively.
48688 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
48689 condition is processed. This can be used to limit the SMTP command rate. The
48690 alias <option>per_rcpt</option> is provided for use in the RCPT ACL instead of <option>per_cmd</option>
48691 to make it clear that the effect is to limit the rate at which recipients are
48692 accepted. Note that in this case the rate limiting engine will see a message
48693 with many recipients as a large high-speed burst.
48696 If a client’s average rate is greater than the maximum, the rate limiting
48697 engine can react in two possible ways, depending on the presence of the
48698 <option>strict</option> or <option>leaky</option> options. This is independent of the other
48699 counter-measures (such as rejecting the message) that may be specified by the
48700 rest of the ACL. The default mode is leaky, which avoids a sender’s
48701 over-aggressive retry rate preventing it from getting any email through.
48704 The <option>strict</option> option means that the client’s recorded rate is always updated.
48705 The effect of this is that Exim measures the client’s average rate of attempts
48706 to send email, which can be much higher than the maximum. If the client is over
48707 the limit it will be subjected to counter-measures until it slows down below
48708 the maximum rate. The smoothing period determines the time it takes for a high
48709 sending rate to decay exponentially to 37% of its peak value, which means that
48710 you can work out the time (the number of smoothing periods) that a client is
48711 subjected to counter-measures after an over-limit burst with this formula:
48713 <literallayout class="monospaced">
48714 ln(peakrate/maxrate)
48717 The <option>leaky</option> option means that the client’s recorded rate is not updated if it
48718 is above the limit. The effect of this is that Exim measures the client’s
48719 average rate of successfully sent email, which cannot be greater than the
48720 maximum. If the client is over the limit it will suffer some counter-measures,
48721 but it will still be able to send email at the configured maximum rate,
48722 whatever the rate of its attempts. This is generally the better choice if you
48723 have clients that retry automatically.
48726 Exim’s other ACL facilities are used to define what counter-measures are taken
48727 when the rate limit is exceeded. This might be anything from logging a warning
48728 (for example, while measuring existing sending rates in order to define
48729 policy), through time delays to slow down fast senders, up to rejecting the
48730 message. For example:
48732 <literallayout class="monospaced">
48733 # Log all senders' rates
48734 warn ratelimit = 0 / 1h / strict
48735 log_message = Sender rate $sender_rate / $sender_rate_period
48737 # Slow down fast senders; note the need to truncate $sender_rate
48738 # at the decimal point.
48739 warn ratelimit = 100 / 1h / per_rcpt / strict
48740 delay = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
48741 $sender_rate_limit }s
48743 # Keep authenticated users under control
48744 deny authenticated = *
48745 ratelimit = 100 / 1d / strict / $authenticated_id
48747 # System-wide rate limit
48748 defer message = Sorry, too busy. Try again later.
48749 ratelimit = 10 / 1s / $primary_hostname
48751 # Restrict incoming rate from each host, with a default
48752 # set using a macro and special cases looked up in a table.
48753 defer message = Sender rate exceeds $sender_rate_limit \
48754 messages per $sender_rate_period
48755 ratelimit = ${lookup {$sender_host_address} \
48756 cdb {DB/ratelimits.cdb} \
48757 {$value} {RATELIMIT} }
48760 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
48761 especially with the <option>per_rcpt</option> option, you may suffer from a performance
48762 bottleneck caused by locking on the ratelimit hints database. Apart from
48763 making your ACLs less complicated, you can reduce the problem by using a
48764 RAM disk for Exim’s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
48765 this means that Exim will lose its hints data after a reboot (including retry
48766 hints, the callout cache, and ratelimit data).
48769 <section id="SECTaddressverification">
48770 <title>Address verification</title>
48772 <indexterm role="concept">
48773 <primary>verifying address</primary>
48774 <secondary>options for</secondary>
48776 <indexterm role="concept">
48777 <primary>policy control</primary>
48778 <secondary>address verification</secondary>
48780 Several of the <option>verify</option> conditions described in section
48781 <xref linkend="SECTaclconditions"/> cause addresses to be verified. These conditions can be
48782 followed by options that modify the verification process. The options are
48783 separated from the keyword and from each other by slashes, and some of them
48784 contain parameters. For example:
48786 <literallayout class="monospaced">
48787 verify = sender/callout
48788 verify = recipient/defer_ok/callout=10s,defer_ok
48791 The first stage of address verification, which always happens, is to run the
48792 address through the routers, in <quote>verify mode</quote>. Routers can detect the
48793 difference between verification and routing for delivery, and their actions can
48794 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
48795 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
48796 The available options are as follows:
48801 If the <option>callout</option> option is specified, successful routing to one or more
48802 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
48803 check. Callouts and their sub-options are discussed in the next section.
48808 If there is a defer error while doing verification routing, the ACL
48809 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
48810 options, the condition is forced to be true instead. Note that this is a main
48811 verification option as well as a suboption for callouts.
48816 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
48817 discusses the reporting of sender address verification failures.
48822 The <option>success_on_redirect</option> option causes verification always to succeed
48823 immediately after a successful redirection. By default, if a redirection
48824 generates just one address, that address is also verified. See further
48825 discussion in section <xref linkend="SECTredirwhilveri"/>.
48830 <indexterm role="concept">
48831 <primary>verifying address</primary>
48832 <secondary>differentiating failures</secondary>
48834 <indexterm role="concept">
48835 <primary><varname>$recipient_verify_failure</varname></primary>
48837 <indexterm role="concept">
48838 <primary><varname>$sender_verify_failure</varname></primary>
48840 <indexterm role="concept">
48841 <primary><varname>$acl_verify_message</varname></primary>
48843 After an address verification failure, <varname>$acl_verify_message</varname> contains the
48844 error message that is associated with the failure. It can be preserved by
48847 <literallayout class="monospaced">
48848 warn !verify = sender
48849 set acl_m0 = $acl_verify_message
48852 If you are writing your own custom rejection message or log message when
48853 denying access, you can use this variable to include information about the
48854 verification failure.
48857 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
48858 appropriate) contains one of the following words:
48863 <option>qualify</option>: The address was unqualified (no domain), and the message
48864 was neither local nor came from an exempted host.
48869 <option>route</option>: Routing failed.
48874 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
48875 occurred at or before the MAIL command (that is, on initial
48876 connection, HELO, or MAIL).
48881 <option>recipient</option>: The RCPT command in a callout was rejected.
48886 <option>postmaster</option>: The postmaster check in a callout was rejected.
48891 The main use of these variables is expected to be to distinguish between
48892 rejections of MAIL and rejections of RCPT in callouts.
48895 <section id="SECTcallver">
48896 <title>Callout verification</title>
48898 <indexterm role="concept">
48899 <primary>verifying address</primary>
48900 <secondary>by callout</secondary>
48902 <indexterm role="concept">
48903 <primary>callout</primary>
48904 <secondary>verification</secondary>
48906 <indexterm role="concept">
48907 <primary>SMTP</primary>
48908 <secondary>callout verification</secondary>
48910 For non-local addresses, routing verifies the domain, but is unable to do any
48911 checking of the local part. There are situations where some means of verifying
48912 the local part is desirable. One way this can be done is to make an SMTP
48913 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
48914 a subsequent host for a recipient address, to see if the host accepts the
48915 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
48916 sender address, the callback is not to the client host that is trying to
48917 deliver the message, but to one of the hosts that accepts incoming mail for the
48918 sender’s domain.
48921 Exim does not do callouts by default. If you want them to happen, you must
48922 request them by setting appropriate options on the <option>verify</option> condition, as
48923 described below. This facility should be used with care, because it can add a
48924 lot of resource usage to the cost of verifying an address. However, Exim does
48925 cache the results of callouts, which helps to reduce the cost. Details of
48926 caching are in section <xref linkend="SECTcallvercache"/>.
48929 Recipient callouts are usually used only between hosts that are controlled by
48930 the same administration. For example, a corporate gateway host could use
48931 callouts to check for valid recipients on an internal mailserver. A successful
48932 callout does not guarantee that a real delivery to the address would succeed;
48933 on the other hand, a failing callout does guarantee that a delivery would fail.
48936 If the <option>callout</option> option is present on a condition that verifies an address, a
48937 second stage of verification occurs if the address is successfully routed to
48938 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
48939 <command>manualroute</command> router, where the router specifies the hosts. However, if a
48940 router that does not set up hosts routes to an <command>smtp</command> transport with a
48941 <option>hosts</option> setting, the transport’s hosts are used. If an <command>smtp</command> transport has
48942 <option>hosts_override</option> set, its hosts are always used, whether or not the router
48943 supplies a host list.
48946 The port that is used is taken from the transport, if it is specified and is a
48947 remote transport. (For routers that do verification only, no transport need be
48948 specified.) Otherwise, the default SMTP port is used. If a remote transport
48949 specifies an outgoing interface, this is used; otherwise the interface is not
48953 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
48954 test whether a bounce message could be delivered to the sender address. The
48955 following SMTP commands are sent:
48958 <literal>HELO </literal><<emphasis>smtp active host name</emphasis>>
48959 <literal>MAIL FROM:<></literal>
48960 <literal>RCPT TO:</literal><<emphasis>the address to be tested</emphasis>>
48961 <literal>QUIT</literal>
48964 LHLO is used instead of HELO if the transport’s <option>protocol</option> option is
48965 set to <quote>lmtp</quote>.
48968 A recipient callout check is similar. By default, it also uses an empty address
48969 for the sender. This default is chosen because most hosts do not make use of
48970 the sender address when verifying a recipient. Using the same address means
48971 that a single cache entry can be used for each recipient. Some sites, however,
48972 do make use of the sender address when verifying. These are catered for by the
48973 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
48976 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
48977 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
48978 Exim tries the next host, if any. If there is a problem with all the remote
48979 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
48980 <option>callout</option> option is given, in which case the condition is forced to succeed.
48983 <section id="CALLaddparcall">
48984 <title>Additional parameters for callouts</title>
48986 <indexterm role="concept">
48987 <primary>callout</primary>
48988 <secondary>additional parameters for</secondary>
48990 The <option>callout</option> option can be followed by an equals sign and a number of
48991 optional parameters, separated by commas. For example:
48993 <literallayout class="monospaced">
48994 verify = recipient/callout=10s,defer_ok
48997 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
48998 separate verify options, is retained for backwards compatibility, but is now
48999 deprecated. The additional parameters for <option>callout</option> are as follows:
49003 <term><<emphasis>a time interval</emphasis>></term>
49006 <indexterm role="concept">
49007 <primary>callout timeout</primary>
49008 <secondary>specifying</secondary>
49010 This specifies the timeout that applies for the callout attempt to each host.
49013 <literallayout class="monospaced">
49014 verify = sender/callout=5s
49017 The default is 30 seconds. The timeout is used for each response from the
49018 remote host. It is also used for the intial connection, unless overridden by
49019 the <option>connect</option> parameter.
49021 </listitem></varlistentry>
49023 <term><emphasis role="bold">connect = </emphasis><<emphasis>time interval</emphasis>></term>
49026 <indexterm role="concept">
49027 <primary>callout connection timeout</primary>
49028 <secondary>specifying</secondary>
49030 This parameter makes it possible to set a different (usually smaller) timeout
49031 for making the SMTP connection. For example:
49033 <literallayout class="monospaced">
49034 verify = sender/callout=5s,connect=1s
49037 If not specified, this timeout defaults to the general timeout value.
49039 </listitem></varlistentry>
49041 <term><emphasis role="bold">defer_ok</emphasis></term>
49044 <indexterm role="concept">
49045 <primary>callout defer</primary>
49046 <secondary>action on</secondary>
49048 When this parameter is present, failure to contact any host, or any other kind
49049 of temporary error, is treated as success by the ACL. However, the cache is not
49050 updated in this circumstance.
49052 </listitem></varlistentry>
49054 <term><emphasis role="bold">fullpostmaster</emphasis></term>
49057 <indexterm role="concept">
49058 <primary>callout</primary>
49059 <secondary>full postmaster check</secondary>
49061 This operates like the <option>postmaster</option> option (see below), but if the check for
49062 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
49063 accordance with the specification in RFC 2821. The RFC states that the
49064 unqualified address <emphasis>postmaster</emphasis> should be accepted.
49066 </listitem></varlistentry>
49068 <term><emphasis role="bold">mailfrom = </emphasis><<emphasis>email address</emphasis>></term>
49071 <indexterm role="concept">
49072 <primary>callout</primary>
49073 <secondary>sender when verifying header</secondary>
49075 When verifying addresses in header lines using the <option>header_sender</option>
49076 verification option, Exim behaves by default as if the addresses are envelope
49077 sender addresses from a message. Callout verification therefore tests to see
49078 whether a bounce message could be delivered, by using an empty address in the
49079 MAIL command. However, it is arguable that these addresses might never be used
49080 as envelope senders, and could therefore justifiably reject bounce messages
49081 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
49082 address to use in the MAIL command. For example:
49084 <literallayout class="monospaced">
49085 require verify = header_sender/callout=mailfrom=abcd@x.y.z
49088 This parameter is available only for the <option>header_sender</option> verification option.
49090 </listitem></varlistentry>
49092 <term><emphasis role="bold">maxwait = </emphasis><<emphasis>time interval</emphasis>></term>
49095 <indexterm role="concept">
49096 <primary>callout overall timeout</primary>
49097 <secondary>specifying</secondary>
49099 This parameter sets an overall timeout for performing a callout verification.
49102 <literallayout class="monospaced">
49103 verify = sender/callout=5s,maxwait=30s
49106 This timeout defaults to four times the callout timeout for individual SMTP
49107 commands. The overall timeout applies when there is more than one host that can
49108 be tried. The timeout is checked before trying the next host. This prevents
49109 very long delays if there are a large number of hosts and all are timing out
49110 (for example, when network connections are timing out).
49112 </listitem></varlistentry>
49114 <term><emphasis role="bold">no_cache</emphasis></term>
49117 <indexterm role="concept">
49118 <primary>callout cache</primary>
49119 <secondary>suppressing</secondary>
49121 <indexterm role="concept">
49122 <primary>caching callout</primary>
49123 <secondary>suppressing</secondary>
49125 When this parameter is given, the callout cache is neither read nor updated.
49127 </listitem></varlistentry>
49129 <term><emphasis role="bold">postmaster</emphasis></term>
49132 <indexterm role="concept">
49133 <primary>callout</primary>
49134 <secondary>postmaster; checking</secondary>
49136 When this parameter is set, a sucessful callout check is followed by a similar
49137 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
49138 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
49139 the postmaster check is recorded in a cache record; if it is a failure, this is
49140 used to fail subsequent callouts for the domain without a connection being
49141 made, until the cache record expires.
49143 </listitem></varlistentry>
49145 <term><emphasis role="bold">postmaster_mailfrom = </emphasis><<emphasis>email address</emphasis>></term>
49148 The postmaster check uses an empty sender in the MAIL command by default.
49149 You can use this parameter to do a postmaster check using a different address.
49152 <literallayout class="monospaced">
49153 require verify = sender/callout=postmaster_mailfrom=abc@x.y.z
49156 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
49157 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
49159 <literallayout class="monospaced">
49160 require verify = sender/callout=postmaster_mailfrom=
49163 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
49164 account of the sender address. It is assumed that either the empty address or
49165 a fixed non-empty address will be used. All that Exim remembers is that the
49166 postmaster check for the domain succeeded or failed.
49168 </listitem></varlistentry>
49170 <term><emphasis role="bold">random</emphasis></term>
49173 <indexterm role="concept">
49174 <primary>callout</primary>
49175 <secondary><quote>random</quote> check</secondary>
49177 When this parameter is set, before doing the normal callout check, Exim does a
49178 check for a <quote>random</quote> local part at the same domain. The local part is not
49179 really random – it is defined by the expansion of the option
49180 <option>callout_random_local_part</option>, which defaults to
49182 <literallayout class="monospaced">
49183 $primary_host_name-$tod_epoch-testing
49186 The idea here is to try to determine whether the remote host accepts all local
49187 parts without checking. If it does, there is no point in doing callouts for
49188 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
49189 a cache record, and used to force the current and subsequent callout checks to
49190 succeed without a connection being made, until the cache record expires.
49192 </listitem></varlistentry>
49194 <term><emphasis role="bold">use_postmaster</emphasis></term>
49197 <indexterm role="concept">
49198 <primary>callout</primary>
49199 <secondary>sender for recipient check</secondary>
49201 This parameter applies to recipient callouts only. For example:
49203 <literallayout class="monospaced">
49204 deny !verify = recipient/callout=use_postmaster
49207 <indexterm role="concept">
49208 <primary><varname>$qualify_domain</varname></primary>
49210 It causes a non-empty postmaster address to be used in the MAIL command when
49211 performing the callout for the recipient, and also for a <quote>random</quote> check if
49212 that is configured. The local part of the address is <literal>postmaster</literal> and the
49213 domain is the contents of <varname>$qualify_domain</varname>.
49215 </listitem></varlistentry>
49217 <term><emphasis role="bold">use_sender</emphasis></term>
49220 This option applies to recipient callouts only. For example:
49222 <literallayout class="monospaced">
49223 require verify = recipient/callout=use_sender
49226 It causes the message’s actual sender address to be used in the MAIL
49227 command when performing the callout, instead of an empty address. There is no
49228 need to use this option unless you know that the called hosts make use of the
49229 sender when checking recipients. If used indiscriminately, it reduces the
49230 usefulness of callout caching.
49232 </listitem></varlistentry>
49235 If you use any of the parameters that set a non-empty sender for the MAIL
49236 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
49237 <option>use_sender</option>), you should think about possible loops. Recipient checking is
49238 usually done between two hosts that are under the same management, and the host
49239 that receives the callouts is not normally configured to do callouts itself.
49240 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
49241 these circumstances.
49244 However, if you use a non-empty sender address for a callout to an arbitrary
49245 host, there is the likelihood that the remote host will itself initiate a
49246 callout check back to your host. As it is checking what appears to be a message
49247 sender, it is likely to use an empty address in MAIL, thus avoiding a
49248 callout loop. However, to be on the safe side it would be best to set up your
49249 own ACLs so that they do not do sender verification checks when the recipient
49250 is the address you use for header sender or postmaster callout checking.
49253 Another issue to think about when using non-empty senders for callouts is
49254 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
49255 by the sender/recipient combination; thus, for any given recipient, many more
49256 actual callouts are performed than when an empty sender or postmaster is used.
49259 <section id="SECTcallvercache">
49260 <title>Callout caching</title>
49262 <indexterm role="concept">
49263 <primary>hints database</primary>
49264 <secondary>callout cache</secondary>
49266 <indexterm role="concept">
49267 <primary>callout</primary>
49268 <secondary>caching</secondary>
49270 <indexterm role="concept">
49271 <primary>caching</primary>
49272 <secondary>callout</secondary>
49274 Exim caches the results of callouts in order to reduce the amount of resources
49275 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
49276 option. A hints database called <quote>callout</quote> is used for the cache. Two
49277 different record types are used: one records the result of a callout check for
49278 a specific address, and the other records information that applies to the
49279 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
49282 When an original callout fails, a detailed SMTP error message is given about
49283 the failure. However, for subsequent failures use the cache data, this message
49287 The expiry times for negative and positive address cache records are
49288 independent, and can be set by the global options <option>callout_negative_expire</option>
49289 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
49292 If a host gives a negative response to an SMTP connection, or rejects any
49293 commands up to and including
49295 <literallayout class="monospaced">
49299 (but not including the MAIL command with a non-empty address),
49300 any callout attempt is bound to fail. Exim remembers such failures in a
49301 domain cache record, which it uses to fail callouts for the domain without
49302 making new connections, until the domain record times out. There are two
49303 separate expiry times for domain cache records:
49304 <option>callout_domain_negative_expire</option> (default 3h) and
49305 <option>callout_domain_positive_expire</option> (default 7d).
49308 Domain records expire when the negative expiry time is reached if callouts
49309 cannot be made for the domain, or if the postmaster check failed.
49310 Otherwise, they expire when the positive expiry time is reached. This
49311 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
49312 will eventually be noticed.
49315 The callout caching mechanism is based on the domain of the address that is
49316 being tested. If the domain routes to several hosts, it is assumed that their
49317 behaviour will be the same.
49320 <section id="SECTsenaddver">
49321 <title>Sender address verification reporting</title>
49323 <indexterm role="concept">
49324 <primary>verifying</primary>
49325 <secondary>suppressing error details</secondary>
49327 When sender verification fails in an ACL, the details of the failure are
49328 given as additional output lines before the 550 response to the relevant
49329 SMTP command (RCPT or DATA). For example, if sender callout is in use,
49332 <literallayout class="monospaced">
49333 MAIL FROM:<xyz@abc.example>
49335 RCPT TO:<pqr@def.example>
49336 550-Verification failed for <xyz@abc.example>
49337 550-Called: 192.168.34.43
49338 550-Sent: RCPT TO:<xyz@abc.example>
49339 550-Response: 550 Unknown local part xyz in <xyz@abc.example>
49340 550 Sender verification failed
49343 If more than one RCPT command fails in the same way, the details are given
49344 only for the first of them. However, some administrators do not want to send
49345 out this much information. You can suppress the details by adding
49346 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
49349 <literallayout class="monospaced">
49350 verify = sender/no_details
49353 <section id="SECTredirwhilveri">
49354 <title>Redirection while verifying</title>
49356 <indexterm role="concept">
49357 <primary>verifying</primary>
49358 <secondary>redirection while</secondary>
49360 <indexterm role="concept">
49361 <primary>address redirection</primary>
49362 <secondary>while verifying</secondary>
49364 A dilemma arises when a local address is redirected by aliasing or forwarding
49365 during verification: should the generated addresses themselves be verified,
49366 or should the successful expansion of the original address be enough to verify
49367 it? By default, Exim takes the following pragmatic approach:
49372 When an incoming address is redirected to just one child address, verification
49373 continues with the child address, and if that fails to verify, the original
49374 verification also fails.
49379 When an incoming address is redirected to more than one child address,
49380 verification does not continue. A success result is returned.
49385 This seems the most reasonable behaviour for the common use of aliasing as a
49386 way of redirecting different local parts to the same mailbox. It means, for
49387 example, that a pair of alias entries of the form
49389 <literallayout class="monospaced">
49391 aw123: :fail: Gone away, no forwarding address
49394 work as expected, with both local parts causing verification failure. When a
49395 redirection generates more than one address, the behaviour is more like a
49396 mailing list, where the existence of the alias itself is sufficient for
49397 verification to succeed.
49400 It is possible, however, to change the default behaviour so that all successful
49401 redirections count as successful verifications, however many new addresses are
49402 generated. This is specified by the <option>success_on_redirect</option> verification
49403 option. For example:
49405 <literallayout class="monospaced">
49406 require verify = recipient/success_on_redirect/callout=10s
49409 In this example, verification succeeds if a router generates a new address, and
49410 the callout does not occur, because no address was routed to a remote host.
49413 <section id="SECTverifyCSA">
49414 <title>Client SMTP authorization (CSA)</title>
49416 <indexterm role="concept">
49417 <primary>CSA</primary>
49418 <secondary>verifying</secondary>
49420 Client SMTP Authorization is a system that allows a site to advertise
49421 which machines are and are not permitted to send email. This is done by placing
49422 special SRV records in the DNS; these are looked up using the client’s HELO
49423 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
49424 Authorization checks in Exim are performed by the ACL condition:
49426 <literallayout class="monospaced">
49430 This fails if the client is not authorized. If there is a DNS problem, or if no
49431 valid CSA SRV record is found, or if the client is authorized, the condition
49432 succeeds. These three cases can be distinguished using the expansion variable
49433 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
49434 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
49435 be likely to cause problems for legitimate email.
49438 The error messages produced by the CSA code include slightly more
49439 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
49440 looking up the CSA SRV record, or problems looking up the CSA target
49441 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
49446 The client’s host name is explicitly not authorized.
49451 The client’s IP address does not match any of the CSA target IP addresses.
49456 The client’s host name is authorized but it has no valid target IP addresses
49457 (for example, the target’s addresses are IPv6 and the client is using IPv4).
49462 The client’s host name has no CSA SRV record but a parent domain has asserted
49463 that all subdomains must be explicitly authorized.
49468 The <option>csa</option> verification condition can take an argument which is the domain to
49469 use for the DNS query. The default is:
49471 <literallayout class="monospaced">
49472 verify = csa/$sender_helo_name
49475 This implementation includes an extension to CSA. If the query domain
49476 is an address literal such as [192.0.2.95], or if it is a bare IP
49477 address, Exim searches for CSA SRV records in the reverse DNS as if
49478 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
49481 <literallayout class="monospaced">
49482 verify = csa/$sender_host_address
49485 In fact, this is the check that Exim performs if the client does not say HELO.
49486 This extension can be turned off by setting the main configuration option
49487 <option>dns_csa_use_reverse</option> to be false.
49490 If a CSA SRV record is not found for the domain itself, a search
49491 is performed through its parent domains for a record which might be
49492 making assertions about subdomains. The maximum depth of this search is limited
49493 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
49494 default. Exim does not look for CSA SRV records in a top level domain, so the
49495 default settings handle HELO domains as long as seven
49496 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
49497 of legitimate HELO domains.
49500 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
49501 direct SRV lookups, this is not sufficient because of the extra parent domain
49502 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
49503 addresses into lookups in the reverse DNS space. The result of a successful
49506 <literallayout class="monospaced">
49507 ${lookup dnsdb {csa=$sender_helo_name}}
49510 has two space-separated fields: an authorization code and a target host name.
49511 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
49512 authorization required but absent, or <quote>?</quote> for unknown.
49515 <section id="SECTverifyPRVS">
49516 <title>Bounce address tag validation</title>
49518 <indexterm role="concept">
49519 <primary>BATV</primary>
49520 <secondary>verifying</secondary>
49522 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
49523 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
49524 Genuine incoming bounce messages should therefore always be addressed to
49525 recipients that have a valid tag. This scheme is a way of detecting unwanted
49526 bounce messages caused by sender address forgeries (often called <quote>collateral
49527 spam</quote>), because the recipients of such messages do not include valid tags.
49530 There are two expansion items to help with the implementation of the BATV
49531 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
49532 the original envelope sender address by using a simple key to add a hash of the
49533 address and some time-based randomizing information. The <option>prvs</option> expansion
49534 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
49535 The syntax of these expansion items is described in section
49536 <xref linkend="SECTexpansionitems"/>.
49539 As an example, suppose the secret per-address keys are stored in an MySQL
49540 database. A query to look up the key for an address could be defined as a macro
49543 <literallayout class="monospaced">
49544 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
49545 WHERE sender='${quote_mysql:$prvscheck_address}'\
49549 Suppose also that the senders who make use of BATV are defined by an address
49550 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
49553 <literallayout class="monospaced">
49554 # Bounces: drop unsigned addresses for BATV senders
49555 deny message = This address does not send an unsigned reverse path.
49557 recipients = +batv_senders
49559 # Bounces: In case of prvs-signed address, check signature.
49560 deny message = Invalid reverse path signature.
49562 condition = ${prvscheck {$local_part@$domain}\
49563 {PRVSCHECK_SQL}{1}}
49564 !condition = $prvscheck_result
49567 The first statement rejects recipients for bounce messages that are addressed
49568 to plain BATV sender addresses, because it is known that BATV senders do not
49569 send out messages with plain sender addresses. The second statement rejects
49570 recipients that are prvs-signed, but with invalid signatures (either because
49571 the key is wrong, or the signature has timed out).
49574 A non-prvs-signed address is not rejected by the second statement, because the
49575 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
49576 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
49577 the first argument is a syntactically valid prvs-signed address, the yield is
49578 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
49579 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
49580 of the checks (empty for failure, <quote>1</quote> for success).
49583 There are two more issues you must consider when implementing prvs-signing.
49584 Firstly, you need to ensure that prvs-signed addresses are not blocked by your
49585 ACLs. A prvs-signed address contains a slash character, but the default Exim
49586 configuration contains this statement in the RCPT ACL:
49588 <literallayout class="monospaced">
49589 deny message = Restricted characters in address
49590 domains = +local_domains
49591 local_parts = ^[.] : ^.*[@%!/|]
49594 This is a conservative rule that blocks local parts that contain slashes. You
49595 should remove the slash in the last line.
49598 Secondly, you have to ensure that the routers accept prvs-signed addresses and
49599 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
49600 router to remove the signature with a configuration along these lines:
49602 <literallayout class="monospaced">
49605 data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
49608 This works because, if the third argument of <option>prvscheck</option> is empty, the result
49609 of the expansion of a prvs-signed address is the decoded value of the original
49610 address. This router should probably be the first of your routers that handles
49614 To create BATV-signed addresses in the first place, a transport of this form
49617 <literallayout class="monospaced">
49618 external_smtp_batv:
49620 return_path = ${prvs {$return_path} \
49621 {${lookup mysql{SELECT \
49622 secret FROM batv_prvs WHERE \
49623 sender='${quote_mysql:$sender_address}'} \
49627 If no key can be found for the existing return path, no signing takes place.
49630 <section id="SECTrelaycontrol">
49631 <title>Using an ACL to control relaying</title>
49633 <indexterm role="concept">
49634 <primary>access control lists (ACLs)</primary>
49635 <secondary>relay control</secondary>
49637 <indexterm role="concept">
49638 <primary>relaying</primary>
49639 <secondary>control by ACL</secondary>
49641 <indexterm role="concept">
49642 <primary>policy control</primary>
49643 <secondary>relay control</secondary>
49645 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
49646 delivers it directly to another host as a result of a remote address contained
49647 within it. Redirecting a local address via an alias or forward file and then
49648 passing the message on to another host is not relaying,
49649 <indexterm role="concept">
49650 <primary><quote>percent hack</quote></primary>
49652 but a redirection as a result of the <quote>percent hack</quote> is.
49655 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
49656 A host which is acting as a gateway or an MX backup is concerned with incoming
49657 relaying from arbitrary hosts to a specific set of domains. On the other hand,
49658 a host which is acting as a smart host for a number of clients is concerned
49659 with outgoing relaying from those clients to the Internet at large. Often the
49660 same host is fulfilling both functions,
49661 but in principle these two kinds of relaying are entirely independent. What is
49662 not wanted is the transmission of mail from arbitrary remote hosts through your
49663 system to arbitrary domains.
49666 You can implement relay control by means of suitable statements in the ACL that
49667 runs for each RCPT command. For convenience, it is often easiest to use
49668 Exim’s named list facility to define the domains and hosts involved. For
49669 example, suppose you want to do the following:
49674 Deliver a number of domains to mailboxes on the local host (or process them
49675 locally in some other way). Let’s say these are <emphasis>my.dom1.example</emphasis> and
49676 <emphasis>my.dom2.example</emphasis>.
49681 Relay mail for a number of other domains for which you are the secondary MX.
49682 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
49687 Relay mail from the hosts on your local LAN, to whatever domains are involved.
49688 Suppose your LAN is 192.168.45.0/24.
49693 In the main part of the configuration, you put the following definitions:
49695 <literallayout class="monospaced">
49696 domainlist local_domains = my.dom1.example : my.dom2.example
49697 domainlist relay_domains = friend1.example : friend2.example
49698 hostlist relay_hosts = 192.168.45.0/24
49701 Now you can use these definitions in the ACL that is run for every RCPT
49704 <literallayout class="monospaced">
49706 accept domains = +local_domains : +relay_domains
49707 accept hosts = +relay_hosts
49710 The first statement accepts any RCPT command that contains an address in
49711 the local or relay domains. For any other domain, control passes to the second
49712 statement, which accepts the command only if it comes from one of the relay
49713 hosts. In practice, you will probably want to make your ACL more sophisticated
49714 than this, for example, by including sender and recipient verification. The
49715 default configuration includes a more comprehensive example, which is described
49716 in chapter <xref linkend="CHAPdefconfil"/>.
49719 <section id="SECTcheralcon">
49720 <title>Checking a relay configuration</title>
49722 <indexterm role="concept">
49723 <primary>relaying</primary>
49724 <secondary>checking control of</secondary>
49726 You can check the relay characteristics of your configuration in the same way
49727 that you can test any ACL behaviour for an incoming SMTP connection, by using
49728 the <option>-bh</option> option to run a fake SMTP session with which you interact.
49731 For specifically testing for unwanted relaying, the host
49732 <emphasis>relay-test.mail-abuse.org</emphasis> provides a useful service. If you telnet to this
49733 host from the host on which Exim is running, using the normal telnet port, you
49734 will see a normal telnet connection message and then quite a long delay. Be
49735 patient. The remote host is making an SMTP connection back to your host, and
49736 trying a number of common probes to test for open relay vulnerability. The
49737 results of the tests will eventually appear on your terminal.
49738 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
49743 <chapter id="CHAPexiscan">
49744 <title>Content scanning at ACL time</title>
49746 <indexterm role="concept" id="IIDcosca" class="startofrange">
49747 <primary>content scanning</primary>
49748 <secondary>at ACL time</secondary>
49750 The extension of Exim to include content scanning at ACL time, formerly known
49751 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
49752 was integrated into the main source for Exim release 4.50, and Tom continues to
49753 maintain it. Most of the wording of this chapter is taken from Tom’s
49757 It is also possible to scan the content of messages at other times. The
49758 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
49759 scanning after all the ACLs have run. A transport filter can be used to scan
49760 messages at delivery time (see the <option>transport_filter</option> option, described in
49761 chapter <xref linkend="CHAPtransportgeneric"/>).
49764 If you want to include the ACL-time content-scanning features when you compile
49765 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
49766 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
49771 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
49772 for all MIME parts for SMTP and non-SMTP messages, respectively.
49777 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
49778 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
49779 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
49784 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
49785 of messages, or parts of messages, for debugging purposes.
49790 Additional expansion variables that are set in the new ACL and by the new
49796 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
49801 There is another content-scanning configuration option for <filename>Local/Makefile</filename>,
49802 called WITH_OLD_DEMIME. If this is set, the old, deprecated <option>demime</option> ACL
49803 condition is compiled, in addition to all the other content-scanning features.
49806 Content-scanning is continually evolving, and new features are still being
49807 added. While such features are still unstable and liable to incompatible
49808 changes, they are made available in Exim by setting options whose names begin
49809 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
49810 this manual. You can find out about them by reading the file called
49811 <filename>doc/experimental.txt</filename>.
49814 All the content-scanning facilites work on a MBOX copy of the message that is
49815 temporarily created in a file called:
49818 <<emphasis>spool_directory</emphasis>><literal>/scan/</literal><<emphasis>message_id</emphasis>>/<<emphasis>message_id</emphasis>><literal>.eml</literal>
49821 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
49822 expect an MBOX-like structure inside that file. The file is created when the
49823 first content scanning facility is called. Subsequent calls to content
49824 scanning conditions open the same file again. The directory is recursively
49825 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
49827 <literallayout class="monospaced">
49828 control = no_mbox_unspool
49831 has been encountered. When the MIME ACL decodes files, they are put into the
49832 same directory by default.
49834 <section id="SECTscanvirus">
49835 <title>Scanning for viruses</title>
49837 <indexterm role="concept">
49838 <primary>virus scanning</primary>
49840 <indexterm role="concept">
49841 <primary>content scanning</primary>
49842 <secondary>for viruses</secondary>
49844 <indexterm role="concept">
49845 <primary>content scanning</primary>
49846 <secondary>the <option>malware</option> condition</secondary>
49848 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
49849 It supports a <quote>generic</quote> interface to scanners called via the shell, and
49850 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
49851 in memory and thus are much faster.
49854 <indexterm role="concept">
49855 <primary><option>av_scanner</option></primary>
49857 You can set the <option>av_scanner</option> option in first part of the Exim configuration
49858 file to specify which scanner to use, together with any additional options that
49859 are needed. The basic syntax is as follows:
49862 <literal>av_scanner = <</literal><emphasis>scanner-type</emphasis><literal>>:<</literal><emphasis>option1</emphasis><literal>>:<</literal><emphasis>option2</emphasis><literal>>:[...]</literal>
49865 If you do not set <option>av_scanner</option>, it defaults to
49867 <literallayout class="monospaced">
49868 av_scanner = sophie:/var/run/sophie
49871 If the value of <option>av_scanner</option> starts with dollar character, it is expanded
49872 before use. The following scanner types are supported in this release:
49876 <term><option>aveserver</option></term>
49879 <indexterm role="concept">
49880 <primary>virus scanners</primary>
49881 <secondary>Kaspersky</secondary>
49883 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
49884 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
49885 which is the path to the daemon’s UNIX socket. The default is shown in this
49888 <literallayout class="monospaced">
49889 av_scanner = aveserver:/var/run/aveserver
49891 </listitem></varlistentry>
49893 <term><option>clamd</option></term>
49896 <indexterm role="concept">
49897 <primary>virus scanners</primary>
49898 <secondary>clamd</secondary>
49900 This daemon-type scanner is GPL and free. You can get it at
49901 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
49902 unpack MIME containers, so it used to be recommended to unpack MIME attachments
49903 in the MIME ACL. This no longer believed to be necessary. One option is
49904 required: either the path and name of a UNIX socket file, or a hostname or IP
49905 number, and a port, separated by space, as in the second of these examples:
49907 <literallayout class="monospaced">
49908 av_scanner = clamd:/opt/clamd/socket
49909 av_scanner = clamd:192.168.2.100 1234
49912 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
49913 contributing the code for this scanner.
49915 </listitem></varlistentry>
49917 <term><option>cmdline</option></term>
49920 <indexterm role="concept">
49921 <primary>virus scanners</primary>
49922 <secondary>command line interface</secondary>
49924 This is the keyword for the generic command line scanner interface. It can be
49925 used to attach virus scanners that are invoked from the shell. This scanner
49926 type takes 3 mandatory options:
49928 <orderedlist numeration="arabic">
49931 The full path and name of the scanner binary, with all command line options,
49932 and a placeholder (<literal>%s</literal>) for the directory to scan.
49937 A regular expression to match against the STDOUT and STDERR output of the
49938 virus scanner. If the expression matches, a virus was found. You must make
49939 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
49940 the <quote>trigger</quote> expression.
49945 Another regular expression, containing exactly one pair of parentheses, to
49946 match the name of the virus found in the scanners output. This is called the
49947 <quote>name</quote> expression.
49952 For example, Sophos Sweep reports a virus on a line like this:
49954 <literallayout class="monospaced">
49955 Virus 'W32/Magistr-B' found in file ./those.bat
49958 For the trigger expression, we can just match the word <quote>found</quote>. For the name
49959 expression, we want to extract the W32/Magistr-B string, so we can match for
49960 the single quotes left and right of it. Altogether, this makes the
49961 configuration setting:
49963 <literallayout class="monospaced">
49964 av_scanner = cmdline:\
49965 /path/to/sweep -all -rec -archive %s:\
49968 </listitem></varlistentry>
49970 <term><option>drweb</option></term>
49973 <indexterm role="concept">
49974 <primary>virus scanners</primary>
49975 <secondary>DrWeb</secondary>
49977 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface takes one
49978 argument, either a full path to a UNIX socket, or an IP address and port
49979 separated by white space, as in these examples:
49981 <literallayout class="monospaced">
49982 av_scanner = drweb:/var/run/drwebd.sock
49983 av_scanner = drweb:192.168.2.20 31337
49986 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
49987 is used. Thanks to Alex Miller for contributing the code for this scanner.
49989 </listitem></varlistentry>
49991 <term><option>fsecure</option></term>
49994 <indexterm role="concept">
49995 <primary>virus scanners</primary>
49996 <secondary>F-Secure</secondary>
49998 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
49999 argument which is the path to a UNIX socket. For example:
50001 <literallayout class="monospaced">
50002 av_scanner = fsecure:/path/to/.fsav
50005 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
50006 Thelmen for contributing the code for this scanner.
50008 </listitem></varlistentry>
50010 <term><option>kavdaemon</option></term>
50013 <indexterm role="concept">
50014 <primary>virus scanners</primary>
50015 <secondary>Kaspersky</secondary>
50017 This is the scanner daemon of Kaspersky Version 4. This version of the
50018 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
50019 scanner type takes one option, which is the path to the daemon’s UNIX socket.
50022 <literallayout class="monospaced">
50023 av_scanner = kavdaemon:/opt/AVP/AvpCtl
50026 The default path is <filename>/var/run/AvpCtl</filename>.
50028 </listitem></varlistentry>
50030 <term><option>mksd</option></term>
50033 <indexterm role="concept">
50034 <primary>virus scanners</primary>
50035 <secondary>mksd</secondary>
50037 This is a daemon type scanner that is aimed mainly at Polish users, though some
50038 parts of documentation are now available in English. You can get it at
50039 <emphasis role="bold"><ulink url="http://linux.mks.com.pl/">http://linux.mks.com.pl/</ulink></emphasis>. The only option for this scanner type is
50040 the maximum number of processes used simultaneously to scan the attachments,
50041 provided that the demime facility is employed and also provided that mksd has
50042 been run with at least the same number of child processes. For example:
50044 <literallayout class="monospaced">
50045 av_scanner = mksd:2
50048 You can safely omit this option (the default value is 1).
50050 </listitem></varlistentry>
50052 <term><option>sophie</option></term>
50054 <para revisionflag="changed">
50055 <indexterm role="concept">
50056 <primary>virus scanners</primary>
50057 <secondary>Sophos and Sophie</secondary>
50059 Sophie is a daemon that uses Sophos’ <option>libsavi</option> library to scan for viruses.
50060 You can get Sophie at <emphasis role="bold"><ulink url="http://www.clanfield.info/sophie/">http://www.clanfield.info/sophie/</ulink></emphasis>. The only option
50061 for this scanner type is the path to the UNIX socket that Sophie uses for
50062 client communication. For example:
50064 <literallayout class="monospaced">
50065 av_scanner = sophie:/tmp/sophie
50068 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
50071 </listitem></varlistentry>
50074 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
50075 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
50079 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
50080 makes it possible to use different scanners. See further below for an example.
50081 The <option>malware</option> condition caches its results, so when you use it multiple times
50082 for the same message, the actual scanning process is only carried out once.
50083 However, using expandable items in <option>av_scanner</option> disables this caching, in
50084 which case each use of the <option>malware</option> condition causes a new scan of the
50088 The <option>malware</option> condition takes a right-hand argument that is expanded before
50089 use. It can then be one of
50094 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
50095 The condition succeeds if a virus was found, and fail otherwise. This is the
50100 <para revisionflag="changed">
50101 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
50102 the condition fails immediately.
50107 A regular expression, in which case the message is scanned for viruses. The
50108 condition succeeds if a virus is found and its name matches the regular
50109 expression. This allows you to take special actions on certain types of virus.
50113 <para revisionflag="changed">
50114 You can append <literal>/defer_ok</literal> to the <option>malware</option> condition to accept messages
50115 even if there is a problem with the virus scanner. Otherwise, such a problem
50116 causes the ACL to defer.
50119 <indexterm role="concept">
50120 <primary><varname>$malware_name</varname></primary>
50122 When a virus is found, the condition sets up an expansion variable called
50123 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
50124 <option>message</option> modifier that specifies the error returned to the sender, and/or in
50128 If your virus scanner cannot unpack MIME and TNEF containers itself, you should
50129 use the <option>demime</option> condition (see section <xref linkend="SECTdemimecond"/>) before the
50130 <option>malware</option> condition.
50133 Here is a very simple scanning example:
50135 <literallayout class="monospaced">
50136 deny message = This message contains malware ($malware_name)
50141 The next example accepts messages when there is a problem with the scanner:
50143 <literallayout class="monospaced">
50144 deny message = This message contains malware ($malware_name)
50146 malware = */defer_ok
50149 The next example shows how to use an ACL variable to scan with both sophie and
50150 aveserver. It assumes you have set:
50152 <literallayout class="monospaced">
50153 av_scanner = $acl_m0
50156 in the main Exim configuration.
50158 <literallayout class="monospaced">
50159 deny message = This message contains malware ($malware_name)
50160 set acl_m0 = sophie
50163 deny message = This message contains malware ($malware_name)
50164 set acl_m0 = aveserver
50168 <section id="SECTscanspamass">
50169 <title>Scanning with SpamAssassin</title>
50171 <indexterm role="concept">
50172 <primary>content scanning</primary>
50173 <secondary>for spam</secondary>
50175 <indexterm role="concept">
50176 <primary>spam scanning</primary>
50178 <indexterm role="concept">
50179 <primary>SpamAssassin</primary>
50180 <secondary>scanning with</secondary>
50182 The <option>spam</option> ACL condition calls SpamAssassin’s <option>spamd</option> daemon to get a spam
50183 score and a report for the message. You can get SpamAssassin at
50184 <emphasis role="bold"><ulink url="http://www.spamassassin.org">http://www.spamassassin.org</ulink></emphasis>, or, if you have a working Perl
50185 installation, you can use CPAN by running:
50187 <literallayout class="monospaced">
50188 perl -MCPAN -e 'install Mail::SpamAssassin'
50191 SpamAssassin has its own set of configuration files. Please review its
50192 documentation to see how you can tweak it. The default installation should work
50196 <indexterm role="concept">
50197 <primary><option>spamd_address</option></primary>
50199 After having installed and configured SpamAssassin, start the <option>spamd</option> daemon.
50200 By default, it listens on 127.0.0.1, TCP port 783. If you use another host or
50201 port for <option>spamd</option>, you must set the <option>spamd_address</option> option in the global
50202 part of the Exim configuration as follows (example):
50204 <literallayout class="monospaced">
50205 spamd_address = 192.168.99.45 387
50208 You do not need to set this option if you use the default. As of version 2.60,
50209 <option>spamd</option> also supports communication over UNIX sockets. If you want to use
50210 these, supply <option>spamd_address</option> with an absolute file name instead of a
50213 <literallayout class="monospaced">
50214 spamd_address = /var/run/spamd_socket
50217 You can have multiple <option>spamd</option> servers to improve scalability. These can
50218 reside on other hardware reachable over the network. To specify multiple
50219 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
50220 option, separated with colons:
50222 <literallayout class="monospaced">
50223 spamd_address = 192.168.2.10 783 : \
50224 192.168.2.11 783 : \
50228 Up to 32 <option>spamd</option> servers are supported. The servers are queried in a random
50229 fashion. When a server fails to respond to the connection attempt, all other
50230 servers are tried until one succeeds. If no server responds, the <option>spam</option>
50234 <emphasis role="bold">Warning</emphasis>: It is not possible to use the UNIX socket connection method with
50235 multiple <option>spamd</option> servers.
50239 <title>Calling SpamAssassin from an Exim ACL</title>
50241 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
50243 <literallayout class="monospaced">
50244 deny message = This message was classified as SPAM
50248 The right-hand side of the <option>spam</option> condition specifies the username that
50249 SpamAssassin should scan for. If you do not want to scan for a particular user,
50250 but rather use the SpamAssassin system-wide default profile, you can scan for
50251 an unknown user, or simply use <quote>nobody</quote>. However, you must put something on
50252 the right-hand side.
50255 The username allows you to use per-domain or per-user antispam profiles. The
50256 right-hand side is expanded before being used, so you can put lookups or
50257 conditions there. When the right-hand side evaluates to <quote>0</quote> or <quote>false</quote>, no
50258 scanning is done and the condition fails immediately.
50261 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
50262 large ones may cause significant performance degredation. As most spam messages
50263 are quite small, it is recommended that you do not scan the big ones. For
50266 <literallayout class="monospaced">
50267 deny message = This message was classified as SPAM
50268 condition = ${if < {$message_size}{10K}}
50272 The <option>spam</option> condition returns true if the threshold specified in the user’s
50273 SpamAssassin profile has been matched or exceeded. If you want to use the
50274 <option>spam</option> condition for its side effects (see the variables below), you can make
50275 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
50278 <indexterm role="concept">
50279 <primary>spam scanning</primary>
50280 <secondary>returned variables</secondary>
50282 When the <option>spam</option> condition is run, it sets up a number of expansion
50283 variables. With the exception of <varname>$spam_score_int</varname>, these are usable only
50284 within ACLs; their values are not retained with the message and so cannot be
50285 used at delivery time.
50289 <term><varname>$spam_score</varname></term>
50292 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
50293 for inclusion in log or reject messages.
50295 </listitem></varlistentry>
50297 <term><varname>$spam_score_int</varname></term>
50300 The spam score of the message, multiplied by ten, as an integer value. For
50301 example <quote>34</quote> or <quote>305</quote>. This is useful for numeric comparisons in
50302 conditions. This variable is special; its value is saved with the message, and
50303 written to Exim’s spool file. This means that it can be used during the whole
50304 life of the message on your Exim system, in particular, in routers or
50305 transports during the later delivery phase.
50307 </listitem></varlistentry>
50309 <term><varname>$spam_bar</varname></term>
50312 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
50313 integer part of the spam score value. A spam score of 4.4 would have a
50314 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
50315 headers, since MUAs can match on such strings.
50317 </listitem></varlistentry>
50319 <term><varname>$spam_report</varname></term>
50322 A multiline text table, containing the full SpamAssassin report for the
50323 message. Useful for inclusion in headers or reject messages.
50325 </listitem></varlistentry>
50328 The <option>spam</option> condition caches its results. If you call it again with the same
50329 user name, it does not scan again, but rather returns the same values as
50333 The <option>spam</option> condition returns DEFER if there is any error while running the
50334 message through SpamAssassin. If you want to treat DEFER as FAIL (to pass on to
50335 the next ACL statement block), append <literal>/defer_ok</literal> to the right-hand side of
50336 the spam condition, like this:
50338 <literallayout class="monospaced">
50339 deny message = This message was classified as SPAM
50340 spam = joe/defer_ok
50343 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
50346 Here is a longer, commented example of the use of the <option>spam</option>
50349 <literallayout class="monospaced" revisionflag="changed">
50350 # put headers in all messages (no matter if spam or not)
50351 warn spam = nobody:true
50352 add_header = X-Spam-Score: $spam_score ($spam_bar)
50353 add_header = X-Spam-Report: $spam_report
50355 # add second subject line with *SPAM* marker when message
50356 # is over threshold
50358 add_header = Subject: *SPAM* $h_Subject:
50360 # reject spam at high scores (> 12)
50361 deny message = This message scored $spam_score spam points.
50363 condition = ${if >{$spam_score_int}{120}{1}{0}}
50366 <section id="SECTscanmimepart">
50367 <title>Scanning MIME parts</title>
50369 <indexterm role="concept">
50370 <primary>content scanning</primary>
50371 <secondary>MIME parts</secondary>
50373 <indexterm role="concept">
50374 <primary>MIME content scanning</primary>
50376 <indexterm role="concept">
50377 <primary><option>acl_smtp_mime</option></primary>
50379 <indexterm role="concept">
50380 <primary><option>acl_not_smtp_mime</option></primary>
50382 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
50383 each MIME part of an SMTP message, including multipart types, in the sequence
50384 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
50385 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
50386 options may both refer to the same ACL if you want the same processing in both
50390 <phrase revisionflag="changed">These ACLs are called (possibly many times) just before the
50391 <option>acl_smtp_data</option> ACL in the case of an SMTP message, or just before the
50392 <option>acl_not_smtp</option> ACL in the case of a non-SMTP message.</phrase> However, a MIME ACL
50393 is called only if the message contains a <emphasis>MIME-Version:</emphasis> header line. When a
50394 call to a MIME ACL does not yield <quote>accept</quote>, ACL processing is aborted and the
50395 appropriate result code is sent to the client. In the case of an SMTP message,
50396 the <option>acl_smtp_data</option> ACL is not called when this happens.
50399 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
50400 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
50401 condition to match against the raw MIME part. You can also use the
50402 <option>mime_regex</option> condition to match against the decoded MIME part (see section
50403 <xref linkend="SECTscanregex"/>).
50406 At the start of a MIME ACL, a number of variables are set from the header
50407 information for the relevant MIME part. These are described below. The contents
50408 of the MIME part are not by default decoded into a disk file except for MIME
50409 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
50410 part into a disk file, you can use the <option>decode</option> modifier. The general syntax
50414 <literal>decode = [/</literal><<emphasis>path</emphasis>><literal>/]</literal><<emphasis>filename</emphasis>>
50417 The right hand side is expanded before use. After expansion,
50420 <orderedlist numeration="arabic">
50423 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
50428 The string <quote>default</quote>. In that case, the file is put in the temporary
50429 <quote>default</quote> directory <<emphasis>spool_directory</emphasis>><filename>/scan/</filename><<emphasis>message_id</emphasis>><filename>/</filename> with
50430 a sequential file name consisting of the message id and a sequence number. The
50431 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
50436 A full path name starting with a slash. If the full name is an existing
50437 directory, it is used as a replacement for the default directory. The filename
50438 is then sequentially assigned. If the path does not exist, it is used as
50439 the full path and file name.
50444 If the string does not start with a slash, it is used as the
50445 filename, and the default path is then used.
50450 You can easily decode a file with its original, proposed filename using
50452 <literallayout class="monospaced">
50453 decode = $mime_filename
50456 However, you should keep in mind that <varname>$mime_filename</varname> might contain
50457 anything. If you place files outside of the default path, they are not
50458 automatically unlinked.
50461 For RFC822 attachments (these are messages attached to messages, with a
50462 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
50463 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
50464 variable is set (see below). Attached messages are always decoded to disk
50465 before being checked, and the files are unlinked once the check is done.
50468 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
50469 used to match regular expressions against raw and decoded MIME parts,
50470 respectively. They are described in section <xref linkend="SECTscanregex"/>.
50473 <indexterm role="concept">
50474 <primary>MIME content scanning</primary>
50475 <secondary>returned variables</secondary>
50477 The following list describes all expansion variables that are
50478 available in the MIME ACL:
50482 <term><varname>$mime_boundary</varname></term>
50485 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
50486 have a boundary string, which is stored in this variable. If the current part
50487 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
50488 contains the empty string.
50490 </listitem></varlistentry>
50492 <term><varname>$mime_charset</varname></term>
50495 This variable contains the character set identifier, if one was found in the
50496 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
50498 <literallayout class="monospaced">
50504 Please note that this value is not normalized, so you should do matches
50505 case-insensitively.
50507 </listitem></varlistentry>
50509 <term><varname>$mime_content_description</varname></term>
50512 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
50513 header. It can contain a human-readable description of the parts content. Some
50514 implementations repeat the filename for attachments here, but they are usually
50515 only used for display purposes.
50517 </listitem></varlistentry>
50519 <term><varname>$mime_content_disposition</varname></term>
50522 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
50523 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
50525 </listitem></varlistentry>
50527 <term><varname>$mime_content_id</varname></term>
50530 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
50531 This is a unique ID that can be used to reference a part from another part.
50533 </listitem></varlistentry>
50535 <term><varname>$mime_content_size</varname></term>
50538 This variable is set only after the <option>decode</option> modifier (see above) has been
50539 successfully run. It contains the size of the decoded part in kilobytes. The
50540 size is always rounded up to full kilobytes, so only a completely empty part
50541 has a <varname>$mime_content_size</varname> of zero.
50543 </listitem></varlistentry>
50545 <term><varname>$mime_content_transfer_encoding</varname></term>
50548 This variable contains the normalized content of the
50549 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
50550 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
50552 </listitem></varlistentry>
50554 <term><varname>$mime_content_type</varname></term>
50557 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
50558 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
50559 are some examples of popular MIME types, as they may appear in this variable:
50561 <literallayout class="monospaced">
50564 application/octet-stream
50569 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
50572 </listitem></varlistentry>
50574 <term><varname>$mime_decoded_filename</varname></term>
50577 This variable is set only after the <option>decode</option> modifier (see above) has been
50578 successfully run. It contains the full path and file name of the file
50579 containing the decoded data.
50581 </listitem></varlistentry>
50584 <indexterm role="concept">
50585 <primary>RFC 2047</primary>
50590 <term><varname>$mime_filename</varname></term>
50593 This is perhaps the most important of the MIME variables. It contains a
50594 proposed filename for an attachment, if one was found in either the
50595 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
50596 RFC2047 decoded, but no additional sanity checks are done. If no filename was
50597 found, this variable contains the empty string.
50599 </listitem></varlistentry>
50601 <term><varname>$mime_is_coverletter</varname></term>
50604 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
50605 attached data. It can be used to clamp down on flashy or unneccessarily encoded
50606 content in the cover letter, while not restricting attachments at all.
50609 The variable contains 1 (true) for a MIME part believed to be part of the
50610 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
50613 <orderedlist numeration="arabic">
50616 The outermost MIME part of a message is always a cover letter.
50621 If a multipart/alternative or multipart/related MIME part is a cover letter,
50622 so are all MIME subparts within that multipart.
50627 If any other multipart is a cover letter, the first subpart is a cover letter,
50628 and the rest are attachments.
50633 All parts contained within an attachment multipart are attachments.
50638 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
50639 alternative plain text), while allowing HTML files to be attached. HTML
50640 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
50642 <literallayout class="monospaced">
50643 deny message = HTML mail is not accepted here
50644 !condition = $mime_is_rfc822
50645 condition = $mime_is_coverletter
50646 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
50648 </listitem></varlistentry>
50650 <term><varname>$mime_is_multipart</varname></term>
50653 This variable has the value 1 (true) when the current part has the main type
50654 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
50655 Since multipart entities only serve as containers for other parts, you may not
50656 want to carry out specific actions on them.
50658 </listitem></varlistentry>
50660 <term><varname>$mime_is_rfc822</varname></term>
50663 This variable has the value 1 (true) if the current part is not a part of the
50664 checked message itself, but part of an attached message. Attached message
50665 decoding is fully recursive.
50667 </listitem></varlistentry>
50669 <term><varname>$mime_part_count</varname></term>
50672 This variable is a counter that is raised for each processed MIME part. It
50673 starts at zero for the very first part (which is usually a multipart). The
50674 counter is per-message, so it is reset when processing RFC822 attachments (see
50675 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
50676 complete, so you can use it in the DATA ACL to determine the number of MIME
50677 parts of a message. For non-MIME messages, this variable contains the value -1.
50679 </listitem></varlistentry>
50682 <section id="SECTscanregex">
50683 <title>Scanning with regular expressions</title>
50685 <indexterm role="concept">
50686 <primary>content scanning</primary>
50687 <secondary>with regular expressions</secondary>
50689 <indexterm role="concept">
50690 <primary>regular expressions</primary>
50691 <secondary>content scanning with</secondary>
50693 You can specify your own custom regular expression matches on the full body of
50694 the message, or on individual MIME parts.
50697 The <option>regex</option> condition takes one or more regular expressions as arguments and
50698 matches them against the full message (when called in the DATA ACL) or a raw
50699 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
50700 linewise, with a maximum line length of 32K characters. That means you cannot
50701 have multiline matches with the <option>regex</option> condition.
50704 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
50705 to 32K of decoded content (the whole content at once, not linewise). If the
50706 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
50707 is decoded automatically when <option>mime_regex</option> is executed (using default path
50708 and filename values). If the decoded data is larger than 32K, only the first
50709 32K characters are checked.
50712 The regular expressions are passed as a colon-separated list. To include a
50713 literal colon, you must double it. Since the whole right-hand side string is
50714 expanded before being used, you must also escape dollar signs and backslashes
50715 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
50716 Here is a simple example that contains two regular expressions:
50718 <literallayout class="monospaced">
50719 deny message = contains blacklisted regex ($regex_match_string)
50720 regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
50723 The conditions returns true if any one of the regular expressions matches. The
50724 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
50725 matching regular expression.
50728 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
50732 <section id="SECTdemimecond">
50733 <title>The demime condition</title>
50735 <indexterm role="concept">
50736 <primary>content scanning</primary>
50737 <secondary>MIME checking</secondary>
50739 <indexterm role="concept">
50740 <primary>MIME content scanning</primary>
50742 The <option>demime</option> ACL condition provides MIME unpacking, sanity checking and file
50743 extension blocking. It is usable only in the DATA and non-SMTP ACLs. The
50744 <option>demime</option> condition uses a simpler interface to MIME decoding than the MIME
50745 ACL functionality, but provides no additional facilities. Please note that this
50746 condition is deprecated and kept only for backward compatibility. You must set
50747 the WITH_OLD_DEMIME option in <filename>Local/Makefile</filename> at build time to be able to
50748 use the <option>demime</option> condition.
50751 The <option>demime</option> condition unpacks MIME containers in the message. It detects
50752 errors in MIME containers and can match file extensions found in the message
50753 against a list. Using this facility produces files containing the unpacked MIME
50754 parts of the message in the temporary scan directory. If you do antivirus
50755 scanning, it is recommened that you use the <option>demime</option> condition before the
50756 antivirus (<option>malware</option>) condition.
50759 On the right-hand side of the <option>demime</option> condition you can pass a
50760 colon-separated list of file extensions that it should match against. For
50763 <literallayout class="monospaced">
50764 deny message = Found blacklisted file attachment
50765 demime = vbs:com:bat:pif:prf:lnk
50768 If one of the file extensions is found, the condition is true, otherwise it is
50769 false. If there is a temporary error while demimeing (for example, <quote>disk
50770 full</quote>), the condition defers, and the message is temporarily rejected (unless
50771 the condition is on a <option>warn</option> verb).
50774 The right-hand side is expanded before being treated as a list, so you can have
50775 conditions and lookups there. If it expands to an empty string, <quote>false</quote>, or
50776 zero (<quote>0</quote>), no demimeing is done and the condition is false.
50779 The <option>demime</option> condition set the following variables:
50783 <term><varname>$demime_errorlevel</varname></term>
50786 <indexterm role="concept">
50787 <primary><varname>$demime_errorlevel</varname></primary>
50789 When an error is detected in a MIME container, this variable contains the
50790 severity of the error, as an integer number. The higher the value, the more
50791 severe the error (the current maximum value is 3). If this variable is unset or
50792 zero, no error occurred.
50794 </listitem></varlistentry>
50796 <term><varname>$demime_reason</varname></term>
50799 <indexterm role="concept">
50800 <primary><varname>$demime_reason</varname></primary>
50802 When <varname>$demime_errorlevel</varname> is greater than zero, this variable contains a
50803 human-readable text string describing the MIME error that occurred.
50805 </listitem></varlistentry>
50809 <term><varname>$found_extension</varname></term>
50812 <indexterm role="concept">
50813 <primary><varname>$found_extension</varname></primary>
50815 When the <option>demime</option> condition is true, this variable contains the file
50816 extension it found.
50818 </listitem></varlistentry>
50821 Both <varname>$demime_errorlevel</varname> and <varname>$demime_reason</varname> are set by the first call of
50822 the <option>demime</option> condition, and are not changed on subsequent calls.
50825 If you do not want to check for file extensions, but rather use the <option>demime</option>
50826 condition for unpacking or error checking purposes, pass <quote>*</quote> as the
50827 right-hand side value. Here is a more elaborate example of how to use this
50830 <literallayout class="monospaced">
50831 # Reject messages with serious MIME container errors
50832 deny message = Found MIME error ($demime_reason).
50834 condition = ${if >{$demime_errorlevel}{2}{1}{0}}
50836 # Reject known virus spreading file extensions.
50837 # Accepting these is pretty much braindead.
50838 deny message = contains $found_extension file (blacklisted).
50839 demime = com:vbs:bat:pif:scr
50841 # Freeze .exe and .doc files. Postmaster can
50842 # examine them and eventually thaw them.
50843 deny log_message = Another $found_extension file.
50848 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
50853 <chapter id="CHAPlocalscan">
50854 <title>Adding a local scan function to Exim</title>
50855 <titleabbrev>Local scan function</titleabbrev>
50857 <indexterm role="concept" id="IIDlosca" class="startofrange">
50858 <primary><function>local_scan()</function> function</primary>
50859 <secondary>description of</secondary>
50861 <indexterm role="concept">
50862 <primary>customizing</primary>
50863 <secondary>input scan using C function</secondary>
50865 <indexterm role="concept">
50866 <primary>policy control</primary>
50867 <secondary>by local scan function</secondary>
50869 In these days of email worms, viruses, and ever-increasing spam, some sites
50870 want to apply a lot of checking to messages before accepting them.
50873 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
50874 passing messages to external virus and spam scanning software. You can also do
50875 a certain amount in Exim itself through string expansions and the <option>condition</option>
50876 condition in the ACL that runs after the SMTP DATA command or the ACL for
50877 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
50880 To allow for further customization to a site’s own requirements, there is the
50881 possibility of linking Exim with a private message scanning function, written
50882 in C. If you want to run code that is written in something other than C, you
50883 can of course use a little C stub to call it.
50886 The local scan function is run once for every incoming message, at the point
50887 when Exim is just about to accept the message.
50888 It can therefore be used to control non-SMTP messages from local processes as
50889 well as messages arriving via SMTP.
50892 Exim applies a timeout to calls of the local scan function, and there is an
50893 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
50894 Zero means <quote>no timeout</quote>.
50895 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
50896 before calling the local scan function, so that the most common types of crash
50897 are caught. If the timeout is exceeded or one of those signals is caught, the
50898 incoming message is rejected with a temporary error if it is an SMTP message.
50899 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
50900 code. The incident is logged on the main and reject logs.
50903 <title>Building Exim to use a local scan function</title>
50905 <indexterm role="concept">
50906 <primary><function>local_scan()</function> function</primary>
50907 <secondary>building Exim to use</secondary>
50909 To make use of the local scan function feature, you must tell Exim where your
50910 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
50911 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
50912 directory, so you might set
50914 <literallayout class="monospaced">
50915 LOCAL_SCAN_SOURCE=Local/local_scan.c
50918 for example. The function must be called <function>local_scan()</function>. It is called by
50919 Exim after it has received a message, when the success return code is about to
50920 be sent. This is after all the ACLs have been run. The return code from your
50921 function controls whether the message is actually accepted or not. There is a
50922 commented template function (that just accepts the message) in the file
50923 _src/local_scan.c_.
50926 If you want to make use of Exim’s run time configuration file to set options
50927 for your <function>local_scan()</function> function, you must also set
50929 <literallayout class="monospaced">
50930 LOCAL_SCAN_HAS_OPTIONS=yes
50933 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
50936 <section id="SECTapiforloc">
50937 <title>API for local_scan()</title>
50939 <indexterm role="concept">
50940 <primary><function>local_scan()</function> function</primary>
50941 <secondary>API description</secondary>
50943 You must include this line near the start of your code:
50945 <literallayout class="monospaced">
50946 #include "local_scan.h"
50949 This header file defines a number of variables and other values, and the
50950 prototype for the function itself. Exim is coded to use unsigned char values
50951 almost exclusively, and one of the things this header defines is a shorthand
50952 for <literal>unsigned char</literal> called <literal>uschar</literal>.
50953 It also contains the following macro definitions, to simplify casting character
50954 strings and pointers to character strings:
50956 <literallayout class="monospaced">
50957 #define CS (char *)
50958 #define CCS (const char *)
50959 #define CSS (char **)
50960 #define US (unsigned char *)
50961 #define CUS (const unsigned char *)
50962 #define USS (unsigned char **)
50965 The function prototype for <function>local_scan()</function> is:
50967 <literallayout class="monospaced">
50968 extern int local_scan(int fd, uschar **return_text);
50971 The arguments are as follows:
50976 <option>fd</option> is a file descriptor for the file that contains the body of the message
50977 (the -D file). The file is open for reading and writing, but updating it is not
50978 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
50981 The descriptor is positioned at character 19 of the file, which is the first
50982 character of the body itself, because the first 19 characters are the message
50983 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
50984 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
50985 case this changes in some future version.
50990 <option>return_text</option> is an address which you can use to return a pointer to a text
50991 string at the end of the function. The value it points to on entry is NULL.
50996 The function must return an <option>int</option> value which is one of the following macros:
51000 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
51003 <indexterm role="concept">
51004 <primary><varname>$local_scan_data</varname></primary>
51006 The message is accepted. If you pass back a string of text, it is saved with
51007 the message, and made available in the variable <varname>$local_scan_data</varname>. No
51008 newlines are permitted (if there are any, they are turned into spaces) and the
51009 maximum length of text is 1000 characters.
51011 </listitem></varlistentry>
51013 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
51016 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
51017 queued without immediate delivery, and is frozen.
51019 </listitem></varlistentry>
51021 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
51024 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
51025 queued without immediate delivery.
51027 </listitem></varlistentry>
51029 <term><literal>LOCAL_SCAN_REJECT</literal></term>
51032 The message is rejected; the returned text is used as an error message which is
51033 passed back to the sender and which is also logged. Newlines are permitted –
51034 they cause a multiline response for SMTP rejections, but are converted to
51035 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
51038 </listitem></varlistentry>
51040 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
51043 The message is temporarily rejected; the returned text is used as an error
51044 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
51045 problem</quote> is used.
51047 </listitem></varlistentry>
51049 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
51052 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
51053 message is not written to the reject log. It has the effect of unsetting the
51054 <option>rejected_header</option> log selector for just this rejection. If
51055 <option>rejected_header</option> is already unset (see the discussion of the
51056 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
51057 same as LOCAL_SCAN_REJECT.
51059 </listitem></varlistentry>
51061 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
51064 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
51065 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
51067 </listitem></varlistentry>
51070 If the message is not being received by interactive SMTP, rejections are
51071 reported by writing to <option>stderr</option> or by sending an email, as configured by the
51072 <option>-oe</option> command line options.
51075 <section id="SECTconoptloc">
51076 <title>Configuration options for local_scan()</title>
51078 <indexterm role="concept">
51079 <primary><function>local_scan()</function> function</primary>
51080 <secondary>configuration options</secondary>
51082 It is possible to have option settings in the main configuration file
51083 that set values in static variables in the <function>local_scan()</function> module. If you
51084 want to do this, you must have the line
51086 <literallayout class="monospaced">
51087 LOCAL_SCAN_HAS_OPTIONS=yes
51090 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
51091 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
51092 file, you must define static variables to hold the option values, and a table
51096 The table must be a vector called <option>local_scan_options</option>, of type
51097 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
51098 and a pointer to the variable that holds the value. The entries must appear in
51099 alphabetical order. Following <option>local_scan_options</option> you must also define a
51100 variable called <option>local_scan_options_count</option> that contains the number of
51101 entries in the table. Here is a short example, showing two kinds of option:
51103 <literallayout class="monospaced">
51104 static int my_integer_option = 42;
51105 static uschar *my_string_option = US"a default string";
51107 optionlist local_scan_options[] = {
51108 { "my_integer", opt_int, &my_integer_option },
51109 { "my_string", opt_stringptr, &my_string_option }
51112 int local_scan_options_count =
51113 sizeof(local_scan_options)/sizeof(optionlist);
51116 The values of the variables can now be changed from Exim’s runtime
51117 configuration file by including a local scan section as in this example:
51119 <literallayout class="monospaced">
51122 my_string = some string of text...
51125 The available types of option data are as follows:
51129 <term><emphasis role="bold">opt_bool</emphasis></term>
51132 This specifies a boolean (true/false) option. The address should point to a
51133 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
51134 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
51135 whether such a variable has been set at all, you can initialize it to
51136 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
51139 </listitem></varlistentry>
51141 <term><emphasis role="bold">opt_fixed</emphasis></term>
51144 This specifies a fixed point number, such as is used for load averages.
51145 The address should point to a variable of type <literal>int</literal>. The value is stored
51146 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
51148 </listitem></varlistentry>
51150 <term><emphasis role="bold">opt_int</emphasis></term>
51153 This specifies an integer; the address should point to a variable of type
51154 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
51157 </listitem></varlistentry>
51159 <term><emphasis role="bold">opt_mkint</emphasis></term>
51162 This is the same as <option>opt_int</option>, except that when such a value is output in a
51163 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
51164 printed with the suffix K or M.
51166 </listitem></varlistentry>
51168 <term><emphasis role="bold">opt_octint</emphasis></term>
51171 This also specifies an integer, but the value is always interpeted as an
51172 octal integer, whether or not it starts with the digit zero, and it is
51173 always output in octal.
51175 </listitem></varlistentry>
51177 <term><emphasis role="bold">opt_stringptr</emphasis></term>
51180 This specifies a string value; the address must be a pointer to a
51181 variable that points to a string (for example, of type <literal>uschar *</literal>).
51183 </listitem></varlistentry>
51185 <term><emphasis role="bold">opt_time</emphasis></term>
51188 This specifies a time interval value. The address must point to a variable of
51189 type <literal>int</literal>. The value that is placed there is a number of seconds.
51191 </listitem></varlistentry>
51194 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
51195 out the values of all the <function>local_scan()</function> options.
51199 <title>Available Exim variables</title>
51201 <indexterm role="concept">
51202 <primary><function>local_scan()</function> function</primary>
51203 <secondary>available Exim variables</secondary>
51205 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
51206 are the only ones that are guaranteed to be maintained from release to release.
51207 Note, however, that you can obtain the value of any Exim variable by calling
51208 <emphasis>expand_string()</emphasis>. The exported variables are as follows:
51212 <term><emphasis role="bold">unsigned int debug_selector</emphasis></term>
51215 This variable is set to zero when no debugging is taking place. Otherwise, it
51216 is a bitmap of debugging selectors. Two bits are identified for use in
51217 <function>local_scan()</function>; they are defined as macros:
51222 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
51223 testing option that is not privileged – any caller may set it. All the
51224 other selector bits can be set only by admin users.
51229 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
51230 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
51236 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
51237 selected, you should use code like this:
51239 <literallayout class="monospaced">
51240 if ((debug_selector & D_local_scan) != 0)
51241 debug_printf("xxx", ...);
51243 </listitem></varlistentry>
51245 <term><emphasis role="bold">uschar *expand_string_message</emphasis></term>
51248 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
51249 variable <option>expand_string_message</option> contains the error message, zero-terminated.
51251 </listitem></varlistentry>
51253 <term><emphasis role="bold">header_line *header_list</emphasis></term>
51256 A pointer to a chain of header lines. The <option>header_line</option> structure is
51259 </listitem></varlistentry>
51261 <term><emphasis role="bold">header_line *header_last</emphasis></term>
51264 A pointer to the last of the header lines.
51266 </listitem></varlistentry>
51268 <term><emphasis role="bold">uschar *headers_charset</emphasis></term>
51271 The value of the <option>headers_charset</option> configuration option.
51273 </listitem></varlistentry>
51275 <term><emphasis role="bold">BOOL host_checking</emphasis></term>
51278 This variable is TRUE during a host checking session that is initiated by the
51279 <option>-bh</option> command line option.
51281 </listitem></varlistentry>
51283 <term><emphasis role="bold">uschar *interface_address</emphasis></term>
51286 The IP address of the interface that received the message, as a string. This
51287 is NULL for locally submitted messages.
51289 </listitem></varlistentry>
51291 <term><emphasis role="bold">int interface_port</emphasis></term>
51294 The port on which this message was received.
51296 </listitem></varlistentry>
51298 <term><emphasis role="bold">uschar *message_id</emphasis></term>
51301 This variable contains Exim’s message id for the incoming message (the value of
51302 <varname>$message_exim_id</varname>) as a zero-terminated string.
51304 </listitem></varlistentry>
51306 <term><emphasis role="bold">uschar *received_protocol</emphasis></term>
51309 The name of the protocol by which the message was received.
51311 </listitem></varlistentry>
51313 <term><emphasis role="bold">int recipients_count</emphasis></term>
51316 The number of accepted recipients.
51318 </listitem></varlistentry>
51320 <term><emphasis role="bold">recipient_item *recipients_list</emphasis></term>
51323 <indexterm role="concept">
51324 <primary>recipient</primary>
51325 <secondary>adding in local scan</secondary>
51327 <indexterm role="concept">
51328 <primary>recipient</primary>
51329 <secondary>removing in local scan</secondary>
51331 The list of accepted recipients, held in a vector of length
51332 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
51333 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
51334 below). You can delete recipients by removing them from the vector and adusting
51335 the value in <option>recipients_count</option>. In particular, by setting
51336 <option>recipients_count</option> to zero you remove all recipients. If you then return the
51337 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
51338 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
51339 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
51341 </listitem></varlistentry>
51343 <term><emphasis role="bold">uschar *sender_address</emphasis></term>
51346 The envelope sender address. For bounce messages this is the empty string.
51348 </listitem></varlistentry>
51350 <term><emphasis role="bold">uschar *sender_host_address</emphasis></term>
51353 The IP address of the sending host, as a string. This is NULL for
51354 locally-submitted messages.
51356 </listitem></varlistentry>
51358 <term><emphasis role="bold">uschar *sender_host_authenticated</emphasis></term>
51361 The name of the authentication mechanism that was used, or NULL if the message
51362 was not received over an authenticated SMTP connection.
51364 </listitem></varlistentry>
51366 <term><emphasis role="bold">uschar *sender_host_name</emphasis></term>
51369 The name of the sending host, if known.
51371 </listitem></varlistentry>
51373 <term><emphasis role="bold">int sender_host_port</emphasis></term>
51376 The port on the sending host.
51378 </listitem></varlistentry>
51380 <term><emphasis role="bold">BOOL smtp_input</emphasis></term>
51383 This variable is TRUE for all SMTP input, including BSMTP.
51385 </listitem></varlistentry>
51387 <term><emphasis role="bold">BOOL smtp_batched_input</emphasis></term>
51390 This variable is TRUE for BSMTP input.
51392 </listitem></varlistentry>
51394 <term><emphasis role="bold">int store_pool</emphasis></term>
51397 The contents of this variable control which pool of memory is used for new
51398 requests. See section <xref linkend="SECTmemhanloc"/> for details.
51400 </listitem></varlistentry>
51404 <title>Structure of header lines</title>
51406 The <option>header_line</option> structure contains the members listed below.
51407 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
51408 (see below). You can cause header lines to be ignored (deleted) by setting
51413 <term><emphasis role="bold">struct header_line *next</emphasis></term>
51416 A pointer to the next header line, or NULL for the last line.
51418 </listitem></varlistentry>
51420 <term><emphasis role="bold">int type</emphasis></term>
51423 A code identifying certain headers that Exim recognizes. The codes are printing
51424 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
51425 Notice in particular that any header line whose type is * is not transmitted
51426 with the message. This flagging is used for header lines that have been
51427 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
51428 lines.) Effectively, * means <quote>deleted</quote>.
51430 </listitem></varlistentry>
51432 <term><emphasis role="bold">int slen</emphasis></term>
51435 The number of characters in the header line, including the terminating and any
51438 </listitem></varlistentry>
51440 <term><emphasis role="bold">uschar *text</emphasis></term>
51443 A pointer to the text of the header. It always ends with a newline, followed by
51444 a zero byte. Internal newlines are preserved.
51446 </listitem></varlistentry>
51450 <title>Structure of recipient items</title>
51452 The <option>recipient_item</option> structure contains these members:
51456 <term><emphasis role="bold">uschar *address</emphasis></term>
51459 This is a pointer to the recipient address as it was received.
51461 </listitem></varlistentry>
51463 <term><emphasis role="bold">int pno</emphasis></term>
51466 This is used in later Exim processing when top level addresses are created by
51467 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
51468 and must always contain -1 at this stage.
51470 </listitem></varlistentry>
51472 <term><emphasis role="bold">uschar *errors_to</emphasis></term>
51475 If this value is not NULL, bounce messages caused by failing to deliver to the
51476 recipient are sent to the address it contains. In other words, it overrides the
51477 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
51478 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
51479 an unqualified address, Exim qualifies it using the domain from
51480 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
51481 is NULL for all recipients.
51483 </listitem></varlistentry>
51487 <title>Available Exim functions</title>
51489 <indexterm role="concept">
51490 <primary><function>local_scan()</function> function</primary>
51491 <secondary>available Exim functions</secondary>
51493 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
51494 These are the only ones that are guaranteed to be maintained from release to
51499 <term><emphasis role="bold">pid_t child_open(uschar **argv, uschar **envp, int newumask, int *infdptr, int *outfdptr, BOOL make_leader)</emphasis></term>
51502 This function creates a child process that runs the command specified by
51503 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
51504 be NULL if no environment variables are to be passed. A new umask is supplied
51505 for the process in <option>newumask</option>.
51508 Pipes to the standard input and output of the new process are set up
51509 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
51510 standard error is cloned to the standard output. If there are any file
51511 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
51512 argument is TRUE, the new process is made into a process group leader.
51515 The function returns the pid of the new process, or -1 if things go wrong.
51517 </listitem></varlistentry>
51519 <term><emphasis role="bold">int child_close(pid_t pid, int timeout)</emphasis></term>
51522 This function waits for a child process to terminate, or for a timeout (in
51523 seconds) to expire. A timeout value of zero means wait as long as it takes. The
51524 return value is as follows:
51532 The process terminated by a normal exit and the value is the process
51538 < 0 and > –256
51541 The process was terminated by a signal and the value is the negation of the
51550 The process timed out.
51558 The was some other error in wait(); <option>errno</option> is still set.
51562 </listitem></varlistentry>
51564 <term><emphasis role="bold">pid_t child_open_exim(int *fd)</emphasis></term>
51567 This function provide you with a means of submitting a new message to
51568 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
51569 want, but this packages it all up for you.) The function creates a pipe,
51570 forks a subprocess that is running
51572 <literallayout class="monospaced">
51573 exim -t -oem -oi -f <>
51576 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
51577 that is connected to the standard input. The yield of the function is the PID
51578 of the subprocess. You can then write a message to the file descriptor, with
51579 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
51582 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
51583 finish and to collect its ending status. A timeout value of zero is usually
51584 fine in this circumstance. Unless you have made a mistake with the recipient
51585 addresses, you should get a return code of zero.
51587 </listitem></varlistentry>
51589 <term><emphasis role="bold">pid_t child_open_exim2(int *fd, uschar *sender, uschar *sender_authentication)</emphasis></term>
51592 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
51596 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
51599 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
51601 </listitem></varlistentry>
51603 <term><emphasis role="bold">void debug_printf(char *, ...)</emphasis></term>
51606 This is Exim’s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
51607 output is written to the standard error stream. If no debugging is selected,
51608 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
51609 conditional on the <literal>local_scan</literal> debug selector by coding like this:
51611 <literallayout class="monospaced">
51612 if ((debug_selector & D_local_scan) != 0)
51613 debug_printf("xxx", ...);
51615 </listitem></varlistentry>
51617 <term><emphasis role="bold">uschar *expand_string(uschar *string)</emphasis></term>
51620 This is an interface to Exim’s string expansion code. The return value is the
51621 expanded string, or NULL if there was an expansion failure.
51622 The C variable <option>expand_string_message</option> contains an error message after an
51623 expansion failure. If expansion does not change the string, the return value is
51624 the pointer to the input string. Otherwise, the return value points to a new
51625 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
51626 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
51628 </listitem></varlistentry>
51630 <term><emphasis role="bold">void header_add(int type, char *format, ...)</emphasis></term>
51633 This function allows you to an add additional header line at the end of the
51634 existing ones. The first argument is the type, and should normally be a space
51635 character. The second argument is a format string and any number of
51636 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
51637 if you want, and you must ensure that the string ends with a newline.
51639 </listitem></varlistentry>
51641 <term><emphasis role="bold">void header_add_at_position(BOOL after, uschar *name, BOOL topnot, int type, char *format, ...)</emphasis></term>
51644 This function adds a new header line at a specified point in the header
51645 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
51648 If <option>name</option> is NULL, the new header is added at the end of the chain if
51649 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
51650 NULL, the header lines are searched for the first non-deleted header that
51651 matches the name. If one is found, the new header is added before it if
51652 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
51653 found header and any adjacent subsequent ones with the same name (even if
51654 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
51655 option controls where the header is added. If it is true, addition is at the
51656 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
51657 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
51659 <literallayout class="monospaced">
51660 header_add_at_position(TRUE, US"Received", TRUE,
51661 ' ', "X-xxx: ...");
51664 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
51665 there may not be if <option>received_header_text</option> expands to an empty string.
51667 </listitem></varlistentry>
51669 <term><emphasis role="bold">void header_remove(int occurrence, uschar *name)</emphasis></term>
51672 This function removes header lines. If <option>occurrence</option> is zero or negative, all
51673 occurrences of the header are removed. If occurrence is greater than zero, that
51674 particular instance of the header is removed. If no header(s) can be found that
51675 match the specification, the function does nothing.
51677 </listitem></varlistentry>
51679 <term><emphasis role="bold">BOOL header_testname(header_line *hdr, uschar *name, int length, BOOL notdel)</emphasis></term>
51682 This function tests whether the given header has the given name. It is not just
51683 a string comparison, because white space is permitted between the name and the
51684 colon. If the <option>notdel</option> argument is true, a false return is forced for all
51685 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
51687 <literallayout class="monospaced">
51688 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
51690 </listitem></varlistentry>
51692 <term><emphasis role="bold">uschar *lss_b64encode(uschar *cleartext, int length)</emphasis></term>
51695 <indexterm role="concept">
51696 <primary>base64 encoding</primary>
51697 <secondary>functions for <function>local_scan()</function> use</secondary>
51699 This function base64-encodes a string, which is passed by address and length.
51700 The text may contain bytes of any value, including zero. The result is passed
51701 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
51704 </listitem></varlistentry>
51706 <term><emphasis role="bold">int lss_b64decode(uschar *codetext, uschar **cleartext)</emphasis></term>
51709 This function decodes a base64-encoded string. Its arguments are a
51710 zero-terminated base64-encoded string and the address of a variable that is set
51711 to point to the result, which is in dynamic memory. The length of the decoded
51712 string is the yield of the function. If the input is invalid base64 data, the
51713 yield is -1. A zero byte is added to the end of the output string to make it
51714 easy to interpret as a C string (assuming it contains no zeros of its own). The
51715 added zero byte is not included in the returned count.
51717 </listitem></varlistentry>
51719 <term><emphasis role="bold">int lss_match_domain(uschar *domain, uschar *list)</emphasis></term>
51722 This function checks for a match in a domain list. Domains are always
51723 matched caselessly. The return value is one of the following:
51726 <literal>OK </literal> match succeeded
51727 <literal>FAIL </literal> match failed
51728 <literal>DEFER </literal> match deferred
51731 DEFER is usually caused by some kind of lookup defer, such as the
51732 inability to contact a database.
51734 </listitem></varlistentry>
51736 <term><emphasis role="bold">int lss_match_local_part(uschar *localpart, uschar *list, BOOL caseless)</emphasis></term>
51739 This function checks for a match in a local part list. The third argument
51740 controls case-sensitivity. The return values are as for
51741 <emphasis>lss_match_domain()</emphasis>.
51743 </listitem></varlistentry>
51745 <term><emphasis role="bold">int lss_match_address(uschar *address, uschar *list, BOOL caseless)</emphasis></term>
51748 This function checks for a match in an address list. The third argument
51749 controls the case-sensitivity of the local part match. The domain is always
51750 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
51752 </listitem></varlistentry>
51754 <term><emphasis role="bold">int lss_match_host(uschar *host_name, uschar *host_address, uschar *list)</emphasis></term>
51757 This function checks for a match in a host list. The most common usage is
51760 <literallayout class="monospaced">
51761 lss_match_host(sender_host_name, sender_host_address, ...)
51764 <indexterm role="concept">
51765 <primary><varname>$sender_host_address</varname></primary>
51767 An empty address field matches an empty item in the host list. If the host name
51768 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
51769 looked up if a host name is required to match an item in the list. The return
51770 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
51771 returns ERROR in the case when it had to look up a host name, but the lookup
51774 </listitem></varlistentry>
51776 <term><emphasis role="bold">void log_write(unsigned int selector, int which, char *format, ...)</emphasis></term>
51779 This function writes to Exim’s log files. The first argument should be zero (it
51780 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
51781 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
51782 them. It specifies to which log or logs the message is written. The remaining
51783 arguments are a format and relevant insertion arguments. The string should not
51784 contain any newlines, not even at the end.
51786 </listitem></varlistentry>
51788 <term><emphasis role="bold">void receive_add_recipient(uschar *address, int pno)</emphasis></term>
51791 This function adds an additional recipient to the message. The first argument
51792 is the recipient address. If it is unqualified (has no domain), it is qualified
51793 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
51796 This function does not allow you to specify a private <option>errors_to</option> address (as
51797 described with the structure of <option>recipient_item</option> above), because it pre-dates
51798 the addition of that field to the structure. However, it is easy to add such a
51799 value afterwards. For example:
51801 <literallayout class="monospaced">
51802 receive_add_recipient(US"monitor@mydom.example", -1);
51803 recipients_list[recipients_count-1].errors_to =
51804 US"postmaster@mydom.example";
51806 </listitem></varlistentry>
51808 <term><emphasis role="bold">BOOL receive_remove_recipient(uschar *recipient)</emphasis></term>
51811 This is a convenience function to remove a named recipient from the list of
51812 recipients. It returns true if a recipient was removed, and false if no
51813 matching recipient could be found. The argument must be a complete email
51816 </listitem></varlistentry>
51819 <indexterm role="concept">
51820 <primary>RFC 2047</primary>
51825 <term><emphasis role="bold">uschar rfc2047_decode(uschar *string, BOOL lencheck, uschar *target, int zeroval, int *lenptr, uschar **error)</emphasis></term>
51828 This function decodes strings that are encoded according to RFC 2047. Typically
51829 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
51830 from the Q or B encoding into a byte-string. Then, if provided with the name of
51831 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
51832 made to translate the result to the named character set. If this fails, the
51833 binary string is returned with an error message.
51836 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
51837 maximum MIME word length is enforced. The third argument is the target
51838 encoding, or NULL if no translation is wanted.
51841 <indexterm role="concept">
51842 <primary>binary zero</primary>
51843 <secondary>in RFC 2047 decoding</secondary>
51845 <indexterm role="concept">
51846 <primary>RFC 2047</primary>
51847 <secondary>binary zero in</secondary>
51849 If a binary zero is encountered in the decoded string, it is replaced by the
51850 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
51851 not be 0 because header lines are handled as zero-terminated strings.
51854 The function returns the result of processing the string, zero-terminated; if
51855 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
51856 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
51859 If an error is encountered, the function returns NULL and uses the <option>error</option>
51860 argument to return an error message. The variable pointed to by <option>error</option> is
51861 set to NULL if there is no error; it may be set non-NULL even when the function
51862 returns a non-NULL value if decoding was successful, but there was a problem
51865 </listitem></varlistentry>
51867 <term><emphasis role="bold">int smtp_fflush(void)</emphasis></term>
51870 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
51873 </listitem></varlistentry>
51875 <term><emphasis role="bold">void smtp_printf(char *, ...)</emphasis></term>
51878 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
51879 output stream. You should use this function only when there is an SMTP output
51880 stream, that is, when the incoming message is being received via interactive
51881 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
51882 is FALSE. If you want to test for an incoming message from another host (as
51883 opposed to a local process that used the <option>-bs</option> command line option), you can
51884 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
51888 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
51889 output function, so it can be used for all forms of SMTP connection.
51892 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
51893 must start with an appropriate response code: 550 if you are going to return
51894 LOCAL_SCAN_REJECT, 451 if you are going to return
51895 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
51896 initial lines of a multi-line response, the code must be followed by a hyphen
51897 to indicate that the line is not the final response line. You must also ensure
51898 that the lines you write terminate with CRLF. For example:
51900 <literallayout class="monospaced">
51901 smtp_printf("550-this is some extra info\r\n");
51902 return LOCAL_SCAN_REJECT;
51905 Note that you can also create multi-line responses by including newlines in
51906 the data returned via the <option>return_text</option> argument. The added value of using
51907 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
51908 multiple output lines.
51911 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
51912 does not automatically flush pending output, and therefore does not test
51913 the state of the stream. (In the main code of Exim, flushing and error
51914 detection is done when Exim is ready for the next SMTP input command.) If
51915 you want to flush the output and check for an error (for example, the
51916 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
51917 arguments. It flushes the output stream, and returns a non-zero value if there
51920 </listitem></varlistentry>
51922 <term><emphasis role="bold">void *store_get(int)</emphasis></term>
51925 This function accesses Exim’s internal store (memory) manager. It gets a new
51926 chunk of memory whose size is given by the argument. Exim bombs out if it ever
51927 runs out of memory. See the next section for a discussion of memory handling.
51929 </listitem></varlistentry>
51931 <term><emphasis role="bold">void *store_get_perm(int)</emphasis></term>
51934 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
51935 permanent pool. See the next section for a discussion of memory handling.
51937 </listitem></varlistentry>
51939 <term><emphasis role="bold">uschar *string_copy(uschar *string)</emphasis></term>
51944 </listitem></varlistentry>
51946 <term><emphasis role="bold">uschar *string_copyn(uschar *string, int length)</emphasis></term>
51951 </listitem></varlistentry>
51953 <term><emphasis role="bold">uschar *string_sprintf(char *format, ...)</emphasis></term>
51956 These three functions create strings using Exim’s dynamic memory facilities.
51957 The first makes a copy of an entire string. The second copies up to a maximum
51958 number of characters, indicated by the second argument. The third uses a format
51959 and insertion arguments to create a new string. In each case, the result is a
51960 pointer to a new string in the current memory pool. See the next section for
51963 </listitem></varlistentry>
51966 <section id="SECTmemhanloc">
51967 <title>More about Exim’s memory handling</title>
51969 <indexterm role="concept">
51970 <primary><function>local_scan()</function> function</primary>
51971 <secondary>memory handling</secondary>
51973 No function is provided for freeing memory, because that is never needed.
51974 The dynamic memory that Exim uses when receiving a message is automatically
51975 recycled if another message is received by the same process (this applies only
51976 to incoming SMTP connections – other input methods can supply only one
51977 message at a time). After receiving the last message, a reception process
51981 Because it is recycled, the normal dynamic memory cannot be used for holding
51982 data that must be preserved over a number of incoming messages on the same SMTP
51983 connection. However, Exim in fact uses two pools of dynamic memory; the second
51984 one is not recycled, and can be used for this purpose.
51987 If you want to allocate memory that remains available for subsequent messages
51988 in the same SMTP connection, you should set
51990 <literallayout class="monospaced">
51991 store_pool = POOL_PERM
51994 before calling the function that does the allocation. There is no need to
51995 restore the value if you do not need to; however, if you do want to revert to
51996 the normal pool, you can either restore the previous value of <option>store_pool</option> or
51997 set it explicitly to POOL_MAIN.
52000 The pool setting applies to all functions that get dynamic memory, including
52001 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
52002 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
52003 block of memory from the permanent pool while preserving the value of
52004 <option>store_pool</option>.
52005 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
52010 <chapter id="CHAPsystemfilter">
52011 <title>System-wide message filtering</title>
52013 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
52014 <primary>filter</primary>
52015 <secondary>system filter</secondary>
52017 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
52018 <primary>filtering all mail</primary>
52020 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
52021 <primary>system filter</primary>
52023 The previous chapters (on ACLs and the local scan function) describe checks
52024 that can be applied to messages before they are accepted by a host. There is
52025 also a mechanism for checking messages once they have been received, but before
52026 they are delivered. This is called the <emphasis>system filter</emphasis>.
52029 The system filter operates in a similar manner to users’ filter files, but it
52030 is run just once per message (however many recipients the message has).
52031 It should not normally be used as a substitute for routing, because <option>deliver</option>
52032 commands in a system router provide new envelope recipient addresses.
52033 The system filter must be an Exim filter. It cannot be a Sieve filter.
52036 The system filter is run at the start of a delivery attempt, before any routing
52037 is done. If a message fails to be completely delivered at the first attempt,
52038 the system filter is run again at the start of every retry.
52039 If you want your filter to do something only once per message, you can make use
52040 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
52041 prevent it happening on retries.
52044 <indexterm role="concept">
52045 <primary><varname>$domain</varname></primary>
52047 <indexterm role="concept">
52048 <primary><varname>$local_part</varname></primary>
52050 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
52051 specific to individual recipient addresses, such as <varname>$local_part</varname> and
52052 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
52053 you want to run a centrally-specified filter for each recipient address
52054 independently, you can do so by setting up a suitable <command>redirect</command> router, as
52055 described in section <xref linkend="SECTperaddfil"/> below.
52058 <title>Specifying a system filter</title>
52060 <indexterm role="concept">
52061 <primary>uid (user id)</primary>
52062 <secondary>system filter</secondary>
52064 <indexterm role="concept">
52065 <primary>gid (group id)</primary>
52066 <secondary>system filter</secondary>
52068 The name of the file that contains the system filter must be specified by
52069 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
52070 other than root, you must also set <option>system_filter_user</option> and
52071 <option>system_filter_group</option> as appropriate. For example:
52073 <literallayout class="monospaced">
52074 system_filter = /etc/mail/exim.filter
52075 system_filter_user = exim
52078 If a system filter generates any deliveries directly to files or pipes (via the
52079 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
52080 specified by setting <option>system_filter_file_transport</option> and
52081 <option>system_filter_pipe_transport</option>, respectively. Similarly,
52082 <option>system_filter_reply_transport</option> must be set to handle any messages generated
52083 by the <option>reply</option> command.
52087 <title>Testing a system filter</title>
52089 You can run simple tests of a system filter in the same way as for a user
52090 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
52091 are permitted only in system filters are recognized.
52094 If you want to test the combined effect of a system filter and a user filter,
52095 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
52099 <title>Contents of a system filter</title>
52101 The language used to specify system filters is the same as for users’ filter
52102 files. It is described in the separate end-user document <emphasis>Exim’s interface to
52103 mail filtering</emphasis>. However, there are some additional features that are
52104 available only in system filters; these are described in subsequent sections.
52105 If they are encountered in a user’s filter file or when testing with <option>-bf</option>,
52109 <indexterm role="concept">
52110 <primary>frozen messages</primary>
52111 <secondary>manual thaw; testing in filter</secondary>
52113 There are two special conditions which, though available in users’ filter
52114 files, are designed for use in system filters. The condition <option>first_delivery</option>
52115 is true only for the first attempt at delivering a message, and
52116 <option>manually_thawed</option> is true only if the message has been frozen, and
52117 subsequently thawed by an admin user. An explicit forced delivery counts as a
52118 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
52121 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
52122 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
52123 succeed, it will not be tried again.
52124 If you want Exim to retry an unseen delivery until it succeeds, you should
52125 arrange to set it up every time the filter runs.
52128 When a system filter finishes running, the values of the variables <varname>$n0</varname> –
52129 <varname>$n9</varname> are copied into <varname>$sn0</varname> – <varname>$sn9</varname> and are thereby made available to
52130 users’ filter files. Thus a system filter can, for example, set up <quote>scores</quote>
52131 to which users’ filter files can refer.
52135 <title>Additional variable for system filters</title>
52137 <indexterm role="concept">
52138 <primary><varname>$recipients</varname></primary>
52140 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
52141 of the message (separated by commas and white space), is available in system
52142 filters. It is not available in users’ filters for privacy reasons.
52146 <title>Defer, freeze, and fail commands for system filters</title>
52148 <indexterm role="concept">
52149 <primary>freezing messages</primary>
52151 <indexterm role="concept">
52152 <primary>message</primary>
52153 <secondary>freezing</secondary>
52155 <indexterm role="concept">
52156 <primary>message</primary>
52157 <secondary>forced failure</secondary>
52159 <indexterm role="concept">
52160 <primary><option>fail</option></primary>
52161 <secondary>in system filter</secondary>
52163 <indexterm role="concept">
52164 <primary><option>freeze</option> in system filter</primary>
52166 <indexterm role="concept">
52167 <primary><option>defer</option> in system filter</primary>
52169 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
52170 always available in system filters, but are not normally enabled in users’
52171 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
52172 for the <command>redirect</command> router.) These commands can optionally be followed by the
52173 word <option>text</option> and a string containing an error message, for example:
52175 <literallayout class="monospaced">
52176 fail text "this message looks like spam to me"
52179 The keyword <option>text</option> is optional if the next character is a double quote.
52182 The <option>defer</option> command defers delivery of the original recipients of the
52183 message. The <option>fail</option> command causes all the original recipients to be failed,
52184 and a bounce message to be created. The <option>freeze</option> command suspends all
52185 delivery attempts for the original recipients. In all cases, any new deliveries
52186 that are specified by the filter are attempted as normal after the filter has
52190 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
52191 not manually frozen since. This means that automatic freezing by a system
52192 filter can be used as a way of checking out suspicious messages. If a message
52193 is found to be all right, manually unfreezing it allows it to be delivered.
52196 <indexterm role="concept">
52197 <primary>log</primary>
52198 <secondary><option>fail</option> command log line</secondary>
52200 <indexterm role="concept">
52201 <primary><option>fail</option></primary>
52202 <secondary>log line; reducing</secondary>
52204 The text given with a fail command is used as part of the bounce message as
52205 well as being written to the log. If the message is quite long, this can fill
52206 up a lot of log space when such failures are common. To reduce the size of the
52207 log message, Exim interprets the text in a special way if it starts with the
52208 two characters <literal><<</literal> and contains <literal>>></literal> later. The text between these two
52209 strings is written to the log, and the rest of the text is used in the bounce
52210 message. For example:
52212 <literallayout class="monospaced">
52213 fail "<<filter test 1>>Your message is rejected \
52214 because it contains attachments that we are \
52215 not prepared to receive."
52218 <indexterm role="concept">
52219 <primary>loop</primary>
52220 <secondary>caused by <option>fail</option></secondary>
52222 Take great care with the <option>fail</option> command when basing the decision to fail on
52223 the contents of the message, because the bounce message will of course include
52224 the contents of the original message and will therefore trigger the <option>fail</option>
52225 command again (causing a mail loop) unless steps are taken to prevent this.
52226 Testing the <option>error_message</option> condition is one way to prevent this. You could
52229 <literallayout class="monospaced">
52230 if $message_body contains "this is spam" and not error_message
52231 then fail text "spam is not wanted here" endif
52234 though of course that might let through unwanted bounce messages. The
52235 alternative is clever checking of the body and/or headers to detect bounces
52236 generated by the filter.
52239 The interpretation of a system filter file ceases after a
52240 <option>defer</option>,
52241 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
52242 set up earlier in the filter file are honoured, so you can use a sequence such
52245 <literallayout class="monospaced">
52250 to send a specified message when the system filter is freezing (or deferring or
52251 failing) a message. The normal deliveries for the message do not, of course,
52255 <section id="SECTaddremheasys">
52256 <title>Adding and removing headers in a system filter</title>
52258 <indexterm role="concept">
52259 <primary>header lines</primary>
52260 <secondary>adding; in system filter</secondary>
52262 <indexterm role="concept">
52263 <primary>header lines</primary>
52264 <secondary>removing; in system filter</secondary>
52266 <indexterm role="concept">
52267 <primary>filter</primary>
52268 <secondary>header lines; adding/removing</secondary>
52270 Two filter commands that are available only in system filters are:
52272 <literallayout class="monospaced">
52273 headers add <string>
52274 headers remove <string>
52277 The argument for the <option>headers add</option> is a string that is expanded and then
52278 added to the end of the message’s headers. It is the responsibility of the
52279 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
52280 space is ignored, and if the string is otherwise empty, or if the expansion is
52281 forced to fail, the command has no effect.
52284 You can use <quote>\n</quote> within the string, followed by white space, to specify
52285 continued header lines. More than one header may be added in one command by
52286 including <quote>\n</quote> within the string without any following white space. For
52289 <literallayout class="monospaced">
52290 headers add "X-header-1: ....\n \
52291 continuation of X-header-1 ...\n\
52295 Note that the header line continuation white space after the first newline must
52296 be placed before the backslash that continues the input string, because white
52297 space after input continuations is ignored.
52300 The argument for <option>headers remove</option> is a colon-separated list of header names.
52301 This command applies only to those headers that are stored with the message;
52302 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
52303 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
52304 header with the same name, they are all removed.
52307 The <option>headers</option> command in a system filter makes an immediate change to the set
52308 of header lines that was received with the message (with possible additions
52309 from ACL processing). Subsequent commands in the system filter operate on the
52310 modified set, which also forms the basis for subsequent message delivery.
52311 Unless further modified during routing or transporting, this set of headers is
52312 used for all recipients of the message.
52315 During routing and transporting, the variables that refer to the contents of
52316 header lines refer only to those lines that are in this set. Thus, header lines
52317 that are added by a system filter are visible to users’ filter files and to all
52318 routers and transports. This contrasts with the manipulation of header lines by
52319 routers and transports, which is not immediate, but which instead is saved up
52320 until the message is actually being written (see section
52321 <xref linkend="SECTheadersaddrem"/>).
52324 If the message is not delivered at the first attempt, header lines that were
52325 added by the system filter are stored with the message, and so are still
52326 present at the next delivery attempt. Header lines that were removed are still
52327 present, but marked <quote>deleted</quote> so that they are not transported with the
52328 message. For this reason, it is usual to make the <option>headers</option> command
52329 conditional on <option>first_delivery</option> so that the set of header lines is not
52330 modified more than once.
52333 Because header modification in a system filter acts immediately, you have to
52334 use an indirect approach if you want to modify the contents of a header line.
52337 <literallayout class="monospaced">
52338 headers add "Old-Subject: $h_subject:"
52339 headers remove "Subject"
52340 headers add "Subject: new subject (was: $h_old-subject:)"
52341 headers remove "Old-Subject"
52345 <title>Setting an errors address in a system filter</title>
52347 <indexterm role="concept">
52348 <primary>envelope sender</primary>
52350 In a system filter, if a <option>deliver</option> command is followed by
52352 <literallayout class="monospaced">
52353 errors_to <some address>
52356 in order to change the envelope sender (and hence the error reporting) for that
52357 delivery, any address may be specified. (In a user filter, only the current
52358 user’s address can be set.) For example, if some mail is being monitored, you
52361 <literallayout class="monospaced">
52362 unseen deliver monitor@spying.example errors_to root@local.example
52365 to take a copy which would not be sent back to the normal error reporting
52366 address if its delivery failed.
52369 <section id="SECTperaddfil">
52370 <title>Per-address filtering</title>
52372 <indexterm role="concept">
52373 <primary><varname>$domain</varname></primary>
52375 <indexterm role="concept">
52376 <primary><varname>$local_part</varname></primary>
52378 In contrast to the system filter, which is run just once per message for each
52379 delivery attempt, it is also possible to set up a system-wide filtering
52380 operation that runs once for each recipient address. In this case, variables
52381 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
52382 filter file could be made dependent on them. This is an example of a router
52383 which implements such a filter:
52385 <literallayout class="monospaced">
52389 domains = +local_domains
52390 file = /central/filters/$local_part
52396 The filter is run in a separate process under its own uid. Therefore, either
52397 <option>check_local_user</option> must be set (as above), in which case the filter is run as
52398 the local user, or the <option>user</option> option must be used to specify which user to
52399 use. If both are set, <option>user</option> overrides.
52402 Care should be taken to ensure that none of the commands in the filter file
52403 specify a significant delivery if the message is to go on to be delivered to
52404 its intended recipient. The router will not then claim to have dealt with the
52405 address, so it will be passed on to subsequent routers to be delivered in the
52407 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
52408 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
52409 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
52414 <chapter id="CHAPmsgproc">
52415 <title>Message processing</title>
52417 <indexterm role="concept" id="IIDmesproc" class="startofrange">
52418 <primary>message</primary>
52419 <secondary>general processing</secondary>
52421 Exim performs various transformations on the sender and recipient addresses of
52422 all messages that it handles, and also on the messages’ header lines. Some of
52423 these are optional and configurable, while others always take place. All of
52424 this processing, except rewriting as a result of routing, and the addition or
52425 removal of header lines while delivering, happens when a message is received,
52426 before it is placed on Exim’s queue.
52429 Some of the automatic processing takes place by default only for
52430 <quote>locally-originated</quote> messages. This adjective is used to describe messages
52431 that are not received over TCP/IP, but instead are passed to an Exim process on
52432 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
52433 set up by the <option>-bs</option> command line option.
52436 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
52437 or ::1) are not considered to be locally-originated. Exim does not treat the
52438 loopback interface specially in any way.
52441 If you want the loopback interface to be treated specially, you must ensure
52442 that there are appropriate entries in your ACLs.
52444 <section id="SECTsubmodnon">
52445 <title>Submission mode for non-local messages</title>
52447 <indexterm role="concept">
52448 <primary>message</primary>
52449 <secondary>submission</secondary>
52451 <indexterm role="concept">
52452 <primary>submission mode</primary>
52454 Processing that happens automatically for locally-originated messages (unless
52455 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
52456 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
52457 state. Submisssion mode is set by the modifier
52459 <literallayout class="monospaced">
52460 control = submission
52463 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
52464 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
52465 a local submission, and is normally used when the source of the message is
52466 known to be an MUA running on a client host (as opposed to an MTA). For
52467 example, to set submission mode for messages originating on the IPv4 loopback
52468 interface, you could include the following in the MAIL ACL:
52470 <literallayout class="monospaced">
52471 warn hosts = 127.0.0.1
52472 control = submission
52475 <indexterm role="concept">
52476 <primary><option>sender_retain</option></primary>
52478 There are some options that can be used when setting submission mode. A slash
52479 is used to separate options. For example:
52481 <literallayout class="monospaced">
52482 control = submission/sender_retain
52485 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
52486 true and <option>local_from_check</option> false for the current incoming message. The first
52487 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
52488 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
52489 authenticated sender. With this setting, Exim still fixes up messages by adding
52490 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
52491 attempt to check sender authenticity in header lines.
52494 When <option>sender_retain</option> is not set, a submission mode setting may specify a
52495 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
52498 <literallayout class="monospaced">
52499 control = submission/domain=some.domain
52502 The domain may be empty. How this value is used is described in sections
52503 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
52504 that allows you to specify the user’s full name for inclusion in a created
52505 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
52507 <literallayout class="monospaced">
52508 accept authenticated = *
52509 control = submission/domain=wonderland.example/\
52510 name=${lookup {$authenticated_id} \
52511 lsearch {/etc/exim/namelist}}
52514 Because the name may contain any characters, including slashes, the <option>name</option>
52515 option must be given last. The remainder of the string is used as the name. For
52516 the example above, if <filename>/etc/exim/namelist</filename> contains:
52518 <literallayout class="monospaced">
52519 bigegg: Humpty Dumpty
52522 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
52525 <literallayout class="monospaced">
52526 Sender: Humpty Dumpty <bigegg@wonderland.example>
52529 <indexterm role="concept">
52530 <primary>return path</primary>
52531 <secondary>in submission mode</secondary>
52533 By default, submission mode forces the return path to the same address as is
52534 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
52535 specified, the return path is also left unchanged.
52538 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
52539 ACL. This means that any sender checks performed before the fix-ups use the
52540 untrusted sender address specified by the user, not the trusted sender address
52541 specified by submission mode. Although this might be slightly unexpected, it
52542 does mean that you can configure ACL checks to spot that a user is trying to
52543 spoof another’s address.
52546 <section id="SECTlineendings">
52547 <title>Line endings</title>
52549 <indexterm role="concept">
52550 <primary>line endings</primary>
52552 <indexterm role="concept">
52553 <primary>carriage return</primary>
52555 <indexterm role="concept">
52556 <primary>linefeed</primary>
52558 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
52559 linefeed) is the line ending for messages transmitted over the Internet using
52560 SMTP over TCP/IP. However, within individual operating systems, different
52561 conventions are used. For example, Unix-like systems use just LF, but others
52562 use CRLF or just CR.
52565 Exim was designed for Unix-like systems, and internally, it stores messages
52566 using the system’s convention of a single LF as a line terminator. When
52567 receiving a message, all line endings are translated to this standard format.
52568 Originally, it was thought that programs that passed messages directly to an
52569 MTA within an operating system would use that system’s convention. Experience
52570 has shown that this is not the case; for example, there are Unix applications
52571 that use CRLF in this circumstance. For this reason, and for compatibility with
52572 other MTAs, the way Exim handles line endings for all messages is now as
52578 LF not preceded by CR is treated as a line ending.
52583 CR is treated as a line ending; if it is immediately followed by LF, the LF
52589 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
52590 nor a local message in the state where a line containing only a dot is a
52596 If a bare CR is encountered within a header line, an extra space is added after
52597 the line terminator so as not to end the header line. The reasoning behind this
52598 is that bare CRs in header lines are most likely either to be mistakes, or
52599 people trying to play silly games.
52604 If the first header line received in a message ends with CRLF, a subsequent
52605 bare LF in a header line is treated in the same way as a bare CR in a header
52612 <title>Unqualified addresses</title>
52614 <indexterm role="concept">
52615 <primary>unqualified addresses</primary>
52617 <indexterm role="concept">
52618 <primary>address</primary>
52619 <secondary>qualification</secondary>
52621 By default, Exim expects every envelope address it receives from an external
52622 host to be fully qualified. Unqualified addresses cause negative responses to
52623 SMTP commands. However, because SMTP is used as a means of transporting
52624 messages from MUAs running on personal workstations, there is sometimes a
52625 requirement to accept unqualified addresses from specific hosts or IP networks.
52628 Exim has two options that separately control which hosts may send unqualified
52629 sender or receipient addresses in SMTP commands, namely
52630 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
52631 cases, if an unqualified address is accepted, it is qualified by adding the
52632 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
52635 <indexterm role="concept">
52636 <primary><option>qualify_domain</option></primary>
52638 <indexterm role="concept">
52639 <primary><option>qualify_recipient</option></primary>
52641 Unqualified addresses in header lines are automatically qualified for messages
52642 that are locally originated, unless the <option>-bnq</option> option is given on the command
52643 line. For messages received over SMTP, unqualified addresses in header lines
52644 are qualified only if unqualified addresses are permitted in SMTP commands. In
52645 other words, such qualification is also controlled by
52646 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
52650 <title>The UUCP From line</title>
52652 <indexterm role="concept">
52653 <primary><quote>From</quote> line</primary>
52655 <indexterm role="concept">
52656 <primary>UUCP</primary>
52657 <secondary><quote>From</quote> line</secondary>
52659 <indexterm role="concept">
52660 <primary>sender</primary>
52661 <secondary>address</secondary>
52663 <indexterm role="concept">
52664 <primary><option>uucp_from_pattern</option></primary>
52666 <indexterm role="concept">
52667 <primary><option>uucp_from_sender</option></primary>
52669 <indexterm role="concept">
52670 <primary>envelope sender</primary>
52672 <indexterm role="concept">
52673 <primary>Sendmail compatibility</primary>
52674 <secondary><quote>From</quote> line</secondary>
52676 Messages that have come from UUCP (and some other applications) often begin
52677 with a line containing the envelope sender and a timestamp, following the word
52678 <quote>From</quote>. Examples of two common formats are:
52680 <literallayout class="monospaced">
52681 From a.oakley@berlin.mus Fri Jan 5 12:35 GMT 1996
52682 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
52685 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
52686 Exim recognizes such lines at the start of messages that are submitted to it
52687 via the command line (that is, on the standard input). It does not recognize
52688 such lines in incoming SMTP messages, unless the sending host matches
52689 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
52690 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
52691 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
52692 default value matches the two common cases shown above and puts the address
52693 that follows <quote>From</quote> into <varname>$1</varname>.
52696 <indexterm role="concept">
52697 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
52698 <secondary>in <quote>From </quote> line handling</secondary>
52700 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
52701 a trusted user, the message’s sender address is constructed by expanding the
52702 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
52703 then parsed as an RFC 2822 address. If there is no domain, the local part is
52704 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
52705 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
52708 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
52709 sender address is not changed. This is also the case for incoming SMTP messages
52710 that are permitted to contain <quote>From</quote> lines.
52713 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
52714 treated as a data line that starts the body of the message, as it is not valid
52715 as a header line. This also happens if a <quote>From</quote> line is present in an
52716 incoming SMTP message from a source that is not permitted to send them.
52720 <title>Resent- header lines</title>
52722 <indexterm role="concept">
52723 <primary><option>Resent-</option> header lines</primary>
52725 RFC 2822 makes provision for sets of header lines starting with the string
52726 <literal>Resent-</literal> to be added to a message when it is resent by the original
52727 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
52728 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
52729 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
52733 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
52734 processing of replies or other such automatic actions on messages.</emphasis>
52738 This leaves things a bit vague as far as other processing actions such as
52739 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
52745 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
52746 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
52751 If there’s a rewriting rule for a particular header line, it is also applied to
52752 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
52753 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
52758 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
52764 For a locally-submitted message,
52765 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
52766 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
52767 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
52768 included in log lines in this case.
52773 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
52774 <option>Resent-</option> header lines are present.
52780 <title>The Auto-Submitted: header line</title>
52782 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
52783 includes the header line:
52785 <literallayout class="monospaced">
52786 Auto-Submitted: auto-replied
52790 <title>The Bcc: header line</title>
52792 <indexterm role="concept">
52793 <primary><emphasis>Bcc:</emphasis> header line</primary>
52795 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
52796 message’s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
52797 extracting its addresses). If <option>-t</option> is not present on the command line, any
52798 existing <emphasis>Bcc:</emphasis> is not removed.
52802 <title>The Date: header line</title>
52804 <indexterm role="concept">
52805 <primary><emphasis>Date:</emphasis> header line</primary>
52807 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
52808 Exim adds one, using the current date and time, unless the
52809 <option>suppress_local_fixups</option> control has been specified.
52813 <title>The Delivery-date: header line</title>
52815 <indexterm role="concept">
52816 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
52818 <indexterm role="concept">
52819 <primary><option>delivery_date_remove</option></primary>
52821 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
52822 set. Exim can be configured to add them to the final delivery of messages. (See
52823 the generic <option>delivery_date_add</option> transport option.) They should not be present
52824 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
52825 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
52830 <title>The Envelope-to: header line</title>
52832 <indexterm role="concept">
52833 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
52835 <indexterm role="concept">
52836 <primary><option>envelope_to_remove</option></primary>
52838 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
52839 Exim can be configured to add them to the final delivery of messages. (See the
52840 generic <option>envelope_to_add</option> transport option.) They should not be present in
52841 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
52842 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
52846 <section id="SECTthefrohea">
52847 <title>The From: header line</title>
52849 <indexterm role="concept">
52850 <primary><emphasis>From:</emphasis> header line</primary>
52852 <indexterm role="concept">
52853 <primary>Sendmail compatibility</primary>
52854 <secondary><quote>From</quote> line</secondary>
52856 <indexterm role="concept">
52857 <primary>message</primary>
52858 <secondary>submission</secondary>
52860 <indexterm role="concept">
52861 <primary>submission mode</primary>
52863 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
52864 adds one if either of the following conditions is true:
52869 The envelope sender address is not empty (that is, this is not a bounce
52870 message). The added header line copies the envelope sender address.
52875 <indexterm role="concept">
52876 <primary><varname>$authenticated_id</varname></primary>
52878 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
52880 <orderedlist numeration="arabic">
52883 <indexterm role="concept">
52884 <primary><varname>$qualify_domain</varname></primary>
52886 If no domain is specified by the submission control, the local part is
52887 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
52892 If a non-empty domain is specified by the submission control, the local
52893 part is <varname>$authenticated_id</varname>, and the the domain is the specified domain.
52898 If an empty domain is specified by the submission control,
52899 <varname>$authenticated_id</varname> is assumed to be the complete address.
52906 A non-empty envelope sender takes precedence.
52909 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
52910 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
52911 containing the sender’s address. The calling user’s login name and full name
52912 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
52913 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
52914 <option>unknown_login</option> configuration option). The address is qualified with
52915 <option>qualify_domain</option>.
52918 For compatibility with Sendmail, if an incoming, non-SMTP message has a
52919 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
52920 user, this is replaced by an address containing the user’s login name and full
52921 name as described in section <xref linkend="SECTconstr"/>.
52925 <title>The Message-ID: header line</title>
52927 <indexterm role="concept">
52928 <primary><emphasis>Message-ID:</emphasis> header line</primary>
52930 <indexterm role="concept">
52931 <primary>message</primary>
52932 <secondary>submission</secondary>
52934 <indexterm role="concept">
52935 <primary><option>message_id_header_text</option></primary>
52937 If a locally-generated or submission-mode incoming message does not contain a
52938 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
52939 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
52940 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
52941 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim’s internal
52942 message id, preceded by the letter E to ensure it starts with a letter, and
52943 followed by @ and the primary host name. Additional information can be included
52944 in this header line by setting the <option>message_id_header_text</option> and/or
52945 <option>message_id_header_domain</option> options.
52949 <title>The Received: header line</title>
52951 <indexterm role="concept">
52952 <primary><emphasis>Received:</emphasis> header line</primary>
52954 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
52955 contents are defined by the <option>received_header_text</option> configuration option, and
52956 Exim automatically adds a semicolon and a timestamp to the configured string.
52959 The <emphasis>Received:</emphasis> header is generated as soon as the message’s header lines
52960 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
52961 line is the time that the message started to be received. This is the value
52962 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
52965 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
52966 changed to the time of acceptance, which is (apart from a small delay while the
52967 -H spool file is written) the earliest time at which delivery could start.
52971 <title>The References: header line</title>
52973 <indexterm role="concept">
52974 <primary><emphasis>References:</emphasis> header line</primary>
52976 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
52977 header line. This is constructed according to the rules that are described in
52978 section 3.64 of RFC 2822 (which states that replies should contain such a
52979 header line), and section 3.14 of RFC 3834 (which states that automatic
52980 responses are not different in this respect). However, because some mail
52981 processing software does not cope well with very long header lines, no more
52982 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
52983 incoming message. If there are more than 12, the first one and then the final
52984 11 are copied, before adding the message ID of the incoming message.
52988 <title>The Return-path: header line</title>
52990 <indexterm role="concept">
52991 <primary><emphasis>Return-path:</emphasis> header line</primary>
52993 <indexterm role="concept">
52994 <primary><option>return_path_remove</option></primary>
52996 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
52997 it does the final delivery of messages. (See the generic <option>return_path_add</option>
52998 transport option.) Therefore, they should not be present in messages in
52999 transit. If the <option>return_path_remove</option> configuration option is set (the
53000 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
53003 <section id="SECTthesenhea">
53004 <title>The Sender: header line</title>
53006 <indexterm role="concept">
53007 <primary><emphasis>Sender:</emphasis> header line</primary>
53009 <indexterm role="concept">
53010 <primary>message</primary>
53011 <secondary>submission</secondary>
53013 For a locally-originated message from an untrusted user, Exim may remove an
53014 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
53015 these actions by setting the <option>local_sender_retain</option> option true, the
53016 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
53020 When a local message is received from an untrusted user and
53021 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
53022 control has not been set, a check is made to see if the address given in the
53023 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
53024 that is expected has the login name as the local part and the value of
53025 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
53026 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
53027 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
53028 line is added to the message.
53031 If you set <option>local_from_check</option> false, this checking does not occur. However,
53032 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
53033 <option>local_sender_retain</option> to be true. It is not possible to set both of these
53034 options true at the same time.
53037 <indexterm role="concept">
53038 <primary>submission mode</primary>
53040 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
53041 received over TCP/IP or for messages submitted by trusted users. However, when
53042 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
53043 not specified on the submission control, the following processing takes place:
53046 <indexterm role="concept">
53047 <primary><varname>$authenticated_id</varname></primary>
53049 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
53050 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
53051 created as follows:
53056 <indexterm role="concept">
53057 <primary><varname>$qualify_domain</varname></primary>
53059 If no domain is specified by the submission control, the local part is
53060 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
53065 If a non-empty domain is specified by the submission control, the local part
53066 is <varname>$authenticated_id</varname>, and the the domain is the specified domain.
53071 If an empty domain is specified by the submission control,
53072 <varname>$authenticated_id</varname> is assumed to be the complete address.
53077 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
53078 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
53079 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
53080 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
53083 <indexterm role="concept">
53084 <primary>return path</primary>
53085 <secondary>created from <emphasis>Sender:</emphasis></secondary>
53087 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
53088 the message (the envelope sender address) is changed to be the same address,
53089 except in the case of submission mode when <option>sender_retain</option> is specified.
53092 <section id="SECTheadersaddrem">
53093 <title>Adding and removing header lines in routers and transports</title>
53095 <indexterm role="concept">
53096 <primary>header lines</primary>
53097 <secondary>adding; in router or transport</secondary>
53099 <indexterm role="concept">
53100 <primary>header lines</primary>
53101 <secondary>removing; in router or transport</secondary>
53103 When a message is delivered, the addition and removal of header lines can be
53104 specified in a system filter, or on any of the routers and transports that
53105 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
53106 modifying headers in a system filter. Header lines can also be added in an ACL
53107 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
53110 In contrast to what happens in a system filter, header modifications that are
53111 specified on routers and transports apply only to the particular recipient
53112 addresses that are being processed by those routers and transports. These
53113 changes do not actually take place until a copy of the message is being
53114 transported. Therefore, they do not affect the basic set of header lines, and
53115 they do not affect the values of the variables that refer to header lines.
53118 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
53119 the transport cannot refer to the modified header lines, because such
53120 expansions all occur before the message is actually transported.
53123 For both routers and transports, the result of expanding a <option>headers_add</option>
53124 option must be in the form of one or more RFC 2822 header lines, separated by
53125 newlines (coded as <quote>\n</quote>). For example:
53127 <literallayout class="monospaced">
53128 headers_add = X-added-header: added by $primary_hostname\n\
53129 X-added-second: another added header line
53132 Exim does not check the syntax of these added header lines.
53135 The result of expanding <option>headers_remove</option> must consist of a colon-separated
53136 list of header names. This is confusing, because header names themselves are
53137 often terminated by colons. In this case, the colons are the list separators,
53138 not part of the names. For example:
53140 <literallayout class="monospaced">
53141 headers_remove = return-receipt-to:acknowledge-to
53144 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router, its value
53145 is expanded at routing time, and then associated with all addresses that are
53146 accepted by that router, and also with any new addresses that it generates. If
53147 an address passes through several routers as a result of aliasing or
53148 forwarding, the changes are cumulative.
53151 <indexterm role="concept">
53152 <primary><option>unseen</option> option</primary>
53154 However, this does not apply to multiple routers that result from the use of
53155 the <option>unseen</option> option. Any header modifications that were specified by the
53156 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
53159 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
53160 settings cannot be delivered together in a batch, so a transport is always
53161 dealing with a set of addresses that have the same header-processing
53165 The transport starts by writing the original set of header lines that arrived
53166 with the message, possibly modified by the system filter. As it writes out
53167 these lines, it consults the list of header names that were attached to the
53168 recipient address(es) by <option>headers_remove</option> options in routers, and it also
53169 consults the transport’s own <option>headers_remove</option> option. Header lines whose
53170 names are on either of these lists are not written out. If there are multiple
53171 instances of any listed header, they are all skipped.
53174 After the remaining original header lines have been written, new header
53175 lines that were specified by routers’ <option>headers_add</option> options are written, in
53176 the order in which they were attached to the address. These are followed by any
53177 header lines specified by the transport’s <option>headers_add</option> option.
53180 This way of handling header line modifications in routers and transports has
53181 the following consequences:
53186 The original set of header lines, possibly modified by the system filter,
53187 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
53188 to it, at all times.
53193 Header lines that are added by a router’s
53194 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
53195 expansion syntax in subsequent routers or the transport.
53200 Conversely, header lines that are specified for removal by <option>headers_remove</option>
53201 in a router remain visible to subsequent routers and the transport.
53206 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
53207 a later router or by a transport.
53212 An added header can refer to the contents of an original header that is to be
53213 removed, even it has the same name as the added header. For example:
53215 <literallayout class="monospaced">
53216 headers_remove = subject
53217 headers_add = Subject: new subject (was: $h_subject:)
53222 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
53223 for a <command>redirect</command> router that has the <option>one_time</option> option set.
53226 <section id="SECTconstr">
53227 <title>Constructed addresses</title>
53229 <indexterm role="concept">
53230 <primary>address</primary>
53231 <secondary>constructed</secondary>
53233 <indexterm role="concept">
53234 <primary>constructed address</primary>
53236 When Exim constructs a sender address for a locally-generated message, it uses
53240 <<emphasis>user name</emphasis>> <<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>>
53245 <literallayout class="monospaced">
53246 Zaphod Beeblebrox <zaphod@end.univ.example>
53249 The user name is obtained from the <option>-F</option> command line option if set, or
53250 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
53251 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
53252 ampersand character, this is replaced by the login name with the first letter
53253 upper cased, as is conventional in a number of operating systems. See the
53254 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
53255 The <option>unknown_username</option> option can be used to specify user names in cases when
53256 there is no password file entry.
53259 <indexterm role="concept">
53260 <primary>RFC 2047</primary>
53262 In all cases, the user name is made to conform to RFC 2822 by quoting all or
53263 parts of it if necessary. In addition, if it contains any non-printing
53264 characters, it is encoded as described in RFC 2047, which defines a way of
53265 including non-ASCII characters in header lines. The value of the
53266 <option>headers_charset</option> option specifies the name of the encoding that is used (the
53267 characters are assumed to be in this encoding). The setting of
53268 <option>print_topbitchars</option> controls whether characters with the top bit set (that
53269 is, with codes greater than 127) count as printing characters or not.
53273 <title>Case of local parts</title>
53275 <indexterm role="concept">
53276 <primary>case of local parts</primary>
53278 <indexterm role="concept">
53279 <primary>local part</primary>
53280 <secondary>case of</secondary>
53282 RFC 2822 states that the case of letters in the local parts of addresses cannot
53283 be assumed to be non-significant. Exim preserves the case of local parts of
53284 addresses, but by default it uses a lower-cased form when it is routing,
53285 because on most Unix systems, usernames are in lower case and case-insensitive
53286 routing is required. However, any particular router can be made to use the
53287 original case for local parts by setting the <option>caseful_local_part</option> generic
53291 <indexterm role="concept">
53292 <primary>mixed-case login names</primary>
53294 If you must have mixed-case user names on your system, the best way to proceed,
53295 assuming you want case-independent handling of incoming email, is to set up
53296 your first router to convert incoming local parts in your domains to the
53297 correct case by means of a file lookup. For example:
53299 <literallayout class="monospaced">
53302 domains = +local_domains
53303 data = ${lookup{$local_part}cdb\
53304 {/etc/usercased.cdb}{$value}fail}\
53308 For this router, the local part is forced to lower case by the default action
53309 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
53310 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
53311 on any subsequent routers which process your domains, they will operate on
53312 local parts with the correct case in a case-sensitive manner.
53316 <title>Dots in local parts</title>
53318 <indexterm role="concept">
53319 <primary>dot</primary>
53320 <secondary>in local part</secondary>
53322 <indexterm role="concept">
53323 <primary>local part</primary>
53324 <secondary>dots in</secondary>
53326 RFC 2822 forbids empty components in local parts. That is, an unquoted local
53327 part may not begin or end with a dot, nor have two consecutive dots in the
53328 middle. However, it seems that many MTAs do not enforce this, so Exim permits
53329 empty components for compatibility.
53333 <title>Rewriting addresses</title>
53335 <indexterm role="concept">
53336 <primary>rewriting</primary>
53337 <secondary>addresses</secondary>
53339 Rewriting of sender and recipient addresses, and addresses in headers, can
53340 happen automatically, or as the result of configuration options, as described
53341 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
53342 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
53345 Automatic rewriting includes qualification, as mentioned above. The other case
53346 in which it can happen is when an incomplete non-local domain is given. The
53347 routing process may cause this to be expanded into the full domain name. For
53348 example, a header such as
53350 <literallayout class="monospaced">
53354 might get rewritten as
53356 <literallayout class="monospaced">
53357 To: hare@teaparty.wonderland.fict.example
53360 Rewriting as a result of routing is the one kind of message processing that
53361 does not happen at input time, as it cannot be done until the address has
53365 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
53366 addresses have been routed, in case any of the headers get changed as a
53367 result of routing. However, doing this in practice would hold up many
53368 deliveries for unreasonable amounts of time, just because one address could not
53369 immediately be routed. Exim therefore does not delay other deliveries when
53370 routing of one or more addresses is deferred.
53371 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
53376 <chapter id="CHAPSMTP">
53377 <title>SMTP processing</title>
53379 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
53380 <primary>SMTP</primary>
53381 <secondary>processing details</secondary>
53383 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
53384 <primary>LMTP</primary>
53385 <secondary>processing details</secondary>
53387 Exim supports a number of different ways of using the SMTP protocol, and its
53388 LMTP variant, which is an interactive protocol for transferring messages into a
53389 closed mail store application. This chapter contains details of how SMTP is
53390 processed. For incoming mail, the following are available:
53395 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
53400 SMTP over the standard input and output (the <option>-bs</option> option);
53405 Batched SMTP on the standard input (the <option>-bS</option> option).
53410 For mail delivery, the following are available:
53415 SMTP over TCP/IP (the <command>smtp</command> transport);
53420 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
53421 <quote>lmtp</quote>);
53426 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
53432 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
53433 the <option>use_bsmtp</option> option set).
53438 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
53439 stored in or read from files (or pipes), in a format in which SMTP commands are
53440 used to contain the envelope information.
53442 <section id="SECToutSMTPTCP">
53443 <title>Outgoing SMTP and LMTP over TCP/IP</title>
53445 <indexterm role="concept">
53446 <primary>SMTP</primary>
53447 <secondary>outgoing over TCP/IP</secondary>
53449 <indexterm role="concept">
53450 <primary>outgoing SMTP over TCP/IP</primary>
53452 <indexterm role="concept">
53453 <primary>LMTP</primary>
53454 <secondary>over TCP/IP</secondary>
53456 <indexterm role="concept">
53457 <primary>outgoing LMTP over TCP/IP</primary>
53459 <indexterm role="concept">
53460 <primary>EHLO</primary>
53462 <indexterm role="concept">
53463 <primary>HELO</primary>
53465 <indexterm role="concept">
53466 <primary>SIZE option on MAIL command</primary>
53468 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
53469 The <option>protocol</option> option selects which protocol is to be used, but the actual
53470 processing is the same in both cases.
53473 If, in response to its EHLO command, Exim is told that the SIZE
53474 parameter is supported, it adds SIZE=<<emphasis>n</emphasis>> to each subsequent MAIL
53475 command. The value of <<emphasis>n</emphasis>> is the message size plus the value of the
53476 <option>size_addition</option> option (default 1024) to allow for additions to the message
53477 such as per-transport header lines, or changes made in a
53478 <indexterm role="concept">
53479 <primary>transport</primary>
53480 <secondary>filter</secondary>
53482 <indexterm role="concept">
53483 <primary>filter</primary>
53484 <secondary>transport filter</secondary>
53486 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
53490 If the remote server advertises support for PIPELINING, Exim uses the
53491 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
53492 required for the transaction.
53495 If the remote server advertises support for the STARTTLS command, and Exim
53496 was built to support TLS encryption, it tries to start a TLS session unless the
53497 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
53500 If the remote server advertises support for the AUTH command, Exim scans
53501 the authenticators configuration for any suitable client settings, as described
53502 in chapter <xref linkend="CHAPSMTPAUTH"/>.
53505 <indexterm role="concept">
53506 <primary>carriage return</primary>
53508 <indexterm role="concept">
53509 <primary>linefeed</primary>
53511 Responses from the remote host are supposed to be terminated by CR followed by
53512 LF. However, there are known to be hosts that do not send CR characters, so in
53513 order to be able to interwork with such hosts, Exim treats LF on its own as a
53517 If a message contains a number of different addresses, all those with the same
53518 characteristics (for example, the same envelope sender) that resolve to the
53519 same set of hosts, in the same order, are sent in a single SMTP transaction,
53520 even if they are for different domains, unless there are more than the setting
53521 of the <option>max_rcpts</option> option in the <command>smtp</command> transport allows, in which case
53522 they are split into groups containing no more than <option>max_rcpts</option> addresses
53523 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
53524 in parallel sessions. The order of hosts with identical MX values is not
53525 significant when checking whether addresses can be batched in this way.
53528 When the <command>smtp</command> transport suffers a temporary failure that is not
53529 message-related, Exim updates its transport-specific database, which contains
53530 records indexed by host name that remember which messages are waiting for each
53531 particular host. It also updates the retry database with new retry times.
53534 <indexterm role="concept">
53535 <primary>hints database</primary>
53536 <secondary>retry keys</secondary>
53538 Exim’s retry hints are based on host name plus IP address, so if one address of
53539 a multi-homed host is broken, it will soon be skipped most of the time.
53540 See the next section for more detail about error handling.
53543 <indexterm role="concept">
53544 <primary>SMTP</primary>
53545 <secondary>passed connection</secondary>
53547 <indexterm role="concept">
53548 <primary>SMTP</primary>
53549 <secondary>batching over TCP/IP</secondary>
53551 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
53552 looks in the hints database for the transport to see if there are any queued
53553 messages waiting for the host to which it is connected. If it finds one, it
53554 creates a new Exim process using the <option>-MC</option> option (which can only be used by
53555 a process running as root or the Exim user) and passes the TCP/IP socket to it
53556 so that it can deliver another message using the same socket. The new process
53557 does only those deliveries that are routed to the connected host, and may in
53558 turn pass the socket on to a third process, and so on.
53561 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
53562 limit the number of messages sent down a single TCP/IP connection.
53565 <indexterm role="concept">
53566 <primary>asterisk</primary>
53567 <secondary>after IP address</secondary>
53569 The second and subsequent messages delivered down an existing connection are
53570 identified in the main log by the addition of an asterisk after the closing
53571 square bracket of the IP address.
53574 <section id="SECToutSMTPerr">
53575 <title>Errors in outgoing SMTP</title>
53577 <indexterm role="concept">
53578 <primary>error</primary>
53579 <secondary>in outgoing SMTP</secondary>
53581 <indexterm role="concept">
53582 <primary>SMTP</primary>
53583 <secondary>errors in outgoing</secondary>
53585 <indexterm role="concept">
53586 <primary>host</primary>
53587 <secondary>error</secondary>
53589 Three different kinds of error are recognized for outgoing SMTP: host errors,
53590 message errors, and recipient errors.
53594 <term><emphasis role="bold">Host errors</emphasis></term>
53597 A host error is not associated with a particular message or with a
53598 particular recipient of a message. The host errors are:
53603 Connection refused or timed out,
53608 Any error response code on connection,
53613 Any error response code to EHLO or HELO,
53618 Loss of connection at any time, except after <quote>.</quote>,
53623 I/O errors at any time,
53628 Timeouts during the session, other than in response to MAIL, RCPT or
53629 the <quote>.</quote> at the end of the data.
53634 For a host error, a permanent error response on connection, or in response to
53635 EHLO, causes all addresses routed to the host to be failed. Any other host
53636 error causes all addresses to be deferred, and retry data to be created for the
53637 host. It is not tried again, for any message, until its retry time arrives. If
53638 the current set of addresses are not all delivered in this run (to some
53639 alternative host), the message is added to the list of those waiting for this
53640 host, so if it is still undelivered when a subsequent successful delivery is
53641 made to the host, it will be sent down the same SMTP connection.
53643 </listitem></varlistentry>
53645 <term><emphasis role="bold">Message errors</emphasis></term>
53648 <indexterm role="concept">
53649 <primary>message</primary>
53650 <secondary>error</secondary>
53652 A message error is associated with a particular message when sent to a
53653 particular host, but not with a particular recipient of the message. The
53654 message errors are:
53659 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
53665 Timeout after MAIL,
53670 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
53671 timeout after the DATA command itself is treated as a host error, as is loss of
53672 connection at any other time.
53677 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
53678 to be failed, and a delivery error report to be returned to the sender. A
53679 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
53680 addresses to be deferred. Retry data is not created for the host, but instead,
53681 a retry record for the combination of host plus message id is created. The
53682 message is not added to the list of those waiting for this host. This ensures
53683 that the failing message will not be sent to this host again until the retry
53684 time arrives. However, other messages that are routed to the host are not
53685 affected, so if it is some property of the message that is causing the error,
53686 it will not stop the delivery of other mail.
53689 If the remote host specified support for the SIZE parameter in its response
53690 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
53691 over-large message will cause a message error because the error arrives as a
53694 </listitem></varlistentry>
53696 <term><emphasis role="bold">Recipient errors</emphasis></term>
53699 <indexterm role="concept">
53700 <primary>recipient</primary>
53701 <secondary>error</secondary>
53703 A recipient error is associated with a particular recipient of a message. The
53704 recipient errors are:
53709 Any error response to RCPT,
53714 Timeout after RCPT.
53719 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
53720 recipient address to be failed, and a bounce message to be returned to the
53721 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
53722 address to be deferred, and routing retry data to be created for it. This is
53723 used to delay processing of the address in subsequent queue runs, until its
53724 routing retry time arrives. This applies to all messages, but because it
53725 operates only in queue runs, one attempt will be made to deliver a new message
53726 to the failing address before the delay starts to operate. This ensures that,
53727 if the failure is really related to the message rather than the recipient
53728 (<quote>message too big for this recipient</quote> is a possible example), other messages
53729 have a chance of getting delivered. If a delivery to the address does succeed,
53730 the retry information gets cleared, so all stuck messages get tried again, and
53731 the retry clock is reset.
53734 The message is not added to the list of those waiting for this host. Use of the
53735 host for other messages is unaffected, and except in the case of a timeout,
53736 other recipients are processed independently, and may be successfully delivered
53737 in the current SMTP session. After a timeout it is of course impossible to
53738 proceed with the session, so all addresses get deferred. However, those other
53739 than the one that failed do not suffer any subsequent retry delays. Therefore,
53740 if one recipient is causing trouble, the others have a chance of getting
53741 through when a subsequent delivery attempt occurs before the failing
53742 recipient’s retry time.
53744 </listitem></varlistentry>
53747 In all cases, if there are other hosts (or IP addresses) available for the
53748 current set of addresses (for example, from multiple MX records), they are
53749 tried in this run for any undelivered addresses, subject of course to their
53750 own retry data. In other words, recipient error retry data does not take effect
53751 until the next delivery attempt.
53754 Some hosts have been observed to give temporary error responses to every
53755 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
53756 would be nice if such circumstances could be recognized, and defer data for the
53757 host itself created, but this is not possible within the current Exim design.
53758 What actually happens is that retry data for every (host, message) combination
53762 The reason that timeouts after MAIL and RCPT are treated specially is that
53763 these can sometimes arise as a result of the remote host’s verification
53764 procedures. Exim makes this assumption, and treats them as if a temporary error
53765 response had been received. A timeout after <quote>.</quote> is treated specially because
53766 it is known that some broken implementations fail to recognize the end of the
53767 message if the last character of the last line is a binary zero. Thus, it is
53768 helpful to treat this case as a message error.
53771 Timeouts at other times are treated as host errors, assuming a problem with the
53772 host, or the connection to it. If a timeout after MAIL, RCPT,
53773 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
53774 the timeout is likely to occur at some other point in the dialogue, causing it
53775 then to be treated as a host error.
53778 There is experimental evidence that some MTAs drop the connection after the
53779 terminating <quote>.</quote> if they do not like the contents of the message for some
53780 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
53781 should be given. That is why Exim treats this case as a message rather than a
53782 host error, in order not to delay other messages to the same host.
53786 <title>Incoming SMTP messages over TCP/IP</title>
53788 <indexterm role="concept">
53789 <primary>SMTP</primary>
53790 <secondary>incoming over TCP/IP</secondary>
53792 <indexterm role="concept">
53793 <primary>incoming SMTP over TCP/IP</primary>
53795 <indexterm role="concept">
53796 <primary>inetd</primary>
53798 <indexterm role="concept">
53799 <primary>daemon</primary>
53801 Incoming SMTP messages can be accepted in one of two ways: by running a
53802 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
53803 <filename>/etc/inetd.conf</filename> should be like this:
53805 <literallayout class="monospaced">
53806 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
53809 Exim distinguishes between this case and the case of a locally running user
53810 agent using the <option>-bs</option> option by checking whether or not the standard input is
53811 a socket. When it is, either the port must be privileged (less than 1024), or
53812 the caller must be root or the Exim user. If any other user passes a socket
53813 with an unprivileged port number, Exim prints a message on the standard error
53814 stream and exits with an error code.
53817 By default, Exim does not make a log entry when a remote host connects or
53818 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
53819 unexpected. It can be made to write such log entries by setting the
53820 <option>smtp_connection</option> log selector.
53823 <indexterm role="concept">
53824 <primary>carriage return</primary>
53826 <indexterm role="concept">
53827 <primary>linefeed</primary>
53829 Commands from the remote host are supposed to be terminated by CR followed by
53830 LF. However, there are known to be hosts that do not send CR characters. In
53831 order to be able to interwork with such hosts, Exim treats LF on its own as a
53833 Furthermore, because common code is used for receiving messages from all
53834 sources, a CR on its own is also interpreted as a line terminator. However, the
53835 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
53838 <indexterm role="concept">
53839 <primary>EHLO</primary>
53840 <secondary>invalid data</secondary>
53842 <indexterm role="concept">
53843 <primary>HELO</primary>
53844 <secondary>invalid data</secondary>
53846 One area that sometimes gives rise to problems concerns the EHLO or
53847 HELO commands. Some clients send syntactically invalid versions of these
53848 commands, which Exim rejects by default. (This is nothing to do with verifying
53849 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
53850 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
53851 match the broken hosts that send invalid commands.
53854 <indexterm role="concept">
53855 <primary>SIZE option on MAIL command</primary>
53857 <indexterm role="concept">
53858 <primary>MAIL</primary>
53859 <secondary>SIZE option</secondary>
53861 The amount of disk space available is checked whenever SIZE is received on
53862 a MAIL command, independently of whether <option>message_size_limit</option> or
53863 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
53864 false. A temporary error is given if there is not enough space. If
53865 <option>check_spool_space</option> is set, the check is for that amount of space plus the
53866 value given with SIZE, that is, it checks that the addition of the incoming
53867 message will not reduce the space below the threshold.
53870 When a message is successfully received, Exim includes the local message id in
53871 its response to the final <quote>.</quote> that terminates the data. If the remote host
53872 logs this text it can help with tracing what has happened to a message.
53875 The Exim daemon can limit the number of simultaneous incoming connections it is
53876 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
53877 number of simultaneous incoming connections from a single remote host (see the
53878 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
53879 rejected using the SMTP temporary error code 421.
53882 The Exim daemon does not rely on the SIGCHLD signal to detect when a
53883 subprocess has finished, as this can get lost at busy times. Instead, it looks
53884 for completed subprocesses every time it wakes up. Provided there are other
53885 things happening (new incoming calls, starts of queue runs), completed
53886 processes will be noticed and tidied away. On very quiet systems you may
53887 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
53888 it will be noticed when the daemon next wakes up.
53891 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
53892 and can also be set up to reject SMTP calls from non-reserved hosts at times of
53893 high system load – for details see the <option>smtp_accept_reserve</option>,
53894 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
53895 applies in both the daemon and <emphasis>inetd</emphasis> cases.
53898 Exim normally starts a delivery process for each message received, though this
53899 can be varied by means of the <option>-odq</option> command line option and the
53900 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
53901 number of simultaneously running delivery processes started in this way from
53902 SMTP input can be limited by the <option>smtp_accept_queue</option> and
53903 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
53904 subsequently received messages are just put on the input queue without starting
53905 a delivery process.
53908 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
53909 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
53910 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
53911 handled by an entirely independent Exim process. Control by load average is,
53912 however, available with <emphasis>inetd</emphasis>.
53915 Exim can be configured to verify addresses in incoming SMTP commands as they
53916 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
53917 to rewrite addresses at this time – before any syntax checking is done. See
53918 section <xref linkend="SECTrewriteS"/>.
53921 Exim can also be configured to limit the rate at which a client host submits
53922 MAIL and RCPT commands in a single SMTP session. See the
53923 <option>smtp_ratelimit_hosts</option> option.
53927 <title>Unrecognized SMTP commands</title>
53929 <indexterm role="concept">
53930 <primary>SMTP</primary>
53931 <secondary>unrecognized commands</secondary>
53933 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
53934 commands during a single SMTP connection, it drops the connection after sending
53935 the error response to the last command. The default value for
53936 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
53937 abuse that subvert web servers into making connections to SMTP ports; in these
53938 circumstances, a number of non-SMTP lines are sent first.
53942 <title>Syntax and protocol errors in SMTP commands</title>
53944 <indexterm role="concept">
53945 <primary>SMTP</primary>
53946 <secondary>syntax errors</secondary>
53948 <indexterm role="concept">
53949 <primary>SMTP</primary>
53950 <secondary>protocol errors</secondary>
53952 A syntax error is detected if an SMTP command is recognized, but there is
53953 something syntactically wrong with its data, for example, a malformed email
53954 address in a RCPT command. Protocol errors include invalid command
53955 sequencing such as RCPT before MAIL. If Exim receives more than
53956 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
53957 drops the connection after sending the error response to the last command. The
53958 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
53959 broken clients that loop sending bad commands (yes, it has been seen).
53963 <title>Use of non-mail SMTP commands</title>
53965 <indexterm role="concept">
53966 <primary>SMTP</primary>
53967 <secondary>non-mail commands</secondary>
53969 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
53970 DATA. Exim counts such commands, and drops the connection if there are too
53971 many of them in a single SMTP session. This action catches some
53972 denial-of-service attempts and things like repeated failing AUTHs, or a mad
53973 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
53974 defines what <quote>too many</quote> means. Its default value is 10.
53977 When a new message is expected, one occurrence of RSET is not counted. This
53978 allows a client to send one RSET between messages (this is not necessary,
53979 but some clients do it). Exim also allows one uncounted occurence of HELO
53980 or EHLO, and one occurrence of STARTTLS between messages. After
53981 starting up a TLS session, another EHLO is expected, and so it too is not
53985 The first occurrence of AUTH in a connection, or immediately following
53986 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
53987 RCPT, DATA, and QUIT are counted.
53990 You can control which hosts are subject to the limit set by
53991 <option>smtp_accept_max_nonmail</option> by setting
53992 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
53993 the limit apply to all hosts. This option means that you can exclude any
53994 specific badly-behaved hosts that you have to live with.
53998 <title>The VRFY and EXPN commands</title>
54000 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
54001 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
54002 appropriate) in order to decide whether the command should be accepted or not.
54003 If no ACL is defined, the command is rejected.
54006 <indexterm role="concept">
54007 <primary>VRFY</primary>
54008 <secondary>processing</secondary>
54010 When VRFY is accepted, it runs exactly the same code as when Exim is
54011 called with the <option>-bv</option> option.
54014 <indexterm role="concept">
54015 <primary>EXPN</primary>
54016 <secondary>processing</secondary>
54018 When EXPN is accepted, a single-level expansion of the address is done.
54019 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
54020 than a verification (the <option>-bv</option> option). If an unqualified local part is given
54021 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
54022 of VRFY and EXPN commands are logged on the main and reject logs, and
54023 VRFY verification failures are logged on the main log for consistency with
54027 <section id="SECTETRN">
54028 <title>The ETRN command</title>
54030 <indexterm role="concept">
54031 <primary>ETRN</primary>
54032 <secondary>processing</secondary>
54034 RFC 1985 describes an SMTP command called ETRN that is designed to
54035 overcome the security problems of the TURN command (which has fallen into
54036 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
54037 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
54038 should be accepted or not. If no ACL is defined, the command is rejected.
54041 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
54042 delivery to certain hosts. As Exim does not organize its message queue by host,
54043 the only form of ETRN that is supported by default is the one where the
54044 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
54045 specific to the SMTP server. A valid ETRN command causes a run of Exim with
54046 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
54047 argument. For example,
54049 <literallayout class="monospaced">
54055 <literallayout class="monospaced">
54059 which causes a delivery attempt on all messages with undelivered addresses
54060 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
54061 default), Exim prevents the simultaneous execution of more than one queue run
54062 for the same argument string as a result of an ETRN command. This stops
54063 a misbehaving client from starting more than one queue runner at once.
54066 <indexterm role="concept">
54067 <primary>hints database</primary>
54068 <secondary>ETRN serialization</secondary>
54070 Exim implements the serialization by means of a hints database in which a
54071 record is written whenever a process is started by ETRN, and deleted when
54072 the process completes. However, Exim does not keep the SMTP session waiting for
54073 the ETRN process to complete. Once ETRN is accepted, the client is sent
54074 a <quote>success</quote> return code. Obviously there is scope for hints records to get
54075 left lying around if there is a system or program crash. To guard against this,
54076 Exim ignores any records that are more than six hours old.
54079 <indexterm role="concept">
54080 <primary><option>smtp_etrn_command</option></primary>
54082 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
54083 used. This specifies a command that is run whenever ETRN is received,
54084 whatever the form of its argument. For
54087 <literallayout class="monospaced">
54088 smtp_etrn_command = /etc/etrn_command $domain \
54089 $sender_host_address
54092 <indexterm role="concept">
54093 <primary><varname>$domain</varname></primary>
54095 The string is split up into arguments which are independently expanded. The
54096 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
54097 and no syntax checking is done on the contents of this argument. Exim does not
54098 wait for the command to complete, so its status code is not checked. Exim runs
54099 under its own uid and gid when receiving incoming SMTP, so it is not possible
54100 for it to change them before running the command.
54104 <title>Incoming local SMTP</title>
54106 <indexterm role="concept">
54107 <primary>SMTP</primary>
54108 <secondary>local incoming</secondary>
54110 Some user agents use SMTP to pass messages to their local MTA using the
54111 standard input and output, as opposed to passing the envelope on the command
54112 line and writing the message to the standard input. This is supported by the
54113 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
54114 messages over TCP/IP (including the use of ACLs), except that the envelope
54115 sender given in a MAIL command is ignored unless the caller is trusted. In
54116 an ACL you can detect this form of SMTP input by testing for an empty host
54117 identification. It is common to have this as the first line in the ACL that
54118 runs for RCPT commands:
54120 <literallayout class="monospaced">
54124 This accepts SMTP messages from local processes without doing any other tests.
54127 <section id="SECTbatchSMTP">
54128 <title>Outgoing batched SMTP</title>
54130 <indexterm role="concept">
54131 <primary>SMTP</primary>
54132 <secondary>batched outgoing</secondary>
54134 <indexterm role="concept">
54135 <primary>batched SMTP output</primary>
54137 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
54138 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
54139 be output in BSMTP format. No SMTP responses are possible for this form of
54140 delivery. All it is doing is using SMTP commands as a way of transmitting the
54141 envelope along with the message.
54144 The message is written to the file or pipe preceded by the SMTP commands
54145 MAIL and RCPT, and followed by a line containing a single dot. Lines in
54146 the message that start with a dot have an extra dot added. The SMTP command
54147 HELO is not normally used. If it is required, the <option>message_prefix</option> option
54148 can be used to specify it.
54151 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
54152 one recipient address at a time by default. However, you can arrange for them
54153 to handle several addresses at once by setting the <option>batch_max</option> option. When
54154 this is done for BSMTP, messages may contain multiple RCPT commands. See
54155 chapter <xref linkend="CHAPbatching"/> for more details.
54158 <indexterm role="concept">
54159 <primary><varname>$host</varname></primary>
54161 When one or more addresses are routed to a BSMTP transport by a router that
54162 sets up a host list, the name of the first host on the list is available to the
54163 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
54166 <literallayout class="monospaced">
54169 driver = manualroute
54170 transport = smtp_appendfile
54171 route_list = domain.example batch.host.example
54175 driver = appendfile
54176 directory = /var/bsmtp/$host
54182 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
54183 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
54184 message (unless there are more than 1000 recipients).
54187 <section id="SECTincomingbatchedSMTP">
54188 <title>Incoming batched SMTP</title>
54190 <indexterm role="concept">
54191 <primary>SMTP</primary>
54192 <secondary>batched incoming</secondary>
54194 <indexterm role="concept">
54195 <primary>batched SMTP input</primary>
54197 The <option>-bS</option> command line option causes Exim to accept one or more messages by
54198 reading SMTP on the standard input, but to generate no responses. If the caller
54199 is trusted, the senders in the MAIL commands are believed; otherwise the
54200 sender is always the caller of Exim. Unqualified senders and receivers are not
54201 rejected (there seems little point) but instead just get qualified. HELO
54202 and EHLO act as RSET; VRFY, EXPN, ETRN and HELP, act
54203 as NOOP; QUIT quits.
54206 No policy checking is done for BSMTP input. That is, no ACL is run at anytime.
54207 In this respect it is like non-SMTP local input.
54210 If an error is detected while reading a message, including a missing <quote>.</quote> at
54211 the end, Exim gives up immediately. It writes details of the error to the
54212 standard output in a stylized way that the calling program should be able to
54213 make some use of automatically, for example:
54215 <literallayout class="monospaced">
54216 554 Unexpected end of file
54217 Transaction started in line 10
54218 Error detected in line 14
54221 It writes a more verbose version, for human consumption, to the standard error
54224 <literallayout class="monospaced">
54225 An error was detected while processing a file of BSMTP input.
54226 The error message was:
54228 501 '>' missing at end of address
54230 The SMTP transaction started in line 10.
54231 The error was detected in line 12.
54232 The SMTP command at fault was:
54234 rcpt to:<malformed@in.com.plete
54236 1 previous message was successfully processed.
54237 The rest of the batch was abandoned.
54240 The return code from Exim is zero only if there were no errors. It is 1 if some
54241 messages were accepted before an error was detected, and 2 if no messages were
54243 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
54244 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
54249 <chapter id="CHAPemsgcust">
54250 <title>Customizing bounce and warning messages</title>
54251 <titleabbrev>Customizing messages</titleabbrev>
54253 When a message fails to be delivered, or remains on the queue for more than a
54254 configured amount of time, Exim sends a message to the original sender, or
54255 to an alternative configured address. The text of these messages is built into
54256 the code of Exim, but it is possible to change it, either by adding a single
54257 string, or by replacing each of the paragraphs by text supplied in a file.
54260 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
54261 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
54262 option. Exim also adds the line
54264 <literallayout class="monospaced">
54265 Auto-Submitted: auto-generated
54268 to all warning and bounce messages,
54271 <title>Customizing bounce messages</title>
54273 <indexterm role="concept">
54274 <primary>customizing</primary>
54275 <secondary>bounce message</secondary>
54277 <indexterm role="concept">
54278 <primary>bounce message</primary>
54279 <secondary>customizing</secondary>
54281 If <option>bounce_message_text</option> is set, its contents are included in the default
54282 message immediately after <quote>This message was created automatically by mail
54283 delivery software.</quote> The string is not expanded. It is not used if
54284 <option>bounce_message_file</option> is set.
54287 When <option>bounce_message_file</option> is set, it must point to a template file for
54288 constructing error messages. The file consists of a series of text items,
54289 separated by lines consisting of exactly four asterisks. If the file cannot be
54290 opened, default text is used and a message is written to the main and panic
54291 logs. If any text item in the file is empty, default text is used for that
54295 <indexterm role="concept">
54296 <primary><varname>$bounce_recipient</varname></primary>
54298 <indexterm role="concept">
54299 <primary><varname>$bounce_return_size_limit</varname></primary>
54301 Each item of text that is read from the file is expanded, and there are two
54302 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
54303 the recipient of an error message while it is being created, and
54304 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
54305 option, rounded to a whole number.
54308 The items must appear in the file in the following order:
54313 The first item is included in the headers, and should include at least a
54314 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
54319 The second item forms the start of the error message. After it, Exim lists the
54320 failing addresses with their error messages.
54325 The third item is used to introduce any text from pipe transports that is to be
54326 returned to the sender. It is omitted if there is no such text.
54331 The fourth item is used to introduce the copy of the message that is returned
54332 as part of the error report.
54337 The fifth item is added after the fourth one if the returned message is
54338 truncated because it is bigger than <option>return_size_limit</option>.
54343 The sixth item is added after the copy of the original message.
54348 The default state (<option>bounce_message_file</option> unset) is equivalent to the
54349 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
54350 other lines have been split in order to fit them on the page:
54352 <literallayout class="monospaced">
54353 Subject: Mail delivery failed
54354 ${if eq{$sender_address}{$bounce_recipient}
54355 {: returning message to sender}}
54357 This message was created automatically by mail delivery software.
54359 A message ${if eq{$sender_address}{$bounce_recipient}
54360 {that you sent }{sent by
54362 <$sender_address>
54364 }}could not be delivered to all of its recipients.
54365 The following address(es) failed:
54367 The following text was generated during the delivery attempt(s):
54369 ------ This is a copy of the message, including all the headers.
54372 ------ The body of the message is $message_size characters long;
54374 ------ $bounce_return_size_limit or so are included here.
54378 <section id="SECTcustwarn">
54379 <title>Customizing warning messages</title>
54381 <indexterm role="concept">
54382 <primary>customizing</primary>
54383 <secondary>warning message</secondary>
54385 <indexterm role="concept">
54386 <primary>warning of delay</primary>
54387 <secondary>customizing the message</secondary>
54389 The option <option>warn_message_file</option> can be pointed at a template file for use when
54390 warnings about message delays are created. In this case there are only three
54396 The first item is included in the headers, and should include at least a
54397 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
54402 The second item forms the start of the warning message. After it, Exim lists
54403 the delayed addresses.
54408 The third item then ends the message.
54413 The default state is equivalent to the following file, except that some lines
54414 have been split here, in order to fit them on the page:
54416 <literallayout class="monospaced">
54417 Subject: Warning: message $message_exim_id delayed
54418 $warn_message_delay
54420 This message was created automatically by mail delivery software.
54422 A message ${if eq{$sender_address}{$warn_message_recipients}
54423 {that you sent }{sent by
54425 <$sender_address>
54427 }}has not been delivered to all of its recipients after
54428 more than $warn_message_delay on the queue on $primary_hostname.
54430 The message identifier is: $message_exim_id
54431 The subject of the message is: $h_subject
54432 The date of the message is: $h_date
54434 The following address(es) have not yet been delivered:
54436 No action is required on your part. Delivery attempts will
54437 continue for some time, and this warning may be repeated at
54438 intervals if the message remains undelivered. Eventually the
54439 mail delivery software will give up, and when that happens,
54440 the message will be returned to you.
54443 <indexterm role="concept">
54444 <primary><varname>$warn_message_delay</varname></primary>
54446 <indexterm role="concept">
54447 <primary><varname>$warn_message_recipients</varname></primary>
54449 However, in the default state the subject and date lines are omitted if no
54450 appropriate headers exist. During the expansion of this file,
54451 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote><<emphasis>n</emphasis>>
54452 minutes</quote> or <quote><<emphasis>n</emphasis>> hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
54453 of recipients for the warning message. There may be more than one if there are
54454 multiple addresses with different <option>errors_to</option> settings on the routers that
54460 <chapter id="CHAPcomconreq">
54461 <title>Some common configuration settings</title>
54463 This chapter discusses some configuration settings that seem to be fairly
54464 common. More examples and discussion can be found in the Exim book.
54467 <title>Sending mail to a smart host</title>
54469 <indexterm role="concept">
54470 <primary>smart host</primary>
54471 <secondary>example router</secondary>
54473 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
54474 should replace the default <command>dnslookup</command> router with a router which does the
54475 routing explicitly:
54477 <literallayout class="monospaced">
54478 send_to_smart_host:
54479 driver = manualroute
54480 route_list = !+local_domains smart.host.name
54481 transport = remote_smtp
54484 You can use the smart host’s IP address instead of the name if you wish.
54485 If you are using Exim only to submit messages to a smart host, and not for
54486 receiving incoming messages, you can arrange for it to do the submission
54487 synchronously by setting the <option>mua_wrapper</option> option (see chapter
54488 <xref linkend="CHAPnonqueueing"/>).
54491 <section id="SECTmailinglists">
54492 <title>Using Exim to handle mailing lists</title>
54494 <indexterm role="concept">
54495 <primary>mailing lists</primary>
54497 Exim can be used to run simple mailing lists, but for large and/or complicated
54498 requirements, the use of additional specialized mailing list software such as
54499 Majordomo or Mailman is recommended.
54502 The <command>redirect</command> router can be used to handle mailing lists where each list
54503 is maintained in a separate file, which can therefore be managed by an
54504 independent manager. The <option>domains</option> router option can be used to run these
54505 lists in a separate domain from normal mail. For example:
54507 <literallayout class="monospaced">
54510 domains = lists.example
54511 file = /usr/lists/$local_part
54514 errors_to = $local_part-request@lists.example
54518 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
54519 in that domain, it looks for a file that matches the local part. If there is no
54520 such file, the router declines, but because <option>no_more</option> is set, no subsequent
54521 routers are tried, and so the whole delivery fails.
54524 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
54525 expanded into a file name or a pipe delivery, which is usually inappropriate in
54529 <indexterm role="concept">
54530 <primary><option>errors_to</option></primary>
54532 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
54533 taken from a mailing list are to be sent to the given address rather than the
54534 original sender of the message. However, before acting on this, Exim verifies
54535 the error address, and ignores it if verification fails.
54538 For example, using the configuration above, mail sent to
54539 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
54540 <filename>/usr/lists/dicts</filename>, with error reports directed to
54541 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
54542 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
54543 the address(es) of this particular list’s manager(s), but other approaches,
54544 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
54545 or <option>local_part_suffix</option> options) to handle addresses of the form
54546 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
54550 <title>Syntax errors in mailing lists</title>
54552 <indexterm role="concept">
54553 <primary>mailing lists</primary>
54554 <secondary>syntax errors in</secondary>
54556 If an entry in redirection data contains a syntax error, Exim normally defers
54557 delivery of the original address. That means that a syntax error in a mailing
54558 list holds up all deliveries to the list. This may not be appropriate when a
54559 list is being maintained automatically from data supplied by users, and the
54560 addresses are not rigorously checked.
54563 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
54564 entries that fail to parse, noting the incident in the log. If in addition
54565 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
54566 whenever a broken address is skipped. It is usually appropriate to set
54567 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
54571 <title>Re-expansion of mailing lists</title>
54573 <indexterm role="concept">
54574 <primary>mailing lists</primary>
54575 <secondary>re-expansion of</secondary>
54577 Exim remembers every individual address to which a message has been delivered,
54578 in order to avoid duplication, but it normally stores only the original
54579 recipient addresses with a message. If all the deliveries to a mailing list
54580 cannot be done at the first attempt, the mailing list is re-expanded when the
54581 delivery is next tried. This means that alterations to the list are taken into
54582 account at each delivery attempt, so addresses that have been added to
54583 the list since the message arrived will therefore receive a copy of the
54584 message, even though it pre-dates their subscription.
54587 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
54588 on the <command>redirect</command> router. If this is done, any addresses generated by the
54589 router that fail to deliver at the first attempt are added to the message as
54590 <quote>top level</quote> addresses, and the parent address that generated them is marked
54591 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
54592 subsequent delivery attempts. The disadvantage of this is that if any of the
54593 failing addresses are incorrect, correcting them in the file has no effect on
54594 pre-existing messages.
54597 The original top-level address is remembered with each of the generated
54598 addresses, and is output in any log messages. However, any intermediate parent
54599 addresses are not recorded. This makes a difference to the log only if the
54600 <option>all_parents</option> selector is set, but for mailing lists there is normally only
54601 one level of expansion anyway.
54605 <title>Closed mailing lists</title>
54607 <indexterm role="concept">
54608 <primary>mailing lists</primary>
54609 <secondary>closed</secondary>
54611 The examples so far have assumed open mailing lists, to which anybody may
54612 send mail. It is also possible to set up closed lists, where mail is accepted
54613 from specified senders only. This is done by making use of the generic
54614 <option>senders</option> option to restrict the router that handles the list.
54617 The following example uses the same file as a list of recipients and as a list
54618 of permitted senders. It requires three routers:
54620 <literallayout class="monospaced">
54623 domains = lists.example
54624 local_part_suffix = -request
54625 file = /usr/lists/$local_part$local_part_suffix
54630 domains = lists.example
54631 senders = ${if exists {/usr/lists/$local_part}\
54632 {lsearch;/usr/lists/$local_part}{*}}
54633 file = /usr/lists/$local_part
54636 errors_to = $local_part-request@lists.example
54641 domains = lists.example
54643 data = :fail: $local_part@lists.example is a closed mailing list
54646 All three routers have the same <option>domains</option> setting, so for any other domains,
54647 they are all skipped. The first router runs only if the local part ends in
54648 <option>-request</option>. It handles messages to the list manager(s) by means of an open
54652 The second router runs only if the <option>senders</option> precondition is satisfied. It
54653 checks for the existence of a list that corresponds to the local part, and then
54654 checks that the sender is on the list by means of a linear search. It is
54655 necessary to check for the existence of the file before trying to search it,
54656 because otherwise Exim thinks there is a configuration error. If the file does
54657 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
54658 means that the router runs, but because there is no list, declines, and
54659 <option>no_more</option> ensures that no further routers are run. The address fails with an
54660 <quote>unrouteable address</quote> error.
54663 The third router runs only if the second router is skipped, which happens when
54664 a mailing list exists, but the sender is not on it. This router forcibly fails
54665 the address, giving a suitable error message.
54668 <section id="SECTverp">
54669 <title>Variable Envelope Return Paths (VERP)</title>
54671 <indexterm role="concept">
54672 <primary>VERP</primary>
54674 <indexterm role="concept">
54675 <primary>Variable Envelope Return Paths</primary>
54677 <indexterm role="concept">
54678 <primary>envelope sender</primary>
54680 Variable Envelope Return Paths – see <emphasis role="bold"><ulink url="http://cr.yp.to/proto/verp.txt">http://cr.yp.to/proto/verp.txt</ulink></emphasis> –
54681 are a way of helping mailing list administrators discover which subscription
54682 address is the cause of a particular delivery failure. The idea is to encode
54683 the original recipient address in the outgoing envelope sender address, so that
54684 if the message is forwarded by another host and then subsequently bounces, the
54685 original recipient can be extracted from the recipient address of the bounce.
54688 <indexterm role="option">
54689 <primary><option>errors_to</option></primary>
54691 <indexterm role="option">
54692 <primary><option>return_path</option></primary>
54694 Envelope sender addresses can be modified by Exim using two different
54695 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
54696 list examples), or the <option>return_path</option> option on a transport. The second of
54697 these is effective only if the message is successfully delivered to another
54698 host; it is not used for errors detected on the local host (see the description
54699 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
54700 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
54702 <literallayout class="monospaced">
54707 ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
54708 {$1-request=$local_part%$domain@your.dom.example}fail}
54711 This has the effect of rewriting the return path (envelope sender) on outgoing
54712 SMTP messages, if the local part of the original return path ends in
54713 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
54714 local part and domain of the recipient into the return path. Suppose, for
54715 example, that a message whose return path has been set to
54716 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
54717 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
54720 <literallayout class="monospaced">
54721 somelist-request=subscriber%other.dom.example@your.dom.example
54723 <para revisionflag="changed">
54724 <indexterm role="concept">
54725 <primary><varname>$local_part</varname></primary>
54727 For this to work, you must tell Exim to send multiple copies of messages that
54728 have more than one recipient, so that each copy has just one recipient. This is
54729 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
54730 might be sent to several different recipients in the same domain, in which case
54731 <varname>$local_part</varname> is not available in the transport, because it is not unique.
54733 <para revisionflag="changed">
54734 Unless your host is doing nothing but mailing list deliveries, you should
54735 probably use a separate transport for the VERP deliveries, so as not to use
54736 extra resources in making one-per-recipient copies for other deliveries. This
54737 can easily be done by expanding the <option>transport</option> option in the router:
54739 <literallayout class="monospaced">
54742 domains = ! +local_domains
54744 ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
54745 {verp_smtp}{remote_smtp}}
54749 If you want to change the return path using <option>errors_to</option> in a router instead
54750 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
54751 routers that handle mailing list addresses. This will ensure that all delivery
54752 errors, including those detected on the local host, are sent to the VERP
54756 On a host that does no local deliveries and has no manual routing, only the
54757 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
54758 SMTP deliveries. Every mailing list recipient has its own return path value,
54759 and so Exim must hand them to the transport one at a time. Here is an example
54760 of a <command>dnslookup</command> router that implements VERP:
54762 <literallayout class="monospaced">
54765 domains = ! +local_domains
54766 transport = remote_smtp
54768 ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
54769 {$1-request=$local_part%$domain@your.dom.example}fail}
54773 Before you start sending out messages with VERPed return paths, you must also
54774 configure Exim to accept the bounce messages that come back to those paths.
54775 Typically this is done by setting a <option>local_part_suffix</option> option for a
54776 router, and using this to route the messages to wherever you want to handle
54780 The overhead incurred in using VERP depends very much on the size of the
54781 message, the number of recipient addresses that resolve to the same remote
54782 host, and the speed of the connection over which the message is being sent. If
54783 a lot of addresses resolve to the same host and the connection is slow, sending
54784 a separate copy of the message for each address may take substantially longer
54785 than sending a single copy with many recipients (for which VERP cannot be
54789 <section id="SECTvirtualdomains">
54790 <title>Virtual domains</title>
54792 <indexterm role="concept">
54793 <primary>virtual domains</primary>
54795 <indexterm role="concept">
54796 <primary>domain</primary>
54797 <secondary>virtual</secondary>
54799 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
54805 A domain for which there are no real mailboxes; all valid local parts are
54806 aliases for other email addresses. Common examples are organizational
54807 top-level domains and <quote>vanity</quote> domains.
54812 One of a number of independent domains that are all handled by the same host,
54813 with mailboxes on that host, but where the mailbox owners do not necessarily
54814 have login accounts on that host.
54819 The first usage is probably more common, and does seem more <quote>virtual</quote> than
54820 the second. This kind of domain can be handled in Exim with a straightforward
54821 aliasing router. One approach is to create a separate alias file for each
54822 virtual domain. Exim can test for the existence of the alias file to determine
54823 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
54824 to a router of this form:
54826 <literallayout class="monospaced">
54829 domains = dsearch;/etc/mail/virtual
54830 data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
54834 The <option>domains</option> option specifies that the router is to be skipped, unless there
54835 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
54836 domain that is being processed. When the router runs, it looks up the local
54837 part in the file to find a new address (or list of addresses). The <option>no_more</option>
54838 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
54839 string), Exim gives up on the address without trying any subsequent routers.
54842 This one router can handle all the virtual domains because the alias file names
54843 follow a fixed pattern. Permissions can be arranged so that appropriate people
54844 can edit the different alias files. A successful aliasing operation results in
54845 a new envelope recipient address, which is then routed from scratch.
54848 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
54849 way. One approach is to create a file for each domain containing a list of
54850 valid local parts, and use it in a router like this:
54852 <literallayout class="monospaced">
54855 domains = dsearch;/etc/mail/domains
54856 local_parts = lsearch;/etc/mail/domains/$domain
54857 transport = my_mailboxes
54860 The address is accepted if there is a file for the domain, and the local part
54861 can be found in the file. The <option>domains</option> option is used to check for the
54862 file’s existence because <option>domains</option> is tested before the <option>local_parts</option>
54863 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
54864 because that option is tested after <option>local_parts</option>. The transport is as
54867 <literallayout class="monospaced">
54869 driver = appendfile
54870 file = /var/mail/$domain/$local_part
54874 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
54875 required, to specify which uid is to be used for writing to the mailboxes.
54878 The configuration shown here is just one example of how you might support this
54879 requirement. There are many other ways this kind of configuration can be set
54880 up, for example, by using a database instead of separate files to hold all the
54881 information about the domains.
54884 <section id="SECTmulbox">
54885 <title>Multiple user mailboxes</title>
54887 <indexterm role="concept">
54888 <primary>multiple mailboxes</primary>
54890 <indexterm role="concept">
54891 <primary>mailbox</primary>
54892 <secondary>multiple</secondary>
54894 <indexterm role="concept">
54895 <primary>local part</primary>
54896 <secondary>prefix</secondary>
54898 <indexterm role="concept">
54899 <primary>local part</primary>
54900 <secondary>suffix</secondary>
54902 Heavy email users often want to operate with multiple mailboxes, into which
54903 incoming mail is automatically sorted. A popular way of handling this is to
54904 allow users to use multiple sender addresses, so that replies can easily be
54905 identified. Users are permitted to add prefixes or suffixes to their local
54906 parts for this purpose. The wildcard facility of the generic router options
54907 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
54908 example, consider this router:
54910 <literallayout class="monospaced">
54914 file = $home/.forward
54915 local_part_suffix = -*
54916 local_part_suffix_optional
54920 <indexterm role="concept">
54921 <primary><varname>$local_part_suffix</varname></primary>
54923 It runs a user’s <filename>.forward</filename> file for all local parts of the form
54924 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
54925 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
54927 <literallayout class="monospaced">
54928 if $local_part_suffix contains -special then
54929 save /home/$local_part/Mail/special
54933 If the filter file does not exist, or does not deal with such addresses, they
54934 fall through to subsequent routers, and, assuming no subsequent use of the
54935 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
54936 control over which suffixes are valid.
54939 Alternatively, a suffix can be used to trigger the use of a different
54940 <filename>.forward</filename> file – which is the way a similar facility is implemented in
54943 <literallayout class="monospaced">
54947 file = $home/.forward$local_part_suffix
54948 local_part_suffix = -*
54949 local_part_suffix_optional
54953 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
54954 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
54955 does not exist, or does not deal with the address, it is passed on to
54956 subsequent routers, which could, if required, look for an unqualified
54957 <filename>.forward</filename> file to use as a default.
54961 <title>Simplified vacation processing</title>
54963 <indexterm role="concept">
54964 <primary>vacation processing</primary>
54966 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
54967 a pipe command in a <filename>.forward</filename> file
54968 (see section <xref linkend="SECTspecitredli"/> for syntax details).
54969 This is prone to error by inexperienced users. There are two features of Exim
54970 that can be used to make this process simpler for users:
54975 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
54976 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
54977 alternatively can use Exim’s <command>autoreply</command> transport. The contents of a user’s
54978 <filename>.forward</filename> file are then much simpler. For example:
54980 <literallayout class="monospaced">
54981 spqr, vacation-spqr
54986 The <option>require_files</option> generic router option can be used to trigger a
54987 vacation delivery by checking for the existence of a certain file in the
54988 user’s home directory. The <option>unseen</option> generic option should also be used, to
54989 ensure that the original delivery also proceeds. In this case, all the user has
54990 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
54996 Another advantage of both these methods is that they both work even when the
54997 use of arbitrary pipes by users is locked out.
55001 <title>Taking copies of mail</title>
55003 <indexterm role="concept">
55004 <primary>message</primary>
55005 <secondary>copying every</secondary>
55007 Some installations have policies that require archive copies of all messages to
55008 be made. A single copy of each message can easily be taken by an appropriate
55009 command in a system filter, which could, for example, use a different file for
55010 each day’s messages.
55013 There is also a shadow transport mechanism that can be used to take copies of
55014 messages that are successfully delivered by local transports, one copy per
55015 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
55016 notification of delivery by sites that insist on doing such things.
55020 <title>Intermittently connected hosts</title>
55022 <indexterm role="concept">
55023 <primary>intermittently connected hosts</primary>
55025 It has become quite common (because it is cheaper) for hosts to connect to the
55026 Internet periodically rather than remain connected all the time. The normal
55027 arrangement is that mail for such hosts accumulates on a system that is
55028 permanently connected.
55031 Exim was designed for use on permanently connected hosts, and so it is not
55032 particularly well-suited to use in an intermittently connected environment.
55033 Nevertheless there are some features that can be used.
55037 <title>Exim on the upstream server host</title>
55039 It is tempting to arrange for incoming mail for the intermittently connected
55040 host to remain on Exim’s queue until the client connects. However, this
55041 approach does not scale very well. Two different kinds of waiting message are
55042 being mixed up in the same queue – those that cannot be delivered because of
55043 some temporary problem, and those that are waiting for their destination host
55044 to connect. This makes it hard to manage the queue, as well as wasting
55045 resources, because each queue runner scans the entire queue.
55048 A better approach is to separate off those messages that are waiting for an
55049 intermittently connected host. This can be done by delivering these messages
55050 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
55051 format, from where they are transmitted by other software when their
55052 destination connects. This makes it easy to collect all the mail for one host
55053 in a single directory, and to apply local timeout rules on a per-message basis
55057 On a very small scale, leaving the mail on Exim’s queue can be made to work. If
55058 you are doing this, you should configure Exim with a long retry period for the
55059 intermittent host. For example:
55061 <literallayout class="monospaced">
55062 cheshire.wonderland.fict.example * F,5d,24h
55065 This stops a lot of failed delivery attempts from occurring, but Exim remembers
55066 which messages it has queued up for that host. Once the intermittent host comes
55067 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
55068 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
55069 causes all the queued up messages to be delivered, often down a single SMTP
55070 connection. While the host remains connected, any new messages get delivered
55074 If the connecting hosts do not have fixed IP addresses, that is, if a host is
55075 issued with a different IP address each time it connects, Exim’s retry
55076 mechanisms on the holding host get confused, because the IP address is normally
55077 used as part of the key string for holding retry information. This can be
55078 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
55079 Since this has disadvantages for permanently connected hosts, it is best to
55080 arrange a separate transport for the intermittently connected ones.
55084 <title>Exim on the intermittently connected client host</title>
55086 The value of <option>smtp_accept_queue_per_connection</option> should probably be
55087 increased, or even set to zero (that is, disabled) on the intermittently
55088 connected host, so that all incoming messages down a single connection get
55089 delivered immediately.
55092 <indexterm role="concept">
55093 <primary>SMTP</primary>
55094 <secondary>passed connection</secondary>
55096 <indexterm role="concept">
55097 <primary>SMTP</primary>
55098 <secondary>multiple deliveries</secondary>
55100 <indexterm role="concept">
55101 <primary>multiple SMTP deliveries</primary>
55103 Mail waiting to be sent from an intermittently connected host will probably
55104 not have been routed, because without a connection DNS lookups are not
55105 possible. This means that if a normal queue run is done at connection time,
55106 each message is likely to be sent in a separate SMTP session. This can be
55107 avoided by starting the queue run with a command line option beginning with
55108 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
55109 first pass, routing is done but no deliveries take place. The second pass is a
55110 normal queue run; since all the messages have been previously routed, those
55111 destined for the same host are likely to get sent as multiple deliveries in a
55112 single SMTP connection.
55117 <chapter id="CHAPnonqueueing">
55118 <title>Using Exim as a non-queueing client</title>
55119 <titleabbrev>Exim as a non-queueing client</titleabbrev>
55121 <indexterm role="concept">
55122 <primary>client</primary>
55123 <secondary>non-queueing</secondary>
55125 <indexterm role="concept">
55126 <primary>smart host</primary>
55127 <secondary>queueing; suppressing</secondary>
55129 On a personal computer, it is a common requirement for all
55130 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
55131 configured to operate that way, for all the popular operating systems.
55132 However, there are some MUAs for Unix-like systems that cannot be so
55133 configured: they submit messages using the command line interface of
55134 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
55138 If the personal computer runs continuously, there is no problem, because it can
55139 run a conventional MTA that handles delivery to the smart host, and deal with
55140 any delays via its queueing mechanism. However, if the computer does not run
55141 continuously or runs different operating systems at different times, queueing
55142 email is not desirable.
55145 There is therefore a requirement for something that can provide the
55146 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
55147 any queueing or retrying facilities. Furthermore, the delivery to the smart
55148 host should be synchronous, so that if it fails, the sending MUA is immediately
55149 informed. In other words, we want something that extends an MUA that submits
55150 to a local MTA via the command line so that it behaves like one that submits
55151 to a remote smart host using TCP/SMTP.
55154 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
55155 that do this job. However, people have found them to be lacking in various
55156 ways. For instance, you might want to allow aliasing and forwarding to be done
55157 before sending a message to the smart host.
55160 Exim already had the necessary infrastructure for doing this job. Just a few
55161 tweaks were needed to make it behave as required, though it is somewhat of an
55162 overkill to use a fully-featured MTA for this purpose.
55165 <indexterm role="concept">
55166 <primary><option>mua_wrapper</option></primary>
55168 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
55169 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
55170 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
55171 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
55172 compatible router and transport configuration. Typically there will be just one
55173 router and one transport, sending everything to a smart host.
55176 When run in MUA wrapping mode, the behaviour of Exim changes in the
55182 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
55183 In other words, the only way to submit messages is via the command line.
55188 Each message is synchonously delivered as soon as it is received (<option>-odi</option> is
55189 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
55190 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
55191 does not finish until the delivery attempt is complete. If the delivery is
55192 successful, a zero return code is given.
55197 Address redirection is permitted, but the final routing for all addresses must
55198 be to the same remote transport, and to the same list of hosts. Furthermore,
55199 the return address (envelope sender) must be the same for all recipients, as
55200 must any added or deleted header lines. In other words, it must be possible to
55201 deliver the message in a single SMTP transaction, however many recipients there
55207 If these conditions are not met, or if routing any address results in a
55208 failure or defer status, or if Exim is unable to deliver all the recipients
55209 successfully to one of the smart hosts, delivery of the entire message fails.
55214 Because no queueing is allowed, all failures are treated as permanent; there
55215 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
55216 smart host. Furthermore, because only a single yes/no response can be given to
55217 the caller, it is not possible to deliver to some recipients and not others. If
55218 there is an error (temporary or permanent) for any recipient, all are failed.
55223 If more than one smart host is listed, Exim will try another host after a
55224 connection failure or a timeout, in the normal way. However, if this kind of
55225 failure happens for all the hosts, the delivery fails.
55230 When delivery fails, an error message is written to the standard error stream
55231 (as well as to Exim’s log), and Exim exits to the caller with a return code
55232 value 1. The message is expunged from Exim’s spool files. No bounce messages
55233 are ever generated.
55238 No retry data is maintained, and any retry rules are ignored.
55243 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
55244 true, <option>max_rcpt</option> in the smtp transport is forced to <quote>unlimited</quote>,
55245 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
55250 The overall effect is that Exim makes a single synchronous attempt to deliver
55251 the message, failing if there is any kind of problem. Because no local
55252 deliveries are done and no daemon can be run, Exim does not need root
55253 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
55254 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
55255 the advantages and disadvantages of running without root privilege.
55259 <chapter id="CHAPlog">
55260 <title>Log files</title>
55262 <indexterm role="concept" id="IIDloggen" class="startofrange">
55263 <primary>log</primary>
55264 <secondary>general description</secondary>
55266 <indexterm role="concept">
55267 <primary>log</primary>
55268 <secondary>types of</secondary>
55270 Exim writes three different logs, referred to as the main log, the reject log,
55276 <indexterm role="concept">
55277 <primary>main log</primary>
55279 The main log records the arrival of each message and each delivery in a single
55280 line in each case. The format is as compact as possible, in an attempt to keep
55281 down the size of log files. Two-character flag sequences make it easy to pick
55282 out these lines. A number of other events are recorded in the main log. Some of
55283 them are optional, in which case the <option>log_selector</option> option controls whether
55284 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
55285 analysis of main log files, is provided in the Exim distribution (see section
55286 <xref linkend="SECTmailstat"/>).
55291 <indexterm role="concept">
55292 <primary>reject log</primary>
55294 The reject log records information from messages that are rejected as a result
55295 of a configuration option (that is, for policy reasons).
55296 The first line of each rejection is a copy of the line that is also written to
55297 the main log. Then, if the message’s header has been read at the time the log
55298 is written, its contents are written to this log. Only the original header
55299 lines are available; header lines added by ACLs are not logged. You can use the
55300 reject log to check that your policy controls are working correctly; on a busy
55301 host this may be easier than scanning the main log for rejection messages. You
55302 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
55308 <indexterm role="concept">
55309 <primary>panic log</primary>
55311 <indexterm role="concept">
55312 <primary>system log</primary>
55314 When certain serious errors occur, Exim writes entries to its panic log. If the
55315 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
55316 are usually written to the main log as well, but can get lost amid the mass of
55317 other entries. The panic log should be empty under normal circumstances. It is
55318 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
55319 regularly, in order to become aware of any problems. When Exim cannot open its
55320 panic log, it tries as a last resort to write to the system log (syslog). This
55321 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
55322 message itself is written at priority LOG_CRIT.
55327 Every log line starts with a timestamp, in the format shown in the following
55328 example. Note that many of the examples shown in this chapter are line-wrapped.
55329 In the log file, this would be all on one line:
55331 <literallayout class="monospaced">
55332 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
55336 By default, the timestamps are in the local timezone. There are two
55337 ways of changing this:
55342 You can set the <option>timezone</option> option to a different time zone; in particular, if
55345 <literallayout class="monospaced">
55349 the timestamps will be in UTC (aka GMT).
55354 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
55357 <literallayout class="monospaced">
55358 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
55362 <section id="SECTwhelogwri">
55363 <title>Where the logs are written</title>
55365 <indexterm role="concept">
55366 <primary>log</primary>
55367 <secondary>destination</secondary>
55369 <indexterm role="concept">
55370 <primary>log</primary>
55371 <secondary>to file</secondary>
55373 <indexterm role="concept">
55374 <primary>log</primary>
55375 <secondary>to syslog</secondary>
55377 <indexterm role="concept">
55378 <primary>syslog</primary>
55380 The logs may be written to local files, or to syslog, or both. However, it
55381 should be noted that many syslog implementations use UDP as a transport, and
55382 are therefore unreliable in the sense that messages are not guaranteed to
55383 arrive at the loghost, nor is the ordering of messages necessarily maintained.
55384 It has also been reported that on large log files (tens of megabytes) you may
55385 need to tweak syslog to prevent it syncing the file with each write – on
55386 Linux this has been seen to make syslog take 90% plus of CPU time.
55389 The destination for Exim’s logs is configured by setting LOG_FILE_PATH in
55390 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
55391 configuration. This latter string is expanded, so it can contain, for example,
55392 references to the host name:
55394 <literallayout class="monospaced">
55395 log_file_path = /var/log/$primary_hostname/exim_%slog
55398 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
55399 rather than at run time, because then the setting is available right from the
55400 start of Exim’s execution. Otherwise, if there’s something it wants to log
55401 before it has read the configuration file (for example, an error in the
55402 configuration file) it will not use the path you want, and may not be able to
55406 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
55407 list, currently limited to at most two items. This is one option where the
55408 facility for changing a list separator may not be used. The list must always be
55409 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
55410 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
55411 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
55412 implying the use of a default path.
55415 When Exim encounters an empty item in the list, it searches the list defined by
55416 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
55417 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
55418 mean <quote>use the path specified at build time</quote>. It no such item exists, log
55419 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
55420 equivalent to the setting:
55422 <literallayout class="monospaced">
55423 log_file_path = $spool_directory/log/%slog
55426 If you do not specify anything at build time or run time, that is where the
55430 A log file path may also contain <literal>%D</literal> if datestamped log file names are in
55431 use – see section <xref linkend="SECTdatlogfil"/> below.
55434 Here are some examples of possible settings:
55437 <literal>LOG_FILE_PATH=syslog </literal> syslog only
55438 <literal>LOG_FILE_PATH=:syslog </literal> syslog and default path
55439 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
55440 <literal>LOG_FILE_PATH=/usr/log/exim_%s </literal> specified path only
55443 If there are more than two paths in the list, the first is used and a panic
55448 <title>Logging to local files that are periodically <quote>cycled</quote></title>
55450 <indexterm role="concept">
55451 <primary>log</primary>
55452 <secondary>cycling local files</secondary>
55454 <indexterm role="concept">
55455 <primary>cycling logs</primary>
55457 <indexterm role="concept">
55458 <primary><emphasis>exicyclog</emphasis></primary>
55460 <indexterm role="concept">
55461 <primary>log</primary>
55462 <secondary>local files; writing to</secondary>
55464 Some operating systems provide centralized and standardised methods for cycling
55465 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
55466 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
55467 main and reject logs each time it is called. The maximum number of old logs to
55468 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
55471 An Exim delivery process opens the main log when it first needs to write to it,
55472 and it keeps the file open in case subsequent entries are required – for
55473 example, if a number of different deliveries are being done for the same
55474 message. However, remote SMTP deliveries can take a long time, and this means
55475 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
55476 something similar is being used to rename log files on a regular basis. To
55477 ensure that a switch of log files is noticed as soon as possible, Exim calls
55478 <function>stat()</function> on the main log’s name before reusing an open file, and if the file
55479 does not exist, or its inode has changed, the old file is closed and Exim
55480 tries to open the main log from scratch. Thus, an old log file may remain open
55481 for quite some time, but no Exim processes should write to it once it has been
55485 <section id="SECTdatlogfil">
55486 <title>Datestamped log files</title>
55488 <indexterm role="concept">
55489 <primary>log</primary>
55490 <secondary>datestamped files</secondary>
55492 Instead of cycling the main and reject log files by renaming them
55493 periodically, some sites like to use files whose names contain a datestamp,
55494 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename>.
55495 Exim has support for this way of working. It is enabled by setting the
55496 <option>log_file_path</option> option to a path that includes <literal>%D</literal> at the point where the
55497 datestamp is required. For example:
55499 <literallayout class="monospaced">
55500 log_file_path = /var/spool/exim/log/%slog-%D
55501 log_file_path = /var/log/exim-%s-%D.log
55502 log_file_path = /var/spool/exim/log/%D-%slog
55505 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
55506 examples of names generated by the above examples:
55508 <literallayout class="monospaced">
55509 /var/spool/exim/log/mainlog-20021225
55510 /var/log/exim-reject-20021225.log
55511 /var/spool/exim/log/20021225-mainlog
55514 When this form of log file is specified, Exim automatically switches to new
55515 files at midnight. It does not make any attempt to compress old logs; you
55516 will need to write your own script if you require this. You should not
55517 run <emphasis>exicyclog</emphasis> with this form of logging.
55520 The location of the panic log is also determined by <option>log_file_path</option>, but it
55521 is not datestamped, because rotation of the panic log does not make sense.
55522 When generating the name of the panic log, <literal>%D</literal> is removed from the string.
55523 In addition, if it immediately follows a slash, a following non-alphanumeric
55524 character is removed; otherwise a preceding non-alphanumeric character is
55525 removed. Thus, the three examples above would give these panic log names:
55527 <literallayout class="monospaced">
55528 /var/spool/exim/log/paniclog
55529 /var/log/exim-panic.log
55530 /var/spool/exim/log/paniclog
55534 <title>Logging to syslog</title>
55536 <indexterm role="concept">
55537 <primary>log</primary>
55538 <secondary>syslog; writing to</secondary>
55540 The use of syslog does not change what Exim logs or the format of its messages,
55541 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
55542 Exim’s log lines are omitted when these lines are sent to syslog. Apart from
55543 that, the same strings are written to syslog as to log files. The syslog
55544 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
55545 by default, but you can change these by setting the <option>syslog_facility</option> and
55546 <option>syslog_processname</option> options, respectively. If Exim was compiled with
55547 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
55548 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
55549 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
55550 the time and host name to each line.
55551 The three log streams are mapped onto syslog priorities as follows:
55556 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
55561 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
55566 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
55571 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
55572 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
55573 these are routed by syslog to the same place. You can suppress this duplication
55574 by setting <option>syslog_duplication</option> false.
55577 Exim’s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
55578 entries contain multiple lines when headers are included. To cope with both
55579 these cases, entries written to syslog are split into separate <function>syslog()</function>
55580 calls at each internal newline, and also after a maximum of
55581 870 data characters. (This allows for a total syslog line length of 1024, when
55582 additions such as timestamps are added.) If you are running a syslog
55583 replacement that can handle lines longer than the 1024 characters allowed by
55584 RFC 3164, you should set
55586 <literallayout class="monospaced">
55587 SYSLOG_LONG_LINES=yes
55590 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
55591 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
55594 To make it easy to re-assemble split lines later, each component of a split
55595 entry starts with a string of the form [<<emphasis>n</emphasis>>/<<emphasis>m</emphasis>>] or [<<emphasis>n</emphasis>>\<<emphasis>m</emphasis>>]
55596 where <<emphasis>n</emphasis>> is the component number and <<emphasis>m</emphasis>> is the total number of
55597 components in the entry. The / delimiter is used when the line was split
55598 because it was too long; if it was split because of an internal newline, the \
55599 delimiter is used. For example, supposing the length limit to be 50 instead of
55600 870, the following would be the result of a typical rejection message to
55601 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
55602 name, and pid as added by syslog:
55604 <literallayout class="monospaced">
55605 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
55606 [2/5] [127.0.0.1] (ph10): syntax error in 'From' header
55607 [3/5] when scanning for sender: missing or malformed lo
55608 [4/5] cal part in "<>" (envelope sender is <ph10@cam.exa
55612 The same error might cause the following lines to be written to <quote>rejectlog</quote>
55615 <literallayout class="monospaced">
55616 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
55617 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
55618 [3/18] er when scanning for sender: missing or malformed
55619 [4/18] local part in "<>" (envelope sender is <ph10@cam
55620 [5\18] .example>)
55621 [6\18] Recipients: ph10@some.domain.cam.example
55622 [7\18] P Received: from [127.0.0.1] (ident=ph10)
55623 [8\18] by xxxxx.cam.example with smtp (Exim 4.00)
55624 [9\18] id 16RdAL-0006pc-00
55625 [10/18] for ph10@cam.example; Mon, 16 Sep 2002 16:
55626 [11\18] 09:43 +0100
55627 [12\18] F From: <>
55628 [13\18] Subject: this is a test header
55629 [18\18] X-something: this is another header
55630 [15/18] I Message-Id: <E16RdAL-0006pc-00@xxxxx.cam.examp
55633 [18/18] Date: Mon, 16 Sep 2002 16:09:43 +0100
55636 Log lines that are neither too long nor contain newlines are written to syslog
55637 without modification.
55640 If only syslog is being used, the Exim monitor is unable to provide a log tail
55641 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
55642 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
55647 <title>Log line flags</title>
55649 One line is written to the main log for each message received, and for each
55650 successful, unsuccessful, and delayed delivery. These lines can readily be
55651 picked out by the distinctive two-character flags that immediately follow the
55652 timestamp. The flags are:
55655 <literal><=</literal> message arrival
55656 <literal>=></literal> normal message delivery
55657 <literal>-></literal> additional address in same delivery
55658 <literal>*></literal> delivery suppressed by <option>-N</option>
55659 <literal>**</literal> delivery failed; address bounced
55660 <literal>==</literal> delivery deferred; temporary problem
55664 <title>Logging message reception</title>
55666 <indexterm role="concept">
55667 <primary>log</primary>
55668 <secondary>reception line</secondary>
55670 The format of the single-line entry in the main log that is written for every
55671 message received is shown in the basic example below, which is split over
55672 several lines in order to fit it on the page:
55674 <literallayout class="monospaced">
55675 2002-10-31 08:57:53 16ZCW1-0005MB-00 <= kryten@dwarf.fict.example
55676 H=mailer.fict.example [192.168.123.123] U=exim
55677 P=smtp S=5678 id=<incoming message id>
55680 The address immediately following <quote><=</quote> is the envelope sender address. A
55681 bounce message is shown with the sender address <quote><></quote>, and if it is locally
55682 generated, this is followed by an item of the form
55684 <literallayout class="monospaced">
55685 R=<message id>
55688 which is a reference to the message that caused the bounce to be sent.
55691 <indexterm role="concept">
55692 <primary>HELO</primary>
55694 <indexterm role="concept">
55695 <primary>EHLO</primary>
55697 For messages from other hosts, the H and U fields identify the remote host and
55698 record the RFC 1413 identity of the user that sent the message, if one was
55699 received. The number given in square brackets is the IP address of the sending
55700 host. If there is a single, unparenthesized host name in the H field, as
55701 above, it has been verified to correspond to the IP address (see the
55702 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
55703 by the remote host in the SMTP HELO or EHLO command, and has not been
55704 verified. If verification yields a different name to that given for HELO or
55705 EHLO, the verified name appears first, followed by the HELO or EHLO
55706 name in parentheses.
55709 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
55710 without brackets, in the HELO or EHLO command, leading to entries in
55711 the log containing text like these examples:
55713 <literallayout class="monospaced">
55714 H=(10.21.32.43) [192.168.8.34]
55715 H=([10.21.32.43]) [192.168.8.34]
55718 This can be confusing. Only the final address in square brackets can be relied
55722 For locally generated messages (that is, messages not received over TCP/IP),
55723 the H field is omitted, and the U field contains the login name of the caller
55727 <indexterm role="concept">
55728 <primary>authentication</primary>
55729 <secondary>logging</secondary>
55731 <indexterm role="concept">
55732 <primary>AUTH</primary>
55733 <secondary>logging</secondary>
55735 For all messages, the P field specifies the protocol used to receive the
55736 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
55737 of incoming SMTP messages, the value indicates whether or not any SMTP
55738 extensions (ESMTP), encryption, or authentication were used. If the SMTP
55739 session was encrypted, there is an additional X field that records the cipher
55740 suite that was used.
55743 The protocol is set to <quote>esmptsa</quote> or <quote>esmtpa</quote> for messages received from
55744 hosts that have authenticated themselves using the SMTP AUTH command. The first
55745 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
55746 there is an additional item A= followed by the name of the authenticator that
55747 was used. If an authenticated identification was set up by the authenticator’s
55748 <option>server_set_id</option> option, this is logged too, separated by a colon from the
55749 authenticator name.
55752 <indexterm role="concept">
55753 <primary>size</primary>
55754 <secondary>of message</secondary>
55756 The id field records the existing message id, if present. The size of the
55757 received message is given by the S field. When the message is delivered,
55758 headers may be removed or added, so that the size of delivered copies of the
55759 message may not correspond with this value (and indeed may be different to each
55763 The <option>log_selector</option> option can be used to request the logging of additional
55764 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
55768 <title>Logging deliveries</title>
55770 <indexterm role="concept">
55771 <primary>log</primary>
55772 <secondary>delivery line</secondary>
55774 The format of the single-line entry in the main log that is written for every
55775 delivery is shown in one of the examples below, for local and remote
55776 deliveries, respectively. Each example has been split into two lines in order
55777 to fit it on the page:
55779 <literallayout class="monospaced">
55780 2002-10-31 08:59:13 16ZCW1-0005MB-00 => marv
55781 <marv@hitch.fict.example> R=localuser T=local_delivery
55782 2002-10-31 09:00:10 16ZCW1-0005MB-00 =>
55783 monk@holistic.fict.example R=dnslookup T=remote_smtp
55784 H=holistic.fict.example [192.168.234.234]
55787 For ordinary local deliveries, the original address is given in angle brackets
55788 after the final delivery address, which might be a pipe or a file. If
55789 intermediate address(es) exist between the original and the final address, the
55790 last of these is given in parentheses after the final address. The R and T
55791 fields record the router and transport that were used to process the address.
55794 If a shadow transport was run after a successful local delivery, the log line
55795 for the successful delivery has an item added on the end, of the form
55798 <literal>ST=<</literal><emphasis>shadow transport name</emphasis><literal>></literal>
55801 If the shadow transport did not succeed, the error message is put in
55802 parentheses afterwards.
55805 <indexterm role="concept">
55806 <primary>asterisk</primary>
55807 <secondary>after IP address</secondary>
55809 When more than one address is included in a single delivery (for example, two
55810 SMTP RCPT commands in one transaction) the second and subsequent addresses are
55811 flagged with <literal>-></literal> instead of <literal>=></literal>. When two or more messages are delivered
55812 down a single SMTP connection, an asterisk follows the IP address in the log
55813 lines for the second and subsequent messages.
55816 The generation of a reply message by a filter file gets logged as a
55817 <quote>delivery</quote> to the addressee, preceded by <quote>></quote>.
55820 The <option>log_selector</option> option can be used to request the logging of additional
55821 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
55825 <title>Discarded deliveries</title>
55827 <indexterm role="concept">
55828 <primary>discarded messages</primary>
55830 <indexterm role="concept">
55831 <primary>message</primary>
55832 <secondary>discarded</secondary>
55834 <indexterm role="concept">
55835 <primary>delivery</primary>
55836 <secondary>discarded; logging</secondary>
55838 When a message is discarded as a result of the command <quote>seen finish</quote> being
55839 obeyed in a filter file which generates no deliveries, a log entry of the form
55841 <literallayout class="monospaced">
55842 2002-12-10 00:50:49 16auJc-0001UB-00 => discarded
55843 <low.club@bridge.example> R=userforward
55846 is written, to record why no deliveries are logged. When a message is discarded
55847 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
55849 <literallayout class="monospaced">
55850 1999-03-02 09:44:33 10HmaX-0005vi-00 => :blackhole:
55851 <hole@nowhere.example> R=blackhole_router
55855 <title>Deferred deliveries</title>
55857 When a delivery is deferred, a line of the following form is logged:
55859 <literallayout class="monospaced">
55860 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
55861 R=dnslookup T=smtp defer (146): Connection refused
55864 In the case of remote deliveries, the error is the one that was given for the
55865 last IP address that was tried. Details of individual SMTP failures are also
55866 written to the log, so the above line would be preceded by something like
55868 <literallayout class="monospaced">
55869 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
55870 mail1.endrest.example [192.168.239.239]: Connection refused
55873 When a deferred address is skipped because its retry time has not been reached,
55874 a message is written to the log, but this can be suppressed by setting an
55875 appropriate value in <option>log_selector</option>.
55879 <title>Delivery failures</title>
55881 <indexterm role="concept">
55882 <primary>delivery</primary>
55883 <secondary>failure; logging</secondary>
55885 If a delivery fails because an address cannot be routed, a line of the
55886 following form is logged:
55888 <literallayout class="monospaced">
55889 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
55890 <jim@trek99.example>: unknown mail domain
55893 If a delivery fails at transport time, the router and transport are shown, and
55894 the response from the remote host is included, as in this example:
55896 <literallayout class="monospaced">
55897 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
55898 R=dnslookup T=remote_smtp: SMTP error from remote mailer
55899 after pipelined RCPT TO:<ace400@pb.example>: host
55900 pbmail3.py.example [192.168.63.111]: 553 5.3.0
55901 <ace400@pb.example>...Addressee unknown
55904 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
55905 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
55906 disabling PIPELINING. The log lines for all forms of delivery failure are
55907 flagged with <literal>**</literal>.
55911 <title>Fake deliveries</title>
55913 <indexterm role="concept">
55914 <primary>delivery</primary>
55915 <secondary>fake; logging</secondary>
55917 If a delivery does not actually take place because the <option>-N</option> option has been
55918 used to suppress it, a normal delivery line is written to the log, except that
55919 <quote>=></quote> is replaced by <quote>*></quote>.
55923 <title>Completion</title>
55927 <literallayout class="monospaced">
55928 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
55931 is written to the main log when a message is about to be removed from the spool
55932 at the end of its processing.
55936 <title>Summary of Fields in Log Lines</title>
55938 <indexterm role="concept">
55939 <primary>log</primary>
55940 <secondary>summary of fields</secondary>
55942 A summary of the field identifiers that are used in log lines is shown in
55943 the following table:
55946 <literal>A </literal> authenticator name (and optional id)
55947 <literal>C </literal> SMTP confirmation on delivery
55948 <literal>CV </literal> certificate verification status
55949 <literal>DN </literal> distinguished name from peer certificate
55950 <literal>DT </literal> on <literal>=></literal> lines: time taken for a delivery
55951 <literal>F </literal> sender address (on delivery lines)
55952 <literal>H </literal> host name and IP address
55953 <literal>I </literal> local interface used
55954 <literal>id </literal> message id for incoming message
55955 <literal>P </literal> on <literal><=</literal> lines: protocol used
55956 <literal> </literal> on <literal>=></literal> and <literal>**</literal> lines: return path
55957 <literal>QT </literal> on <literal>=></literal> lines: time spent on queue so far
55958 <literal> </literal> on <quote>Completed</quote> lines: time spent on queue
55959 <literal>R </literal> on <literal><=</literal> lines: reference for local bounce
55960 <literal> </literal> on <literal>=></literal> <literal>**</literal> and <literal>==</literal> lines: router name
55961 <literal>S </literal> size of message
55962 <literal>ST </literal> shadow transport name
55963 <literal>T </literal> on <literal><=</literal> lines: message subject (topic)
55964 <literal> </literal> on <literal>=></literal> <literal>**</literal> and <literal>==</literal> lines: transport name
55965 <literal>U </literal> local user or RFC 1413 identity
55966 <literal>X </literal> TLS cipher suite
55970 <title>Other log entries</title>
55972 Various other types of log entry are written from time to time. Most should be
55973 self-explanatory. Among the more common are:
55978 <indexterm role="concept">
55979 <primary>retry</primary>
55980 <secondary>time not reached</secondary>
55982 <emphasis>retry time not reached</emphasis> An address previously suffered a temporary error
55983 during routing or local delivery, and the time to retry has not yet arrived.
55984 This message is not written to an individual message log file unless it happens
55985 during the first delivery attempt.
55990 <emphasis>retry time not reached for any host</emphasis> An address previously suffered
55991 temporary errors during remote delivery, and the retry time has not yet arrived
55992 for any of the hosts to which it is routed.
55997 <indexterm role="concept">
55998 <primary>spool directory</primary>
55999 <secondary>file locked</secondary>
56001 <emphasis>spool file locked</emphasis> An attempt to deliver a message cannot proceed because
56002 some other Exim process is already working on the message. This can be quite
56003 common if queue running processes are started at frequent intervals. The
56004 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
56010 <indexterm role="concept">
56011 <primary>error</primary>
56012 <secondary>ignored</secondary>
56014 <emphasis>error ignored</emphasis> There are several circumstances that give rise to this
56017 <orderedlist numeration="arabic">
56020 Exim failed to deliver a bounce message whose age was greater than
56021 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
56026 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
56027 failed. The delivery was discarded.
56032 A delivery set up by a router configured with
56034 <literallayout class="monospaced">
56035 errors_to = <>
56038 failed. The delivery was discarded.
56045 <section id="SECTlogselector">
56046 <title>Reducing or increasing what is logged</title>
56048 <indexterm role="concept">
56049 <primary>log</primary>
56050 <secondary>selectors</secondary>
56052 By setting the <option>log_selector</option> global option, you can disable some of Exim’s
56053 default logging, or you can request additional logging. The value of
56054 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
56057 <literallayout class="monospaced">
56058 log_selector = +arguments -retry_defer
56061 The list of optional log items is in the following table, with the default
56062 selection marked by asterisks:
56065 <literal>*acl_warn_skipped </literal> skipped <option>warn</option> statement in ACL
56066 <literal> address_rewrite </literal> address rewriting
56067 <literal> all_parents </literal> all parents in => lines
56068 <literal> arguments </literal> command line arguments
56069 <literal>*connection_reject </literal> connection rejections
56070 <literal>*delay_delivery </literal> immediate delivery delayed
56071 <literal> deliver_time </literal> time taken to perform delivery
56072 <literal> delivery_size </literal> add <literal>S=</literal><emphasis>nnn</emphasis> to => lines
56073 <literal>*dnslist_defer </literal> defers of DNS list (aka RBL) lookups
56074 <literal>*etrn </literal> ETRN commands
56075 <literal>*host_lookup_failed </literal> as it says
56076 <literal> ident_timeout </literal> timeout for ident connection
56077 <literal> incoming_interface </literal> incoming interface on <= lines
56078 <literal> incoming_port </literal> incoming port on <= lines
56079 <literal>*lost_incoming_connection </literal> as it says (includes timeouts)
56080 <literal> outgoing_port </literal> add remote port to => lines
56081 <literal>*queue_run </literal> start and end queue runs
56082 <literal> queue_time </literal> time on queue for one recipient
56083 <literal> queue_time_overall </literal> time on queue for whole message
56084 <literal> received_recipients </literal> recipients on <= lines
56085 <literal> received_sender </literal> sender on <= lines
56086 <literal>*rejected_header </literal> header contents on reject log
56087 <literal>*retry_defer </literal> <quote>retry time not reached</quote>
56088 <literal> return_path_on_delivery </literal> put return path on => and ** lines
56089 <literal> sender_on_delivery </literal> add sender to => lines
56090 <literal>*sender_verify_fail </literal> sender verification failures
56091 <literal>*size_reject </literal> rejection because too big
56092 <literal>*skip_delivery </literal> delivery skipped in a queue run
56093 <literal> smtp_confirmation </literal> SMTP confirmation on => lines
56094 <literal> smtp_connection </literal> SMTP connections
56095 <literal> smtp_incomplete_transaction</literal> incomplete SMTP transactions
56096 <literal> smtp_protocol_error </literal> SMTP protocol errors
56097 <literal> smtp_syntax_error </literal> SMTP syntax errors
56098 <literal> subject </literal> contents of <emphasis>Subject:</emphasis> on <= lines
56099 <literal> tls_certificate_verified </literal> certificate verification status
56100 <literal>*tls_cipher </literal> TLS cipher suite on <= and => lines
56101 <literal> tls_peerdn </literal> TLS peer DN on <= and => lines
56102 <literal> unknown_in_list </literal> DNS lookup failed in list match
56104 <literal> all </literal> all of the above
56107 More details on each of these items follows:
56112 <indexterm role="concept">
56113 <primary><option>warn</option> statement</primary>
56114 <secondary>log when skipping</secondary>
56116 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
56117 its conditions cannot be evaluated, a log line to this effect is written if
56118 this log selector is set.
56123 <indexterm role="concept">
56124 <primary>log</primary>
56125 <secondary>rewriting</secondary>
56127 <indexterm role="concept">
56128 <primary>rewriting</primary>
56129 <secondary>logging</secondary>
56131 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
56132 rewrites, but not to rewrites in filters run as an unprivileged user (because
56133 such users cannot access the log).
56138 <indexterm role="concept">
56139 <primary>log</primary>
56140 <secondary>full parentage</secondary>
56142 <option>all_parents</option>: Normally only the original and final addresses are logged on
56143 delivery lines; with this selector, intermediate parents are given in
56144 parentheses between them.
56149 <indexterm role="concept">
56150 <primary>log</primary>
56151 <secondary>Exim arguments</secondary>
56153 <indexterm role="concept">
56154 <primary>Exim arguments</primary>
56155 <secondary>logging</secondary>
56157 <option>arguments</option>: This causes Exim to write the arguments with which it was called
56158 to the main log, preceded by the current working directory. This is a debugging
56159 feature, added to make it easier to find out how certain MUAs call
56160 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
56161 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
56162 that are empty or that contain white space are quoted. Non-printing characters
56163 are shown as escape sequences. This facility cannot log unrecognized arguments,
56164 because the arguments are checked before the configuration file is read. The
56165 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
56166 between the caller and Exim.
56171 <indexterm role="concept">
56172 <primary>log</primary>
56173 <secondary>connection rejections</secondary>
56175 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
56176 connection is rejected, for whatever reason.
56181 <indexterm role="concept">
56182 <primary>log</primary>
56183 <secondary>delayed delivery</secondary>
56185 <indexterm role="concept">
56186 <primary>delayed delivery</primary>
56187 <secondary>logging</secondary>
56189 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
56190 started for an incoming message because the load is too high or too many
56191 messages were received on one connection. Logging does not occur if no delivery
56192 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
56197 <indexterm role="concept">
56198 <primary>log</primary>
56199 <secondary>delivery duration</secondary>
56201 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
56202 perform the actual delivery is logged as DT=<<emphasis>time</emphasis>>, for example, <literal>DT=1s</literal>.
56207 <indexterm role="concept">
56208 <primary>log</primary>
56209 <secondary>message size on delivery</secondary>
56211 <indexterm role="concept">
56212 <primary>size</primary>
56213 <secondary>of message</secondary>
56215 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
56216 the <quote>=></quote> line, tagged with S=.
56221 <indexterm role="concept">
56222 <primary>log</primary>
56223 <secondary>dnslist defer</secondary>
56225 <indexterm role="concept">
56226 <primary>DNS list</primary>
56227 <secondary>logging defer</secondary>
56229 <indexterm role="concept">
56230 <primary>black list (DNS)</primary>
56232 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
56233 DNS black list suffers a temporary error.
56238 <indexterm role="concept">
56239 <primary>log</primary>
56240 <secondary>ETRN commands</secondary>
56242 <indexterm role="concept">
56243 <primary>ETRN</primary>
56244 <secondary>logging</secondary>
56246 <option>etrn</option>: Every legal ETRN command that is received is logged, before the ACL
56247 is run to determine whether or not it is actually accepted. An invalid ETRN
56248 command, or one received within a message transaction is not logged by this
56249 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
56254 <indexterm role="concept">
56255 <primary>log</primary>
56256 <secondary>host lookup failure</secondary>
56258 <option>host_lookup_failed</option>: When a lookup of a host’s IP addresses fails to find
56259 any addresses, or when a lookup of an IP address fails to find a host name, a
56260 log line is written. This logging does not apply to direct DNS lookups when
56261 routing email addresses, but it does apply to <quote>byname</quote> lookups.
56266 <indexterm role="concept">
56267 <primary>log</primary>
56268 <secondary>ident timeout</secondary>
56270 <indexterm role="concept">
56271 <primary>RFC 1413</primary>
56272 <secondary>logging timeout</secondary>
56274 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
56275 client’s ident port times out.
56280 <indexterm role="concept">
56281 <primary>log</primary>
56282 <secondary>incoming interface</secondary>
56284 <indexterm role="concept">
56285 <primary>interface</primary>
56286 <secondary>logging</secondary>
56288 <option>incoming_interface</option>: The interface on which a message was received is added
56289 to the <quote><=</quote> line as an IP address in square brackets, tagged by I= and
56290 followed by a colon and the port number. The local interface and port are also
56291 added to other SMTP log lines, for example <quote>SMTP connection from</quote>, and to
56297 <indexterm role="concept">
56298 <primary>log</primary>
56299 <secondary>incoming remote port</secondary>
56301 <indexterm role="concept">
56302 <primary>port</primary>
56303 <secondary>logging remote</secondary>
56305 <indexterm role="concept">
56306 <primary>TCP/IP</primary>
56307 <secondary>logging incoming remote port</secondary>
56309 <indexterm role="concept">
56310 <primary><varname>$sender_fullhost</varname></primary>
56312 <indexterm role="concept">
56313 <primary><varname>$sender_rcvhost</varname></primary>
56315 <option>incoming_port</option>: The remote port number from which a message was received is
56316 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
56317 in square brackets, and separated from it by a colon. This is implemented by
56318 changing the value that is put in the <varname>$sender_fullhost</varname> and
56319 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
56320 important with the widening use of NAT (see RFC 2505).
56325 <indexterm role="concept">
56326 <primary>log</primary>
56327 <secondary>dropped connection</secondary>
56329 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
56330 connection is unexpectedly dropped.
56335 <indexterm role="concept">
56336 <primary>log</primary>
56337 <secondary>outgoing remote port</secondary>
56339 <indexterm role="concept">
56340 <primary>port</primary>
56341 <secondary>logging outgoint remote</secondary>
56343 <indexterm role="concept">
56344 <primary>TCP/IP</primary>
56345 <secondary>logging ougtoing remote port</secondary>
56347 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
56348 containing => tags) following the IP address. This option is not included in
56349 the default setting, because for most ordinary configurations, the remote port
56350 number is always 25 (the SMTP port).
56355 <indexterm role="concept">
56356 <primary>log</primary>
56357 <secondary>queue run</secondary>
56359 <indexterm role="concept">
56360 <primary>queue runner</primary>
56361 <secondary>logging</secondary>
56363 <option>queue_run</option>: The start and end of every queue run are logged.
56368 <indexterm role="concept">
56369 <primary>log</primary>
56370 <secondary>queue time</secondary>
56372 <option>queue_time</option>: The amount of time the message has been in the queue on the
56373 local host is logged as QT=<<emphasis>time</emphasis>> on delivery (<literal>=></literal>) lines, for example,
56374 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
56375 includes reception time as well as the delivery time for the current address.
56376 This means that it may be longer than the difference between the arrival and
56377 delivery log line times, because the arrival log line is not written until the
56378 message has been successfully received.
56383 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
56384 the local host is logged as QT=<<emphasis>time</emphasis>> on <quote>Completed</quote> lines, for
56385 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
56386 message, so it includes reception time as well as the total delivery time.
56391 <indexterm role="concept">
56392 <primary>log</primary>
56393 <secondary>recipients</secondary>
56395 <option>received_recipients</option>: The recipients of a message are listed in the main log
56396 as soon as the message is received. The list appears at the end of the log line
56397 that is written when a message is received, preceded by the word <quote>for</quote>. The
56398 addresses are listed after they have been qualified, but before any rewriting
56400 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
56406 <indexterm role="concept">
56407 <primary>log</primary>
56408 <secondary>sender reception</secondary>
56410 <option>received_sender</option>: The unrewritten original sender of a message is added to
56411 the end of the log line that records the message’s arrival, after the word
56412 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
56417 <indexterm role="concept">
56418 <primary>log</primary>
56419 <secondary>header lines for rejection</secondary>
56421 <option>rejected_header</option>: If a message’s header has been received at the time a
56422 rejection is written to the reject log, the complete header is added to the
56423 log. Header logging can be turned off individually for messages that are
56424 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
56429 <indexterm role="concept">
56430 <primary>log</primary>
56431 <secondary>retry defer</secondary>
56433 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
56434 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
56435 message is always omitted from individual message logs after the first delivery
56441 <indexterm role="concept">
56442 <primary>log</primary>
56443 <secondary>return path</secondary>
56445 <option>return_path_on_delivery</option>: The return path that is being transmitted with
56446 the message is included in delivery and bounce lines, using the tag P=.
56447 This is omitted if no delivery actually happens, for example, if routing fails,
56448 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
56453 <indexterm role="concept">
56454 <primary>log</primary>
56455 <secondary>sender on delivery</secondary>
56457 <option>sender_on_delivery</option>: The message’s sender address is added to every delivery
56458 and bounce line, tagged by F= (for <quote>from</quote>).
56459 This is the original sender that was received with the message; it is not
56460 necessarily the same as the outgoing return path.
56465 <indexterm role="concept">
56466 <primary>log</primary>
56467 <secondary>sender verify failure</secondary>
56469 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
56470 gives details of a sender verification failure is not written. Log lines for
56471 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
56477 <indexterm role="concept">
56478 <primary>log</primary>
56479 <secondary>size rejection</secondary>
56481 <option>size_reject</option>: A log line is written whenever a message is rejected because
56487 <indexterm role="concept">
56488 <primary>log</primary>
56489 <secondary>frozen messages; skipped</secondary>
56491 <indexterm role="concept">
56492 <primary>frozen messages</primary>
56493 <secondary>logging skipping</secondary>
56495 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
56496 queue run because it is frozen or because another process is already delivering
56498 <indexterm role="concept">
56499 <primary><quote>spool file is locked</quote></primary>
56501 The message that is written is <quote>spool file is locked</quote>.
56506 <indexterm role="concept">
56507 <primary>log</primary>
56508 <secondary>smtp confirmation</secondary>
56510 <indexterm role="concept">
56511 <primary>SMTP</primary>
56512 <secondary>logging confirmation</secondary>
56514 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP dialogue for
56515 outgoing messages is added to delivery log lines in the form <literal>C=</literal><<emphasis>text</emphasis>>.
56516 A number of MTAs (including Exim) return an identifying string in this
56522 <indexterm role="concept">
56523 <primary>log</primary>
56524 <secondary>SMTP connections</secondary>
56526 <indexterm role="concept">
56527 <primary>SMTP</primary>
56528 <secondary>logging connections</secondary>
56530 <option>smtp_connection</option>: A log line is written whenever an SMTP connection is
56531 established or closed, unless the connection is from a host that matches
56532 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
56533 only when the closure is unexpected.) This applies to connections from local
56534 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
56535 dropped in the middle of a message, a log line is always written, whether or
56536 not this selector is set, but otherwise nothing is written at the start and end
56537 of connections unless this selector is enabled.
56540 For TCP/IP connections to an Exim daemon, the current number of connections is
56541 included in the log message for each new connection, but note that the count is
56542 reset if the daemon is restarted.
56543 Also, because connections are closed (and the closure is logged) in
56544 subprocesses, the count may not include connections that have been closed but
56545 whose termination the daemon has not yet noticed. Thus, while it is possible to
56546 match up the opening and closing of connections in the log, the value of the
56547 logged counts may not be entirely accurate.
56552 <indexterm role="concept">
56553 <primary>log</primary>
56554 <secondary>SMTP transaction; incomplete</secondary>
56556 <indexterm role="concept">
56557 <primary>SMTP</primary>
56558 <secondary>logging incomplete transactions</secondary>
56560 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
56561 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
56562 and the message sender plus any accepted recipients are included in the log
56563 line. This can provide evidence of dictionary attacks.
56568 <indexterm role="concept">
56569 <primary>log</primary>
56570 <secondary>SMTP protocol error</secondary>
56572 <indexterm role="concept">
56573 <primary>SMTP</primary>
56574 <secondary>logging protocol error</secondary>
56576 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
56577 encountered. Exim does not have perfect detection of all protocol errors
56578 because of transmission delays and the use of pipelining. If PIPELINING has
56579 been advertised to a client, an Exim server assumes that the client will use
56580 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
56581 received after rejecting MAIL) as protocol errors.
56586 <indexterm role="concept">
56587 <primary>SMTP</primary>
56588 <secondary>logging syntax errors</secondary>
56590 <indexterm role="concept">
56591 <primary>SMTP</primary>
56592 <secondary>syntax errors; logging</secondary>
56594 <indexterm role="concept">
56595 <primary>SMTP</primary>
56596 <secondary>unknown command; logging</secondary>
56598 <indexterm role="concept">
56599 <primary>log</primary>
56600 <secondary>unknown SMTP command</secondary>
56602 <indexterm role="concept">
56603 <primary>log</primary>
56604 <secondary>SMTP syntax error</secondary>
56606 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
56607 encountered. An unrecognized command is treated as a syntax error. For an
56608 external connection, the host identity is given; for an internal connection
56609 using <option>-bs</option> the sender identification (normally the calling user) is given.
56614 <indexterm role="concept">
56615 <primary>log</primary>
56616 <secondary>subject</secondary>
56618 <indexterm role="concept">
56619 <primary>subject</primary>
56620 <secondary>logging</secondary>
56622 <option>subject</option>: The subject of the message is added to the arrival log line,
56623 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
56624 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
56625 specifies whether characters with values greater than 127 should be logged
56626 unchanged, or whether they should be rendered as escape sequences.
56631 <indexterm role="concept">
56632 <primary>log</primary>
56633 <secondary>certificate verification</secondary>
56635 <option>tls_certificate_verified</option>: An extra item is added to <= and => log lines
56636 when TLS is in use. The item is <literal>CV=yes</literal> if the peer’s certificate was
56637 verified, and <literal>CV=no</literal> if not.
56642 <indexterm role="concept">
56643 <primary>log</primary>
56644 <secondary>TLS cipher</secondary>
56646 <indexterm role="concept">
56647 <primary>TLS</primary>
56648 <secondary>logging cipher</secondary>
56650 <option>tls_cipher</option>: When a message is sent or received over an encrypted
56651 connection, the cipher suite used is added to the log line, preceded by X=.
56656 <indexterm role="concept">
56657 <primary>log</primary>
56658 <secondary>TLS peer DN</secondary>
56660 <indexterm role="concept">
56661 <primary>TLS</primary>
56662 <secondary>logging peer DN</secondary>
56664 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
56665 connection, and a certificate is supplied by the remote host, the peer DN is
56666 added to the log line, preceded by DN=.
56671 <indexterm role="concept">
56672 <primary>log</primary>
56673 <secondary>DNS failure in list</secondary>
56675 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
56676 result of a list match is failure because a DNS lookup failed.
56682 <title>Message log</title>
56684 <indexterm role="concept">
56685 <primary>message</primary>
56686 <secondary>log file for</secondary>
56688 <indexterm role="concept">
56689 <primary>log</primary>
56690 <secondary>message log; description of</secondary>
56692 <indexterm role="concept">
56693 <primary><filename>msglog</filename> directory</primary>
56695 <indexterm role="concept">
56696 <primary><option>preserve_message_logs</option></primary>
56698 In addition to the general log files, Exim writes a log file for each message
56699 that it handles. The names of these per-message logs are the message ids, and
56700 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
56701 message log contains copies of the log lines that apply to the message. This
56702 makes it easier to inspect the status of an individual message without having
56703 to search the main log. A message log is deleted when processing of the message
56704 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
56705 only with great care because they can fill up your disk very quickly.
56708 On a heavily loaded system, it may be desirable to disable the use of
56709 per-message logs, in order to reduce disk I/O. This can be done by setting the
56710 <option>message_logs</option> option false.
56711 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
56716 <chapter id="CHAPutils">
56717 <title>Exim utilities</title>
56719 <indexterm role="concept" id="IIDutils" class="startofrange">
56720 <primary>utilities</primary>
56722 A number of utility scripts and programs are supplied with Exim and are
56723 described in this chapter. There is also the Exim Monitor, which is covered in
56724 the next chapter. The utilities described here are:
56726 <informaltable frame="none">
56727 <tgroup cols="4" colsep="0" rowsep="0">
56728 <colspec colwidth="2*" align="left"/>
56729 <colspec colwidth="8*" align="left"/>
56730 <colspec colwidth="30*" align="left"/>
56731 <colspec colwidth="40*" align="left"/>
56735 <entry><xref linkend="SECTfinoutwha"/></entry>
56736 <entry><emphasis>exiwhat</emphasis></entry>
56737 <entry>list what Exim processes are doing</entry>
56741 <entry><xref linkend="SECTgreptheque"/></entry>
56742 <entry><emphasis>exiqgrep</emphasis></entry>
56743 <entry>grep the queue</entry>
56747 <entry><xref linkend="SECTsumtheque"/></entry>
56748 <entry><emphasis>exiqsumm</emphasis></entry>
56749 <entry>summarize the queue</entry>
56753 <entry><xref linkend="SECTextspeinf"/></entry>
56754 <entry><emphasis>exigrep</emphasis></entry>
56755 <entry>search the main log</entry>
56759 <entry><xref linkend="SECTexipick"/></entry>
56760 <entry><emphasis>exipick</emphasis></entry>
56761 <entry>select messages on various criteria</entry>
56765 <entry><xref linkend="SECTcyclogfil"/></entry>
56766 <entry><emphasis>exicyclog</emphasis></entry>
56767 <entry>cycle (rotate) log files</entry>
56771 <entry><xref linkend="SECTmailstat"/></entry>
56772 <entry><emphasis>eximstats</emphasis></entry>
56773 <entry>extract statistics from the log</entry>
56777 <entry><xref linkend="SECTcheckaccess"/></entry>
56778 <entry><emphasis>exim_checkaccess</emphasis></entry>
56779 <entry>check address acceptance from given IP</entry>
56783 <entry><xref linkend="SECTdbmbuild"/></entry>
56784 <entry><emphasis>exim_dbmbuild</emphasis></entry>
56785 <entry>build a DBM file</entry>
56789 <entry><xref linkend="SECTfinindret"/></entry>
56790 <entry><emphasis>exinext</emphasis></entry>
56791 <entry>extract retry information</entry>
56795 <entry><xref linkend="SECThindatmai"/></entry>
56796 <entry><emphasis>exim_dumpdb</emphasis></entry>
56797 <entry>dump a hints database</entry>
56801 <entry><xref linkend="SECThindatmai"/></entry>
56802 <entry><emphasis>exim_tidydb</emphasis></entry>
56803 <entry>clean up a hints database</entry>
56807 <entry><xref linkend="SECThindatmai"/></entry>
56808 <entry><emphasis>exim_fixdb</emphasis></entry>
56809 <entry>patch a hints database</entry>
56813 <entry><xref linkend="SECTmailboxmaint"/></entry>
56814 <entry><emphasis>exim_lock</emphasis></entry>
56815 <entry>lock a mailbox file</entry>
56821 Another utility that might be of use to sites with many MTAs is Tom Kistner’s
56822 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
56823 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
56825 <section id="SECTfinoutwha">
56826 <title>Finding out what Exim processes are doing (exiwhat)</title>
56828 <indexterm role="concept">
56829 <primary><emphasis>exiwhat</emphasis></primary>
56831 <indexterm role="concept">
56832 <primary>process</primary>
56833 <secondary>querying</secondary>
56835 <indexterm role="concept">
56836 <primary>SIGUSR1</primary>
56838 On operating systems that can restart a system call after receiving a signal
56839 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
56840 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
56841 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
56842 processes it can find, having first emptied the file. It then waits for one
56843 second to allow the Exim processes to react before displaying the results. In
56844 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
56845 send the signal to the Exim processes, so it is normally run as root.
56848 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
56849 use by system administrators. It is not sensible, for example, to set up a
56850 script that sends SIGUSR1 signals to Exim processes at short intervals.
56853 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
56854 varies in different operating systems. Not only are different options used,
56855 but the format of the output is different. For this reason, there are some
56856 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
56857 it doesn’t seem to be working for you, check the following compile-time
56861 <literal>EXIWHAT_PS_CMD </literal> the command for running <emphasis>ps</emphasis>
56862 <literal>EXIWHAT_PS_ARG </literal> the argument for <emphasis>ps</emphasis>
56863 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
56864 <literal>EXIWHAT_KILL_ARG </literal> the argument for the <emphasis>kill</emphasis> command
56867 An example of typical output from <emphasis>exiwhat</emphasis> is
56869 <literallayout class="monospaced">
56870 164 daemon: -q1h, listening on port 25
56871 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
56872 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
56873 [10.19.42.42] (editor@ref.example)
56874 10592 handling incoming call from [192.168.243.242]
56875 10628 accepting a local non-SMTP message
56878 The first number in the output line is the process number. The third line has
56879 been split here, in order to fit it on the page.
56882 <section id="SECTgreptheque">
56883 <title>Selective queue listing (exiqgrep)</title>
56885 <indexterm role="concept">
56886 <primary><emphasis>exiqgrep</emphasis></primary>
56888 <indexterm role="concept">
56889 <primary>queue</primary>
56890 <secondary>grepping</secondary>
56892 This utility is a Perl script contributed by Matt Hubbard. It runs
56894 <literallayout class="monospaced">
56898 to obtain a queue listing with undelivered recipients only, and then greps the
56899 output to select messages that match given criteria. The following selection
56900 options are available:
56904 <term><emphasis role="bold">-f</emphasis> <<emphasis>regex</emphasis>></term>
56907 Match the sender address. The field that is tested is enclosed in angle
56908 brackets, so you can test for bounce messages with
56910 <literallayout class="monospaced">
56911 exiqgrep -f '^<>$'
56913 </listitem></varlistentry>
56915 <term><emphasis role="bold">-r</emphasis> <<emphasis>regex</emphasis>></term>
56918 Match a recipient address. The field that is tested is not enclosed in angle
56921 </listitem></varlistentry>
56923 <term><emphasis role="bold">-s</emphasis> <<emphasis>regex</emphasis>></term>
56926 Match against the size field.
56928 </listitem></varlistentry>
56930 <term><emphasis role="bold">-y</emphasis> <<emphasis>seconds</emphasis>></term>
56933 Match messages that are younger than the given time.
56935 </listitem></varlistentry>
56937 <term><emphasis role="bold">-o</emphasis> <<emphasis>seconds</emphasis>></term>
56940 Match messages that are older than the given time.
56942 </listitem></varlistentry>
56944 <term><emphasis role="bold">-z</emphasis></term>
56947 Match only frozen messages.
56949 </listitem></varlistentry>
56951 <term><emphasis role="bold">-x</emphasis></term>
56954 Match only non-frozen messages.
56956 </listitem></varlistentry>
56959 The following options control the format of the output:
56963 <term><emphasis role="bold">-c</emphasis></term>
56966 Display only the count of matching messages.
56968 </listitem></varlistentry>
56970 <term><emphasis role="bold">-l</emphasis></term>
56973 Long format – display the full message information as output by Exim. This is
56976 </listitem></varlistentry>
56978 <term><emphasis role="bold">-i</emphasis></term>
56981 Display message ids only.
56983 </listitem></varlistentry>
56985 <term><emphasis role="bold">-b</emphasis></term>
56988 Brief format – one line per message.
56990 </listitem></varlistentry>
56992 <term><emphasis role="bold">-R</emphasis></term>
56995 Display messages in reverse order.
56997 </listitem></varlistentry>
57000 There is one more option, <option>-h</option>, which outputs a list of options.
57003 <section id="SECTsumtheque">
57004 <title>Summarising the queue (exiqsumm)</title>
57006 <indexterm role="concept">
57007 <primary><emphasis>exiqsumm</emphasis></primary>
57009 <indexterm role="concept">
57010 <primary>queue</primary>
57011 <secondary>summary</secondary>
57013 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
57014 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
57015 running a command such as
57017 <literallayout class="monospaced">
57018 exim -bp | exiqsumm
57021 The output consists of one line for each domain that has messages waiting for
57022 it, as in the following example:
57024 <literallayout class="monospaced">
57025 3 2322 74m 66m msn.com.example
57028 Each line lists the number of
57029 pending deliveries for a domain, their total volume, and the length of time
57030 that the oldest and the newest messages have been waiting. Note that the number
57031 of pending deliveries is greater than the number of messages when messages
57032 have more than one recipient.
57035 A summary line is output at the end. By default the output is sorted on the
57036 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
57037 the output to be sorted by oldest message and by count of messages,
57041 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
57042 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
57043 generated by aliasing or forwarding are included (unless the <option>one_time</option>
57044 option of the <command>redirect</command> router has been used to convert them into <quote>top
57045 level</quote> addresses).
57048 <section id="SECTextspeinf">
57049 <title>Extracting specific information from the log (exigrep)</title>
57051 <indexterm role="concept">
57052 <primary><emphasis>exigrep</emphasis></primary>
57054 <indexterm role="concept">
57055 <primary>log</primary>
57056 <secondary>extracts; grepping for</secondary>
57058 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
57059 files for entries that match a given pattern. When it finds a match, it
57060 extracts all the log entries for the relevant message, not just those that
57061 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
57062 given message, or all mail for a given user, or for a given host, for example.
57063 The input files can be in Exim log format or syslog format.
57066 If a matching log line is not associated with a specific message, it is always
57067 included in <emphasis>exigrep</emphasis>’s output. The usage is:
57070 <literal>exigrep [-l] [-t<</literal><emphasis>n</emphasis><literal>>] <</literal><emphasis>pattern</emphasis><literal>> [<</literal><emphasis>log file</emphasis><literal>>] ...</literal>
57073 The <option>-t</option> argument specifies a number of seconds. It adds an additional
57074 condition for message selection. Messages that are complete are shown only if
57075 they spent more than <<emphasis>n</emphasis>> seconds on the queue.
57078 The <option>-l</option> flag means <quote>literal</quote>, that is, treat all characters in the
57079 pattern as standing for themselves. Otherwise the pattern must be a Perl
57080 regular expression. The pattern match is case-insensitive. If no file names are
57081 given on the command line, the standard input is read.
57084 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
57085 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
57086 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
57089 <section id="SECTexipick">
57090 <title>Selecting messages by various criteria (exipick)</title>
57092 <indexterm role="concept">
57093 <primary><emphasis>exipick</emphasis></primary>
57095 John Jetmore’s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
57096 lists messages from the queue according to a variety of criteria. For details,
57097 visit <emphasis role="bold"><ulink url="http://www.exim.org/eximwiki/ToolExipickManPage">http://www.exim.org/eximwiki/ToolExipickManPage</ulink></emphasis> or run:
57099 <literallayout class="monospaced">
57103 <section id="SECTcyclogfil">
57104 <title>Cycling log files (exicyclog)</title>
57106 <indexterm role="concept">
57107 <primary>log</primary>
57108 <secondary>cycling local files</secondary>
57110 <indexterm role="concept">
57111 <primary>cycling logs</primary>
57113 <indexterm role="concept">
57114 <primary><emphasis>exicyclog</emphasis></primary>
57116 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
57117 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
57118 you are using log files with datestamps in their names (see section
57119 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
57120 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
57121 There are two command line options for <emphasis>exicyclog</emphasis>:
57126 <option>-k</option> <<emphasis>count</emphasis>> specifies the number of log files to keep, overriding the
57127 default that is set when Exim is built. The default default is 10.
57132 <option>-l</option> <<emphasis>path</emphasis>> specifies the log file path, in the same format as Exim’s
57133 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
57134 overriding the script’s default, which is to find the setting from Exim’s
57140 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
57141 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
57142 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
57143 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
57144 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
57145 logs are handled similarly.
57148 If the limit is greater than 99, the script uses 3-digit numbers such as
57149 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
57150 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
57151 any existing log files.
57154 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
57155 the end are deleted. All files with numbers greater than 01 are compressed,
57156 using a compression command which is configured by the COMPRESS_COMMAND
57157 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
57158 root <option>crontab</option> entry of the form
57160 <literallayout class="monospaced">
57161 1 0 * * * su exim -c /usr/exim/bin/exicyclog
57164 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
57165 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
57168 <section id="SECTmailstat">
57169 <title>Mail statistics (eximstats)</title>
57171 <indexterm role="concept">
57172 <primary>statistics</primary>
57174 <indexterm role="concept">
57175 <primary><emphasis>eximstats</emphasis></primary>
57177 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
57178 information from log files. The output is either plain text, or HTML.
57179 Exim log files are also suported by the <emphasis>Lire</emphasis> system produced by the
57180 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
57183 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
57184 latest version is the result of some extensive revision by Steve Campbell. A
57185 lot of information is given by default, but there are options for suppressing
57186 various parts of it. Following any options, the arguments to the script are a
57187 list of files, which should be main log files. For example:
57189 <literallayout class="monospaced">
57190 eximstats -nr /var/spool/exim/log/mainlog.01
57193 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
57194 messages received from or delivered to various hosts. The information is sorted
57195 both by message count and by volume, and the top fifty hosts in each category
57196 are listed on the standard output. Similar information, based on email
57197 addresses or domains instead of hosts can be requested by means of various
57198 options. For messages delivered and received locally, similar statistics are
57199 also produced per user.
57202 The output also includes total counts and statistics about delivery errors, and
57203 histograms showing the number of messages received and deliveries made in each
57204 hour of the day. A delivery with more than one address in its envelope (for
57205 example, an SMTP transaction with more than one RCPT command) is counted
57206 as a single delivery by <emphasis>eximstats</emphasis>.
57209 Though normally more deliveries than receipts are reported (as messages may
57210 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
57211 messages received than delivered, even though the queue is empty at the start
57212 and end of the period in question. If an incoming message contains no valid
57213 recipients, no deliveries are recorded for it. A bounce message is handled as
57214 an entirely separate message.
57217 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
57218 of messages received and deliveries made, and the number of hosts involved in
57219 each case. It also outputs the number of messages that were delayed (that is,
57220 not completely delivered at the first attempt), and the number that had at
57221 least one address that failed.
57224 The remainder of the output is in sections that can be independently disabled
57225 or modified by various options. It consists of a summary of deliveries by
57226 transport, histograms of messages received and delivered per time interval
57227 (default per hour), information about the time messages spent on the queue,
57228 a list of relayed messages, lists of the top fifty sending hosts, local
57229 senders, destination hosts, and destination local users by count and by volume,
57230 and a list of delivery errors that occurred.
57233 The relay information lists messages that were actually relayed, that is, they
57234 came from a remote host and were directly delivered to some other remote host,
57235 without being processed (for example, for aliasing or forwarding) locally.
57238 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
57239 outputs. These are documented in the Perl script itself, and can be extracted
57240 by running the command <command>perldoc</command> on the script. For example:
57242 <literallayout class="monospaced">
57243 perldoc /usr/exim/bin/eximstats
57246 <section id="SECTcheckaccess">
57247 <title>Checking access policy (exim_checkaccess)</title>
57249 <indexterm role="concept">
57250 <primary><emphasis>exim_checkaccess</emphasis></primary>
57252 <indexterm role="concept">
57253 <primary>policy control</primary>
57254 <secondary>checking access</secondary>
57256 <indexterm role="concept">
57257 <primary>checking access</primary>
57259 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
57260 debugging output, in order to check what Exim is doing when it is applying
57261 policy controls to incoming SMTP mail. However, not everybody is sufficiently
57262 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
57263 sometimes you just want to answer the question <quote>Does this address have
57264 access?</quote> without bothering with any further details.
57267 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
57268 two arguments, an IP address and an email address:
57270 <literallayout class="monospaced">
57271 exim_checkaccess 10.9.8.7 A.User@a.domain.example
57274 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
57275 given email address would be accepted in a RCPT command in a TCP/IP
57276 connection from the host with the given IP address. The output of the utility
57277 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
57279 <literallayout class="monospaced">
57281 550 Relay not permitted
57284 When running this test, the utility uses <literal><></literal> as the envelope sender address
57285 for the MAIL command, but you can change this by providing additional
57286 options. These are passed directly to the Exim command. For example, to specify
57287 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
57290 <literallayout class="monospaced">
57291 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
57292 -f himself@there.example
57295 Note that these additional Exim command line items must be given after the two
57296 mandatory arguments.
57299 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
57300 while running its checks. You can run checks that include callouts by using
57301 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
57304 <section id="SECTdbmbuild">
57305 <title>Making DBM files (exim_dbmbuild)</title>
57307 <indexterm role="concept">
57308 <primary>DBM</primary>
57309 <secondary>building dbm files</secondary>
57311 <indexterm role="concept">
57312 <primary>building DBM files</primary>
57314 <indexterm role="concept">
57315 <primary><emphasis>exim_dbmbuild</emphasis></primary>
57317 <indexterm role="concept">
57318 <primary>lower casing</primary>
57320 <indexterm role="concept">
57321 <primary>binary zero</primary>
57322 <secondary>in lookup key</secondary>
57324 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
57325 the format used by the <command>lsearch</command> lookup (see section
57326 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
57327 names as keys and the remainder of the information as data. The lower-casing
57328 can be prevented by calling the program with the <option>-nolc</option> option.
57331 A terminating zero is included as part of the key string. This is expected by
57332 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
57333 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
57334 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
57338 The program requires two arguments: the name of the input file (which can be a
57339 single hyphen to indicate the standard input), and the name of the output file.
57340 It creates the output under a temporary name, and then renames it if all went
57344 <indexterm role="concept">
57345 <primary>USE_DB</primary>
57347 If the native DB interface is in use (USE_DB is set in a compile-time
57348 configuration file – this is common in free versions of Unix) the two file
57349 names must be different, because in this mode the Berkeley DB functions create
57350 a single output file using exactly the name given. For example,
57352 <literallayout class="monospaced">
57353 exim_dbmbuild /etc/aliases /etc/aliases.db
57356 reads the system alias file and creates a DBM version of it in
57357 <filename>/etc/aliases.db</filename>.
57360 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
57361 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
57362 environment, the suffixes are added to the second argument of
57363 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
57364 when the Berkeley functions are used in compatibility mode (though this is not
57365 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
57368 If a duplicate key is encountered, the program outputs a warning, and when it
57369 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
57370 option is used. By default, only the first of a set of duplicates is used –
57371 this makes it compatible with <command>lsearch</command> lookups. There is an option
57372 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
57373 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
57374 <option>stderr</option>. For other errors, where it doesn’t actually make a new file, the
57378 <section id="SECTfinindret">
57379 <title>Finding individual retry times (exinext)</title>
57381 <indexterm role="concept">
57382 <primary>retry</primary>
57383 <secondary>times</secondary>
57385 <indexterm role="concept">
57386 <primary><emphasis>exinext</emphasis></primary>
57388 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
57389 fish specific information out of the retry database. Given a mail domain (or a
57390 complete address), it looks up the hosts for that domain, and outputs any retry
57391 information for the hosts or for the domain. At present, the retry information
57392 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
57393 output. For example:
57395 <literallayout class="monospaced">
57396 $ exinext piglet@milne.fict.example
57397 kanga.milne.example:192.168.8.1 error 146: Connection refused
57398 first failed: 21-Feb-1996 14:57:34
57399 last tried: 21-Feb-1996 14:57:34
57400 next try at: 21-Feb-1996 15:02:34
57401 roo.milne.example:192.168.8.3 error 146: Connection refused
57402 first failed: 20-Jan-1996 13:12:08
57403 last tried: 21-Feb-1996 11:42:03
57404 next try at: 21-Feb-1996 19:42:03
57405 past final cutoff time
57408 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
57409 will give any retry information for that local part in your default domain.
57410 A message id can be used to obtain retry information pertaining to a specific
57411 message. This exists only when an attempt to deliver a message to a remote host
57412 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
57413 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
57417 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
57418 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
57419 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
57420 configuration file, and the second sets macros for use within the configuration
57421 file. These features are mainly to help in testing, but might also be useful in
57422 environments where more than one configuration file is in use.
57425 <section id="SECThindatmai">
57426 <title>Hints database maintenance</title>
57428 <indexterm role="concept">
57429 <primary>hints database</primary>
57430 <secondary>maintenance</secondary>
57432 <indexterm role="concept">
57433 <primary>maintaining Exim’s hints database</primary>
57435 Three utility programs are provided for maintaining the DBM files that Exim
57436 uses to contain its delivery hint information. Each program requires two
57437 arguments. The first specifies the name of Exim’s spool directory, and the
57438 second is the name of the database it is to operate on. These are as follows:
57443 <emphasis>retry</emphasis>: the database of retry information
57448 <emphasis>wait-</emphasis><<emphasis>transport name</emphasis>>: databases of information about messages waiting
57454 <emphasis>callout</emphasis>: the callout cache
57459 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
57464 <emphasis>misc</emphasis>: other hints data
57469 The <emphasis>misc</emphasis> database is used for
57474 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
57479 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
57480 <command>smtp</command> transport)
57486 <title>exim_dumpdb</title>
57488 <indexterm role="concept">
57489 <primary><emphasis>exim_dumpdb</emphasis></primary>
57491 The entire contents of a database are written to the standard output by the
57492 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
57493 spool and database names. For example, to dump the retry database:
57495 <literallayout class="monospaced">
57496 exim_dumpdb /var/spool/exim retry
57499 Two lines of output are produced for each entry:
57501 <literallayout class="monospaced">
57502 T:mail.ref.example:192.168.242.242 146 77 Connection refused
57503 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
57506 The first item on the first line is the key of the record. It starts with one
57507 of the letters R, or T, depending on whether it refers to a routing or
57508 transport retry. For a local delivery, the next part is the local address; for
57509 a remote delivery it is the name of the remote host, followed by its failing IP
57510 address (unless <option>no_retry_include_ip_address</option> is set on the <command>smtp</command>
57511 transport). If the remote port is not the standard one (port 25), it is added
57512 to the IP address. Then there follows an error code, an additional error code,
57513 and a textual description of the error.
57516 The three times on the second line are the time of first failure, the time of
57517 the last delivery attempt, and the computed time for the next attempt. The line
57518 ends with an asterisk if the cutoff time for the last retry rule has been
57522 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
57523 consists of a host name followed by a list of ids for messages that are or were
57524 waiting to be delivered to that host. If there are a very large number for any
57525 one host, continuation records, with a sequence number added to the host name,
57526 may be seen. The data in these records is often out of date, because a message
57527 may be routed to several alternative hosts, and Exim makes no effort to keep
57532 <title>exim_tidydb</title>
57534 <indexterm role="concept">
57535 <primary><emphasis>exim_tidydb</emphasis></primary>
57537 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
57538 database. If run with no options, it removes all records that are more than 30
57539 days old. The age is calculated from the date and time that the record was last
57540 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
57541 since the first delivery failure. Information about a host that has been down
57542 for more than 30 days will remain in the database, provided that the record is
57543 updated sufficiently often.
57546 The cutoff date can be altered by means of the <option>-t</option> option, which must be
57547 followed by a time. For example, to remove all records older than a week from
57548 the retry database:
57550 <literallayout class="monospaced">
57551 exim_tidydb -t 7d /var/spool/exim retry
57554 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
57555 message ids. In the former these appear as data in records keyed by host –
57556 they were messages that were waiting for that host – and in the latter they
57557 are the keys for retry information for messages that have suffered certain
57558 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
57559 message ids in database records are those of messages that are still on the
57560 queue. Message ids for messages that no longer exist are removed from
57561 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
57562 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
57563 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
57564 whenever it removes information from the database.
57567 Certain records are automatically removed by Exim when they are no longer
57568 needed, but others are not. For example, if all the MX hosts for a domain are
57569 down, a retry record is created for each one. If the primary MX host comes back
57570 first, its record is removed when Exim successfully delivers to it, but the
57571 records for the others remain because Exim has not tried to use those hosts.
57574 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
57575 hints databases. You should do this at a quiet time of day, because it requires
57576 a database to be locked (and therefore inaccessible to Exim) while it does its
57577 work. Removing records from a DBM file does not normally make the file smaller,
57578 but all the common DBM libraries are able to re-use the space that is released.
57579 After an initial phase of increasing in size, the databases normally reach a
57580 point at which they no longer get any bigger, as long as they are regularly
57584 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
57585 databases is likely to keep on increasing.
57589 <title>exim_fixdb</title>
57591 <indexterm role="concept">
57592 <primary><emphasis>exim_fixdb</emphasis></primary>
57594 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
57595 Its main use is for testing Exim, but it might also be occasionally useful for
57596 getting round problems in a live system. It has no options, and its interface
57597 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
57598 key of a database record can then be entered, and the data for that record is
57602 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
57603 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
57604 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
57605 data for individual fields can be changed by typing the field number followed
57606 by new data, for example:
57608 <literallayout class="monospaced">
57612 resets the time of the next delivery attempt. Time values are given as a
57613 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
57614 used as optional separators.
57617 <section id="SECTmailboxmaint">
57618 <title>Mailbox maintenance (exim_lock)</title>
57620 <indexterm role="concept">
57621 <primary>mailbox</primary>
57622 <secondary>maintenance</secondary>
57624 <indexterm role="concept">
57625 <primary><emphasis>exim_lock</emphasis></primary>
57627 <indexterm role="concept">
57628 <primary>locking mailboxes</primary>
57630 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
57631 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
57632 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
57633 a user agent while investigating a problem. The utility requires the name of
57634 the file as its first argument. If the locking is successful, the second
57635 argument is run as a command (using C’s <function>system()</function> function); if there is no
57636 second argument, the value of the SHELL environment variable is used; if this
57637 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
57638 is unlocked and the utility ends. The following options are available:
57642 <term><option>-fcntl</option></term>
57645 Use <function>fcntl()</function> locking on the open mailbox.
57647 </listitem></varlistentry>
57649 <term><option>-flock</option></term>
57652 Use <function>flock()</function> locking on the open mailbox, provided the operating system
57655 </listitem></varlistentry>
57657 <term><option>-interval</option></term>
57660 This must be followed by a number, which is a number of seconds; it sets the
57661 interval to sleep between retries (default 3).
57663 </listitem></varlistentry>
57665 <term><option>-lockfile</option></term>
57668 Create a lock file before opening the mailbox.
57670 </listitem></varlistentry>
57672 <term><option>-mbx</option></term>
57675 Lock the mailbox using MBX rules.
57677 </listitem></varlistentry>
57679 <term><option>-q</option></term>
57682 Suppress verification output.
57684 </listitem></varlistentry>
57686 <term><option>-retries</option></term>
57689 This must be followed by a number; it sets the number of times to try to get
57690 the lock (default 10).
57692 </listitem></varlistentry>
57694 <term><option>-restore_time</option></term>
57697 This option causes <option>exim_lock</option> to restore the modified and read times to the
57698 locked file before exiting. This allows you to access a locked mailbox (for
57699 example, to take a backup copy) without disturbing the times that the user
57702 </listitem></varlistentry>
57704 <term><option>-timeout</option></term>
57707 This must be followed by a number, which is a number of seconds; it sets a
57708 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
57709 default), a non-blocking call is used.
57711 </listitem></varlistentry>
57713 <term><option>-v</option></term>
57716 Generate verbose output.
57718 </listitem></varlistentry>
57721 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
57722 default is to create a lock file and also to use <function>fcntl()</function> locking on the
57723 mailbox, which is the same as Exim’s default. The use of <option>-flock</option> or
57724 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
57725 requires that the directory containing the file be writeable. Locking by lock
57726 file does not last for ever; Exim assumes that a lock file is expired if it is
57727 more than 30 minutes old.
57730 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
57731 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
57732 to be taken out on the open mailbox, and an exclusive lock on the file
57733 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
57734 number of the mailbox file. When the locking is released, if an exclusive lock
57735 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
57738 The default output contains verification of the locking that takes place. The
57739 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
57740 suppresses all output except error messages.
57745 <literallayout class="monospaced">
57746 exim_lock /var/spool/mail/spqr
57749 runs an interactive shell while the file is locked, whereas
57752 <literal>exim_lock -q /var/spool/mail/spqr <<End</literal>
57753 <<emphasis>some commands</emphasis>>
57754 <literal>End</literal>
57757 runs a specific non-interactive sequence of commands while the file is locked,
57758 suppressing all verification output. A single command can be run by a command
57761 <literallayout class="monospaced">
57762 exim_lock -q /var/spool/mail/spqr \
57763 "cp /var/spool/mail/spqr /some/where"
57766 Note that if a command is supplied, it must be entirely contained within the
57767 second argument – hence the quotes.
57768 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
57773 <chapter id="CHAPeximon">
57774 <title>The Exim monitor</title>
57776 <indexterm role="concept" id="IIDeximon" class="startofrange">
57777 <primary>Exim monitor</primary>
57778 <secondary>description</secondary>
57780 <indexterm role="concept">
57781 <primary>X-windows</primary>
57783 <indexterm role="concept">
57784 <primary><emphasis>eximon</emphasis></primary>
57786 <indexterm role="concept">
57787 <primary>Local/eximon.conf</primary>
57789 <indexterm role="concept">
57790 <primary>_exim_monitor/EDITME_</primary>
57792 The Exim monitor is an application which displays in an X window information
57793 about the state of Exim’s queue and what Exim is doing. An admin user can
57794 perform certain operations on messages from this GUI interface; however all
57795 such facilities are also available from the command line, and indeed, the
57796 monitor itself makes use of the command line to perform any actions requested.
57799 <title>Running the monitor</title>
57801 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
57802 script that sets up a number of environment variables, and then runs the
57803 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
57804 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
57805 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
57806 parameters are for.
57809 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
57810 a particular invocation by setting up environment variables of the same names,
57811 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
57813 <literallayout class="monospaced">
57814 EXIMON_LOG_DEPTH=400 eximon
57817 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
57818 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
57819 overrides the Exim log file configuration. This makes it possible to have
57820 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
57821 syslog messages are routed to a file on the local host.
57824 X resources can be used to change the appearance of the window in the normal
57825 way. For example, a resource setting of the form
57827 <literallayout class="monospaced">
57828 Eximon*background: gray94
57831 changes the colour of the background to light grey rather than white. The
57832 stripcharts are drawn with both the data lines and the reference lines in
57833 black. This means that the reference lines are not visible when on top of the
57834 data. However, their colour can be changed by setting a resource called
57835 <quote>highlight</quote> (an odd name, but that’s what the Athena stripchart widget uses).
57836 For example, if your X server is running Unix, you could set up lighter
57837 reference lines in the stripcharts by obeying
57839 <literallayout class="monospaced">
57840 xrdb -merge <<End
57841 Eximon*highlight: gray
57845 <indexterm role="concept">
57846 <primary>admin user</primary>
57848 In order to see the contents of messages on the queue, and to operate on them,
57849 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
57852 The monitor’s window is divided into three parts. The first contains one or
57853 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
57854 main log file, and the third is a display of the queue of messages awaiting
57855 delivery, with two more action buttons. The following sections describe these
57856 different parts of the display.
57860 <title>The stripcharts</title>
57862 <indexterm role="concept">
57863 <primary>stripchart</primary>
57865 The first stripchart is always a count of messages on the queue. Its name can
57866 be configured by setting QUEUE_STRIPCHART_NAME in the
57867 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
57868 configuration script by regular expression matches on log file entries, making
57869 it possible to display, for example, counts of messages delivered to certain
57870 hosts or using certain transports. The supplied defaults display counts of
57871 received and delivered messages, and of local and SMTP deliveries. The default
57872 period between stripchart updates is one minute; this can be adjusted by a
57873 parameter in the <filename>Local/eximon.conf</filename> file.
57876 The stripchart displays rescale themselves automatically as the value they are
57877 displaying changes. There are always 10 horizontal lines in each chart; the
57878 title string indicates the value of each division when it is greater than one.
57879 For example, <quote>x2</quote> means that each division represents a value of 2.
57882 It is also possible to have a stripchart which shows the percentage fullness of
57883 a particular disk partition, which is useful when local deliveries are confined
57884 to a single partition.
57887 <indexterm role="concept">
57888 <primary><option>statvfs</option> function</primary>
57890 This relies on the availability of the <function>statvfs()</function> function or equivalent in
57891 the operating system. Most, but not all versions of Unix that support Exim have
57892 this. For this particular stripchart, the top of the chart always represents
57893 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
57894 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
57895 <filename>Local/eximon.conf</filename> file.
57899 <title>Main action buttons</title>
57901 <indexterm role="concept">
57902 <primary>size</primary>
57903 <secondary>of monitor window</secondary>
57905 <indexterm role="concept">
57906 <primary>Exim monitor</primary>
57907 <secondary>window size</secondary>
57909 <indexterm role="concept">
57910 <primary>window size</primary>
57912 Below the stripcharts there is an action button for quitting the monitor. Next
57913 to this is another button marked <quote>Size</quote>. They are placed here so that
57914 shrinking the window to its default minimum size leaves just the queue count
57915 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
57916 the window to expand to its maximum size, unless it is already at the maximum,
57917 in which case it is reduced to its minimum.
57920 When expanding to the maximum, if the window cannot be fully seen where it
57921 currently is, it is moved back to where it was the last time it was at full
57922 size. When it is expanding from its minimum size, the old position is
57923 remembered, and next time it is reduced to the minimum it is moved back there.
57926 The idea is that you can keep a reduced window just showing one or two
57927 stripcharts at a convenient place on your screen, easily expand it to show
57928 the full window when required, and just as easily put it back to what it was.
57929 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
57930 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
57931 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
57934 Normally, the monitor starts up with the window at its full size, but it can be
57935 built so that it starts up with the window at its smallest size, by setting
57936 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
57940 <title>The log display</title>
57942 <indexterm role="concept">
57943 <primary>log</primary>
57944 <secondary>tail of; in monitor</secondary>
57946 The second section of the window is an area in which a display of the tail of
57947 the main log is maintained.
57948 To save space on the screen, the timestamp on each log line is shortened by
57949 removing the date and, if <option>log_timezone</option> is set, the timezone.
57950 The log tail is not available when the only destination for logging data is
57951 syslog, unless the syslog lines are routed to a local file whose name is passed
57952 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
57955 The log sub-window has a scroll bar at its lefthand side which can be used to
57956 move back to look at earlier text, and the up and down arrow keys also have a
57957 scrolling effect. The amount of log that is kept depends on the setting of
57958 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
57959 to use. When this is full, the earlier 50% of data is discarded – this is
57960 much more efficient than throwing it away line by line. The sub-window also has
57961 a horizontal scroll bar for accessing the ends of long log lines. This is the
57962 only means of horizontal scrolling; the right and left arrow keys are not
57963 available. Text can be cut from this part of the window using the mouse in the
57964 normal way. The size of this subwindow is controlled by parameters in the
57965 configuration file <filename>Local/eximon.conf</filename>.
57968 Searches of the text in the log window can be carried out by means of the ^R
57969 and ^S keystrokes, which default to a reverse and a forward search,
57970 respectively. The search covers only the text that is displayed in the window.
57971 It cannot go further back up the log.
57974 The point from which the search starts is indicated by a caret marker. This is
57975 normally at the end of the text in the window, but can be positioned explicitly
57976 by pointing and clicking with the left mouse button, and is moved automatically
57977 by a successful search. If new text arrives in the window when it is scrolled
57978 back, the caret remains where it is, but if the window is not scrolled back,
57979 the caret is moved to the end of the new text.
57982 Pressing ^R or ^S pops up a window into which the search text can be typed.
57983 There are buttons for selecting forward or reverse searching, for carrying out
57984 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
57985 happens and the window remains so that further searches can be done. If the
57986 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
57987 ^C is typed the search is cancelled.
57990 The searching facility is implemented using the facilities of the Athena text
57991 widget. By default this pops up a window containing both <quote>search</quote> and
57992 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
57993 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
57994 However, the linkers in BSDI and HP-UX seem unable to handle an externally
57995 provided version of <option>TextPop</option> when the remaining parts of the text widget
57996 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
57997 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
57998 on these systems, at the expense of having unwanted items in the search popup
58003 <title>The queue display</title>
58005 <indexterm role="concept">
58006 <primary>queue</primary>
58007 <secondary>display in monitor</secondary>
58009 The bottom section of the monitor window contains a list of all messages that
58010 are on the queue, which includes those currently being received or delivered,
58011 as well as those awaiting delivery. The size of this subwindow is controlled by
58012 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
58013 at which it is updated is controlled by another parameter in the same file –
58014 the default is 5 minutes, since queue scans can be quite expensive. However,
58015 there is an <quote>Update</quote> action button just above the display which can be used
58016 to force an update of the queue display at any time.
58019 When a host is down for some time, a lot of pending mail can build up for it,
58020 and this can make it hard to deal with other messages on the queue. To help
58021 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
58022 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
58023 type anything in here and press <quote>Return</quote>, the text is added to a chain of
58024 such texts, and if every undelivered address in a message matches at least one
58025 of the texts, the message is not displayed.
58028 If there is an address that does not match any of the texts, all the addresses
58029 are displayed as normal. The matching happens on the ends of addresses so, for
58030 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
58031 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
58032 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
58033 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
58034 a hide request is automatically cancelled after one hour.
58037 While the dialogue box is displayed, you can’t press any buttons or do anything
58038 else to the monitor window. For this reason, if you want to cut text from the
58039 queue display to use in the dialogue box, you have to do the cutting before
58040 pressing the <quote>Hide</quote> button.
58043 The queue display contains, for each unhidden queued message, the length of
58044 time it has been on the queue, the size of the message, the message id, the
58045 message sender, and the first undelivered recipient, all on one line. If it is
58046 a bounce message, the sender is shown as <quote><></quote>. If there is more than one
58047 recipient to which the message has not yet been delivered, subsequent ones are
58048 listed on additional lines, up to a maximum configured number, following which
58049 an ellipsis is displayed. Recipients that have already received the message are
58053 <indexterm role="concept">
58054 <primary>frozen messages</primary>
58055 <secondary>display</secondary>
58057 If a message is frozen, an asterisk is displayed at the left-hand side.
58060 The queue display has a vertical scroll bar, and can also be scrolled by means
58061 of the arrow keys. Text can be cut from it using the mouse in the normal way.
58062 The text searching facilities, as described above for the log window, are also
58063 available, but the caret is always moved to the end of the text when the queue
58064 display is updated.
58068 <title>The queue menu</title>
58070 <indexterm role="concept">
58071 <primary>queue</primary>
58072 <secondary>menu in monitor</secondary>
58074 If the <option>shift</option> key is held down and the left button is clicked when the mouse
58075 pointer is over the text for any message, an action menu pops up, and the first
58076 line of the queue display for the message is highlighted. This does not affect
58080 If you want to use some other event for popping up the menu, you can set the
58081 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
58082 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
58083 value set in this parameter is a standard X event description. For example, to
58084 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
58086 <literallayout class="monospaced">
58087 EXIMON_MENU_EVENT='Ctrl<Btn1Down>' eximon
58090 The title of the menu is the message id, and it contains entries which act as
58096 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
58097 in a new text window.
58102 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
58103 information and headers is displayed in a new text window. See chapter
58104 <xref linkend="CHAPspool"/> for a description of the format of spool files.
58109 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
58110 displayed in a new text window. There is a default limit of 20,000 bytes to the
58111 amount of data displayed. This can be changed by setting the BODY_MAX
58112 option at compile time, or the EXIMON_BODY_MAX option at run time.
58117 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
58118 delivery of the message. This causes an automatic thaw if the message is
58119 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
58120 a new text window. The delivery is run in a separate process, to avoid holding
58121 up the monitor while the delivery proceeds.
58126 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
58127 that the message be frozen.
58132 <indexterm role="concept">
58133 <primary>thawing messages</primary>
58135 <indexterm role="concept">
58136 <primary>unfreezing messages</primary>
58138 <indexterm role="concept">
58139 <primary>frozen messages</primary>
58140 <secondary>thawing</secondary>
58142 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
58143 that the message be thawed.
58148 <indexterm role="concept">
58149 <primary>delivery</primary>
58150 <secondary>forcing failure</secondary>
58152 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
58153 that Exim gives up trying to deliver the message. A bounce message is generated
58154 for any remaining undelivered addresses.
58159 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
58160 that the message be deleted from the system without generating a bounce
58166 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
58167 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
58168 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
58169 Otherwise it must be entered as a fully qualified address. Pressing RETURN
58170 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
58171 additional recipient be added to the message, unless the entry box is empty, in
58172 which case no action is taken.
58177 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
58178 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
58179 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
58180 Otherwise it must be entered as a fully qualified address. Pressing RETURN
58181 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
58182 recipient address as already delivered, unless the entry box is empty, in which
58183 case no action is taken.
58188 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
58189 mark all recipient addresses as already delivered.
58194 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
58195 sender’s address. Pressing RETURN causes a call to Exim to be made using the
58196 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
58197 in which case no action is taken. If you want to set an empty sender (as in
58198 bounce messages), you must specify it as <quote><></quote>. Otherwise, if the address is
58199 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
58200 the address is qualified with that domain.
58205 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
58206 other cases when a call to Exim is made, if there is any output from Exim (in
58207 particular, if the command fails) a window containing the command and the
58208 output is displayed. Otherwise, the results of the action are normally apparent
58209 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
58210 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
58211 if no output is generated.
58214 The queue display is automatically updated for actions such as freezing and
58215 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
58216 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
58217 force an update of the display after one of these actions.
58220 In any text window that is displayed as result of a menu action, the normal
58221 cut-and-paste facility is available, and searching can be carried out using ^R
58222 and ^S, as described above for the log tail window.
58223 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
58228 <chapter id="CHAPsecurity">
58229 <title>Security considerations</title>
58231 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
58232 <primary>security</primary>
58233 <secondary>discussion of</secondary>
58235 This chapter discusses a number of issues concerned with security, some of
58236 which are also covered in other parts of this manual.
58239 For reasons that this author does not understand, some people have promoted
58240 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
58241 existence of this chapter in the documentation. However, the intent of the
58242 chapter is simply to describe the way Exim works in relation to certain
58243 security concerns, not to make any specific claims about the effectiveness of
58244 its security as compared with other MTAs.
58247 What follows is a description of the way Exim is supposed to be. Best efforts
58248 have been made to try to ensure that the code agrees with the theory, but an
58249 absence of bugs can never be guaranteed. Any that are reported will get fixed
58250 as soon as possible.
58253 <title>Building a more <quote>hardened</quote> Exim</title>
58255 <indexterm role="concept">
58256 <primary>security</primary>
58257 <secondary>build-time features</secondary>
58259 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
58260 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
58261 Exim administrator who does not have the root password, or by someone who has
58262 penetrated the Exim (but not the root) account. These options are as follows:
58267 ALT_CONFIG_PREFIX can be set to a string that is required to match the
58268 start of any file names used with the <option>-C</option> option. When it is set, these file
58269 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
58270 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
58271 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
58272 default setting for <option>ALT_CONFIG_PREFIX</option>.
58275 If the permitted configuration files are confined to a directory to
58276 which only root has access, this guards against someone who has broken
58277 into the Exim account from running a privileged Exim with an arbitrary
58278 configuration file, and using it to break into other accounts.
58283 If ALT_CONFIG_ROOT_ONLY is defined, root privilege is retained for <option>-C</option>
58284 and <option>-D</option> only if the caller of Exim is root. Without it, the Exim user may
58285 also use <option>-C</option> and <option>-D</option> and retain privilege. Setting this option locks out
58286 the possibility of testing a configuration using <option>-C</option> right through message
58287 reception and delivery, even if the caller is root. The reception works, but by
58288 that time, Exim is running as the Exim user, so when it re-execs to regain
58289 privilege for the delivery, the use of <option>-C</option> causes privilege to be lost.
58290 However, root can test reception and delivery using two separate commands.
58291 ALT_CONFIG_ROOT_ONLY is not set by default.
58296 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
58302 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
58303 never to be used for any deliveries. This is like the <option>never_users</option> runtime
58304 option, but it cannot be overridden; the runtime option adds additional users
58305 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
58306 is permitted to modify the runtime file from using Exim as a way to get root.
58312 <title>Root privilege</title>
58314 <indexterm role="concept">
58315 <primary>setuid</primary>
58317 <indexterm role="concept">
58318 <primary>root privilege</primary>
58320 The Exim binary is normally setuid to root, which means that it gains root
58321 privilege (runs as root) when it starts execution. In some special cases (for
58322 example, when the daemon is not in use and there are no local deliveries), it
58323 may be possible to run Exim setuid to some user other than root. This is
58324 discussed in the next section. However, in most installations, root privilege
58325 is required for two things:
58330 To set up a socket connected to the standard SMTP port (25) when initialising
58331 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
58337 To be able to change uid and gid in order to read users’ <filename>.forward</filename> files and
58338 perform local deliveries as the receiving user or as specified in the
58344 It is not necessary to be root to do any of the other things Exim does, such as
58345 receiving messages and delivering them externally over SMTP, and it is
58346 obviously more secure if Exim does not run as root except when necessary.
58347 For this reason, a user and group for Exim to use must be defined in
58348 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
58349 group</quote>. Their values can be changed by the run time configuration, though this
58350 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
58351 <emphasis>mail</emphasis> or another user name altogether.
58354 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
58355 abdication; the process cannot regain root afterwards. Prior to release 4.00,
58356 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
58359 After a new Exim process has interpreted its command line options, it changes
58360 uid and gid in the following cases:
58365 <indexterm role="concept">
58366 <primary><option>-C</option> option</primary>
58368 <indexterm role="concept">
58369 <primary><option>-D</option> option</primary>
58371 If the <option>-C</option> option is used to specify an alternate configuration file, or if
58372 the <option>-D</option> option is used to define macro values for the configuration, and the
58373 calling process is not running as root or the Exim user, the uid and gid are
58374 changed to those of the calling process.
58375 However, if ALT_CONFIG_ROOT_ONLY is defined in <filename>Local/Makefile</filename>, only
58376 root callers may use <option>-C</option> and <option>-D</option> without losing privilege, and if
58377 DISABLE_D_OPTION is set, the <option>-D</option> option may not be used at all.
58382 <indexterm role="concept">
58383 <primary><option>-be</option> option</primary>
58385 <indexterm role="concept">
58386 <primary><option>-bf</option> option</primary>
58388 <indexterm role="concept">
58389 <primary><option>-bF</option> option</primary>
58391 If the expansion test option (<option>-be</option>) or one of the filter testing options
58392 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
58398 If the process is not a daemon process or a queue runner process or a delivery
58399 process or a process for testing address routing (started with <option>-bt</option>), the
58400 uid and gid are changed to the Exim user and group. This means that Exim always
58401 runs under its own uid and gid when receiving messages. This also applies when
58402 testing address verification
58403 <indexterm role="concept">
58404 <primary><option>-bv</option> option</primary>
58406 <indexterm role="concept">
58407 <primary><option>-bh</option> option</primary>
58409 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
58415 For a daemon, queue runner, delivery, or address testing process, the uid
58416 remains as root at this stage, but the gid is changed to the Exim group.
58421 The processes that initially retain root privilege behave as follows:
58426 A daemon process changes the gid to the Exim group and the uid to the Exim
58427 user after setting up one or more listening sockets. The <function>initgroups()</function>
58428 function is called, so that if the Exim user is in any additional groups, they
58429 will be used during message reception.
58434 A queue runner process retains root privilege throughout its execution. Its
58435 job is to fork a controlled sequence of delivery processes.
58440 A delivery process retains root privilege throughout most of its execution,
58441 but any actual deliveries (that is, the transports themselves) are run in
58442 subprocesses which always change to a non-root uid and gid. For local
58443 deliveries this is typically the uid and gid of the owner of the mailbox; for
58444 remote deliveries, the Exim uid and gid are used. Once all the delivery
58445 subprocesses have been run, a delivery process changes to the Exim uid and gid
58446 while doing post-delivery tidying up such as updating the retry database and
58447 generating bounce and warning messages.
58450 While the recipient addresses in a message are being routed, the delivery
58451 process runs as root. However, if a user’s filter file has to be processed,
58452 this is done in a subprocess that runs under the individual user’s uid and
58453 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
58458 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
58459 the routing is done in the same environment as a message delivery.
58464 <section id="SECTrunexiwitpri">
58465 <title>Running Exim without privilege</title>
58467 <indexterm role="concept">
58468 <primary>privilege</primary>
58469 <secondary>running without</secondary>
58471 <indexterm role="concept">
58472 <primary>unprivileged running</primary>
58474 <indexterm role="concept">
58475 <primary>root privilege</primary>
58476 <secondary>running without</secondary>
58478 Some installations like to run Exim in an unprivileged state for more of its
58479 operation, for added security. Support for this mode of operation is provided
58480 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
58481 gid are changed to the Exim user and group at the start of a delivery process
58482 (and also queue runner and address testing processes). This means that address
58483 routing is no longer run as root, and the deliveries themselves cannot change
58487 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
58488 that the daemon can still be started in the usual way, and it can respond
58489 correctly to SIGHUP because the re-invocation regains root privilege.
58492 An alternative approach is to make Exim setuid to the Exim user and also setgid
58494 If you do this, the daemon must be started from a root process. (Calling
58495 Exim from a root process makes it behave in the way it does when it is setuid
58496 root.) However, the daemon cannot restart itself after a SIGHUP signal because
58497 it cannot regain privilege.
58500 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
58501 stops Exim from trying to re-invoke itself to do a delivery after a message has
58502 been received. Such a re-invocation is a waste of resources because it has no
58506 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
58507 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
58508 to the Exim user seems a clean approach, but there is one complication:
58511 In this style of operation, Exim is running with the real uid and gid set to
58512 those of the calling process, and the effective uid/gid set to Exim’s values.
58513 Ideally, any association with the calling process’ uid/gid should be dropped,
58514 that is, the real uid/gid should be reset to the effective values so as to
58515 discard any privileges that the caller may have. While some operating systems
58516 have a function that permits this action for a non-root effective uid, quite a
58517 number of them do not. Because of this lack of standardization, Exim does not
58518 address this problem at this time.
58521 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
58522 is to keep the Exim binary setuid to root, and to set
58523 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
58524 be used in the most straightforward way.
58527 If you configure Exim not to run delivery processes as root, there are a
58528 number of restrictions on what you can do:
58533 You can deliver only as the Exim user/group. You should explicitly use the
58534 <option>user</option> and <option>group</option> options to override routers or local transports that
58535 normally deliver as the recipient. This makes sure that configurations that
58536 work in this mode function the same way in normal mode. Any implicit or
58537 explicit specification of another user causes an error.
58542 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
58543 not worthwhile to include them in the configuration.
58548 Users who wish to use <filename>.forward</filename> would have to make their home directory and
58549 the file itself accessible to the Exim user. Pipe and append-to-file entries,
58550 and their equivalents in Exim filters, cannot be used. While they could be
58551 enabled in the Exim user’s name, that would be insecure and not very useful.
58556 Unless the local user mailboxes are all owned by the Exim user (possible in
58557 some POP3 or IMAP-only environments):
58559 <orderedlist numeration="arabic">
58562 They must be owned by the Exim group and be writable by that group. This
58563 implies you must set <option>mode</option> in the appendfile configuration, as well as the
58564 mode of the mailbox files themselves.
58569 You must set <option>no_check_owner</option>, since most or all of the files will not be
58570 owned by the Exim user.
58575 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
58576 on a newly created mailbox when unprivileged. This also implies that new
58577 mailboxes need to be created manually.
58584 These restrictions severely restrict what can be done in local deliveries.
58585 However, there are no restrictions on remote deliveries. If you are running a
58586 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
58587 gives more security at essentially no cost.
58590 If you are using the <option>mua_wrapper</option> facility (see chapter
58591 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
58595 <title>Delivering to local files</title>
58597 Full details of the checks applied by <command>appendfile</command> before it writes to a file
58598 are given in chapter <xref linkend="CHAPappendfile"/>.
58602 <title>IPv4 source routing</title>
58604 <indexterm role="concept">
58605 <primary>source routing</primary>
58606 <secondary>in IP packets</secondary>
58608 <indexterm role="concept">
58609 <primary>IP source routing</primary>
58611 Many operating systems suppress IP source-routed packets in the kernel, but
58612 some cannot be made to do this, so Exim does its own check. It logs incoming
58613 IPv4 source-routed TCP calls, and then drops them. Things are all different in
58614 IPv6. No special checking is currently done.
58618 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
58620 Support for these SMTP commands is disabled by default. If required, they can
58621 be enabled by defining suitable ACLs.
58625 <title>Privileged users</title>
58627 <indexterm role="concept">
58628 <primary>trusted user</primary>
58630 <indexterm role="concept">
58631 <primary>admin user</primary>
58633 <indexterm role="concept">
58634 <primary>privileged user</primary>
58636 <indexterm role="concept">
58637 <primary>user</primary>
58638 <secondary>trusted</secondary>
58640 <indexterm role="concept">
58641 <primary>user</primary>
58642 <secondary>admin</secondary>
58644 Exim recognises two sets of users with special privileges. Trusted users are
58645 able to submit new messages to Exim locally, but supply their own sender
58646 addresses and information about a sending host. For other users submitting
58647 local messages, Exim sets up the sender address from the uid, and doesn’t
58648 permit a remote host to be specified.
58651 <indexterm role="concept">
58652 <primary><option>-f</option> option</primary>
58654 However, an untrusted user is permitted to use the <option>-f</option> command line option
58655 in the special form <option>-f <></option> to indicate that a delivery failure for the
58656 message should not cause an error report. This affects the message’s envelope,
58657 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
58658 permitted to use specific forms of address with the <option>-f</option> option by setting
58659 the <option>untrusted_set_sender</option> option.
58662 Trusted users are used to run processes that receive mail messages from some
58663 other mail domain and pass them on to Exim for delivery either locally, or over
58664 the Internet. Exim trusts a caller that is running as root, as the Exim user,
58665 as any user listed in the <option>trusted_users</option> configuration option, or under any
58666 group listed in the <option>trusted_groups</option> option.
58669 Admin users are permitted to do things to the messages on Exim’s queue. They
58670 can freeze or thaw messages, cause them to be returned to their senders, remove
58671 them entirely, or modify them in various ways. In addition, admin users can run
58672 the Exim monitor and see all the information it is capable of providing, which
58673 includes the contents of files on the spool.
58676 <indexterm role="concept">
58677 <primary><option>-M</option> option</primary>
58679 <indexterm role="concept">
58680 <primary><option>-q</option> option</primary>
58682 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
58683 delivery of messages on its queue is restricted to admin users. This
58684 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
58685 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
58686 queue is also restricted to admin users. This restriction can be relaxed by
58687 setting <option>no_queue_list_requires_admin</option>.
58690 Exim recognises an admin user if the calling process is running as root or as
58691 the Exim user or if any of the groups associated with the calling process is
58692 the Exim group. It is not necessary actually to be running under the Exim
58693 group. However, if admin users who are not root or the Exim user are to access
58694 the contents of files on the spool via the Exim monitor (which runs
58695 unprivileged), Exim must be built to allow group read access to its spool
58700 <title>Spool files</title>
58702 <indexterm role="concept">
58703 <primary>spool directory</primary>
58704 <secondary>files</secondary>
58706 Exim’s spool directory and everything it contains is owned by the Exim user and
58707 set to the Exim group. The mode for spool files is defined in the
58708 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
58709 any user who is a member of the Exim group can access these files.
58713 <title>Use of argv[0]</title>
58715 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
58716 of specific strings, Exim assumes certain options. For example, calling Exim
58717 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
58718 to calling it with the option <option>-bS</option>. There are no security implications in
58723 <title>Use of %f formatting</title>
58725 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
58726 are actually stored in integer variables as 1000 times the load average.
58727 Consequently, their range is limited and so therefore is the length of the
58732 <title>Embedded Exim path</title>
58734 Exim uses its own path name, which is embedded in the code, only when it needs
58735 to re-exec in order to regain root privilege. Therefore, it is not root when it
58736 does so. If some bug allowed the path to get overwritten, it would lead to an
58737 arbitrary program’s being run as exim, not as root.
58741 <title>Use of sprintf()</title>
58743 <indexterm role="concept">
58744 <primary><function>sprintf()</function></primary>
58746 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
58747 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc’d store.
58748 The intermediate formatting is done into a large fixed buffer by a function
58749 that runs through the format string itself, and checks the length of each
58750 conversion before performing it, thus preventing buffer overruns.
58753 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
58754 the output buffer is known to be sufficiently long to contain the converted
58759 <title>Use of debug_printf() and log_write()</title>
58761 Arbitrary strings are passed to both these functions, but they do their
58762 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
58763 the format string itself, and checks the length of each conversion.
58767 <title>Use of strcat() and strcpy()</title>
58769 These are used only in cases where the output buffer is known to be large
58770 enough to hold the result.
58771 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
58776 <chapter id="CHAPspool">
58777 <title>Format of spool files</title>
58779 <indexterm role="concept" id="IIDforspo1" class="startofrange">
58780 <primary>format</primary>
58781 <secondary>spool files</secondary>
58783 <indexterm role="concept" id="IIDforspo2" class="startofrange">
58784 <primary>spool directory</primary>
58785 <secondary>format of files</secondary>
58787 <indexterm role="concept" id="IIDforspo3" class="startofrange">
58788 <primary>spool files</primary>
58789 <secondary>format of</secondary>
58791 <indexterm role="concept">
58792 <primary>spool files</primary>
58793 <secondary>editing</secondary>
58795 A message on Exim’s queue consists of two files, whose names are the message id
58796 followed by -D and -H, respectively. The data portion of the message is kept in
58797 the -D file on its own. The message’s envelope, status, and headers are all
58798 kept in the -H file, whose format is described in this chapter. Each of these
58799 two files contains the final component of its own name as its first line. This
58800 is insurance against disk crashes where the directory is lost but the files
58801 themselves are recoverable.
58804 Some people are tempted into editing -D files in order to modify messages. You
58805 need to be extremely careful if you do this; it is not recommended and you are
58806 on your own if you do it. Here are some of the pitfalls:
58811 You must ensure that Exim does not try to deliver the message while you are
58812 fiddling with it. The safest way is to take out a write lock on the -D file,
58813 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
58814 place, the lock will be retained. If you write a new file and rename it, the
58815 lock will be lost at the instant of rename.
58820 <indexterm role="concept">
58821 <primary><varname>$body_linecount</varname></primary>
58823 If you change the number of lines in the file, the value of
58824 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect. At
58825 present, this value is not used by Exim, but there is no guarantee that this
58826 will always be the case.
58831 If the message is in MIME format, you must take care not to break it.
58836 If the message is cryptographically signed, any change will invalidate the
58842 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
58843 its subdirectories when <option>split_spool_directory</option> is set). These are journal
58844 files, used to record addresses to which the message has been delivered during
58845 the course of a delivery run. At the end of the run, the -H file is updated,
58846 and the -J file is deleted.
58849 <title>Format of the -H file</title>
58851 <indexterm role="concept">
58852 <primary>uid (user id)</primary>
58853 <secondary>in spool file</secondary>
58855 <indexterm role="concept">
58856 <primary>gid (group id)</primary>
58857 <secondary>in spool file</secondary>
58859 The second line of the -H file contains the login name for the uid of the
58860 process that called Exim to read the message, followed by the numerical uid and
58861 gid. For a locally generated message, this is normally the user who sent the
58862 message. For a message received over TCP/IP, it is normally the Exim user.
58865 The third line of the file contains the address of the message’s sender as
58866 transmitted in the envelope, contained in angle brackets. The sender address is
58867 empty for bounce messages. For incoming SMTP mail, the sender address is given
58868 in the MAIL command. For locally generated mail, the sender address is
58869 created by Exim from the login name of the current user and the configured
58870 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
58871 leading <quote>From </quote> line if the caller is trusted, or if the supplied address is
58872 <quote><></quote> or an address that matches <option>untrusted_set_senders</option>.
58875 The fourth line contains two numbers. The first is the time that the message
58876 was received, in the conventional Unix form – the number of seconds since the
58877 start of the epoch. The second number is a count of the number of messages
58878 warning of delayed delivery that have been sent to the sender.
58881 There follow a number of lines starting with a hyphen. These can appear in any
58882 order, and are omitted when not relevant:
58886 <term><option>-acl</option> <<emphasis>number</emphasis>> <<emphasis>length</emphasis>></term>
58889 This item is obsolete, and is not generated from Exim release 4.61 onwards;
58890 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
58891 recognized, to provide backward compatibility. In the old format, a line of
58892 this form is present for every ACL variable that is not empty. The number
58893 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0–9 and
58894 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10–19. The length is the length of
58895 the data string for the variable. The string itself starts at the beginning of
58896 the next line, and is followed by a newline character. It may contain internal
58899 </listitem></varlistentry>
58901 <term><option>-aclc</option> <<emphasis>number</emphasis>> <<emphasis>length</emphasis>></term>
58904 A line of this form is present for every ACL connection variable that is not
58905 empty. The number identifies the variable. The length is the length of the data
58906 string for the variable. The string itself starts at the beginning of the next
58907 line, and is followed by a newline character. It may contain internal newlines.
58909 </listitem></varlistentry>
58911 <term><option>-aclm</option> <<emphasis>number</emphasis>> <<emphasis>length</emphasis>></term>
58914 A line of this form is present for every ACL message variable that is not
58915 empty. The number identifies the variable. The length is the length of the data
58916 string for the variable. The string itself starts at the beginning of the next
58917 line, and is followed by a newline character. It may contain internal newlines.
58919 </listitem></varlistentry>
58921 <term><option>-active_hostname</option> <<emphasis>hostname</emphasis>></term>
58924 This is present if, when the message was received over SMTP, the value of
58925 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
58927 </listitem></varlistentry>
58929 <term><option>-allow_unqualified_recipient</option></term>
58932 This is present if unqualified recipient addresses are permitted in header
58933 lines (to stop such addresses from being qualified if rewriting occurs at
58934 transport time). Local messages that were input using <option>-bnq</option> and remote
58935 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
58937 </listitem></varlistentry>
58939 <term><option>-allow_unqualified_sender</option></term>
58942 This is present if unqualified sender addresses are permitted in header lines
58943 (to stop such addresses from being qualified if rewriting occurs at transport
58944 time). Local messages that were input using <option>-bnq</option> and remote messages from
58945 hosts that match <option>sender_unqualified_hosts</option> set this flag.
58947 </listitem></varlistentry>
58949 <term><option>-auth_id</option> <<emphasis>text</emphasis>></term>
58952 The id information for a message received on an authenticated SMTP connection
58953 – the value of the <varname>$authenticated_id</varname> variable.
58955 </listitem></varlistentry>
58957 <term><option>-auth_sender</option> <<emphasis>address</emphasis>></term>
58960 The address of an authenticated sender – the value of the
58961 <varname>$authenticated_sender</varname> variable.
58963 </listitem></varlistentry>
58965 <term><option>-body_linecount</option> <<emphasis>number</emphasis>></term>
58968 This records the number of lines in the body of the message, and is always
58971 </listitem></varlistentry>
58973 <term><option>-body_zerocount</option> <<emphasis>number</emphasis>></term>
58976 This records the number of binary zero bytes in the body of the message, and is
58977 present if the number is greater than zero.
58979 </listitem></varlistentry>
58981 <term><option>-deliver_firsttime</option></term>
58984 This is written when a new message is first added to the spool. When the spool
58985 file is updated after a deferral, it is omitted.
58987 </listitem></varlistentry>
58989 <term><option>-frozen</option> <<emphasis>time</emphasis>></term>
58992 <indexterm role="concept">
58993 <primary>frozen messages</primary>
58994 <secondary>spool data</secondary>
58996 The message is frozen, and the freezing happened at <<emphasis>time</emphasis>>.
58998 </listitem></varlistentry>
59000 <term><option>-helo_name</option> <<emphasis>text</emphasis>></term>
59003 This records the host name as specified by a remote host in a HELO or EHLO
59006 </listitem></varlistentry>
59008 <term><option>-host_address</option> <<emphasis>address</emphasis>>.<<emphasis>port</emphasis>></term>
59011 This records the IP address of the host from which the message was received and
59012 the remote port number that was used. It is omitted for locally generated
59015 </listitem></varlistentry>
59017 <term><option>-host_auth</option> <<emphasis>text</emphasis>></term>
59020 If the message was received on an authenticated SMTP connection, this records
59021 the name of the authenticator – the value of the
59022 <varname>$sender_host_authenticated</varname> variable.
59024 </listitem></varlistentry>
59026 <term><option>-host_lookup_failed</option></term>
59029 This is present if an attempt to look up the sending host’s name from its IP
59030 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
59032 </listitem></varlistentry>
59034 <term><option>-host_name</option> <<emphasis>text</emphasis>></term>
59037 <indexterm role="concept">
59038 <primary>reverse DNS lookup</primary>
59040 <indexterm role="concept">
59041 <primary>DNS</primary>
59042 <secondary>reverse lookup</secondary>
59044 This records the name of the remote host from which the message was received,
59045 if the host name was looked up from the IP address when the message was being
59046 received. It is not present if no reverse lookup was done.
59048 </listitem></varlistentry>
59050 <term><option>-ident</option> <<emphasis>text</emphasis>></term>
59053 For locally submitted messages, this records the login of the originating user,
59054 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
59055 ident value. For messages received over TCP/IP, this records the ident string
59056 supplied by the remote host, if any.
59058 </listitem></varlistentry>
59060 <term><option>-interface_address</option> <<emphasis>address</emphasis>>.<<emphasis>port</emphasis>></term>
59063 This records the IP address of the local interface and the port number through
59064 which a message was received from a remote host. It is omitted for locally
59065 generated messages.
59067 </listitem></varlistentry>
59069 <term><option>-local</option></term>
59072 The message is from a local sender.
59074 </listitem></varlistentry>
59076 <term><option>-localerror</option></term>
59079 The message is a locally-generated bounce message.
59081 </listitem></varlistentry>
59083 <term><option>-local_scan</option> <<emphasis>string</emphasis>></term>
59086 This records the data string that was returned by the <function>local_scan()</function> function
59087 when the message was received – the value of the <varname>$local_scan_data</varname>
59088 variable. It is omitted if no data was returned.
59090 </listitem></varlistentry>
59092 <term><option>-manual_thaw</option></term>
59095 The message was frozen but has been thawed manually, that is, by an explicit
59096 Exim command rather than via the auto-thaw process.
59098 </listitem></varlistentry>
59100 <term><option>-N</option></term>
59103 A testing delivery process was started using the <option>-N</option> option to suppress any
59104 actual deliveries, but delivery was deferred. At any further delivery attempts,
59105 <option>-N</option> is assumed.
59107 </listitem></varlistentry>
59109 <term><option>-received_protocol</option></term>
59112 This records the value of the <varname>$received_protocol</varname> variable, which contains
59113 the name of the protocol by which the message was received.
59115 </listitem></varlistentry>
59117 <term><option>-sender_set_untrusted</option></term>
59120 The envelope sender of this message was set by an untrusted local caller (used
59121 to ensure that the caller is displayed in queue listings).
59123 </listitem></varlistentry>
59125 <term><option>-spam_score_int</option> <<emphasis>number</emphasis>></term>
59128 If a message was scanned by SpamAssassin, this is present. It records the value
59129 of <varname>$spam_score_int</varname>.
59131 </listitem></varlistentry>
59133 <term><option>-tls_certificate_verified</option></term>
59136 A TLS certificate was received from the client that sent this message, and the
59137 certificate was verified by the server.
59139 </listitem></varlistentry>
59141 <term><option>-tls_cipher</option> <<emphasis>cipher name</emphasis>></term>
59144 When the message was received over an encrypted connection, this records the
59145 name of the cipher suite that was used.
59147 </listitem></varlistentry>
59149 <term><option>-tls_peerdn</option> <<emphasis>peer DN</emphasis>></term>
59152 When the message was received over an encrypted connection, and a certificate
59153 was received from the client, this records the Distinguished Name from that
59156 </listitem></varlistentry>
59159 Following the options there is a list of those addresses to which the message
59160 is not to be delivered. This set of addresses is initialized from the command
59161 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
59162 is set; otherwise it starts out empty. Whenever a successful delivery is made,
59163 the address is added to this set. The addresses are kept internally as a
59164 balanced binary tree, and it is a representation of that tree which is written
59165 to the spool file. If an address is expanded via an alias or forward file, the
59166 original address is added to the tree when deliveries to all its child
59167 addresses are complete.
59170 If the tree is empty, there is a single line in the spool file containing just
59171 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
59172 Y or N, followed by an address. The address is the value for the node of the
59173 tree, and the letters indicate whether the node has a left branch and/or a
59174 right branch attached to it, respectively. If branches exist, they immediately
59175 follow. Here is an example of a three-node tree:
59177 <literallayout class="monospaced">
59178 YY darcy@austen.fict.example
59179 NN alice@wonderland.fict.example
59180 NN editor@thesaurus.ref.example
59183 After the non-recipients tree, there is a list of the message’s recipients.
59184 This is a simple list, preceded by a count. It includes all the original
59185 recipients of the message, including those to whom the message has already been
59186 delivered. In the simplest case, the list contains one address per line. For
59189 <literallayout class="monospaced">
59191 editor@thesaurus.ref.example
59192 darcy@austen.fict.example
59194 alice@wonderland.fict.example
59197 However, when a child address has been added to the top-level addresses as a
59198 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
59199 line is of the following form:
59202 <<emphasis>top-level address</emphasis>> <<emphasis>errors_to address</emphasis>> <<emphasis>length</emphasis>>,<<emphasis>parent number</emphasis>>#<<emphasis>flag bits</emphasis>>
59205 The 01 flag bit indicates the presence of the three other fields that follow
59206 the top-level address. Other bits may be used in future to support additional
59207 fields. The <<emphasis>parent number</emphasis>> is the offset in the recipients list of the
59208 original parent of the <quote>one time</quote> address. The first two fields are the
59209 envelope sender that is associated with this address and its length. If the
59210 length is zero, there is no special envelope sender (there are then two space
59211 characters in the line). A non-empty field can arise from a <command>redirect</command> router
59212 that has an <option>errors_to</option> setting.
59215 A blank line separates the envelope and status information from the headers
59216 which follow. A header may occupy several lines of the file, and to save effort
59217 when reading it in, each header is preceded by a number and an identifying
59218 character. The number is the number of characters in the header, including any
59219 embedded newlines and the terminating newline. The character is one of the
59222 <informaltable frame="none">
59223 <tgroup cols="2" colsep="0" rowsep="0">
59224 <colspec colwidth="50pt" align="left"/>
59225 <colspec colwidth="254pt" align="left"/>
59228 <entry><<emphasis>blank</emphasis>></entry>
59229 <entry>header in which Exim has no special interest</entry>
59232 <entry><literal>B</literal></entry>
59233 <entry><emphasis>Bcc:</emphasis> header</entry>
59236 <entry><literal>C</literal></entry>
59237 <entry><emphasis>Cc:</emphasis> header</entry>
59240 <entry><literal>F</literal></entry>
59241 <entry><emphasis>From:</emphasis> header</entry>
59244 <entry><literal>I</literal></entry>
59245 <entry><emphasis>Message-id:</emphasis> header</entry>
59248 <entry><literal>P</literal></entry>
59249 <entry><emphasis>Received:</emphasis> header – P for <quote>postmark</quote></entry>
59252 <entry><literal>R</literal></entry>
59253 <entry><emphasis>Reply-To:</emphasis> header</entry>
59256 <entry><literal>S</literal></entry>
59257 <entry><emphasis>Sender:</emphasis> header</entry>
59260 <entry><literal>T</literal></entry>
59261 <entry><emphasis>To:</emphasis> header</entry>
59264 <entry><literal>*</literal></entry>
59265 <entry>replaced or deleted header</entry>
59271 Deleted or replaced (rewritten) headers remain in the spool file for debugging
59272 purposes. They are not transmitted when the message is delivered. Here is a
59273 typical set of headers:
59275 <literallayout class="monospaced">
59276 111P Received: by hobbit.fict.example with local (Exim 4.00)
59277 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
59278 049 Message-Id: <E14y9EI-00026G-00@hobbit.fict.example>
59279 038* X-rewrote-sender: bb@hobbit.fict.example
59280 042* From: Bilbo Baggins <bb@hobbit.fict.example>
59281 049F From: Bilbo Baggins <B.Baggins@hobbit.fict.example>
59282 099* To: alice@wonderland.fict.example, rdo@foundation,
59283 darcy@austen.fict.example, editor@thesaurus.ref.example
59284 104T To: alice@wonderland.fict.example, rdo@foundation.example,
59285 darcy@austen.fict.example, editor@thesaurus.ref.example
59286 038 Date: Fri, 11 May 2001 10:28:59 +0100
59289 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
59290 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
59291 unqualified domain <emphasis>foundation</emphasis>.
59292 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
59293 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
59294 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
59300 <title>Adding new drivers or lookup types</title>
59301 <titleabbrev>Adding drivers or lookups</titleabbrev>
59303 <indexterm role="concept">
59304 <primary>adding drivers</primary>
59306 <indexterm role="concept">
59307 <primary>new drivers</primary>
59308 <secondary>adding</secondary>
59310 <indexterm role="concept">
59311 <primary>drivers</primary>
59312 <secondary>adding new</secondary>
59314 The following actions have to be taken in order to add a new router, transport,
59315 authenticator, or lookup type to Exim:
59317 <orderedlist numeration="arabic">
59320 Choose a name for the driver or lookup type that does not conflict with any
59321 existing name; I will use <quote>newdriver</quote> in what follows.
59326 Add to <filename>src/EDITME</filename> the line:
59329 <<emphasis>type</emphasis>><literal>_NEWDRIVER=yes</literal>
59332 where <<emphasis>type</emphasis>> is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
59333 code is not to be included in the binary by default, comment this line out. You
59334 should also add any relevant comments about the driver or lookup type.
59339 Add to <filename>src/config.h.defaults</filename> the line:
59341 <literallayout class="monospaced">
59342 #define <type>_NEWDRIVER
59347 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
59348 and create a table entry as is done for all the other drivers and lookup types.
59353 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
59354 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
59355 driver or lookup type and add it to the definition of OBJ.
59360 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
59361 <filename>src</filename>.
59366 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
59367 as for other drivers and lookups.
59372 Then all you need to do is write the code! A good way to start is to make a
59373 proforma by copying an existing module of the same type, globally changing all
59374 occurrences of the name, and cutting out most of the code. Note that any
59375 options you create must be listed in alphabetical order, because the tables are
59376 searched using a binary chop procedure.
59379 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
59380 the interface that is expected.
59384 <index role="option">
59385 <title>Option index</title>
59388 <index role="concept">
59389 <title>Concept index</title>