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>22 March 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.61</revnumber>
14 <date>22 March 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.61 of Exim.
196 Substantive changes from the 4.60 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="260pt" 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="260pt" 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>
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>.
397 <title>Exim training</title>
399 <indexterm role="concept">
400 <primary>training courses</primary>
402 From time to time (approximately annually at the time of writing), training
403 courses are run by the author of Exim in Cambridge, UK. Details of any
404 forthcoming courses can be found on the web site
405 <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>.
409 <title>Bug reports</title>
411 <indexterm role="concept">
412 <primary>bug reports</primary>
414 <indexterm role="concept">
415 <primary>reporting bugs</primary>
417 Reports of obvious bugs should be emailed to <emphasis>bugs@exim.org</emphasis>. However, if you
418 are unsure whether some behaviour is a bug or not, the best thing to do is to
419 post a message to the <emphasis>exim-dev</emphasis> mailing list and have it discussed.
422 <section id="SECTavail">
423 <title>Where to find the Exim distribution</title>
425 <indexterm role="concept">
426 <primary>FTP site</primary>
428 <indexterm role="concept">
429 <primary>distribution</primary>
430 <secondary>ftp site</secondary>
432 The master ftp site for the Exim distribution is
435 <emphasis role="bold">ftp://ftp.csx.cam.ac.uk/pub/software/email/exim</emphasis>
441 <emphasis role="bold">ftp://ftp.exim.org/pub/exim</emphasis>
444 The file references that follow are relative to the <filename>exim</filename> directories at
445 these sites. There are now quite a number of independent mirror sites around
446 the world. Those that I know about are listed in the file called <filename>Mirrors</filename>.
449 Within the <filename>exim</filename> directory there are subdirectories called <filename>exim3</filename> (for
450 previous Exim 3 distributions), <filename>exim4</filename> (for the latest Exim 4
451 distributions), and <filename>Testing</filename> for testing versions. In the <filename>exim4</filename>
452 subdirectory, the current release can always be found in files called
455 <filename>exim-n.nn.tar.gz</filename>
456 <filename>exim-n.nn.tar.bz2</filename>
459 where <emphasis>n.nn</emphasis> is the highest such version number in the directory. The two
460 files contain identical data; the only difference is the type of compression.
461 The <filename>.bz2</filename> file is usually a lot smaller than the <filename>.gz</filename> file.
464 <indexterm role="concept">
465 <primary>distribution</primary>
466 <secondary>signing details</secondary>
468 <indexterm role="concept">
469 <primary>distribution</primary>
470 <secondary>public key</secondary>
472 <indexterm role="concept">
473 <primary>public key for signed distribution</primary>
475 The distributions are currently signed with Philip Hazel’s GPG key. The
476 corresponding public key is available from a number of keyservers, and there is
477 also a copy in the file <filename>Public-Key</filename>. The signatures for the tar bundles are
481 <filename>exim-n.nn.tar.gz.sig</filename>
482 <filename>exim-n.nn.tar.bz2.sig</filename>
485 For each released version, the log of changes is made separately available in a
486 separate file in the directory <filename>ChangeLogs</filename> so that it is possible to
487 find out what has changed without having to download the entire distribution.
490 <indexterm role="concept">
491 <primary>documentation</primary>
492 <secondary>available formats</secondary>
494 The main distribution contains ASCII versions of this specification and other
495 documentation; other formats of the documents are available in separate files
496 inside the <filename>exim4</filename> directory of the FTP site:
499 <filename>exim-html-n.nn.tar.gz</filename>
500 <filename>exim-pdf-n.nn.tar.gz</filename>
501 <filename>exim-postscript-n.nn.tar.gz</filename>
502 <filename>exim-texinfo-n.nn.tar.gz</filename>
505 These tar files contain only the <filename>doc</filename> directory, not the complete
506 distribution, and are also available in <filename>.bz2</filename> as well as <filename>.gz</filename> forms.
507 <indexterm role="concept">
508 <primary>FAQ</primary>
510 The FAQ is available for downloading in two different formats in these files:
513 <filename>exim4/FAQ.txt.gz</filename>
514 <filename>exim4/FAQ.html.tar.gz</filename>
517 The first of these is a single ASCII file that can be searched with a text
518 editor. The second is a directory of HTML files, normally accessed by starting
519 at <filename>index.html</filename>. The HTML version of the FAQ (which is also included in the
520 HTML documentation tarbundle) includes a keyword-in-context index, which is
521 often the most convenient way of finding your way around.
525 <title>Wish list</title>
527 <indexterm role="concept">
528 <primary>wish list</primary>
530 A wish list is maintained, containing ideas for new features that have been
531 submitted. From time to time the file is exported to the ftp site into the file
532 <filename>exim4/WishList</filename>. Items are removed from the list if they get implemented.
536 <title>Contributed material</title>
538 <indexterm role="concept">
539 <primary>contributed material</primary>
541 At the ftp site, there is a directory called <filename>Contrib</filename> that contains
542 miscellaneous files contributed to the Exim community by Exim users. There is
543 also a collection of contributed configuration examples in
544 <filename>exim4/config.samples.tar.gz</filename>. These samples are referenced from the FAQ.
548 <title>Limitations</title>
552 <indexterm role="concept">
553 <primary>limitations of Exim</primary>
555 <indexterm role="concept">
556 <primary>bang paths</primary>
557 <secondary>not handled by Exim</secondary>
559 Exim is designed for use as an Internet MTA, and therefore handles addresses in
560 RFC 2822 domain format only. It cannot handle UUCP <quote>bang paths</quote>, though
561 simple two-component bang paths can be converted by a straightforward rewriting
562 configuration. This restriction does not prevent Exim from being interfaced to
563 UUCP as a transport mechanism, provided that domain addresses are used.
568 <indexterm role="concept">
569 <primary>domainless addresses</primary>
571 <indexterm role="concept">
572 <primary>address</primary>
573 <secondary>without domain</secondary>
575 Exim insists that every address it handles has a domain attached. For incoming
576 local messages, domainless addresses are automatically qualified with a
577 configured domain value. Configuration options specify from which remote
578 systems unqualified addresses are acceptable. These are then qualified on
584 <indexterm role="concept">
585 <primary>transport</primary>
586 <secondary>external</secondary>
588 <indexterm role="concept">
589 <primary>external transports</primary>
591 The only external transport mechanisms that are currently implemented are SMTP
592 and LMTP over a TCP/IP network (including support for IPv6). However, a pipe
593 transport is available, and there are facilities for writing messages to files
594 and pipes, optionally in <emphasis>batched SMTP</emphasis> format; these facilities can be used
595 to send messages to other transport mechanisms such as UUCP, provided they can
596 handle domain-style addresses. Batched SMTP input is also catered for.
601 Exim is not designed for storing mail for dial-in hosts. When the volumes of
602 such mail are large, it is better to get the messages <quote>delivered</quote> into files
603 (that is, off Exim’s queue) and subsequently passed on to the dial-in hosts by
609 Although Exim does have basic facilities for scanning incoming messages, these
610 are not comprehensive enough to do full virus or spam scanning. Such operations
611 are best carried out using additional specialized software packages. If you
612 compile Exim with the content-scanning extension, straightforward interfaces to
613 a number of common scanners are provided.
619 <title>Run time configuration</title>
621 Exim’s run time configuration is held in a single text file that is divided
622 into a number of sections. The entries in this file consist of keywords and
623 values, in the style of Smail 3 configuration files. A default configuration
624 file which is suitable for simple online installations is provided in the
625 distribution, and is described in chapter <xref linkend="CHAPdefconfil"/> below.
629 <title>Calling interface</title>
631 <indexterm role="concept">
632 <primary>Sendmail compatibility</primary>
633 <secondary>command line interface</secondary>
635 Like many MTAs, Exim has adopted the Sendmail command line interface so that it
636 can be a straight replacement for <filename>/usr/lib/sendmail</filename> or
637 <filename>/usr/sbin/sendmail</filename> when sending mail, but you do not need to know anything
638 about Sendmail in order to run Exim. For actions other than sending messages,
639 Sendmail-compatible options also exist, but those that produce output (for
640 example, <option>-bp</option>, which lists the messages on the queue) do so in Exim’s own
641 format. There are also some additional options that are compatible with Smail
642 3, and some further options that are new to Exim. Chapter <xref linkend="CHAPcommandline"/>
643 documents all Exim’s command line options. This information is automatically
644 made into the man page that forms part of the Exim distribution.
647 Control of messages on the queue can be done via certain privileged command
648 line options. There is also an optional monitor program called <emphasis>eximon</emphasis>,
649 which displays current information in an X window, and which contains a menu
650 interface to Exim’s command line administration options.
654 <title>Terminology</title>
656 <indexterm role="concept">
657 <primary>terminology definitions</primary>
659 <indexterm role="concept">
660 <primary>body of message</primary>
661 <secondary>definition of</secondary>
663 The <emphasis>body</emphasis> of a message is the actual data that the sender wants to transmit.
664 It is the last part of a message, and is separated from the <emphasis>header</emphasis> (see
665 below) by a blank line.
668 <indexterm role="concept">
669 <primary>bounce message</primary>
670 <secondary>definition of</secondary>
672 When a message cannot be delivered, it is normally returned to the sender in a
673 delivery failure message or a <quote>non-delivery report</quote> (NDR). The term
674 <emphasis>bounce</emphasis> is commonly used for this action, and the error reports are often
675 called <emphasis>bounce messages</emphasis>. This is a convenient shorthand for <quote>delivery
676 failure error report</quote>. Such messages have an empty sender address in the
677 message’s <emphasis>envelope</emphasis> (see below) to ensure that they cannot themselves give
678 rise to further bounce messages.
681 The term <emphasis>default</emphasis> appears frequently in this manual. It is used to qualify a
682 value which is used in the absence of any setting in the configuration. It may
683 also qualify an action which is taken unless a configuration setting specifies
687 The term <emphasis>defer</emphasis> is used when the delivery of a message to a specific
688 destination cannot immediately take place for some reason (a remote host may be
689 down, or a user’s local mailbox may be full). Such deliveries are <emphasis>deferred</emphasis>
693 The word <emphasis>domain</emphasis> is sometimes used to mean all but the first component of a
694 host’s name. It is <emphasis>not</emphasis> used in that sense here, where it normally refers to
695 the part of an email address following the @ sign.
698 <indexterm role="concept">
699 <primary>envelope</primary>
700 <secondary>definition of</secondary>
702 <indexterm role="concept">
703 <primary>sender</primary>
704 <secondary>definition of</secondary>
706 A message in transit has an associated <emphasis>envelope</emphasis>, as well as a header and a
707 body. The envelope contains a sender address (to which bounce messages should
708 be delivered), and any number of recipient addresses. References to the
709 sender or the recipients of a message usually mean the addresses in the
710 envelope. An MTA uses these addresses for delivery, and for returning bounce
711 messages, not the addresses that appear in the header lines.
714 <indexterm role="concept">
715 <primary>message header</primary>
716 <secondary>definition of</secondary>
718 <indexterm role="concept">
719 <primary>header section</primary>
720 <secondary>definition of</secondary>
722 The <emphasis>header</emphasis> of a message is the first part of a message’s text, consisting
723 of a number of lines, each of which has a name such as <emphasis>From:</emphasis>, <emphasis>To:</emphasis>,
724 <emphasis>Subject:</emphasis>, etc. Long header lines can be split over several text lines by
725 indenting the continuations. The header is separated from the body by a blank
729 <indexterm role="concept">
730 <primary>local part</primary>
731 <secondary>definition of</secondary>
733 <indexterm role="concept">
734 <primary>domain</primary>
735 <secondary>definition of</secondary>
737 The term <emphasis>local part</emphasis>, which is taken from RFC 2822, is used to refer to that
738 part of an email address that precedes the @ sign. The part that follows the
739 @ sign is called the <emphasis>domain</emphasis> or <emphasis>mail domain</emphasis>.
742 <indexterm role="concept">
743 <primary>local delivery</primary>
744 <secondary>definition of</secondary>
746 <indexterm role="concept">
747 <primary>remote delivery</primary>
748 <secondary>definition of</secondary>
750 The terms <emphasis>local delivery</emphasis> and <emphasis>remote delivery</emphasis> are used to distinguish
751 delivery to a file or a pipe on the local host from delivery by SMTP over
752 TCP/IP to another host. As far as Exim is concerned, all hosts other than the
753 host it is running on are <emphasis>remote</emphasis>.
756 <indexterm role="concept">
757 <primary>return path</primary>
758 <secondary>definition of</secondary>
760 <emphasis>Return path</emphasis> is another name that is used for the sender address in a
761 message’s envelope.
764 <indexterm role="concept">
765 <primary>queue</primary>
766 <secondary>definition of</secondary>
768 The term <emphasis>queue</emphasis> is used to refer to the set of messages awaiting delivery,
769 because this term is in widespread use in the context of MTAs. However, in
770 Exim’s case the reality is more like a pool than a queue, because there is
771 normally no ordering of waiting messages.
774 <indexterm role="concept">
775 <primary>queue runner</primary>
776 <secondary>definition of</secondary>
778 The term <emphasis>queue runner</emphasis> is used to describe a process that scans the queue
779 and attempts to deliver those messages whose retry times have come. This term
780 is used by other MTAs, and also relates to the command <option>runq</option>, but in Exim
781 the waiting messages are normally processed in an unpredictable order.
784 <indexterm role="concept">
785 <primary>spool directory</primary>
786 <secondary>definition of</secondary>
788 The term <emphasis>spool directory</emphasis> is used for a directory in which Exim keeps the
789 messages on its queue – that is, those that it is in the process of
790 delivering. This should not be confused with the directory in which local
791 mailboxes are stored, which is called a <quote>spool directory</quote> by some people. In
792 the Exim documentation, <quote>spool</quote> is always used in the first sense.
798 <title>Incorporated code</title>
800 <indexterm role="concept">
801 <primary>incorporated code</primary>
803 <indexterm role="concept">
804 <primary>regular expressions</primary>
805 <secondary>library</secondary>
807 <indexterm role="concept">
808 <primary>PCRE</primary>
810 A number of pieces of external code are included in the Exim distribution.
815 Regular expressions are supported in the main Exim program and in the Exim
816 monitor using the freely-distributable PCRE library, copyright ©
817 University of Cambridge. The source is distributed in the directory
818 <filename>src/pcre</filename>. However, this is a cut-down version of PCRE. If you want to use
819 the PCRE library in other programs, you should obtain and install the full
820 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>.
825 <indexterm role="concept">
826 <primary>cdb</primary>
827 <secondary>acknowledgement</secondary>
829 Support for the cdb (Constant DataBase) lookup method is provided by code
830 contributed by Nigel Metheringham of (at the time he contributed it) Planet
831 Online Ltd. The implementation is completely contained within the code of Exim.
832 It does not link against an external cdb library. The code contains the
833 following statements:
837 Copyright © 1998 Nigel Metheringham, Planet Online Ltd
840 This program is free software; you can redistribute it and/or modify it under
841 the terms of the GNU General Public License as published by the Free Software
842 Foundation; either version 2 of the License, or (at your option) any later
846 This code implements Dan Bernstein’s Constant DataBase (cdb) spec. Information,
847 the spec and sample code for cdb can be obtained from
848 <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
849 code from Dan Bernstein’s implementation (which has no license restrictions
856 <indexterm role="concept">
857 <primary>SPA authentication</primary>
859 <indexterm role="concept">
860 <primary>Samba project</primary>
862 <indexterm role="concept">
863 <primary>Microsoft Secure Password Authentication</primary>
865 Client support for Microsoft’s <emphasis>Secure Password Authentication</emphasis> is provided
866 by code contributed by Marc Prud’hommeaux. Server support was contributed by
867 Tom Kistner. This includes code taken from the Samba project, which is released
873 <indexterm role="concept">
874 <primary>Cyrus</primary>
876 <indexterm role="concept">
877 <primary><emphasis>pwcheck</emphasis> daemon</primary>
879 <indexterm role="concept">
880 <primary><emphasis>pwauthd</emphasis> daemon</primary>
882 Support for calling the Cyrus <emphasis>pwcheck</emphasis> and <emphasis>saslauthd</emphasis> daemons is provided
883 by code taken from the Cyrus-SASL library and adapted by Alexander S.
884 Sabourenkov. The permission notice appears below, in accordance with the
885 conditions expressed therein.
889 Copyright © 2001 Carnegie Mellon University. All rights reserved.
892 Redistribution and use in source and binary forms, with or without
893 modification, are permitted provided that the following conditions
896 <orderedlist numeration="arabic">
899 Redistributions of source code must retain the above copyright
900 notice, this list of conditions and the following disclaimer.
905 Redistributions in binary form must reproduce the above copyright
906 notice, this list of conditions and the following disclaimer in
907 the documentation and/or other materials provided with the
913 The name <quote>Carnegie Mellon University</quote> must not be used to
914 endorse or promote products derived from this software without
915 prior written permission. For permission or any other legal
916 details, please contact
919 Office of Technology Transfer
920 Carnegie Mellon University
922 Pittsburgh, PA 15213-3890
923 (412) 268-4387, fax: (412) 268-7395
924 tech-transfer@andrew.cmu.edu
929 Redistributions of any form whatsoever must retain the following
933 <quote>This product includes software developed by Computing Services
934 at Carnegie Mellon University (<emphasis role="bold"><ulink url="http://www.cmu.edu/computing/">http://www.cmu.edu/computing/</ulink></emphasis>.</quote>
937 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
938 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
939 AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
940 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
941 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
942 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
943 OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
951 <indexterm role="concept">
952 <primary>Exim monitor</primary>
953 <secondary>acknowledgement</secondary>
955 <indexterm role="concept">
956 <primary>X-windows</primary>
958 <indexterm role="concept">
959 <primary>Athena</primary>
961 The Exim Monitor program, which is an X-Window application, includes
962 modified versions of the Athena StripChart and TextPop widgets.
963 This code is copyright by DEC and MIT, and their permission notice appears
964 below, in accordance with the conditions expressed therein.
968 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
969 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
975 Permission to use, copy, modify, and distribute this software and its
976 documentation for any purpose and without fee is hereby granted,
977 provided that the above copyright notice appear in all copies and that
978 both that copyright notice and this permission notice appear in
979 supporting documentation, and that the names of Digital or MIT not be
980 used in advertising or publicity pertaining to distribution of the
981 software without specific, written prior permission.
984 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
985 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
986 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
987 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
988 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
989 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
996 Many people have contributed code fragments, some large, some small, that were
997 not covered by any specific licence requirements. It is assumed that the
998 contributors are happy to see their code incoporated into Exim under the GPL.
1005 <title>How Exim receives and delivers mail</title>
1006 <titleabbrev>Receiving and delivering mail</titleabbrev>
1008 <title>Overall philosophy</title>
1010 <indexterm role="concept">
1011 <primary>design philosophy</primary>
1013 Exim is designed to work efficiently on systems that are permanently connected
1014 to the Internet and are handling a general mix of mail. In such circumstances,
1015 most messages can be delivered immediately. Consequently, Exim does not
1016 maintain independent queues of messages for specific domains or hosts, though
1017 it does try to send several messages in a single SMTP connection after a host
1018 has been down, and it also maintains per-host retry information.
1022 <title>Policy control</title>
1024 <indexterm role="concept">
1025 <primary>policy control</primary>
1026 <secondary>overview</secondary>
1028 Policy controls are now an important feature of MTAs that are connected to the
1029 Internet. Perhaps their most important job is to stop MTAs being abused as
1030 <quote>open relays</quote> by misguided individuals who send out vast amounts of
1031 unsolicited junk, and want to disguise its source. Exim provides flexible
1032 facilities for specifying policy controls on incoming mail:
1037 <indexterm role="concept">
1038 <primary>access control lists (ACLs)</primary>
1039 <secondary>introduction</secondary>
1041 Exim 4 (unlike previous versions of Exim) implements policy controls on
1042 incoming mail by means of <emphasis>Access Control Lists</emphasis> (ACLs). Each list is a
1043 series of statements that may either grant or deny access. ACLs can be used at
1044 several places in the SMTP dialogue while receiving a message from a remote
1045 host. However, the most common places are after each RCPT command, and at the
1046 very end of the message. The sysadmin can specify conditions for accepting or
1047 rejecting individual recipients or the entire message, respectively, at these
1048 two points (see chapter <xref linkend="CHAPACL"/>). Denial of access results in an SMTP
1054 An ACL is also available for locally generated, non-SMTP messages. In this
1055 case, the only available actions are to accept or deny the entire message.
1060 When Exim is compiled with the content-scanning extension, facilities are
1061 provided in the ACL mechanism for passing the message to external virus and/or
1062 spam scanning software. The result of such a scan is passed back to the ACL,
1063 which can then use it to decide what to do with the message.
1068 When a message has been received, either from a remote host or from the local
1069 host, but before the final acknowledgement has been sent, a locally supplied C
1070 function called <function>local_scan()</function> can be run to inspect the message and decide
1071 whether to accept it or not (see chapter <xref linkend="CHAPlocalscan"/>). If the message
1072 is accepted, the list of recipients can be modified by the function.
1077 Using the <function>local_scan()</function> mechanism is another way of calling external scanner
1078 software. The <option>SA-Exim</option> add-on package works this way. It does not require
1079 Exim to be compiled with the content-scanning extension.
1084 After a message has been accepted, a further checking mechanism is available in
1085 the form of the <emphasis>system filter</emphasis> (see chapter <xref linkend="CHAPsystemfilter"/>). This
1086 runs at the start of every delivery process.
1092 <title>User filters</title>
1094 <indexterm role="concept">
1095 <primary>filter</primary>
1096 <secondary>introduction</secondary>
1098 <indexterm role="concept">
1099 <primary>Sieve filter</primary>
1101 In a conventional Exim configuration, users are able to run private filters by
1102 setting up appropriate <filename>.forward</filename> files in their home directories. See
1103 chapter <xref linkend="CHAPredirect"/> (about the <command>redirect</command> router) for the
1104 configuration needed to support this, and the separate document entitled
1105 <emphasis>Exim’s interfaces to mail filtering</emphasis> for user details. Two different kinds
1106 of filtering are available:
1111 Sieve filters are written in the standard filtering language that is defined
1117 Exim filters are written in a syntax that is unique to Exim, but which is more
1118 powerful than Sieve, which it pre-dates.
1123 User filters are run as part of the routing process, described below.
1126 <section id="SECTmessiden">
1127 <title>Message identification</title>
1129 <indexterm role="concept">
1130 <primary>message ids</primary>
1131 <secondary>details of format</secondary>
1133 <indexterm role="concept">
1134 <primary>format</primary>
1135 <secondary>of message id</secondary>
1137 <indexterm role="concept">
1138 <primary>id of message</primary>
1140 <indexterm role="concept">
1141 <primary>base62</primary>
1143 <indexterm role="concept">
1144 <primary>base36</primary>
1146 <indexterm role="concept">
1147 <primary>Darwin</primary>
1149 <indexterm role="concept">
1150 <primary>Cygwin</primary>
1152 Every message handled by Exim is given a <emphasis>message id</emphasis> which is sixteen
1153 characters long. It is divided into three parts, separated by hyphens, for
1154 example <literal>16VDhn-0001bo-D3</literal>. Each part is a sequence of letters and digits,
1155 normally encoding numbers in base 62. However, in the Darwin operating
1156 system (Mac OS X) and when Exim is compiled to run under Cygwin, base 36
1157 (avoiding the use of lower case letters) is used instead, because the message
1158 id is used to construct file names, and the names of files in those systems are
1159 not always case-sensitive.
1162 <indexterm role="concept">
1163 <primary>pid (process id)</primary>
1164 <secondary>re-use of</secondary>
1166 The detail of the contents of the message id have changed as Exim has evolved.
1167 Earlier versions relied on the operating system not re-using a process id (pid)
1168 within one second. On modern operating systems, this assumption can no longer
1169 be made, so the algorithm had to be changed. To retain backward compatibility,
1170 the format of the message id was retained, which is why the following rules are
1176 The first six characters of the message id are the time at which the message
1177 started to be received, to a granularity of one second. That is, this field
1178 contains the number of seconds since the start of the epoch (the normal Unix
1179 way of representing the date and time of day).
1184 After the first hyphen, the next six characters are the id of the process that
1185 received the message.
1190 There are two different possibilities for the final two characters:
1192 <orderedlist numeration="arabic">
1195 <indexterm role="concept">
1196 <primary><option>localhost_number</option></primary>
1198 If <option>localhost_number</option> is not set, this value is the fractional part of the
1199 time of reception, normally in units of 1/2000 of a second, but for systems
1200 that must use base 36 instead of base 62 (because of case-insensitive file
1201 systems), the units are 1/1000 of a second.
1206 If <option>localhost_number</option> is set, it is multiplied by 200 (100) and added to
1207 the fractional part of the time, which in this case is in units of 1/200
1208 (1/100) of a second.
1215 After a message has been received, Exim waits for the clock to tick at the
1216 appropriate resolution before proceeding, so that if another message is
1217 received by the same process, or by another process with the same (re-used)
1218 pid, it is guaranteed that the time will be different. In most cases, the clock
1219 will already have ticked while the message was being received.
1223 <title>Receiving mail</title>
1225 <indexterm role="concept">
1226 <primary>receiving mail</primary>
1228 <indexterm role="concept">
1229 <primary>message</primary>
1230 <secondary>reception</secondary>
1232 The only way Exim can receive mail from another host is using SMTP over
1233 TCP/IP, in which case the sender and recipient addresses are transferred using
1234 SMTP commands. However, from a locally running process (such as a user’s MUA),
1235 there are several possibilities:
1240 If the process runs Exim with the <option>-bm</option> option, the message is read
1241 non-interactively (usually via a pipe), with the recipients taken from the
1242 command line, or from the body of the message if <option>-t</option> is also used.
1247 If the process runs Exim with the <option>-bS</option> option, the message is also read
1248 non-interactively, but in this case the recipients are listed at the start of
1249 the message in a series of SMTP RCPT commands, terminated by a DATA
1250 command. This is so-called <quote>batch SMTP</quote> format,
1251 but it isn’t really SMTP. The SMTP commands are just another way of passing
1252 envelope addresses in a non-interactive submission.
1257 If the process runs Exim with the <option>-bs</option> option, the message is read
1258 interactively, using the SMTP protocol. A two-way pipe is normally used for
1259 passing data between the local process and the Exim process.
1260 This is <quote>real</quote> SMTP and is handled in the same way as SMTP over TCP/IP. For
1261 example, the ACLs for SMTP commands are used for this form of submission.
1266 A local process may also make a TCP/IP call to the host’s loopback address
1267 (127.0.0.1) or any other of its IP addresses. When receiving messages, Exim
1268 does not treat the loopback address specially. It treats all such connections
1269 in the same way as connections from other hosts.
1274 <indexterm role="concept">
1275 <primary>message sender</primary>
1276 <secondary>constructed by Exim</secondary>
1278 <indexterm role="concept">
1279 <primary>sender</primary>
1280 <secondary>constructed by Exim</secondary>
1282 In the three cases that do not involve TCP/IP, the sender address is
1283 constructed from the login name of the user that called Exim and a default
1284 qualification domain (which can be set by the <option>qualify_domain</option> configuration
1285 option). For local or batch SMTP, a sender address that is passed using the
1286 SMTP MAIL command is ignored. However, the system administrator may allow
1287 certain users (<quote>trusted users</quote>) to specify a different sender address
1288 unconditionally, or all users to specify certain forms of different sender
1289 address. The <option>-f</option> option or the SMTP MAIL command is used to specify these
1290 different addresses. See section <xref linkend="SECTtrustedadmin"/> for details of trusted
1291 users, and the <option>untrusted_set_sender</option> option for a way of allowing untrusted
1292 users to change sender addresses.
1295 Messages received by either of the non-interactive mechanisms are subject to
1296 checking by the non-SMTP ACL, if one is defined. Messages received using SMTP
1297 (either over TCP/IP, or interacting with a local process) can be checked by a
1298 number of ACLs that operate at different times during the SMTP session. Either
1299 individual recipients, or the entire message, can be rejected if local policy
1300 requirements are not met. The <function>local_scan()</function> function (see chapter
1301 <xref linkend="CHAPlocalscan"/>) is run for all incoming messages.
1304 Exim can be configured not to start a delivery process when a message is
1305 received; this can be unconditional, or depend on the number of incoming SMTP
1306 connections or the system load. In these situations, new messages wait on the
1307 queue until a queue runner process picks them up. However, in standard
1308 configurations under normal conditions, delivery is started as soon as a
1309 message is received.
1313 <title>Handling an incoming message</title>
1315 <indexterm role="concept">
1316 <primary>spool directory</primary>
1317 <secondary>files that hold a message</secondary>
1319 <indexterm role="concept">
1320 <primary>file</primary>
1321 <secondary>how a message is held</secondary>
1323 When Exim accepts a message, it writes two files in its spool directory. The
1324 first contains the envelope information, the current status of the message, and
1325 the header lines, and the second contains the body of the message. The names of
1326 the two spool files consist of the message id, followed by <literal>-H</literal> for the
1327 file containing the envelope and header, and <literal>-D</literal> for the data file.
1330 <indexterm role="concept">
1331 <primary>spool directory</primary>
1332 <secondary><filename>input</filename> sub-directory</secondary>
1334 By default all these message files are held in a single directory called
1335 <filename>input</filename> inside the general Exim spool directory. Some operating systems do
1336 not perform very well if the number of files in a directory gets very large; to
1337 improve performance in such cases, the <option>split_spool_directory</option> option can be
1338 used. This causes Exim to split up the input files into 62 sub-directories
1339 whose names are single letters or digits.
1342 The envelope information consists of the address of the message’s sender and
1343 the addresses of the recipients. This information is entirely separate from
1344 any addresses contained in the header lines. The status of the message includes
1345 a list of recipients who have already received the message. The format of the
1346 first spool file is described in chapter <xref linkend="CHAPspool"/>.
1349 <indexterm role="concept">
1350 <primary>rewriting</primary>
1351 <secondary>addresses</secondary>
1353 Address rewriting that is specified in the rewrite section of the configuration
1354 (see chapter <xref linkend="CHAPrewrite"/>) is done once and for all on incoming addresses,
1355 both in the header lines and the envelope, at the time the message is accepted.
1356 If during the course of delivery additional addresses are generated (for
1357 example, via aliasing), these new addresses are rewritten as soon as they are
1358 generated. At the time a message is actually delivered (transported) further
1359 rewriting can take place; because this is a transport option, it can be
1360 different for different forms of delivery. It is also possible to specify the
1361 addition or removal of certain header lines at the time the message is
1362 delivered (see chapters <xref linkend="CHAProutergeneric"/> and
1363 <xref linkend="CHAPtransportgeneric"/>).
1367 <title>Life of a message</title>
1369 <indexterm role="concept">
1370 <primary>message</primary>
1371 <secondary>life of</secondary>
1373 <indexterm role="concept">
1374 <primary>message</primary>
1375 <secondary>frozen</secondary>
1377 A message remains in the spool directory until it is completely delivered to
1378 its recipients or to an error address, or until it is deleted by an
1379 administrator or by the user who originally created it. In cases when delivery
1380 cannot proceed – for example, when a message can neither be delivered to its
1381 recipients nor returned to its sender, the message is marked <quote>frozen</quote> on the
1382 spool, and no more deliveries are attempted.
1385 <indexterm role="concept">
1386 <primary>frozen messages</primary>
1387 <secondary>thawing</secondary>
1389 <indexterm role="concept">
1390 <primary>message</primary>
1391 <secondary>thawing frozen</secondary>
1393 An administrator can <quote>thaw</quote> such messages when the problem has been
1394 corrected, and can also freeze individual messages by hand if necessary. In
1395 addition, an administrator can force a delivery error, causing a bounce message
1399 <indexterm role="concept">
1400 <primary><option>timeout_frozen_after</option></primary>
1402 <indexterm role="concept">
1403 <primary><option>ignore_bounce_errors_after</option></primary>
1405 There are options called <option>ignore_bounce_errors_after</option> and
1406 <option>timeout_frozen_after</option>, which discard frozen messages after a certain time.
1407 The first applies only to frozen bounces, the second to any frozen messages.
1410 <indexterm role="concept">
1411 <primary>message</primary>
1412 <secondary>log file for</secondary>
1414 <indexterm role="concept">
1415 <primary>log</primary>
1416 <secondary>file for each message</secondary>
1418 While Exim is working on a message, it writes information about each delivery
1419 attempt to its main log file. This includes successful, unsuccessful, and
1420 delayed deliveries for each recipient (see chapter <xref linkend="CHAPlog"/>). The log
1421 lines are also written to a separate <emphasis>message log</emphasis> file for each message.
1422 These logs are solely for the benefit of the administrator, and are normally
1423 deleted along with the spool files when processing of a message is complete.
1424 The use of individual message logs can be disabled by setting
1425 <option>no_message_logs</option>; this might give an improvement in performance on very busy
1429 <indexterm role="concept">
1430 <primary>journal file</primary>
1432 <indexterm role="concept">
1433 <primary>file</primary>
1434 <secondary>journal</secondary>
1436 All the information Exim itself needs to set up a delivery is kept in the first
1437 spool file, along with the header lines. When a successful delivery occurs, the
1438 address is immediately written at the end of a journal file, whose name is the
1439 message id followed by <literal>-J</literal>. At the end of a delivery run, if there are some
1440 addresses left to be tried again later, the first spool file (the <literal>-H</literal> file)
1441 is updated to indicate which these are, and the journal file is then deleted.
1442 Updating the spool file is done by writing a new file and renaming it, to
1443 minimize the possibility of data loss.
1446 Should the system or the program crash after a successful delivery but before
1447 the spool file has been updated, the journal is left lying around. The next
1448 time Exim attempts to deliver the message, it reads the journal file and
1449 updates the spool file before proceeding. This minimizes the chances of double
1450 deliveries caused by crashes.
1453 <section id="SECTprocaddress">
1454 <title>Processing an address for delivery</title>
1456 <indexterm role="concept">
1457 <primary>drivers</primary>
1458 <secondary>definition of</secondary>
1460 <indexterm role="concept">
1461 <primary>router</primary>
1462 <secondary>definition of</secondary>
1464 <indexterm role="concept">
1465 <primary>transport</primary>
1466 <secondary>definition of</secondary>
1468 The main delivery processing elements of Exim are called <emphasis>routers</emphasis> and
1469 <emphasis>transports</emphasis>, and collectively these are known as <emphasis>drivers</emphasis>. Code for a
1470 number of them is provided in the source distribution, and compile-time options
1471 specify which ones are included in the binary. Run time options specify which
1472 ones are actually used for delivering messages.
1475 <indexterm role="concept">
1476 <primary>drivers</primary>
1477 <secondary>instance definition</secondary>
1479 Each driver that is specified in the run time configuration is an <emphasis>instance</emphasis>
1480 of that particular driver type. Multiple instances are allowed; for example,
1481 you can set up several different <command>smtp</command> transports, each with different
1482 option values that might specify different ports or different timeouts. Each
1483 instance has its own identifying name. In what follows we will normally use the
1484 instance name when discussing one particular instance (that is, one specific
1485 configuration of the driver), and the generic driver name when discussing
1486 the driver’s features in general.
1489 A <emphasis>router</emphasis> is a driver that operates on an address, either determining how
1490 its delivery should happen, by assigning it to a specific transport, or
1491 converting the address into one or more new addresses (for example, via an
1492 alias file). A router may also explicitly choose to fail an address, causing it
1496 A <emphasis>transport</emphasis> is a driver that transmits a copy of the message from Exim’s
1497 spool to some destination. There are two kinds of transport: for a <emphasis>local</emphasis>
1498 transport, the destination is a file or a pipe on the local host, whereas for a
1499 <emphasis>remote</emphasis> transport the destination is some other host. A message is passed
1500 to a specific transport as a result of successful routing. If a message has
1501 several recipients, it may be passed to a number of different transports.
1504 <indexterm role="concept">
1505 <primary>preconditions</primary>
1506 <secondary>definition of</secondary>
1508 An address is processed by passing it to each configured router instance in
1509 turn, subject to certain preconditions, until a router accepts the address or
1510 specifies that it should be bounced. We will describe this process in more
1511 detail shortly. First, as a simple example, we consider how each recipient
1512 address in a message is processed in a small configuration of three routers.
1515 To make this a more concrete example, it is described in terms of some actual
1516 routers, but remember, this is only an example. You can configure Exim’s
1517 routers in many different ways, and there may be any number of routers in a
1521 The first router that is specified in a configuration is often one that handles
1522 addresses in domains that are not recognized specially by the local host. These
1523 are typically addresses for arbitrary domains on the Internet. A precondition
1524 is set up which looks for the special domains known to the host (for example,
1525 its own domain name), and the router is run for addresses that do <emphasis>not</emphasis>
1526 match. Typically, this is a router that looks up domains in the DNS in order to
1527 find the hosts to which this address routes. If it succeeds, the address is
1528 assigned to a suitable SMTP transport; if it does not succeed, the router is
1529 configured to fail the address.
1532 The second router is reached only when the domain is recognized as one that
1533 <quote>belongs</quote> to the local host. This router does redirection – also known as
1534 aliasing and forwarding. When it generates one or more new addresses from the
1535 original, each of them is routed independently from the start. Otherwise, the
1536 router may cause an address to fail, or it may simply decline to handle the
1537 address, in which case the address is passed to the next router.
1540 The final router in many configurations is one that checks to see if the
1541 address belongs to a local mailbox. The precondition may involve a check to
1542 see if the local part is the name of a login account, or it may look up the
1543 local part in a file or a database. If its preconditions are not met, or if
1544 the router declines, we have reached the end of the routers. When this happens,
1545 the address is bounced.
1549 <title>Processing an address for verification</title>
1551 <indexterm role="concept">
1552 <primary>router</primary>
1553 <secondary>for verification</secondary>
1555 <indexterm role="concept">
1556 <primary>verifying address</primary>
1557 <secondary>overview</secondary>
1559 As well as being used to decide how to deliver to an address, Exim’s routers
1560 are also used for <emphasis>address verification</emphasis>. Verification can be requested as
1561 one of the checks to be performed in an ACL for incoming messages, on both
1562 sender and recipient addresses, and it can be tested using the <option>-bv</option> and
1563 <option>-bvs</option> command line options.
1566 When an address is being verified, the routers are run in <quote>verify mode</quote>. This
1567 does not affect the way the routers work, but it is a state that can be
1568 detected. By this means, a router can be skipped or made to behave differently
1569 when verifying. A common example is a configuration in which the first router
1570 sends all messages to a message-scanning program, unless they have been
1571 previously scanned. Thus, the first router accepts all addresses without any
1572 checking, making it useless for verifying. Normally, the <option>no_verify</option> option
1573 would be set for such a router, causing it to be skipped in verify mode.
1576 <section id="SECTrunindrou">
1577 <title>Running an individual router</title>
1579 <indexterm role="concept">
1580 <primary>router</primary>
1581 <secondary>running details</secondary>
1583 <indexterm role="concept">
1584 <primary>preconditions</primary>
1585 <secondary>checking</secondary>
1587 <indexterm role="concept">
1588 <primary>router</primary>
1589 <secondary>result of running</secondary>
1591 As explained in the example above, a number of preconditions are checked before
1592 running a router. If any are not met, the router is skipped, and the address is
1593 passed to the next router. When all the preconditions on a router <emphasis>are</emphasis> met,
1594 the router is run. What happens next depends on the outcome, which is one of
1600 <emphasis>accept</emphasis>: The router accepts the address, and either assigns it to a
1601 transport, or generates one or more <quote>child</quote> addresses. Processing the
1602 original address ceases,
1603 <indexterm role="concept">
1604 <primary><option>unseen</option> option</primary>
1606 unless the <option>unseen</option> option is set on the router. This option
1607 can be used to set up multiple deliveries with different routing (for example,
1608 for keeping archive copies of messages). When <option>unseen</option> is set, the address is
1609 passed to the next router. Normally, however, an <emphasis>accept</emphasis> return marks the
1613 Any child addresses generated by the router are processed independently,
1614 starting with the first router by default. It is possible to change this by
1615 setting the <option>redirect_router</option> option to specify which router to start at for
1616 child addresses. Unlike <option>pass_router</option> (see below) the router specified by
1617 <option>redirect_router</option> may be anywhere in the router configuration.
1622 <emphasis>pass</emphasis>: The router recognizes the address, but cannot handle it itself. It
1623 requests that the address be passed to another router. By default the address
1624 is passed to the next router, but this can be changed by setting the
1625 <option>pass_router</option> option. However, (unlike <option>redirect_router</option>) the named router
1626 must be below the current router (to avoid loops).
1631 <emphasis>decline</emphasis>: The router declines to accept the address because it does not
1632 recognize it at all. By default, the address is passed to the next router, but
1633 this can be prevented by setting the <option>no_more</option> option. When <option>no_more</option> is
1634 set, all the remaining routers are skipped. In effect, <option>no_more</option> converts
1635 <emphasis>decline</emphasis> into <emphasis>fail</emphasis>.
1640 <emphasis>fail</emphasis>: The router determines that the address should fail, and queues it for
1641 the generation of a bounce message. There is no further processing of the
1642 original address unless <option>unseen</option> is set on the router.
1647 <emphasis>defer</emphasis>: The router cannot handle the address at the present time. (A
1648 database may be offline, or a DNS lookup may have timed out.) No further
1649 processing of the address happens in this delivery attempt. It is tried again
1650 next time the message is considered for delivery.
1655 <emphasis>error</emphasis>: There is some error in the router (for example, a syntax error in
1656 its configuration). The action is as for defer.
1661 If an address reaches the end of the routers without having been accepted by
1662 any of them, it is bounced as unrouteable. The default error message in this
1663 situation is <quote>unrouteable address</quote>, but you can set your own message by
1664 making use of the <option>cannot_route_message</option> option. This can be set for any
1665 router; the value from the last router that <quote>saw</quote> the address is used.
1668 Sometimes while routing you want to fail a delivery when some conditions are
1669 met but others are not, instead of passing the address on for further routing.
1670 You can do this by having a second router that explicitly fails the delivery
1671 when the relevant conditions are met. The <command>redirect</command> router has a <quote>fail</quote>
1672 facility for this purpose.
1676 <title>Duplicate addresses</title>
1678 <indexterm role="concept">
1679 <primary>case of local parts</primary>
1681 <indexterm role="concept">
1682 <primary>address duplicate</primary>
1683 <secondary>discarding</secondary>
1685 Once routing is complete, Exim scans the addresses that are assigned to local
1686 and remote transports, and discards any duplicates that it finds. During this
1687 check, local parts are treated as case-sensitive.
1690 <section id="SECTrouprecon">
1691 <title>Router preconditions</title>
1693 <indexterm role="concept">
1694 <primary>router preconditions</primary>
1695 <secondary>order of processing</secondary>
1697 <indexterm role="concept">
1698 <primary>preconditions</primary>
1699 <secondary>order of processing</secondary>
1701 The preconditions that are tested for each router are listed below, in the
1702 order in which they are tested. The individual configuration options are
1703 described in more detail in chapter <xref linkend="CHAProutergeneric"/>.
1708 The <option>local_part_prefix</option> and <option>local_part_suffix</option> options can specify that
1709 the local parts handled by the router may or must have certain prefixes and/or
1710 suffixes. If a mandatory affix (prefix or suffix) is not present, the router is
1711 skipped. These conditions are tested first. When an affix is present, it is
1712 removed from the local part before further processing, including the evaluation
1713 of any other conditions.
1718 Routers can be designated for use only when not verifying an address, that is,
1719 only when routing it for delivery (or testing its delivery routing). If the
1720 <option>verify</option> option is set false, the router is skipped when Exim is verifying an
1722 Setting the <option>verify</option> option actually sets two options, <option>verify_sender</option> and
1723 <option>verify_recipient</option>, which independently control the use of the router for
1724 sender and recipient verification. You can set these options directly if
1725 you want a router to be used for only one type of verification.
1730 If the <option>address_test</option> option is set false, the router is skipped when Exim is
1731 run with the <option>-bt</option> option to test an address routing. This can be helpful
1732 when the first router sends all new messages to a scanner of some sort; it
1733 makes it possible to use <option>-bt</option> to test subsequent delivery routing without
1734 having to simulate the effect of the scanner.
1739 Routers can be designated for use only when verifying an address, as
1740 opposed to routing it for delivery. The <option>verify_only</option> option controls this.
1745 Individual routers can be explicitly skipped when running the routers to
1746 check an address given in the SMTP EXPN command (see the <option>expn</option> option).
1751 If the <option>domains</option> option is set, the domain of the address must be in the set
1752 of domains that it defines.
1757 <indexterm role="concept">
1758 <primary><varname>$local_part_prefix</varname></primary>
1760 <indexterm role="concept">
1761 <primary><varname>$local_part</varname></primary>
1763 <indexterm role="concept">
1764 <primary><varname>$local_part_suffix</varname></primary>
1766 If the <option>local_parts</option> option is set, the local part of the address must be in
1767 the set of local parts that it defines. If <option>local_part_prefix</option> or
1768 <option>local_part_suffix</option> is in use, the prefix or suffix is removed from the local
1769 part before this check. If you want to do precondition tests on local parts
1770 that include affixes, you can do so by using a <option>condition</option> option (see below)
1771 that uses the variables <varname>$local_part</varname>, <varname>$local_part_prefix</varname>, and
1772 <varname>$local_part_suffix</varname> as necessary.
1777 <indexterm role="concept">
1778 <primary><varname>$local_user_uid</varname></primary>
1780 <indexterm role="concept">
1781 <primary><varname>$local_user_gid</varname></primary>
1783 <indexterm role="concept">
1784 <primary><varname>$home</varname></primary>
1786 If the <option>check_local_user</option> option is set, the local part must be the name of
1787 an account on the local host. If this check succeeds, the uid and gid of the
1788 local user are placed in <varname>$local_user_uid</varname> and <varname>$local_user_gid</varname> and the
1789 user’s home directory is placed in <varname>$home</varname>; these values can be used in the
1790 remaining preconditions.
1795 If the <option>router_home_directory</option> option is set, it is expanded at this point,
1796 because it overrides the value of <varname>$home</varname>. If this expansion were left till
1797 later, the value of <varname>$home</varname> as set by <option>check_local_user</option> would be used in
1798 subsequent tests. Having two different values of <varname>$home</varname> in the same router
1799 could lead to confusion.
1804 If the <option>senders</option> option is set, the envelope sender address must be in the
1805 set of addresses that it defines.
1810 If the <option>require_files</option> option is set, the existence or non-existence of
1811 specified files is tested.
1816 <indexterm role="concept">
1817 <primary>customizing</primary>
1818 <secondary>precondition</secondary>
1820 If the <option>condition</option> option is set, it is evaluated and tested. This option
1821 uses an expanded string to allow you to set up your own custom preconditions.
1822 Expanded strings are described in chapter <xref linkend="CHAPexpand"/>.
1827 Note that <option>require_files</option> comes near the end of the list, so you cannot use
1828 it to check for the existence of a file in which to lookup up a domain, local
1829 part, or sender. However, as these options are all expanded, you can use the
1830 <option>exists</option> expansion condition to make such tests within each condition. The
1831 <option>require_files</option> option is intended for checking files that the router may be
1832 going to use internally, or which are needed by a specific transport (for
1833 example, <filename>.procmailrc</filename>).
1837 <title>Delivery in detail</title>
1839 <indexterm role="concept">
1840 <primary>delivery</primary>
1841 <secondary>in detail</secondary>
1843 When a message is to be delivered, the sequence of events is as follows:
1848 If a system-wide filter file is specified, the message is passed to it. The
1849 filter may add recipients to the message, replace the recipients, discard the
1850 message, cause a new message to be generated, or cause the message delivery to
1851 fail. The format of the system filter file is the same as for Exim user filter
1852 files, described in the separate document entitled <emphasis>Exim’s interfaces to mail
1853 filtering</emphasis>.
1854 <indexterm role="concept">
1855 <primary>Sieve filter</primary>
1856 <secondary>not available for system filter</secondary>
1858 (<emphasis role="bold">Note</emphasis>: Sieve cannot be used for system filter files.)
1861 Some additional features are available in system filters – see chapter
1862 <xref linkend="CHAPsystemfilter"/> for details. Note that a message is passed to the system
1863 filter only once per delivery attempt, however many recipients it has. However,
1864 if there are several delivery attempts because one or more addresses could not
1865 be immediately delivered, the system filter is run each time. The filter
1866 condition <option>first_delivery</option> can be used to detect the first run of the system
1872 Each recipient address is offered to each configured router in turn, subject to
1873 its preconditions, until one is able to handle it. If no router can handle the
1874 address, that is, if they all decline, the address is failed. Because routers
1875 can be targeted at particular domains, several locally handled domains can be
1876 processed entirely independently of each other.
1881 <indexterm role="concept">
1882 <primary>routing</primary>
1883 <secondary>loops in</secondary>
1885 <indexterm role="concept">
1886 <primary>loop</primary>
1887 <secondary>while routing</secondary>
1889 A router that accepts an address may assign it to a local or a remote
1890 transport. However, the transport is not run at this time. Instead, the address
1891 is placed on a list for the particular transport, which will be run later.
1892 Alternatively, the router may generate one or more new addresses (typically
1893 from alias, forward, or filter files). New addresses are fed back into this
1894 process from the top, but in order to avoid loops, a router ignores any address
1895 which has an identically-named ancestor that was processed by itself.
1900 When all the routing has been done, addresses that have been successfully
1901 handled are passed to their assigned transports. When local transports are
1902 doing real local deliveries, they handle only one address at a time, but if a
1903 local transport is being used as a pseudo-remote transport (for example, to
1904 collect batched SMTP messages for transmission by some other means) multiple
1905 addresses can be handled. Remote transports can always handle more than one
1906 address at a time, but can be configured not to do so, or to restrict multiple
1907 addresses to the same domain.
1912 Each local delivery to a file or a pipe runs in a separate process under a
1913 non-privileged uid, and these deliveries are run one at a time. Remote
1914 deliveries also run in separate processes, normally under a uid that is private
1915 to Exim (<quote>the Exim user</quote>), but in this case, several remote deliveries can be
1916 run in parallel. The maximum number of simultaneous remote deliveries for any
1917 one message is set by the <option>remote_max_parallel</option> option.
1918 The order in which deliveries are done is not defined, except that all local
1919 deliveries happen before any remote deliveries.
1924 <indexterm role="concept">
1925 <primary>queue runner</primary>
1927 When it encounters a local delivery during a queue run, Exim checks its retry
1928 database to see if there has been a previous temporary delivery failure for the
1929 address before running the local transport. If there was a previous failure,
1930 Exim does not attempt a new delivery until the retry time for the address is
1931 reached. However, this happens only for delivery attempts that are part of a
1932 queue run. Local deliveries are always attempted when delivery immediately
1933 follows message reception, even if retry times are set for them. This makes for
1934 better behaviour if one particular message is causing problems (for example,
1935 causing quota overflow, or provoking an error in a filter file).
1940 <indexterm role="concept">
1941 <primary>delivery</primary>
1942 <secondary>retry in remote transports</secondary>
1944 Remote transports do their own retry handling, since an address may be
1945 deliverable to one of a number of hosts, each of which may have a different
1946 retry time. If there have been previous temporary failures and no host has
1947 reached its retry time, no delivery is attempted, whether in a queue run or
1948 not. See chapter <xref linkend="CHAPretry"/> for details of retry strategies.
1953 If there were any permanent errors, a bounce message is returned to an
1954 appropriate address (the sender in the common case), with details of the error
1955 for each failing address. Exim can be configured to send copies of bounce
1956 messages to other addresses.
1961 <indexterm role="concept">
1962 <primary>delivery</primary>
1963 <secondary>deferral</secondary>
1965 If one or more addresses suffered a temporary failure, the message is left on
1966 the queue, to be tried again later. Delivery of these addresses is said to be
1967 <emphasis>deferred</emphasis>.
1972 When all the recipient addresses have either been delivered or bounced,
1973 handling of the message is complete. The spool files and message log are
1974 deleted, though the message log can optionally be preserved if required.
1980 <title>Retry mechanism</title>
1982 <indexterm role="concept">
1983 <primary>delivery</primary>
1984 <secondary>retry mechanism</secondary>
1986 <indexterm role="concept">
1987 <primary>retry</primary>
1988 <secondary>description of mechanism</secondary>
1990 <indexterm role="concept">
1991 <primary>queue runner</primary>
1993 Exim’s mechanism for retrying messages that fail to get delivered at the first
1994 attempt is the queue runner process. You must either run an Exim daemon that
1995 uses the <option>-q</option> option with a time interval to start queue runners at regular
1996 intervals, or use some other means (such as <emphasis>cron</emphasis>) to start them. If you do
1997 not arrange for queue runners to be run, messages that fail temporarily at the
1998 first attempt will remain on your queue for ever. A queue runner process works
1999 its way through the queue, one message at a time, trying each delivery that has
2000 passed its retry time.
2001 You can run several queue runners at once.
2004 Exim uses a set of configured rules to determine when next to retry the failing
2005 address (see chapter <xref linkend="CHAPretry"/>). These rules also specify when Exim
2006 should give up trying to deliver to the address, at which point it generates a
2007 bounce message. If no retry rules are set for a particular host, address, and
2008 error combination, no retries are attempted, and temporary errors are treated
2013 <title>Temporary delivery failure</title>
2015 <indexterm role="concept">
2016 <primary>delivery</primary>
2017 <secondary>temporary failure</secondary>
2019 There are many reasons why a message may not be immediately deliverable to a
2020 particular address. Failure to connect to a remote machine (because it, or the
2021 connection to it, is down) is one of the most common. Temporary failures may be
2022 detected during routing as well as during the transport stage of delivery.
2023 Local deliveries may be delayed if NFS files are unavailable, or if a mailbox
2024 is on a file system where the user is over quota. Exim can be configured to
2025 impose its own quotas on local mailboxes; where system quotas are set they will
2029 If a host is unreachable for a period of time, a number of messages may be
2030 waiting for it by the time it recovers, and sending them in a single SMTP
2031 connection is clearly beneficial. Whenever a delivery to a remote host is
2035 <indexterm role="concept">
2036 <primary>hints database</primary>
2038 Exim makes a note in its hints database, and whenever a successful
2039 SMTP delivery has happened, it looks to see if any other messages are waiting
2040 for the same host. If any are found, they are sent over the same SMTP
2041 connection, subject to a configuration limit as to the maximum number in any
2046 <title>Permanent delivery failure</title>
2048 <indexterm role="concept">
2049 <primary>delivery</primary>
2050 <secondary>permanent failure</secondary>
2052 <indexterm role="concept">
2053 <primary>bounce message</primary>
2054 <secondary>when generated</secondary>
2056 When a message cannot be delivered to some or all of its intended recipients, a
2057 bounce message is generated. Temporary delivery failures turn into permanent
2058 errors when their timeout expires. All the addresses that fail in a given
2059 delivery attempt are listed in a single message. If the original message has
2060 many recipients, it is possible for some addresses to fail in one delivery
2061 attempt and others to fail subsequently, giving rise to more than one bounce
2062 message. The wording of bounce messages can be customized by the administrator.
2063 See chapter <xref linkend="CHAPemsgcust"/> for details.
2066 <indexterm role="concept">
2067 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2069 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2070 failed addresses, for the benefit of programs that try to analyse such messages
2074 <indexterm role="concept">
2075 <primary>bounce message</primary>
2076 <secondary>recipient of</secondary>
2078 A bounce message is normally sent to the sender of the original message, as
2079 obtained from the message’s envelope. For incoming SMTP messages, this is the
2080 address given in the MAIL command. However, when an address is expanded via a
2081 forward or alias file, an alternative address can be specified for delivery
2082 failures of the generated addresses. For a mailing list expansion (see section
2083 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2088 <title>Failures to deliver bounce messages</title>
2090 <indexterm role="concept">
2091 <primary>bounce message</primary>
2092 <secondary>failure to deliver</secondary>
2094 If a bounce message (either locally generated or received from a remote host)
2095 itself suffers a permanent delivery failure, the message is left on the queue,
2096 but it is frozen, awaiting the attention of an administrator. There are options
2097 that can be used to make Exim discard such failed messages, or to keep them
2098 for only a short time (see <option>timeout_frozen_after</option> and
2099 <option>ignore_bounce_errors_after</option>).
2105 <title>Building and installing Exim</title>
2107 <indexterm role="concept" id="IIDbuex" class="startofrange">
2108 <primary>building Exim</primary>
2112 <title>Unpacking</title>
2114 Exim is distributed as a gzipped or bzipped tar file which, when upacked,
2115 creates a directory with the name of the current release (for example,
2116 <filename>exim-4.61</filename>) into which the following files are placed:
2118 <informaltable frame="none">
2119 <tgroup cols="2" colsep="0" rowsep="0">
2120 <colspec colwidth="140pt" align="left"/>
2121 <colspec colwidth="260pt" align="left"/>
2124 <entry><filename>ACKNOWLEDGMENTS</filename></entry>
2125 <entry>contains some acknowledgments</entry>
2128 <entry><filename>CHANGES</filename></entry>
2129 <entry>contains a reference to where changes are documented</entry>
2132 <entry><filename>LICENCE</filename></entry>
2133 <entry>the GNU General Public Licence</entry>
2136 <entry><filename>Makefile</filename></entry>
2137 <entry>top-level make file</entry>
2140 <entry><filename>NOTICE</filename></entry>
2141 <entry>conditions for the use of Exim</entry>
2144 <entry><filename>README</filename></entry>
2145 <entry>list of files, directories and simple build instructions</entry>
2151 Other files whose names begin with <filename>README</filename> may also be present. The
2152 following subdirectories are created:
2154 <informaltable frame="none">
2155 <tgroup cols="2" colsep="0" rowsep="0">
2156 <colspec colwidth="140pt" align="left"/>
2157 <colspec colwidth="260pt" align="left"/>
2160 <entry><filename>Local</filename></entry>
2161 <entry>an empty directory for local configuration files</entry>
2164 <entry><filename>OS</filename></entry>
2165 <entry>OS-specific files</entry>
2168 <entry><filename>doc</filename></entry>
2169 <entry>documentation files</entry>
2172 <entry><filename>exim_monitor</filename></entry>
2173 <entry>source files for the Exim monitor</entry>
2176 <entry><filename>scripts</filename></entry>
2177 <entry>scripts used in the build process</entry>
2180 <entry><filename>src</filename></entry>
2181 <entry>remaining source files</entry>
2184 <entry><filename>util</filename></entry>
2185 <entry>independent utilities</entry>
2191 The main utility programs are contained in the <filename>src</filename> directory, and are built
2192 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2193 that may be useful to some sites.
2197 <title>Multiple machine architectures and operating systems</title>
2199 <indexterm role="concept">
2200 <primary>building Exim</primary>
2201 <secondary>multiple OS/architectures</secondary>
2203 The building process for Exim is arranged to make it easy to build binaries for
2204 a number of different architectures and operating systems from the same set of
2205 source files. Compilation does not take place in the <filename>src</filename> directory.
2206 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2208 <indexterm role="concept">
2209 <primary>symbolic link</primary>
2210 <secondary>to build directory</secondary>
2212 Symbolic links to the sources are installed in this directory, which is where
2213 the actual building takes place. In most cases, Exim can discover the machine
2214 architecture and operating system for itself, but the defaults can be
2215 overridden if necessary.
2218 <section id="SECTdb">
2219 <title>DBM libraries</title>
2221 <indexterm role="concept">
2222 <primary>DBM libraries</primary>
2223 <secondary>discussion of</secondary>
2225 <indexterm role="concept">
2226 <primary>hints database</primary>
2227 <secondary>DBM files used for</secondary>
2229 Even if you do not use any DBM files in your configuration, Exim still needs a
2230 DBM library in order to operate, because it uses indexed files for its hints
2231 databases. Unfortunately, there are a number of DBM libraries in existence, and
2232 different operating systems often have different ones installed.
2235 <indexterm role="concept">
2236 <primary>Solaris</primary>
2237 <secondary>DBM library for</secondary>
2239 <indexterm role="concept">
2240 <primary>IRIX</primary>
2241 <secondary>DBM library for</secondary>
2243 <indexterm role="concept">
2244 <primary>BSD</primary>
2245 <secondary>DBM library for</secondary>
2247 <indexterm role="concept">
2248 <primary>Linux</primary>
2249 <secondary>DBM library for</secondary>
2251 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2252 Linux distribution, the DBM configuration should happen automatically, and you
2253 may be able to ignore this section. Otherwise, you may have to learn more than
2254 you would like about DBM libraries from what follows.
2257 <indexterm role="concept">
2258 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2260 Licensed versions of Unix normally contain a library of DBM functions operating
2261 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2262 versions of Unix seem to vary in what they contain as standard. In particular,
2263 some early versions of Linux have no default DBM library, and different
2264 distributors have chosen to bundle different libraries with their packaged
2265 versions. However, the more recent releases seem to have standardised on the
2266 Berkeley DB library.
2269 Different DBM libraries have different conventions for naming the files they
2270 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2273 <orderedlist numeration="arabic">
2276 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2277 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2282 <indexterm role="concept">
2283 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2285 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2286 compatibility interface it makes two different hard links to it with names
2287 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2288 file name is used unmodified.
2293 <indexterm role="concept">
2294 <primary>Berkeley DB library</primary>
2296 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2297 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2298 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2303 If the Berkeley package is used in its native mode, it operates on a single
2304 file called <filename>dbmfile</filename>; the programmer’s interface is somewhat different to
2305 the traditional <emphasis>ndbm</emphasis> interface.
2310 To complicate things further, there are several very different versions of the
2311 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2312 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while, but the latest versions are now
2313 numbered 4.<emphasis>x</emphasis>. Maintenance of some of the earlier releases has ceased. All
2314 versions of Berkeley DB can be obtained from
2315 <emphasis role="bold"><ulink url="http://www.sleepycat.com/">http://www.sleepycat.com/</ulink></emphasis>.
2320 <indexterm role="concept">
2321 <primary><emphasis>tdb</emphasis> DBM library</primary>
2323 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2324 <emphasis role="bold"><ulink url="http://download.sourceforge.net/tdb">http://download.sourceforge.net/tdb</ulink></emphasis>. It has its own interface, and also
2325 operates on a single file.
2330 <indexterm role="concept">
2331 <primary>USE_DB</primary>
2333 <indexterm role="concept">
2334 <primary>DBM libraries</primary>
2335 <secondary>configuration for building</secondary>
2337 Exim and its utilities can be compiled to use any of these interfaces. In order
2338 to use any version of the Berkeley DB package in native mode, you must set
2339 USE_DB in an appropriate configuration file (typically
2340 <filename>Local/Makefile</filename>). For example:
2342 <literallayout class="monospaced">
2346 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2347 error is diagnosed if you set more than one of these.
2350 At the lowest level, the build-time configuration sets none of these options,
2351 thereby assuming an interface of type (1). However, some operating system
2352 configuration files (for example, those for the BSD operating systems and
2353 Linux) assume type (4) by setting USE_DB as their default, and the
2354 configuration files for Cygwin set USE_GDBM. Anything you set in
2355 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2358 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2359 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2360 in one of these lines:
2362 <literallayout class="monospaced">
2367 Settings like that will work if the DBM library is installed in the standard
2368 place. Sometimes it is not, and the library’s header file may also not be in
2369 the default path. You may need to set INCLUDE to specify where the header
2370 file is, and to specify the path to the library more fully in DBMLIB, as in
2373 <literallayout class="monospaced">
2374 INCLUDE=-I/usr/local/include/db-4.1
2375 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2378 There is further detailed discussion about the various DBM libraries in the
2379 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2383 <title>Pre-building configuration</title>
2385 <indexterm role="concept">
2386 <primary>building Exim</primary>
2387 <secondary>pre-building configuration</secondary>
2389 <indexterm role="concept">
2390 <primary>configuration for building Exim</primary>
2392 <indexterm role="concept">
2393 <primary><filename>Local/Makefile</filename></primary>
2395 <indexterm role="concept">
2396 <primary><filename>src/EDITME</filename></primary>
2398 Before building Exim, a local configuration file that specifies options
2399 independent of any operating system has to be created with the name
2400 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2401 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2402 therein. These descriptions are therefore not repeated here. If you are
2403 building Exim for the first time, the simplest thing to do is to copy
2404 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2407 There are three settings that you must supply, because Exim will not build
2408 without them. They are the location of the run time configuration file
2409 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2410 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2411 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2412 a colon-separated list of file names; Exim uses the first of them that exists.
2415 There are a few other parameters that can be specified either at build time or
2416 at run time, to enable the same binary to be used on a number of different
2417 machines. However, if the locations of Exim’s spool directory and log file
2418 directory (if not within the spool directory) are fixed, it is recommended that
2419 you specify them in <filename>Local/Makefile</filename> instead of at run time, so that errors
2420 detected early in Exim’s execution (such as a malformed configuration file) can
2424 <indexterm role="concept">
2425 <primary>content scanning</primary>
2426 <secondary>specifying at build time</secondary>
2428 Exim’s interfaces for calling virus and spam scanning software directly from
2429 access control lists are not compiled by default. If you want to include these
2430 facilities, you need to set
2432 <literallayout class="monospaced">
2433 WITH_CONTENT_SCAN=yes
2436 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2437 chapter <xref linkend="CHAPexiscan"/>.
2440 <indexterm role="concept">
2441 <primary><filename>Local/eximon.conf</filename></primary>
2443 <indexterm role="concept">
2444 <primary>_exim_monitor/EDITME_</primary>
2446 If you are going to build the Exim monitor, a similar configuration process is
2447 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2448 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2449 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2450 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2453 This is all the configuration that is needed in straightforward cases for known
2454 operating systems. However, the building process is set up so that it is easy
2455 to override options that are set by default or by operating-system-specific
2456 configuration files, for example to change the name of the C compiler, which
2457 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2462 <title>Support for iconv()</title>
2464 <indexterm role="concept">
2465 <primary><function>iconv()</function> support</primary>
2467 <indexterm role="concept">
2468 <primary>RFC 2047</primary>
2470 The contents of header lines in messages may be encoded according to the rules
2471 described RFC 2047. This makes it possible to transmit characters that are not
2472 in the ASCII character set, and to label them as being in a particular
2473 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2474 mechanism, it decodes them, and translates them into a specified character set
2475 (default ISO-8859-1). The translation is possible only if the operating system
2476 supports the <function>iconv()</function> function.
2479 However, some of the operating systems that supply <function>iconv()</function> do not support
2480 very many conversions. The GNU <option>libiconv</option> library (available from
2481 <emphasis role="bold"><ulink url="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2482 systems to remedy this deficiency, as well as on systems that do not supply
2483 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2485 <literallayout class="monospaced">
2489 to your <filename>Local/Makefile</filename> and rebuild Exim.
2492 <section id="SECTinctlsssl">
2493 <title>Including TLS/SSL encryption support</title>
2495 <indexterm role="concept">
2496 <primary>TLS</primary>
2497 <secondary>including support for TLS</secondary>
2499 <indexterm role="concept">
2500 <primary>encryption</primary>
2501 <secondary>including support for</secondary>
2503 <indexterm role="concept">
2504 <primary>SUPPORT_TLS</primary>
2506 <indexterm role="concept">
2507 <primary>OpenSSL</primary>
2508 <secondary>building Exim with</secondary>
2510 <indexterm role="concept">
2511 <primary>GnuTLS</primary>
2512 <secondary>building Exim with</secondary>
2514 Exim can be built to support encrypted SMTP connections, using the STARTTLS
2515 command as per RFC 2487. It can also support legacy clients that expect to
2516 start a TLS session immediately on connection to a non-standard port (see the
2517 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2521 If you want to build Exim with TLS support, you must first install either the
2522 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2526 If OpenSSL is installed, you should set
2528 <literallayout class="monospaced">
2530 TLS_LIBS=-lssl -lcrypto
2533 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2534 OpenSSL library and include files. For example:
2536 <literallayout class="monospaced">
2538 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2539 TLS_INCLUDE=-I/usr/local/openssl/include/
2542 <indexterm role="concept">
2543 <primary>USE_GNUTLS</primary>
2545 If GnuTLS is installed, you should set
2547 <literallayout class="monospaced">
2550 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2553 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2554 library and include files. For example:
2556 <literallayout class="monospaced">
2559 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2560 TLS_INCLUDE=-I/usr/gnu/include
2563 You do not need to set TLS_INCLUDE if the relevant directory is already
2564 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2565 given in chapter <xref linkend="CHAPTLS"/>.
2569 <title>Use of tcpwrappers</title>
2571 <indexterm role="concept">
2572 <primary>tcpwrappers</primary>
2573 <secondary>building Exim to support</secondary>
2575 <indexterm role="concept">
2576 <primary>USE_TCP_WRAPPERS</primary>
2578 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2579 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2580 alternative to Exim’s own checking facilities for installations that are
2581 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2582 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2583 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2584 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2585 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2588 <literallayout class="monospaced">
2589 USE_TCP_WRAPPERS=yes
2590 CFLAGS=-O -I/usr/local/include
2591 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2594 in <filename>Local/Makefile</filename>. The name to use in the <emphasis>tcpwrappers</emphasis> control files is
2595 <quote>exim</quote>. For example, the line
2597 <literallayout class="monospaced">
2598 exim : LOCAL 192.168.1. .friendly.domain.example
2601 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2602 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2603 All other connections are denied. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2608 <title>Including support for IPv6</title>
2610 <indexterm role="concept">
2611 <primary>IPv6</primary>
2612 <secondary>including support for</secondary>
2614 Exim contains code for use on systems that have IPv6 support. Setting
2615 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2616 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2617 where the IPv6 support is not fully integrated into the normal include and
2621 Two different types of DNS record for handling IPv6 addresses have been
2622 defined. AAAA records (analagous to A records for IPv4) are in use, and are
2623 currently seen as the mainstream. Another record type called A6 was proposed
2624 as better than AAAA because it had more flexibility. However, it was felt to be
2625 over-complex, and its status was reduced to <quote>experimental</quote>. It is not known
2626 if anyone is actually using A6 records. Exim has support for A6 records, but
2627 this is included only if you set <literal>SUPPORT_A6=YES</literal> in <filename>Local/Makefile</filename>. The
2628 support has not been tested for some time.
2632 <title>The building process</title>
2634 <indexterm role="concept">
2635 <primary>build directory</primary>
2637 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2638 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2639 operating system types, and creates a build directory if one does not exist.
2640 For example, on a Sun system running Solaris 8, the directory
2641 <filename>build-SunOS5-5.8-sparc</filename> is created.
2642 <indexterm role="concept">
2643 <primary>symbolic link</primary>
2644 <secondary>to source files</secondary>
2646 Symbolic links to relevant source files are installed in the build directory.
2649 <emphasis role="bold">Warning</emphasis>: The <option>-j</option> (parallel) flag must not be used with <emphasis>make</emphasis>; the
2650 building process fails if it is set.
2653 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2654 a make file inside the build directory, using the configuration files from the
2655 <filename>Local</filename> directory. The new make file is then passed to another instance of
2656 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2657 then compiling and linking the binaries for the Exim monitor (if configured), a
2658 number of utility programs, and finally Exim itself. The command <literal>make
2659 makefile</literal> can be used to force a rebuild of the make file in the build
2660 directory, should this ever be necessary.
2663 If you have problems building Exim, check for any comments there may be in the
2664 <filename>README</filename> file concerning your operating system, and also take a look at the
2665 FAQ, where some common problems are covered.
2669 <title>Output from <quote>make</quote></title>
2671 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2672 unreadable, because these lines can be very long. For this reason, the normal
2673 output is suppressed by default, and instead output similar to that which
2674 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2675 each module that is being compiled or linked. However, it is still possible to
2676 get the full output, by calling <emphasis>make</emphasis> like this:
2678 <literallayout class="monospaced">
2682 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2683 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2684 given in addition to the the short output.
2687 <section id="SECToverride">
2688 <title>Overriding build-time options for Exim</title>
2690 <indexterm role="concept">
2691 <primary>build-time options</primary>
2692 <secondary>overriding</secondary>
2694 The main make file that is created at the beginning of the building process
2695 consists of the concatenation of a number of files which set configuration
2696 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2697 more than once, the last setting overrides any previous ones. This provides a
2698 convenient way of overriding defaults. The files that are concatenated are, in
2702 <filename>OS/Makefile-Default</filename>
2703 <filename>OS/Makefile-</filename><<emphasis>ostype</emphasis>>
2704 <filename>Local/Makefile</filename>
2705 <filename>Local/Makefile-</filename><<emphasis>ostype</emphasis>>
2706 <filename>Local/Makefile-</filename><<emphasis>archtype</emphasis>>
2707 <filename>Local/Makefile-</filename><<emphasis>ostype</emphasis>>-<<emphasis>archtype</emphasis>>
2708 <filename>OS/Makefile-Base</filename>
2711 <indexterm role="concept">
2712 <primary><filename>Local/Makefile</filename></primary>
2714 <indexterm role="concept">
2715 <primary>building Exim</primary>
2716 <secondary>operating system type</secondary>
2718 <indexterm role="concept">
2719 <primary>building Exim</primary>
2720 <secondary>architecture type</secondary>
2722 where <<emphasis>ostype</emphasis>> is the operating system type and <<emphasis>archtype</emphasis>> is the
2723 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2724 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2725 and are often not needed.
2728 The values used for <<emphasis>ostype</emphasis>> and <<emphasis>archtype</emphasis>> are obtained from scripts
2729 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2730 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2731 values are used, thereby providing a means of forcing particular settings.
2732 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2733 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2734 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2735 that Exim expects. You can run these scripts directly from the shell in order
2736 to find out what values are being used on your system.
2739 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2740 therein. Some (but not all) are mentioned below. If there is something that
2741 needs changing, review the contents of this file and the contents of the make
2742 file for your operating system (<filename>OS/Makefile-<ostype></filename>) to see what the
2746 <indexterm role="concept">
2747 <primary>building Exim</primary>
2748 <secondary>overriding default settings</secondary>
2750 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2751 or in <filename>OS/Makefile-<ostype></filename>, or to add any new definitions, you do not
2752 need to change the original files. Instead, you should make the changes by
2753 putting the new values in an appropriate <filename>Local</filename> file. For example,
2754 <indexterm role="concept">
2755 <primary>Tru64-Unix build-time settings</primary>
2757 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2758 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2759 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2760 called with the option <option>-std1</option>, to make it recognize some of the features of
2761 Standard C that Exim uses. (Most other compilers recognize Standard C by
2762 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2763 containing the lines
2765 <literallayout class="monospaced">
2770 If you are compiling for just one operating system, it may be easier to put
2771 these lines directly into <filename>Local/Makefile</filename>.
2774 Keeping all your local configuration settings separate from the distributed
2775 files makes it easy to transfer them to new versions of Exim simply by copying
2776 the contents of the <filename>Local</filename> directory.
2779 <indexterm role="concept">
2780 <primary>NIS lookup type</primary>
2781 <secondary>including support for</secondary>
2783 <indexterm role="concept">
2784 <primary>NIS+ lookup type</primary>
2785 <secondary>including support for</secondary>
2787 <indexterm role="concept">
2788 <primary>LDAP</primary>
2789 <secondary>including support for</secondary>
2791 <indexterm role="concept">
2792 <primary>lookup</primary>
2793 <secondary>inclusion in binary</secondary>
2795 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2796 lookup, but not all systems have these components installed, so the default is
2797 not to include the relevant code in the binary. All the different kinds of file
2798 and database lookup that Exim supports are implemented as separate code modules
2799 which are included only if the relevant compile-time options are set. In the
2800 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2802 <literallayout class="monospaced">
2808 and similar settings apply to the other lookup types. They are all listed in
2809 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2810 libraries need to be installed before compiling Exim.
2811 <indexterm role="concept">
2812 <primary>cdb</primary>
2813 <secondary>including support for</secondary>
2815 However, there are some optional lookup types (such as cdb) for which
2816 the code is entirely contained within Exim, and no external include
2817 files or libraries are required. When a lookup type is not included in the
2818 binary, attempts to configure Exim to use it cause run time configuration
2822 <indexterm role="concept">
2823 <primary>Perl</primary>
2824 <secondary>including support for</secondary>
2826 Exim can be linked with an embedded Perl interpreter, allowing Perl
2827 subroutines to be called during string expansion. To enable this facility,
2829 <literallayout class="monospaced">
2833 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2834 chapter <xref linkend="CHAPperl"/>.
2837 <indexterm role="concept">
2838 <primary>X11 libraries</primary>
2839 <secondary>location of</secondary>
2841 The location of the X11 libraries is something that varies a lot between
2842 operating systems, and there may be different versions of X11 to cope
2843 with. Exim itself makes no use of X11, but if you are compiling the Exim
2844 monitor, the X11 libraries must be available.
2845 The following three variables are set in <filename>OS/Makefile-Default</filename>:
2847 <literallayout class="monospaced">
2849 XINCLUDE=-I$(X11)/include
2850 XLFLAGS=-L$(X11)/lib
2853 These are overridden in some of the operating-system configuration files. For
2854 example, in <filename>OS/Makefile-SunOS5</filename> there is
2856 <literallayout class="monospaced">
2858 XINCLUDE=-I$(X11)/include
2859 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
2862 If you need to override the default setting for your operating system, place a
2863 definition of all three of these variables into your
2864 <filename>Local/Makefile-<ostype></filename> file.
2867 <indexterm role="concept">
2868 <primary>EXTRALIBS</primary>
2870 If you need to add any extra libraries to the link steps, these can be put in a
2871 variable called EXTRALIBS, which appears in all the link commands, but by
2872 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
2873 command for linking the main Exim binary, and not for any associated utilities.
2876 <indexterm role="concept">
2877 <primary>DBM libraries</primary>
2878 <secondary>configuration for building</secondary>
2880 There is also DBMLIB, which appears in the link commands for binaries that
2881 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
2882 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
2883 binary, and which can be used, for example, to include additional X11
2887 <indexterm role="concept">
2888 <primary>configuration file</primary>
2889 <secondary>editing</secondary>
2891 The make file copes with rebuilding Exim correctly if any of the configuration
2892 files are edited. However, if an optional configuration file is deleted, it is
2893 necessary to touch the associated non-optional file (that is,
2894 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
2898 <title>OS-specific header files</title>
2900 <indexterm role="concept">
2901 <primary><filename>os.h</filename></primary>
2903 <indexterm role="concept">
2904 <primary>building Exim</primary>
2905 <secondary>OS-specific C header files</secondary>
2907 The <filename>OS</filename> directory contains a number of files with names of the form
2908 <filename>os.h-<ostype></filename>. These are system-specific C header files that should not
2909 normally need to be changed. There is a list of macro settings that are
2910 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
2911 are porting Exim to a new operating system.
2915 <title>Overriding build-time options for the monitor</title>
2917 <indexterm role="concept">
2918 <primary>building Eximon</primary>
2919 <secondary>overriding default options</secondary>
2921 A similar process is used for overriding things when building the Exim monitor,
2922 where the files that are involved are
2925 <filename>OS/eximon.conf-Default</filename>
2926 <filename>OS/eximon.conf-</filename><<emphasis>ostype</emphasis>>
2927 <filename>Local/eximon.conf</filename>
2928 <filename>Local/eximon.conf-</filename><<emphasis>ostype</emphasis>>
2929 <filename>Local/eximon.conf-</filename><<emphasis>archtype</emphasis>>
2930 <filename>Local/eximon.conf-</filename><<emphasis>ostype</emphasis>>-<<emphasis>archtype</emphasis>>
2933 <indexterm role="concept">
2934 <primary><filename>Local/eximon.conf</filename></primary>
2936 As with Exim itself, the final three files need not exist, and in this case the
2937 <filename>OS/eximon.conf-<ostype></filename> file is also optional. The default values in
2938 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
2939 variables of the same name, preceded by EXIMON_. For example, setting
2940 EXIMON_LOG_DEPTH in the environment overrides the value of
2941 LOG_DEPTH at run time.
2942 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
2946 <title>Installing Exim binaries and scripts</title>
2948 <indexterm role="concept">
2949 <primary>installing Exim</primary>
2951 <indexterm role="concept">
2952 <primary>BIN_DIRECTORY</primary>
2954 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
2955 arguments. The script copies binaries and utility scripts into the directory
2956 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
2957 <indexterm role="concept">
2958 <primary>setuid</primary>
2959 <secondary>installing Exim with</secondary>
2961 The install script copies files only if they are newer than the files they are
2962 going to replace. The Exim binary is required to be owned by root and have the
2963 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
2964 install</literal> as root so that it can set up the Exim binary in this way. However, in
2965 some special situations (for example, if a host is doing no local deliveries)
2966 it may be possible to run Exim without making the binary setuid root (see
2967 chapter <xref linkend="CHAPsecurity"/> for details).
2970 <indexterm role="concept">
2971 <primary>CONFIGURE_FILE</primary>
2973 Exim’s run time configuration file is named by the CONFIGURE_FILE setting
2974 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
2975 exist, the default configuration file <filename>src/configure.default</filename> is copied there
2976 by the installation script. If a run time configuration file already exists, it
2977 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
2978 alternative files, no default is installed.
2981 <indexterm role="concept">
2982 <primary>system aliases file</primary>
2984 <indexterm role="concept">
2985 <primary><filename>/etc/aliases</filename></primary>
2987 One change is made to the default configuration file when it is installed: the
2988 default configuration contains a router that references a system aliases file.
2989 The path to this file is set to the value specified by
2990 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
2991 If the system aliases file does not exist, the installation script creates it,
2992 and outputs a comment to the user.
2995 The created file contains no aliases, but it does contain comments about the
2996 aliases a site should normally have. Mail aliases have traditionally been
2997 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
2998 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
2999 Exim’s configuration if necessary.
3002 The default configuration uses the local host’s name as the only local domain,
3003 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
3004 running as the local user. System aliases and <filename>.forward</filename> files in users’ home
3005 directories are supported, but no NIS or NIS+ support is configured. Domains
3006 other than the name of the local host are routed using the DNS, with delivery
3010 It is possible to install Exim for special purposes (such as building a binary
3011 distribution) in a private part of the file system. You can do this by a
3014 <literallayout class="monospaced">
3015 make DESTDIR=/some/directory/ install
3018 This has the effect of pre-pending the specified directory to all the file
3019 paths, except the name of the system aliases file that appears in the default
3020 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3021 For backwards compatibility, ROOT is used if DESTDIR is not set,
3022 but this usage is deprecated.
3025 <indexterm role="concept">
3026 <primary>installing Exim</primary>
3027 <secondary>what is not installed</secondary>
3029 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3030 <emphasis>convert4r4</emphasis>, or the <emphasis>pcretest</emphasis> test program. You will probably run the
3031 first of these only once (if you are upgrading from Exim 3), and the second
3032 isn’t really part of Exim. None of the documentation files in the <filename>doc</filename>
3033 directory are copied, except for the info files when you have set
3034 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3037 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3038 to their names. The Exim binary itself, however, is handled differently. It is
3039 installed under a name that includes the version number and the compile number,
3040 for example <filename>exim-4.61-1</filename>. The script then arranges for a symbolic link
3041 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3042 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3043 from the directory (as seen by other processes).
3046 <indexterm role="concept">
3047 <primary>installing Exim</primary>
3048 <secondary>testing the script</secondary>
3050 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3051 real, you can pass the <option>-n</option> option to the installation script by this
3054 <literallayout class="monospaced">
3055 make INSTALL_ARG=-n install
3058 The contents of the variable INSTALL_ARG are passed to the installation
3059 script. You do not need to be root to run this test. Alternatively, you can run
3060 the installation script directly, but this must be from within the build
3061 directory. For example, from the top-level Exim directory you could use this
3064 <literallayout class="monospaced">
3065 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3068 <indexterm role="concept">
3069 <primary>installing Exim</primary>
3070 <secondary>install script options</secondary>
3072 There are two other options that can be supplied to the installation script.
3077 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3078 to root, and the call to make it a setuid binary.
3083 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3089 INSTALL_ARG can be used to pass these options to the script. For example:
3091 <literallayout class="monospaced">
3092 make INSTALL_ARG=-no_symlink install
3095 The installation script can also be given arguments specifying which files are
3096 to be copied. For example, to install just the Exim binary, and nothing else,
3097 without creating the symbolic link, you could use:
3099 <literallayout class="monospaced">
3100 make INSTALL_ARG='-no_symlink exim' install
3103 <section id="SECTinsinfdoc">
3104 <title>Installing info documentation</title>
3106 <indexterm role="concept">
3107 <primary>installing Exim</primary>
3108 <secondary><emphasis>info</emphasis> documentation</secondary>
3110 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3111 reason, the Texinfo source of Exim’s documentation is not included in the main
3112 distribution. Instead it is available separately from the ftp site (see section
3113 <xref linkend="SECTavail"/>).
3116 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3117 source of the documentation is found in the source tree, running <literal>make
3118 install</literal> automatically builds the info files and installs them.
3122 <title>Setting up the spool directory</title>
3124 <indexterm role="concept">
3125 <primary>spool directory</primary>
3126 <secondary>creating</secondary>
3128 When it starts up, Exim tries to create its spool directory if it does not
3129 exist. The Exim uid and gid are used for the owner and group of the spool
3130 directory. Sub-directories are automatically created in the spool directory as
3135 <title>Testing</title>
3137 <indexterm role="concept">
3138 <primary>testing</primary>
3139 <secondary>installation</secondary>
3141 Having installed Exim, you can check that the run time configuration file is
3142 syntactically valid by running the following command, which assumes that the
3143 Exim binary directory is within your PATH environment variable:
3145 <literallayout class="monospaced">
3149 If there are any errors in the configuration file, Exim outputs error messages.
3150 Otherwise it outputs the version number and build date,
3151 the DBM library that is being used, and information about which drivers and
3152 other optional code modules are included in the binary.
3153 Some simple routing tests can be done by using the address testing option. For
3157 <literal>exim -bt</literal> <<emphasis>local username</emphasis>>
3160 should verify that it recognizes a local mailbox, and
3163 <literal>exim -bt</literal> <<emphasis>remote address</emphasis>>
3166 a remote one. Then try getting it to deliver mail, both locally and remotely.
3167 This can be done by passing messages directly to Exim, without going through a
3168 user agent. For example:
3170 <literallayout class="monospaced">
3171 exim -v postmaster@your.domain.example
3172 From: user@your.domain.example
3173 To: postmaster@your.domain.example
3174 Subject: Testing Exim
3176 This is a test message.
3180 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3181 In this case you should see copies of three log lines, one for the message’s
3182 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3185 <indexterm role="concept">
3186 <primary>delivery</primary>
3187 <secondary>problems with</secondary>
3189 If you encounter problems, look at Exim’s log files (<emphasis>mainlog</emphasis> and
3190 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3191 of information is running Exim with debugging turned on, by specifying the
3192 <option>-d</option> option. If a message is stuck on Exim’s spool, you can force a delivery
3193 with debugging turned on by a command of the form
3196 <literal>exim -d -M</literal> <<emphasis>exim-message-id</emphasis>>
3199 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3200 produces rather a lot of output, but you can cut this down to specific areas.
3201 For example, if you use <option>-d-all+route</option> only the debugging information
3202 relevant to routing is included. (See the <option>-d</option> option in chapter
3203 <xref linkend="CHAPcommandline"/> for more details.)
3206 <indexterm role="concept">
3207 <primary><quote>sticky</quote> bit</primary>
3209 <indexterm role="concept">
3210 <primary>lock files</primary>
3212 One specific problem that has shown up on some sites is the inability to do
3213 local deliveries into a shared mailbox directory, because it does not have the
3214 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3215 writing to a mailbox file, and if it cannot create the lock file, the delivery
3216 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3217 directory, or by setting a specific group for local deliveries and allowing
3218 that group to create files in the directory (see the comments above the
3219 <command>local_delivery</command> transport in the default configuration file). Another
3220 approach is to configure Exim not to use lock files, but just to rely on
3221 <function>fcntl()</function> locking instead. However, you should do this only if all user
3222 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3223 see chapter <xref linkend="CHAPappendfile"/>.
3226 One thing that cannot be tested on a system that is already running an MTA is
3227 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3228 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3229 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3230 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3234 Testing a new version on a system that is already running Exim can most easily
3235 be done by building a binary with a different CONFIGURE_FILE setting. From
3236 within the run time configuration, all other file and directory names
3237 that Exim uses can be altered, in order to keep it entirely clear of the
3242 <title>Replacing another MTA with Exim</title>
3244 <indexterm role="concept">
3245 <primary>replacing another MTA</primary>
3247 Building and installing Exim for the first time does not of itself put it in
3248 general use. The name by which the system’s MTA is called by mail user agents
3249 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3250 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3251 binary in order to get the user agents to pass messages to Exim. This is
3252 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3253 or <filename>/usr/lib/sendmail</filename>
3254 <indexterm role="concept">
3255 <primary>symbolic link</primary>
3256 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3258 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3259 privilege and executable status from the old MTA. It is then necessary to stop
3260 and restart the mailer daemon, if one is running.
3263 <indexterm role="concept">
3264 <primary>FreeBSD</primary>
3265 <secondary>MTA indirection</secondary>
3267 <indexterm role="concept">
3268 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3270 Some operating systems have introduced alternative ways of switching MTAs. For
3271 example, if you are running FreeBSD, you need to edit the file
3272 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3273 described. A typical example of the contents of this file for running Exim is
3276 <literallayout class="monospaced">
3277 sendmail /usr/exim/bin/exim
3278 send-mail /usr/exim/bin/exim
3279 mailq /usr/exim/bin/exim -bp
3280 newaliases /usr/bin/true
3283 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3284 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3285 favourite user agent.
3288 You should consider what to tell your users about the change of MTA. Exim may
3289 have different capabilities to what was previously running, and there are
3290 various operational differences such as the text of messages produced by
3291 command line options and in bounce messages. If you allow your users to make
3292 use of Exim’s filtering capabilities, you should make the document entitled
3293 <emphasis>Exim’s interface to mail filtering</emphasis> available to them.
3297 <title>Upgrading Exim</title>
3299 <indexterm role="concept">
3300 <primary>upgrading Exim</primary>
3302 If you are already running Exim on your host, building and installing a new
3303 version automatically makes it available to MUAs, or any other programs that
3304 call the MTA directly. However, if you are running an Exim daemon, you do need
3305 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3306 new binary. You do not need to stop processing mail in order to install a new
3307 version of Exim. The install script does not modify an existing runtime
3312 <title>Stopping the Exim daemon on Solaris</title>
3314 <indexterm role="concept">
3315 <primary>Solaris</primary>
3316 <secondary>stopping Exim on</secondary>
3318 The standard command for stopping the mailer daemon on Solaris is
3320 <literallayout class="monospaced">
3321 /etc/init.d/sendmail stop
3324 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3325 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3326 for the text <quote>sendmail</quote>; this is not present because the actual program name
3327 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3328 solution is to replace the line that finds the process id with something like
3330 <literallayout class="monospaced">
3331 pid=`cat /var/spool/exim/exim-daemon.pid`
3334 to obtain the daemon’s pid directly from the file that Exim saves it in.
3337 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3338 still be received from local processes, and if automatic delivery is configured
3339 (the normal case), deliveries will still occur.
3344 <chapter id="CHAPcommandline">
3345 <title>The Exim command line</title>
3347 <indexterm role="concept" id="IIDclo1" class="startofrange">
3348 <primary>command line</primary>
3349 <secondary>options</secondary>
3351 <indexterm role="concept" id="IIDclo2" class="startofrange">
3352 <primary>options</primary>
3353 <secondary>command line</secondary>
3355 Exim’s command line takes the standard Unix form of a sequence of options,
3356 each starting with a hyphen character, followed by a number of arguments. The
3357 options are compatible with the main options of Sendmail, and there are also
3358 some additional options, some of which are compatible with Smail 3. Certain
3359 combinations of options do not make sense, and provoke an error if used.
3360 The form of the arguments depends on which options are set.
3363 <title>Setting options by program name</title>
3365 <indexterm role="concept">
3366 <primary><emphasis>mailq</emphasis></primary>
3368 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3369 were present before any other options.
3370 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3372 This feature is for compatibility with some systems that contain a command of
3373 that name in one of the standard libraries, symbolically linked to
3374 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3377 <indexterm role="concept">
3378 <primary><emphasis>rsmtp</emphasis></primary>
3380 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3381 were present before any other options, for compatibility with Smail. The
3382 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3386 <indexterm role="concept">
3387 <primary><emphasis>rmail</emphasis></primary>
3389 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3390 <option>-oee</option> options were present before any other options, for compatibility with
3391 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3394 <indexterm role="concept">
3395 <primary><emphasis>runq</emphasis></primary>
3397 <indexterm role="concept">
3398 <primary>queue runner</primary>
3400 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3401 were present before any other options, for compatibility with Smail. The <option>-q</option>
3402 option causes a single queue runner process to be started.
3405 <indexterm role="concept">
3406 <primary><emphasis>newaliases</emphasis></primary>
3408 <indexterm role="concept">
3409 <primary>alias file</primary>
3410 <secondary>building</secondary>
3412 <indexterm role="concept">
3413 <primary>Sendmail compatibility</primary>
3414 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3416 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3417 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3418 This option is used for rebuilding Sendmail’s alias file. Exim does not have
3419 the concept of a single alias file, but can be configured to run a given
3420 command if called with the <option>-bi</option> option.
3423 <section id="SECTtrustedadmin">
3424 <title>Trusted and admin users</title>
3426 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3427 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3428 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3429 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3430 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3435 <indexterm role="concept">
3436 <primary>trusted user</primary>
3437 <secondary>definition of</secondary>
3439 <indexterm role="concept">
3440 <primary>user</primary>
3441 <secondary>trusted definition of</secondary>
3443 The trusted users are root, the Exim user, any user listed in the
3444 <option>trusted_users</option> configuration option, and any user whose current group or any
3445 supplementary group is one of those listed in the <option>trusted_groups</option>
3446 configuration option. Note that the Exim group is not automatically trusted.
3449 <indexterm role="concept">
3450 <primary><quote>From</quote> line</primary>
3452 <indexterm role="concept">
3453 <primary>envelope sender</primary>
3455 Trusted users are always permitted to use the <option>-f</option> option or a leading
3456 <quote>From </quote> line to specify the envelope sender of a message that is passed to
3457 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3458 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3459 users to set envelope senders.
3462 <indexterm role="concept">
3463 <primary><emphasis>From:</emphasis> header line</primary>
3465 <indexterm role="concept">
3466 <primary><emphasis>Sender:</emphasis> header line</primary>
3468 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3469 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3470 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3473 Trusted users may also specify a host name, host address, interface address,
3474 protocol name, ident value, and authentication data when submitting a message
3475 locally. Thus, they are able to insert messages into Exim’s queue locally that
3476 have the characteristics of messages received from a remote host. Untrusted
3477 users may in some circumstances use <option>-f</option>, but can never set the other values
3478 that are available to trusted users.
3483 <indexterm role="concept">
3484 <primary>user</primary>
3485 <secondary>admin definition of</secondary>
3487 <indexterm role="concept">
3488 <primary>admin user</primary>
3489 <secondary>definition of</secondary>
3491 The admin users are root, the Exim user, and any user that is a member of the
3492 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3493 The current group does not have to be one of these groups.
3496 Admin users are permitted to list the queue, and to carry out certain
3497 operations on messages, for example, to force delivery failures. It is also
3498 necessary to be an admin user in order to see the full information provided by
3499 the Exim monitor, and full debugging output.
3502 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3503 Exim to attempt delivery of messages on its queue is restricted to admin users.
3504 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3505 option false (that is, specifying <option>no_prod_requires_admin</option>).
3508 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3509 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3515 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3516 edit Exim’s configuration file, you are giving those users an easy way of
3517 getting root. There is further discussion of this issue at the start of chapter
3518 <xref linkend="CHAPconf"/>.
3522 <title>Command line options</title>
3524 The command options are described in alphabetical order below.
3526 <!-- === Start of command line options === -->
3529 <term><option>--</option></term>
3532 <indexterm role="option">
3533 <primary>--</primary>
3535 <indexterm role="concept">
3536 <primary>options</primary>
3537 <secondary>command line; terminating</secondary>
3539 This is a pseudo-option whose only purpose is to terminate the options and
3540 therefore to cause subsequent command line items to be treated as arguments
3541 rather than options, even if they begin with hyphens.
3543 </listitem></varlistentry>
3545 <term><option>--help</option></term>
3548 <indexterm role="option">
3549 <primary><option>--help</option></primary>
3551 This option causes Exim to output a few sentences stating what it is.
3552 The same output is generated if the Exim binary is called with no options and
3555 </listitem></varlistentry>
3557 <term><option>-B</option><<emphasis>type</emphasis>></term>
3560 <indexterm role="option">
3561 <primary><option>-B</option></primary>
3563 <indexterm role="concept">
3564 <primary>8-bit characters</primary>
3566 <indexterm role="concept">
3567 <primary>Sendmail compatibility</primary>
3568 <secondary>8-bit characters</secondary>
3570 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3571 clean; it ignores this option.
3573 </listitem></varlistentry>
3575 <term><option>-bd</option></term>
3578 <indexterm role="option">
3579 <primary><option>-bd</option></primary>
3581 <indexterm role="concept">
3582 <primary>daemon</primary>
3584 <indexterm role="concept">
3585 <primary>SMTP listener</primary>
3587 <indexterm role="concept">
3588 <primary>queue runner</primary>
3590 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3591 the <option>-bd</option> option is combined with the <option>-q</option><<emphasis>time</emphasis>> option, to specify
3592 that the daemon should also initiate periodic queue runs.
3595 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3596 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3597 disconnect from the controlling terminal. When running this way, it can be
3598 stopped by pressing ctrl-C.
3601 By default, Exim listens for incoming connections to the standard SMTP port on
3602 all the host’s running interfaces. However, it is possible to listen on other
3603 ports, on multiple ports, and only on specific interfaces. Chapter
3604 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3607 When a listening daemon
3608 <indexterm role="concept">
3609 <primary>daemon</primary>
3610 <secondary>process id (pid)</secondary>
3612 <indexterm role="concept">
3613 <primary>pid (process id)</primary>
3614 <secondary>of daemon</secondary>
3616 is started without the use of <option>-oX</option> (that is, without overriding the normal
3617 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3618 in Exim’s spool directory. This location can be overridden by setting
3619 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3623 When <option>-oX</option> is used on the command line to start a listening daemon, the
3624 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3625 used to specify a path on the command line if a pid file is required.
3629 <indexterm role="concept">
3630 <primary>SIGHUP</primary>
3632 can be used to cause the daemon to re-exec itself. This should be done whenever
3633 Exim’s configuration file, or any file that is incorporated into it by means of
3634 the <option>.include</option> facility, is changed, and also whenever a new version of Exim
3635 is installed. It is not necessary to do this when other files that are
3636 referenced from the configuration (for example, alias files) are changed,
3637 because these are reread each time they are used.
3639 </listitem></varlistentry>
3641 <term><option>-bdf</option></term>
3644 <indexterm role="option">
3645 <primary><option>-bdf</option></primary>
3647 This option has the same effect as <option>-bd</option> except that it never disconnects
3648 from the controlling terminal, even when no debugging is specified.
3650 </listitem></varlistentry>
3652 <term><option>-be</option></term>
3655 <indexterm role="option">
3656 <primary><option>-be</option></primary>
3658 <indexterm role="concept">
3659 <primary>testing</primary>
3660 <secondary>string expansion</secondary>
3662 <indexterm role="concept">
3663 <primary>expansion</primary>
3664 <secondary>testing</secondary>
3666 Run Exim in expansion testing mode. Exim discards its root privilege, to
3667 prevent ordinary users from using this mode to read otherwise inaccessible
3668 files. If no arguments are given, Exim runs interactively, prompting for lines
3669 of data. Otherwise, it processes each argument in turn.
3672 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3673 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3674 used without command line arguments. If successful, it uses the <function>readline()</function>
3675 function, which provides extensive line-editing facilities, for reading the
3676 test data. A line history is supported.
3679 Long expansion expressions can be split over several lines by using backslash
3680 continuations. As in Exim’s run time configuration, white space at the start of
3681 continuation lines is ignored. Each argument or data line is passed through the
3682 string expansion mechanism, and the result is output. Variable values from the
3683 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3684 message-specific values (such as <varname>$domain</varname>) are set, because no message is
3688 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3689 files or databases you are using, you must exit and restart Exim before trying
3690 the same lookup again. Otherwise, because each Exim process caches the results
3691 of lookups, you will just get the same result as before.
3693 </listitem></varlistentry>
3695 <term><option>-bF</option> <<emphasis>filename</emphasis>></term>
3698 <indexterm role="option">
3699 <primary><option>-bF</option></primary>
3701 <indexterm role="concept">
3702 <primary>system filter</primary>
3703 <secondary>testing</secondary>
3705 <indexterm role="concept">
3706 <primary>testing</primary>
3707 <secondary>system filter</secondary>
3709 This option is the same as <option>-bf</option> except that it assumes that the filter being
3710 tested is a system filter. The additional commands that are available only in
3711 system filters are recognized.
3713 </listitem></varlistentry>
3715 <term><option>-bf</option> <<emphasis>filename</emphasis>></term>
3718 <indexterm role="option">
3719 <primary><option>-bf</option></primary>
3721 <indexterm role="concept">
3722 <primary>filter</primary>
3723 <secondary>testing</secondary>
3725 <indexterm role="concept">
3726 <primary>testing</primary>
3727 <secondary>filter file</secondary>
3729 <indexterm role="concept">
3730 <primary>forward file</primary>
3731 <secondary>testing</secondary>
3733 <indexterm role="concept">
3734 <primary>testing</primary>
3735 <secondary>forward file</secondary>
3737 <indexterm role="concept">
3738 <primary>Sieve filter</primary>
3739 <secondary>testing</secondary>
3741 This option runs Exim in user filter testing mode; the file is the filter file
3742 to be tested, and a test message must be supplied on the standard input. If
3743 there are no message-dependent tests in the filter, an empty file can be
3747 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
3748 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
3749 filter and a user filter in the same run. For example:
3751 <literallayout class="monospaced">
3752 exim -bF /system/filter -bf /user/filter </test/message
3755 This is helpful when the system filter adds header lines or sets filter
3756 variables that are used by the user filter.
3759 If the test filter file does not begin with one of the special lines
3761 <literallayout class="monospaced">
3766 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
3767 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
3768 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
3772 The result of an Exim command that uses <option>-bf</option>, provided no errors are
3773 detected, is a list of the actions that Exim would try to take if presented
3774 with the message for real. More details of filter testing are given in the
3775 separate document entitled <emphasis>Exim’s interfaces to mail filtering</emphasis>.
3778 When testing a filter file,
3779 <indexterm role="concept">
3780 <primary><quote>From</quote> line</primary>
3782 <indexterm role="concept">
3783 <primary>envelope sender</primary>
3785 <indexterm role="concept">
3786 <primary><option>-f</option> option</primary>
3787 <secondary>for filter testing</secondary>
3789 the envelope sender can be set by the <option>-f</option> option,
3790 or by a <quote>From </quote> line at the start of the test message. Various parameters
3791 that would normally be taken from the envelope recipient address of the message
3792 can be set by means of additional command line options (see the next four
3795 </listitem></varlistentry>
3797 <term><option>-bfd</option> <<emphasis>domain</emphasis>></term>
3800 <indexterm role="option">
3801 <primary><option>-bfd</option></primary>
3803 <indexterm role="concept">
3804 <primary><varname>$qualify_domain</varname></primary>
3806 This sets the domain of the recipient address when a filter file is being
3807 tested by means of the <option>-bf</option> option. The default is the value of
3808 <varname>$qualify_domain</varname>.
3810 </listitem></varlistentry>
3812 <term><option>-bfl</option> <<emphasis>local part</emphasis>></term>
3815 <indexterm role="option">
3816 <primary><option>-bfl</option></primary>
3818 This sets the local part of the recipient address when a filter file is being
3819 tested by means of the <option>-bf</option> option. The default is the username of the
3820 process that calls Exim. A local part should be specified with any prefix or
3821 suffix stripped, because that is how it appears to the filter when a message is
3822 actually being delivered.
3824 </listitem></varlistentry>
3826 <term><option>-bfp</option> <<emphasis>prefix</emphasis>></term>
3829 <indexterm role="option">
3830 <primary><option>-bfp</option></primary>
3832 This sets the prefix of the local part of the recipient address when a filter
3833 file is being tested by means of the <option>-bf</option> option. The default is an empty
3836 </listitem></varlistentry>
3838 <term><option>-bfs</option> <<emphasis>suffix</emphasis>></term>
3841 <indexterm role="option">
3842 <primary><option>-bfs</option></primary>
3844 This sets the suffix of the local part of the recipient address when a filter
3845 file is being tested by means of the <option>-bf</option> option. The default is an empty
3848 </listitem></varlistentry>
3850 <term><option>-bh</option> <<emphasis>IP address</emphasis>></term>
3853 <indexterm role="option">
3854 <primary><option>-bh</option></primary>
3856 <indexterm role="concept">
3857 <primary>testing</primary>
3858 <secondary>incoming SMTP</secondary>
3860 <indexterm role="concept">
3861 <primary>SMTP</primary>
3862 <secondary>testing incoming</secondary>
3864 <indexterm role="concept">
3865 <primary>testing</primary>
3866 <secondary>relay control</secondary>
3868 <indexterm role="concept">
3869 <primary>relaying</primary>
3870 <secondary>testing configuration</secondary>
3872 <indexterm role="concept">
3873 <primary>policy control</primary>
3874 <secondary>testing</secondary>
3876 <indexterm role="concept">
3877 <primary>debugging</primary>
3878 <secondary><option>-bh</option> option</secondary>
3880 This option runs a fake SMTP session as if from the given IP address, using the
3881 standard input and output. The IP address may include a port number at the end,
3882 after a full stop. For example:
3884 <literallayout class="monospaced">
3885 exim -bh 10.9.8.7.1234
3886 exim -bh fe80::a00:20ff:fe86:a061.5678
3889 When an IPv6 address is given, it is converted into canonical form. In the case
3890 of the second example above, the value of <varname>$sender_host_address</varname> after
3891 conversion to the canonical form is
3892 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
3895 Comments as to what is going on are written to the standard error file. These
3896 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
3897 This facility is provided for testing configuration options for incoming
3898 messages, to make sure they implement the required policy. For example, you can
3899 test your relay controls using <option>-bh</option>.
3902 <emphasis role="bold">Warning 1</emphasis>:
3903 <indexterm role="concept">
3904 <primary>RFC 1413</primary>
3906 You cannot test features of the configuration that rely on
3907 ident (RFC 1413) callouts. These cannot be done when testing using
3908 <option>-bh</option> because there is no incoming SMTP connection.
3911 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
3912 are also skipped when testing using <option>-bh</option>. If you want these callouts to
3913 occur, use <option>-bhc</option> instead.
3916 Messages supplied during the testing session are discarded, and nothing is
3917 written to any of the real log files. There may be pauses when DNS (and other)
3918 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
3919 can be used to specify a specific IP interface and port if this is important.
3922 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
3923 output just states whether a given recipient address from a given host is
3924 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
3926 </listitem></varlistentry>
3928 <term><option>-bhc</option> <<emphasis>IP address</emphasis>></term>
3931 <indexterm role="option">
3932 <primary><option>-bhc</option></primary>
3934 This option operates in the same way as <option>-bh</option>, except that address
3935 verification callouts are performed if required. This includes consulting and
3936 updating the callout cache database.
3938 </listitem></varlistentry>
3940 <term><option>-bi</option></term>
3943 <indexterm role="option">
3944 <primary><option>-bi</option></primary>
3946 <indexterm role="concept">
3947 <primary>alias file</primary>
3948 <secondary>building</secondary>
3950 <indexterm role="concept">
3951 <primary>building alias file</primary>
3953 <indexterm role="concept">
3954 <primary>Sendmail compatibility</primary>
3955 <secondary><option>-bi</option> option</secondary>
3957 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
3958 Exim does not have the concept of a single alias file, and so it cannot mimic
3959 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
3960 tend to appear in various scripts such as NIS make files, so the option must be
3964 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
3965 configuration option is run, under the uid and gid of the caller of Exim. If
3966 the <option>-oA</option> option is used, its value is passed to the command as an argument.
3967 The command set by <option>bi_command</option> may not contain arguments. The command can
3968 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
3969 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
3970 <option>-bi</option> is a no-op.
3972 </listitem></varlistentry>
3974 <term><option>-bm</option></term>
3977 <indexterm role="option">
3978 <primary><option>-bm</option></primary>
3980 <indexterm role="concept">
3981 <primary>local message reception</primary>
3983 This option runs an Exim receiving process that accepts an incoming,
3984 locally-generated message on the current input. The recipients are given as the
3985 command arguments (except when <option>-t</option> is also present – see below). Each
3986 argument can be a comma-separated list of RFC 2822 addresses. This is the
3987 default option for selecting the overall action of an Exim call; it is assumed
3988 if no other conflicting option is present.
3991 If any addresses in the message are unqualified (have no domain), they are
3992 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
3993 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
3994 suppressing this for special cases.
3997 Policy checks on the contents of local messages can be enforced by means of
3998 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4001 <indexterm role="concept">
4002 <primary>return code</primary>
4003 <secondary>for <option>-bm</option></secondary>
4005 The return code is zero if the message is successfully accepted. Otherwise, the
4006 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting – see below.
4010 <indexterm role="concept">
4011 <primary>message</primary>
4012 <secondary>format</secondary>
4014 <indexterm role="concept">
4015 <primary>format</primary>
4016 <secondary>message</secondary>
4018 <indexterm role="concept">
4019 <primary><quote>From</quote> line</primary>
4021 <indexterm role="concept">
4022 <primary>UUCP</primary>
4023 <secondary><quote>From</quote> line</secondary>
4025 <indexterm role="concept">
4026 <primary>Sendmail compatibility</primary>
4027 <secondary><quote>From</quote> line</secondary>
4029 of the message must be as defined in RFC 2822, except that, for
4030 compatibility with Sendmail and Smail, a line in one of the forms
4032 <literallayout class="monospaced">
4033 From sender Fri Jan 5 12:55 GMT 1997
4034 From sender Fri, 5 Jan 97 12:55:01
4037 (with the weekday optional, and possibly with additional text after the date)
4038 is permitted to appear at the start of the message. There appears to be no
4039 authoritative specification of the format of this line. Exim recognizes it by
4040 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4041 option, which can be changed if necessary.
4045 <indexterm role="concept">
4046 <primary><option>-f</option> option</primary>
4047 <secondary>overriding <quote>From</quote> line</secondary>
4049 specified sender is treated as if it were given as the argument to the
4050 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4051 preference to the address taken from the message. The caller of Exim must be a
4052 trusted user for the sender of a message to be set in this way.
4054 </listitem></varlistentry>
4056 <term><option>-bnq</option></term>
4059 <indexterm role="option">
4060 <primary><option>-bnq</option></primary>
4062 <indexterm role="concept">
4063 <primary>address qualification</primary>
4064 <secondary>suppressing</secondary>
4066 By default, Exim automatically qualifies unqualified addresses (those
4067 without domains) that appear in messages that are submitted locally (that
4068 is, not over TCP/IP). This qualification applies both to addresses in
4069 envelopes, and addresses in header lines. Sender addresses are qualified using
4070 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4071 defaults to the value of <option>qualify_domain</option>).
4074 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4075 being used to re-submit messages that originally came from remote hosts after
4076 content scanning, you probably do not want to qualify unqualified addresses in
4077 header lines. (Such lines will be present only if you have not enabled a header
4078 syntax check in the appropriate ACL.)
4081 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4082 messages that originate on the local host. When this is used, unqualified
4083 addresses in the envelope provoke errors (causing message rejection) and
4084 unqualified addresses in header lines are left alone.
4086 </listitem></varlistentry>
4088 <term><option>-bP</option></term>
4091 <indexterm role="option">
4092 <primary><option>-bP</option></primary>
4094 <indexterm role="concept">
4095 <primary>configuration options</primary>
4096 <secondary>extracting</secondary>
4098 <indexterm role="concept">
4099 <primary>options</primary>
4100 <secondary>configuration – extracting</secondary>
4102 If this option is given with no arguments, it causes the values of all Exim’s
4103 main configuration options to be written to the standard output. The values
4104 of one or more specific options can be requested by giving their names as
4105 arguments, for example:
4107 <literallayout class="monospaced">
4108 exim -bP qualify_domain hold_domains
4111 However, any option setting that is preceded by the word <quote>hide</quote> in the
4112 configuration file is not shown in full, except to an admin user. For other
4113 users, the output is as in this example:
4115 <literallayout class="monospaced">
4116 mysql_servers = <value not displayable>
4119 If <option>configure_file</option> is given as an argument, the name of the run time
4120 configuration file is output.
4121 If a list of configuration files was supplied, the value that is output here
4122 is the name of the file that was actually used.
4125 <indexterm role="concept">
4126 <primary>daemon</primary>
4127 <secondary>process id (pid)</secondary>
4129 <indexterm role="concept">
4130 <primary>pid (process id)</primary>
4131 <secondary>of daemon</secondary>
4133 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4134 directories where log files and daemon pid files are written are output,
4135 respectively. If these values are unset, log files are written in a
4136 sub-directory of the spool directory called <option>log</option>, and the pid file is
4137 written directly into the spool directory.
4140 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4142 <literallayout class="monospaced">
4143 exim -bP +local_domains
4146 it searches for a matching named list of any type (domain, host, address, or
4147 local part) and outputs what it finds.
4150 <indexterm role="concept">
4151 <primary>options</primary>
4152 <secondary>router – extracting</secondary>
4154 <indexterm role="concept">
4155 <primary>options</primary>
4156 <secondary>transport – extracting</secondary>
4158 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4159 followed by the name of an appropriate driver instance, the option settings for
4160 that driver are output. For example:
4162 <literallayout class="monospaced">
4163 exim -bP transport local_delivery
4166 The generic driver options are output first, followed by the driver’s private
4167 options. A list of the names of drivers of a particular type can be obtained by
4168 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4169 <option>authenticator_list</option>, and a complete list of all drivers with their option
4170 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4171 <option>authenticators</option>.
4173 </listitem></varlistentry>
4175 <term><option>-bp</option></term>
4178 <indexterm role="option">
4179 <primary><option>-bp</option></primary>
4181 <indexterm role="concept">
4182 <primary>queue</primary>
4183 <secondary>listing messages on</secondary>
4185 <indexterm role="concept">
4186 <primary>listing</primary>
4187 <secondary>messages on the queue</secondary>
4189 This option requests a listing of the contents of the mail queue on the
4190 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4191 just those messages are listed. By default, this option can be used only by an
4192 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4193 to allow any user to see the queue.
4196 Each message on the queue is displayed as in the following example:
4198 <literallayout class="monospaced">
4199 25m 2.9K 0t5C6f-0000c8-00 <alice@wonderland.fict.example>
4200 red.king@looking-glass.fict.example
4201 <other addresses>
4204 <indexterm role="concept">
4205 <primary>message</primary>
4206 <secondary>size in queue listing</secondary>
4208 <indexterm role="concept">
4209 <primary>size</primary>
4210 <secondary>of message</secondary>
4212 The first line contains the length of time the message has been on the queue
4213 (in this case 25 minutes), the size of the message (2.9K), the unique local
4214 identifier for the message, and the message sender, as contained in the
4215 envelope. For bounce messages, the sender address is empty, and appears as
4216 <quote><></quote>. If the message was submitted locally by an untrusted user who overrode
4217 the default sender address, the user’s login name is shown in parentheses
4218 before the sender address.
4221 <indexterm role="concept">
4222 <primary>frozen messages</primary>
4223 <secondary>in queue listing</secondary>
4225 If the message is frozen (attempts to deliver it are suspended) then the text
4226 <quote>*** frozen ***</quote> is displayed at the end of this line.
4229 The recipients of the message (taken from the envelope, not the headers) are
4230 displayed on subsequent lines. Those addresses to which the message has already
4231 been delivered are marked with the letter D. If an original address gets
4232 expanded into several addresses via an alias or forward file, the original is
4233 displayed with a D only when deliveries for all of its child addresses are
4236 </listitem></varlistentry>
4238 <term><option>-bpa</option></term>
4241 <indexterm role="option">
4242 <primary><option>-bpa</option></primary>
4244 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4245 that were generated from the original top level address(es) in each message by
4246 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4247 of just <quote>D</quote>.
4249 </listitem></varlistentry>
4251 <term><option>-bpc</option></term>
4254 <indexterm role="option">
4255 <primary><option>-bpc</option></primary>
4257 <indexterm role="concept">
4258 <primary>queue</primary>
4259 <secondary>count of messages on</secondary>
4261 This option counts the number of messages on the queue, and writes the total
4262 to the standard output. It is restricted to admin users, unless
4263 <option>queue_list_requires_admin</option> is set false.
4265 </listitem></varlistentry>
4267 <term><option>-bpr</option></term>
4270 <indexterm role="option">
4271 <primary><option>-bpr</option></primary>
4273 This option operates like <option>-bp</option>, but the output is not sorted into
4274 chronological order of message arrival. This can speed it up when there are
4275 lots of messages on the queue, and is particularly useful if the output is
4276 going to be post-processed in a way that doesn’t need the sorting.
4278 </listitem></varlistentry>
4280 <term><option>-bpra</option></term>
4283 <indexterm role="option">
4284 <primary><option>-bpra</option></primary>
4286 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4288 </listitem></varlistentry>
4290 <term><option>-bpru</option></term>
4293 <indexterm role="option">
4294 <primary><option>-bpru</option></primary>
4296 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4298 </listitem></varlistentry>
4300 <term><option>-bpu</option></term>
4303 <indexterm role="option">
4304 <primary><option>-bpu</option></primary>
4306 This option operates like <option>-bp</option> but shows only undelivered top-level
4307 addresses for each message displayed. Addresses generated by aliasing or
4308 forwarding are not shown, unless the message was deferred after processing by a
4309 router with the <option>one_time</option> option set.
4311 </listitem></varlistentry>
4313 <term><option>-brt</option></term>
4316 <indexterm role="option">
4317 <primary><option>-brt</option></primary>
4319 <indexterm role="concept">
4320 <primary>testing</primary>
4321 <secondary>retry configuration</secondary>
4323 <indexterm role="concept">
4324 <primary>retry</primary>
4325 <secondary>configuration testing</secondary>
4327 This option is for testing retry rules, and it must be followed by up to three
4328 arguments. It causes Exim to look for a retry rule that matches the values
4329 and to write it to the standard output. For example:
4331 <literallayout class="monospaced">
4332 exim -brt bach.comp.mus.example
4333 Retry rule: *.comp.mus.example F,2h,15m; F,4d,30m;
4335 <para revisionflag="changed">
4336 See chapter <xref linkend="CHAPretry"/> for a description of Exim’s retry rules. The first
4337 argument, which is required, can be a complete address in the form
4338 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4339 contains a dot, it is interpreted as an optional second domain name; if no
4340 retry rule is found for the first argument, the second is tried. This ties in
4341 with Exim’s behaviour when looking for retry rules for remote hosts – if no
4342 rule is found that matches the host, one that matches the mail domain is
4343 sought. Finally, an argument that is the name of a specific delivery error, as
4344 used in setting up retry rules, can be given. For example:
4346 <literallayout class="monospaced" revisionflag="changed">
4347 exim -brt haydn.comp.mus.example quota_3d
4348 Retry rule: *@haydn.comp.mus.example quota_3d F,1h,15m
4350 </listitem></varlistentry>
4352 <term><option>-brw</option></term>
4355 <indexterm role="option">
4356 <primary><option>-brw</option></primary>
4358 <indexterm role="concept">
4359 <primary>testing</primary>
4360 <secondary>rewriting</secondary>
4362 <indexterm role="concept">
4363 <primary>rewriting</primary>
4364 <secondary>testing</secondary>
4366 This option is for testing address rewriting rules, and it must be followed by
4367 a single argument, consisting of either a local part without a domain, or a
4368 complete address with a fully qualified domain. Exim outputs how this address
4369 would be rewritten for each possible place it might appear. See chapter
4370 <xref linkend="CHAPrewrite"/> for further details.
4372 </listitem></varlistentry>
4374 <term><option>-bS</option></term>
4377 <indexterm role="option">
4378 <primary><option>-bS</option></primary>
4380 <indexterm role="concept">
4381 <primary>SMTP</primary>
4382 <secondary>batched incoming</secondary>
4384 <indexterm role="concept">
4385 <primary>batched SMTP input</primary>
4387 This option is used for batched SMTP input, which is an alternative interface
4388 for non-interactive local message submission. A number of messages can be
4389 submitted in a single run. However, despite its name, this is not really SMTP
4390 input. Exim reads each message’s envelope from SMTP commands on the standard
4391 input, but generates no responses. If the caller is trusted, or
4392 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4393 believed; otherwise the sender is always the caller of Exim.
4396 The message itself is read from the standard input, in SMTP format (leading
4397 dots doubled), terminated by a line containing just a single dot. An error is
4398 provoked if the terminating dot is missing. A further message may then follow.
4401 As for other local message submissions, the contents of incoming batch SMTP
4402 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4403 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4404 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4407 Some other SMTP commands are recognized in the input. HELO and EHLO act
4408 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4409 QUIT quits, ignoring the rest of the standard input.
4412 <indexterm role="concept">
4413 <primary>return code</primary>
4414 <secondary>for <option>-bS</option></secondary>
4416 If any error is encountered, reports are written to the standard output and
4417 error streams, and Exim gives up immediately. The return code is 0 if no error
4418 was detected; it is 1 if one or more messages were accepted before the error
4419 was detected; otherwise it is 2.
4422 More details of input using batched SMTP are given in section
4423 <xref linkend="SECTincomingbatchedSMTP"/>.
4425 </listitem></varlistentry>
4427 <term><option>-bs</option></term>
4430 <indexterm role="option">
4431 <primary><option>-bs</option></primary>
4433 <indexterm role="concept">
4434 <primary>SMTP</primary>
4435 <secondary>local input</secondary>
4437 <indexterm role="concept">
4438 <primary>local SMTP input</primary>
4440 This option causes Exim to accept one or more messages by reading SMTP commands
4441 on the standard input, and producing SMTP replies on the standard output. SMTP
4442 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4443 Some user agents use this interface as a way of passing locally-generated
4444 messages to the MTA.
4448 <indexterm role="concept">
4449 <primary>sender</primary>
4450 <secondary>source of</secondary>
4452 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4453 set, the senders of messages are taken from the SMTP MAIL commands.
4454 Otherwise the content of these commands is ignored and the sender is set up as
4455 the calling user. Unqualified addresses are automatically qualified using
4456 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4457 <option>-bnq</option> option is used.
4460 <indexterm role="concept">
4461 <primary>inetd</primary>
4464 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4465 using a listening daemon. Exim can distinguish the two cases by checking
4466 whether the standard input is a TCP/IP socket. When Exim is called from
4467 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4468 above concerning senders and qualification do not apply. In this situation,
4469 Exim behaves in exactly the same way as it does when receiving a message via
4470 the listening daemon.
4472 </listitem></varlistentry>
4474 <term><option>-bt</option></term>
4477 <indexterm role="option">
4478 <primary><option>-bt</option></primary>
4480 <indexterm role="concept">
4481 <primary>testing</primary>
4482 <secondary>addresses</secondary>
4484 <indexterm role="concept">
4485 <primary>address</primary>
4486 <secondary>testing</secondary>
4488 This option runs Exim in address testing mode, in which each argument is taken
4489 as an address to be tested for deliverability. The results are written to the
4490 standard output. If a test fails, and the caller is not an admin user, no
4491 details of the failure are output, because these might contain sensitive
4492 information such as usernames and passwords for database lookups.
4495 If no arguments are given, Exim runs in an interactive manner, prompting with a
4496 right angle bracket for addresses to be tested.
4499 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4500 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4504 Each address is handled as if it were the recipient address of a message
4505 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4506 written to the standard output. However, any router that has
4507 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4508 genuine routing tests if your first router passes everything to a scanner
4513 <indexterm role="concept">
4514 <primary>return code</primary>
4515 <secondary>for <option>-bt</option></secondary>
4517 return code is 2 if any address failed outright; it is 1 if no address
4518 failed outright but at least one could not be resolved for some reason. Return
4519 code 0 is given only when all addresses succeed.
4522 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4523 routers in the configuration makes any tests on the sender address of a
4525 <indexterm role="concept">
4526 <primary><option>-f</option> option</primary>
4527 <secondary>for address testing</secondary>
4529 you can use the <option>-f</option> option to set an appropriate sender when running
4530 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4531 default qualifying domain. However, if you have set up (for example) routers
4532 whose behaviour depends on the contents of an incoming message, you cannot test
4533 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4536 </listitem></varlistentry>
4538 <term><option>-bV</option></term>
4541 <indexterm role="option">
4542 <primary><option>-bV</option></primary>
4544 <indexterm role="concept">
4545 <primary>version number of Exim</primary>
4546 <secondary>verifying</secondary>
4548 This option causes Exim to write the current version number, compilation
4549 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4550 It also lists the DBM library this is being used, the optional modules (such as
4551 specific lookup types), the drivers that are included in the binary, and the
4552 name of the run time configuration file that is in use.
4555 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4556 configuration file. However, this is a static check only. It cannot check
4557 values that are to be expanded. For example, although a misspelt ACL verb is
4558 detected, an error in the verb’s arguments is not. You cannot rely on <option>-bV</option>
4559 alone to discover (for example) all the typos in the configuration; some
4560 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4561 dynamic testing facilities.
4563 </listitem></varlistentry>
4565 <term><option>-bv</option></term>
4568 <indexterm role="option">
4569 <primary><option>-bv</option></primary>
4571 <indexterm role="concept">
4572 <primary>verifying address</primary>
4573 <secondary>using <option>-bv</option></secondary>
4575 <indexterm role="concept">
4576 <primary>address</primary>
4577 <secondary>verification</secondary>
4579 This option runs Exim in address verification mode, in which each argument is
4580 taken as an address to be verified. During normal operation, verification
4581 happens mostly as a consequence processing a <option>verify</option> condition in an ACL
4582 (see chapter <xref linkend="CHAPACL"/>). If you want to test an entire ACL, see the <option>-bh</option>
4586 If verification fails, and the caller is not an admin user, no details of the
4587 failure are output, because these might contain sensitive information such as
4588 usernames and passwords for database lookups.
4591 If no arguments are given, Exim runs in an interactive manner, prompting with a
4592 right angle bracket for addresses to be verified.
4595 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4596 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
4600 Verification differs from address testing (the <option>-bt</option> option) in that routers
4601 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
4602 router that has <option>fail_verify</option> set, verification fails. The address is
4603 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
4604 address, <option>-bvs</option> should be used.
4607 If the <option>-v</option> option is not set, the output consists of a single line for each
4608 address, stating whether it was verified or not, and giving a reason in the
4609 latter case. Otherwise, more details are given of how the address has been
4610 handled, and in the case of address redirection, all the generated addresses
4611 are also considered. Without <option>-v</option>, generating more than one address by
4612 redirection causes verification to end successfully.
4616 <indexterm role="concept">
4617 <primary>return code</primary>
4618 <secondary>for <option>-bv</option></secondary>
4620 return code is 2 if any address failed outright; it is 1 if no address
4621 failed outright but at least one could not be resolved for some reason. Return
4622 code 0 is given only when all addresses succeed.
4625 If any of the routers in the configuration makes any tests on the sender
4626 address of a message, you should use the <option>-f</option> option to set an appropriate
4627 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
4628 calling user at the default qualifying domain.
4630 </listitem></varlistentry>
4632 <term><option>-bvs</option></term>
4635 <indexterm role="option">
4636 <primary><option>-bvs</option></primary>
4638 This option acts like <option>-bv</option>, but verifies the address as a sender rather
4639 than a recipient address. This affects any rewriting and qualification that
4642 </listitem></varlistentry>
4644 <term><option>-C</option> <<emphasis>filelist</emphasis>></term>
4647 <indexterm role="option">
4648 <primary><option>-C</option></primary>
4650 <indexterm role="concept">
4651 <primary>configuration file</primary>
4652 <secondary>alternate</secondary>
4654 <indexterm role="concept">
4655 <primary>CONFIGURE_FILE</primary>
4657 <indexterm role="concept">
4658 <primary>alternate configuration file</primary>
4660 This option causes Exim to find the run time configuration file from the given
4661 list instead of from the list specified by the CONFIGURE_FILE
4662 compile-time setting. Usually, the list will consist of just a single file
4663 name, but it can be a colon-separated list of names. In this case, the first
4664 file that exists is used. Failure to open an existing file stops Exim from
4665 proceeding any further along the list, and an error is generated.
4668 When this option is used by a caller other than root or the Exim user, and the
4669 list is different from the compiled-in list, Exim gives up its root privilege
4670 immediately, and runs with the real and effective uid and gid set to those of
4671 the caller. However, if ALT_CONFIG_ROOT_ONLY is defined in
4672 <filename>Local/Makefile</filename>, root privilege is retained for <option>-C</option> only if the caller of
4676 That is, the Exim user is no longer privileged in this regard. This build-time
4677 option is not set by default in the Exim source distribution tarbundle.
4678 However, if you are using a <quote>packaged</quote> version of Exim (source or binary),
4679 the packagers might have enabled it.
4682 Setting ALT_CONFIG_ROOT_ONLY locks out the possibility of testing a
4683 configuration using <option>-C</option> right through message reception and delivery, even
4684 if the caller is root. The reception works, but by that time, Exim is running
4685 as the Exim user, so when it re-executes to regain privilege for the delivery,
4686 the use of <option>-C</option> causes privilege to be lost. However, root can test reception
4687 and delivery using two separate commands (one to put a message on the queue,
4688 using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
4691 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
4692 prefix string with which any file named in a <option>-C</option> command line option
4693 must start. In addition, the file name must not contain the sequence <literal>/../</literal>.
4694 However, if the value of the <option>-C</option> option is identical to the value of
4695 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
4696 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
4697 unset, any file name can be used with <option>-C</option>.
4700 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
4701 to a directory to which only root has access. This prevents someone who has
4702 broken into the Exim account from running a privileged Exim with an arbitrary
4706 The <option>-C</option> facility is useful for ensuring that configuration files are
4707 syntactically correct, but cannot be used for test deliveries, unless the
4708 caller is privileged, or unless it is an exotic configuration that does not
4709 require privilege. No check is made on the owner or group of the files
4710 specified by this option.
4712 </listitem></varlistentry>
4714 <term><option>-D</option><<emphasis>macro</emphasis>>=<<emphasis>value</emphasis>></term>
4717 <indexterm role="option">
4718 <primary><option>-D</option></primary>
4720 <indexterm role="concept">
4721 <primary>macro</primary>
4722 <secondary>setting on command line</secondary>
4724 This option can be used to override macro definitions in the configuration file
4725 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
4726 unprivileged caller, it causes Exim to give up its root privilege.
4727 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
4728 completely disabled, and its use causes an immediate error exit.
4731 The entire option (including equals sign if present) must all be within one
4732 command line item. <option>-D</option> can be used to set the value of a macro to the empty
4733 string, in which case the equals sign is optional. These two commands are
4736 <literallayout class="monospaced">
4741 To include spaces in a macro definition item, quotes must be used. If you use
4742 quotes, spaces are permitted around the macro name and the equals sign. For
4745 <literallayout class="monospaced">
4746 exim '-D ABC = something' ...
4749 <option>-D</option> may be repeated up to 10 times on a command line.
4751 </listitem></varlistentry>
4753 <term><option>-d</option><<emphasis>debug options</emphasis>></term>
4756 <indexterm role="option">
4757 <primary><option>-d</option></primary>
4759 <indexterm role="concept">
4760 <primary>debugging</primary>
4761 <secondary>list of selectors</secondary>
4763 <indexterm role="concept">
4764 <primary>debugging</primary>
4765 <secondary><option>-d</option> option</secondary>
4767 This option causes debugging information to be written to the standard
4768 error stream. It is restricted to admin users because debugging output may show
4769 database queries that contain password information. Also, the details of users’
4770 filter files should be protected. When <option>-d</option> is used, <option>-v</option> is assumed. If
4771 <option>-d</option> is given on its own, a lot of standard debugging data is output. This
4772 can be reduced, or increased to include some more rarely needed information, by
4773 directly following <option>-d</option> with a string made up of names preceded by plus or
4774 minus characters. These add or remove sets of debugging data, respectively. For
4775 example, <option>-d+filter</option> adds filter debugging, whereas <option>-d-all+filter</option> selects
4776 only filter debugging. Note that no spaces are allowed in the debug setting.
4777 The available debugging categories are:
4780 <literal>acl </literal> ACL interpretation
4781 <literal>auth </literal> authenticators
4782 <literal>deliver </literal> general delivery logic
4783 <literal>dns </literal> DNS lookups (see also resolver)
4784 <literal>dnsbl </literal> DNS black list (aka RBL) code
4785 <literal>exec </literal> arguments for <function>execv()</function> calls
4786 <literal>expand </literal> detailed debugging for string expansions
4787 <literal>filter </literal> filter handling
4788 <literal>hints_lookup </literal> hints data lookups
4789 <literal>host_lookup </literal> all types of name-to-IP address handling
4790 <literal>ident </literal> ident lookup
4791 <literal>interface </literal> lists of local interfaces
4792 <literal>lists </literal> matching things in lists
4793 <literal>load </literal> system load checks
4794 <literal>local_scan </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
4795 <literal>lookup </literal> general lookup code and all lookups
4796 <literal>memory </literal> memory handling
4797 <literal>pid </literal> add pid to debug output lines
4798 <literal>process_info </literal> setting info for the process log
4799 <literal>queue_run </literal> queue runs
4800 <literal>receive </literal> general message reception logic
4801 <literal>resolver </literal> turn on the DNS resolver’s debugging output
4802 <literal>retry </literal> retry handling
4803 <literal>rewrite </literal> address rewriting
4804 <literal>route </literal> address routing
4805 <literal>timestamp </literal> add timestamp to debug output lines
4806 <literal>tls </literal> TLS logic
4807 <literal>transport </literal> transports
4808 <literal>uid </literal> changes of uid/gid and looking up uid/gid
4809 <literal>verify </literal> address verification logic
4810 <literal>all </literal> almost all of the above (see below), and also <option>-v</option>
4813 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
4814 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
4815 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
4816 is included, an awful lot of output that is very rarely of interest is
4817 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
4818 turn everything off.
4821 <indexterm role="concept">
4822 <primary>resolver</primary>
4823 <secondary>debugging output</secondary>
4825 <indexterm role="concept">
4826 <primary>DNS resolver</primary>
4827 <secondary>debugging output</secondary>
4829 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
4830 with DEBUG enabled. This is not the case in some operating systems. Also,
4831 unfortunately, debugging output from the DNS resolver is written to stdout
4835 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
4836 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
4837 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
4838 daemon, which then passes it on to any re-executed Exims. Exim also
4839 automatically adds the pid to debug lines when several remote deliveries are
4843 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
4844 of all debug output lines. This can be useful when trying to track down delays
4848 If the <option>debug_print</option> option is set in any driver, it produces output whenever
4849 any debugging is selected, or if <option>-v</option> is used.
4851 </listitem></varlistentry>
4853 <term><option>-dd</option><<emphasis>debug options</emphasis>></term>
4856 <indexterm role="option">
4857 <primary><option>-dd</option></primary>
4859 This option behaves exactly like <option>-d</option> except when used on a command that
4860 starts a daemon process. In that case, debugging is turned off for the
4861 subprocesses that the daemon creates. Thus, it is useful for monitoring the
4862 behaviour of the daemon without creating as much output as full debugging does.
4864 </listitem></varlistentry>
4866 <term><option>-dropcr</option></term>
4869 <indexterm role="option">
4870 <primary><option>-dropcr</option></primary>
4872 This is an obsolete option that is now a no-op. It used to affect the way Exim
4873 handled CR and LF characters in incoming messages. What happens now is
4874 described in section <xref linkend="SECTlineendings"/>.
4876 </listitem></varlistentry>
4878 <term><option>-E</option></term>
4881 <indexterm role="option">
4882 <primary><option>-E</option></primary>
4884 <indexterm role="concept">
4885 <primary>bounce message</primary>
4886 <secondary>generating</secondary>
4888 This option specifies that an incoming message is a locally-generated delivery
4889 failure report. It is used internally by Exim when handling delivery failures
4890 and is not intended for external use. Its only effect is to stop Exim
4891 generating certain messages to the postmaster, as otherwise message cascades
4892 could occur in some situations. As part of the same option, a message id may
4893 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
4894 new message contains the id, following <quote>R=</quote>, as a cross-reference.
4896 </listitem></varlistentry>
4898 <term><option>-e</option><emphasis>x</emphasis></term>
4901 <indexterm role="option">
4902 <primary><option>-e</option><emphasis>x</emphasis></primary>
4904 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
4905 called by various programs without the leading <option>o</option> in the option. For
4906 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
4907 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
4909 </listitem></varlistentry>
4911 <term><option>-F</option> <<emphasis>string</emphasis>></term>
4914 <indexterm role="option">
4915 <primary><option>-F</option></primary>
4917 <indexterm role="concept">
4918 <primary>sender</primary>
4919 <secondary>name</secondary>
4921 <indexterm role="concept">
4922 <primary>name</primary>
4923 <secondary>of sender</secondary>
4925 This option sets the sender’s full name for use when a locally-generated
4926 message is being accepted. In the absence of this option, the user’s <emphasis>gecos</emphasis>
4927 entry from the password data is used. As users are generally permitted to alter
4928 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
4929 between <option>-F</option> and the <<emphasis>string</emphasis>> is optional.
4931 </listitem></varlistentry>
4933 <term><option>-f</option> <<emphasis>address</emphasis>></term>
4936 <indexterm role="option">
4937 <primary><option>-f</option></primary>
4939 <indexterm role="concept">
4940 <primary>sender</primary>
4941 <secondary>address</secondary>
4943 <indexterm role="concept">
4944 <primary>address</primary>
4945 <secondary>sender</secondary>
4947 <indexterm role="concept">
4948 <primary>trusted user</primary>
4950 <indexterm role="concept">
4951 <primary>envelope sender</primary>
4953 <indexterm role="concept">
4954 <primary>user</primary>
4955 <secondary>trusted</secondary>
4957 This option sets the address of the envelope sender of a locally-generated
4958 message (also known as the return path). The option can normally be used only
4959 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
4963 Processes running as root or the Exim user are always trusted. Other
4964 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
4965 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
4966 of a local message is set to the caller’s login name at the default qualify
4970 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
4971 can be specified by any user, trusted or not, to create a message that can
4972 never provoke a bounce. An empty sender can be specified either as an empty
4973 string, or as a pair of angle brackets with nothing between them, as in these
4974 examples of shell commands:
4976 <literallayout class="monospaced">
4977 exim -f '<>' user@domain
4978 exim -f "" user@domain
4981 In addition, the use of <option>-f</option> is not restricted when testing a filter file
4982 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
4983 <option>-bv</option> options.
4986 Allowing untrusted users to change the sender address does not of itself make
4987 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
4988 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
4989 though this can be overridden by setting <option>no_local_from_check</option>.
4993 <indexterm role="concept">
4994 <primary><quote>From</quote> line</primary>
4996 space between <option>-f</option> and the <<emphasis>address</emphasis>> is optional (that is, they can be
4997 given as two arguments or one combined argument). The sender of a
4998 locally-generated message can also be set (when permitted) by an initial
4999 <quote>From </quote> line in the message – see the description of <option>-bm</option> above – but
5000 if <option>-f</option> is also present, it overrides <quote>From </quote>.
5002 </listitem></varlistentry>
5004 <term><option>-G</option></term>
5007 <indexterm role="option">
5008 <primary><option>-G</option></primary>
5010 <indexterm role="concept">
5011 <primary>Sendmail compatibility</primary>
5012 <secondary><option>-G</option> option ignored</secondary>
5014 This is a Sendmail option which is ignored by Exim.
5016 </listitem></varlistentry>
5018 <term><option>-h</option> <<emphasis>number</emphasis>></term>
5021 <indexterm role="option">
5022 <primary><option>-h</option></primary>
5024 <indexterm role="concept">
5025 <primary>Sendmail compatibility</primary>
5026 <secondary><option>-h</option> option ignored</secondary>
5028 This option is accepted for compatibility with Sendmail, but has no effect. (In
5029 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5032 </listitem></varlistentry>
5034 <term><option>-i</option></term>
5037 <indexterm role="option">
5038 <primary><option>-i</option></primary>
5040 <indexterm role="concept">
5041 <primary>Solaris</primary>
5042 <secondary><emphasis>mail</emphasis> command</secondary>
5044 <indexterm role="concept">
5045 <primary>dot in incoming</primary>
5046 <secondary>non-SMTP message</secondary>
5048 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5049 line by itself should not terminate an incoming, non-SMTP message. I can find
5050 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5051 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5053 </listitem></varlistentry>
5055 <term><option>-M</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5058 <indexterm role="option">
5059 <primary><option>-M</option></primary>
5061 <indexterm role="concept">
5062 <primary>forcing delivery</primary>
5064 <indexterm role="concept">
5065 <primary>delivery</primary>
5066 <secondary>forcing attempt</secondary>
5068 <indexterm role="concept">
5069 <primary>frozen messages</primary>
5070 <secondary>forcing delivery</secondary>
5072 This option requests Exim to run a delivery attempt on each message in turn. If
5073 any of the messages are frozen, they are automatically thawed before the
5074 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5075 and <option>hold_domains</option> are ignored.
5079 <indexterm role="concept">
5080 <primary>hints database</primary>
5081 <secondary>overriding retry hints</secondary>
5083 hints for any of the addresses are overridden – Exim tries to deliver even if
5084 the normal retry time has not yet been reached. This option requires the caller
5085 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5086 which can be set false to relax this restriction (and also the same requirement
5087 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5090 The deliveries happen synchronously, that is, the original Exim process does
5091 not terminate until all the delivery attempts have finished. No output is
5092 produced unless there is a serious error. If you want to see what is happening,
5093 use the <option>-v</option> option as well, or inspect Exim’s main log.
5095 </listitem></varlistentry>
5097 <term><option>-Mar</option> <<emphasis>message id</emphasis>> <<emphasis>address</emphasis>> <<emphasis>address</emphasis>> ...</term>
5100 <indexterm role="option">
5101 <primary><option>-Mar</option></primary>
5103 <indexterm role="concept">
5104 <primary>message</primary>
5105 <secondary>adding recipients</secondary>
5107 <indexterm role="concept">
5108 <primary>recipient</primary>
5109 <secondary>adding</secondary>
5111 This option requests Exim to add the addresses to the list of recipients of the
5112 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5113 id, and the remaining ones must be email addresses. However, if the message is
5114 active (in the middle of a delivery attempt), it is not altered. This option
5115 can be used only by an admin user.
5117 </listitem></varlistentry>
5119 <term><option>-MC</option> <<emphasis>transport</emphasis>> <<emphasis>hostname</emphasis>> <<emphasis>sequence number</emphasis>> <<emphasis>message id</emphasis>></term>
5122 <indexterm role="option">
5123 <primary><option>-MC</option></primary>
5125 <indexterm role="concept">
5126 <primary>SMTP</primary>
5127 <secondary>passed connection</secondary>
5129 <indexterm role="concept">
5130 <primary>SMTP</primary>
5131 <secondary>multiple deliveries</secondary>
5133 <indexterm role="concept">
5134 <primary>multiple SMTP deliveries</primary>
5136 This option is not intended for use by external callers. It is used internally
5137 by Exim to invoke another instance of itself to deliver a waiting message using
5138 an existing SMTP connection, which is passed as the standard input. Details are
5139 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5140 must be root or the Exim user in order to use it.
5142 </listitem></varlistentry>
5144 <term><option>-MCA</option></term>
5147 <indexterm role="option">
5148 <primary><option>-MCA</option></primary>
5150 This option is not intended for use by external callers. It is used internally
5151 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5152 connection to the remote host has been authenticated.
5154 </listitem></varlistentry>
5156 <term><option>-MCP</option></term>
5159 <indexterm role="option">
5160 <primary><option>-MCP</option></primary>
5162 This option is not intended for use by external callers. It is used internally
5163 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5164 which Exim is connected supports pipelining.
5166 </listitem></varlistentry>
5168 <term><option>-MCQ</option> <<emphasis>process id</emphasis>> <<emphasis>pipe fd</emphasis>></term>
5171 <indexterm role="option">
5172 <primary><option>-MCQ</option></primary>
5174 This option is not intended for use by external callers. It is used internally
5175 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5176 started by a queue runner. It passes on the process id of the queue runner,
5177 together with the file descriptor number of an open pipe. Closure of the pipe
5178 signals the final completion of the sequence of processes that are passing
5179 messages through the same SMTP connection.
5181 </listitem></varlistentry>
5183 <term><option>-MCS</option></term>
5186 <indexterm role="option">
5187 <primary><option>-MCS</option></primary>
5189 This option is not intended for use by external callers. It is used internally
5190 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5191 SMTP SIZE option should be used on messages delivered down the existing
5194 </listitem></varlistentry>
5196 <term><option>-MCT</option></term>
5199 <indexterm role="option">
5200 <primary><option>-MCT</option></primary>
5202 This option is not intended for use by external callers. It is used internally
5203 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5204 host to which Exim is connected supports TLS encryption.
5206 </listitem></varlistentry>
5208 <term><option>-Mc</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5211 <indexterm role="option">
5212 <primary><option>-Mc</option></primary>
5214 <indexterm role="concept">
5215 <primary>hints database</primary>
5216 <secondary>not overridden by <option>-Mc</option></secondary>
5218 <indexterm role="concept">
5219 <primary>delivery</primary>
5220 <secondary>manually started – not forced</secondary>
5222 This option requests Exim to run a delivery attempt on each message in turn,
5223 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5224 that are found. This option is not very useful to external callers. It is
5225 provided mainly for internal use by Exim when it needs to re-invoke itself in
5226 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5227 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5228 respects retry times and other options such as <option>hold_domains</option> that are
5229 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5230 If you want to run a specific delivery as if in a queue run, you should use
5231 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5232 and other deliveries is made in one or two places.
5234 </listitem></varlistentry>
5236 <term><option>-Mes</option> <<emphasis>message id</emphasis>> <<emphasis>address</emphasis>></term>
5239 <indexterm role="option">
5240 <primary><option>-Mes</option></primary>
5242 <indexterm role="concept">
5243 <primary>message</primary>
5244 <secondary>changing sender</secondary>
5246 <indexterm role="concept">
5247 <primary>sender</primary>
5248 <secondary>changing</secondary>
5250 This option requests Exim to change the sender address in the message to the
5251 given address, which must be a fully qualified address or <quote><></quote> (<quote>es</quote> for
5252 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5253 be a message id, and the second one an email address. However, if the message
5254 is active (in the middle of a delivery attempt), its status is not altered.
5255 This option can be used only by an admin user.
5257 </listitem></varlistentry>
5259 <term><option>-Mf</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5262 <indexterm role="option">
5263 <primary><option>-Mf</option></primary>
5265 <indexterm role="concept">
5266 <primary>freezing messages</primary>
5268 <indexterm role="concept">
5269 <primary>message</primary>
5270 <secondary>manually freezing</secondary>
5272 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5273 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5274 either manually or as a result of the <option>auto_thaw</option> configuration option.
5275 However, if any of the messages are active (in the middle of a delivery
5276 attempt), their status is not altered. This option can be used only by an admin
5279 </listitem></varlistentry>
5281 <term><option>-Mg</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5284 <indexterm role="option">
5285 <primary><option>-Mg</option></primary>
5287 <indexterm role="concept">
5288 <primary>giving up on messages</primary>
5290 <indexterm role="concept">
5291 <primary>message</primary>
5292 <secondary>abandoning delivery attempts</secondary>
5294 <indexterm role="concept">
5295 <primary>delivery</primary>
5296 <secondary>abandoning further attempts</secondary>
5298 This option requests Exim to give up trying to deliver the listed messages,
5299 including any that are frozen. However, if any of the messages are active,
5300 their status is not altered. For non-bounce messages, a delivery error message
5301 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5302 Bounce messages are just discarded. This option can be used only by an admin
5305 </listitem></varlistentry>
5307 <term><option>-Mmad</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5310 <indexterm role="option">
5311 <primary><option>-Mmad</option></primary>
5313 <indexterm role="concept">
5314 <primary>delivery</primary>
5315 <secondary>cancelling all</secondary>
5317 This option requests Exim to mark all the recipient addresses in the messages
5318 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5319 message is active (in the middle of a delivery attempt), its status is not
5320 altered. This option can be used only by an admin user.
5322 </listitem></varlistentry>
5324 <term><option>-Mmd</option> <<emphasis>message id</emphasis>> <<emphasis>address</emphasis>> <<emphasis>address</emphasis>> ...</term>
5327 <indexterm role="option">
5328 <primary><option>-Mmd</option></primary>
5330 <indexterm role="concept">
5331 <primary>delivery</primary>
5332 <secondary>cancelling by address</secondary>
5334 <indexterm role="concept">
5335 <primary>recipient</primary>
5336 <secondary>removing</secondary>
5338 <indexterm role="concept">
5339 <primary>removing recipients</primary>
5341 This option requests Exim to mark the given addresses as already delivered
5342 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5343 the remaining ones must be email addresses. These are matched to recipient
5344 addresses in the message in a case-sensitive manner. If the message is active
5345 (in the middle of a delivery attempt), its status is not altered. This option
5346 can be used only by an admin user.
5348 </listitem></varlistentry>
5350 <term><option>-Mrm</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5353 <indexterm role="option">
5354 <primary><option>-Mrm</option></primary>
5356 <indexterm role="concept">
5357 <primary>removing messages</primary>
5359 <indexterm role="concept">
5360 <primary>abandoning mail</primary>
5362 <indexterm role="concept">
5363 <primary>message</primary>
5364 <secondary>manually discarding</secondary>
5366 This option requests Exim to remove the given messages from the queue. No
5367 bounce messages are sent; each message is simply forgotten. However, if any of
5368 the messages are active, their status is not altered. This option can be used
5369 only by an admin user or by the user who originally caused the message to be
5370 placed on the queue.
5372 </listitem></varlistentry>
5374 <term><option>-Mt</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5377 <indexterm role="option">
5378 <primary><option>-Mt</option></primary>
5380 <indexterm role="concept">
5381 <primary>thawing messages</primary>
5383 <indexterm role="concept">
5384 <primary>unfreezing messages</primary>
5386 <indexterm role="concept">
5387 <primary>frozen messages</primary>
5388 <secondary>thawing</secondary>
5390 <indexterm role="concept">
5391 <primary>message</primary>
5392 <secondary>thawing frozen</secondary>
5394 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5395 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5396 messages are active, their status is not altered. This option can be used only
5399 </listitem></varlistentry>
5401 <term><option>-Mvb</option> <<emphasis>message id</emphasis>></term>
5404 <indexterm role="option">
5405 <primary><option>-Mvb</option></primary>
5407 <indexterm role="concept">
5408 <primary>listing</primary>
5409 <secondary>message body</secondary>
5411 <indexterm role="concept">
5412 <primary>message</primary>
5413 <secondary>listing body of</secondary>
5415 This option causes the contents of the message body (-D) spool file to be
5416 written to the standard output. This option can be used only by an admin user.
5418 </listitem></varlistentry>
5420 <term><option>-Mvh</option> <<emphasis>message id</emphasis>></term>
5423 <indexterm role="option">
5424 <primary><option>-Mvh</option></primary>
5426 <indexterm role="concept">
5427 <primary>listing</primary>
5428 <secondary>message headers</secondary>
5430 <indexterm role="concept">
5431 <primary>header lines</primary>
5432 <secondary>listing</secondary>
5434 <indexterm role="concept">
5435 <primary>message</primary>
5436 <secondary>listing header lines</secondary>
5438 This option causes the contents of the message headers (-H) spool file to be
5439 written to the standard output. This option can be used only by an admin user.
5441 </listitem></varlistentry>
5443 <term><option>-Mvl</option> <<emphasis>message id</emphasis>></term>
5446 <indexterm role="option">
5447 <primary><option>-Mvl</option></primary>
5449 <indexterm role="concept">
5450 <primary>listing</primary>
5451 <secondary>message log</secondary>
5453 <indexterm role="concept">
5454 <primary>message</primary>
5455 <secondary>listing message log</secondary>
5457 This option causes the contents of the message log spool file to be written to
5458 the standard output. This option can be used only by an admin user.
5460 </listitem></varlistentry>
5462 <term><option>-m</option></term>
5465 <indexterm role="option">
5466 <primary><option>-m</option></primary>
5468 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
5469 treats it that way too.
5471 </listitem></varlistentry>
5473 <term><option>-N</option></term>
5476 <indexterm role="option">
5477 <primary><option>-N</option></primary>
5479 <indexterm role="concept">
5480 <primary>debugging</primary>
5481 <secondary><option>-N</option> option</secondary>
5483 <indexterm role="concept">
5484 <primary>debugging</primary>
5485 <secondary>suppressing delivery</secondary>
5487 This is a debugging option that inhibits delivery of a message at the transport
5488 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery –
5489 it just doesn’t actually transport the message, but instead behaves as if it
5490 had successfully done so. However, it does not make any updates to the retry
5491 database, and the log entries for deliveries are flagged with <quote>*></quote> rather
5492 than <quote>=></quote>.
5495 Because <option>-N</option> discards any message to which it applies, only root or the Exim
5496 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
5497 words, an ordinary user can use it only when supplying an incoming message to
5498 which it will apply. Although transportation never fails when <option>-N</option> is set, an
5499 address may be deferred because of a configuration problem on a transport, or a
5500 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
5501 the message, and applies to any subsequent delivery attempts that may happen
5504 </listitem></varlistentry>
5506 <term><option>-n</option></term>
5509 <indexterm role="option">
5510 <primary><option>-n</option></primary>
5512 <indexterm role="concept">
5513 <primary>Sendmail compatibility</primary>
5514 <secondary><option>-n</option> option ignored</secondary>
5516 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>. It is ignored
5519 </listitem></varlistentry>
5521 <term><option>-O</option> <<emphasis>data</emphasis>></term>
5524 <indexterm role="option">
5525 <primary><option>-O</option></primary>
5527 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
5530 </listitem></varlistentry>
5532 <term><option>-oA</option> <<emphasis>file name</emphasis>></term>
5535 <indexterm role="option">
5536 <primary><option>-oA</option></primary>
5538 <indexterm role="concept">
5539 <primary>Sendmail compatibility</primary>
5540 <secondary><option>-oA</option> option</secondary>
5542 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
5543 alternative alias file name. Exim handles <option>-bi</option> differently; see the
5546 </listitem></varlistentry>
5548 <term><option>-oB</option> <<emphasis>n</emphasis>></term>
5551 <indexterm role="option">
5552 <primary><option>-oB</option></primary>
5554 <indexterm role="concept">
5555 <primary>SMTP</primary>
5556 <secondary>passed connection</secondary>
5558 <indexterm role="concept">
5559 <primary>SMTP</primary>
5560 <secondary>multiple deliveries</secondary>
5562 <indexterm role="concept">
5563 <primary>multiple SMTP deliveries</primary>
5565 This is a debugging option which limits the maximum number of messages that can
5566 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
5567 transport. If <<emphasis>n</emphasis>> is omitted, the limit is set to 1.
5569 </listitem></varlistentry>
5571 <term><option>-odb</option></term>
5574 <indexterm role="option">
5575 <primary><option>-odb</option></primary>
5577 <indexterm role="concept">
5578 <primary>background delivery</primary>
5580 <indexterm role="concept">
5581 <primary>delivery</primary>
5582 <secondary>in the background</secondary>
5584 This option applies to all modes in which Exim accepts incoming messages,
5585 including the listening daemon. It requests <quote>background</quote> delivery of such
5586 messages, which means that the accepting process automatically starts a
5587 delivery process for each message received, but does not wait for the delivery
5588 processes to finish.
5591 When all the messages have been received, the reception process exits,
5592 leaving the delivery processes to finish in their own time. The standard output
5593 and error streams are closed at the start of each delivery process.
5594 This is the default action if none of the <option>-od</option> options are present.
5597 If one of the queueing options in the configuration file
5598 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
5599 overrides it if <option>queue_only_override</option> is set true, which is the default
5600 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
5602 </listitem></varlistentry>
5604 <term><option>-odf</option></term>
5607 <indexterm role="option">
5608 <primary><option>-odf</option></primary>
5610 <indexterm role="concept">
5611 <primary>foreground delivery</primary>
5613 <indexterm role="concept">
5614 <primary>delivery</primary>
5615 <secondary>in the foreground</secondary>
5617 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
5618 accepted a locally-generated message. (For the daemon it is exactly the same as
5619 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
5620 and Exim waits for it to complete before proceeding.
5623 The original Exim reception process does not finish until the delivery
5624 process for the final message has ended. The standard error stream is left open
5628 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
5629 false and one of the queueing options in the configuration file is in effect.
5632 If there is a temporary delivery error during foreground delivery, the
5633 message is left on the queue for later delivery, and the original reception
5634 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
5635 restricted configuration that never queues messages.
5637 </listitem></varlistentry>
5639 <term><option>-odi</option></term>
5642 <indexterm role="option">
5643 <primary><option>-odi</option></primary>
5645 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
5648 </listitem></varlistentry>
5650 <term><option>-odq</option></term>
5653 <indexterm role="option">
5654 <primary><option>-odq</option></primary>
5656 <indexterm role="concept">
5657 <primary>non-immediate delivery</primary>
5659 <indexterm role="concept">
5660 <primary>delivery</primary>
5661 <secondary>suppressing immediate</secondary>
5663 <indexterm role="concept">
5664 <primary>queueing incoming messages</primary>
5666 This option applies to all modes in which Exim accepts incoming messages,
5667 including the listening daemon. It specifies that the accepting process should
5668 not automatically start a delivery process for each message received. Messages
5669 are placed on the queue, and remain there until a subsequent queue runner
5670 process encounters them. There are several configuration options (such as
5671 <option>queue_only</option>) that can be used to queue incoming messages under certain
5672 conditions. This option overrides all of them and also <option>-odqs</option>. It always
5675 </listitem></varlistentry>
5677 <term><option>-odqs</option></term>
5680 <indexterm role="option">
5681 <primary><option>-odqs</option></primary>
5683 <indexterm role="concept">
5684 <primary>SMTP</primary>
5685 <secondary>delaying delivery</secondary>
5687 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
5688 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
5689 <option>queue_only_override</option> is false and one of the queueing options in the
5690 configuration file is in effect.
5693 When <option>-odqs</option> does operate, a delivery process is started for each incoming
5694 message, in the background by default, but in the foreground if <option>-odi</option> is
5695 also present. The recipient addresses are routed, and local deliveries are done
5696 in the normal way. However, if any SMTP deliveries are required, they are not
5697 done at this time, so the message remains on the queue until a subsequent queue
5698 runner process encounters it. Because routing was done, Exim knows which
5699 messages are waiting for which hosts, and so a number of messages for the same
5700 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
5701 configuration option has the same effect for specific domains. See also the
5702 <option>-qq</option> option.
5704 </listitem></varlistentry>
5706 <term><option>-oee</option></term>
5709 <indexterm role="option">
5710 <primary><option>-oee</option></primary>
5712 <indexterm role="concept">
5713 <primary>error</primary>
5714 <secondary>reporting</secondary>
5716 If an error is detected while a non-SMTP message is being received (for
5717 example, a malformed address), the error is reported to the sender in a mail
5721 <indexterm role="concept">
5722 <primary>return code</primary>
5723 <secondary>for <option>-oee</option></secondary>
5726 this error message is successfully sent, the Exim receiving process
5727 exits with a return code of zero. If not, the return code is 2 if the problem
5728 is that the original message has no recipients, or 1 any other error. This is
5729 the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
5731 </listitem></varlistentry>
5733 <term><option>-oem</option></term>
5736 <indexterm role="option">
5737 <primary><option>-oem</option></primary>
5739 <indexterm role="concept">
5740 <primary>error</primary>
5741 <secondary>reporting</secondary>
5743 <indexterm role="concept">
5744 <primary>return code</primary>
5745 <secondary>for <option>-oem</option></secondary>
5747 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
5748 return code, whether or not the error message was successfully sent.
5749 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
5751 </listitem></varlistentry>
5753 <term><option>-oep</option></term>
5756 <indexterm role="option">
5757 <primary><option>-oep</option></primary>
5759 <indexterm role="concept">
5760 <primary>error</primary>
5761 <secondary>reporting</secondary>
5763 If an error is detected while a non-SMTP message is being received, the
5764 error is reported by writing a message to the standard error file (stderr).
5765 <indexterm role="concept">
5766 <primary>return code</primary>
5767 <secondary>for <option>-oep</option></secondary>
5769 The return code is 1 for all errors.
5771 </listitem></varlistentry>
5773 <term><option>-oeq</option></term>
5776 <indexterm role="option">
5777 <primary><option>-oeq</option></primary>
5779 <indexterm role="concept">
5780 <primary>error</primary>
5781 <secondary>reporting</secondary>
5783 This option is supported for compatibility with Sendmail, but has the same
5784 effect as <option>-oep</option>.
5786 </listitem></varlistentry>
5788 <term><option>-oew</option></term>
5791 <indexterm role="option">
5792 <primary><option>-oew</option></primary>
5794 <indexterm role="concept">
5795 <primary>error</primary>
5796 <secondary>reporting</secondary>
5798 This option is supported for compatibility with Sendmail, but has the same
5799 effect as <option>-oem</option>.
5801 </listitem></varlistentry>
5803 <term><option>-oi</option></term>
5806 <indexterm role="option">
5807 <primary><option>-oi</option></primary>
5809 <indexterm role="concept">
5810 <primary>dot in incoming</primary>
5811 <secondary>non-SMTP message</secondary>
5813 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
5814 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
5815 single dot does terminate, though Exim does no special processing for other
5816 lines that start with a dot. This option is set by default if Exim is called as
5817 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
5819 </listitem></varlistentry>
5821 <term><option>-oitrue</option></term>
5824 <indexterm role="option">
5825 <primary><option>-oitrue</option></primary>
5827 This option is treated as synonymous with <option>-oi</option>.
5829 </listitem></varlistentry>
5831 <term><option>-oMa</option> <<emphasis>host address</emphasis>></term>
5834 <indexterm role="option">
5835 <primary><option>-oMa</option></primary>
5837 <indexterm role="concept">
5838 <primary>sender host address</primary>
5839 <secondary>specifying for local message</secondary>
5841 A number of options starting with <option>-oM</option> can be used to set values associated
5842 with remote hosts on locally-submitted messages (that is, messages not received
5843 over TCP/IP). These options can be used by any caller in conjunction with the
5844 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
5845 other circumstances, they are ignored unless the caller is trusted.
5848 The <option>-oMa</option> option sets the sender host address. This may include a port
5849 number at the end, after a full stop (period). For example:
5851 <literallayout class="monospaced">
5852 exim -bs -oMa 10.9.8.7.1234
5855 An alternative syntax is to enclose the IP address in square brackets,
5856 followed by a colon and the port number:
5858 <literallayout class="monospaced">
5859 exim -bs -oMa [10.9.8.7]:1234
5862 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
5863 port, if present, in <varname>$sender_host_port</varname>.
5865 </listitem></varlistentry>
5867 <term><option>-oMaa</option> <<emphasis>name</emphasis>></term>
5870 <indexterm role="option">
5871 <primary><option>-oMaa</option></primary>
5873 <indexterm role="concept">
5874 <primary>authentication name</primary>
5875 <secondary>specifying for local message</secondary>
5877 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
5878 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
5879 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
5881 </listitem></varlistentry>
5883 <term><option>-oMai</option> <<emphasis>string</emphasis>></term>
5886 <indexterm role="option">
5887 <primary><option>-oMai</option></primary>
5889 <indexterm role="concept">
5890 <primary>authentication id</primary>
5891 <secondary>specifying for local message</secondary>
5893 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
5894 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
5895 This overrides the default value (the caller’s login id) for messages from
5896 local sources. See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated
5899 </listitem></varlistentry>
5901 <term><option>-oMas</option> <<emphasis>address</emphasis>></term>
5904 <indexterm role="option">
5905 <primary><option>-oMas</option></primary>
5907 <indexterm role="concept">
5908 <primary>authentication sender</primary>
5909 <secondary>specifying for local message</secondary>
5911 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
5912 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
5913 overrides the sender address that is created from the caller’s login id for
5914 messages from local sources. See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of
5915 authenticated senders.
5917 </listitem></varlistentry>
5919 <term><option>-oMi</option> <<emphasis>interface address</emphasis>></term>
5922 <indexterm role="option">
5923 <primary><option>-oMi</option></primary>
5925 <indexterm role="concept">
5926 <primary>interface address</primary>
5927 <secondary>specifying for local message</secondary>
5929 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
5930 option sets the IP interface address value. A port number may be included,
5931 using the same syntax as for <option>-oMa</option>. The interface address is placed in
5932 <varname>$interface_address</varname> and the port number, if present, in <varname>$interface_port</varname>.
5934 </listitem></varlistentry>
5936 <term><option>-oMr</option> <<emphasis>protocol name</emphasis>></term>
5939 <indexterm role="option">
5940 <primary><option>-oMr</option></primary>
5942 <indexterm role="concept">
5943 <primary>protocol</primary>
5944 <secondary>incoming – specifying for local message</secondary>
5946 <indexterm role="concept">
5947 <primary><varname>$received_protocol</varname></primary>
5949 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
5950 option sets the received protocol value that is stored in
5951 <varname>$received_protocol</varname>. However, this applies only when <option>-bs</option> is not used. For
5952 interactive SMTP input (<option>-bs</option>), the protocol is always <quote>local-</quote> followed by
5953 one of the standard SMTP protocol names (see the description of
5954 <varname>$received_protocol</varname> in section <xref linkend="SECTexpvar"/>). For <option>-bS</option> (batch SMTP)
5955 however, the protocol can be set by <option>-oMr</option>.
5957 </listitem></varlistentry>
5959 <term><option>-oMs</option> <<emphasis>host name</emphasis>></term>
5962 <indexterm role="option">
5963 <primary><option>-oMs</option></primary>
5965 <indexterm role="concept">
5966 <primary>sender host name</primary>
5967 <secondary>specifying for local message</secondary>
5969 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
5970 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
5971 present, Exim does not attempt to look up a host name from an IP address; it
5972 uses the name it is given.
5974 </listitem></varlistentry>
5976 <term><option>-oMt</option> <<emphasis>ident string</emphasis>></term>
5979 <indexterm role="option">
5980 <primary><option>-oMt</option></primary>
5982 <indexterm role="concept">
5983 <primary>sender ident string</primary>
5984 <secondary>specifying for local message</secondary>
5986 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
5987 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
5988 local callers is the login id of the calling process.
5990 </listitem></varlistentry>
5992 <term><option>-om</option></term>
5995 <indexterm role="option">
5996 <primary><option>-om</option></primary>
5998 <indexterm role="concept">
5999 <primary>Sendmail compatibility</primary>
6000 <secondary><option>-om</option> option ignored</secondary>
6002 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6003 message should receive a copy of the message if the sender appears in an alias
6004 expansion. Exim always does this, so the option does nothing.
6006 </listitem></varlistentry>
6008 <term><option>-oo</option></term>
6011 <indexterm role="option">
6012 <primary><option>-oo</option></primary>
6014 <indexterm role="concept">
6015 <primary>Sendmail compatibility</primary>
6016 <secondary><option>-oo</option> option ignored</secondary>
6018 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6019 whatever that means.
6021 </listitem></varlistentry>
6023 <term><option>-oP</option> <<emphasis>path</emphasis>></term>
6026 <indexterm role="option">
6027 <primary><option>-oP</option></primary>
6029 <indexterm role="concept">
6030 <primary>pid (process id)</primary>
6031 <secondary>of daemon</secondary>
6033 <indexterm role="concept">
6034 <primary>daemon</primary>
6035 <secondary>process id (pid)</secondary>
6037 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6038 value. The option specifies the file to which the process id of the daemon is
6039 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6040 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6041 because in those cases, the normal pid file is not used.
6043 </listitem></varlistentry>
6045 <term><option>-or</option> <<emphasis>time</emphasis>></term>
6048 <indexterm role="option">
6049 <primary><option>-or</option></primary>
6051 <indexterm role="concept">
6052 <primary>timeout</primary>
6053 <secondary>for non-SMTP input</secondary>
6055 This option sets a timeout value for incoming non-SMTP messages. If it is not
6056 set, Exim will wait forever for the standard input. The value can also be set
6057 by the <option>receive_timeout</option> option. The format used for specifying times is
6058 described in section <xref linkend="SECTtimeformat"/>.
6060 </listitem></varlistentry>
6062 <term><option>-os</option> <<emphasis>time</emphasis>></term>
6065 <indexterm role="option">
6066 <primary><option>-os</option></primary>
6068 <indexterm role="concept">
6069 <primary>timeout</primary>
6070 <secondary>for SMTP input</secondary>
6072 <indexterm role="concept">
6073 <primary>SMTP timeout</primary>
6074 <secondary>input</secondary>
6076 This option sets a timeout value for incoming SMTP messages. The timeout
6077 applies to each SMTP command and block of data. The value can also be set by
6078 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6079 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6081 </listitem></varlistentry>
6083 <term><option>-ov</option></term>
6086 <indexterm role="option">
6087 <primary><option>-ov</option></primary>
6089 This option has exactly the same effect as <option>-v</option>.
6091 </listitem></varlistentry>
6093 <term><option>-oX</option> <<emphasis>number or string</emphasis>></term>
6096 <indexterm role="option">
6097 <primary><option>-oX</option></primary>
6099 <indexterm role="concept">
6100 <primary>TCP/IP</primary>
6101 <secondary>setting listening ports</secondary>
6103 <indexterm role="concept">
6104 <primary>TCP/IP</primary>
6105 <secondary>setting listening interfaces</secondary>
6107 <indexterm role="concept">
6108 <primary>port</primary>
6109 <secondary>receiving TCP/IP</secondary>
6111 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6112 is also given. It controls which ports and interfaces the daemon uses. Details
6113 of the syntax, and how it interacts with configuration file options, are given
6114 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6115 file is written unless <option>-oP</option> is also present to specify a pid file name.
6117 </listitem></varlistentry>
6119 <term><option>-pd</option></term>
6122 <indexterm role="option">
6123 <primary><option>-pd</option></primary>
6125 <indexterm role="concept">
6126 <primary>Perl</primary>
6127 <secondary>starting the interpreter</secondary>
6129 This option applies when an embedded Perl interpreter is linked with Exim (see
6130 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6131 option, forcing the starting of the interpreter to be delayed until it is
6134 </listitem></varlistentry>
6136 <term><option>-ps</option></term>
6139 <indexterm role="option">
6140 <primary><option>-ps</option></primary>
6142 <indexterm role="concept">
6143 <primary>Perl</primary>
6144 <secondary>starting the interpreter</secondary>
6146 This option applies when an embedded Perl interpreter is linked with Exim (see
6147 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6148 option, forcing the starting of the interpreter to occur as soon as Exim is
6151 </listitem></varlistentry>
6153 <term><option>-p</option><<emphasis>rval</emphasis>>:<<emphasis>sval</emphasis>></term>
6156 <indexterm role="option">
6157 <primary><option>-p</option></primary>
6159 For compatibility with Sendmail, this option is equivalent to
6162 <literal>-oMr</literal> <<emphasis>rval</emphasis>> <literal>-oMs</literal> <<emphasis>sval</emphasis>>
6165 It sets the incoming protocol and host name (for trusted callers). The
6166 host name and its colon can be omitted when only the protocol is to be set.
6167 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6168 to embedded Perl. It is therefore impossible to set a protocol value of <literal>p</literal>
6169 or <literal>s</literal> using this option (but that does not seem a real limitation).
6171 </listitem></varlistentry>
6173 <term><option>-q</option></term>
6176 <indexterm role="option">
6177 <primary><option>-q</option></primary>
6179 <indexterm role="concept">
6180 <primary>queue runner</primary>
6181 <secondary>starting manually</secondary>
6183 This option is normally restricted to admin users. However, there is a
6184 configuration option called <option>prod_requires_admin</option> which can be set false to
6185 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6186 and <option>-S</option> options).
6189 <indexterm role="concept">
6190 <primary>queue runner</primary>
6191 <secondary>description of operation</secondary>
6193 The <option>-q</option> option starts one queue runner process. This scans the queue of
6194 waiting messages, and runs a delivery process for each one in turn. It waits
6195 for each delivery process to finish before starting the next one. A delivery
6196 process may not actually do any deliveries if the retry times for the addresses
6197 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6201 <indexterm role="concept">
6202 <primary>SMTP</primary>
6203 <secondary>passed connection</secondary>
6205 <indexterm role="concept">
6206 <primary>SMTP</primary>
6207 <secondary>multiple deliveries</secondary>
6209 <indexterm role="concept">
6210 <primary>multiple SMTP deliveries</primary>
6212 the delivery process spawns other processes to deliver other messages down
6213 passed SMTP connections, the queue runner waits for these to finish before
6217 When all the queued messages have been considered, the original queue runner
6218 process terminates. In other words, a single pass is made over the waiting
6219 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6220 this to be repeated periodically.
6223 Exim processes the waiting messages in an unpredictable order. It isn’t very
6224 random, but it is likely to be different each time, which is all that matters.
6225 If one particular message screws up a remote MTA, other messages to the same
6226 MTA have a chance of getting through if they get tried first.
6229 It is possible to cause the messages to be processed in lexical message id
6230 order, which is essentially the order in which they arrived, by setting the
6231 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6233 </listitem></varlistentry>
6235 <term><option>-q</option><<emphasis>qflags</emphasis>></term>
6238 The <option>-q</option> option may be followed by one or more flag letters that change its
6239 behaviour. They are all optional, but if more than one is present, they must
6240 appear in the correct order. Each flag is described in a separate item below.
6242 </listitem></varlistentry>
6244 <term><option>-qq...</option></term>
6247 <indexterm role="option">
6248 <primary><option>-qq</option></primary>
6250 <indexterm role="concept">
6251 <primary>queue</primary>
6252 <secondary>double scanning</secondary>
6254 <indexterm role="concept">
6255 <primary>queue</primary>
6256 <secondary>routing</secondary>
6258 <indexterm role="concept">
6259 <primary>routing</primary>
6260 <secondary>whole queue before delivery</secondary>
6262 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6263 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6264 every domain. Addresses are routed, local deliveries happen, but no remote
6268 <indexterm role="concept">
6269 <primary>hints database</primary>
6270 <secondary>remembering routing</secondary>
6272 The hints database that remembers which messages are waiting for specific hosts
6273 is updated, as if delivery to those hosts had been deferred. After this is
6274 complete, a second, normal queue scan happens, with routing and delivery taking
6275 place as normal. Messages that are routed to the same host should mostly be
6276 delivered down a single SMTP
6277 <indexterm role="concept">
6278 <primary>SMTP</primary>
6279 <secondary>passed connection</secondary>
6281 <indexterm role="concept">
6282 <primary>SMTP</primary>
6283 <secondary>multiple deliveries</secondary>
6285 <indexterm role="concept">
6286 <primary>multiple SMTP deliveries</primary>
6288 connection because of the hints that were set up during the first queue scan.
6289 This option may be useful for hosts that are connected to the Internet
6292 </listitem></varlistentry>
6294 <term><option>-q[q]i...</option></term>
6297 <indexterm role="option">
6298 <primary><option>-qi</option></primary>
6300 <indexterm role="concept">
6301 <primary>queue</primary>
6302 <secondary>initial delivery</secondary>
6304 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6305 those messages that haven’t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6306 delivery</quote>.) This can be helpful if you are putting messages on the queue using
6307 <option>-odq</option> and want a queue runner just to process the new messages.
6309 </listitem></varlistentry>
6311 <term><option>-q[q][i]f...</option></term>
6314 <indexterm role="option">
6315 <primary><option>-qf</option></primary>
6317 <indexterm role="concept">
6318 <primary>queue</primary>
6319 <secondary>forcing delivery</secondary>
6321 <indexterm role="concept">
6322 <primary>delivery</primary>
6323 <secondary>forcing in queue run</secondary>
6325 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6326 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6327 their retry times are tried.
6329 </listitem></varlistentry>
6331 <term><option>-q[q][i]ff...</option></term>
6334 <indexterm role="option">
6335 <primary><option>-qff</option></primary>
6337 <indexterm role="concept">
6338 <primary>frozen messages</primary>
6339 <secondary>forcing delivery</secondary>
6341 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6344 </listitem></varlistentry>
6346 <term><option>-q[q][i][f[f]]l</option></term>
6349 <indexterm role="option">
6350 <primary><option>-ql</option></primary>
6352 <indexterm role="concept">
6353 <primary>queue</primary>
6354 <secondary>local deliveries only</secondary>
6356 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6357 be done. If a message requires any remote deliveries, it remains on the queue
6360 </listitem></varlistentry>
6362 <term><option>-q</option><<emphasis>qflags</emphasis>> <<emphasis>start id</emphasis>> <<emphasis>end id</emphasis>></term>
6365 <indexterm role="concept">
6366 <primary>queue</primary>
6367 <secondary>delivering specific messages</secondary>
6369 When scanning the queue, Exim can be made to skip over messages whose ids are
6370 lexically less than a given value by following the <option>-q</option> option with a
6371 starting message id. For example:
6373 <literallayout class="monospaced">
6374 exim -q 0t5C6f-0000c8-00
6377 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
6378 second message id is given, messages whose ids are lexically greater than it
6379 are also skipped. If the same id is given twice, for example,
6381 <literallayout class="monospaced">
6382 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
6385 just one delivery process is started, for that message. This differs from
6386 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
6387 that it counts as a delivery from a queue run. Note that the selection
6388 mechanism does not affect the order in which the messages are scanned. There
6389 are also other ways of selecting specific sets of messages for delivery in a
6390 queue run – see <option>-R</option> and <option>-S</option>.
6392 </listitem></varlistentry>
6394 <term><option>-q</option><<emphasis>qflags</emphasis>><<emphasis>time</emphasis>></term>
6397 <indexterm role="concept">
6398 <primary>queue runner</primary>
6399 <secondary>starting periodically</secondary>
6401 <indexterm role="concept">
6402 <primary>periodic queue running</primary>
6404 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
6405 starting a queue runner process at intervals specified by the given time value
6406 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
6407 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
6408 single daemon process handles both functions. A common way of starting up a
6409 combined daemon at system boot time is to use a command such as
6411 <literallayout class="monospaced">
6412 /usr/exim/bin/exim -bd -q30m
6415 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
6416 process every 30 minutes.
6419 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
6420 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
6422 </listitem></varlistentry>
6424 <term><option>-qR</option><<emphasis>rsflags</emphasis>> <<emphasis>string</emphasis>></term>
6427 <indexterm role="option">
6428 <primary><option>-qR</option></primary>
6430 This option is synonymous with <option>-R</option>. It is provided for Sendmail
6433 </listitem></varlistentry>
6435 <term><option>-qS</option><<emphasis>rsflags</emphasis>> <<emphasis>string</emphasis>></term>
6438 <indexterm role="option">
6439 <primary><option>-qS</option></primary>
6441 This option is synonymous with <option>-S</option>.
6443 </listitem></varlistentry>
6445 <term><option>-R</option><<emphasis>rsflags</emphasis>> <<emphasis>string</emphasis>></term>
6448 <indexterm role="option">
6449 <primary><option>-R</option></primary>
6451 <indexterm role="concept">
6452 <primary>queue runner</primary>
6453 <secondary>for specific recipients</secondary>
6455 <indexterm role="concept">
6456 <primary>delivery</primary>
6457 <secondary>to given domain</secondary>
6459 <indexterm role="concept">
6460 <primary>domain</primary>
6461 <secondary>delivery to</secondary>
6463 The <<emphasis>rsflags</emphasis>> may be empty, in which case the white space before the string
6464 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
6465 which are the possible values for <<emphasis>rsflags</emphasis>>. White space is required if
6466 <<emphasis>rsflags</emphasis>> is not empty.
6469 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
6470 perform a single queue run, except that, when scanning the messages on the
6471 queue, Exim processes only those that have at least one undelivered recipient
6472 address containing the given string, which is checked in a case-independent
6473 way. If the <<emphasis>rsflags</emphasis>> start with <emphasis>r</emphasis>, <<emphasis>string</emphasis>> is interpreted as a
6474 regular expression; otherwise it is a literal string.
6477 Once a message is selected, all its addresses are processed. For the first
6478 selected message, Exim overrides any retry information and forces a delivery
6479 attempt for each undelivered address. This means that if delivery of any
6480 address in the first message is successful, any existing retry information is
6481 deleted, and so delivery attempts for that address in subsequently selected
6482 messages (which are processed without forcing) will run. However, if delivery
6483 of any address does not succeed, the retry information is updated, and in
6484 subsequently selected messages, the failing address will be skipped.
6487 <indexterm role="concept">
6488 <primary>frozen messages</primary>
6489 <secondary>forcing delivery</secondary>
6491 If the <<emphasis>rsflags</emphasis>> contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
6492 all selected messages, not just the first; frozen messages are included when
6493 <emphasis>ff</emphasis> is present.
6496 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
6497 to a given domain after a host has been down for some time. When the SMTP
6498 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
6499 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
6500 an arbitrary command instead.
6502 </listitem></varlistentry>
6504 <term><option>-r</option></term>
6507 <indexterm role="option">
6508 <primary><option>-r</option></primary>
6510 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
6512 </listitem></varlistentry>
6514 <term><option>-S</option><<emphasis>rsflags</emphasis>> <<emphasis>string</emphasis>></term>
6517 <indexterm role="option">
6518 <primary><option>-S</option></primary>
6520 <indexterm role="concept">
6521 <primary>delivery</primary>
6522 <secondary>from given sender</secondary>
6524 <indexterm role="concept">
6525 <primary>queue runner</primary>
6526 <secondary>for specific senders</secondary>
6528 This option acts like <option>-R</option> except that it checks the string against each
6529 message’s sender instead of against the recipients. If <option>-R</option> is also set, both
6530 conditions must be met for a message to be selected. If either of the options
6531 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
6533 </listitem></varlistentry>
6535 <term><option>-Tqt</option> <<emphasis>times</emphasis>></term>
6538 <indexterm role="option">
6539 <primary><option>-Tqt</option></primary>
6541 This an option that is exclusively for use by the Exim testing suite. It is not
6542 recognized when Exim is run normally. It allows for the setting up of explicit
6543 <quote>queue times</quote> so that various warning/retry features can be tested.
6545 </listitem></varlistentry>
6547 <term><option>-t</option></term>
6550 <indexterm role="option">
6551 <primary><option>-t</option></primary>
6553 <indexterm role="concept">
6554 <primary>recipient</primary>
6555 <secondary>extracting from header lines</secondary>
6557 <indexterm role="concept">
6558 <primary><emphasis>Bcc:</emphasis> header line</primary>
6560 <indexterm role="concept">
6561 <primary><emphasis>Cc:</emphasis> header line</primary>
6563 <indexterm role="concept">
6564 <primary><emphasis>To:</emphasis> header line</primary>
6566 When Exim is receiving a locally-generated, non-SMTP message on its standard
6567 input, the <option>-t</option> option causes the recipients of the message to be obtained
6568 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
6569 from the command arguments. The addresses are extracted before any rewriting
6570 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
6573 <indexterm role="concept">
6574 <primary>Sendmail compatibility</primary>
6575 <secondary><option>-t</option> option</secondary>
6577 If the command has any arguments, they specify addresses to which the message
6578 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
6579 the recipients list obtained from the headers. This is compatible with Smail 3
6580 and in accordance with the documented behaviour of several versions of
6581 Sendmail, as described in man pages on a number of operating systems (e.g.
6582 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
6583 argument addresses to those obtained from the headers, and the O’Reilly
6584 Sendmail book documents it that way. Exim can be made to add argument addresses
6585 instead of subtracting them by setting the option
6586 <option>extract_addresses_remove_arguments</option> false.
6589 <indexterm role="concept">
6590 <primary><option>Resent-</option> header lines</primary>
6591 <secondary>with <option>-t</option></secondary>
6593 If there are any <option>Resent-</option> header lines in the message, Exim extracts
6594 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
6595 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
6596 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
6597 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
6600 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
6601 message is resent several times). The RFC also specifies that they should be
6602 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
6603 not at all clear how <option>-t</option> should operate in the present of multiple sets,
6604 nor indeed exactly what constitutes a <quote>set</quote>.
6605 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
6606 are often added at the end of the header, and if a message is resent more than
6607 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
6608 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
6610 </listitem></varlistentry>
6612 <term><option>-ti</option></term>
6615 <indexterm role="option">
6616 <primary><option>-ti</option></primary>
6618 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
6619 compatibility with Sendmail.
6621 </listitem></varlistentry>
6623 <term><option>-tls-on-connect</option></term>
6626 <indexterm role="option">
6627 <primary><option>-tls-on-connect</option></primary>
6629 <indexterm role="concept">
6630 <primary>TLS</primary>
6631 <secondary>use without STARTTLS</secondary>
6633 <indexterm role="concept">
6634 <primary>TLS</primary>
6635 <secondary>automatic start</secondary>
6637 This option is available when Exim is compiled with TLS support. It forces all
6638 incoming SMTP connections to behave as if the incoming port is listed in the
6639 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
6640 <xref linkend="CHAPTLS"/> for further details.
6642 </listitem></varlistentry>
6644 <term><option>-U</option></term>
6647 <indexterm role="option">
6648 <primary><option>-U</option></primary>
6650 <indexterm role="concept">
6651 <primary>Sendmail compatibility</primary>
6652 <secondary><option>-U</option> option ignored</secondary>
6654 Sendmail uses this option for <quote>initial message submission</quote>, and its
6655 documentation states that in future releases, it may complain about
6656 syntactically invalid messages rather than fixing them when this flag is not
6657 set. Exim ignores this option.
6659 </listitem></varlistentry>
6661 <term><option>-v</option></term>
6664 <indexterm role="option">
6665 <primary><option>-v</option></primary>
6667 This option causes Exim to write information to the standard error stream,
6668 describing what it is doing. In particular, it shows the log lines for
6669 receiving and delivering a message, and if an SMTP connection is made, the SMTP
6670 dialogue is shown. Some of the log lines shown may not actually be written to
6671 the log if the setting of <option>log_selector</option> discards them. Any relevant
6672 selectors are shown with each log line. If none are shown, the logging is
6675 </listitem></varlistentry>
6677 <term><option>-x</option></term>
6680 <indexterm role="option">
6681 <primary><option>-x</option></primary>
6683 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
6684 National Language Support extended characters in the body of the mail item</quote>).
6685 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
6688 </listitem></varlistentry>
6691 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
6692 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
6694 <!-- === End of command line options === -->
6698 <chapter id="CHAPconf">
6699 <title>The Exim run time configuration file</title>
6700 <titleabbrev>The runtime configuration file</titleabbrev>
6702 <indexterm role="concept">
6703 <primary>run time configuration</primary>
6705 <indexterm role="concept">
6706 <primary>configuration file</primary>
6707 <secondary>general description</secondary>
6709 <indexterm role="concept">
6710 <primary>CONFIGURE_FILE</primary>
6712 <indexterm role="concept">
6713 <primary>configuration file</primary>
6714 <secondary>errors in</secondary>
6716 <indexterm role="concept">
6717 <primary>error</primary>
6718 <secondary>in configuration file</secondary>
6720 <indexterm role="concept">
6721 <primary>return code</primary>
6722 <secondary>for bad configuration</secondary>
6724 Exim uses a single run time configuration file that is read whenever an Exim
6725 binary is executed. Note that in normal operation, this happens frequently,
6726 because Exim is designed to operate in a distributed manner, without central
6730 If a syntax error is detected while reading the configuration file, Exim
6731 writes a message on the standard error, and exits with a non-zero return code.
6732 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
6733 errors can be detected at this time. The values of any expanded options are
6734 not checked until the expansion happens, even when the expansion does not
6735 actually alter the string.
6738 The name of the configuration file is compiled into the binary for security
6739 reasons, and is specified by the CONFIGURE_FILE compilation option. In
6740 most configurations, this specifies a single file. However, it is permitted to
6741 give a colon-separated list of file names, in which case Exim uses the first
6742 existing file in the list.
6745 <indexterm role="concept">
6746 <primary>EXIM_USER</primary>
6748 <indexterm role="concept">
6749 <primary>EXIM_GROUP</primary>
6751 <indexterm role="concept">
6752 <primary>CONFIGURE_OWNER</primary>
6754 <indexterm role="concept">
6755 <primary>CONFIGURE_GROUP</primary>
6757 <indexterm role="concept">
6758 <primary>configuration file</primary>
6759 <secondary>ownership</secondary>
6761 <indexterm role="concept">
6762 <primary>ownership</primary>
6763 <secondary>configuration file</secondary>
6765 The run time configuration file must be owned by root or by the user that is
6766 specified at compile time by the EXIM_USER option, or by the user that is
6767 specified at compile time by the CONFIGURE_OWNER option (if set). The
6768 configuration file must not be world-writeable or group-writeable, unless its
6769 group is the one specified at compile time by the EXIM_GROUP option or by the
6770 CONFIGURE_GROUP option.
6773 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
6774 to root, anybody who is able to edit the run time configuration file has an
6775 easy way to run commands as root. If you make your mail administrators members
6776 of the Exim group, but do not trust them with root, make sure that the run time
6777 configuration is not group writeable.
6780 A default configuration file, which will work correctly in simple situations,
6781 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
6782 defines just one file name, the installation process copies the default
6783 configuration to a new file of that name if it did not previously exist. If
6784 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
6785 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
6789 <title>Using a different configuration file</title>
6791 <indexterm role="concept">
6792 <primary>configuration file</primary>
6793 <secondary>alternate</secondary>
6795 A one-off alternate configuration can be specified by the <option>-C</option> command line
6796 option, which may specify a single file or a list of files. However, when
6797 <option>-C</option> is used, Exim gives up its root privilege, unless called by root or the
6798 Exim user (or unless the argument for <option>-C</option> is identical to the built-in value
6799 from CONFIGURE_FILE). <option>-C</option> is useful mainly for checking the syntax of
6800 configuration files before installing them. No owner or group checks are done
6801 on a configuration file specified by <option>-C</option>.
6804 The privileged use of <option>-C</option> by the Exim user can be locked out by setting
6805 ALT_CONFIG_ROOT_ONLY in <filename>Local/Makefile</filename> when building Exim. However,
6806 if you do this, you also lock out the possibility of testing a
6807 configuration using <option>-C</option> right through message reception and delivery, even
6808 if the caller is root. The reception works, but by that time, Exim is running
6809 as the Exim user, so when it re-execs to regain privilege for the delivery, the
6810 use of <option>-C</option> causes privilege to be lost. However, root can test reception and
6811 delivery using two separate commands (one to put a message on the queue, using
6812 <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
6815 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
6816 prefix string with which any file named in a <option>-C</option> command line option must
6817 start. In addition, the file name must not contain the sequence <quote><literal>/../</literal></quote>.
6818 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any file
6819 name can be used with <option>-C</option>.
6822 One-off changes to a configuration can be specified by the <option>-D</option> command line
6823 option, which defines and overrides values for macros used inside the
6824 configuration file. However, like <option>-C</option>, the use of this option by a
6825 non-privileged user causes Exim to discard its root privilege.
6826 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
6827 completely disabled, and its use causes an immediate error exit.
6830 Some sites may wish to use the same Exim binary on different machines that
6831 share a file system, but to use different configuration files on each machine.
6832 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
6833 looks for a file whose name is the configuration file name followed by a dot
6834 and the machine’s node name, as obtained from the <function>uname()</function> function. If this
6835 file does not exist, the standard name is tried. This processing occurs for
6836 each file name in the list given by CONFIGURE_FILE or <option>-C</option>.
6839 In some esoteric situations different versions of Exim may be run under
6840 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
6841 help with this. See the comments in <filename>src/EDITME</filename> for details.
6844 <section id="SECTconffilfor">
6845 <title>Configuration file format</title>
6847 <indexterm role="concept">
6848 <primary>configuration file</primary>
6849 <secondary>format of</secondary>
6851 <indexterm role="concept">
6852 <primary>format</primary>
6853 <secondary>configuration file</secondary>
6855 Exim’s configuration file is divided into a number of different parts. General
6856 option settings must always appear at the start of the file. The other parts
6857 are all optional, and may appear in any order. Each part other than the first
6858 is introduced by the word <quote>begin</quote> followed by the name of the part. The
6864 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail.
6869 <indexterm role="concept">
6870 <primary>AUTH</primary>
6871 <secondary>configuration</secondary>
6873 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
6874 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
6879 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
6880 addresses and determine how the message is to be delivered.
6885 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
6886 define mechanisms for copying messages to destinations.
6891 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be immediately delivered.
6896 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
6897 when new addresses are generated during delivery.
6902 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
6903 want to use this feature, you must set
6905 <literallayout class="monospaced">
6906 LOCAL_SCAN_HAS_OPTIONS=yes
6909 in <filename>Local/Makefile</filename> before building Exim. Full details of the
6910 <function>local_scan()</function> facility are given in chapter <xref linkend="CHAPlocalscan"/>.
6915 <indexterm role="concept">
6916 <primary>configuration file</primary>
6917 <secondary>leading white space in</secondary>
6919 <indexterm role="concept">
6920 <primary>configuration file</primary>
6921 <secondary>trailing white space in</secondary>
6923 <indexterm role="concept">
6924 <primary>white space</primary>
6925 <secondary>in configuration file</secondary>
6927 Leading and trailing white space in configuration lines is always ignored.
6930 Blank lines in the file, and lines starting with a # character (ignoring
6931 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
6932 # character other than at the beginning of a line is not treated specially,
6933 and does not introduce a comment.
6936 Any non-comment line can be continued by ending it with a backslash. Note that
6937 the general rule for white space means that trailing white space after the
6938 backslash and leading white space at the start of continuation
6939 lines is ignored. Comment lines beginning with # (but not empty lines) may
6940 appear in the middle of a sequence of continuation lines.
6943 A convenient way to create a configuration file is to start from the
6944 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
6945 change settings as required.
6948 The ACLs, retry rules, and rewriting rules have their own syntax which is
6949 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
6950 respectively. The other parts of the configuration file have some syntactic
6951 items in common, and these are described below, from section <xref linkend="SECTcos"/>
6952 onwards. Before that, the inclusion, macro, and conditional facilities are
6957 <title>File inclusions in the configuration file</title>
6959 <indexterm role="concept">
6960 <primary>inclusions in configuration file</primary>
6962 <indexterm role="concept">
6963 <primary>configuration file</primary>
6964 <secondary>including other files</secondary>
6966 <indexterm role="concept">
6967 <primary>.include in configuration file</primary>
6969 <indexterm role="concept">
6970 <primary>.include_if_exists in configuration file</primary>
6972 You can include other files inside Exim’s run time configuration file by
6976 <literal>.include</literal> <<emphasis>file name</emphasis>>
6977 <literal>.include_if_exists</literal> <<emphasis>file name</emphasis>>
6979 <para revisionflag="changed">
6980 on a line by itself. Double quotes round the file name are optional. If you use
6981 the first form, a configuration error occurs if the file does not exist; the
6982 second form does nothing for non-existent files. In all cases, an absolute file
6986 Includes may be nested to any depth, but remember that Exim reads its
6987 configuration file often, so it is a good idea to keep them to a minimum.
6988 If you change the contents of an included file, you must HUP the daemon,
6989 because an included file is read only when the configuration itself is read.
6992 The processing of inclusions happens early, at a physical line level, so, like
6993 comment lines, an inclusion can be used in the middle of an option setting,
6996 <literallayout class="monospaced">
6997 hosts_lookup = a.b.c \
7001 Include processing happens after macro processing (see below). Its effect is to
7002 process the lines of the included file as if they occurred inline where the
7006 <section id="SECTmacrodefs">
7007 <title>Macros in the configuration file</title>
7009 <indexterm role="concept">
7010 <primary>macro</primary>
7011 <secondary>description of</secondary>
7013 <indexterm role="concept">
7014 <primary>configuration file</primary>
7015 <secondary>macros</secondary>
7017 If a line in the main part of the configuration (that is, before the first
7018 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7019 definition, and must be of the form
7022 <<emphasis>name</emphasis>> = <<emphasis>rest of line</emphasis>>
7025 The name must consist of letters, digits, and underscores, and need not all be
7026 in upper case, though that is recommended. The rest of the line, including any
7027 continuations, is the replacement text, and has leading and trailing white
7028 space removed. Quotes are not removed. The replacement text can never end with
7029 a backslash character, but this doesn’t seem to be a serious limitation.
7032 Macros may also be defined between router, transport, authenticator, or ACL
7033 definitions. They may not, however, be defined within an individual driver or
7034 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7038 <title>Macro substitution</title>
7040 Once a macro is defined, all subsequent lines in the file (and any included
7041 files) are scanned for the macro name; if there are several macros, the line is
7042 scanned for each in turn, in the order in which the macros are defined. The
7043 replacement text is not re-scanned for the current macro, though it is scanned
7044 for subsequently defined macros. For this reason, a macro name may not contain
7045 the name of a previously defined macro as a substring. You could, for example,
7049 <literal>ABCD_XYZ = </literal><<emphasis>something</emphasis>>
7050 <literal>ABCD = </literal><<emphasis>something else</emphasis>>
7053 but putting the definitions in the opposite order would provoke a configuration
7054 error. Macro expansion is applied to individual physical lines from the file,
7055 before checking for line continuation or file inclusion (see above). If a line
7056 consists solely of a macro name, and the expansion of the macro is empty, the
7057 line is ignored. A macro at the start of a line may turn the line into a
7058 comment line or a <literal>.include</literal> line.
7062 <title>Redefining macros</title>
7064 Once defined, the value of a macro can be redefined later in the configuration
7065 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7066 <emphasis>=</emphasis>. For example:
7068 <literallayout class="monospaced">
7071 MAC == updated value
7074 Redefinition does not alter the order in which the macros are applied to the
7075 subsequent lines of the configuration file. It is still the same order in which
7076 the macros were originally defined. All that changes is the macro’s value.
7077 Redefinition makes it possible to accumulate values. For example:
7079 <literallayout class="monospaced">
7082 MAC == MAC and something added
7085 This can be helpful in situations where the configuration file is built
7086 from a number of other files.
7090 <title>Overriding macro values</title>
7092 The values set for macros in the configuration file can be overridden by the
7093 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7094 used, unless called by root or the Exim user. A definition on the command line
7095 using the <option>-D</option> option causes all definitions and redefinitions within the
7100 <title>Example of macro usage</title>
7102 As an example of macro usage, consider a configuration where aliases are looked
7103 up in a MySQL database. It helps to keep the file less cluttered if long
7104 strings such as SQL statements are defined separately as macros, for example:
7106 <literallayout class="monospaced">
7107 ALIAS_QUERY = select mailbox from user where \
7108 login=${quote_mysql:$local_part};
7111 This can then be used in a <command>redirect</command> router setting like this:
7113 <literallayout class="monospaced">
7114 data = ${lookup mysql{ALIAS_QUERY}}
7117 In earlier versions of Exim macros were sometimes used for domain, host, or
7118 address lists. In Exim 4 these are handled better by named lists – see
7119 section <xref linkend="SECTnamedlists"/>.
7123 <title>Conditional skips in the configuration file</title>
7125 <indexterm role="concept">
7126 <primary>configuration file</primary>
7127 <secondary>conditional skips</secondary>
7129 <indexterm role="concept">
7130 <primary>.ifdef</primary>
7132 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7133 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7134 portions of the configuration file. The processing happens whenever the file is
7135 read (that is, when an Exim binary starts to run).
7138 The implementation is very simple. Instances of the first four directives must
7139 be followed by text that includes the names of one or macros. The condition
7140 that is tested is whether or not any macro substitution has taken place in the
7143 <literallayout class="monospaced">
7145 message_size_limit = 50M
7147 message_size_limit = 100M
7151 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined, and 100M
7152 otherwise. If there is more than one macro named on the line, the condition
7153 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7154 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7157 Although you can use a macro expansion to generate one of these directives,
7158 it is not very useful, because the condition <quote>there was a macro substitution
7159 in this line</quote> will always be true.
7162 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7163 to clarify complicated nestings.
7166 <section id="SECTcos">
7167 <title>Common option syntax</title>
7169 <indexterm role="concept">
7170 <primary>common option syntax</primary>
7172 <indexterm role="concept">
7173 <primary>syntax of common options</primary>
7175 <indexterm role="concept">
7176 <primary>configuration file</primary>
7177 <secondary>common option syntax</secondary>
7179 For the main set of options, driver options, and <function>local_scan()</function> options,
7180 each setting is on a line by itself, and starts with a name consisting of
7181 lower-case letters and underscores. Many options require a data value, and in
7182 these cases the name must be followed by an equals sign (with optional white
7183 space) and then the value. For example:
7185 <literallayout class="monospaced">
7186 qualify_domain = mydomain.example.com
7189 Some option settings may contain sensitive data, for example, passwords for
7190 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7191 line option to read these values, you can precede the option settings with the
7192 word <quote>hide</quote>. For example:
7194 <literallayout class="monospaced">
7195 hide mysql_servers = localhost/users/admin/secret-password
7198 For non-admin users, such options are displayed like this:
7200 <literallayout class="monospaced">
7201 mysql_servers = <value not displayable>
7204 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7205 all instances of the same driver.
7208 The following sections describe the syntax used for the different data types
7209 that are found in option settings.
7213 <title>Boolean options</title>
7215 <indexterm role="concept">
7216 <primary>format</primary>
7217 <secondary>boolean</secondary>
7219 <indexterm role="concept">
7220 <primary>boolean configuration values</primary>
7222 <indexterm role="option">
7223 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7225 <indexterm role="option">
7226 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7228 Options whose type is given as boolean are on/off switches. There are two
7229 different ways of specifying such options: with and without a data value. If
7230 the option name is specified on its own without data, the switch is turned on;
7231 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7232 boolean options may be followed by an equals sign and one of the words
7233 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7234 the following two settings have exactly the same effect:
7236 <literallayout class="monospaced">
7241 The following two lines also have the same (opposite) effect:
7243 <literallayout class="monospaced">
7248 You can use whichever syntax you prefer.
7252 <title>Integer values</title>
7254 <indexterm role="concept">
7255 <primary>integer configuration values</primary>
7257 <indexterm role="concept">
7258 <primary>format</primary>
7259 <secondary>integer</secondary>
7261 If an integer data item starts with the characters <quote>0x</quote>, the remainder of it
7262 is interpreted as a hexadecimal number. Otherwise, it is treated as octal if it
7263 starts with the digit 0, and decimal if not. If an integer value is followed by
7264 the letter K, it is multiplied by 1024; if it is followed by the letter M, it
7265 is multiplied by 1024x1024.
7268 When the values of integer option settings are output, values which are an
7269 exact multiple of 1024 or 1024x1024 are
7270 sometimes, but not always,
7271 printed using the letters K and M. The printing style is independent of the
7272 actual input format that was used.
7276 <title>Octal integer values</title>
7278 <indexterm role="concept">
7279 <primary>integer format</primary>
7281 <indexterm role="concept">
7282 <primary>format</primary>
7283 <secondary>octal integer</secondary>
7285 The value of an option specified as an octal integer is always interpreted in
7286 octal, whether or not it starts with the digit zero. Such options are always
7291 <title>Fixed point number values</title>
7293 <indexterm role="concept">
7294 <primary>fixed point configuration values</primary>
7296 <indexterm role="concept">
7297 <primary>format</primary>
7298 <secondary>fixed point</secondary>
7300 A fixed point number consists of a decimal integer, optionally followed by a
7301 decimal point and up to three further digits.
7304 <section id="SECTtimeformat">
7305 <title>Time interval values</title>
7307 <indexterm role="concept">
7308 <primary>time interval</primary>
7309 <secondary>specifying in configuration</secondary>
7311 <indexterm role="concept">
7312 <primary>format</primary>
7313 <secondary>time interval</secondary>
7315 A time interval is specified as a sequence of numbers, each followed by one of
7316 the following letters, with no intervening white space:
7318 <informaltable frame="none">
7319 <tgroup cols="2" colsep="0" rowsep="0">
7320 <colspec colwidth="50pt" align="left"/>
7321 <colspec colwidth="260pt" align="left"/>
7324 <entry> <option>s</option></entry>
7325 <entry>seconds</entry>
7328 <entry> <option>m</option></entry>
7329 <entry>minutes</entry>
7332 <entry> <option>h</option></entry>
7333 <entry>hours</entry>
7336 <entry> <option>d</option></entry>
7340 <entry> <option>w</option></entry>
7341 <entry>weeks</entry>
7347 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
7348 intervals are output in the same format. Exim does not restrict the values; it
7349 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
7352 <section id="SECTstrings">
7353 <title>String values</title>
7355 <indexterm role="concept">
7356 <primary>string</primary>
7357 <secondary>format of configuration values</secondary>
7359 <indexterm role="concept">
7360 <primary>format</primary>
7361 <secondary>string</secondary>
7363 If a string data item does not start with a double-quote character, it is taken
7364 as consisting of the remainder of the line plus any continuation lines,
7365 starting at the first character after any leading white space, with trailing
7366 white space removed, and with no interpretation of the characters in the
7367 string. Because Exim removes comment lines (those beginning with #) at an early
7368 stage, they can appear in the middle of a multi-line string. The following
7369 settings are therefore equivalent:
7371 <literallayout class="monospaced">
7372 trusted_users = uucp:mail
7374 trusted_users = uucp:\
7375 # This comment line is ignored
7379 <indexterm role="concept">
7380 <primary>string</primary>
7381 <secondary>quoted</secondary>
7383 <indexterm role="concept">
7384 <primary>escape characters in quoted strings</primary>
7386 If a string does start with a double-quote, it must end with a closing
7387 double-quote, and any backslash characters other than those used for line
7388 continuation are interpreted as escape characters, as follows:
7390 <informaltable frame="none">
7391 <tgroup cols="2" colsep="0" rowsep="0">
7392 <colspec colwidth="100pt" align="left"/>
7393 <colspec colwidth="260pt" align="left"/>
7396 <entry> <literal>\\</literal></entry>
7397 <entry>single backslash</entry>
7400 <entry> <literal>\n</literal></entry>
7401 <entry>newline</entry>
7404 <entry> <literal>\r</literal></entry>
7405 <entry>carriage return</entry>
7408 <entry> <literal>\t</literal></entry>
7412 <entry> <literal>\</literal><<emphasis>octal digits</emphasis>></entry>
7413 <entry>up to 3 octal digits specify one character</entry>
7416 <entry> <literal>\x</literal><<emphasis>hex digits</emphasis>></entry>
7417 <entry>up to 2 hexadecimal digits specify one character</entry>
7423 If a backslash is followed by some other character, including a double-quote
7424 character, that character replaces the pair.
7427 Quoting is necessary only if you want to make use of the backslash escapes to
7428 insert special characters, or if you need to specify a value with leading or
7429 trailing spaces. These cases are rare, so quoting is almost never needed in
7430 current versions of Exim. In versions of Exim before 3.14, quoting was required
7431 in order to continue lines, so you may come across older configuration files
7432 and examples that apparently quote unnecessarily.
7436 <title>Expanded strings</title>
7438 <indexterm role="concept">
7439 <primary>string expansion</primary>
7440 <secondary>definition of</secondary>
7442 <indexterm role="concept">
7443 <primary>expansion</primary>
7444 <secondary>definition of</secondary>
7446 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
7447 by which means various parts of the string may be changed according to the
7448 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
7449 is as just described; in particular, the handling of backslashes in quoted
7450 strings is done as part of the input process, before expansion takes place.
7451 However, backslash is also an escape character for the expander, so any
7452 backslashes that are required for that reason must be doubled if they are
7453 within a quoted configuration string.
7457 <title>User and group names</title>
7459 <indexterm role="concept">
7460 <primary>user name</primary>
7461 <secondary>format of</secondary>
7463 <indexterm role="concept">
7464 <primary>format</primary>
7465 <secondary>user name</secondary>
7467 <indexterm role="concept">
7468 <primary>group</primary>
7469 <secondary>name format</secondary>
7471 <indexterm role="concept">
7472 <primary>format</primary>
7473 <secondary>group name</secondary>
7475 User and group names are specified as strings, using the syntax described
7476 above, but the strings are interpreted specially. A user or group name must
7477 either consist entirely of digits, or be a name that can be looked up using the
7478 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
7481 <section id="SECTlistconstruct">
7482 <title>List construction</title>
7484 <indexterm role="concept">
7485 <primary>list</primary>
7486 <secondary>syntax of in configuration</secondary>
7488 <indexterm role="concept">
7489 <primary>format</primary>
7490 <secondary>list item in configuration</secondary>
7492 <indexterm role="concept">
7493 <primary>string list</primary>
7494 <secondary>definition</secondary>
7496 The data for some configuration options is a list of items, with colon as the
7497 default separator. Many of these options are shown with type <quote>string list</quote> in
7498 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
7499 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
7500 are all the same; however, those other than <quote>string list</quote> are subject to
7501 particular kinds of interpretation, as described in chapter
7502 <xref linkend="CHAPdomhosaddlists"/>.
7505 In all these cases, the entire list is treated as a single string as far as the
7506 input syntax is concerned. The <option>trusted_users</option> setting in section
7507 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
7508 in a list, it must be entered as two colons. Leading and trailing white space
7509 on each item in a list is ignored. This makes it possible to include items that
7510 start with a colon, and in particular, certain forms of IPv6 address. For
7513 <literallayout class="monospaced">
7514 local_interfaces = 127.0.0.1 : ::::1
7517 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
7520 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
7521 list items, it is not ignored when parsing the list. The space after the first
7522 colon in the example above is necessary. If it were not there, the list would
7523 be interpreted as the two items 127.0.0.1:: and 1.
7526 <indexterm role="concept">
7527 <primary>list separator</primary>
7528 <secondary>changing</secondary>
7530 <indexterm role="concept">
7531 <primary>IPv6</primary>
7532 <secondary>addresses in lists</secondary>
7534 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
7535 introduced to allow the separator character to be changed. If a list begins
7536 with a left angle bracket, followed by any punctuation character, that
7537 character is used instead of colon as the list separator. For example, the list
7538 above can be rewritten to use a semicolon separator like this:
7540 <literallayout class="monospaced">
7541 local_interfaces = <; 127.0.0.1 ; ::1
7544 This facility applies to all lists, with the exception of the list in
7545 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
7546 confined to circumstances where they really are needed.
7549 <section id="SECTempitelis">
7550 <title>Empty items in lists</title>
7552 <indexterm role="concept">
7553 <primary>list</primary>
7554 <secondary>empty item in</secondary>
7556 An empty item at the end of a list is always ignored. In other words, trailing
7557 separator characters are ignored. Thus, the list in
7559 <literallayout class="monospaced">
7560 senders = user@domain :
7563 contains only a single item. If you want to include an empty string as one item
7564 in a list, it must not be the last item. For example, this list contains three
7565 items, the second of which is empty:
7567 <literallayout class="monospaced">
7568 senders = user1@domain : : user2@domain
7571 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
7572 are interpreted as representing a single colon data character (and the list
7573 would then contain just one item). If you want to specify a list that contains
7574 just one, empty item, you can do it as in this example:
7576 <literallayout class="monospaced">
7580 In this case, the first item is empty, and the second is discarded because it
7581 is at the end of the list.
7584 <section id="SECTfordricon">
7585 <title>Format of driver configurations</title>
7587 <indexterm role="concept">
7588 <primary>drivers</primary>
7589 <secondary>configuration format</secondary>
7591 There are separate parts in the configuration for defining routers, transports,
7592 and authenticators. In each part, you are defining a number of driver
7593 instances, each with its own set of options. Each driver instance is defined by
7594 a sequence of lines like this:
7597 <<emphasis>instance name</emphasis>>:
7598 <<emphasis>option</emphasis>>
7600 <<emphasis>option</emphasis>>
7603 In the following example, the instance name is <command>localuser</command>, and it is
7604 followed by three options settings:
7606 <literallayout class="monospaced">
7610 transport = local_delivery
7613 For each driver instance, you specify which Exim code module it uses – by the
7614 setting of the <option>driver</option> option – and (optionally) some configuration
7615 settings. For example, in the case of transports, if you want a transport to
7616 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
7617 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
7618 described in detail in its own separate chapter later in this manual.
7621 You can have several routers, transports, or authenticators that are based on
7622 the same underlying driver (each must have a different instance name).
7625 The order in which routers are defined is important, because addresses are
7626 passed to individual routers one by one, in order. The order in which
7627 transports are defined does not matter at all. The order in which
7628 authenticators are defined is used only when Exim, as a client, is searching
7629 them to find one that matches an authentication mechanism offered by the
7633 <indexterm role="concept">
7634 <primary>generic options</primary>
7636 <indexterm role="concept">
7637 <primary>options</primary>
7638 <secondary>generic – definition of</secondary>
7640 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
7641 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
7642 same type (that is, all routers, all transports or all authenticators). The
7643 <option>driver</option> option is a generic option that must appear in every definition.
7644 <indexterm role="concept">
7645 <primary>private options</primary>
7647 The private options are special for each driver, and none need appear, because
7648 they all have default values.
7651 The options may appear in any order, except that the <option>driver</option> option must
7652 precede any private options, since these depend on the particular driver. For
7653 this reason, it is recommended that <option>driver</option> always be the first option.
7656 Driver instance names, which are used for reference in log entries and
7657 elsewhere, can be any sequence of letters, digits, and underscores (starting
7658 with a letter) and must be unique among drivers of the same type. A router and
7659 a transport (for example) can each have the same name, but no two router
7660 instances can have the same name. The name of a driver instance should not be
7661 confused with the name of the underlying driver module. For example, the
7662 configuration lines:
7664 <literallayout class="monospaced">
7669 create an instance of the <command>smtp</command> transport driver whose name is
7670 <command>remote_smtp</command>. The same driver code can be used more than once, with
7671 different instance names and different option settings each time. A second
7672 instance of the <command>smtp</command> transport, with different options, might be defined
7675 <literallayout class="monospaced">
7679 command_timeout = 10s
7682 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
7683 these transport instances from routers, and these names would appear in log
7687 Comment lines may be present in the middle of driver specifications. The full
7688 list of option settings for any particular driver instance, including all the
7689 defaulted values, can be extracted by making use of the <option>-bP</option> command line
7695 <chapter id="CHAPdefconfil">
7696 <title>The default configuration file</title>
7698 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
7699 <primary>configuration file</primary>
7700 <secondary>default <quote>walk through</quote></secondary>
7702 <indexterm role="concept">
7703 <primary>default</primary>
7704 <secondary>configuration file <quote>walk through</quote></secondary>
7706 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
7707 is sufficient for a host with simple mail requirements. As an introduction to
7708 the way Exim is configured, this chapter <quote>walks through</quote> the default
7709 configuration, giving brief explanations of the settings. Detailed descriptions
7710 of the options are given in subsequent chapters. The default configuration file
7711 itself contains extensive comments about ways you might want to modify the
7712 initial settings. However, note that there are many options that are not
7713 mentioned at all in the default configuration.
7716 <title>Main configuration settings</title>
7718 The main (global) configuration option settings must always come first in the
7719 file. The first thing you’ll see in the file, after some initial comments, is
7722 <literallayout class="monospaced">
7723 # primary_hostname =
7726 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
7727 to know the official, fully qualified name of your host, and this is where you
7728 can specify it. However, in most cases you do not need to set this option. When
7729 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
7732 The first three non-comment configuration lines are as follows:
7734 <literallayout class="monospaced">
7735 domainlist local_domains = @
7736 domainlist relay_to_domains =
7737 hostlist relay_from_hosts = 127.0.0.1
7740 These are not, in fact, option settings. They are definitions of two named
7741 domain lists and one named host list. Exim allows you to give names to lists of
7742 domains, hosts, and email addresses, in order to make it easier to manage the
7743 configuration file (see section <xref linkend="SECTnamedlists"/>).
7746 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
7747 later in the configuration to identify domains that are to be delivered
7751 <indexterm role="concept">
7752 <primary>@ in a domain list</primary>
7754 There is just one item in this list, the string <quote>@</quote>. This is a special form
7755 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
7756 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
7757 be delivered locally. Because the local host’s name is referenced indirectly,
7758 the same configuration file can be used on different hosts.
7761 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
7762 list itself is empty. Later in the configuration we will come to the part that
7763 controls mail relaying through the local host; it allows relaying to any
7764 domains in this list. By default, therefore, no relaying on the basis of a mail
7765 domain is permitted.
7768 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
7769 used later in the configuration to permit relaying from any host or IP address
7770 that matches the list. The default contains just the IP address of the IPv4
7771 loopback interface, which means that processes on the local host are able to
7772 submit mail for relaying by sending it over TCP/IP to that interface. No other
7773 hosts are permitted to submit messages for relaying.
7776 Just to be sure there’s no misunderstanding: at this point in the configuration
7777 we aren’t actually setting up any controls. We are just defining some domains
7778 and hosts that will be used in the controls that are specified later.
7781 The next two configuration lines are genuine option settings:
7783 <literallayout class="monospaced">
7784 acl_smtp_rcpt = acl_check_rcpt
7785 acl_smtp_data = acl_check_data
7788 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
7789 during an incoming SMTP session for every recipient of a message (every RCPT
7790 command), and after the contents of the message have been received,
7791 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
7792 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
7793 section of the configuration. The RCPT ACL controls which recipients are
7794 accepted for an incoming message – if a configuration does not provide an ACL
7795 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
7796 contents of a message to be checked.
7799 Two commented-out option settings are next:
7801 <literallayout class="monospaced">
7802 # av_scanner = clamd:/tmp/clamd
7803 # spamd_address = 127.0.0.1 783
7806 These are example settings that can be used when Exim is compiled with the
7807 content-scanning extension. The first specifies the interface to the virus
7808 scanner, and the second specifies the interface to SpamAssassin. Further
7809 details are given in chapter <xref linkend="CHAPexiscan"/>.
7812 Two more commented-out options settings follow:
7814 <literallayout class="monospaced">
7816 # qualify_recipient =
7819 The first of these specifies a domain that Exim uses when it constructs a
7820 complete email address from a local login name. This is often needed when Exim
7821 receives a message from a local process. If you do not set <option>qualify_domain</option>,
7822 the value of <option>primary_hostname</option> is used. If you set both of these options,
7823 you can have different qualification domains for sender and recipient
7824 addresses. If you set only the first one, its value is used in both cases.
7827 <indexterm role="concept">
7828 <primary>domain literal</primary>
7829 <secondary>recognizing format</secondary>
7831 The following line must be uncommented if you want Exim to recognize
7832 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
7833 (an IP address within square brackets) instead of a named domain.
7835 <literallayout class="monospaced">
7836 # allow_domain_literals
7839 The RFCs still require this form, but many people think that in the modern
7840 Internet it makes little sense to permit mail to be sent to specific hosts by
7841 quoting their IP addresses. This ancient format has been used by people who
7842 try to abuse hosts by using them for unwanted relaying. However, some
7843 people believe there are circumstances (for example, messages addressed to
7844 <emphasis>postmaster</emphasis>) where domain literals are still useful.
7847 The next configuration line is a kind of trigger guard:
7849 <literallayout class="monospaced">
7853 It specifies that no delivery must ever be run as the root user. The normal
7854 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
7855 setting is a guard against slips in the configuration.
7856 The list of users specified by <option>never_users</option> is not, however, the complete
7857 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
7858 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
7859 contents of <option>never_users</option> are added to this list. By default
7860 FIXED_NEVER_USERS also specifies root.
7863 When a remote host connects to Exim in order to send mail, the only information
7864 Exim has about the host’s identity is its IP address. The next configuration
7867 <literallayout class="monospaced">
7871 specifies that Exim should do a reverse DNS lookup on all incoming connections,
7872 in order to get a host name. This improves the quality of the logging
7873 information, but if you feel it is too expensive, you can remove it entirely,
7874 or restrict the lookup to hosts on <quote>nearby</quote> networks.
7875 Note that it is not always possible to find a host name from an IP address,
7876 because not all DNS reverse zones are maintained, and sometimes DNS servers are
7880 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
7881 1413 (hence their names):
7883 <literallayout class="monospaced">
7885 rfc1413_query_timeout = 30s
7888 These settings cause Exim to make ident callbacks for all incoming SMTP calls.
7889 You can limit the hosts to which these calls are made, or change the timeout
7890 that is used. If you set the timeout to zero, all ident calls are disabled.
7891 Although they are cheap and can provide useful information for tracing problem
7892 messages, some hosts and firewalls have problems with ident calls. This can
7893 result in a timeout instead of an immediate refused connection, leading to
7894 delays on starting up an incoming SMTP session.
7897 When Exim receives messages over SMTP connections, it expects all addresses to
7898 be fully qualified with a domain, as required by the SMTP definition. However,
7899 if you are running a server to which simple clients submit messages, you may
7900 find that they send unqualified addresses. The two commented-out options:
7902 <literallayout class="monospaced">
7903 # sender_unqualified_hosts =
7904 # recipient_unqualified_hosts =
7907 show how you can specify hosts that are permitted to send unqualified sender
7908 and recipient addresses, respectively.
7911 The <option>percent_hack_domains</option> option is also commented out:
7913 <literallayout class="monospaced">
7914 # percent_hack_domains =
7917 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
7918 This is an almost obsolete form of explicit email routing. If you do not know
7919 anything about it, you can safely ignore this topic.
7922 The last two settings in the main part of the default configuration are
7923 concerned with messages that have been <quote>frozen</quote> on Exim’s queue. When a
7924 message is frozen, Exim no longer continues to try to deliver it. Freezing
7925 occurs when a bounce message encounters a permanent failure because the sender
7926 address of the original message that caused the bounce is invalid, so the
7927 bounce cannot be delivered. This is probably the most common case, but there
7928 are also other conditions that cause freezing, and frozen messages are not
7929 always bounce messages.
7931 <literallayout class="monospaced">
7932 ignore_bounce_errors_after = 2d
7933 timeout_frozen_after = 7d
7936 The first of these options specifies that failing bounce messages are to be
7937 discarded after 2 days on the queue. The second specifies that any frozen
7938 message (whether a bounce message or not) is to be timed out (and discarded)
7939 after a week. In this configuration, the first setting ensures that no failing
7940 bounce message ever lasts a week.
7944 <title>ACL configuration</title>
7946 <indexterm role="concept">
7947 <primary>default</primary>
7948 <secondary>ACLs</secondary>
7950 <indexterm role="concept">
7951 <primary>access control lists (ACLs)</primary>
7952 <secondary>default configuration</secondary>
7954 In the default configuration, the ACL section follows the main configuration.
7955 It starts with the line
7957 <literallayout class="monospaced">
7961 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
7962 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
7963 and <option>acl_smtp_data</option> above.
7966 <indexterm role="concept">
7967 <primary>RCPT</primary>
7968 <secondary>ACL for</secondary>
7970 The first ACL is used for every RCPT command in an incoming SMTP message. Each
7971 RCPT command specifies one of the message’s recipients. The ACL statements
7972 are considered in order, until the recipient address is either accepted or
7973 rejected. The RCPT command is then accepted or rejected, according to the
7974 result of the ACL processing.
7976 <literallayout class="monospaced">
7980 This line, consisting of a name terminated by a colon, marks the start of the
7983 <literallayout class="monospaced">
7987 This ACL statement accepts the recipient if the sending host matches the list.
7988 But what does that strange list mean? It doesn’t actually contain any host
7989 names or IP addresses. The presence of the colon puts an empty item in the
7990 list; Exim matches this only if the incoming message did not come from a remote
7991 host, because in that case, the remote hostname is empty. The colon is
7992 important. Without it, the list itself is empty, and can never match anything.
7995 What this statement is doing is to accept unconditionally all recipients in
7996 messages that are submitted by SMTP from local processes using the standard
7997 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8000 <literallayout class="monospaced">
8001 deny message = Restricted characters in address
8002 domains = +local_domains
8003 local_parts = ^[.] : ^.*[@%!/|]
8005 deny message = Restricted characters in address
8006 domains = !+local_domains
8007 local_parts = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8010 These statements are concerned with local parts that contain any of the
8011 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8012 Although these characters are entirely legal in local parts (in the case of
8013 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8014 in Internet mail addresses.
8017 The first three have in the past been associated with explicitly routed
8018 addresses (percent is still sometimes used – see the <option>percent_hack_domains</option>
8019 option). Addresses containing these characters are regularly tried by spammers
8020 in an attempt to bypass relaying restrictions, and also by open relay testing
8021 programs. Unless you really need them it is safest to reject these characters
8022 at this early stage. This configuration is heavy-handed in rejecting these
8023 characters for all messages it accepts from remote hosts. This is a deliberate
8024 policy of being as safe as possible.
8027 The first rule above is stricter, and is applied to messages that are addressed
8028 to one of the local domains handled by this host. This is implemented by the
8029 first condition, which restricts it to domains that are listed in the
8030 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8031 reference to a named list. In this configuration, there is just one domain in
8032 <emphasis>local_domains</emphasis>, but in general there may be many.
8035 The second condition on the first statement uses two regular expressions to
8036 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8037 or <quote>|</quote>. If you have local accounts that include these characters, you will
8038 have to modify this rule.
8041 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8042 allows them because they have been encountered in practice. (Consider the
8043 common convention of local parts constructed as
8044 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8045 the author of Exim, who has no second initial.) However, a local part starting
8046 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8047 file name (for example, for a mailing list). This is also true for local parts
8048 that contain slashes. A pipe symbol can also be troublesome if the local part
8049 is incorporated unthinkingly into a shell command line.
8052 The second rule above applies to all other domains, and is less strict. This
8053 allows your own users to send outgoing messages to sites that use slashes
8054 and vertical bars in their local parts. It blocks local parts that begin
8055 with a dot, slash, or vertical bar, but allows these characters within the
8056 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8057 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8058 (or your users’ viruses) from mounting certain kinds of attack on remote sites.
8060 <literallayout class="monospaced">
8061 accept local_parts = postmaster
8062 domains = +local_domains
8065 This statement, which has two conditions, accepts an incoming address if the
8066 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
8067 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8068 reference to a named list. In this configuration, there is just one domain in
8069 <emphasis>local_domains</emphasis>, but in general there may be many.
8072 The presence of this statement means that mail to postmaster is never blocked
8073 by any of the subsequent tests. This can be helpful while sorting out problems
8074 in cases where the subsequent tests are incorrectly denying access.
8076 <literallayout class="monospaced">
8077 require verify = sender
8080 This statement requires the sender address to be verified before any subsequent
8081 ACL statement can be used. If verification fails, the incoming recipient
8082 address is refused. Verification consists of trying to route the address, to
8083 see if a bounce message could be delivered to it. In the case of remote
8084 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
8085 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
8086 discusses the details of address verification.
8088 <literallayout class="monospaced">
8089 accept hosts = +relay_from_hosts
8090 control = submission
8093 This statement accepts the address if the message is coming from one of the
8094 hosts that are defined as being allowed to relay through this host. Recipient
8095 verification is omitted here, because in many cases the clients are dumb MUAs
8096 that do not cope well with SMTP error responses. For the same reason, the
8097 second line specifies <quote>submission mode</quote> for messages that are accepted. This
8098 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
8099 messages that are deficient in some way, for example, because they lack a
8100 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
8101 probably add recipient verification here, and disable submission mode.
8103 <literallayout class="monospaced">
8104 accept authenticated = *
8105 control = submission
8108 This statement accepts the address if the client host has authenticated itself.
8109 Submission mode is again specified, on the grounds that such messages are most
8110 likely to come from MUAs. The default configuration does not define any
8111 authenticators, which means that no client can in fact authenticate. You will
8112 need to add authenticator definitions if you want to make use of this ACL
8115 <literallayout class="monospaced">
8116 # deny message = rejected because $sender_host_address \
8117 # is in a black list at $dnslist_domain\n\
8119 # dnslists = black.list.example
8121 # warn message = X-Warning: $sender_host_address is \
8122 # in a black list at $dnslist_domain
8123 # log_message = found in $dnslist_domain
8124 # dnslists = black.list.example
8127 These commented-out lines are examples of how you could configure Exim to check
8128 sending hosts against a DNS black list. The first statement rejects messages
8129 from blacklisted hosts, whereas the second merely inserts a warning header
8132 <literallayout class="monospaced">
8133 accept domains = +local_domains
8138 This statement accepts the incoming recipient address if its domain is one of
8139 the local domains, but only if the address can be verified. Verification of
8140 local addresses normally checks both the local part and the domain. The
8141 <option>endpass</option> line needs some explanation: if the condition above <option>endpass</option>
8142 fails, that is, if the address is not in a local domain, control is passed to
8143 the next ACL statement. However, if the condition below <option>endpass</option> fails, that
8144 is, if a recipient in a local domain cannot be verified, access is denied and
8145 the recipient is rejected.
8147 <literallayout class="monospaced">
8148 accept domains = +relay_to_domains
8153 This statement accepts the incoming recipient address if its domain is one of
8154 the domains for which this host is a relay, but again, only if the address can
8157 <literallayout class="monospaced">
8158 deny message = relay not permitted
8161 The final statement denies access, giving a specific error message. Reaching
8162 the end of the ACL also causes access to be denied, but with the generic
8163 message <quote>administrative prohibition</quote>.
8165 <literallayout class="monospaced">
8169 This line marks the start of the second ACL, and names it. Most of the contents
8170 of this ACL are commented out:
8172 <literallayout class="monospaced">
8174 # message = This message contains a virus \
8178 These lines are examples of how to arrange for messages to be scanned for
8179 viruses when Exim has been compiled with the content-scanning extension, and a
8180 suitable virus scanner is installed. If the message is found to contain a
8181 virus, it is rejected with the given custom error message.
8183 <literallayout class="monospaced">
8184 # warn spam = nobody
8185 # message = X-Spam_score: $spam_score\n\
8186 # X-Spam_score_int: $spam_score_int\n\
8187 # X-Spam_bar: $spam_bar\n\
8188 # X-Spam_report: $spam_report
8191 These lines are an example of how to arrange for messages to be scanned by
8192 SpamAssassin when Exim has been compiled with the content-scanning extension,
8193 and SpamAssassin has been installed. The SpamAssassin check is run with
8194 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
8195 series of extra header line. In this case, the message is not rejected,
8196 whatever the spam score.
8198 <literallayout class="monospaced">
8202 This final line in the DATA ACL accepts the message unconditionally.
8206 <title>Router configuration</title>
8208 <indexterm role="concept">
8209 <primary>default</primary>
8210 <secondary>routers</secondary>
8212 <indexterm role="concept">
8213 <primary>routers</primary>
8214 <secondary>default</secondary>
8216 The router configuration comes next in the default configuration, introduced
8219 <literallayout class="monospaced">
8223 Routers are the modules in Exim that make decisions about where to send
8224 messages. An address is passed to each router in turn, until it is either
8225 accepted, or failed. This means that the order in which you define the routers
8226 matters. Each router is fully described in its own chapter later in this
8227 manual. Here we give only brief overviews.
8229 <literallayout class="monospaced">
8231 # driver = ipliteral
8232 # domains = !+local_domains
8233 # transport = remote_smtp
8236 <indexterm role="concept">
8237 <primary>domain literal</primary>
8238 <secondary>default router</secondary>
8240 This router is commented out because the majority of sites do not want to
8241 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
8242 you uncomment this router, you also need to uncomment the setting of
8243 <option>allow_domain_literals</option> in the main part of the configuration.
8245 <literallayout class="monospaced">
8248 domains = ! +local_domains
8249 transport = remote_smtp
8250 ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
8254 The first uncommented router handles addresses that do not involve any local
8255 domains. This is specified by the line
8257 <literallayout class="monospaced">
8258 domains = ! +local_domains
8261 The <option>domains</option> option lists the domains to which this router applies, but the
8262 exclamation mark is a negation sign, so the router is used only for domains
8263 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
8264 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
8265 indicates that it is referring to a named list. Addresses in other domains are
8266 passed on to the following routers.
8269 The name of the router driver is <command>dnslookup</command>,
8270 and is specified by the <option>driver</option> option. Do not be confused by the fact that
8271 the name of this router instance is the same as the name of the driver. The
8272 instance name is arbitrary, but the name set in the <option>driver</option> option must be
8273 one of the driver modules that is in the Exim binary.
8276 The <command>dnslookup</command> router routes addresses by looking up their domains in the
8277 DNS in order to obtain a list of hosts to which the address is routed. If the
8278 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
8279 specified by the <option>transport</option> option. If the router does not find the domain
8280 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
8281 the address fails and is bounced.
8284 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
8285 be entirely ignored. This option is present because a number of cases have been
8286 encountered where MX records in the DNS point to host names
8287 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
8288 Completely ignoring these IP addresses causes Exim to fail to route the
8289 email address, so it bounces. Otherwise, Exim would log a routing problem, and
8290 continue to try to deliver the message periodically until the address timed
8293 <literallayout class="monospaced">
8298 data = ${lookup{$local_part}lsearch{/etc/aliases}}
8300 file_transport = address_file
8301 pipe_transport = address_pipe
8304 Control reaches this and subsequent routers only for addresses in the local
8305 domains. This router checks to see whether the local part is defined as an
8306 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
8307 data that it looks up from that file. If no data is found for the local part,
8308 the value of the <option>data</option> option is empty, causing the address to be passed to
8312 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
8313 often used. That is why it is referenced by from the default configuration
8314 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
8315 <filename>Local/Makefile</filename> before building Exim.
8317 <literallayout class="monospaced">
8321 # local_part_suffix = +* : -*
8322 # local_part_suffix_optional
8323 file = $home/.forward
8328 file_transport = address_file
8329 pipe_transport = address_pipe
8330 reply_transport = address_reply
8333 This is the most complicated router in the default configuration. It is another
8334 redirection router, but this time it is looking for forwarding data set up by
8335 individual users. The <option>check_local_user</option> setting specifies a check that the
8336 local part of the address is the login name of a local user. If it is not, the
8337 router is skipped. The two commented options that follow <option>check_local_user</option>,
8340 <literallayout class="monospaced">
8341 # local_part_suffix = +* : -*
8342 # local_part_suffix_optional
8345 <indexterm role="concept">
8346 <primary><varname>$local_part_suffix</varname></primary>
8348 show how you can specify the recognition of local part suffixes. If the first
8349 is uncommented, a suffix beginning with either a plus or a minus sign, followed
8350 by any sequence of characters, is removed from the local part and placed in the
8351 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
8352 presence of a suffix in the local part is optional. When a suffix is present,
8353 the check for a local login uses the local part with the suffix removed.
8356 When a local user account is found, the file called <filename>.forward</filename> in the user’s
8357 home directory is consulted. If it does not exist, or is empty, the router
8358 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
8359 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
8362 <indexterm role="concept">
8363 <primary>Sieve filter</primary>
8364 <secondary>enabling in default router</secondary>
8366 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
8367 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
8368 is commented out by default), the contents of the file are interpreted as a set
8369 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
8370 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
8371 separate document entitled <emphasis>Exim’s interfaces to mail filtering</emphasis>.
8374 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
8375 verifying addresses, or when running as a consequence of an SMTP EXPN command.
8376 There are two reasons for doing this:
8378 <orderedlist numeration="arabic">
8381 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
8382 checking an address for validity; it makes sense not to waste resources doing
8388 More importantly, when Exim is verifying addresses or handling an EXPN
8389 command during an SMTP session, it is running as the Exim user, not as root.
8390 The group is the Exim group, and no additional groups are set up.
8391 It may therefore not be possible for Exim to read users’ <filename>.forward</filename> files at
8397 The setting of <option>check_ancestor</option> prevents the router from generating a new
8398 address that is the same as any previous address that was redirected. (This
8399 works round a problem concerning a bad interaction between aliasing and
8400 forwarding – see section <xref linkend="SECTredlocmai"/>).
8403 The final three option settings specify the transports that are to be used when
8404 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
8405 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
8407 <literallayout class="monospaced">
8408 a.nother@elsewhere.example, /home/spqr/archive
8411 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
8414 <literallayout class="monospaced">
8418 # local_part_suffix = +* : -*
8419 # local_part_suffix_optional
8420 transport = local_delivery
8423 The final router sets up delivery into local mailboxes, provided that the local
8424 part is the name of a local login, by accepting the address and assigning it to
8425 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
8426 routers, so the address is bounced. The commented suffix settings fulfil the
8427 same purpose as they do for the <command>userforward</command> router.
8431 <title>Transport configuration</title>
8433 <indexterm role="concept">
8434 <primary>default</primary>
8435 <secondary>transports</secondary>
8437 <indexterm role="concept">
8438 <primary>transports</primary>
8439 <secondary>default</secondary>
8441 Transports define mechanisms for actually delivering messages. They operate
8442 only when referenced from routers, so the order in which they are defined does
8443 not matter. The transports section of the configuration starts with
8445 <literallayout class="monospaced">
8449 One remote transport and four local transports are defined.
8451 <literallayout class="monospaced">
8456 This transport is used for delivering messages over SMTP connections. All its
8457 options are defaulted. The list of remote hosts comes from the router.
8459 <literallayout class="monospaced">
8462 file = /var/mail/$local_part
8470 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
8471 traditional BSD mailbox format. By default it runs under the uid and gid of the
8472 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
8473 directory. Some systems use the alternative approach of running mail deliveries
8474 under a particular group instead of using the sticky bit. The commented options
8475 show how this can be done.
8478 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
8479 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
8480 similarly-named options above.
8482 <literallayout class="monospaced">
8488 This transport is used for handling deliveries to pipes that are generated by
8489 redirection (aliasing or users’ <filename>.forward</filename> files). The <option>return_output</option>
8490 option specifies that any output generated by the pipe is to be returned to the
8493 <literallayout class="monospaced">
8501 This transport is used for handling deliveries to files that are generated by
8502 redirection. The name of the file is not specified in this instance of
8503 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
8505 <literallayout class="monospaced">
8510 This transport is used for handling automatic replies generated by users’
8515 <title>Default retry rule</title>
8517 <indexterm role="concept">
8518 <primary>retry</primary>
8519 <secondary>default rule</secondary>
8521 <indexterm role="concept">
8522 <primary>default</primary>
8523 <secondary>retry rule</secondary>
8525 The retry section of the configuration file contains rules which affect the way
8526 Exim retries deliveries that cannot be completed at the first attempt. It is
8527 introduced by the line
8529 <literallayout class="monospaced">
8533 In the default configuration, there is just one rule, which applies to all
8536 <literallayout class="monospaced">
8537 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
8540 This causes any temporarily failing address to be retried every 15 minutes for
8541 2 hours, then at intervals starting at one hour and increasing by a factor of
8542 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
8543 is not delivered after 4 days of temporary failure, it is bounced.
8547 <title>Rewriting configuration</title>
8549 The rewriting section of the configuration, introduced by
8551 <literallayout class="monospaced">
8555 contains rules for rewriting addresses in messages as they arrive. There are no
8556 rewriting rules in the default configuration file.
8560 <title>Authenticators configuration</title>
8562 <indexterm role="concept">
8563 <primary>AUTH</primary>
8564 <secondary>configuration</secondary>
8566 The authenticators section of the configuration, introduced by
8568 <literallayout class="monospaced">
8569 begin authenticators
8572 defines mechanisms for the use of the SMTP AUTH command. No authenticators
8573 are specified in the default configuration file.
8574 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
8579 <chapter id="CHAPregexp">
8580 <title>Regular expressions</title>
8582 <indexterm role="concept">
8583 <primary>regular expressions</primary>
8584 <secondary>library</secondary>
8586 <indexterm role="concept">
8587 <primary>PCRE</primary>
8589 Exim supports the use of regular expressions in many of its options. It
8590 uses the PCRE regular expression library; this provides regular expression
8591 matching that is compatible with Perl 5. The syntax and semantics of
8592 regular expressions is discussed in many Perl reference books, and also in
8593 Jeffrey Friedl’s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
8594 O’Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
8597 The documentation for the syntax and semantics of the regular expressions that
8598 are supported by PCRE is included in plain text in the file
8599 <filename>doc/pcrepattern.txt</filename> in the Exim distribution, and also in the HTML
8600 tarbundle of Exim documentation. It describes in detail the features of the
8601 regular expressions that PCRE supports, so no further description is included
8602 here. The PCRE functions are called from Exim using the default option settings
8603 (that is, with no PCRE options set), except that the PCRE_CASELESS option is
8604 set when the matching is required to be case-insensitive.
8607 In most cases, when a regular expression is required in an Exim configuration,
8608 it has to start with a circumflex, in order to distinguish it from plain text
8609 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
8610 second item in the colon-separated list is a regular expression.
8612 <literallayout class="monospaced">
8613 domains = a.b.c : ^\\d{3} : *.y.z : ...
8616 The doubling of the backslash is required because of string expansion that
8617 precedes interpretation – see section <xref linkend="SECTlittext"/> for more discussion
8618 of this issue, and a way of avoiding the need for doubling backslashes. The
8619 regular expression that is eventually used in this example contains just one
8620 backslash. The circumflex is included in the regular expression, and has the
8621 normal effect of <quote>anchoring</quote> it to the start of the string that is being
8625 There are, however, two cases where a circumflex is not required for the
8626 recognition of a regular expression: these are the <option>match</option> condition in a
8627 string expansion, and the <option>matches</option> condition in an Exim filter file. In
8628 these cases, the relevant string is always treated as a regular expression; if
8629 it does not start with a circumflex, the expression is not anchored, and can
8630 match anywhere in the subject string.
8633 In all cases, if you want a regular expression to match at the end of a string,
8634 you must code the $ metacharacter to indicate this. For example:
8636 <literallayout class="monospaced">
8637 domains = ^\\d{3}\\.example
8640 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
8643 <literallayout class="monospaced">
8644 domains = ^\\d{3}\\.example\$
8647 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
8648 $ is needed because string expansion also interprets dollar characters.
8651 <title>Testing regular expressions</title>
8653 <indexterm role="concept">
8654 <primary>testing</primary>
8655 <secondary>regular expressions</secondary>
8657 <indexterm role="concept">
8658 <primary>regular expressions</primary>
8659 <secondary>testing</secondary>
8661 <indexterm role="concept">
8662 <primary><emphasis>pcretest</emphasis></primary>
8664 A program called <emphasis>pcretest</emphasis> forms part of the PCRE distribution and is built
8665 with PCRE during the process of building Exim. It is primarily intended for
8666 testing PCRE itself, but it can also be used for experimenting with regular
8667 expressions. After building Exim, the binary can be found in the build
8668 directory (it is not installed anywhere automatically). There is documentation
8669 of various options in <filename>doc/pcretest.txt</filename>, but for simple testing, none are
8670 needed. This is the output of a sample run of <emphasis>pcretest</emphasis>:
8673 <literal> re> </literal><emphasis role="bold"><literal>/^([@]+)@.+\.(ac|edu)\.(?!kr)[a-z]{2}$/</literal></emphasis>
8674 <literal>data> </literal><emphasis role="bold"><literal>x@y.ac.uk</literal></emphasis>
8675 <literal> 0: x@y.ac.uk</literal>
8676 <literal> 1: x</literal>
8677 <literal> 2: ac</literal>
8678 <literal>data> </literal><emphasis role="bold"><literal>x@y.ac.kr</literal></emphasis>
8679 <literal>No match</literal>
8680 <literal>data> </literal><emphasis role="bold"><literal>x@y.edu.com</literal></emphasis>
8681 <literal>No match</literal>
8682 <literal>data> </literal><emphasis role="bold"><literal>x@y.edu.co</literal></emphasis>
8683 <literal> 0: x@y.edu.co</literal>
8684 <literal> 1: x</literal>
8685 <literal> 2: edu</literal>
8688 Input typed by the user is shown in bold face. After the <quote>re></quote> prompt, a
8689 regular expression enclosed in delimiters is expected. If this compiles without
8690 error, <quote>data></quote> prompts are given for strings against which the expression is
8691 matched. An empty data line causes a new regular expression to be read. If the
8692 match is successful, the captured substring values (that is, what would be in
8693 the variables <varname>$0</varname>, <varname>$1</varname>, <varname>$2</varname>, etc.) are shown. The above example tests for
8694 an email address whose domain ends with either <quote>ac</quote> or <quote>edu</quote> followed by a
8695 two-character top-level domain that is not <quote>kr</quote>. The local part is captured
8696 in <varname>$1</varname> and the <quote>ac</quote> or <quote>edu</quote> in <varname>$2</varname>.
8701 <chapter id="CHAPfdlookup">
8702 <title>File and database lookups</title>
8704 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
8705 <primary>file</primary>
8706 <secondary>lookups</secondary>
8708 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
8709 <primary>database lookups</primary>
8711 <indexterm role="concept">
8712 <primary>lookup</primary>
8713 <secondary>description of</secondary>
8715 Exim can be configured to look up data in files or databases as it processes
8716 messages. Two different kinds of syntax are used:
8718 <orderedlist numeration="arabic">
8721 A string that is to be expanded may contain explicit lookup requests. These
8722 cause parts of the string to be replaced by data that is obtained from the
8723 lookup. Lookups of this type are conditional expansion items. Different results
8724 can be defined for the cases of lookup success and failure. See chapter
8725 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
8730 Lists of domains, hosts, and email addresses can contain lookup requests as a
8731 way of avoiding excessively long linear lists. In this case, the data that is
8732 returned by the lookup is often (but not always) discarded; whether the lookup
8733 succeeds or fails is what really counts. These kinds of list are described in
8734 chapter <xref linkend="CHAPdomhosaddlists"/>.
8739 String expansions, lists, and lookups interact with each other in such a way
8740 that there is no order in which to describe any one of them that does not
8741 involve references to the others. Each of these three chapters makes more sense
8742 if you have read the other two first. If you are reading this for the first
8743 time, be aware that some of it will make a lot more sense after you have read
8744 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
8747 <title>Examples of different lookup syntax</title>
8749 It is easy to confuse the two different kinds of lookup, especially as the
8750 lists that may contain the second kind are always expanded before being
8751 processed as lists. Therefore, they may also contain lookups of the first kind.
8752 Be careful to distinguish between the following two examples:
8754 <literallayout class="monospaced">
8755 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
8756 domains = lsearch;/some/file
8759 The first uses a string expansion, the result of which must be a domain list.
8760 No strings have been specified for a successful or a failing lookup; the
8761 defaults in this case are the looked-up data and an empty string, respectively.
8762 The expansion takes place before the string is processed as a list, and the
8763 file that is searched could contain lines like this:
8765 <literallayout class="monospaced">
8766 192.168.3.4: domain1:domain2:...
8767 192.168.1.9: domain3:domain4:...
8770 When the lookup succeeds, the result of the expansion is a list of domains (and
8771 possibly other types of item that are allowed in domain lists).
8774 In the second example, the lookup is a single item in a domain list. It causes
8775 Exim to use a lookup to see if the domain that is being processed can be found
8776 in the file. The file could contains lines like this:
8778 <literallayout class="monospaced">
8783 Any data that follows the keys is not relevant when checking that the domain
8784 matches the list item.
8787 It is possible, though no doubt confusing, to use both kinds of lookup at once.
8788 Consider a file containing lines like this:
8790 <literallayout class="monospaced">
8791 192.168.5.6: lsearch;/another/file
8794 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
8795 first <option>domains</option> setting above generates the second setting, which therefore
8796 causes a second lookup to occur.
8799 The rest of this chapter describes the different lookup types that are
8800 available. Any of them can be used in any part of the configuration where a
8801 lookup is permitted.
8805 <title>Lookup types</title>
8807 <indexterm role="concept">
8808 <primary>lookup</primary>
8809 <secondary>types of</secondary>
8811 <indexterm role="concept">
8812 <primary>single-key lookup</primary>
8813 <secondary>definition of</secondary>
8815 Two different types of data lookup are implemented:
8820 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
8821 and a single key to search for. The key must be a non-empty string for the
8822 lookup to succeed. The lookup type determines how the file is searched.
8827 <indexterm role="concept">
8828 <primary>query-style lookup</primary>
8829 <secondary>definition of</secondary>
8831 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
8832 key value is assumed by Exim for query-style lookups. You can use whichever
8833 Exim variables you need to construct the database query.
8838 The code for each lookup type is in a separate source file that is included in
8839 the binary of Exim only if the corresponding compile-time option is set. The
8840 default settings in <filename>src/EDITME</filename> are:
8842 <literallayout class="monospaced">
8847 which means that only linear searching and DBM lookups are included by default.
8848 For some types of lookup (e.g. SQL databases), you need to install appropriate
8849 libraries and header files before building Exim.
8852 <section id="SECTsinglekeylookups">
8853 <title>Single-key lookup types</title>
8855 <indexterm role="concept">
8856 <primary>lookup</primary>
8857 <secondary>single-key types</secondary>
8859 <indexterm role="concept">
8860 <primary>single-key lookup</primary>
8861 <secondary>list of types</secondary>
8863 The following single-key lookup types are implemented:
8868 <indexterm role="concept">
8869 <primary>cdb</primary>
8870 <secondary>description of</secondary>
8872 <indexterm role="concept">
8873 <primary>lookup</primary>
8874 <secondary>cdb</secondary>
8876 <indexterm role="concept">
8877 <primary>binary zero</primary>
8878 <secondary>in lookup key</secondary>
8880 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
8881 string without a terminating binary zero. The cdb format is designed for
8882 indexed files that are read frequently and never updated, except by total
8883 re-creation. As such, it is particulary suitable for large files containing
8884 aliases or other indexed data referenced by an MTA. Information about cdb can
8885 be found in several places:
8888 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>
8889 <emphasis role="bold"><ulink url="ftp://ftp.corpit.ru/pub/tinycdb/">ftp://ftp.corpit.ru/pub/tinycdb/</ulink></emphasis>
8890 <emphasis role="bold"><ulink url="http://packages.debian.org/stable/utils/freecdb.html">http://packages.debian.org/stable/utils/freecdb.html</ulink></emphasis>
8893 A cdb distribution is not needed in order to build Exim with cdb support,
8894 because the code for reading cdb files is included directly in Exim itself.
8895 However, no means of building or testing cdb files is provided with Exim, so
8896 you need to obtain a cdb distribution in order to do this.
8901 <indexterm role="concept">
8902 <primary>DBM</primary>
8903 <secondary>lookup type</secondary>
8905 <indexterm role="concept">
8906 <primary>lookup</primary>
8907 <secondary>dbm</secondary>
8909 <indexterm role="concept">
8910 <primary>binary zero</primary>
8911 <secondary>in lookup key</secondary>
8913 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
8914 DBM file by looking up the record with the given key. A terminating binary
8915 zero is included in the key that is passed to the DBM library. See section
8916 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
8919 <indexterm role="concept">
8920 <primary>Berkeley DB library</primary>
8921 <secondary>file format</secondary>
8923 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
8924 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
8925 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
8926 the DB_UNKNOWN option. This enables it to handle any of the types of database
8927 that the library supports, and can be useful for accessing DBM files created by
8928 other applications. (For earlier DB versions, DB_HASH is always used.)
8933 <indexterm role="concept">
8934 <primary>lookup</primary>
8935 <secondary>dbmnz</secondary>
8937 <indexterm role="concept">
8938 <primary>lookup</primary>
8939 <secondary>dbm – terminating zero</secondary>
8941 <indexterm role="concept">
8942 <primary>binary zero</primary>
8943 <secondary>in lookup key</secondary>
8945 <indexterm role="concept">
8946 <primary>Courier</primary>
8948 <indexterm role="concept">
8949 <primary><filename>/etc/userdbshadow.dat</filename></primary>
8951 <indexterm role="concept">
8952 <primary>dmbnz lookup type</primary>
8954 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
8955 is not included in the key that is passed to the DBM library. You may need this
8956 if you want to look up data in files that are created by or shared with some
8957 other application that does not use terminating zeros. For example, you need to
8958 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
8959 calls using the passwords from Courier’s <filename>/etc/userdbshadow.dat</filename> file. Exim’s
8960 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
8961 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
8966 <indexterm role="concept">
8967 <primary>lookup</primary>
8968 <secondary>dsearch</secondary>
8970 <indexterm role="concept">
8971 <primary>dsearch lookup type</primary>
8973 <command>dsearch</command>: The given file must be a directory; this is searched for a file
8974 whose name is the key. The key may not contain any forward slash characters.
8975 The result of a successful lookup is the name of the file. An example of how
8976 this lookup can be used to support virtual domains is given in section
8977 <xref linkend="SECTvirtualdomains"/>.
8982 <indexterm role="concept">
8983 <primary>lookup</primary>
8984 <secondary>iplsearch</secondary>
8986 <indexterm role="concept">
8987 <primary>iplsearch lookup type</primary>
8989 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
8990 terminated by a colon or white space or the end of the line. The keys in the
8991 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
8992 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
8993 being interpreted as a key terminator. For example:
8995 <literallayout class="monospaced">
8996 1.2.3.4: data for 1.2.3.4
8997 192.168.0.0/16 data for 192.168.0.0/16
8998 "abcd::cdab": data for abcd::cdab
8999 "abcd:abcd::/32" data for abcd:abcd::/32
9002 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
9003 file is searched linearly, using the CIDR masks where present, until a matching
9004 key is found. The first key that matches is used; there is no attempt to find a
9005 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
9006 <command>iplsearch</command> is the same as for <command>lsearch</command>.
9009 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
9010 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9011 lookup types support only literal keys.
9014 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
9015 the implicit key is the host’s IP address rather than its name (see section
9016 <xref linkend="SECThoslispatsikey"/>).
9021 <indexterm role="concept">
9022 <primary>linear search</primary>
9024 <indexterm role="concept">
9025 <primary>lookup</primary>
9026 <secondary>lsearch</secondary>
9028 <indexterm role="concept">
9029 <primary>lsearch lookup type</primary>
9031 <command>lsearch</command>: The given file is a text file that is searched linearly for a
9032 line beginning with the search key, terminated by a colon or white space or the
9033 end of the line. The first occurrence that is found in the file is used. White
9034 space between the key and the colon is permitted. The remainder of the line,
9035 with leading and trailing white space removed, is the data. This can be
9036 continued onto subsequent lines by starting them with any amount of white
9037 space, but only a single space character is included in the data at such a
9038 junction. If the data begins with a colon, the key must be terminated by a
9041 <literallayout class="monospaced">
9045 Empty lines and lines beginning with # are ignored, even if they occur in the
9046 middle of an item. This is the traditional textual format of alias files. Note
9047 that the keys in an <command>lsearch</command> file are literal strings. There is no
9048 wildcarding of any kind.
9051 <indexterm role="concept">
9052 <primary>lookup</primary>
9053 <secondary>lsearch – colons in keys</secondary>
9055 <indexterm role="concept">
9056 <primary>white space</primary>
9057 <secondary>in lsearch key</secondary>
9059 In most <command>lsearch</command> files, keys are not required to contain colons or #
9060 characters, or white space. However, if you need this feature, it is available.
9061 If a key begins with a doublequote character, it is terminated only by a
9062 matching quote (or end of line), and the normal escaping rules apply to its
9063 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
9064 quoted keys (exactly as for unquoted keys). There is no special handling of
9065 quotes for the data part of an <command>lsearch</command> line.
9070 <indexterm role="concept">
9071 <primary>NIS lookup type</primary>
9073 <indexterm role="concept">
9074 <primary>lookup</primary>
9075 <secondary>NIS</secondary>
9077 <indexterm role="concept">
9078 <primary>binary zero</primary>
9079 <secondary>in lookup key</secondary>
9081 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
9082 the given key, without a terminating binary zero. There is a variant called
9083 <command>nis0</command> which does include the terminating binary zero in the key. This is
9084 reportedly needed for Sun-style alias files. Exim does not recognize NIS
9085 aliases; the full map names must be used.
9090 <indexterm role="concept">
9091 <primary>wildlsearch lookup type</primary>
9093 <indexterm role="concept">
9094 <primary>lookup</primary>
9095 <secondary>wildlsearch</secondary>
9097 <indexterm role="concept">
9098 <primary>nwildlsearch lookup type</primary>
9100 <indexterm role="concept">
9101 <primary>lookup</primary>
9102 <secondary>nwildlsearch</secondary>
9104 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
9105 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
9106 the file may be wildcarded. The difference between these two lookup types is
9107 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
9108 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
9111 Like <command>lsearch</command>, the testing is done case-insensitively. The following forms
9112 of wildcard are recognized:
9114 <orderedlist numeration="arabic">
9117 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
9119 <literallayout class="monospaced">
9120 *.a.b.c data for anything.a.b.c
9121 *fish data for anythingfish
9126 The string may begin with a circumflex to indicate a regular expression. For
9127 example, for <command>wildlsearch</command>:
9129 <literallayout class="monospaced">
9130 ^\N\d+\.a\.b\N data for <digits>.a.b
9133 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
9134 expression. If you are using <command>nwildlsearch</command>, where the keys are not
9135 string-expanded, the equivalent entry is:
9137 <literallayout class="monospaced">
9138 ^\d+\.a\.b data for <digits>.a.b
9141 If the regular expression contains white space or colon characters, you must
9142 either quote it (see <command>lsearch</command> above), or represent these characters in other
9143 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
9144 colon. This may be easier than quoting, because if you quote, you have to
9145 escape all the backslashes inside the quotes.
9148 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
9149 match for later use, because the results of all lookups are cached. If a lookup
9150 is repeated, the result is taken from the cache, and no actual pattern matching
9151 takes place. The values of all the numeric variables are unset after a
9152 <command>(n)wildlsearch</command> match.
9157 Although I cannot see it being of much use, the general matching function that
9158 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
9159 lookup name terminated by a semicolon, and followed by lookup data. For
9162 <literallayout class="monospaced">
9163 cdb;/some/file data for keys that match the file
9166 The data that is obtained from the nested lookup is discarded.
9171 Keys that do not match any of these patterns are interpreted literally. The
9172 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
9173 be followed by optional colons.
9176 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
9177 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9178 lookup types support only literal keys.
9184 <title>Query-style lookup types</title>
9186 <indexterm role="concept">
9187 <primary>lookup</primary>
9188 <secondary>query-style types</secondary>
9190 <indexterm role="concept">
9191 <primary>query-style lookup</primary>
9192 <secondary>list of types</secondary>
9194 The supported query-style lookup types are listed below. Further details about
9195 many of them are given in later sections.
9200 <indexterm role="concept">
9201 <primary>DNS</primary>
9202 <secondary>as a lookup type</secondary>
9204 <indexterm role="concept">
9205 <primary>lookup</primary>
9206 <secondary>DNS</secondary>
9208 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
9209 are given in the supplied query. The resulting data is the contents of the
9210 records. See section <xref linkend="SECTdnsdb"/>.
9215 <indexterm role="concept">
9216 <primary>Interbase lookup type</primary>
9218 <indexterm role="concept">
9219 <primary>lookup</primary>
9220 <secondary>Interbase</secondary>
9222 <command>ibase</command>: This does a lookup in an Interbase database.
9227 <indexterm role="concept">
9228 <primary>LDAP</primary>
9229 <secondary>lookup type</secondary>
9231 <indexterm role="concept">
9232 <primary>lookup</primary>
9233 <secondary>LDAP</secondary>
9235 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
9236 returns attributes from a single entry. There is a variant called <command>ldapm</command>
9237 that permits values from multiple entries to be returned. A third variant
9238 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
9239 any attribute values. See section <xref linkend="SECTldap"/>.
9244 <indexterm role="concept">
9245 <primary>MySQL</primary>
9246 <secondary>lookup type</secondary>
9248 <indexterm role="concept">
9249 <primary>lookup</primary>
9250 <secondary>MySQL</secondary>
9252 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
9253 MySQL database. See section <xref linkend="SECTsql"/>.
9258 <indexterm role="concept">
9259 <primary>NIS+ lookup type</primary>
9261 <indexterm role="concept">
9262 <primary>lookup</primary>
9263 <secondary>NIS+</secondary>
9265 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
9266 the field to be returned. See section <xref linkend="SECTnisplus"/>.
9271 <indexterm role="concept">
9272 <primary>Oracle</primary>
9273 <secondary>lookup type</secondary>
9275 <indexterm role="concept">
9276 <primary>lookup</primary>
9277 <secondary>Oracle</secondary>
9279 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
9280 Oracle database. See section <xref linkend="SECTsql"/>.
9285 <indexterm role="concept">
9286 <primary>lookup</primary>
9287 <secondary>passwd</secondary>
9289 <indexterm role="concept">
9290 <primary>passwd lookup type</primary>
9292 <indexterm role="concept">
9293 <primary><filename>/etc/passwd</filename></primary>
9295 <command>passwd</command> is a query-style lookup with queries that are just user names. The
9296 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
9297 success, the result string is the same as you would get from an <command>lsearch</command>
9298 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
9299 password value. For example:
9301 <literallayout class="monospaced">
9302 *:42:42:King Rat:/home/kr:/bin/bash
9307 <indexterm role="concept">
9308 <primary>PostgreSQL lookup type</primary>
9310 <indexterm role="concept">
9311 <primary>lookup</primary>
9312 <secondary>PostgreSQL</secondary>
9314 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
9315 PostgreSQL database. See section <xref linkend="SECTsql"/>.
9320 <indexterm role="concept">
9321 <primary>sqlite lookup type</primary>
9323 <indexterm role="concept">
9324 <primary>lookup</primary>
9325 <secondary>sqlite</secondary>
9327 <command>sqlite</command>: The format of the query is a file name followed by an SQL statement
9328 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
9333 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
9334 not likely to be useful in normal operation.
9339 <indexterm role="concept">
9340 <primary>whoson lookup type</primary>
9342 <indexterm role="concept">
9343 <primary>lookup</primary>
9344 <secondary>whoson</secondary>
9346 <command>whoson</command>: <emphasis>Whoson</emphasis> (<emphasis role="bold"><ulink url="http://whoson.sourceforge.net">http://whoson.sourceforge.net</ulink></emphasis>) is a proposed
9347 Internet protocol that allows Internet server programs to check whether a
9348 particular (dynamically allocated) IP address is currently allocated to a known
9349 (trusted) user and, optionally, to obtain the identity of the said user. In
9350 Exim, this can be used to implement <quote>POP before SMTP</quote> checking using ACL
9353 <literallayout class="monospaced">
9354 require condition = \
9355 ${lookup whoson {$sender_host_address}{yes}{no}}
9358 The query consists of a single IP address. The value returned is the name of
9359 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
9360 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
9361 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
9367 <title>Temporary errors in lookups</title>
9369 <indexterm role="concept">
9370 <primary>lookup</primary>
9371 <secondary>temporary error in</secondary>
9373 Lookup functions can return temporary error codes if the lookup cannot be
9374 completed. For example, an SQL or LDAP database might be unavailable. For this
9375 reason, it is not advisable to use a lookup that might do this for critical
9376 options such as a list of local domains.
9379 When a lookup cannot be completed in a router or transport, delivery
9380 of the message (to the relevant address) is deferred, as for any other
9381 temporary error. In other circumstances Exim may assume the lookup has failed,
9382 or may give up altogether.
9385 <section id="SECTdefaultvaluelookups">
9386 <title>Default values in single-key lookups</title>
9388 <indexterm role="concept">
9389 <primary>wildcard lookups</primary>
9391 <indexterm role="concept">
9392 <primary>lookup</primary>
9393 <secondary>default values</secondary>
9395 <indexterm role="concept">
9396 <primary>lookup</primary>
9397 <secondary>wildcard</secondary>
9399 <indexterm role="concept">
9400 <primary>lookup</primary>
9401 <secondary>* added to type</secondary>
9403 <indexterm role="concept">
9404 <primary>default</primary>
9405 <secondary>in single-key lookups</secondary>
9407 In this context, a <quote>default value</quote> is a value specified by the administrator
9408 that is to be used if a lookup fails.
9411 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
9412 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
9413 provide a default value. See also the section on partial matching below.
9416 <indexterm role="concept">
9417 <primary>*@ with single-key lookup</primary>
9419 <indexterm role="concept">
9420 <primary>lookup</primary>
9421 <secondary>*@ added to type</secondary>
9423 <indexterm role="concept">
9424 <primary>alias file</primary>
9425 <secondary>per-domain default</secondary>
9427 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
9428 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
9429 character, a second lookup is done with everything before the last @ replaced
9430 by *. This makes it possible to provide per-domain defaults in alias files
9431 that include the domains in the keys. If the second lookup fails (or doesn’t
9432 take place because there is no @ in the key), <quote>*</quote> is looked up.
9433 For example, a <command>redirect</command> router might contain:
9435 <literallayout class="monospaced">
9436 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
9439 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
9440 looks up these keys, in this order:
9442 <literallayout class="monospaced">
9448 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
9449 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
9450 complete scan is done for each key, and only if it is not found at all does
9451 Exim move on to try the next key.
9454 <section id="SECTpartiallookup">
9455 <title>Partial matching in single-key lookups</title>
9457 <indexterm role="concept">
9458 <primary>partial matching</primary>
9460 <indexterm role="concept">
9461 <primary>wildcard lookups</primary>
9463 <indexterm role="concept">
9464 <primary>lookup</primary>
9465 <secondary>partial matching</secondary>
9467 <indexterm role="concept">
9468 <primary>lookup</primary>
9469 <secondary>wildcard</secondary>
9471 <indexterm role="concept">
9472 <primary>asterisk</primary>
9473 <secondary>in search type</secondary>
9475 The normal operation of a single-key lookup is to search the file for an exact
9476 match with the given key. However, in a number of situations where domains are
9477 being looked up, it is useful to be able to do partial matching. In this case,
9478 information in the file that has a key starting with <quote>*.</quote> is matched by any
9479 domain that ends with the components that follow the full stop. For example, if
9480 a key in a DBM file is
9482 <literallayout class="monospaced">
9483 *.dates.fict.example
9486 then when partial matching is enabled this is matched by (amongst others)
9487 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
9488 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
9492 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
9493 also not available for any lookup items in address lists (see section
9494 <xref linkend="SECTaddresslist"/>).
9497 Partial matching is implemented by doing a series of separate lookups using
9498 keys constructed by modifying the original subject key. This means that it can
9499 be used with any of the single-key lookup types, provided that
9500 partial matching keys
9501 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
9502 Keys in the file that do not begin with the prefix are matched only by
9503 unmodified subject keys when partial matching is in use.
9506 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
9507 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
9508 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
9509 is added at the start of the subject key, and it is looked up again. If that
9510 fails, further lookups are tried with dot-separated components removed from the
9511 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
9515 A minimum number of two non-* components are required. This can be adjusted
9516 by including a number before the hyphen in the search type. For example,
9517 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
9518 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
9519 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
9520 up when the minimum number of non-* components is two:
9522 <literallayout class="monospaced">
9523 2250.dates.fict.example
9524 *.2250.dates.fict.example
9525 *.dates.fict.example
9529 As soon as one key in the sequence is successfully looked up, the lookup
9533 <indexterm role="concept">
9534 <primary>lookup</primary>
9535 <secondary>partial matching – changing prefix</secondary>
9537 <indexterm role="concept">
9538 <primary>prefix</primary>
9539 <secondary>for partial matching</secondary>
9541 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
9542 changed. The motivation for this feature is to allow Exim to operate with file
9543 formats that are used by other MTAs. A different prefix can be supplied in
9544 parentheses instead of the hyphen after <quote>partial</quote>. For example:
9546 <literallayout class="monospaced">
9547 domains = partial(.)lsearch;/some/file
9550 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9551 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
9552 components is unchanged). The prefix may consist of any punctuation characters
9553 other than a closing parenthesis. It may be empty, for example:
9555 <literallayout class="monospaced">
9556 domains = partial1()cdb;/some/file
9559 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9560 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
9563 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
9564 just one non-wild component has failed, and the original key is shortened right
9565 down to the null string) depends on the prefix:
9570 If the prefix has zero length, the whole lookup fails.
9575 If the prefix has length 1, a lookup for just the prefix is done. For
9576 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
9581 Otherwise, if the prefix ends in a dot, the dot is removed, and the
9582 remainder is looked up. With the default prefix, therefore, the final lookup is
9583 for <quote>*</quote> on its own.
9588 Otherwise, the whole prefix is looked up.
9593 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
9594 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
9595 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
9596 specified, adding <quote>*</quote> to the search type has no effect with the default
9597 prefix, because the <quote>*</quote> key is already included in the sequence of partial
9598 lookups. However, there might be a use for lookup types such as
9599 <quote>partial0(.)lsearch*</quote>.
9602 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
9603 in domain lists and the like. Partial matching works only in terms of
9604 dot-separated components; a key such as <literal>*fict.example</literal>
9605 in a database file is useless, because the asterisk in a partial matching
9606 subject key is always followed by a dot.
9610 <title>Lookup caching</title>
9612 <indexterm role="concept">
9613 <primary>lookup</primary>
9614 <secondary>caching</secondary>
9616 <indexterm role="concept">
9617 <primary>caching</primary>
9618 <secondary>lookup data</secondary>
9620 Exim caches all lookup results in order to avoid needless repetition of
9621 lookups. However, because (apart from the daemon) Exim operates as a collection
9622 of independent, short-lived processes, this caching applies only within a
9623 single Exim process. There is no inter-process lookup caching facility.
9626 For single-key lookups, Exim keeps the relevant files open in case there is
9627 another lookup that needs them. In some types of configuration this can lead to
9628 many files being kept open for messages with many recipients. To avoid hitting
9629 the operating system limit on the number of simultaneously open files, Exim
9630 closes the least recently used file when it needs to open more files than its
9631 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
9634 The single-key lookup files are closed and the lookup caches are flushed at
9635 strategic points during delivery – for example, after all routing is
9640 <title>Quoting lookup data</title>
9642 <indexterm role="concept">
9643 <primary>lookup</primary>
9644 <secondary>quoting</secondary>
9646 <indexterm role="concept">
9647 <primary>quoting</primary>
9648 <secondary>in lookups</secondary>
9650 When data from an incoming message is included in a query-style lookup, there
9651 is the possibility of special characters in the data messing up the syntax of
9652 the query. For example, a NIS+ query that contains
9654 <literallayout class="monospaced">
9658 will be broken if the local part happens to contain a closing square bracket.
9659 For NIS+, data can be enclosed in double quotes like this:
9661 <literallayout class="monospaced">
9662 [name="$local_part"]
9665 but this still leaves the problem of a double quote in the data. The rule for
9666 NIS+ is that double quotes must be doubled. Other lookup types have different
9667 rules, and to cope with the differing requirements, an expansion operator
9668 of the following form is provided:
9670 <literallayout class="monospaced">
9671 ${quote_<lookup-type>:<string>}
9674 For example, the safest way to write the NIS+ query is
9676 <literallayout class="monospaced">
9677 [name="${quote_nisplus:$local_part}"]
9680 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
9681 operator can be used for all lookup types, but has no effect for single-key
9682 lookups, since no quoting is ever needed in their key strings.
9685 <section id="SECTdnsdb">
9686 <title>More about dnsdb</title>
9688 <indexterm role="concept">
9689 <primary>dnsdb lookup</primary>
9691 <indexterm role="concept">
9692 <primary>lookup</primary>
9693 <secondary>dnsdb</secondary>
9695 <indexterm role="concept">
9696 <primary>DNS</primary>
9697 <secondary>as a lookup type</secondary>
9699 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
9700 of a record type and a domain name, separated by an equals sign. For example,
9701 an expansion string could contain:
9703 <literallayout class="monospaced">
9704 ${lookup dnsdb{mx=a.b.example}{$value}fail}
9707 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
9708 is used on its own as the result. If the lookup succeeds, the <literal>fail</literal> keyword
9709 causes a <emphasis>forced expansion failure</emphasis> – see section <xref linkend="SECTforexpfai"/> for
9710 an explanation of what this means.
9713 The supported DNS record types are A, CNAME, MX, NS, PTR, SRV, and TXT, and,
9714 when Exim is compiled with IPv6 support, AAAA (and A6 if that is also
9715 configured). If no type is given, TXT is assumed. When the type is PTR,
9716 the data can be an IP address, written as normal; inversion and the addition of
9717 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
9719 <literallayout class="monospaced">
9720 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
9723 If the data for a PTR record is not a syntactically valid IP address, it is not
9724 altered and nothing is added.
9727 <indexterm role="concept">
9728 <primary>MX record</primary>
9729 <secondary>in <command>dnsdb</command> lookup</secondary>
9731 <indexterm role="concept">
9732 <primary>SRV record</primary>
9733 <secondary>in <command>dnsdb</command> lookup</secondary>
9735 For an MX lookup, both the preference value and the host name are returned for
9736 each record, separated by a space. For an SRV lookup, the priority, weight,
9737 port, and host name are returned for each record, separated by spaces.
9740 For any record type, if multiple records are found (or, for A6 lookups, if a
9741 single record leads to multiple addresses), the data is returned as a
9742 concatenation, with newline as the default separator. The order, of course,
9743 depends on the DNS resolver. You can specify a different separator character
9744 between multiple records by putting a right angle-bracket followed immediately
9745 by the new separator at the start of the query. For example:
9747 <literallayout class="monospaced">
9748 ${lookup dnsdb{>: a=host1.example}}
9751 It is permitted to specify a space as the separator character. Further
9752 white space is ignored.
9756 <title>Pseudo dnsdb record types</title>
9758 <indexterm role="concept">
9759 <primary>MX record</primary>
9760 <secondary>in <command>dnsdb</command> lookup</secondary>
9762 By default, both the preference value and the host name are returned for
9763 each MX record, separated by a space. If you want only host names, you can use
9764 the pseudo-type MXH:
9766 <literallayout class="monospaced">
9767 ${lookup dnsdb{mxh=a.b.example}}
9770 In this case, the preference values are omitted, and just the host names are
9774 <indexterm role="concept">
9775 <primary>name server</primary>
9776 <secondary>for enclosing domain</secondary>
9778 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
9779 records on the given domain, but if none are found, it removes the first
9780 component of the domain name, and tries again. This process continues until NS
9781 records are found or there are no more components left (or there is a DNS
9782 error). In other words, it may return the name servers for a top-level domain,
9783 but it never returns the root name servers. If there are no NS records for the
9784 top-level domain, the lookup fails. Consider these examples:
9786 <literallayout class="monospaced">
9787 ${lookup dnsdb{zns=xxx.quercite.com}}
9788 ${lookup dnsdb{zns=xxx.edu}}
9791 Assuming that in each case there are no NS records for the full domain name,
9792 the first returns the name servers for <option>quercite.com</option>, and the second returns
9793 the name servers for <option>edu</option>.
9796 You should be careful about how you use this lookup because, unless the
9797 top-level domain does not exist, the lookup always returns some host names. The
9798 sort of use to which this might be put is for seeing if the name servers for a
9799 given domain are on a blacklist. You can probably assume that the name servers
9800 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
9804 <indexterm role="concept">
9805 <primary>CSA</primary>
9806 <secondary>in <command>dnsdb</command> lookup</secondary>
9808 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
9809 records according to the CSA rules, which are described in section
9810 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
9811 not sufficient because of the extra parent domain search behaviour of CSA. The
9812 result of a successful lookup such as:
9814 <literallayout class="monospaced">
9815 ${lookup dnsdb {csa=$sender_helo_name}}
9818 has two space-separated fields: an authorization code and a target host name.
9819 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
9820 authorization required but absent, or <quote>?</quote> for unknown.
9824 <title>Multiple dnsdb lookups</title>
9826 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
9827 However, you can specify a list of domains or IP addresses in a single
9828 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
9829 the default separator, but with the ability to change this. For example:
9831 <literallayout class="monospaced">
9832 ${lookup dnsdb{one.domain.com:two.domain.com}}
9833 ${lookup dnsdb{a=one.host.com:two.host.com}}
9834 ${lookup dnsdb{ptr = <; 1.2.3.4 ; 4.5.6.8}}
9837 In order to retain backwards compatibility, there is one special case: if
9838 the lookup type is PTR and no change of separator is specified, Exim looks
9839 to see if the rest of the string is precisely one IPv6 address. In this
9840 case, it does not treat it as a list.
9843 The data from each lookup is concatenated, with newline separators by default,
9844 in the same way that multiple DNS records for a single item are handled. A
9845 different separator can be specified, as described above.
9848 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
9849 temporary DNS error for any of them, the behaviour is controlled by
9850 an optional keyword followed by a comma that may appear before the record
9851 type. The possible keywords are <quote>defer_strict</quote>, <quote>defer_never</quote>, and
9852 <quote>defer_lax</quote>. With <quote>strict</quote> behaviour, any temporary DNS error causes the
9853 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
9854 ignored, and the behaviour is as if the DNS lookup failed to find anything.
9855 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
9856 error causes the whole lookup to defer only if none of the other lookups
9857 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
9859 <literallayout class="monospaced">
9860 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
9861 ${lookup dnsdb{a=one.host.com:two.host.com}}
9864 Thus, in the default case, as long as at least one of the DNS lookups
9865 yields some data, the lookup succeeds.
9868 <section id="SECTldap">
9869 <title>More about LDAP</title>
9871 <indexterm role="concept">
9872 <primary>LDAP lookup</primary>
9874 <indexterm role="concept">
9875 <primary>lookup</primary>
9876 <secondary>LDAP</secondary>
9878 <indexterm role="concept">
9879 <primary>Solaris</primary>
9880 <secondary>LDAP</secondary>
9882 The original LDAP implementation came from the University of Michigan; this has
9883 become <quote>Open LDAP</quote>, and there are now two different releases. Another
9884 implementation comes from Netscape, and Solaris 7 and subsequent releases
9885 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
9886 the lookup function level, their error handling is different. For this reason
9887 it is necessary to set a compile-time variable when building Exim with LDAP, to
9888 indicate which LDAP library is in use. One of the following should appear in
9889 your <filename>Local/Makefile</filename>:
9891 <literallayout class="monospaced">
9892 LDAP_LIB_TYPE=UMICHIGAN
9893 LDAP_LIB_TYPE=OPENLDAP1
9894 LDAP_LIB_TYPE=OPENLDAP2
9895 LDAP_LIB_TYPE=NETSCAPE
9896 LDAP_LIB_TYPE=SOLARIS
9899 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
9900 same interface as the University of Michigan version.
9903 There are three LDAP lookup types in Exim. These behave slightly differently in
9904 the way they handle the results of a query:
9909 <command>ldap</command> requires the result to contain just one entry; if there are more, it
9915 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
9916 Distinguished Name that is returned rather than any attribute values.
9921 <command>ldapm</command> permits the result to contain more than one entry; the attributes
9922 from all of them are returned.
9927 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
9928 Exim behaves as if the entry did not exist, and the lookup fails. The format of
9929 the data returned by a successful lookup is described in the next section.
9930 First we explain how LDAP queries are coded.
9933 <section id="SECTforldaque">
9934 <title>Format of LDAP queries</title>
9936 <indexterm role="concept">
9937 <primary>LDAP</primary>
9938 <secondary>query format</secondary>
9940 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
9941 the configuration of a <command>redirect</command> router one might have this setting:
9943 <literallayout class="monospaced">
9944 data = ${lookup ldap \
9945 {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
9946 c=UK?mailbox?base?}}
9949 <indexterm role="concept">
9950 <primary>LDAP</primary>
9951 <secondary>with TLS</secondary>
9953 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
9954 secure (encrypted) LDAP connections. The second of these ensures that an
9955 encrypted TLS connection is used.
9959 <title>LDAP quoting</title>
9961 <indexterm role="concept">
9962 <primary>LDAP</primary>
9963 <secondary>quoting</secondary>
9965 Two levels of quoting are required in LDAP queries, the first for LDAP itself
9966 and the second because the LDAP query is represented as a URL. Furthermore,
9967 within an LDAP query, two different kinds of quoting are required. For this
9968 reason, there are two different LDAP-specific quoting operators.
9971 The <option>quote_ldap</option> operator is designed for use on strings that are part of
9972 filter specifications. Conceptually, it first does the following conversions on
9975 <literallayout class="monospaced">
9982 in accordance with RFC 2254. The resulting string is then quoted according
9983 to the rules for URLs, that is, all non-alphanumeric characters except
9985 <literallayout class="monospaced">
9989 are converted to their hex values, preceded by a percent sign. For example:
9991 <literallayout class="monospaced">
9992 ${quote_ldap: a(bc)*, a<yz>; }
9997 <literallayout class="monospaced">
9998 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
10001 Removing the URL quoting, this is (with a leading and a trailing space):
10003 <literallayout class="monospaced">
10004 a\28bc\29\2A, a<yz>;
10007 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
10008 base DN specifications in queries. Conceptually, it first converts the string
10009 by inserting a backslash in front of any of the following characters:
10011 <literallayout class="monospaced">
10012 , + " \ < > ;
10015 It also inserts a backslash before any leading spaces or # characters, and
10016 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
10017 is then quoted according to the rules for URLs. For example:
10019 <literallayout class="monospaced">
10020 ${quote_ldap_dn: a(bc)*, a<yz>; }
10025 <literallayout class="monospaced">
10026 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
10029 Removing the URL quoting, this is (with a trailing space):
10031 <literallayout class="monospaced">
10032 \ a(bc)*\, a\<yz\>\;\
10035 There are some further comments about quoting in the section on LDAP
10036 authentication below.
10040 <title>LDAP connections</title>
10042 <indexterm role="concept">
10043 <primary>LDAP</primary>
10044 <secondary>connections</secondary>
10046 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
10047 is in use, via a Unix domain socket. The example given above does not specify
10048 an LDAP server. A server that is reached by TCP/IP can be specified in a query
10049 by starting it with
10051 <literallayout class="monospaced">
10052 ldap://<hostname>:<port>/...
10055 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
10056 used. When no server is specified in a query, a list of default servers is
10057 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
10058 colon-separated list of servers which are tried in turn until one successfully
10059 handles a query, or there is a serious error. Successful handling either
10060 returns the requested data, or indicates that it does not exist. Serious errors
10061 are syntactical, or multiple values when only a single value is expected.
10062 Errors which cause the next server to be tried are connection failures, bind
10063 failures, and timeouts.
10066 For each server name in the list, a port number can be given. The standard way
10067 of specifing a host and port is to use a colon separator (RFC 1738). Because
10068 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
10069 doubled. For example
10071 <literallayout class="monospaced">
10072 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
10075 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
10076 to the LDAP library with no server name, and the library’s default (normally
10077 the local host) is used.
10080 If you are using the OpenLDAP library, you can connect to an LDAP server using
10081 a Unix domain socket instead of a TCP/IP connection. This is specified by using
10082 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
10083 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
10087 For this type of connection, instead of a host name for the server, a pathname
10088 for the socket is required, and the port number is not relevant. The pathname
10089 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
10090 the query. In the former case, you can have settings such as
10092 <literallayout class="monospaced">
10093 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
10096 When the pathname is given in the query, you have to escape the slashes as
10097 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
10099 <literallayout class="monospaced">
10100 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
10103 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
10104 a pathname, it uses the Unix domain socket code, even if the query actually
10105 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
10106 socket connection. This behaviour means that you can use a setting of
10107 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
10108 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
10109 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
10113 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
10114 specified, an error is diagnosed. However, if there are more items in
10115 <option>ldap_default_servers</option>, they are tried. In other words:
10120 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
10126 Using <literal>ldapi</literal> with a host name causes an error.
10131 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
10132 <option>ldap_default_servers</option>, does whatever the library does by default.
10136 <title>LDAP authentication and control information</title>
10138 <indexterm role="concept">
10139 <primary>LDAP</primary>
10140 <secondary>authentication</secondary>
10142 The LDAP URL syntax provides no way of passing authentication and other control
10143 information to the server. To make this possible, the URL in an LDAP query may
10144 be preceded by any number of <<emphasis>name</emphasis>>=<<emphasis>value</emphasis>> settings, separated by
10145 spaces. If a value contains spaces it must be enclosed in double quotes, and
10146 when double quotes are used, backslash is interpreted in the usual way inside
10147 them. The following names are recognized:
10150 <literal>DEREFERENCE</literal> set the dereferencing parameter
10151 <literal>NETTIME </literal> set a timeout for a network operation
10152 <literal>USER </literal> set the DN, for authenticating the LDAP bind
10153 <literal>PASS </literal> set the password, likewise
10154 <literal>SIZE </literal> set the limit for the number of entries returned
10155 <literal>TIME </literal> set the maximum waiting time for a query
10158 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
10159 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>.
10162 The name CONNECT is an obsolete name for NETTIME, retained for
10163 backwards compatibility. This timeout (specified as a number of seconds) is
10164 enforced from the client end for operations that can be carried out over a
10165 network. Specifically, it applies to network connections and calls to the
10166 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
10167 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
10168 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
10169 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
10170 Netscape SDK; for OpenLDAP no action is taken.
10173 The TIME parameter (also a number of seconds) is passed to the server to
10174 set a server-side limit on the time taken to complete a search.
10177 Here is an example of an LDAP query in an Exim lookup that uses some of these
10178 values. This is a single line, folded to fit on the page:
10180 <literallayout class="monospaced">
10182 {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
10183 ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
10187 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
10188 any of the auxiliary data. Exim configuration settings that include lookups
10189 which contain password information should be preceded by <quote>hide</quote> to prevent
10190 non-admin users from using the <option>-bP</option> option to see their values.
10193 The auxiliary data items may be given in any order. The default is no
10194 connection timeout (the system timeout is used), no user or password, no limit
10195 on the number of entries returned, and no time limit on queries.
10198 When a DN is quoted in the USER= setting for LDAP authentication, Exim
10199 removes any URL quoting that it may contain before passing it LDAP. Apparently
10200 some libraries do this for themselves, but some do not. Removing the URL
10201 quoting has two advantages:
10206 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
10207 DNs as with DNs inside actual queries.
10212 It permits spaces inside USER= DNs.
10217 For example, a setting such as
10219 <literallayout class="monospaced">
10220 USER=cn=${quote_ldap_dn:$1}
10223 should work even if <varname>$1</varname> contains spaces.
10226 Expanded data for the PASS= value should be quoted using the <option>quote</option>
10227 expansion operator, rather than the LDAP quote operators. The only reason this
10228 field needs quoting is to ensure that it conforms to the Exim syntax, which
10229 does not allow unquoted spaces. For example:
10231 <literallayout class="monospaced">
10235 The LDAP authentication mechanism can be used to check passwords as part of
10236 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
10237 <xref linkend="CHAPexpand"/>.
10241 <title>Format of data returned by LDAP</title>
10243 <indexterm role="concept">
10244 <primary>LDAP</primary>
10245 <secondary>returned data formats</secondary>
10247 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
10248 as a sequence of values, for example
10250 <literallayout class="monospaced">
10251 cn=manager, o=University of Cambridge, c=UK
10254 The <command>ldap</command> lookup type generates an error if more than one entry matches the
10255 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
10256 the result between the data from different entries. It is possible for multiple
10257 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
10258 you know that whatever values are returned all came from a single entry in the
10262 In the common case where you specify a single attribute in your LDAP query, the
10263 result is not quoted, and does not contain the attribute name. If the attribute
10264 has multiple values, they are separated by commas.
10267 If you specify multiple attributes, the result contains space-separated, quoted
10268 strings, each preceded by the attribute name and an equals sign. Within the
10269 quotes, the quote character, backslash, and newline are escaped with
10270 backslashes, and commas are used to separate multiple values for the attribute.
10271 Apart from the escaping, the string within quotes takes the same form as the
10272 output when a single attribute is requested. Specifying no attributes is the
10273 same as specifying all of an entry’s attributes.
10276 Here are some examples of the output format. The first line of each pair is an
10277 LDAP query, and the second is the data that is returned. The attribute called
10278 <option>attr1</option> has two values, whereas <option>attr2</option> has only one value:
10280 <literallayout class="monospaced">
10281 ldap:///o=base?attr1?sub?(uid=fred)
10284 ldap:///o=base?attr2?sub?(uid=fred)
10287 ldap:///o=base?attr1,attr2?sub?(uid=fred)
10288 attr1="value1.1, value1.2" attr2="value two"
10290 ldap:///o=base??sub?(uid=fred)
10291 objectClass="top" attr1="value1.1, value1.2" attr2="value two"
10294 The <option>extract</option> operator in string expansions can be used to pick out
10295 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs. You can
10296 make use of Exim’s <option>-be</option> option to run expansion tests and thereby check the
10297 results of LDAP lookups.
10300 <section id="SECTnisplus">
10301 <title>More about NIS+</title>
10303 <indexterm role="concept">
10304 <primary>NIS+ lookup type</primary>
10306 <indexterm role="concept">
10307 <primary>lookup</primary>
10308 <secondary>NIS+</secondary>
10310 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
10311 and field name. If this is given, the result of a successful query is the
10312 contents of the named field; otherwise the result consists of a concatenation
10313 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
10314 values containing spaces are quoted. For example, the query
10316 <literallayout class="monospaced">
10317 [name=mg1456],passwd.org_dir
10320 might return the string
10322 <literallayout class="monospaced">
10323 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
10324 home=/home/mg1456 shell=/bin/bash shadow=""
10327 (split over two lines here to fit on the page), whereas
10329 <literallayout class="monospaced">
10330 [name=mg1456],passwd.org_dir:gcos
10335 <literallayout class="monospaced">
10339 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
10340 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
10341 operator is to double any quote characters within the text.
10344 <section id="SECTsql">
10345 <title>SQL lookups</title>
10347 <indexterm role="concept">
10348 <primary>SQL lookup types</primary>
10350 Exim can support lookups in Interbase, MySQL, Oracle, PostgreSQL, and SQLite
10351 databases. Queries for these databases contain SQL statements, so an example
10354 <literallayout class="monospaced">
10355 ${lookup mysql{select mailbox from users where id='userx'}\
10359 If the result of the query contains more than one field, the data for each
10360 field in the row is returned, preceded by its name, so the result of
10362 <literallayout class="monospaced">
10363 ${lookup pgsql{select home,name from users where id='userx'}\
10369 <literallayout class="monospaced">
10370 home=/home/userx name="Mister X"
10373 Empty values and values containing spaces are double quoted, with embedded
10374 quotes escaped by a backslash. If the result of the query contains just one
10375 field, the value is passed back verbatim, without a field name, for example:
10377 <literallayout class="monospaced">
10381 If the result of the query yields more than one row, it is all concatenated,
10382 with a newline between the data for each row.
10386 <title>More about MySQL, PostgreSQL, Oracle, and Interbase</title>
10388 <indexterm role="concept">
10389 <primary>MySQL</primary>
10390 <secondary>lookup type</secondary>
10392 <indexterm role="concept">
10393 <primary>PostgreSQL lookup type</primary>
10395 <indexterm role="concept">
10396 <primary>lookup</primary>
10397 <secondary>MySQL</secondary>
10399 <indexterm role="concept">
10400 <primary>lookup</primary>
10401 <secondary>PostgreSQL</secondary>
10403 <indexterm role="concept">
10404 <primary>Oracle</primary>
10405 <secondary>lookup type</secondary>
10407 <indexterm role="concept">
10408 <primary>lookup</primary>
10409 <secondary>Oracle</secondary>
10411 <indexterm role="concept">
10412 <primary>Interbase lookup type</primary>
10414 <indexterm role="concept">
10415 <primary>lookup</primary>
10416 <secondary>Interbase</secondary>
10418 If any MySQL, PostgreSQL, Oracle, or Interbase lookups are used, the
10419 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, or <option>ibase_servers</option>
10420 option (as appropriate) must be set to a colon-separated list of server
10421 information. Each item in the list is a slash-separated list of four items:
10422 host name, database name, user name, and password. In the case of Oracle, the
10423 host name field is used for the <quote>service name</quote>, and the database name field
10424 is not used and should be empty. For example:
10426 <literallayout class="monospaced">
10427 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
10430 Because password data is sensitive, you should always precede the setting with
10431 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
10432 option. Here is an example where two MySQL servers are listed:
10434 <literallayout class="monospaced">
10435 hide mysql_servers = localhost/users/root/secret:\
10436 otherhost/users/root/othersecret
10439 For MySQL and PostgreSQL, a host may be specified as <<emphasis>name</emphasis>>:<<emphasis>port</emphasis>> but
10440 because this is a colon-separated list, the colon has to be doubled. For each
10441 query, these parameter groups are tried in order until a connection and a query
10445 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
10446 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
10447 respectively, and the characters single-quote, double-quote, and backslash
10448 itself are escaped with backslashes. The <option>quote_pgsql</option> expansion operator, in
10449 addition, escapes the percent and underscore characters. This cannot be done
10450 for MySQL because these escapes are not recognized in contexts where these
10451 characters are not special.
10455 <title>Special MySQL features</title>
10457 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
10458 causes a connection to the server on the local host by means of a Unix domain
10459 socket. An alternate socket can be specified in parentheses. The full syntax of
10460 each item in <option>mysql_servers</option> is:
10463 <<emphasis>hostname</emphasis>>::<<emphasis>port</emphasis>>(<<emphasis>socket name</emphasis>>)/<<emphasis>database</emphasis>>/<<emphasis>user</emphasis>>/<<emphasis>password</emphasis>>
10466 Any of the three sub-parts of the first field can be omitted. For normal use on
10467 the local host it can be left blank or set to just <quote>localhost</quote>.
10470 No database need be supplied – but if it is absent here, it must be given in
10474 If a MySQL query is issued that does not request any data (an insert, update,
10475 or delete command), the result of the lookup is the number of rows affected.
10478 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
10479 anything (for example, setting a field to the value it already has), the result
10480 is zero because no rows are affected.
10484 <title>Special PostgreSQL features</title>
10486 PostgreSQL lookups can also use Unix domain socket connections to the database.
10487 This is usually faster and costs less CPU time than a TCP/IP connection.
10488 However it can be used only if the mail server runs on the same machine as the
10489 database server. A configuration line for PostgreSQL via Unix domain sockets
10492 <literallayout class="monospaced">
10493 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
10496 In other words, instead of supplying a host name, a path to the socket is
10497 given. The path name is enclosed in parentheses so that its slashes aren’t
10498 visually confused with the delimiters for the other server parameters.
10501 If a PostgreSQL query is issued that does not request any data (an insert,
10502 update, or delete command), the result of the lookup is the number of rows
10506 <section id="SECTsqlite">
10507 <title>More about SQLite</title>
10509 <indexterm role="concept">
10510 <primary>lookup</primary>
10511 <secondary>SQLite</secondary>
10513 <indexterm role="concept">
10514 <primary>SQLite lookup type</primary>
10516 SQLite is different to the other SQL lookups because a file name is required in
10517 addition to the SQL query. An SQLite database is a single file, and there is no
10518 daemon as in the other SQL databases. The interface to Exim requires the name
10519 of the file, as an absolute path, to be given at the start of the query. It is
10520 separated from the query by white space. This means that the path name cannot
10521 contain white space. Here is a lookup expansion example:
10523 <literallayout class="monospaced">
10524 ${lookup sqlite {/some/thing/sqlitedb \
10525 select name from aliases where id='userx';}}
10528 In a list, the syntax is similar. For example:
10530 <literallayout class="monospaced">
10531 domainlist relay_domains = sqlite;/some/thing/sqlitedb \
10532 select * from relays where ip='$sender_host_address';
10535 The only character affected by the <option>quote_sqlite</option> operator is a single
10536 quote, which it doubles.
10539 The SQLite library handles multiple simultaneous accesses to the database
10540 internally. Multiple readers are permitted, but only one process can
10541 update at once. Attempts to access the database while it is being updated
10542 are rejected after a timeout period, during which the SQLite library
10543 waits for the lock to be released. In Exim, the default timeout is set
10544 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
10546 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
10547 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
10552 <chapter id="CHAPdomhosaddlists">
10553 <title>Domain, host, address, and local part lists</title>
10554 <titleabbrev>Domain, host, and address lists</titleabbrev>
10556 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
10557 <primary>lists of domains; hosts; etc.</primary>
10559 A number of Exim configuration options contain lists of domains, hosts,
10560 email addresses, or local parts. For example, the <option>hold_domains</option> option
10561 contains a list of domains whose delivery is currently suspended. These lists
10562 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
10563 arguments to expansion conditions such as <option>match_domain</option>.
10566 Each item in one of these lists is a pattern to be matched against a domain,
10567 host, email address, or local part, respectively. In the sections below, the
10568 different types of pattern for each case are described, but first we cover some
10569 general facilities that apply to all four kinds of list.
10572 <title>Expansion of lists</title>
10574 <indexterm role="concept">
10575 <primary>expansion</primary>
10576 <secondary>of lists</secondary>
10578 Each list is expanded as a single string before it is used. The result of
10579 expansion must be a list, possibly containing empty items, which is split up
10580 into separate items for matching. By default, colon is the separator character,
10581 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
10582 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
10583 discusses the way to specify empty list items.
10586 If the string expansion is forced to fail, Exim behaves as if the item it is
10587 testing (domain, host, address, or local part) is not in the list. Other
10588 expansion failures cause temporary errors.
10591 If an item in a list is a regular expression, backslashes, dollars and possibly
10592 other special characters in the expression must be protected against
10593 misinterpretation by the string expander. The easiest way to do this is to use
10594 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
10595 expression should not be expanded. For example, in an ACL you might have:
10597 <literallayout class="monospaced">
10598 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
10599 ${lookup{$domain}lsearch{/badsenders/bydomain}}
10602 The first item is a regular expression that is protected from expansion by
10603 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
10604 senders based on the receiving domain.
10608 <title>Negated items in lists</title>
10610 <indexterm role="concept">
10611 <primary>list</primary>
10612 <secondary>negation</secondary>
10614 <indexterm role="concept">
10615 <primary>negation</primary>
10616 <secondary>in lists</secondary>
10618 Items in a list may be positive or negative. Negative items are indicated by a
10619 leading exclamation mark, which may be followed by optional white space. A list
10620 defines a set of items (domains, etc). When Exim processes one of these lists,
10621 it is trying to find out whether a domain, host, address, or local part
10622 (respectively) is in the set that is defined by the list. It works like this:
10625 The list is scanned from left to right. If a positive item is matched, the
10626 subject that is being checked is in the set; if a negative item is matched, the
10627 subject is not in the set. If the end of the list is reached without the
10628 subject having matched any of the patterns, it is in the set if the last item
10629 was a negative one, but not if it was a positive one. For example, the list in
10631 <literallayout class="monospaced">
10632 domainlist relay_domains = !a.b.c : *.b.c
10635 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
10636 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
10637 list is positive. However, if the setting were
10639 <literallayout class="monospaced">
10640 domainlist relay_domains = !a.b.c
10643 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
10644 list is negative. In other words, a list that ends with a negative item behaves
10645 as if it had an extra item <literal>:*</literal> on the end.
10648 Another way of thinking about positive and negative items in lists is to read
10649 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
10653 <section id="SECTfilnamlis">
10654 <title>File names in lists</title>
10656 <indexterm role="concept">
10657 <primary>list</primary>
10658 <secondary>file name in</secondary>
10660 If an item in a domain, host, address, or local part list is an absolute file
10661 name (beginning with a slash character), each line of the file is read and
10662 processed as if it were an independent item in the list, except that further
10663 file names are not allowed,
10664 and no expansion of the data from the file takes place.
10665 Empty lines in the file are ignored, and the file may also contain comment
10671 For domain and host lists, if a # character appears anywhere in a line of the
10672 file, it and all following characters are ignored.
10677 Because local parts may legitimately contain # characters, a comment in an
10678 address list or local part list file is recognized only if # is preceded by
10679 white space or the start of the line. For example:
10681 <literallayout class="monospaced">
10682 not#comment@x.y.z # but this is a comment
10687 Putting a file name in a list has the same effect as inserting each line of the
10688 file as an item in the list (blank lines and comments excepted). However, there
10689 is one important difference: the file is read each time the list is processed,
10690 so if its contents vary over time, Exim’s behaviour changes.
10693 If a file name is preceded by an exclamation mark, the sense of any match
10694 within the file is inverted. For example, if
10696 <literallayout class="monospaced">
10697 hold_domains = !/etc/nohold-domains
10700 and the file contains the lines
10702 <literallayout class="monospaced">
10707 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
10708 any domain matching <literal>*.b.c</literal> is not.
10712 <title>An lsearch file is not an out-of-line list</title>
10714 As will be described in the sections that follow, lookups can be used in lists
10715 to provide indexed methods of checking list membership. There has been some
10716 confusion about the way <command>lsearch</command> lookups work in lists. Because
10717 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
10718 sometimes thought that it is allowed to contain wild cards and other kinds of
10719 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
10720 always fixed strings, just as for any other single-key lookup type.
10723 If you want to use a file to contain wild-card patterns that form part of a
10724 list, just give the file name on its own, without a search type, as described
10725 in the previous section.
10728 <section id="SECTnamedlists">
10729 <title>Named lists</title>
10731 <indexterm role="concept">
10732 <primary>named lists</primary>
10734 <indexterm role="concept">
10735 <primary>list</primary>
10736 <secondary>named</secondary>
10738 A list of domains, hosts, email addresses, or local parts can be given a name
10739 which is then used to refer to the list elsewhere in the configuration. This is
10740 particularly convenient if the same list is required in several different
10741 places. It also allows lists to be given meaningful names, which can improve
10742 the readability of the configuration. For example, it is conventional to define
10743 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
10744 locally on a host, using a configuration line such as
10746 <literallayout class="monospaced">
10747 domainlist local_domains = localhost:my.dom.example
10750 Named lists are referenced by giving their name preceded by a plus sign, so,
10751 for example, a router that is intended to handle local domains would be
10752 configured with the line
10754 <literallayout class="monospaced">
10755 domains = +local_domains
10758 The first router in a configuration is often one that handles all domains
10759 except the local ones, using a configuration with a negated item like this:
10761 <literallayout class="monospaced">
10764 domains = ! +local_domains
10765 transport = remote_smtp
10769 The four kinds of named list are created by configuration lines starting with
10770 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
10771 respectively. Then there follows the name that you are defining, followed by an
10772 equals sign and the list itself. For example:
10774 <literallayout class="monospaced">
10775 hostlist relay_hosts = 192.168.23.0/24 : my.friend.example
10776 addresslist bad_senders = cdb;/etc/badsenders
10779 A named list may refer to other named lists:
10781 <literallayout class="monospaced">
10782 domainlist dom1 = first.example : second.example
10783 domainlist dom2 = +dom1 : third.example
10784 domainlist dom3 = fourth.example : +dom2 : fifth.example
10787 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
10788 effect may not be what you intended, because the negation does not propagate
10789 out to the higher level. For example, consider:
10791 <literallayout class="monospaced">
10792 domainlist dom1 = !a.b
10793 domainlist dom2 = +dom1 : *.b
10796 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
10797 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
10798 means it matches the second list as well. The effect is not the same as
10800 <literallayout class="monospaced">
10801 domainlist dom2 = !a.b : *.b
10804 where <emphasis>x.y</emphasis> does not match. It’s best to avoid negation altogether in
10805 referenced lists if you can.
10808 Named lists may have a performance advantage. When Exim is routing an
10809 address or checking an incoming message, it caches the result of tests on named
10810 lists. So, if you have a setting such as
10812 <literallayout class="monospaced">
10813 domains = +local_domains
10816 on several of your routers
10817 or in several ACL statements,
10818 the actual test is done only for the first one. However, the caching works only
10819 if there are no expansions within the list itself or any sublists that it
10820 references. In other words, caching happens only for lists that are known to be
10821 the same each time they are referenced.
10824 By default, there may be up to 16 named lists of each type. This limit can be
10825 extended by changing a compile-time variable. The use of domain and host lists
10826 is recommended for concepts such as local domains, relay domains, and relay
10827 hosts. The default configuration is set up like this.
10831 <title>Named lists compared with macros</title>
10833 <indexterm role="concept">
10834 <primary>list</primary>
10835 <secondary>named compared with macro</secondary>
10837 <indexterm role="concept">
10838 <primary>macro</primary>
10839 <secondary>compared with named list</secondary>
10841 At first sight, named lists might seem to be no different from macros in the
10842 configuration file. However, macros are just textual substitutions. If you
10845 <literallayout class="monospaced">
10846 ALIST = host1 : host2
10847 auth_advertise_hosts = !ALIST
10850 it probably won’t do what you want, because that is exactly the same as
10852 <literallayout class="monospaced">
10853 auth_advertise_hosts = !host1 : host2
10856 Notice that the second host name is not negated. However, if you use a host
10859 <literallayout class="monospaced">
10860 hostlist alist = host1 : host2
10861 auth_advertise_hosts = ! +alist
10864 the negation applies to the whole list, and so that is equivalent to
10866 <literallayout class="monospaced">
10867 auth_advertise_hosts = !host1 : !host2
10871 <title>Named list caching</title>
10873 <indexterm role="concept">
10874 <primary>list</primary>
10875 <secondary>caching of named</secondary>
10877 <indexterm role="concept">
10878 <primary>caching</primary>
10879 <secondary>named lists</secondary>
10881 While processing a message, Exim caches the result of checking a named list if
10882 it is sure that the list is the same each time. In practice, this means that
10883 the cache operates only if the list contains no $ characters, which guarantees
10884 that it will not change when it is expanded. Sometimes, however, you may have
10885 an expanded list that you know will be the same each time within a given
10886 message. For example:
10888 <literallayout class="monospaced">
10889 domainlist special_domains = \
10890 ${lookup{$sender_host_address}cdb{/some/file}}
10893 This provides a list of domains that depends only on the sending host’s IP
10894 address. If this domain list is referenced a number of times (for example,
10895 in several ACL lines, or in several routers) the result of the check is not
10896 cached by default, because Exim does not know that it is going to be the
10897 same list each time.
10900 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
10901 cache the result anyway. For example:
10903 <literallayout class="monospaced">
10904 domainlist_cache special_domains = ${lookup{...
10907 If you do this, you should be absolutely sure that caching is going to do
10908 the right thing in all cases. When in doubt, leave it out.
10911 <section id="SECTdomainlist">
10912 <title>Domain lists</title>
10914 <indexterm role="concept">
10915 <primary>domain list</primary>
10916 <secondary>patterns for</secondary>
10918 <indexterm role="concept">
10919 <primary>list</primary>
10920 <secondary>domain list</secondary>
10922 Domain lists contain patterns that are to be matched against a mail domain.
10923 The following types of item may appear in domain lists:
10928 <indexterm role="concept">
10929 <primary>primary host name</primary>
10931 <indexterm role="concept">
10932 <primary>host name</primary>
10933 <secondary>matched in domain list</secondary>
10935 <indexterm role="concept">
10936 <primary><option>primary_hostname</option></primary>
10938 <indexterm role="concept">
10939 <primary>domain list</primary>
10940 <secondary>matching primary host name</secondary>
10942 <indexterm role="concept">
10943 <primary>@ in a domain list</primary>
10945 If a pattern consists of a single @ character, it matches the local host name,
10946 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
10947 possible to use the same configuration file on several different hosts that
10948 differ only in their names.
10953 <indexterm role="concept">
10954 <primary>@[] in a domain list</primary>
10956 <indexterm role="concept">
10957 <primary>domain list</primary>
10958 <secondary>matching local IP interfaces</secondary>
10960 <indexterm role="concept">
10961 <primary>domain literal</primary>
10963 If a pattern consists of the string <literal>@[]</literal> it matches any local IP interface
10964 address, enclosed in square brackets, as in an email address that contains a
10966 In today’s Internet, the use of domain literals is controversial.
10971 <indexterm role="concept">
10972 <primary>@mx_any</primary>
10974 <indexterm role="concept">
10975 <primary>@mx_primary</primary>
10977 <indexterm role="concept">
10978 <primary>@mx_secondary</primary>
10980 <indexterm role="concept">
10981 <primary>domain list</primary>
10982 <secondary>matching MX pointers to local host</secondary>
10984 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
10985 has an MX record pointing to the local host or to any host that is listed in
10986 <indexterm role="concept">
10987 <primary><option>hosts_treat_as_local</option></primary>
10989 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
10990 are similar, except that the first matches only when a primary MX target is the
10991 local host, and the second only when no primary MX target is the local host,
10992 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
10993 preference value – there may of course be more than one of them.
10996 The MX lookup that takes place when matching a pattern of this type is
10997 performed with the resolver options for widening names turned off. Thus, for
10998 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
10999 resolver’s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
11000 options of the <command>dnslookup</command> router for a discussion of domain widening.
11003 Sometimes you may want to ignore certain IP addresses when using one of these
11004 patterns. You can specify this by following the pattern with <literal>/ignore=</literal><<emphasis>ip
11005 list</emphasis>>, where <<emphasis>ip list</emphasis>> is a list of IP addresses. These addresses are
11006 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
11007 on a router). For example:
11009 <literallayout class="monospaced">
11010 domains = @mx_any/ignore=127.0.0.1
11013 This example matches any domain that has an MX record pointing to one of
11014 the local host’s IP addresses other than 127.0.0.1.
11017 The list of IP addresses is in fact processed by the same code that processes
11018 host lists, so it may contain CIDR-coded network specifications and it may also
11019 contain negative items.
11022 Because the list of IP addresses is a sublist within a domain list, you have to
11023 be careful about delimiters if there is more than one address. Like any other
11024 list, the default delimiter can be changed. Thus, you might have:
11026 <literallayout class="monospaced">
11027 domains = @mx_any/ignore=<;127.0.0.1;0.0.0.0 : \
11028 an.other.domain : ...
11031 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
11032 involved, it is easiest to change the delimiter for the main list as well:
11034 <literallayout class="monospaced">
11035 domains = <? @mx_any/ignore=<;127.0.0.1;::1 ? \
11036 an.other.domain ? ...
11041 <indexterm role="concept">
11042 <primary>asterisk</primary>
11043 <secondary>in domain list</secondary>
11045 <indexterm role="concept">
11046 <primary>domain list</primary>
11047 <secondary>asterisk in</secondary>
11049 <indexterm role="concept">
11050 <primary>domain list</primary>
11051 <secondary>matching <quote>ends with</quote></secondary>
11053 If a pattern starts with an asterisk, the remaining characters of the pattern
11054 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
11055 domain lists differs from its use in partial matching lookups. In a domain
11056 list, the character following the asterisk need not be a dot, whereas partial
11057 matching works only in terms of dot-separated components. For example, a domain
11058 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
11059 <emphasis>cipher.key.ex</emphasis>.
11064 <indexterm role="concept">
11065 <primary>regular expressions</primary>
11066 <secondary>in domain list</secondary>
11068 <indexterm role="concept">
11069 <primary>domain list</primary>
11070 <secondary>matching regular expression</secondary>
11072 If a pattern starts with a circumflex character, it is treated as a regular
11073 expression, and matched against the domain using a regular expression matching
11074 function. The circumflex is treated as part of the regular expression.
11075 References to descriptions of the syntax of regular expressions are given in
11076 chapter <xref linkend="CHAPregexp"/>.
11079 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
11080 must escape any backslash and dollar characters in the regular expression, or
11081 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
11082 it is not to be expanded (unless you really do want to build a regular
11083 expression by expansion, of course).
11088 <indexterm role="concept">
11089 <primary>lookup</primary>
11090 <secondary>in domain list</secondary>
11092 <indexterm role="concept">
11093 <primary>domain list</primary>
11094 <secondary>matching by lookup</secondary>
11096 If a pattern starts with the name of a single-key lookup type followed by a
11097 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
11098 must be a file name in a suitable format for the lookup type. For example, for
11099 <quote>cdb;</quote> it must be an absolute path:
11101 <literallayout class="monospaced">
11102 domains = cdb;/etc/mail/local_domains.cdb
11105 The appropriate type of lookup is done on the file using the domain name as the
11106 key. In most cases, the data that is looked up is not used; Exim is interested
11107 only in whether or not the key is present in the file. However, when a lookup
11108 is used for the <option>domains</option> option on a router
11109 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
11110 <varname>$domain_data</varname> variable and can be referred to in other router options or
11111 other statements in the same ACL.
11116 Any of the single-key lookup type names may be preceded by
11117 <literal>partial</literal><<emphasis>n</emphasis>><literal>-</literal>, where the <<emphasis>n</emphasis>> is optional, for example,
11119 <literallayout class="monospaced">
11120 domains = partial-dbm;/partial/domains
11123 This causes partial matching logic to be invoked; a description of how this
11124 works is given in section <xref linkend="SECTpartiallookup"/>.
11129 <indexterm role="concept">
11130 <primary>asterisk</primary>
11131 <secondary>in lookup type</secondary>
11133 Any of the single-key lookup types may be followed by an asterisk. This causes
11134 a default lookup for a key consisting of a single asterisk to be done if the
11135 original lookup fails. This is not a useful feature when using a domain list to
11136 select particular domains (because any domain would match), but it might have
11137 value if the result of the lookup is being used via the <varname>$domain_data</varname>
11138 expansion variable.
11143 If the pattern starts with the name of a query-style lookup type followed by a
11144 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
11145 pattern must be an appropriate query for the lookup type, as described in
11146 chapter <xref linkend="CHAPfdlookup"/>. For example:
11148 <literallayout class="monospaced">
11149 hold_domains = mysql;select domain from holdlist \
11150 where domain = '$domain';
11153 In most cases, the data that is looked up is not used (so for an SQL query, for
11154 example, it doesn’t matter what field you select). Exim is interested only in
11155 whether or not the query succeeds. However, when a lookup is used for the
11156 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
11157 variable and can be referred to in other options.
11162 <indexterm role="concept">
11163 <primary>domain list</primary>
11164 <secondary>matching literal domain name</secondary>
11166 If none of the above cases apply, a caseless textual comparison is made
11167 between the pattern and the domain.
11172 Here is an example that uses several different kinds of pattern:
11174 <literallayout class="monospaced">
11175 domainlist funny_domains = \
11178 *.foundation.fict.example : \
11179 \N^[1-2]\d{3}\.fict\.example$\N : \
11180 partial-dbm;/opt/data/penguin/book : \
11181 nis;domains.byname : \
11182 nisplus;[name=$domain,status=local],domains.org_dir
11185 There are obvious processing trade-offs among the various matching modes. Using
11186 an asterisk is faster than a regular expression, and listing a few names
11187 explicitly probably is too. The use of a file or database lookup is expensive,
11188 but may be the only option if hundreds of names are required. Because the
11189 patterns are tested in order, it makes sense to put the most commonly matched
11193 <section id="SECThostlist">
11194 <title>Host lists</title>
11196 <indexterm role="concept">
11197 <primary>host list</primary>
11198 <secondary>patterns in</secondary>
11200 <indexterm role="concept">
11201 <primary>list</primary>
11202 <secondary>host list</secondary>
11204 Host lists are used to control what remote hosts are allowed to do. For
11205 example, some hosts may be allowed to use the local host as a relay, and some
11206 may be permitted to use the SMTP ETRN command. Hosts can be identified in
11207 two different ways, by name or by IP address. In a host list, some types of
11208 pattern are matched to a host name, and some are matched to an IP address.
11209 You need to be particularly careful with this when single-key lookups are
11210 involved, to ensure that the right value is being used as the key.
11214 <title>Special host list patterns</title>
11216 <indexterm role="concept">
11217 <primary>empty item in hosts list</primary>
11219 <indexterm role="concept">
11220 <primary>host list</primary>
11221 <secondary>empty string in</secondary>
11223 If a host list item is the empty string, it matches only when no remote host is
11224 involved. This is the case when a message is being received from a local
11225 process using SMTP on the standard input, that is, when a TCP/IP connection is
11229 <indexterm role="concept">
11230 <primary>asterisk</primary>
11231 <secondary>in host list</secondary>
11233 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
11234 the IP address nor the name is actually inspected.
11237 <section id="SECThoslispatip">
11238 <title>Host list patterns that match by IP address</title>
11240 <indexterm role="concept">
11241 <primary>host list</primary>
11242 <secondary>matching IP addresses</secondary>
11244 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
11245 the incoming address actually appears in the IPv6 host as
11246 <literal>::ffff:</literal><<emphasis>v4address</emphasis>>. When such an address is tested against a host
11247 list, it is converted into a traditional IPv4 address first. (Not all operating
11248 systems accept IPv4 calls on IPv6 sockets, as there have been some security
11252 The following types of pattern in a host list check the remote host by
11253 inspecting its IP address:
11258 If the pattern is a plain domain name (not a regular expression, not starting
11259 with *, not a lookup of any kind), Exim calls the operating system function
11260 to find the associated IP address(es). Exim uses the newer
11261 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
11262 This typically causes a forward DNS lookup of the name. The result is compared
11263 with the IP address of the subject host.
11266 If there is a temporary problem (such as a DNS timeout) with the host name
11267 lookup, a temporary error occurs. For example, if the list is being used in an
11268 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
11269 temporary SMTP error code. If no IP address can be found for the host name,
11270 what happens is described in section <xref linkend="SECTbehipnot"/> below.
11275 <indexterm role="concept">
11276 <primary>@ in a host list</primary>
11278 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
11279 domain name, as just described.
11284 If the pattern is an IP address, it is matched against the IP address of the
11285 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
11286 IPv6 addresses can be given in colon-separated format, but the colons have to
11287 be doubled so as not to be taken as item separators when the default list
11288 separator is used. IPv6 addresses are recognized even when Exim is compiled
11289 without IPv6 support. This means that if they appear in a host list on an
11290 IPv4-only host, Exim will not treat them as host names. They are just addresses
11291 that can never match a client host.
11296 <indexterm role="concept">
11297 <primary>@[] in a host list</primary>
11299 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
11300 the local host. For example, if the local host is an IPv4 host with one
11301 interface address 10.45.23.56, these two ACL statements have the same effect:
11303 <literallayout class="monospaced">
11304 accept hosts = 127.0.0.1 : 10.45.23.56
11310 <indexterm role="concept">
11311 <primary>CIDR notation</primary>
11313 If the pattern is an IP address followed by a slash and a mask length (for
11314 example 10.11.42.0/24), it is matched against the IP address of the subject
11315 host under the given mask. This allows, an entire network of hosts to be
11316 included (or excluded) by a single item. The mask uses CIDR notation; it
11317 specifies the number of address bits that must match, starting from the most
11318 significant end of the address.
11321 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
11322 of a range of addresses. It is the number of bits in the network portion of the
11323 address. The above example specifies a 24-bit netmask, so it matches all 256
11324 addresses in the 10.11.42.0 network. An item such as
11326 <literallayout class="monospaced">
11330 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
11331 32 for an IPv4 address is the same as no mask at all; just a single address
11335 Here is another example which shows an IPv4 and an IPv6 network:
11337 <literallayout class="monospaced">
11338 recipient_unqualified_hosts = 192.168.0.0/16: \
11339 3ffe::ffff::836f::::/48
11342 The doubling of list separator characters applies only when these items
11343 appear inline in a host list. It is not required when indirecting via a file.
11346 <literallayout class="monospaced">
11347 recipient_unqualified_hosts = /opt/exim/unqualnets
11350 could make use of a file containing
11352 <literallayout class="monospaced">
11354 3ffe:ffff:836f::/48
11357 to have exactly the same effect as the previous example. When listing IPv6
11358 addresses inline, it is usually more convenient to use the facility for
11359 changing separator characters. This list contains the same two networks:
11361 <literallayout class="monospaced">
11362 recipient_unqualified_hosts = <; 172.16.0.0/12; \
11363 3ffe:ffff:836f::/48
11366 The separator is changed to semicolon by the leading <quote><;</quote> at the start of the
11372 <section id="SECThoslispatsikey">
11373 <title>Host list patterns for single-key lookups by host address</title>
11375 <indexterm role="concept">
11376 <primary>host list</primary>
11377 <secondary>lookup of IP address</secondary>
11379 When a host is to be identified by a single-key lookup of its complete IP
11380 address, the pattern takes this form:
11383 <literal>net-<</literal><emphasis>single-key-search-type</emphasis><literal>>;<</literal><emphasis>search-data</emphasis><literal>></literal>
11388 <literallayout class="monospaced">
11389 hosts_lookup = net-cdb;/hosts-by-ip.db
11392 The text form of the IP address of the subject host is used as the lookup key.
11393 IPv6 addresses are converted to an unabbreviated form, using lower case
11394 letters, with dots as separators because colon is the key terminator in
11395 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
11396 quoting the keys, but this is a facility that was added later.] The data
11397 returned by the lookup is not used.
11400 <indexterm role="concept">
11401 <primary>IP address</primary>
11402 <secondary>masking</secondary>
11404 <indexterm role="concept">
11405 <primary>host list</primary>
11406 <secondary>masked IP address</secondary>
11408 Single-key lookups can also be performed using masked IP addresses, using
11409 patterns of this form:
11412 <literal>net<</literal><emphasis>number</emphasis><literal>>-<</literal><emphasis>single-key-search-type</emphasis><literal>>;<</literal><emphasis>search-data</emphasis><literal>></literal>
11417 <literallayout class="monospaced">
11418 net24-dbm;/networks.db
11421 The IP address of the subject host is masked using <<emphasis>number</emphasis>> as the mask
11422 length. A textual string is constructed from the masked value, followed by the
11423 mask, and this is used as the lookup key. For example, if the host’s IP address
11424 is 192.168.34.6, the key that is looked up for the above example is
11425 <quote>192.168.34.0/24</quote>. IPv6 addresses are converted to a text value using lower
11426 case letters and dots as separators instead of the more usual colon, because
11427 colon is the key terminator in <command>lsearch</command> files. Full, unabbreviated IPv6
11428 addresses are always used.
11431 <emphasis role="bold">Warning</emphasis>: Specifing <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
11432 IPv6 address) is not the same as specifing just <option>net-</option> without a number. In
11433 the former case the key strings include the mask value, whereas in the latter
11434 case the IP address is used on its own.
11437 <section id="SECThoslispatnam">
11438 <title>Host list patterns that match by host name</title>
11440 <indexterm role="concept">
11441 <primary>host</primary>
11442 <secondary>lookup failures</secondary>
11444 <indexterm role="concept">
11445 <primary>unknown host name</primary>
11447 <indexterm role="concept">
11448 <primary>host list</primary>
11449 <secondary>matching host name</secondary>
11451 There are several types of pattern that require Exim to know the name of the
11452 remote host. These are either wildcard patterns or lookups by name. (If a
11453 complete hostname is given without any wildcarding, it is used to find an IP
11454 address to match against, as described in the section <xref linkend="SECThoslispatip"/>
11458 If the remote host name is not already known when Exim encounters one of these
11459 patterns, it has to be found from the IP address.
11460 Although many sites on the Internet are conscientious about maintaining reverse
11461 DNS data for their hosts, there are also many that do not do this.
11462 Consequently, a name cannot always be found, and this may lead to unwanted
11463 effects. Take care when configuring host lists with wildcarded name patterns.
11464 Consider what will happen if a name cannot be found.
11467 Because of the problems of determining host names from IP addresses, matching
11468 against host names is not as common as matching against IP addresses.
11471 By default, in order to find a host name, Exim first does a reverse DNS lookup;
11472 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
11473 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
11474 are done can be changed by setting the <option>host_lookup_order</option> option.
11477 There are some options that control what happens if a host name cannot be
11478 found. These are described in section <xref linkend="SECTbehipnot"/> below.
11481 <indexterm role="concept">
11482 <primary>host</primary>
11483 <secondary>alias for</secondary>
11485 <indexterm role="concept">
11486 <primary>alias for host</primary>
11488 As a result of aliasing, hosts may have more than one name. When processing any
11489 of the following types of pattern, all the host’s names are checked:
11494 <indexterm role="concept">
11495 <primary>asterisk</primary>
11496 <secondary>in host list</secondary>
11498 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
11499 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
11500 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
11501 requirement. Other kinds of wildcarding require the use of a regular
11507 <indexterm role="concept">
11508 <primary>regular expressions</primary>
11509 <secondary>in host list</secondary>
11511 <indexterm role="concept">
11512 <primary>host list</primary>
11513 <secondary>regular expression in</secondary>
11515 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
11516 matched against the host name. For example,
11518 <literallayout class="monospaced">
11522 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
11523 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
11524 that backslash and dollar characters are not misinterpreted as part of the
11525 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
11526 part of the string as non-expandable. For example:
11528 <literallayout class="monospaced">
11529 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
11532 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
11533 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
11534 example. Without it, a match at the start of the host name is all that is
11540 <section id="SECTbehipnot">
11541 <title>Behaviour when an IP address or name cannot be found</title>
11543 <indexterm role="concept">
11544 <primary>host</primary>
11545 <secondary>lookup failures</secondary>
11547 While processing a host list, Exim may need to look up an IP address from a
11548 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
11549 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
11550 behaviour when it fails to find the information it is seeking is the same.
11553 <indexterm role="concept">
11554 <primary><literal>+include_unknown</literal></primary>
11556 <indexterm role="concept">
11557 <primary><literal>+ignore_unknown</literal></primary>
11559 By default, Exim behaves as if the host does not match the list. This may not
11560 always be what you want to happen. To change Exim’s behaviour, the special
11561 items <literal>+include_unknown</literal> or <literal>+ignore_unknown</literal> may appear in the list (at
11562 top level – they are not recognized in an indirected file).
11567 If any item that follows <literal>+include_unknown</literal> requires information that
11568 cannot found, Exim behaves as if the host does match the list. For example,
11570 <literallayout class="monospaced">
11571 host_reject_connection = +include_unknown:*.enemy.ex
11574 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
11575 any hosts whose name it cannot find.
11580 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
11581 be found, Exim ignores that item and proceeds to the rest of the list. For
11584 <literallayout class="monospaced">
11585 accept hosts = +ignore_unknown : friend.example : \
11589 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
11590 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
11591 name can be found for 192.168.4.5, it is rejected.
11596 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
11597 list. The effect of each one lasts until the next, or until the end of the
11600 <para revisionflag="changed">
11601 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
11602 apply to temporary DNS errors. They always cause a defer action (except when
11603 <option>dns_again_means_nonexist</option> converts them into permanent errors).
11606 <section id="SECThoslispatnamsk">
11607 <title>Host list patterns for single-key lookups by host name</title>
11609 <indexterm role="concept">
11610 <primary>host</primary>
11611 <secondary>lookup failures</secondary>
11613 <indexterm role="concept">
11614 <primary>unknown host name</primary>
11616 <indexterm role="concept">
11617 <primary>host list</primary>
11618 <secondary>matching host name</secondary>
11620 If a pattern is of the form
11623 <<emphasis>single-key-search-type</emphasis>>;<<emphasis>search-data</emphasis>>
11628 <literallayout class="monospaced">
11629 dbm;/host/accept/list
11632 a single-key lookup is performend, using the host name as its key. If the
11633 lookup succeeds, the host matches the item. The actual data that is looked up
11637 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
11638 keys in the file, not IP addresses. If you want to do lookups based on IP
11639 addresses, you must precede the search type with <quote>net-</quote> (see section
11640 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
11641 two items in the same list, one doing an address lookup and one doing a name
11642 lookup, both using the same file.
11646 <title>Host list patterns for query-style lookups</title>
11648 If a pattern is of the form
11651 <<emphasis>query-style-search-type</emphasis>>;<<emphasis>query</emphasis>>
11654 the query is obeyed, and if it succeeds, the host matches the item. The actual
11655 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
11656 <varname>$sender_host_name</varname> can be used in the query. For example:
11658 <literallayout class="monospaced">
11659 hosts_lookup = pgsql;\
11660 select ip from hostlist where ip='$sender_host_address'
11663 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
11664 can use the <option>sg</option> expansion item to change this if you need to. If you want to
11665 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
11669 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
11670 looks up the host name if has not already done so. (See section
11671 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
11674 Historical note: prior to release 4.30, Exim would always attempt to find a
11675 host name before running the query, unless the search type was preceded by
11676 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
11677 still recognized for query-style lookups, but its presence or absence has no
11678 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
11679 See section <xref linkend="SECThoslispatsikey"/>.)
11682 <section id="SECTmixwilhos">
11683 <title>Mixing wildcarded host names and addresses in host lists</title>
11685 <indexterm role="concept">
11686 <primary>host list</primary>
11687 <secondary>mixing names and addresses in</secondary>
11689 If you have name lookups or wildcarded host names and IP addresses in the same
11690 host list, you should normally put the IP addresses first. For example, in an
11691 ACL you could have:
11693 <literallayout class="monospaced">
11694 accept hosts = 10.9.8.7 : *.friend.example
11697 The reason for this lies in the left-to-right way that Exim processes lists.
11698 It can test IP addresses without doing any DNS lookups, but when it reaches an
11699 item that requires a host name, it fails if it cannot find a host name to
11700 compare with the pattern. If the above list is given in the opposite order, the
11701 <option>accept</option> statement fails for a host whose name cannot be found, even if its
11702 IP address is 10.9.8.7.
11705 If you really do want to do the name check first, and still recognize the IP
11706 address, you can rewrite the ACL like this:
11708 <literallayout class="monospaced">
11709 accept hosts = *.friend.example
11710 accept hosts = 10.9.8.7
11713 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
11714 <xref linkend="CHAPACL"/> for details of ACLs.
11717 <section id="SECTaddresslist">
11718 <title>Address lists</title>
11720 <indexterm role="concept">
11721 <primary>list</primary>
11722 <secondary>address list</secondary>
11724 <indexterm role="concept">
11725 <primary>address list</primary>
11726 <secondary>empty item</secondary>
11728 <indexterm role="concept">
11729 <primary>address list</primary>
11730 <secondary>patterns</secondary>
11732 Address lists contain patterns that are matched against mail addresses. There
11733 is one special case to be considered: the sender address of a bounce message is
11734 always empty. You can test for this by providing an empty item in an address
11735 list. For example, you can set up a router to process bounce messages by
11736 using this option setting:
11738 <literallayout class="monospaced">
11742 The presence of the colon creates an empty item. If you do not provide any
11743 data, the list is empty and matches nothing. The empty sender can also be
11744 detected by a regular expression that matches an empty string,
11745 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
11747 <para revisionflag="changed">
11748 Non-empty items in an address list can be straightforward email addresses. For
11751 <literallayout class="monospaced" revisionflag="changed">
11752 senders = jbc@askone.example : hs@anacreon.example
11754 <para revisionflag="changed">
11755 A certain amount of wildcarding is permitted. If a pattern contains an @
11756 character, but is not a regular expression and does not begin with a
11757 semicolon-terminated lookup type (described below), the local part of the
11758 subject address is compared with the local part of the pattern, which may start
11759 with an asterisk. If the local parts match, the domain is checked in exactly
11760 the same way as for a pattern in a domain list. For example, the domain can be
11761 wildcarded, refer to a named list, or be a lookup:
11763 <literallayout class="monospaced" revisionflag="changed">
11764 deny senders = *@*.spamming.site:\
11765 *@+hostile_domains:\
11766 bozo@partial-lsearch;/list/of/dodgy/sites:\
11767 *@dbm;/bad/domains.db
11769 <para revisionflag="changed">
11770 <indexterm role="concept">
11771 <primary>local part</primary>
11772 <secondary>starting with !</secondary>
11774 <indexterm role="concept">
11775 <primary>address list</primary>
11776 <secondary>local part starting with !</secondary>
11778 If a local part that begins with an exclamation mark is required, it has to be
11779 specified using a regular expression, because otherwise the exclamation mark is
11780 treated as a sign of negation, as is standard in lists.
11782 <para revisionflag="changed">
11783 If a non-empty pattern that is not a regular expression or a lookup does not
11784 contain an @ character, it is matched against the domain part of the subject
11785 address. The only two formats that are recognized this way are a literal
11786 domain, or a domain pattern that starts with *. In both these cases, the effect
11787 is the same as if <literal>*@</literal> preceded the pattern. For example:
11789 <literallayout class="monospaced" revisionflag="changed">
11790 deny senders = enemy.domain : *.enemy.domain
11792 <para revisionflag="changed">
11793 The following kinds of more complicated address list pattern can match any
11794 address, including the empty address that is characteristic of bounce message
11797 <itemizedlist revisionflag="changed">
11799 <para revisionflag="changed">
11800 <indexterm role="concept">
11801 <primary>regular expressions</primary>
11802 <secondary>in address list</secondary>
11804 <indexterm role="concept">
11805 <primary>address list</primary>
11806 <secondary>regular expression in</secondary>
11808 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
11809 done against the complete address, with the pattern as the regular expression.
11810 You must take care that backslash and dollar characters are not misinterpreted
11811 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
11812 to mark that part of the string as non-expandable. For example:
11814 <literallayout class="monospaced" revisionflag="changed">
11815 deny senders = \N^.*this.*@example\.com$\N : \
11816 \N^\d{8}.+@spamhaus.example$\N : ...
11818 <para revisionflag="changed">
11819 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
11820 start with <quote>^</quote> by the time they are being interpreted as address patterns.
11825 <indexterm role="concept">
11826 <primary>address list</primary>
11827 <secondary>lookup for complete address</secondary>
11829 Complete addresses can be looked up by using a pattern that starts with a
11830 lookup type terminated by a semicolon, followed by the data for the lookup. For
11833 <literallayout class="monospaced">
11834 deny senders = cdb;/etc/blocked.senders : \
11835 mysql;select address from blocked where \
11836 address='${quote_mysql:$sender_address}'
11839 Both query-style and single-key lookup types can be used. For a single-key
11840 lookup type, Exim uses the complete address as the key. However, empty keys are
11841 not supported for single-key lookups, so a match against the empty address
11842 always fails. This restriction does not apply to query-style lookups.
11845 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
11846 cannot be used, and is ignored if specified, with an entry being written to the
11848 <indexterm role="concept">
11849 <primary>*@ with single-key lookup</primary>
11851 However, you can configure lookup defaults, as described in section
11852 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
11853 default. For example, with this lookup:
11855 <literallayout class="monospaced">
11856 accept senders = lsearch*@;/some/file
11859 the file could contains lines like this:
11861 <literallayout class="monospaced">
11862 user1@domain1.example
11866 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
11869 <literallayout class="monospaced">
11870 nimrod@jaeger.example
11875 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
11876 would mean that every address matches, thus rendering the test useless.
11879 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
11881 <literallayout class="monospaced">
11882 deny recipients = dbm*@;/some/file
11883 deny recipients = *@dbm;/some/file
11886 The first does a whole address lookup, with defaulting, as just described,
11887 because it starts with a lookup type. The second matches the local part and
11888 domain independently, as described in a bullet point below.
11893 The following kinds of address list pattern can match only non-empty addresses.
11894 If the subject address is empty, a match against any of these pattern types
11900 <indexterm role="concept">
11901 <primary>@@ with single-key lookup</primary>
11903 <indexterm role="concept">
11904 <primary>address list</primary>
11905 <secondary>@@ lookup type</secondary>
11907 <indexterm role="concept">
11908 <primary>address list</primary>
11909 <secondary>split local part and domain</secondary>
11911 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
11912 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
11913 split into a local part and a domain. The domain is looked up in the file. If
11914 it is not found, there is no match. If it is found, the data that is looked up
11915 from the file is treated as a colon-separated list of local part patterns, each
11916 of which is matched against the subject local part in turn.
11919 <indexterm role="concept">
11920 <primary>asterisk</primary>
11921 <secondary>in address list</secondary>
11923 The lookup may be a partial one, and/or one involving a search for a default
11924 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
11925 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
11926 even be further lookups. They may also be independently negated. For example,
11929 <literallayout class="monospaced">
11930 deny senders = @@dbm;/etc/reject-by-domain
11933 the data from which the DBM file is built could contain lines like
11935 <literallayout class="monospaced">
11936 baddomain.com: !postmaster : *
11939 to reject all senders except <option>postmaster</option> from that domain.
11942 <indexterm role="concept">
11943 <primary>local part</primary>
11944 <secondary>starting with !</secondary>
11946 If a local part that actually begins with an exclamation mark is required, it
11947 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
11948 may be split over several lines by indenting the second and subsequent lines,
11949 but the separating colon must still be included at line breaks. White space
11950 surrounding the colons is ignored. For example:
11952 <literallayout class="monospaced">
11953 aol.com: spammer1 : spammer2 : ^[0-9]+$ :
11954 spammer3 : spammer4
11957 As in all colon-separated lists in Exim, a colon can be included in an item by
11961 If the last item in the list starts with a right angle-bracket, the remainder
11962 of the item is taken as a new key to look up in order to obtain a continuation
11963 list of local parts. The new key can be any sequence of characters. Thus one
11964 might have entries like
11966 <literallayout class="monospaced">
11967 aol.com: spammer1 : spammer 2 : >*
11968 xyz.com: spammer3 : >*
11972 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
11973 local parts for all domains, in addition to the specific local parts listed for
11974 each domain. Of course, using this feature costs another lookup each time a
11975 chain is followed, but the effort needed to maintain the data is reduced.
11978 <indexterm role="concept">
11979 <primary>loop</primary>
11980 <secondary>in lookups</secondary>
11982 It is possible to construct loops using this facility, and in order to catch
11983 them, the chains may be no more than fifty items long.
11988 The @@<<emphasis>lookup</emphasis>> style of item can also be used with a query-style
11989 lookup, but in this case, the chaining facility is not available. The lookup
11990 can only return a single list of local parts.
11995 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
11996 in these two examples:
11998 <literallayout class="monospaced">
12000 senders = *@+my_list
12003 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
12004 example it is a named domain list.
12007 <section id="SECTcasletadd">
12008 <title>Case of letters in address lists</title>
12010 <indexterm role="concept">
12011 <primary>case of local parts</primary>
12013 <indexterm role="concept">
12014 <primary>address list</primary>
12015 <secondary>case forcing</secondary>
12017 <indexterm role="concept">
12018 <primary>case forcing in address lists</primary>
12020 Domains in email addresses are always handled caselessly, but for local parts
12021 case may be significant on some systems (see <option>caseful_local_part</option> for how
12022 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
12023 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
12024 blocking lists should be done in a case-independent manner. Since most address
12025 lists in Exim are used for this kind of control, Exim attempts to do this by
12029 The domain portion of an address is always lowercased before matching it to an
12030 address list. The local part is lowercased by default, and any string
12031 comparisons that take place are done caselessly. This means that the data in
12032 the address list itself, in files included as plain file names, and in any file
12033 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
12034 keys in files that are looked up by a search type other than <command>lsearch</command> (which
12035 works caselessly) must be in lower case, because these lookups are not
12039 <indexterm role="concept">
12040 <primary><literal>+caseful</literal></primary>
12042 To allow for the possibility of caseful address list matching, if an item in
12043 an address list is the string <quote>+caseful</quote>, the original case of the local
12044 part is restored for any comparisons that follow, and string comparisons are no
12045 longer case-independent. This does not affect the domain, which remains in
12046 lower case. However, although independent matches on the domain alone are still
12047 performed caselessly, regular expressions that match against an entire address
12048 become case-sensitive after <quote>+caseful</quote> has been seen.
12051 <section id="SECTlocparlis">
12052 <title>Local part lists</title>
12054 <indexterm role="concept">
12055 <primary>list</primary>
12056 <secondary>local part list</secondary>
12058 <indexterm role="concept">
12059 <primary>local part</primary>
12060 <secondary>list</secondary>
12062 Case-sensitivity in local part lists is handled in the same way as for address
12063 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
12064 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
12065 set false, the subject is lowercased and the matching is initially
12066 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
12067 matching in the local part list, but not elsewhere in the router. If
12068 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
12069 option is case-sensitive from the start.
12072 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
12073 comments are handled in the same way as address lists – they are recognized
12074 only if the # is preceded by white space or the start of the line.
12075 Otherwise, local part lists are matched in the same way as domain lists, except
12076 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
12077 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
12078 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
12080 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
12085 <chapter id="CHAPexpand">
12086 <title>String expansions</title>
12088 <indexterm role="concept" id="IIDstrexp" class="startofrange">
12089 <primary>expansion</primary>
12090 <secondary>of strings</secondary>
12092 Many strings in Exim’s run time configuration are expanded before use. Some of
12093 them are expanded every time they are used; others are expanded only once.
12096 When a string is being expanded it is copied verbatim from left to right except
12097 when a dollar or backslash character is encountered. A dollar specifies the
12098 start of a portion of the string that is interpreted and replaced as described
12099 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
12100 escape character, as described in the following section.
12102 <section id="SECTlittext">
12103 <title>Literal text in expanded strings</title>
12105 <indexterm role="concept">
12106 <primary>expansion</primary>
12107 <secondary>including literal text</secondary>
12109 An uninterpreted dollar can be included in an expanded string by putting a
12110 backslash in front of it. A backslash can be used to prevent any special
12111 character being treated specially in an expansion, including backslash itself.
12112 If the string appears in quotes in the configuration file, two backslashes are
12113 required because the quotes themselves cause interpretation of backslashes when
12114 the string is read in (see section <xref linkend="SECTstrings"/>).
12117 <indexterm role="concept">
12118 <primary>expansion</primary>
12119 <secondary>non-expandable substrings</secondary>
12121 A portion of the string can specified as non-expandable by placing it between
12122 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
12123 expressions, which often contain backslashes and dollar signs. For example:
12125 <literallayout class="monospaced">
12126 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
12129 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
12130 without interpretation until it reaches the next <literal>\N</literal> or the end of the
12135 <title>Character escape sequences in expanded strings</title>
12137 <indexterm role="concept">
12138 <primary>expansion</primary>
12139 <secondary>escape sequences</secondary>
12141 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
12142 expanded string is recognized as an escape sequence for the character newline,
12143 carriage return, or tab, respectively. A backslash followed by up to three
12144 octal digits is recognized as an octal encoding for a single character, and a
12145 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
12149 These escape sequences are also recognized in quoted strings when they are read
12150 in. Their interpretation in expansions as well is useful for unquoted strings,
12151 and for other cases such as looked-up strings that are then expanded.
12155 <title>Testing string expansions</title>
12157 <indexterm role="concept">
12158 <primary>expansion</primary>
12159 <secondary>testing</secondary>
12161 <indexterm role="concept">
12162 <primary>testing</primary>
12163 <secondary>string expansion</secondary>
12165 <indexterm role="concept">
12166 <primary><option>-be</option> option</primary>
12168 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
12169 takes the command arguments, or lines from the standard input if there are no
12170 arguments, runs them through the string expansion code, and writes the results
12171 to the standard output. Variables based on configuration values are set up, but
12172 since no message is being processed, variables such as <varname>$local_part</varname> have no
12173 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
12174 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
12175 and <option>nhash</option>.
12178 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
12179 instead runs under the uid and gid it was called with, to prevent users from
12180 using <option>-be</option> for reading files to which they do not have access.
12183 <section id="SECTforexpfai">
12184 <title>Forced expansion failure</title>
12186 <indexterm role="concept">
12187 <primary>expansion</primary>
12188 <secondary>forced failure</secondary>
12190 A number of expansions that are described in the following section have
12191 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
12192 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
12193 used depends on some condition that is evaluated as part of the expansion. If,
12194 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
12195 the entire string expansion fails in a way that can be detected by the code
12196 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
12197 its consequences depend on the circumstances. In some cases it is no different
12198 from any other expansion failure, but in others a different action may be
12199 taken. Such variations are mentioned in the documentation of the option that is
12203 <section id="SECTexpansionitems">
12204 <title>Expansion items</title>
12206 The following items are recognized in expanded strings. White space may be used
12207 between sub-items that are keywords or substrings enclosed in braces inside an
12208 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
12209 white space is significant.
12213 <term><emphasis role="bold">$</emphasis><<emphasis>variable name</emphasis>> or <emphasis role="bold">${</emphasis><<emphasis>variable name</emphasis>><emphasis role="bold">}</emphasis></term>
12216 <indexterm role="concept">
12217 <primary>expansion</primary>
12218 <secondary>variables</secondary>
12220 Substitute the contents of the named variable, for example:
12222 <literallayout class="monospaced">
12227 The second form can be used to separate the name from subsequent alphanumeric
12228 characters. This form (using braces) is available only for variables; it does
12229 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
12230 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
12231 given, the expansion fails.
12233 </listitem></varlistentry>
12235 <term><emphasis role="bold">${</emphasis><<emphasis>op</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
12238 <indexterm role="concept">
12239 <primary>expansion</primary>
12240 <secondary>operators</secondary>
12242 The string is first itself expanded, and then the operation specified by
12243 <<emphasis>op</emphasis>> is applied to it. For example:
12245 <literallayout class="monospaced">
12249 The string starts with the first character after the colon, which may be
12250 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
12251 below. The operator notation is used for simple expansion items that have just
12252 one argument, because it reduces the number of braces and therefore makes the
12253 string easier to understand.
12255 </listitem></varlistentry>
12257 <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>
12260 <indexterm role="concept">
12261 <primary><option>dlfunc</option></primary>
12263 This expansion dynamically loads and then calls a locally-written C function.
12264 This functionality is available only if Exim is compiled with
12266 <literallayout class="monospaced">
12270 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
12271 object so that it doesn’t reload the same object file in the same Exim process
12272 (but of course Exim does start new processes frequently).
12275 There may be from zero to eight arguments to the function. When compiling
12276 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
12277 included. The Exim variables and functions that are defined by that API
12278 are also available for dynamically loaded functions. The function itself
12279 must have the following type:
12281 <literallayout class="monospaced">
12282 int dlfunction(uschar **yield, int argc, uschar *argv[])
12285 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
12286 function should return one of the following values:
12289 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
12290 into the expanded string that is being built.
12293 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
12294 from <emphasis>yield</emphasis>, if it is set.
12297 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
12298 taken from <emphasis>yield</emphasis> if it is set.
12301 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
12304 When compiling a function that is to be used in this way with gcc,
12305 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
12306 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
12308 </listitem></varlistentry>
12310 <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>
12313 <indexterm role="concept">
12314 <primary>expansion</primary>
12315 <secondary>extracting substrings by key</secondary>
12317 <indexterm role="concept">
12318 <primary><option>extract</option></primary>
12319 <secondary>substrings by key</secondary>
12321 The key and <<emphasis>string1</emphasis>> are first expanded separately. Leading and trailing
12322 white space is removed from the key (but not from any of the strings). The key
12323 must not consist entirely of digits. The expanded <<emphasis>string1</emphasis>> must be of the
12327 <<emphasis>key1</emphasis>> = <<emphasis>value1</emphasis>> <<emphasis>key2</emphasis>> = <<emphasis>value2</emphasis>> ...
12330 <indexterm role="concept">
12331 <primary><varname>$value</varname></primary>
12333 where the equals signs and spaces (but not both) are optional. If any of the
12334 values contain white space, they must be enclosed in double quotes, and any
12335 values that are enclosed in double quotes are subject to escape processing as
12336 described in section <xref linkend="SECTstrings"/>. The expanded <<emphasis>string1</emphasis>> is searched
12337 for the value that corresponds to the key. The search is case-insensitive. If
12338 the key is found, <<emphasis>string2</emphasis>> is expanded, and replaces the whole item;
12339 otherwise <<emphasis>string3</emphasis>> is used. During the expansion of <<emphasis>string2</emphasis>> the
12340 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
12341 is restored to any previous value it might have had.
12344 If {<<emphasis>string3</emphasis>>} is omitted, the item is replaced by an empty string if the
12345 key is not found. If {<<emphasis>string2</emphasis>>} is also omitted, the value that was
12346 extracted is used. Thus, for example, these two expansions are identical, and
12347 yield <quote>2001</quote>:
12349 <literallayout class="monospaced">
12350 ${extract{gid}{uid=1984 gid=2001}}
12351 ${extract{gid}{uid=1984 gid=2001}{$value}}
12354 Instead of {<<emphasis>string3</emphasis>>} the word <quote>fail</quote> (not in curly brackets) can
12355 appear, for example:
12357 <literallayout class="monospaced">
12358 ${extract{Z}{A=... B=...}{$value} fail }
12361 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
12362 {<<emphasis>string2</emphasis>>} must be present for <quote>fail</quote> to be recognized.
12364 </listitem></varlistentry>
12366 <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>
12369 <indexterm role="concept">
12370 <primary>expansion</primary>
12371 <secondary>extracting substrings by number</secondary>
12373 <indexterm role="concept">
12374 <primary><option>extract</option></primary>
12375 <secondary>substrings by number</secondary>
12377 The <<emphasis>number</emphasis>> argument must consist entirely of decimal digits,
12378 apart from leading and trailing white space, which is ignored.
12379 This is what distinguishes this form of <option>extract</option> from the previous kind. It
12380 behaves in the same way, except that, instead of extracting a named field, it
12381 extracts from <<emphasis>string1</emphasis>> the field whose number is given as the first
12382 argument. You can use <varname>$value</varname> in <<emphasis>string2</emphasis>> or <literal>fail</literal> instead of
12383 <<emphasis>string3</emphasis>> as before.
12386 The fields in the string are separated by any one of the characters in the
12387 separator string. These may include space or tab characters.
12388 The first field is numbered one. If the number is negative, the fields are
12389 counted from the end of the string, with the rightmost one numbered -1. If the
12390 number given is zero, the entire string is returned. If the modulus of the
12391 number is greater than the number of fields in the string, the result is the
12392 expansion of <<emphasis>string3</emphasis>>, or the empty string if <<emphasis>string3</emphasis>> is not
12393 provided. For example:
12395 <literallayout class="monospaced">
12396 ${extract{2}{:}{x:42:99:& Mailer::/bin/bash}}
12399 yields <quote>42</quote>, and
12401 <literallayout class="monospaced">
12402 ${extract{-4}{:}{x:42:99:& Mailer::/bin/bash}}
12405 yields <quote>99</quote>. Two successive separators mean that the field between them is
12406 empty (for example, the fifth field above).
12408 </listitem></varlistentry>
12410 <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>
12413 <indexterm role="concept">
12414 <primary>hash function</primary>
12415 <secondary>textual</secondary>
12417 <indexterm role="concept">
12418 <primary>expansion</primary>
12419 <secondary>textual hash</secondary>
12421 This is a textual hashing function, and was the first to be implemented in
12422 early versions of Exim. In current releases, there are other hashing functions
12423 (numeric, MD5, and SHA-1), which are described below.
12426 The first two strings, after expansion, must be numbers. Call them <<emphasis>m</emphasis>> and
12427 <<emphasis>n</emphasis>>. If you are using fixed values for these numbers, that is, if
12428 <<emphasis>string1</emphasis>> and <<emphasis>string2</emphasis>> do not change when they are expanded, you can
12429 use the simpler operator notation that avoids some of the braces:
12431 <literallayout class="monospaced">
12432 ${hash_<n>_<m>:<string>}
12435 The second number is optional (in both notations). If <<emphasis>n</emphasis>> is greater than
12436 or equal to the length of the string, the expansion item returns the string.
12437 Otherwise it computes a new string of length <<emphasis>n</emphasis>> by applying a hashing
12438 function to the string. The new string consists of characters taken from the
12439 first <<emphasis>m</emphasis>> characters of the string
12441 <literallayout class="monospaced">
12442 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
12445 If <<emphasis>m</emphasis>> is not present the value 26 is used, so that only lower case
12446 letters appear. For example:
12449 <literal>$hash{3}{monty}} </literal> yields <literal>jmg</literal>
12450 <literal>$hash{5}{monty}} </literal> yields <literal>monty</literal>
12451 <literal>$hash{4}{62}{monty python}}</literal> yields <literal>fbWx</literal>
12453 </listitem></varlistentry>
12455 <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>
12458 See <emphasis role="bold">$rheader</emphasis> below.
12460 </listitem></varlistentry>
12462 <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>
12465 See <emphasis role="bold">$rheader</emphasis> below.
12467 </listitem></varlistentry>
12469 <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>
12472 <indexterm role="concept">
12473 <primary>expansion</primary>
12474 <secondary>header insertion</secondary>
12476 <indexterm role="concept">
12477 <primary><varname>$header_</varname></primary>
12479 <indexterm role="concept">
12480 <primary><varname>$bheader_</varname></primary>
12482 <indexterm role="concept">
12483 <primary><varname>$rheader_</varname></primary>
12485 <indexterm role="concept">
12486 <primary>header lines</primary>
12487 <secondary>in expansion strings</secondary>
12489 <indexterm role="concept">
12490 <primary>header lines</primary>
12491 <secondary>character sets</secondary>
12493 <indexterm role="concept">
12494 <primary>header lines</primary>
12495 <secondary>decoding</secondary>
12497 Substitute the contents of the named message header line, for example
12499 <literallayout class="monospaced">
12503 The newline that terminates a header line is not included in the expansion, but
12504 internal newlines (caused by splitting the header line over several physical
12505 lines) may be present.
12508 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
12509 the data in the header line is interpreted.
12514 <indexterm role="concept">
12515 <primary>white space</primary>
12516 <secondary>in header lines</secondary>
12518 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
12519 processing at all, and without the removal of leading and trailing white space.
12524 <indexterm role="concept">
12525 <primary>base64 encoding</primary>
12526 <secondary>in header lines</secondary>
12528 <option>bheader</option> removes leading and trailing white space, and then decodes base64
12529 or quoted-printable MIME <quote>words</quote> within the header text, but does no
12530 character set translation. If decoding of what looks superficially like a MIME
12531 <quote>word</quote> fails, the raw string is returned. If decoding
12532 <indexterm role="concept">
12533 <primary>binary zero</primary>
12534 <secondary>in header line</secondary>
12536 produces a binary zero character, it is replaced by a question mark – this is
12537 what Exim does for binary zeros that are actually received in header lines.
12542 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
12543 standard character set. This is an attempt to produce the same string as would
12544 be displayed on a user’s MUA. If translation fails, the <option>bheader</option> string is
12545 returned. Translation is attempted only on operating systems that support the
12546 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
12547 a system Makefile or in <filename>Local/Makefile</filename>.
12552 In a filter file, the target character set for <option>header</option> can be specified by a
12553 command of the following form:
12555 <literallayout class="monospaced">
12556 headers charset "UTF-8"
12559 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
12560 subsequently obeyed filter commands. In the absence of this command, the target
12561 character set in a filter is taken from the setting of the <option>headers_charset</option>
12562 option in the runtime configuration. The value of this option defaults to the
12563 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
12567 Header names follow the syntax of RFC 2822, which states that they may contain
12568 any printing characters except space and colon. Consequently, curly brackets
12569 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
12570 if they were variables. Attempting to do so causes a syntax error.
12573 Only header lines that are common to all copies of a message are visible to
12574 this mechanism. These are the original header lines that are received with the
12575 message, and any that are added by an ACL <option>warn</option> statement or by a system
12576 filter. Header lines that are added to a particular copy of a message by a
12577 router or transport are not accessible.
12580 For incoming SMTP messages, no header lines are visible in ACLs that are obeyed
12581 before the DATA ACL, because the header structure is not set up until the
12582 message is received. Header lines that are added by <option>warn</option> statements in a
12583 RCPT ACL (for example) are saved until the message’s incoming header lines
12584 are available, at which point they are added. When a DATA ACL is running,
12585 however, header lines added by earlier ACLs are visible.
12588 Upper case and lower case letters are synonymous in header names. If the
12589 following character is white space, the terminating colon may be omitted, but
12590 this is not recommended, because you may then forget it when it is needed. When
12591 white space terminates the header name, it is included in the expanded string.
12592 If the message does not contain the given header, the expansion item is
12593 replaced by an empty string. (See the <option>def</option> condition in section
12594 <xref linkend="SECTexpcond"/> for a means of testing for the existence of a header.)
12597 If there is more than one header with the same name, they are all
12598 concatenated to form the substitution string, up to a maximum length of 64K. A
12599 newline character is inserted between each line. For the <option>header</option> expansion,
12600 for those headers that contain lists of addresses, a comma is also inserted at
12601 the junctions between lines. This does not happen for the <option>rheader</option>
12604 </listitem></varlistentry>
12606 <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>
12609 <indexterm role="concept">
12610 <primary>expansion</primary>
12611 <secondary>hmac hashing</secondary>
12613 <indexterm role="concept">
12614 <primary><option>hmac</option></primary>
12616 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
12617 shared secret and some text into a message authentication code, as specified in
12618 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
12619 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
12620 cryptographic hash, allowing for authentication that is not possible with MD5
12621 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
12622 present. For example:
12624 <literallayout class="monospaced">
12625 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
12628 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
12631 <literallayout class="monospaced">
12632 dd97e3ba5d1a61b5006108f8c8252953
12635 As an example of how this might be used, you might put in the main part of
12636 an Exim configuration:
12638 <literallayout class="monospaced">
12639 SPAMSCAN_SECRET=cohgheeLei2thahw
12642 In a router or a transport you could then have:
12644 <literallayout class="monospaced">
12646 X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
12647 ${hmac{md5}{SPAMSCAN_SECRET}\
12648 {${primary_hostname},${message_exim_id},$h_message-id:}}
12651 Then given a message, you can check where it was scanned by looking at the
12652 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
12653 this header line is authentic by recomputing the authentication code from the
12654 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
12655 using Exim’s <option>-be</option> option, or by other means, for example by using the
12656 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
12658 </listitem></varlistentry>
12660 <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>
12663 <indexterm role="concept">
12664 <primary>expansion</primary>
12665 <secondary>conditional</secondary>
12667 <indexterm role="concept">
12668 <primary><option>if</option>, expansion item</primary>
12670 If <<emphasis>condition</emphasis>> is true, <<emphasis>string1</emphasis>> is expanded and replaces the whole
12671 item; otherwise <<emphasis>string2</emphasis>> is used. The available conditions are described
12672 in section <xref linkend="SECTexpcond"/> below. For example:
12674 <literallayout class="monospaced">
12675 ${if eq {$local_part}{postmaster} {yes}{no} }
12678 The second string need not be present; if it is not and the condition is not
12679 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
12680 be present instead of the second string (without any curly brackets). In this
12681 case, the expansion is forced to fail if the condition is not true (see section
12682 <xref linkend="SECTforexpfai"/>).
12685 If both strings are omitted, the result is the string <literal>true</literal> if the condition
12686 is true, and the empty string if the condition is false. This makes it less
12687 cumbersome to write custom ACL and router conditions. For example, instead of
12689 <literallayout class="monospaced">
12690 condition = ${if >{$acl_m4}{3}{true}{false}}
12695 <literallayout class="monospaced">
12696 condition = ${if >{$acl_m4}{3}}
12698 </listitem></varlistentry>
12700 <term><emphasis role="bold">${length{</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}}</emphasis></term>
12703 <indexterm role="concept">
12704 <primary>expansion</primary>
12705 <secondary>string truncation</secondary>
12707 <indexterm role="concept">
12708 <primary><option>length</option></primary>
12709 <secondary>expansion item</secondary>
12711 The <option>length</option> item is used to extract the initial portion of a string. Both
12712 strings are expanded, and the first one must yield a number, <<emphasis>n</emphasis>>, say. If
12713 you are using a fixed value for the number, that is, if <<emphasis>string1</emphasis>> does not
12714 change when expanded, you can use the simpler operator notation that avoids
12715 some of the braces:
12717 <literallayout class="monospaced">
12718 ${length_<n>:<string>}
12721 The result of this item is either the first <<emphasis>n</emphasis>> characters or the whole
12722 of <<emphasis>string2</emphasis>>, whichever is the shorter. Do not confuse <option>length</option> with
12723 <option>strlen</option>, which gives the length of a string.
12725 </listitem></varlistentry>
12727 <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>
12730 This is the first of one of two different types of lookup item, which are both
12731 described in the next item.
12733 </listitem></varlistentry>
12735 <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>
12738 <indexterm role="concept">
12739 <primary>expansion</primary>
12740 <secondary>lookup in</secondary>
12742 <indexterm role="concept">
12743 <primary>file</primary>
12744 <secondary>lookups</secondary>
12746 <indexterm role="concept">
12747 <primary>lookup</primary>
12748 <secondary>in expanded string</secondary>
12750 The two forms of lookup item specify data lookups in files and databases, as
12751 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
12752 lookups, and the second is used for query-style lookups. The <<emphasis>key</emphasis>>,
12753 <<emphasis>file</emphasis>>, and <<emphasis>query</emphasis>> strings are expanded before use.
12756 If there is any white space in a lookup item which is part of a filter command,
12757 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
12758 other place where white space is significant, the lookup item must be enclosed
12759 in double quotes. The use of data lookups in users’ filter files may be locked
12760 out by the system administrator.
12763 <indexterm role="concept">
12764 <primary><varname>$value</varname></primary>
12766 If the lookup succeeds, <<emphasis>string1</emphasis>> is expanded and replaces the entire item.
12767 During its expansion, the variable <varname>$value</varname> contains the data returned by the
12768 lookup. Afterwards it reverts to the value it had previously (at the outer
12769 level it is empty). If the lookup fails, <<emphasis>string2</emphasis>> is expanded and replaces
12770 the entire item. If {<<emphasis>string2</emphasis>>} is omitted, the replacement is the empty
12771 string on failure. If <<emphasis>string2</emphasis>> is provided, it can itself be a nested
12772 lookup, thus providing a mechanism for looking up a default value when the
12773 original lookup fails.
12776 If a nested lookup is used as part of <<emphasis>string1</emphasis>>, <varname>$value</varname> contains the
12777 data for the outer lookup while the parameters of the second lookup are
12778 expanded, and also while <<emphasis>string2</emphasis>> of the second lookup is expanded, should
12779 the second lookup fail. Instead of {<<emphasis>string2</emphasis>>} the word <quote>fail</quote> can
12780 appear, and in this case, if the lookup fails, the entire expansion is forced
12781 to fail (see section <xref linkend="SECTforexpfai"/>). If both {<<emphasis>string1</emphasis>>} and
12782 {<<emphasis>string2</emphasis>>} are omitted, the result is the looked up value in the case of a
12783 successful lookup, and nothing in the case of failure.
12786 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
12787 search type in order to do partial matching, and * or *@ may follow a search
12788 type to request default lookups if the key does not match (see sections
12789 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
12792 <indexterm role="concept">
12793 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
12794 <secondary>in lookup expansion</secondary>
12796 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
12797 and non-wild parts of the key during the expansion of the replacement text.
12798 They return to their previous values at the end of the lookup item.
12801 This example looks up the postmaster alias in the conventional alias file:
12803 <literallayout class="monospaced">
12804 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
12807 This example uses NIS+ to look up the full name of the user corresponding to
12808 the local part of an address, forcing the expansion to fail if it is not found:
12810 <literallayout class="monospaced">
12811 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
12814 </listitem></varlistentry>
12816 <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>
12819 <indexterm role="concept">
12820 <primary>expansion</primary>
12821 <secondary>numeric hash</secondary>
12823 <indexterm role="concept">
12824 <primary>hash function</primary>
12825 <secondary>numeric</secondary>
12827 The three strings are expanded; the first two must yield numbers. Call them
12828 <<emphasis>n</emphasis>> and <<emphasis>m</emphasis>>. If you are using fixed values for these numbers, that is,
12829 if <<emphasis>string1</emphasis>> and <<emphasis>string2</emphasis>> do not change when they are expanded, you
12830 can use the simpler operator notation that avoids some of the braces:
12832 <literallayout class="monospaced">
12833 ${nhash_<n>_<m>:<string>}
12836 The second number is optional (in both notations). If there is only one number,
12837 the result is a number in the range 0–<<emphasis>n</emphasis>>-1. Otherwise, the string is
12838 processed by a div/mod hash function that returns two numbers, separated by a
12839 slash, in the ranges 0 to <<emphasis>n</emphasis>>-1 and 0 to <<emphasis>m</emphasis>>-1, respectively. For
12842 <literallayout class="monospaced">
12843 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
12846 returns the string <quote>6/33</quote>.
12848 </listitem></varlistentry>
12850 <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>
12853 <indexterm role="concept">
12854 <primary>Perl</primary>
12855 <secondary>use in expanded string</secondary>
12857 <indexterm role="concept">
12858 <primary>expansion</primary>
12859 <secondary>calling Perl from</secondary>
12861 This item is available only if Exim has been built to include an embedded Perl
12862 interpreter. The subroutine name and the arguments are first separately
12863 expanded, and then the Perl subroutine is called with those arguments. No
12864 additional arguments need be given; the maximum number permitted, including the
12865 name of the subroutine, is nine.
12868 The return value of the subroutine is inserted into the expanded string, unless
12869 the return value is <option>undef</option>. In that case, the expansion fails in the same
12870 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
12871 Whatever you return is evaluated in a scalar context. For example, if you
12872 return the name of a Perl vector, the return value is the size of the vector,
12876 If the subroutine exits by calling Perl’s <option>die</option> function, the expansion fails
12877 with the error message that was passed to <option>die</option>. More details of the embedded
12878 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
12881 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
12882 out the use of this expansion item in filter files.
12884 </listitem></varlistentry>
12886 <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>
12889 <indexterm role="concept">
12890 <primary>prvs</primary>
12891 <secondary>expansion item</secondary>
12893 The first argument is a complete email address and the second is secret
12894 keystring. The third argument, specifying a key number, is optional. If absent,
12895 it defaults to 0. The result of the expansion is a prvs-signed email address,
12896 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
12897 as part of a bounce address tag validation (BATV) scheme. For more discussion
12898 and an example, see section <xref linkend="SECTverifyPRVS"/>.
12900 </listitem></varlistentry>
12902 <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>
12905 <indexterm role="concept">
12906 <primary>prvscheck</primary>
12907 <secondary>expansion item</secondary>
12909 This expansion item is the complement of the <option>prvs</option> item. It is used for
12910 checking prvs-signed addresses. If the expansion of the first argument does not
12911 yield a syntactically valid prvs-signed address, the whole item expands to the
12912 empty string. When the first argument does expand to a syntactically valid
12913 prvs-signed address, the second argument is expanded, with the prvs-decoded
12914 version of the address and the key number extracted from the address in the
12915 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
12918 These two variables can be used in the expansion of the second argument to
12919 retrieve the secret. The validity of the prvs-signed address is then checked
12920 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
12921 which is empty for failure or <quote>1</quote> for success.
12924 The third argument is optional; if it is missing, it defaults to an empty
12925 string. This argument is now expanded. If the result is an empty string, the
12926 result of the expansion is the decoded version of the address. This is the case
12927 whether or not the signature was valid. Otherwise, the result of the expansion
12928 is the expansion of the third argument.
12931 All three variables can be used in the expansion of the third argument.
12932 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
12933 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
12935 </listitem></varlistentry>
12937 <term><emphasis role="bold">${readfile{</emphasis><<emphasis>file name</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>eol string</emphasis>><emphasis role="bold">}}</emphasis></term>
12940 <indexterm role="concept">
12941 <primary>expansion</primary>
12942 <secondary>inserting an entire file</secondary>
12944 <indexterm role="concept">
12945 <primary>file</primary>
12946 <secondary>inserting into expansion</secondary>
12948 <indexterm role="concept">
12949 <primary><option>readfile</option> expansion item</primary>
12951 The file name and end-of-line string are first expanded separately. The file is
12952 then read, and its contents replace the entire item. All newline characters in
12953 the file are replaced by the end-of-line string if it is present. Otherwise,
12954 newlines are left in the string.
12955 String expansion is not applied to the contents of the file. If you want this,
12956 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
12957 the string expansion fails.
12960 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
12961 locks out the use of this expansion item in filter files.
12963 </listitem></varlistentry>
12965 <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>
12968 <indexterm role="concept">
12969 <primary>expansion</primary>
12970 <secondary>inserting from a socket</secondary>
12972 <indexterm role="concept">
12973 <primary>socket</primary>
12974 <secondary>use of in expansion</secondary>
12976 <indexterm role="concept">
12977 <primary><option>readsocket</option> expansion item</primary>
12979 This item inserts data that is read from a Unix domain socket into the expanded
12980 string. The minimal way of using it uses just two arguments:
12982 <literallayout class="monospaced">
12983 ${readsocket{/socket/name}{request string}}
12986 Exim connects to the socket, writes the request string (unless it is an
12987 empty string) and reads from the socket until an end-of-file is read. A timeout
12988 of 5 seconds is applied. Additional, optional arguments extend what can be
12989 done. Firstly, you can vary the timeout. For example:
12991 <literallayout class="monospaced">
12992 ${readsocket{/socket/name}{request-string}{3s}}
12995 A fourth argument allows you to change any newlines that are in the data
12996 that is read, in the same way as for <option>readfile</option> (see above). This example
12997 turns them into spaces:
12999 <literallayout class="monospaced">
13000 ${readsocket{/socket/name}{request-string}{3s}{ }}
13003 As with all expansions, the substrings are expanded before the processing
13004 happens. Errors in these sub-expansions cause the expansion to fail. In
13005 addition, the following errors can occur:
13010 Failure to create a socket file descriptor;
13015 Failure to connect the socket;
13020 Failure to write the request-string;
13025 Timeout on reading from the socket.
13030 By default, any of these errors causes the expansion to fail. However, if
13031 you supply a fifth substring, it is expanded and used when any of the above
13032 errors occurs. For example:
13034 <literallayout class="monospaced">
13035 ${readsocket{/socket/name}{request-string}{3s}{\n}\
13039 You can test for the existence of the socket by wrapping this expansion in
13040 <literal>${if exists</literal>, but there is a race condition between that test and the
13041 actual opening of the socket, so it is safer to use the fifth argument if you
13042 want to be absolutely sure of avoiding an expansion error for a non-existent
13046 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
13047 locks out the use of this expansion item in filter files.
13049 </listitem></varlistentry>
13051 <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>
13054 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
13055 expansion item above.
13057 </listitem></varlistentry>
13059 <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>
13062 <indexterm role="concept">
13063 <primary>expansion</primary>
13064 <secondary>running a command</secondary>
13066 <indexterm role="concept">
13067 <primary><option>run</option> expansion item</primary>
13069 The command and its arguments are first expanded separately, and then the
13070 command is run in a separate process, but under the same uid and gid. As in
13071 other command executions from Exim, a shell is not used by default. If you want
13072 a shell, you must explicitly code it.
13075 <indexterm role="concept">
13076 <primary>return code</primary>
13077 <secondary>from <option>run</option> expansion</secondary>
13079 <indexterm role="concept">
13080 <primary><varname>$value</varname></primary>
13082 If the command succeeds (gives a zero return code) <<emphasis>string1</emphasis>> is expanded
13083 and replaces the entire item; during this expansion, the standard output from
13084 the command is in the variable <varname>$value</varname>. If the command fails, <<emphasis>string2</emphasis>>,
13085 if present, is expanded and used. Once again, during the expansion, the
13086 standard output from the command is in the variable <varname>$value</varname>. If <<emphasis>string2</emphasis>>
13087 is absent, the result is empty. Alternatively, <<emphasis>string2</emphasis>> can be the word
13088 <quote>fail</quote> (not in braces) to force expansion failure if the command does not
13089 succeed. If both strings are omitted, the result is contents of the standard
13090 output on success, and nothing on failure.
13093 <indexterm role="concept">
13094 <primary><varname>$runrc</varname></primary>
13096 The return code from the command is put in the variable <varname>$runrc</varname>, and this
13097 remains set afterwards, so in a filter file you can do things like this:
13099 <literallayout class="monospaced">
13100 if "${run{x y z}{}}$runrc" is 1 then ...
13101 elif $runrc is 2 then ...
13106 If execution of the command fails (for example, the command does not exist),
13107 the return code is 127 – the same code that shells use for non-existent
13111 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
13112 option values are expanded, except for those preconditions whose order of
13113 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
13114 by the expansion of one option, and use it in another.
13117 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
13118 out the use of this expansion item in filter files.
13120 </listitem></varlistentry>
13122 <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>
13125 <indexterm role="concept">
13126 <primary>expansion</primary>
13127 <secondary>string substitution</secondary>
13129 <indexterm role="concept">
13130 <primary><option>sg</option> expansion item</primary>
13132 This item works like Perl’s substitution operator (s) with the global (/g)
13133 option; hence its name. However, unlike the Perl equivalent, Exim does not
13134 modify the subject string; instead it returns the modified string for insertion
13135 into the overall expansion. The item takes three arguments: the subject string,
13136 a regular expression, and a substitution string. For example:
13138 <literallayout class="monospaced">
13139 ${sg{abcdefabcdef}{abc}{xyz}}
13142 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
13143 if any $ or \ characters are required in the regular expression or in the
13144 substitution string, they have to be escaped. For example:
13146 <literallayout class="monospaced">
13147 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
13150 yields <quote>defabc</quote>, and
13152 <literallayout class="monospaced">
13153 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
13156 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
13157 the regular expression from string expansion.
13159 </listitem></varlistentry>
13161 <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>
13164 <indexterm role="concept">
13165 <primary><option>substr</option></primary>
13167 <indexterm role="concept">
13168 <primary>substring extraction</primary>
13170 <indexterm role="concept">
13171 <primary>expansion</primary>
13172 <secondary>substring extraction</secondary>
13174 The three strings are expanded; the first two must yield numbers. Call them
13175 <<emphasis>n</emphasis>> and <<emphasis>m</emphasis>>. If you are using fixed values for these numbers, that is,
13176 if <<emphasis>string1</emphasis>> and <<emphasis>string2</emphasis>> do not change when they are expanded, you
13177 can use the simpler operator notation that avoids some of the braces:
13179 <literallayout class="monospaced">
13180 ${substr_<n>_<m>:<string>}
13183 The second number is optional (in both notations).
13184 If it is absent in the simpler format, the preceding underscore must also be
13188 The <option>substr</option> item can be used to extract more general substrings than
13189 <option>length</option>. The first number, <<emphasis>n</emphasis>>, is a starting offset, and <<emphasis>m</emphasis>> is the
13190 length required. For example
13192 <literallayout class="monospaced">
13193 ${substr{3}{2}{$local_part}}
13196 If the starting offset is greater than the string length the result is the
13197 null string; if the length plus starting offset is greater than the string
13198 length, the result is the right-hand part of the string, starting from the
13199 given offset. The first character in the string has offset zero.
13202 The <option>substr</option> expansion item can take negative offset values to count
13203 from the right-hand end of its operand. The last character is offset -1, the
13204 second-last is offset -2, and so on. Thus, for example,
13206 <literallayout class="monospaced">
13207 ${substr{-5}{2}{1234567}}
13210 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
13211 length of the string, the substring starts at the beginning of the string, and
13212 the length is reduced by the amount of overshoot. Thus, for example,
13214 <literallayout class="monospaced">
13215 ${substr{-5}{2}{12}}
13218 yields an empty string, but
13220 <literallayout class="monospaced">
13221 ${substr{-3}{2}{12}}
13224 yields <quote>1</quote>.
13227 When the second number is omitted from <option>substr</option>, the remainder of the string
13228 is taken if the offset is positive. If it is negative, all characters in the
13229 string preceding the offset point are taken. For example, an offset of -1 and
13230 no length, as in these semantically identical examples:
13232 <literallayout class="monospaced">
13234 ${substr{-1}{abcde}}
13237 yields all but the last character of the string, that is, <quote>abcd</quote>.
13239 </listitem></varlistentry>
13241 <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>
13244 <indexterm role="concept">
13245 <primary>expansion</primary>
13246 <secondary>character translation</secondary>
13248 <indexterm role="concept">
13249 <primary><option>tr</option> expansion item</primary>
13251 This item does single-character translation on its subject string. The second
13252 argument is a list of characters to be translated in the subject string. Each
13253 matching character is replaced by the corresponding character from the
13254 replacement list. For example
13256 <literallayout class="monospaced">
13257 ${tr{abcdea}{ac}{13}}
13260 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
13261 last occurrence is used. If the third string is shorter than the second, its
13262 last character is replicated. However, if it is empty, no translation takes
13265 </listitem></varlistentry>
13268 <section id="SECTexpop">
13269 <title>Expansion operators</title>
13271 <indexterm role="concept">
13272 <primary>expansion</primary>
13273 <secondary>operators</secondary>
13275 For expansion items that perform transformations on a single argument string,
13276 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
13277 The substring is first expanded before the operation is applied to it. The
13278 following operations can be performed:
13282 <term><emphasis role="bold">${address:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13285 <indexterm role="concept">
13286 <primary>expansion</primary>
13287 <secondary>RFC 2822 address handling</secondary>
13289 <indexterm role="concept">
13290 <primary><option>address</option></primary>
13291 <secondary>expansion item</secondary>
13293 The string is interpreted as an RFC 2822 address, as it might appear in a
13294 header line, and the effective address is extracted from it. If the string does
13295 not parse successfully, the result is empty.
13297 </listitem></varlistentry>
13299 <term><emphasis role="bold">${base62:</emphasis><<emphasis>digits</emphasis>><emphasis role="bold">}</emphasis></term>
13302 <indexterm role="concept">
13303 <primary><option>base62</option></primary>
13305 <indexterm role="concept">
13306 <primary>expansion</primary>
13307 <secondary>conversion to base 62</secondary>
13309 The string must consist entirely of decimal digits. The number is converted to
13310 base 62 and output as a string of six characters, including leading zeros. In
13311 the few operating environments where Exim uses base 36 instead of base 62 for
13312 its message identifiers (because those systems do not have case-sensitive file
13313 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
13314 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
13316 </listitem></varlistentry>
13318 <term><emphasis role="bold">${base62d:</emphasis><<emphasis>base-62 digits</emphasis>><emphasis role="bold">}</emphasis></term>
13321 <indexterm role="concept">
13322 <primary><option>base62d</option></primary>
13324 <indexterm role="concept">
13325 <primary>expansion</primary>
13326 <secondary>conversion to base 62</secondary>
13328 The string must consist entirely of base-62 digits, or, in operating
13329 environments where Exim uses base 36 instead of base 62 for its message
13330 identifiers, base-36 digits. The number is converted to decimal and output as a
13333 </listitem></varlistentry>
13335 <term><emphasis role="bold">${domain:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13338 <indexterm role="concept">
13339 <primary>domain</primary>
13340 <secondary>extraction</secondary>
13342 <indexterm role="concept">
13343 <primary>expansion</primary>
13344 <secondary>domain extraction</secondary>
13346 The string is interpreted as an RFC 2822 address and the domain is extracted
13347 from it. If the string does not parse successfully, the result is empty.
13349 </listitem></varlistentry>
13351 <term><emphasis role="bold">${escape:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13354 <indexterm role="concept">
13355 <primary>expansion</primary>
13356 <secondary>escaping non-printing characters</secondary>
13358 <indexterm role="concept">
13359 <primary><option>escape</option>, expansion item</primary>
13361 If the string contains any non-printing characters, they are converted to
13362 escape sequences starting with a backslash. Whether characters with the most
13363 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
13364 is controlled by the <option>print_topbitchars</option> option.
13366 </listitem></varlistentry>
13368 <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>
13371 <indexterm role="concept">
13372 <primary>expansion</primary>
13373 <secondary>expression evaluation</secondary>
13375 <indexterm role="concept">
13376 <primary>expansion</primary>
13377 <secondary>arithmetic expression</secondary>
13379 <indexterm role="concept">
13380 <primary><option>eval</option> expansion item</primary>
13382 These items supports simple arithmetic in expansion strings. The string (after
13383 expansion) must be a conventional arithmetic expression, but it is limited to
13384 five basic operators (plus, minus, times, divide, remainder) and parentheses.
13385 All operations are carried out using integer arithmetic. Plus and minus have a
13386 lower priority than times, divide, and remainder; operators with the same
13387 priority are evaluated from left to right.
13390 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
13391 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
13392 decimal, even if they start with a leading zero. This can be useful when
13393 processing numbers extracted from dates or times, which often do have leading
13397 A number may be followed by <quote>K</quote> or <quote>M</quote> to multiply it by 1024 or 1024*1024,
13398 respectively. Negative numbers are supported. The result of the computation is
13399 a decimal representation of the answer (without <quote>K</quote> or <quote>M</quote>). For example:
13402 <literal>${eval:1+1} </literal> yields 2
13403 <literal>${eval:1+2*3} </literal> yields 7
13404 <literal>${eval:(1+2)*3} </literal> yields 9
13405 <literal>${eval:2+42%5} </literal> yields 4
13408 As a more realistic example, in an ACL you might have
13410 <literallayout class="monospaced">
13411 deny message = Too many bad recipients
13414 {>{$rcpt_count}{10}} \
13417 {$recipients_count} \
13418 {${eval:$rcpt_count/2}} \
13423 The condition is true if there have been more than 10 RCPT commands and
13424 fewer than half of them have resulted in a valid recipient.
13426 </listitem></varlistentry>
13428 <term><emphasis role="bold">${expand:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13431 <indexterm role="concept">
13432 <primary>expansion</primary>
13433 <secondary>re-expansion of substring</secondary>
13435 The <option>expand</option> operator causes a string to be expanded for a second time. For
13438 <literallayout class="monospaced">
13439 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
13442 first looks up a string in a file while expanding the operand for <option>expand</option>,
13443 and then re-expands what it has found.
13445 </listitem></varlistentry>
13447 <term><emphasis role="bold">${from_utf8:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13450 <indexterm role="concept">
13451 <primary>Unicode</primary>
13453 <indexterm role="concept">
13454 <primary>UTF-8</primary>
13455 <secondary>conversion from</secondary>
13457 <indexterm role="concept">
13458 <primary>expansion</primary>
13459 <secondary>UTF-8 conversion</secondary>
13461 <indexterm role="concept">
13462 <primary><option>from_utf8</option></primary>
13464 The world is slowly moving towards Unicode, although there are no standards for
13465 email yet. However, other applications (including some databases) are starting
13466 to store data in Unicode, using UTF-8 encoding. This operator converts from a
13467 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
13468 converted to underscores. The input must be a valid UTF-8 string. If it is not,
13469 the result is an undefined sequence of bytes.
13472 Unicode code points with values less than 256 are compatible with ASCII and
13473 ISO-8859-1 (also known as Latin-1).
13474 For example, character 169 is the copyright symbol in both cases, though the
13475 way it is encoded is different. In UTF-8, more than one byte is needed for
13476 characters with code values greater than 127, whereas ISO-8859-1 is a
13477 single-byte encoding (but thereby limited to 256 characters). This makes
13478 translation from UTF-8 to ISO-8859-1 straightforward.
13480 </listitem></varlistentry>
13482 <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>
13485 <indexterm role="concept">
13486 <primary>hash function</primary>
13487 <secondary>textual</secondary>
13489 <indexterm role="concept">
13490 <primary>expansion</primary>
13491 <secondary>textual hash</secondary>
13493 The <option>hash</option> operator is a simpler interface to the hashing function that can
13494 be used when the two parameters are fixed numbers (as opposed to strings that
13495 change when expanded). The effect is the same as
13497 <literallayout class="monospaced">
13498 ${hash{<n>}{<m>}{<string>}}
13501 See the description of the general <option>hash</option> item above for details. The
13502 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
13504 </listitem></varlistentry>
13506 <term><emphasis role="bold">${hex2b64:</emphasis><<emphasis>hexstring</emphasis>><emphasis role="bold">}</emphasis></term>
13509 <indexterm role="concept">
13510 <primary>base64 encoding</primary>
13511 <secondary>conversion from hex</secondary>
13513 <indexterm role="concept">
13514 <primary>expansion</primary>
13515 <secondary>hex to base64</secondary>
13517 <indexterm role="concept">
13518 <primary><option>hex2b64</option></primary>
13520 This operator converts a hex string into one that is base64 encoded. This can
13521 be useful for processing the output of the MD5 and SHA-1 hashing functions.
13523 </listitem></varlistentry>
13525 <term><emphasis role="bold">${lc:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13528 <indexterm role="concept">
13529 <primary>case forcing in strings</primary>
13531 <indexterm role="concept">
13532 <primary>string</primary>
13533 <secondary>case forcing</secondary>
13535 <indexterm role="concept">
13536 <primary>lower casing</primary>
13538 <indexterm role="concept">
13539 <primary>expansion</primary>
13540 <secondary>case forcing</secondary>
13542 <indexterm role="concept">
13543 <primary><option>lc</option> expansion item</primary>
13545 This forces the letters in the string into lower-case, for example:
13547 <literallayout class="monospaced">
13550 </listitem></varlistentry>
13552 <term><emphasis role="bold">${length_</emphasis><<emphasis>number</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13555 <indexterm role="concept">
13556 <primary>expansion</primary>
13557 <secondary>string truncation</secondary>
13559 <indexterm role="concept">
13560 <primary><option>length</option></primary>
13561 <secondary>expansion item</secondary>
13563 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
13564 can be used when the parameter is a fixed number (as opposed to a string that
13565 changes when expanded). The effect is the same as
13567 <literallayout class="monospaced">
13568 ${length{<number>}{<string>}}
13571 See the description of the general <option>length</option> item above for details. Note that
13572 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
13573 when <option>length</option> is used as an operator.
13575 </listitem></varlistentry>
13577 <term><emphasis role="bold">${local_part:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13580 <indexterm role="concept">
13581 <primary>expansion</primary>
13582 <secondary>local part extraction</secondary>
13584 <indexterm role="concept">
13585 <primary><option>local_part</option> expansion item</primary>
13587 The string is interpreted as an RFC 2822 address and the local part is
13588 extracted from it. If the string does not parse successfully, the result is
13591 </listitem></varlistentry>
13593 <term><emphasis role="bold">${mask:</emphasis><<emphasis>IP address</emphasis>><emphasis role="bold">/</emphasis><<emphasis>bit count</emphasis>><emphasis role="bold">}</emphasis></term>
13596 <indexterm role="concept">
13597 <primary>masked IP address</primary>
13599 <indexterm role="concept">
13600 <primary>IP address</primary>
13601 <secondary>masking</secondary>
13603 <indexterm role="concept">
13604 <primary>CIDR notation</primary>
13606 <indexterm role="concept">
13607 <primary>expansion</primary>
13608 <secondary>IP address masking</secondary>
13610 <indexterm role="concept">
13611 <primary><option>mask</option>, expansion item</primary>
13613 If the form of the string to be operated on is not an IP address followed by a
13614 slash and an integer (that is, a network address in CIDR notation), the
13615 expansion fails. Otherwise, this operator converts the IP address to binary,
13616 masks off the least significant bits according to the bit count, and converts
13617 the result back to text, with mask appended. For example,
13619 <literallayout class="monospaced">
13620 ${mask:10.111.131.206/28}
13623 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
13624 be mostly used for looking up masked addresses in files, the result for an IPv6
13625 address uses dots to separate components instead of colons, because colon
13626 terminates a key string in lsearch files. So, for example,
13628 <literallayout class="monospaced">
13629 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
13634 <literallayout class="monospaced">
13635 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
13638 Letters in IPv6 addresses are always output in lower case.
13640 </listitem></varlistentry>
13642 <term><emphasis role="bold">${md5:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13645 <indexterm role="concept">
13646 <primary>MD5 hash</primary>
13648 <indexterm role="concept">
13649 <primary>expansion</primary>
13650 <secondary>MD5 hash</secondary>
13652 <indexterm role="concept">
13653 <primary><option>md5</option> expansion item</primary>
13655 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
13656 as a 32-digit hexadecimal number, in which any letters are in lower case.
13658 </listitem></varlistentry>
13660 <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>
13663 <indexterm role="concept">
13664 <primary>expansion</primary>
13665 <secondary>numeric hash</secondary>
13667 <indexterm role="concept">
13668 <primary>hash function</primary>
13669 <secondary>numeric</secondary>
13671 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
13672 that can be used when the two parameters are fixed numbers (as opposed to
13673 strings that change when expanded). The effect is the same as
13675 <literallayout class="monospaced">
13676 ${nhash{<n>}{<m>}{<string>}}
13679 See the description of the general <option>nhash</option> item above for details.
13681 </listitem></varlistentry>
13683 <term><emphasis role="bold">${quote:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13686 <indexterm role="concept">
13687 <primary>quoting</primary>
13688 <secondary>in string expansions</secondary>
13690 <indexterm role="concept">
13691 <primary>expansion</primary>
13692 <secondary>quoting</secondary>
13694 <indexterm role="concept">
13695 <primary><option>quote</option>, expansion item</primary>
13697 The <option>quote</option> operator puts its argument into double quotes if it
13698 is an empty string or
13699 contains anything other than letters, digits, underscores, dots, and hyphens.
13700 Any occurrences of double quotes and backslashes are escaped with a backslash.
13701 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
13702 respectively For example,
13704 <literallayout class="monospaced">
13710 <literallayout class="monospaced">
13714 The place where this is useful is when the argument is a substitution from a
13715 variable or a message header.
13717 </listitem></varlistentry>
13719 <term><emphasis role="bold">${quote_local_part:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13722 <indexterm role="concept">
13723 <primary><option>quote_local_part</option> expansion item</primary>
13725 This operator is like <option>quote</option>, except that it quotes the string only if
13726 required to do so by the rules of RFC 2822 for quoting local parts. For
13727 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
13728 If you are creating a new email address from the contents of <varname>$local_part</varname>
13729 (or any other unknown data), you should always use this operator.
13731 </listitem></varlistentry>
13733 <term><emphasis role="bold">${quote_</emphasis><<emphasis>lookup-type</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13736 <indexterm role="concept">
13737 <primary>quoting</primary>
13738 <secondary>lookup-specific</secondary>
13740 This operator applies lookup-specific quoting rules to the string. Each
13741 query-style lookup type has its own quoting rules which are described with
13742 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
13744 <literallayout class="monospaced">
13745 ${quote_ldap:two * two}
13750 <literallayout class="monospaced">
13754 For single-key lookup types, no quoting is ever necessary and this operator
13755 yields an unchanged string.
13757 </listitem></varlistentry>
13759 <term><emphasis role="bold">${rxquote:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13762 <indexterm role="concept">
13763 <primary>quoting</primary>
13764 <secondary>in regular expressions</secondary>
13766 <indexterm role="concept">
13767 <primary>regular expressions</primary>
13768 <secondary>quoting</secondary>
13770 <indexterm role="concept">
13771 <primary><option>rxquote</option> expansion item</primary>
13773 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
13774 characters in its argument. This is useful when substituting the values of
13775 variables or headers inside regular expressions.
13777 </listitem></varlistentry>
13779 <term><emphasis role="bold">${rfc2047:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13782 <indexterm role="concept">
13783 <primary>expansion</primary>
13784 <secondary>RFC 2047</secondary>
13786 <indexterm role="concept">
13787 <primary>RFC 2047</primary>
13788 <secondary>expansion operator</secondary>
13790 <indexterm role="concept">
13791 <primary><option>rfc2047</option> expansion item</primary>
13793 This operator encodes text according to the rules of RFC 2047. This is an
13794 encoding that is used in header lines to encode non-ASCII characters. It is
13795 assumed that the input string is in the encoding specified by the
13796 <option>headers_charset</option> option, which defaults to ISO-8859-1. If the string
13797 contains only characters in the range 33–126, and no instances of the
13800 <literallayout class="monospaced">
13801 ? = ( ) < > @ , ; : \ " . [ ] _
13804 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
13805 string, using as many <quote>encoded words</quote> as necessary to encode all the
13808 </listitem></varlistentry>
13810 <term><emphasis role="bold">${sha1:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13813 <indexterm role="concept">
13814 <primary>SHA-1 hash</primary>
13816 <indexterm role="concept">
13817 <primary>expansion</primary>
13818 <secondary>SHA-1 hashing</secondary>
13820 <indexterm role="concept">
13821 <primary><option>sha2</option> expansion item</primary>
13823 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
13824 it as a 40-digit hexadecimal number, in which any letters are in upper case.
13826 </listitem></varlistentry>
13828 <term><emphasis role="bold">${stat:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13831 <indexterm role="concept">
13832 <primary>expansion</primary>
13833 <secondary>statting a file</secondary>
13835 <indexterm role="concept">
13836 <primary>file</primary>
13837 <secondary>extracting characteristics</secondary>
13839 <indexterm role="concept">
13840 <primary><option>stat</option> expansion item</primary>
13842 The string, after expansion, must be a file path. A call to the <function>stat()</function>
13843 function is made for this path. If <function>stat()</function> fails, an error occurs and the
13844 expansion fails. If it succeeds, the data from the stat replaces the item, as a
13845 series of <<emphasis>name</emphasis>>=<<emphasis>value</emphasis>> pairs, where the values are all numerical,
13846 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
13847 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
13848 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
13849 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
13850 can extract individual fields using the <option>extract</option> expansion item.
13853 The use of the <option>stat</option> expansion in users’ filter files can be locked out by
13854 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
13855 systems for files larger than 2GB.
13857 </listitem></varlistentry>
13859 <term><emphasis role="bold">${str2b64:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13862 <indexterm role="concept">
13863 <primary>expansion</primary>
13864 <secondary>base64 encoding</secondary>
13866 <indexterm role="concept">
13867 <primary>base64 encoding</primary>
13868 <secondary>in string expansion</secondary>
13870 <indexterm role="concept">
13871 <primary><option>str2b64</option> expansion item</primary>
13873 This operator converts a string into one that is base64 encoded.
13875 </listitem></varlistentry>
13877 <term><emphasis role="bold">${strlen:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13880 <indexterm role="concept">
13881 <primary>expansion</primary>
13882 <secondary>string length</secondary>
13884 <indexterm role="concept">
13885 <primary>string</primary>
13886 <secondary>length in expansion</secondary>
13888 <indexterm role="concept">
13889 <primary><option>strlen</option> expansion item</primary>
13891 The item is replace by the length of the expanded string, expressed as a
13892 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
13894 </listitem></varlistentry>
13896 <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>
13899 <indexterm role="concept">
13900 <primary><option>substr</option> expansion item</primary>
13902 <indexterm role="concept">
13903 <primary>substring extraction</primary>
13905 <indexterm role="concept">
13906 <primary>expansion</primary>
13907 <secondary>substring expansion</secondary>
13909 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
13910 can be used when the two parameters are fixed numbers (as opposed to strings
13911 that change when expanded). The effect is the same as
13913 <literallayout class="monospaced">
13914 ${substr{<start>}{<length>}{<string>}}
13917 See the description of the general <option>substr</option> item above for details. The
13918 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
13920 </listitem></varlistentry>
13921 <varlistentry revisionflag="changed">
13922 <term><emphasis role="bold">${time_eval:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13924 <para revisionflag="changed">
13925 <indexterm role="concept">
13926 <primary><option>time_eval</option> expansion item</primary>
13928 <indexterm role="concept">
13929 <primary>time interval</primary>
13930 <secondary>decoding</secondary>
13932 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
13935 </listitem></varlistentry>
13937 <term><emphasis role="bold">${time_interval:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13940 <indexterm role="concept">
13941 <primary><option>time_interval</option> expansion item</primary>
13943 <indexterm role="concept">
13944 <primary>time interval</primary>
13945 <secondary>formatting</secondary>
13947 The argument (after sub-expansion) must be a sequence of decimal digits that
13948 represents an interval of time as a number of seconds. It is converted into a
13949 number of larger units and output in Exim’s normal time format, for example,
13950 <literal>1w3d4h2m6s</literal>.
13952 </listitem></varlistentry>
13954 <term><emphasis role="bold">${uc:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13957 <indexterm role="concept">
13958 <primary>case forcing in strings</primary>
13960 <indexterm role="concept">
13961 <primary>string</primary>
13962 <secondary>case forcing</secondary>
13964 <indexterm role="concept">
13965 <primary>upper casing</primary>
13967 <indexterm role="concept">
13968 <primary>expansion</primary>
13969 <secondary>case forcing</secondary>
13971 <indexterm role="concept">
13972 <primary><option>uc</option> expansion item</primary>
13974 This forces the letters in the string into upper-case.
13976 </listitem></varlistentry>
13979 <section id="SECTexpcond">
13980 <title>Expansion conditions</title>
13982 <indexterm role="concept">
13983 <primary>expansion</primary>
13984 <secondary>conditions</secondary>
13986 The following conditions are available for testing by the <option>${if</option> construct
13987 while expanding strings:
13991 <term><emphasis role="bold">!</emphasis><<emphasis>condition</emphasis>></term>
13994 <indexterm role="concept">
13995 <primary>expansion</primary>
13996 <secondary>negating a condition</secondary>
13998 <indexterm role="concept">
13999 <primary>negation</primary>
14000 <secondary>in expansion condition</secondary>
14002 Preceding any condition with an exclamation mark negates the result of the
14005 </listitem></varlistentry>
14007 <term><<emphasis>symbolic operator</emphasis>> <emphasis role="bold">{</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14010 <indexterm role="concept">
14011 <primary>numeric comparison</primary>
14013 <indexterm role="concept">
14014 <primary>expansion</primary>
14015 <secondary>numeric comparison</secondary>
14017 There are a number of symbolic operators for doing numeric comparisons. They
14021 <literal>= </literal> equal
14022 <literal>== </literal> equal
14023 <literal>> </literal> greater
14024 <literal>>= </literal> greater or equal
14025 <literal>< </literal> less
14026 <literal><= </literal> less or equal
14031 <literallayout class="monospaced">
14032 ${if >{$message_size}{10M} ...
14035 Note that the general negation operator provides for inequality testing. The
14036 two strings must take the form of optionally signed decimal integers,
14037 optionally followed by one of the letters <quote>K</quote> or <quote>M</quote> (in either upper or
14038 lower case), signifying multiplication by 1024 or 1024*1024, respectively.
14040 </listitem></varlistentry>
14042 <term><emphasis role="bold">crypteq {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14045 <indexterm role="concept">
14046 <primary>expansion</primary>
14047 <secondary>encrypted comparison</secondary>
14049 <indexterm role="concept">
14050 <primary>encrypted strings</primary>
14051 <secondary>comparing</secondary>
14053 <indexterm role="concept">
14054 <primary><option>crypteq</option> expansion condition</primary>
14056 This condition is included in the Exim binary if it is built to support any
14057 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
14058 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
14059 included in the binary.
14062 The <option>crypteq</option> condition has two arguments. The first is encrypted and
14063 compared against the second, which is already encrypted. The second string may
14064 be in the LDAP form for storing encrypted strings, which starts with the
14065 encryption type in curly brackets, followed by the data. If the second string
14066 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
14067 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
14068 Typically this will be a field from a password file. An example of an encrypted
14069 string in LDAP form is:
14071 <literallayout class="monospaced">
14072 {md5}CY9rzUYh03PK3k6DJie09g==
14075 If such a string appears directly in an expansion, the curly brackets have to
14076 be quoted, because they are part of the expansion syntax. For example:
14078 <literallayout class="monospaced">
14079 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
14082 The following encryption types (whose names are matched case-independently) are
14088 <indexterm role="concept">
14089 <primary>MD5 hash</primary>
14091 <indexterm role="concept">
14092 <primary>base64 encoding</primary>
14093 <secondary>in encrypted password</secondary>
14095 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
14096 printable characters to compare with the remainder of the second string. If the
14097 length of the comparison string is 24, Exim assumes that it is base64 encoded
14098 (as in the above example). If the length is 32, Exim assumes that it is a
14099 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
14105 <indexterm role="concept">
14106 <primary>SHA-1 hash</primary>
14108 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
14109 printable characters to compare with the remainder of the second string. If the
14110 length of the comparison string is 28, Exim assumes that it is base64 encoded.
14111 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
14112 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
14117 <indexterm role="concept">
14118 <primary><function>crypt()</function></primary>
14120 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
14121 only the first eight characters of the password. However, in modern operating
14122 systems this is no longer true, and in many cases the entire password is used,
14123 whatever its length.
14128 <indexterm role="concept">
14129 <primary><function>crypt16()</function></primary>
14131 <option>{crypt16}</option> calls the <function>crypt16()</function> function (also known as <function>bigcrypt()</function>),
14132 which was orginally created to use up to 16 characters of the password. Again,
14133 in modern operating systems, more characters may be used.
14138 Exim has its own version of <function>crypt16()</function> (which is just a double call to
14139 <function>crypt()</function>). For operating systems that have their own version, setting
14140 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
14141 operating system version instead of its own. This option is set by default in
14142 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
14143 support <function>crypt16()</function>.
14146 If you do not put any curly bracket encryption type in a <option>crypteq</option>
14147 comparison, the default is either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as determined
14148 by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default default is
14149 <literal>{crypt}</literal>. Whatever the default, you can always use either function by
14150 specifying it explicitly in curly brackets.
14153 Note that if a password is no longer than 8 characters, the results of
14154 encrypting it with <function>crypt()</function> and <function>crypt16()</function> are identical. That means that
14155 <function>crypt16()</function> is backwards compatible, as long as nobody feeds it a password
14156 longer than 8 characters.
14158 </listitem></varlistentry>
14160 <term><emphasis role="bold">def:</emphasis><<emphasis>variable name</emphasis>></term>
14163 <indexterm role="concept">
14164 <primary>expansion</primary>
14165 <secondary>checking for empty variable</secondary>
14167 <indexterm role="concept">
14168 <primary><option>def</option> expansion condition</primary>
14170 The <option>def</option> condition must be followed by the name of one of the expansion
14171 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
14172 variable does not contain the empty string. For example:
14174 <literallayout class="monospaced">
14175 ${if def:sender_ident {from $sender_ident}}
14178 Note that the variable name is given without a leading <option>$</option> character. If the
14179 variable does not exist, the expansion fails.
14181 </listitem></varlistentry>
14183 <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>
14186 <indexterm role="concept">
14187 <primary>expansion</primary>
14188 <secondary>checking header line existence</secondary>
14190 This condition is true if a message is being processed and the named header
14191 exists in the message. For example,
14193 <literallayout class="monospaced">
14194 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
14197 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
14198 the header name must be terminated by a colon if white space does not follow.
14200 </listitem></varlistentry>
14202 <term><emphasis role="bold">eq {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14205 <indexterm role="concept">
14206 <primary>string</primary>
14207 <secondary>comparison</secondary>
14209 <indexterm role="concept">
14210 <primary>expansion</primary>
14211 <secondary>string comparison</secondary>
14213 <indexterm role="concept">
14214 <primary><option>eq</option> expansion condition</primary>
14216 The two substrings are first expanded. The condition is true if the two
14217 resulting strings are identical, including the case of letters.
14219 </listitem></varlistentry>
14221 <term><emphasis role="bold">eqi {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14224 <indexterm role="concept">
14225 <primary>string</primary>
14226 <secondary>comparison</secondary>
14228 <indexterm role="concept">
14229 <primary>expansion</primary>
14230 <secondary>string comparison</secondary>
14232 <indexterm role="concept">
14233 <primary><option>eqi</option> expansion condition</primary>
14235 The two substrings are first expanded. The condition is true if the two
14236 resulting strings are identical when compared in a case-independent way.
14238 </listitem></varlistentry>
14240 <term><emphasis role="bold">exists {</emphasis><<emphasis>file name</emphasis>><emphasis role="bold">}</emphasis></term>
14243 <indexterm role="concept">
14244 <primary>expansion</primary>
14245 <secondary>file existence test</secondary>
14247 <indexterm role="concept">
14248 <primary>file</primary>
14249 <secondary>existence test</secondary>
14251 <indexterm role="concept">
14252 <primary><option>exists</option>, expansion condition</primary>
14254 The substring is first expanded and then interpreted as an absolute path. The
14255 condition is true if the named file (or directory) exists. The existence test
14256 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
14257 users’ filter files may be locked out by the system administrator.
14259 </listitem></varlistentry>
14261 <term><emphasis role="bold">first_delivery</emphasis></term>
14264 <indexterm role="concept">
14265 <primary>delivery</primary>
14266 <secondary>first</secondary>
14268 <indexterm role="concept">
14269 <primary>first delivery</primary>
14271 <indexterm role="concept">
14272 <primary>expansion</primary>
14273 <secondary>first delivery test</secondary>
14275 <indexterm role="concept">
14276 <primary><option>first_delivery</option> expansion condition</primary>
14278 This condition, which has no data, is true during a message’s first delivery
14279 attempt. It is false during any subsequent delivery attempts.
14281 </listitem></varlistentry>
14283 <term><emphasis role="bold">ge {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14286 <indexterm role="concept">
14287 <primary><option>ge</option> expansion condition</primary>
14289 See <emphasis role="bold">gei</emphasis>.
14291 </listitem></varlistentry>
14293 <term><emphasis role="bold">gei {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14296 <indexterm role="concept">
14297 <primary>string</primary>
14298 <secondary>comparison</secondary>
14300 <indexterm role="concept">
14301 <primary>expansion</primary>
14302 <secondary>string comparison</secondary>
14304 <indexterm role="concept">
14305 <primary><option>gei</option> expansion condition</primary>
14307 The two substrings are first expanded. The condition is true if the first
14308 string is lexically greater than or equal to the second string: for <option>ge</option> the
14309 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
14312 </listitem></varlistentry>
14314 <term><emphasis role="bold">gt {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14317 <indexterm role="concept">
14318 <primary><option>gt</option> expansion condition</primary>
14320 See <emphasis role="bold">gti</emphasis>.
14322 </listitem></varlistentry>
14324 <term><emphasis role="bold">gti {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14327 <indexterm role="concept">
14328 <primary>string</primary>
14329 <secondary>comparison</secondary>
14331 <indexterm role="concept">
14332 <primary>expansion</primary>
14333 <secondary>string comparison</secondary>
14335 <indexterm role="concept">
14336 <primary><option>gti</option> expansion condition</primary>
14338 The two substrings are first expanded. The condition is true if the first
14339 string is lexically greater than the second string: for <option>gt</option> the comparison
14340 includes the case of letters, whereas for <option>gti</option> the comparison is
14343 </listitem></varlistentry>
14345 <term><emphasis role="bold">isip {</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14348 <indexterm role="concept">
14349 <primary><option>isip</option> expansion condition</primary>
14351 See <emphasis role="bold">isip6</emphasis>.
14353 </listitem></varlistentry>
14355 <term><emphasis role="bold">isip4 {</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14358 <indexterm role="concept">
14359 <primary><option>isip4</option> expansion condition</primary>
14361 See <emphasis role="bold">isip6</emphasis>.
14363 </listitem></varlistentry>
14365 <term><emphasis role="bold">isip6 {</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14368 <indexterm role="concept">
14369 <primary>IP address</primary>
14370 <secondary>testing string format</secondary>
14372 <indexterm role="concept">
14373 <primary>string</primary>
14374 <secondary>testing for IP address</secondary>
14376 <indexterm role="concept">
14377 <primary><option>isip6</option> expansion condition</primary>
14379 The substring is first expanded, and then tested to see if it has the form of
14380 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
14381 <option>isip4</option> and <option>isip6</option> test just for IPv4 or IPv6 addresses, respectively. For
14382 example, you could use
14384 <literallayout class="monospaced">
14385 ${if isip4{$sender_host_address}...
14388 to test which version of IP an incoming SMTP connection is using.
14390 </listitem></varlistentry>
14392 <term><emphasis role="bold">ldapauth {</emphasis><<emphasis>ldap query</emphasis>><emphasis role="bold">}</emphasis></term>
14395 <indexterm role="concept">
14396 <primary>LDAP</primary>
14397 <secondary>use for authentication</secondary>
14399 <indexterm role="concept">
14400 <primary>expansion</primary>
14401 <secondary>LDAP authentication test</secondary>
14403 <indexterm role="concept">
14404 <primary><option>ldapauth</option> expansion condition</primary>
14406 This condition supports user authentication using LDAP. See section
14407 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
14408 queries. For this use, the query must contain a user name and password. The
14409 query itself is not used, and can be empty. The condition is true if the
14410 password is not empty, and the user name and password are accepted by the LDAP
14411 server. An empty password is rejected without calling LDAP because LDAP binds
14412 with an empty password are considered anonymous regardless of the username, and
14413 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
14414 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
14417 </listitem></varlistentry>
14419 <term><emphasis role="bold">le {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14422 <indexterm role="concept">
14423 <primary><option>le</option> expansion condition</primary>
14425 See <emphasis role="bold">lei</emphasis>.
14427 </listitem></varlistentry>
14429 <term><emphasis role="bold">lei {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14432 <indexterm role="concept">
14433 <primary>string</primary>
14434 <secondary>comparison</secondary>
14436 <indexterm role="concept">
14437 <primary>expansion</primary>
14438 <secondary>string comparison</secondary>
14440 <indexterm role="concept">
14441 <primary><option>lei</option> expansion condition</primary>
14443 The two substrings are first expanded. The condition is true if the first
14444 string is lexically less than or equal to the second string: for <option>le</option> the
14445 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
14448 </listitem></varlistentry>
14450 <term><emphasis role="bold">lt {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14453 <indexterm role="concept">
14454 <primary><option>lt</option> expansion condition</primary>
14456 See <emphasis role="bold">lti</emphasis>.
14458 </listitem></varlistentry>
14460 <term><emphasis role="bold">lti {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14463 <indexterm role="concept">
14464 <primary>string</primary>
14465 <secondary>comparison</secondary>
14467 <indexterm role="concept">
14468 <primary>expansion</primary>
14469 <secondary>string comparison</secondary>
14471 <indexterm role="concept">
14472 <primary><option>lti</option> expansion condition</primary>
14474 The two substrings are first expanded. The condition is true if the first
14475 string is lexically less than the second string: for <option>lt</option> the comparison
14476 includes the case of letters, whereas for <option>lti</option> the comparison is
14479 </listitem></varlistentry>
14481 <term><emphasis role="bold">match {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14484 <indexterm role="concept">
14485 <primary>expansion</primary>
14486 <secondary>regular expression comparison</secondary>
14488 <indexterm role="concept">
14489 <primary>regular expressions</primary>
14490 <secondary>match in expanded string</secondary>
14492 <indexterm role="concept">
14493 <primary><option>match</option>, expansion condition</primary>
14495 The two substrings are first expanded. The second is then treated as a regular
14496 expression and applied to the first. Because of the pre-expansion, if the
14497 regular expression contains dollar, or backslash characters, they must be
14498 escaped. Care must also be taken if the regular expression contains braces
14499 (curly brackets). A closing brace must be escaped so that it is not taken as a
14500 premature termination of <<emphasis>string2</emphasis>>. The easiest approach is to use the
14501 <literal>\N</literal> feature to disable expansion of the regular expression.
14504 <literallayout class="monospaced">
14505 ${if match {$local_part}{\N^\d{3}\N} ...
14508 If the whole expansion string is in double quotes, further escaping of
14509 backslashes is also required.
14512 The condition is true if the regular expression match succeeds.
14513 The regular expression is not required to begin with a circumflex
14514 metacharacter, but if there is no circumflex, the expression is not anchored,
14515 and it may match anywhere in the subject, not just at the start. If you want
14516 the pattern to match at the end of the subject, you must include the <literal>$</literal>
14517 metacharacter at an appropriate point.
14520 <indexterm role="concept">
14521 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
14522 <secondary>in <option>if</option> expansion</secondary>
14524 At the start of an <option>if</option> expansion the values of the numeric variable
14525 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
14526 succeeds causes them to be reset to the substrings of that condition and they
14527 will have these values during the expansion of the success string. At the end
14528 of the <option>if</option> expansion, the previous values are restored. After testing a
14529 combination of conditions using <option>or</option>, the subsequent values of the numeric
14530 variables are those of the condition that succeeded.
14532 </listitem></varlistentry>
14534 <term><emphasis role="bold">match_address {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14537 <indexterm role="concept">
14538 <primary><option>match_address</option> expansion condition</primary>
14540 See <emphasis role="bold">match_local_part</emphasis>.
14542 </listitem></varlistentry>
14544 <term><emphasis role="bold">match_domain {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14547 <indexterm role="concept">
14548 <primary><option>match_domain</option> expansion condition</primary>
14550 See <emphasis role="bold">match_local_part</emphasis>.
14552 </listitem></varlistentry>
14554 <term><emphasis role="bold">match_ip {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14557 <indexterm role="concept">
14558 <primary><option>match_ip</option> expansion condition</primary>
14560 This condition matches an IP address to a list of IP address patterns. It must
14561 be followed by two argument strings. The first (after expansion) must be an IP
14562 address or an empty string. The second (after expansion) is a restricted host
14563 list that can match only an IP address, not a host name. For example:
14565 <literallayout class="monospaced">
14566 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
14569 The specific types of host list item that are permitted in the list are:
14574 An IP address, optionally with a CIDR mask.
14579 A single asterisk, which matches any IP address.
14584 An empty item, which matches only if the IP address is empty. This could be
14585 useful for testing for a locally submitted message or one from specific hosts
14586 in a single test such as
14588 <literallayout class="monospaced">
14589 ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
14592 where the first item in the list is the empty string.
14597 The item @[] matches any of the local host’s interface addresses.
14602 Lookups are assumed to be <quote>net-</quote> style lookups, even if <literal>net-</literal> is not
14603 specified. Thus, the following are equivalent:
14605 <literallayout class="monospaced">
14606 ${if match_ip{$sender_host_address}{lsearch;/some/file}...
14607 ${if match_ip{$sender_host_address}{net-lsearch;/some/file}...
14610 You do need to specify the <literal>net-</literal> prefix if you want to specify a
14611 specific address mask, for example, by using <literal>net24-</literal>.
14616 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
14618 </listitem></varlistentry>
14620 <term><emphasis role="bold">match_local_part {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14623 <indexterm role="concept">
14624 <primary>domain list</primary>
14625 <secondary>in expansion condition</secondary>
14627 <indexterm role="concept">
14628 <primary>address list</primary>
14629 <secondary>in expansion condition</secondary>
14631 <indexterm role="concept">
14632 <primary>local part list</primary>
14633 <secondary>in expansion condition</secondary>
14635 <indexterm role="concept">
14636 <primary><option>match_local_part</option> expansion condition</primary>
14638 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
14639 possible to test domain, address, and local part lists within expansions. Each
14640 condition requires two arguments: an item and a list to match. A trivial
14643 <literallayout class="monospaced">
14644 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
14647 In each case, the second argument may contain any of the allowable items for a
14648 list of the appropriate type. Also, because the second argument (after
14649 expansion) is a standard form of list, it is possible to refer to a named list.
14650 Thus, you can use conditions like this:
14652 <literallayout class="monospaced">
14653 ${if match_domain{$domain}{+local_domains}{...
14656 <indexterm role="concept">
14657 <primary><literal>+caseful</literal></primary>
14659 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
14660 item can be used, as in all address lists, to cause subsequent items to
14661 have their local parts matched casefully. Domains are always matched
14665 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
14666 hosts have two identities: a name and an IP address, and it is not clear
14667 how to specify cleanly how such a test would work. However, IP addresses can be
14668 matched using <option>match_ip</option>.
14670 </listitem></varlistentry>
14672 <term><emphasis role="bold">pam {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">:...}</emphasis></term>
14675 <indexterm role="concept">
14676 <primary>PAM authentication</primary>
14678 <indexterm role="concept">
14679 <primary>AUTH</primary>
14680 <secondary>with PAM</secondary>
14682 <indexterm role="concept">
14683 <primary>Solaris</primary>
14684 <secondary>PAM support</secondary>
14686 <indexterm role="concept">
14687 <primary>expansion</primary>
14688 <secondary>PAM authentication test</secondary>
14690 <indexterm role="concept">
14691 <primary><option>pam</option> expansion condition</primary>
14693 <emphasis>Pluggable Authentication Modules</emphasis>
14694 (<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
14695 available in the latest releases of Solaris and in some GNU/Linux
14696 distributions. The Exim support, which is intended for use in conjunction with
14697 the SMTP AUTH command, is available only if Exim is compiled with
14699 <literallayout class="monospaced">
14703 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
14704 in some releases of GNU/Linux <option>-ldl</option> is also needed.
14707 The argument string is first expanded, and the result must be a
14708 colon-separated list of strings. Leading and trailing white space is ignored.
14709 The PAM module is initialized with the service name <quote>exim</quote> and the user name
14710 taken from the first item in the colon-separated data string (<<emphasis>string1</emphasis>>).
14711 The remaining items in the data string are passed over in response to requests
14712 from the authentication function. In the simple case there will only be one
14713 request, for a password, so the data consists of just two strings.
14716 There can be problems if any of the strings are permitted to contain colon
14717 characters. In the usual way, these have to be doubled to avoid being taken as
14718 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
14719 item can be used to double any existing colons. For example, the configuration
14720 of a LOGIN authenticator might contain this setting:
14722 <literallayout class="monospaced">
14723 server_condition = ${if pam{$1:${sg{$2}{:}{::}}}{yes}{no}}
14726 For a PLAIN authenticator you could use:
14728 <literallayout class="monospaced">
14729 server_condition = ${if pam{$2:${sg{$3}{:}{::}}}{yes}{no}}
14732 In some operating systems, PAM authentication can be done only from a process
14733 running as root. Since Exim is running as the Exim user when receiving
14734 messages, this means that PAM cannot be used directly in those systems.
14735 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
14736 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>.
14737 The patched module allows one special uid/gid combination, in addition to root,
14738 to authenticate. If you build the patched module to allow the Exim user and
14739 group, PAM can then be used from an Exim authenticator.
14741 </listitem></varlistentry>
14743 <term><emphasis role="bold">pwcheck {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14746 <indexterm role="concept">
14747 <primary><emphasis>pwcheck</emphasis> daemon</primary>
14749 <indexterm role="concept">
14750 <primary>Cyrus</primary>
14752 <indexterm role="concept">
14753 <primary>expansion</primary>
14754 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
14756 <indexterm role="concept">
14757 <primary><option>pwcheck</option> expansion condition</primary>
14759 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
14760 This is one way of making it possible for passwords to be checked by a process
14761 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
14762 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
14765 The pwcheck support is not included in Exim by default. You need to specify
14766 the location of the pwcheck daemon’s socket in <filename>Local/Makefile</filename> before
14767 building Exim. For example:
14769 <literallayout class="monospaced">
14770 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
14773 You do not need to install the full Cyrus software suite in order to use
14774 the pwcheck daemon. You can compile and install just the daemon alone
14775 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
14776 access to the <filename>/var/pwcheck</filename> directory.
14779 The <option>pwcheck</option> condition takes one argument, which must be the user name and
14780 password, separated by a colon. For example, in a LOGIN authenticator
14781 configuration, you might have this:
14783 <literallayout class="monospaced">
14784 server_condition = ${if pwcheck{$1:$2}{1}{0}}
14786 </listitem></varlistentry>
14788 <term><emphasis role="bold">queue_running</emphasis></term>
14791 <indexterm role="concept">
14792 <primary>queue runner</primary>
14793 <secondary>detecting when delivering from</secondary>
14795 <indexterm role="concept">
14796 <primary>expansion</primary>
14797 <secondary>queue runner test</secondary>
14799 <indexterm role="concept">
14800 <primary><option>queue_runnint</option> expansion condition</primary>
14802 This condition, which has no data, is true during delivery attempts that are
14803 initiated by queue runner processes, and false otherwise.
14805 </listitem></varlistentry>
14807 <term><emphasis role="bold">radius {</emphasis><<emphasis>authentication string</emphasis>><emphasis role="bold">}</emphasis></term>
14810 <indexterm role="concept">
14811 <primary>Radius</primary>
14813 <indexterm role="concept">
14814 <primary>expansion</primary>
14815 <secondary>Radius authentication</secondary>
14817 <indexterm role="concept">
14818 <primary><option>radiu</option> expansion condition</primary>
14820 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
14821 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
14822 the Radius client configuration file in order to build Exim with Radius
14826 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
14827 library, using the original API. If you are using release 0.4.0 or later of
14828 this library, you need to set
14830 <literallayout class="monospaced">
14831 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
14834 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
14835 <option>libradius</option> library that comes with FreeBSD. To do this, set
14837 <literallayout class="monospaced">
14838 RADIUS_LIB_TYPE=RADLIB
14841 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
14842 You may also have to supply a suitable setting in EXTRALIBS so that the
14843 Radius library can be found when Exim is linked.
14846 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
14847 Radius client library, which calls the Radius server. The condition is true if
14848 the authentication is successful. For example:
14850 <literallayout class="monospaced">
14851 server_condition = ${if radius{<arguments>}{yes}{no}}
14853 </listitem></varlistentry>
14855 <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>
14858 <indexterm role="concept">
14859 <primary><emphasis>saslauthd</emphasis> daemon</primary>
14861 <indexterm role="concept">
14862 <primary>Cyrus</primary>
14864 <indexterm role="concept">
14865 <primary>expansion</primary>
14866 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
14868 <indexterm role="concept">
14869 <primary><option>saslauthd</option> expansion condition</primary>
14871 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
14872 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
14873 Using this daemon is one way of making it possible for passwords to be checked
14874 by a process that is not running as root.
14877 The saslauthd support is not included in Exim by default. You need to specify
14878 the location of the saslauthd daemon’s socket in <filename>Local/Makefile</filename> before
14879 building Exim. For example:
14881 <literallayout class="monospaced">
14882 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
14885 You do not need to install the full Cyrus software suite in order to use
14886 the saslauthd daemon. You can compile and install just the daemon alone
14887 from the Cyrus SASL library.
14890 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
14891 two are mandatory. For example:
14893 <literallayout class="monospaced">
14894 server_condition = ${if saslauthd{{$1}{$2}}{1}{0}}
14897 The service and the realm are optional (which is why the arguments are enclosed
14898 in their own set of braces). For details of the meaning of the service and
14899 realm, and how to run the daemon, consult the Cyrus documentation.
14901 </listitem></varlistentry>
14905 <title>Combining expansion conditions</title>
14907 <indexterm role="concept">
14908 <primary>expansion</primary>
14909 <secondary>combining conditions</secondary>
14911 Several conditions can be tested at once by combining them using the <option>and</option>
14912 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
14913 conditions on their own, and precede their lists of sub-conditions. Each
14914 sub-condition must be enclosed in braces within the overall braces that contain
14915 the list. No repetition of <option>if</option> is used.
14919 <term><emphasis role="bold">or {{</emphasis><<emphasis>cond1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>cond2</emphasis>><emphasis role="bold">}...}</emphasis></term>
14922 <indexterm role="concept">
14923 <primary><quote>or</quote> expansion condition</primary>
14925 <indexterm role="concept">
14926 <primary>expansion</primary>
14927 <secondary><quote>or</quote> of conditions</secondary>
14929 The sub-conditions are evaluated from left to right. The condition is true if
14930 any one of the sub-conditions is true.
14933 <literallayout class="monospaced">
14934 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
14937 When a true sub-condition is found, the following ones are parsed but not
14938 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
14939 numeric variables afterwards are taken from the first one that succeeds.
14941 </listitem></varlistentry>
14943 <term><emphasis role="bold">and {{</emphasis><<emphasis>cond1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>cond2</emphasis>><emphasis role="bold">}...}</emphasis></term>
14946 <indexterm role="concept">
14947 <primary><quote>and</quote> expansion condition</primary>
14949 <indexterm role="concept">
14950 <primary>expansion</primary>
14951 <secondary><quote>and</quote> of conditions</secondary>
14953 The sub-conditions are evaluated from left to right. The condition is true if
14954 all of the sub-conditions are true. If there are several <quote>match</quote>
14955 sub-conditions, the values of the numeric variables afterwards are taken from
14956 the last one. When a false sub-condition is found, the following ones are
14957 parsed but not evaluated.
14959 </listitem></varlistentry>
14962 <section id="SECTexpvar">
14963 <title>Expansion variables</title>
14965 <indexterm role="concept">
14966 <primary>expansion variables</primary>
14967 <secondary>list of</secondary>
14969 This section contains an alphabetical list of all the expansion variables. Some
14970 of them are available only when Exim is compiled with specific options such as
14971 support for TLS or the content scanning extension.
14975 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
14978 <indexterm role="concept">
14979 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
14981 When a <option>match</option> expansion condition succeeds, these variables contain the
14982 captured substrings identified by the regular expression during subsequent
14983 processing of the success string of the containing <option>if</option> expansion item. They
14984 may also be set externally by some other matching process which precedes the
14985 expansion of the string. For example, the commands available in Exim filter
14986 files include an <option>if</option> command with its own regular expression matching
14989 </listitem></varlistentry>
14991 <term><varname>$acl_c0</varname> – <varname>$acl_c19</varname></term>
14994 Values can be placed in these variables by the <option>set</option> modifier in an ACL. The
14995 values persist throughout the lifetime of an SMTP connection. They can be used
14996 to pass information between ACLs and different invocations of the same ACL.
14997 When a message is received, the values of these variables are saved with the
14998 message, and can be accessed by filters, routers, and transports during
14999 subsequent delivery.
15001 </listitem></varlistentry>
15003 <term><varname>$acl_m0</varname> – <varname>$acl_m19</varname></term>
15006 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
15007 retain their values while a message is being received, but are reset
15008 afterwards. They are also reset by MAIL, RSET, EHLO, HELO, and after starting a
15009 TLS session. When a message is received, the values of these variables are
15010 saved with the message, and can be accessed by filters, routers, and transports
15011 during subsequent delivery.
15013 </listitem></varlistentry>
15015 <term><varname>$acl_verify_message</varname></term>
15018 <indexterm role="concept">
15019 <primary><varname>$acl_verify_message</varname></primary>
15021 After an address verification has failed, this variable contains the failure
15022 message. It retains its value for use in subsequent modifiers. The message can
15023 be preserved by coding like this:
15025 <literallayout class="monospaced">
15026 warn !verify = sender
15027 set acl_m0 = $acl_verify_message
15030 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
15031 <option>log_message</option> modifiers, to include information about the verification
15034 </listitem></varlistentry>
15036 <term><varname>$address_data</varname></term>
15039 <indexterm role="concept">
15040 <primary><varname>$address_data</varname></primary>
15042 This variable is set by means of the <option>address_data</option> option in routers. The
15043 value then remains with the address while it is processed by subsequent routers
15044 and eventually a transport. If the transport is handling multiple addresses,
15045 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
15046 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
15050 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
15051 a recipient address, the final value is still in the variable for subsequent
15052 conditions and modifiers of the ACL statement. If routing the address caused it
15053 to be redirected to just one address, the child address is also routed as part
15054 of the verification, and in this case the final value of <varname>$address_data</varname> is
15055 from the child’s routing.
15058 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
15059 sender address, the final value is also preserved, but this time in
15060 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
15064 In both cases (recipient and sender verification), the value does not persist
15065 after the end of the current ACL statement. If you want to preserve
15066 these values for longer, you can save them in ACL variables.
15068 </listitem></varlistentry>
15070 <term><varname>$address_file</varname></term>
15073 <indexterm role="concept">
15074 <primary><varname>$address_file</varname></primary>
15076 When, as a result of aliasing, forwarding, or filtering, a message is directed
15077 to a specific file, this variable holds the name of the file when the transport
15078 is running. At other times, the variable is empty. For example, using the
15079 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
15081 <literallayout class="monospaced">
15082 /home/r2d2/savemail
15085 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
15086 contains <quote>/home/r2d2/savemail</quote>.
15089 <indexterm role="concept">
15090 <primary>Sieve filter</primary>
15091 <secondary>value of <varname>$address_file</varname></secondary>
15093 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
15094 then up to the transport configuration to generate an appropriate absolute path
15095 to the relevant file.
15097 </listitem></varlistentry>
15099 <term><varname>$address_pipe</varname></term>
15102 <indexterm role="concept">
15103 <primary><varname>$address_pipe</varname></primary>
15105 When, as a result of aliasing or forwarding, a message is directed to a pipe,
15106 this variable holds the pipe command when the transport is running.
15108 </listitem></varlistentry>
15109 <varlistentry revisionflag="changed">
15110 <term><varname>$auth1</varname> – <varname>$auth3</varname></term>
15112 <para revisionflag="changed">
15113 <indexterm role="concept">
15114 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
15116 These variables are used in SMTP authenticators (see chapters
15117 <xref linkend="CHAPplaintext"/>–<xref linkend="CHAPspa"/>). Elsewhere, they are empty.
15119 </listitem></varlistentry>
15121 <term><varname>$authenticated_id</varname></term>
15124 <indexterm role="concept">
15125 <primary>authentication</primary>
15126 <secondary>id</secondary>
15128 <indexterm role="concept">
15129 <primary><varname>$authenticated_id</varname></primary>
15131 When a server successfully authenticates a client it may be configured to
15132 preserve some of the authentication information in the variable
15133 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
15134 user/password authenticator configuration might preserve the user name for use
15135 in the routers. Note that this is not the same information that is saved in
15136 <varname>$sender_host_authenticated</varname>. When a message is submitted locally (that is,
15137 not over a TCP connection), the value of <varname>$authenticated_id</varname> is the login name
15138 of the calling process.
15140 </listitem></varlistentry>
15142 <term><varname>$authenticated_sender</varname></term>
15145 <indexterm role="concept">
15146 <primary>sender</primary>
15147 <secondary>authenticated</secondary>
15149 <indexterm role="concept">
15150 <primary>authentication</primary>
15151 <secondary>sender</secondary>
15153 <indexterm role="concept">
15154 <primary>AUTH</primary>
15155 <secondary>on MAIL command</secondary>
15157 <indexterm role="concept">
15158 <primary><varname>$authenticated_sender</varname></primary>
15160 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
15161 SMTP MAIL command if it believes the sender is sufficiently trusted, as
15162 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
15163 <quote><></quote>, it is set as the authenticated sender of the message, and the value is
15164 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
15165 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
15168 <indexterm role="concept">
15169 <primary><varname>$qualify_domain</varname></primary>
15171 When a message is submitted locally (that is, not over a TCP connection), the
15172 value of <varname>$authenticated_sender</varname> is an address constructed from the login
15173 name of the calling process and <varname>$qualify_domain</varname>.
15175 </listitem></varlistentry>
15177 <term><varname>$authentication_failed</varname></term>
15180 <indexterm role="concept">
15181 <primary>authentication</primary>
15182 <secondary>failure</secondary>
15184 <indexterm role="concept">
15185 <primary><varname>$authentication_failed</varname></primary>
15187 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
15188 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
15189 possible to distinguish between <quote>did not try to authenticate</quote>
15190 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
15191 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
15192 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
15193 negative response to an AUTH command, including (for example) an attempt to use
15194 an undefined mechanism.
15196 </listitem></varlistentry>
15198 <term><varname>$body_linecount</varname></term>
15201 <indexterm role="concept">
15202 <primary>message body</primary>
15203 <secondary>line count</secondary>
15205 <indexterm role="concept">
15206 <primary>body of message</primary>
15207 <secondary>line count</secondary>
15209 <indexterm role="concept">
15210 <primary><varname>$body_linecount</varname></primary>
15212 When a message is being received or delivered, this variable contains the
15213 number of lines in the message’s body. See also <varname>$message_linecount</varname>.
15215 </listitem></varlistentry>
15217 <term><varname>$body_zerocount</varname></term>
15220 <indexterm role="concept">
15221 <primary>message body</primary>
15222 <secondary>binary zero count</secondary>
15224 <indexterm role="concept">
15225 <primary>body of message</primary>
15226 <secondary>binary zero count</secondary>
15228 <indexterm role="concept">
15229 <primary>binary zero</primary>
15230 <secondary>in message body</secondary>
15232 <indexterm role="concept">
15233 <primary><varname>$body_zerocount</varname></primary>
15235 When a message is being received or delivered, this variable contains the
15236 number of binary zero bytes in the message’s body.
15238 </listitem></varlistentry>
15240 <term><varname>$bounce_recipient</varname></term>
15243 <indexterm role="concept">
15244 <primary><varname>$bounce_recipient</varname></primary>
15246 This is set to the recipient address of a bounce message while Exim is creating
15247 it. It is useful if a customized bounce message text file is in use (see
15248 chapter <xref linkend="CHAPemsgcust"/>).
15250 </listitem></varlistentry>
15252 <term><varname>$bounce_return_size_limit</varname></term>
15255 <indexterm role="concept">
15256 <primary><varname>$bounce_return_size_limit</varname></primary>
15258 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
15259 up to a multiple of 1000. It is useful when a customized error message text
15260 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
15262 </listitem></varlistentry>
15264 <term><varname>$caller_gid</varname></term>
15267 <indexterm role="concept">
15268 <primary>gid (group id)</primary>
15269 <secondary>caller</secondary>
15271 <indexterm role="concept">
15272 <primary><varname>$caller_gid</varname></primary>
15274 The real group id under which the process that called Exim was running. This is
15275 not the same as the group id of the originator of a message (see
15276 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
15277 incarnation normally contains the Exim gid.
15279 </listitem></varlistentry>
15281 <term><varname>$caller_uid</varname></term>
15284 <indexterm role="concept">
15285 <primary>uid (user id)</primary>
15286 <secondary>caller</secondary>
15288 <indexterm role="concept">
15289 <primary><varname>$caller_uid</varname></primary>
15291 The real user id under which the process that called Exim was running. This is
15292 not the same as the user id of the originator of a message (see
15293 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
15294 incarnation normally contains the Exim uid.
15296 </listitem></varlistentry>
15298 <term><varname>$compile_date</varname></term>
15301 <indexterm role="concept">
15302 <primary><varname>$compile_date</varname></primary>
15304 The date on which the Exim binary was compiled.
15306 </listitem></varlistentry>
15308 <term><varname>$compile_number</varname></term>
15311 <indexterm role="concept">
15312 <primary><varname>$compile_number</varname></primary>
15314 The building process for Exim keeps a count of the number
15315 of times it has been compiled. This serves to distinguish different
15316 compilations of the same version of the program.
15318 </listitem></varlistentry>
15320 <term><varname>$demime_errorlevel</varname></term>
15323 <indexterm role="concept">
15324 <primary><varname>$demime_errorlevel</varname></primary>
15326 This variable is available when Exim is compiled with
15327 the content-scanning extension and the obsolete <option>demime</option> condition. For
15328 details, see section <xref linkend="SECTdemimecond"/>.
15330 </listitem></varlistentry>
15332 <term><varname>$demime_reason</varname></term>
15335 <indexterm role="concept">
15336 <primary><varname>$demime_reason</varname></primary>
15338 This variable is available when Exim is compiled with the
15339 content-scanning extension and the obsolete <option>demime</option> condition. For details,
15340 see section <xref linkend="SECTdemimecond"/>.
15342 </listitem></varlistentry>
15344 <term><varname>$dnslist_domain</varname></term>
15347 <indexterm role="concept">
15348 <primary>black list (DNS)</primary>
15350 <indexterm role="concept">
15351 <primary><varname>$dnslist_domain</varname></primary>
15353 When a client host is found to be on a DNS (black) list,
15354 the list’s domain name is put into this variable so that it can be included in
15355 the rejection message.
15357 </listitem></varlistentry>
15359 <term><varname>$dnslist_text</varname></term>
15362 <indexterm role="concept">
15363 <primary><varname>$dnslist_text</varname></primary>
15365 When a client host is found to be on a DNS (black) list, the
15366 contents of any associated TXT record are placed in this variable.
15368 </listitem></varlistentry>
15370 <term><varname>$dnslist_value</varname></term>
15373 <indexterm role="concept">
15374 <primary><varname>$dnslist_value</varname></primary>
15376 When a client host is found to be on a DNS (black) list,
15377 the IP address from the resource record is placed in this variable.
15378 If there are multiple records, all the addresses are included, comma-space
15381 </listitem></varlistentry>
15383 <term><varname>$domain</varname></term>
15386 <indexterm role="concept">
15387 <primary><varname>$domain</varname></primary>
15389 When an address is being routed, or delivered on its own, this variable
15390 contains the domain. Global address rewriting happens when a message is
15391 received, so the value of <varname>$domain</varname> during routing and delivery is the value
15392 after rewriting. <varname>$domain</varname> is set during user filtering, but not during system
15393 filtering, because a message may have many recipients and the system filter is
15397 When more than one address is being delivered at once (for example, several
15398 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
15399 have the same domain. Transports can be restricted to handling only one domain
15400 at a time if the value of <varname>$domain</varname> is required at transport time – this is
15401 the default for local transports. For further details of the environment in
15402 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
15405 <indexterm role="concept">
15406 <primary><option>delay_warning_condition</option></primary>
15408 At the end of a delivery, if all deferred addresses have the same domain, it is
15409 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
15412 The <varname>$domain</varname> variable is also used in some other circumstances:
15417 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
15418 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
15419 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
15420 normally set during the running of the MAIL ACL. However, if the sender address
15421 is verified with a callout during the MAIL ACL, the sender domain is placed in
15422 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
15423 the <command>smtp</command> transport.
15428 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
15429 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
15430 it can be used in the expansion of the replacement address, for example, to
15431 rewrite domains by file lookup.
15436 With one important exception, whenever a domain list is being scanned,
15437 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
15438 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
15439 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
15440 that, in a RCPT ACL, the sender domain list can be dependent on the
15441 recipient domain (which is what is in <varname>$domain</varname> at this time).
15446 <indexterm role="concept">
15447 <primary>ETRN</primary>
15448 <secondary>value of <varname>$domain</varname></secondary>
15450 <indexterm role="concept">
15451 <primary><option>smtp_etrn_command</option></primary>
15453 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
15454 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
15458 </listitem></varlistentry>
15460 <term><varname>$domain_data</varname></term>
15463 <indexterm role="concept">
15464 <primary><varname>$domain_data</varname></primary>
15466 When the <option>domains</option> option on a router matches a domain by
15467 means of a lookup, the data read by the lookup is available during the running
15468 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
15469 address to a transport, the value is available in that transport. If the
15470 transport is handling multiple addresses, the value from the first address is
15474 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
15475 domain by means of a lookup. The data read by the lookup is available during
15476 the rest of the ACL statement. In all other situations, this variable expands
15479 </listitem></varlistentry>
15481 <term><varname>$exim_gid</varname></term>
15484 <indexterm role="concept">
15485 <primary><varname>$exim_gid</varname></primary>
15487 This variable contains the numerical value of the Exim group id.
15489 </listitem></varlistentry>
15491 <term><varname>$exim_path</varname></term>
15494 <indexterm role="concept">
15495 <primary><varname>$exim_path</varname></primary>
15497 This variable contains the path to the Exim binary.
15499 </listitem></varlistentry>
15501 <term><varname>$exim_uid</varname></term>
15504 <indexterm role="concept">
15505 <primary><varname>$exim_uid</varname></primary>
15507 This variable contains the numerical value of the Exim user id.
15509 </listitem></varlistentry>
15511 <term><varname>$found_extension</varname></term>
15514 <indexterm role="concept">
15515 <primary><varname>$found_extension</varname></primary>
15517 This variable is available when Exim is compiled with the
15518 content-scanning extension and the obsolete <option>demime</option> condition. For details,
15519 see section <xref linkend="SECTdemimecond"/>.
15521 </listitem></varlistentry>
15523 <term><varname>$header_</varname><<emphasis>name</emphasis>></term>
15526 This is not strictly an expansion variable. It is expansion syntax for
15527 inserting the message header line with the given name. Note that the name must
15528 be terminated by colon or white space, because it may contain a wide variety of
15529 characters. Note also that braces must <emphasis>not</emphasis> be used.
15531 </listitem></varlistentry>
15533 <term><varname>$home</varname></term>
15536 <indexterm role="concept">
15537 <primary><varname>$home</varname></primary>
15539 When the <option>check_local_user</option> option is set for a router, the user’s home
15540 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
15541 means it is set during the running of users’ filter files. A router may also
15542 explicitly set a home directory for use by a transport; this can be overridden
15543 by a setting on the transport itself.
15546 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
15547 of the environment variable HOME.
15549 </listitem></varlistentry>
15551 <term><varname>$host</varname></term>
15554 <indexterm role="concept">
15555 <primary><varname>$host</varname></primary>
15557 When the <command>smtp</command> transport is expanding its options for encryption using TLS,
15558 <varname>$host</varname> contains the name of the host to which it is connected. Likewise, when
15559 used in the client part of an authenticator configuration (see chapter
15560 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
15561 client is connected.
15564 <indexterm role="concept">
15565 <primary>transport</primary>
15566 <secondary>filter</secondary>
15568 <indexterm role="concept">
15569 <primary>filter</primary>
15570 <secondary>transport filter</secondary>
15572 When used in a transport filter (see chapter <xref linkend="CHAPtransportgeneric"/>)
15573 <varname>$host</varname> refers to the host involved in the current connection. When a local
15574 transport is run as a result of a router that sets up a host list, <varname>$host</varname>
15575 contains the name of the first host.
15577 </listitem></varlistentry>
15579 <term><varname>$host_address</varname></term>
15582 <indexterm role="concept">
15583 <primary><varname>$host_address</varname></primary>
15585 This variable is set to the remote host’s IP address whenever <varname>$host</varname> is set
15586 for a remote connection. It is also set to the IP address that is being checked
15587 when the <option>ignore_target_hosts</option> option is being processed.
15589 </listitem></varlistentry>
15591 <term><varname>$host_data</varname></term>
15594 <indexterm role="concept">
15595 <primary><varname>$host_data</varname></primary>
15597 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
15598 result of the lookup is made available in the <varname>$host_data</varname> variable. This
15599 allows you, for example, to do things like this:
15601 <literallayout class="monospaced">
15602 deny hosts = net-lsearch;/some/file
15603 message = $host_data
15605 </listitem></varlistentry>
15607 <term><varname>$host_lookup_deferred</varname></term>
15610 <indexterm role="concept">
15611 <primary>host name lookup</primary>
15612 <secondary>failure of</secondary>
15614 <indexterm role="concept">
15615 <primary><varname>$host_lookup_deferred</varname></primary>
15617 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
15618 message comes from a remote host and there is an attempt to look up the host’s
15619 name from its IP address, and the attempt is not successful, one of these
15620 variables is set to <quote>1</quote>.
15625 If the lookup receives a definite negative response (for example, a DNS lookup
15626 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
15631 If there is any kind of problem during the lookup, such that Exim cannot
15632 tell whether or not the host name is defined (for example, a timeout for a DNS
15633 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
15638 Looking up a host’s name from its IP address consists of more than just a
15639 single reverse lookup. Exim checks that a forward lookup of at least one of the
15640 names it receives from a reverse lookup yields the original IP address. If this
15641 is not the case, Exim does not accept the looked up name(s), and
15642 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
15643 IP address (for example, the existence of a PTR record in the DNS) is not
15644 sufficient on its own for the success of a host name lookup. If the reverse
15645 lookup succeeds, but there is a lookup problem such as a timeout when checking
15646 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
15647 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
15649 </listitem></varlistentry>
15651 <term><varname>$host_lookup_failed</varname></term>
15654 <indexterm role="concept">
15655 <primary><varname>$host_lookup_failed</varname></primary>
15657 See <varname>$host_lookup_deferred</varname>.
15659 </listitem></varlistentry>
15661 <term><varname>$inode</varname></term>
15664 <indexterm role="concept">
15665 <primary><varname>$inode</varname></primary>
15667 The only time this variable is set is while expanding the <option>directory_file</option>
15668 option in the <command>appendfile</command> transport. The variable contains the inode number
15669 of the temporary file which is about to be renamed. It can be used to construct
15670 a unique name for the file.
15672 </listitem></varlistentry>
15674 <term><varname>$interface_address</varname></term>
15677 <indexterm role="concept">
15678 <primary><varname>$interface_address</varname></primary>
15680 As soon as a server starts processing a TCP/IP connection, this variable is set
15681 to the address of the local IP interface, and <varname>$interface_port</varname> is set to the
15682 port number. These values are therefore available for use in the <quote>connect</quote>
15683 ACL. See also the <option>-oMi</option> command line option. As well as being used in ACLs,
15684 these variable could be used, for example, to make the file name for a TLS
15685 certificate depend on which interface and/or port is being used.
15687 </listitem></varlistentry>
15689 <term><varname>$interface_port</varname></term>
15692 <indexterm role="concept">
15693 <primary><varname>$interface_port</varname></primary>
15695 See <varname>$interface_address</varname>.
15697 </listitem></varlistentry>
15699 <term><varname>$ldap_dn</varname></term>
15702 <indexterm role="concept">
15703 <primary><varname>$ldap_dn</varname></primary>
15705 This variable, which is available only when Exim is compiled with LDAP support,
15706 contains the DN from the last entry in the most recently successful LDAP
15709 </listitem></varlistentry>
15711 <term><varname>$load_average</varname></term>
15714 <indexterm role="concept">
15715 <primary><varname>$load_average</varname></primary>
15717 This variable contains the system load average, multiplied by 1000 to that it
15718 is an integer. For example, if the load average is 0.21, the value of the
15719 variable is 210. The value is recomputed every time the variable is referenced.
15721 </listitem></varlistentry>
15723 <term><varname>$local_part</varname></term>
15726 <indexterm role="concept">
15727 <primary><varname>$local_part</varname></primary>
15729 When an address is being routed, or delivered on its own, this
15730 variable contains the local part. When a number of addresses are being
15731 delivered together (for example, multiple RCPT commands in an SMTP
15732 session), <varname>$local_part</varname> is not set.
15735 Global address rewriting happens when a message is received, so the value of
15736 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
15737 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
15738 because a message may have many recipients and the system filter is called just
15742 <indexterm role="concept">
15743 <primary><varname>$local_part_prefix</varname></primary>
15745 <indexterm role="concept">
15746 <primary><varname>$local_part_suffix</varname></primary>
15748 If a local part prefix or suffix has been recognized, it is not included in the
15749 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
15750 any prefix or suffix are in <varname>$local_part_prefix</varname> and
15751 <varname>$local_part_suffix</varname>, respectively.
15754 When a message is being delivered to a file, pipe, or autoreply transport as a
15755 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
15756 the parent address, not to the file name or command (see <varname>$address_file</varname> and
15757 <varname>$address_pipe</varname>).
15760 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
15761 local part of the recipient address.
15764 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
15765 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
15766 it can be used in the expansion of the replacement address, for example.
15769 In all cases, all quoting is removed from the local part. For example, for both
15772 <literallayout class="monospaced">
15773 "abc:xyz"@test.example
15774 abc\:xyz@test.example
15777 the value of <varname>$local_part</varname> is
15779 <literallayout class="monospaced">
15783 If you use <varname>$local_part</varname> to create another address, you should always wrap it
15784 inside a quoting operator. For example, in a <command>redirect</command> router you could
15787 <literallayout class="monospaced">
15788 data = ${quote_local_part:$local_part}@new.domain.example
15791 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
15792 to process local parts in a case-dependent manner in a router, you can set the
15793 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
15795 </listitem></varlistentry>
15797 <term><varname>$local_part_data</varname></term>
15800 <indexterm role="concept">
15801 <primary><varname>$local_part_data</varname></primary>
15803 When the <option>local_parts</option> option on a router matches a local part by means of a
15804 lookup, the data read by the lookup is available during the running of the
15805 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
15806 to a transport, the value is available in that transport. If the transport is
15807 handling multiple addresses, the value from the first address is used.
15810 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
15811 matches a local part by means of a lookup. The data read by the lookup is
15812 available during the rest of the ACL statement. In all other situations, this
15813 variable expands to nothing.
15815 </listitem></varlistentry>
15817 <term><varname>$local_part_prefix</varname></term>
15820 <indexterm role="concept">
15821 <primary><varname>$local_part_prefix</varname></primary>
15823 When an address is being routed or delivered, and a
15824 specific prefix for the local part was recognized, it is available in this
15825 variable, having been removed from <varname>$local_part</varname>.
15827 </listitem></varlistentry>
15829 <term><varname>$local_part_suffix</varname></term>
15832 <indexterm role="concept">
15833 <primary><varname>$local_part_suffix</varname></primary>
15835 When an address is being routed or delivered, and a
15836 specific suffix for the local part was recognized, it is available in this
15837 variable, having been removed from <varname>$local_part</varname>.
15839 </listitem></varlistentry>
15841 <term><varname>$local_scan_data</varname></term>
15844 <indexterm role="concept">
15845 <primary><varname>$local_scan_data</varname></primary>
15847 This variable contains the text returned by the <function>local_scan()</function> function when
15848 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
15850 </listitem></varlistentry>
15852 <term><varname>$local_user_gid</varname></term>
15855 <indexterm role="concept">
15856 <primary><varname>$local_user_gid</varname></primary>
15858 See <varname>$local_user_uid</varname>.
15860 </listitem></varlistentry>
15862 <term><varname>$local_user_uid</varname></term>
15865 <indexterm role="concept">
15866 <primary><varname>$local_user_uid</varname></primary>
15868 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
15869 <option>check_local_user</option> router precondition succeeds. This means that their values
15870 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
15871 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
15872 router-specific expansions. At all other times, the values in these variables
15873 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
15875 </listitem></varlistentry>
15877 <term><varname>$localhost_number</varname></term>
15880 <indexterm role="concept">
15881 <primary><varname>$localhost_number</varname></primary>
15883 This contains the expanded value of the
15884 <option>localhost_number</option> option. The expansion happens after the main options have
15887 </listitem></varlistentry>
15889 <term><varname>$log_inodes</varname></term>
15892 <indexterm role="concept">
15893 <primary><varname>$log_inodes</varname></primary>
15895 The number of free inodes in the disk partition where Exim’s
15896 log files are being written. The value is recalculated whenever the variable is
15897 referenced. If the relevant file system does not have the concept of inodes,
15898 the value of is -1. See also the <option>check_log_inodes</option> option.
15900 </listitem></varlistentry>
15902 <term><varname>$log_space</varname></term>
15905 <indexterm role="concept">
15906 <primary><varname>$log_space</varname></primary>
15908 The amount of free space (as a number of kilobytes) in the disk
15909 partition where Exim’s log files are being written. The value is recalculated
15910 whenever the variable is referenced. If the operating system does not have the
15911 ability to find the amount of free space (only true for experimental systems),
15912 the space value is -1. See also the <option>check_log_space</option> option.
15914 </listitem></varlistentry>
15916 <term><varname>$mailstore_basename</varname></term>
15919 <indexterm role="concept">
15920 <primary><varname>$mailstore_basename</varname></primary>
15922 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
15923 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
15924 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
15925 contains the basename of the files that are being written, that is, the name
15926 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
15929 </listitem></varlistentry>
15931 <term><varname>$malware_name</varname></term>
15934 <indexterm role="concept">
15935 <primary><varname>$malware_name</varname></primary>
15937 This variable is available when Exim is compiled with the
15938 content-scanning extension. It is set to the name of the virus that was found
15939 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
15941 </listitem></varlistentry>
15943 <term><varname>$message_age</varname></term>
15946 <indexterm role="concept">
15947 <primary>message</primary>
15948 <secondary>age of</secondary>
15950 <indexterm role="concept">
15951 <primary><varname>$message_age</varname></primary>
15953 This variable is set at the start of a delivery attempt to contain the number
15954 of seconds since the message was received. It does not change during a single
15957 </listitem></varlistentry>
15959 <term><varname>$message_body</varname></term>
15962 <indexterm role="concept">
15963 <primary>body of message</primary>
15964 <secondary>expansion variable</secondary>
15966 <indexterm role="concept">
15967 <primary>message body</primary>
15968 <secondary>in expansion</secondary>
15970 <indexterm role="concept">
15971 <primary>binary zero</primary>
15972 <secondary>in message body</secondary>
15974 <indexterm role="concept">
15975 <primary><varname>$message_body</varname></primary>
15977 This variable contains the initial portion of a message’s
15978 body while it is being delivered, and is intended mainly for use in filter
15979 files. The maximum number of characters of the body that are put into the
15980 variable is set by the <option>message_body_visible</option> configuration option; the
15981 default is 500. Newlines are converted into spaces to make it easier to search
15982 for phrases that might be split over a line break.
15983 Binary zeros are also converted into spaces.
15985 </listitem></varlistentry>
15987 <term><varname>$message_body_end</varname></term>
15990 <indexterm role="concept">
15991 <primary>body of message</primary>
15992 <secondary>expansion variable</secondary>
15994 <indexterm role="concept">
15995 <primary>message body</primary>
15996 <secondary>in expansion</secondary>
15998 <indexterm role="concept">
15999 <primary><varname>$message_body_end</varname></primary>
16001 This variable contains the final portion of a message’s
16002 body while it is being delivered. The format and maximum size are as for
16003 <varname>$message_body</varname>.
16005 </listitem></varlistentry>
16007 <term><varname>$message_body_size</varname></term>
16010 <indexterm role="concept">
16011 <primary>body of message</primary>
16012 <secondary>size</secondary>
16014 <indexterm role="concept">
16015 <primary>message body</primary>
16016 <secondary>size</secondary>
16018 <indexterm role="concept">
16019 <primary><varname>$message_body_size</varname></primary>
16021 When a message is being delivered, this variable contains the size of the body
16022 in bytes. The count starts from the character after the blank line that
16023 separates the body from the header. Newlines are included in the count. See
16024 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
16026 </listitem></varlistentry>
16028 <term><varname>$message_exim_id</varname></term>
16031 <indexterm role="concept">
16032 <primary><varname>$message_exim_id</varname></primary>
16034 When a message is being received or delivered, this variable contains the
16035 unique message id that is generated and used by Exim to identify the message.
16036 An id is not created for a message until after its header has been successfully
16037 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
16038 line; it is the local id that Exim assigns to the message, for example:
16039 <literal>1BXTIK-0001yO-VA</literal>.
16041 </listitem></varlistentry>
16043 <term><varname>$message_headers</varname></term>
16046 This variable contains a concatenation of all the header lines when a message
16047 is being processed, except for lines added by routers or transports. The header
16048 lines are separated by newline characters.
16050 </listitem></varlistentry>
16052 <term><varname>$message_id</varname></term>
16055 This is an old name for <varname>$message_exim_id</varname>, which is now deprecated.
16057 </listitem></varlistentry>
16059 <term><varname>$message_linecount</varname></term>
16062 <indexterm role="concept">
16063 <primary><varname>$message_linecount</varname></primary>
16065 This variable contains the total number of lines in the header and body of the
16066 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
16067 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
16068 number of lines received. Before delivery happens (that is, before filters,
16069 routers, and transports run) the count is increased to include the
16070 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
16071 lines that are added by ACLs. The blank line that separates the message header
16072 from the body is not counted. Here is an example of the use of this variable in
16075 <literallayout class="monospaced">
16076 deny message = Too many lines in message header
16078 ${if <{250}{${eval:$message_linecount - $body_linecount}}}
16081 In the MAIL and RCPT ACLs, the value is zero because at that stage the
16082 message has not yet been received.
16084 </listitem></varlistentry>
16086 <term><varname>$message_size</varname></term>
16089 <indexterm role="concept">
16090 <primary>size</primary>
16091 <secondary>of message</secondary>
16093 <indexterm role="concept">
16094 <primary>message</primary>
16095 <secondary>size</secondary>
16097 <indexterm role="concept">
16098 <primary><varname>$message_size</varname></primary>
16100 When a message is being processed, this variable contains its size in bytes. In
16101 most cases, the size includes those headers that were received with the
16102 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
16103 deliveries as they are written. However, there is one special case: during the
16104 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
16105 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
16106 precise size of the file that has been written. See also
16107 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
16110 <indexterm role="concept">
16111 <primary>RCPT</primary>
16112 <secondary>value of <varname>$message_size</varname></secondary>
16114 While running an ACL at the time of an SMTP RCPT command, <varname>$message_size</varname>
16115 contains the size supplied on the MAIL command, or -1 if no size was given. The
16116 value may not, of course, be truthful.
16118 </listitem></varlistentry>
16120 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
16123 A number of variables whose names start with <varname>$mime</varname> are
16124 available when Exim is compiled with the content-scanning extension. For
16125 details, see section <xref linkend="SECTscanmimepart"/>.
16127 </listitem></varlistentry>
16129 <term><varname>$n0</varname> – <varname>$n9</varname></term>
16132 These variables are counters that can be incremented by means
16133 of the <option>add</option> command in filter files.
16135 </listitem></varlistentry>
16137 <term><varname>$original_domain</varname></term>
16140 <indexterm role="concept">
16141 <primary><varname>$domain</varname></primary>
16143 <indexterm role="concept">
16144 <primary><varname>$original_domain</varname></primary>
16146 When a top-level address is being processed for delivery, this contains the
16147 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
16148 generated by an alias, forward, or filter file) is being processed, this
16149 variable contains the domain of the original address. This differs from
16150 <varname>$parent_domain</varname> only when there is more than one level of aliasing or
16151 forwarding. When more than one address is being delivered in a single transport
16152 run, <varname>$original_domain</varname> is not set.
16155 If a new address is created by means of a <option>deliver</option> command in a system
16156 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
16157 part <emphasis>system-filter</emphasis> and the default qualify domain.
16159 </listitem></varlistentry>
16161 <term><varname>$original_local_part</varname></term>
16164 <indexterm role="concept">
16165 <primary><varname>$local_part</varname></primary>
16167 <indexterm role="concept">
16168 <primary><varname>$original_local_part</varname></primary>
16170 When a top-level address is being processed for delivery, this contains the
16171 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
16172 local part, because <varname>$original_local_part</varname> always contains the full local
16173 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
16174 filter file) is being processed, this variable contains the full local part of
16175 the original address.
16178 If the router that did the redirection processed the local part
16179 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
16180 This variable differs from <varname>$parent_local_part</varname> only when there is more than
16181 one level of aliasing or forwarding. When more than one address is being
16182 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
16185 If a new address is created by means of a <option>deliver</option> command in a system
16186 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
16187 part <emphasis>system-filter</emphasis> and the default qualify domain.
16189 </listitem></varlistentry>
16191 <term><varname>$originator_gid</varname></term>
16194 <indexterm role="concept">
16195 <primary>gid (group id)</primary>
16196 <secondary>of originating user</secondary>
16198 <indexterm role="concept">
16199 <primary>sender</primary>
16200 <secondary>gid</secondary>
16202 <indexterm role="concept">
16203 <primary><varname>$caller_gid</varname></primary>
16205 <indexterm role="concept">
16206 <primary><varname>$originator_gid</varname></primary>
16208 This variable contains the value of <varname>$caller_gid</varname> that was set when the
16209 message was received. For messages received via the command line, this is the
16210 gid of the sending user. For messages received by SMTP over TCP/IP, this is
16211 normally the gid of the Exim user.
16213 </listitem></varlistentry>
16215 <term><varname>$originator_uid</varname></term>
16218 <indexterm role="concept">
16219 <primary>uid (user id)</primary>
16220 <secondary>of originating user</secondary>
16222 <indexterm role="concept">
16223 <primary>sender</primary>
16224 <secondary>uid</secondary>
16226 <indexterm role="concept">
16227 <primary><varname>$caller_uid</varname></primary>
16229 <indexterm role="concept">
16230 <primary><varname>$originaltor_uid</varname></primary>
16232 The value of <varname>$caller_uid</varname> that was set when the message was received. For
16233 messages received via the command line, this is the uid of the sending user.
16234 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
16237 </listitem></varlistentry>
16239 <term><varname>$parent_domain</varname></term>
16242 <indexterm role="concept">
16243 <primary><varname>$parent_domain</varname></primary>
16245 This variable is similar to <varname>$original_domain</varname> (see
16246 above), except that it refers to the immediately preceding parent address.
16248 </listitem></varlistentry>
16250 <term><varname>$parent_local_part</varname></term>
16253 <indexterm role="concept">
16254 <primary><varname>$parent_local_part</varname></primary>
16256 This variable is similar to <varname>$original_local_part</varname>
16257 (see above), except that it refers to the immediately preceding parent address.
16259 </listitem></varlistentry>
16261 <term><varname>$pid</varname></term>
16264 <indexterm role="concept">
16265 <primary>pid (process id)</primary>
16266 <secondary>of current process</secondary>
16268 <indexterm role="concept">
16269 <primary><varname>$pid</varname></primary>
16271 This variable contains the current process id.
16273 </listitem></varlistentry>
16275 <term><varname>$pipe_addresses</varname></term>
16278 <indexterm role="concept">
16279 <primary>filter</primary>
16280 <secondary>transport filter</secondary>
16282 <indexterm role="concept">
16283 <primary>transport</primary>
16284 <secondary>filter</secondary>
16286 <indexterm role="concept">
16287 <primary><varname>$pipe_addresses</varname></primary>
16289 This is not an expansion variable, but is mentioned here because the string
16290 <quote>$pipe_addresses</quote> is handled specially in the command specification for the
16291 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
16292 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
16293 It cannot be used in general expansion strings, and provokes an <quote>unknown
16294 variable</quote> error if encountered.
16296 </listitem></varlistentry>
16298 <term><varname>$primary_hostname</varname></term>
16301 <indexterm role="concept">
16302 <primary><varname>$primary_hostname</varname></primary>
16304 This variable contains the value set by <option>primary_hostname</option> in the
16305 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
16306 a single-component name, Exim calls <function>gethostbyname()</function> (or
16307 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
16308 qualified host name. See also <varname>$smtp_active_hostname</varname>.
16310 </listitem></varlistentry>
16312 <term><varname>$prvscheck_address</varname></term>
16315 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
16316 which is described in sections <xref linkend="SECTexpansionitems"/> and
16317 <xref linkend="SECTverifyPRVS"/>.
16319 </listitem></varlistentry>
16321 <term><varname>$prvscheck_keynum</varname></term>
16324 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
16325 which is described in sections <xref linkend="SECTexpansionitems"/> and
16326 <xref linkend="SECTverifyPRVS"/>.
16328 </listitem></varlistentry>
16330 <term><varname>$prvscheck_result</varname></term>
16333 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
16334 which is described in sections <xref linkend="SECTexpansionitems"/> and
16335 <xref linkend="SECTverifyPRVS"/>.
16337 </listitem></varlistentry>
16339 <term><varname>$qualify_domain</varname></term>
16342 <indexterm role="concept">
16343 <primary><varname>$qualify_domain</varname></primary>
16345 The value set for the <option>qualify_domain</option> option in the configuration file.
16347 </listitem></varlistentry>
16349 <term><varname>$qualify_recipient</varname></term>
16352 <indexterm role="concept">
16353 <primary><varname>$qualify_recipient</varname></primary>
16355 The value set for the <option>qualify_recipient</option> option in the configuration file,
16356 or if not set, the value of <varname>$qualify_domain</varname>.
16358 </listitem></varlistentry>
16360 <term><varname>$rcpt_count</varname></term>
16363 <indexterm role="concept">
16364 <primary><varname>$rcpt_count</varname></primary>
16366 When a message is being received by SMTP, this variable contains the number of
16367 RCPT commands received for the current message. If this variable is used in a
16368 RCPT ACL, its value includes the current command.
16370 </listitem></varlistentry>
16372 <term><varname>$rcpt_defer_count</varname></term>
16375 <indexterm role="concept">
16376 <primary><varname>$rcpt_defer_count</varname></primary>
16378 When a message is being received by SMTP, this variable contains the number of
16379 RCPT commands in the current message that have previously been rejected with a
16380 temporary (4<emphasis>xx</emphasis>) response.
16382 </listitem></varlistentry>
16384 <term><varname>$rcpt_fail_count</varname></term>
16387 <indexterm role="concept">
16388 <primary><varname>$rcpt_fail_count</varname></primary>
16390 When a message is being received by SMTP, this variable contains the number of
16391 RCPT commands in the current message that have previously been rejected with a
16392 permanent (5<emphasis>xx</emphasis>) response.
16394 </listitem></varlistentry>
16396 <term><varname>$received_count</varname></term>
16399 <indexterm role="concept">
16400 <primary><varname>$received_count</varname></primary>
16402 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
16403 including the one added by Exim (so its value is always greater than zero). It
16404 is available in the DATA ACL, the non-SMTP ACL, and while routing and
16407 </listitem></varlistentry>
16409 <term><varname>$received_for</varname></term>
16412 <indexterm role="concept">
16413 <primary><varname>$received_for</varname></primary>
16415 If there is only a single recipient address in an incoming message, this
16416 variable contains that address when the <emphasis>Received:</emphasis> header line is being
16417 built. The value is copied after recipient rewriting has happened, but before
16418 the <function>local_scan()</function> function is run.
16420 </listitem></varlistentry>
16422 <term><varname>$received_protocol</varname></term>
16425 <indexterm role="concept">
16426 <primary><varname>$received_protocol</varname></primary>
16428 When a message is being processed, this variable contains the name of the
16429 protocol by which it was received. Most of the names used by Exim are defined
16430 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
16431 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
16432 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
16433 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
16434 connection and the client was successfully authenticated.
16437 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
16438 automatically set up on connection without the use of STARTTLS (see
16439 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
16440 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
16441 where the client initially uses EHLO, sets up an encrypted connection using
16442 STARTTLS, and then uses HELO afterwards.
16445 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
16446 messages that are injected locally by trusted callers. This is commonly used to
16447 identify messages that are being re-injected after some kind of scanning.
16449 </listitem></varlistentry>
16451 <term><varname>$received_time</varname></term>
16454 <indexterm role="concept">
16455 <primary><varname>$received_time</varname></primary>
16457 This variable contains the date and time when the current message was received,
16458 as a number of seconds since the start of the Unix epoch.
16460 </listitem></varlistentry>
16462 <term><varname>$recipient_data</varname></term>
16465 <indexterm role="concept">
16466 <primary><varname>$recipient_data</varname></primary>
16468 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
16469 condition. It contains the data from the lookup, and the value remains set
16470 until the next <option>recipients</option> test. Thus, you can do things like this:
16473 <literal>require recipients = cdb*@;/some/file</literal>
16474 <literal>deny </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
16477 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
16478 method in the address list, using the semicolon syntax as in the example above.
16479 The variable is not set for a lookup that is used as part of the string
16480 expansion that all such lists undergo before being interpreted.
16482 </listitem></varlistentry>
16484 <term><varname>$recipient_verify_failure</varname></term>
16487 <indexterm role="concept">
16488 <primary><varname>$recipient_verify_failure</varname></primary>
16490 In an ACL, when a recipient verification fails, this variable contains
16491 information about the failure. It is set to one of the following words:
16496 <quote>qualify</quote>: The address was unqualified (no domain), and the message
16497 was neither local nor came from an exempted host.
16502 <quote>route</quote>: Routing failed.
16507 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
16508 or before the MAIL command (that is, on initial connection, HELO, or
16514 <quote>recipient</quote>: The RCPT command in a callout was rejected.
16519 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
16524 The main use of this variable is expected to be to distinguish between
16525 rejections of MAIL and rejections of RCPT.
16527 </listitem></varlistentry>
16529 <term><varname>$recipients</varname></term>
16532 <indexterm role="concept">
16533 <primary><varname>$recipients</varname></primary>
16535 This variable contains a list of envelope recipients for a
16536 message. A comma and a space separate the addresses in the replacement text.
16537 However, the variable is not generally available, to prevent exposure of Bcc
16538 recipients in unprivileged users’ filter files. You can use <varname>$recipients</varname> only
16539 in these two cases:
16541 <orderedlist numeration="arabic">
16544 In a system filter file.
16549 In the ACLs associated with the DATA command, that is, the ACLs defined by
16550 <option>acl_smtp_predata</option> and <option>acl_smtp_data</option>.
16554 </listitem></varlistentry>
16556 <term><varname>$recipients_count</varname></term>
16559 <indexterm role="concept">
16560 <primary><varname>$recipients_count</varname></primary>
16562 When a message is being processed, this variable contains the number of
16563 envelope recipients that came with the message. Duplicates are not excluded
16564 from the count. While a message is being received over SMTP, the number
16565 increases for each accepted recipient. It can be referenced in an ACL.
16567 </listitem></varlistentry>
16569 <term><varname>$reply_address</varname></term>
16572 <indexterm role="concept">
16573 <primary><varname>$reply_address</varname></primary>
16575 When a message is being processed, this variable contains the contents of the
16576 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
16577 contents of the <emphasis>From:</emphasis> header line. <phrase revisionflag="changed">Apart from the removal of leading
16578 white space, the value is not processed in any way. In particular, no RFC 2047
16579 decoding or character code translation takes place.</phrase>
16581 </listitem></varlistentry>
16583 <term><varname>$return_path</varname></term>
16586 <indexterm role="concept">
16587 <primary><varname>$return_path</varname></primary>
16589 When a message is being delivered, this variable contains the return path –
16590 the sender field that will be sent as part of the envelope. It is not enclosed
16591 in <> characters. At the start of routing an address, <varname>$return_path</varname> has the
16592 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
16593 mailing list has been expanded by a router which specifies a different address
16594 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
16595 address, whereas <varname>$sender_address</varname> always contains the original sender address
16596 that was received with the message. In other words, <varname>$sender_address</varname> contains
16597 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
16600 </listitem></varlistentry>
16602 <term><varname>$return_size_limit</varname></term>
16605 <indexterm role="concept">
16606 <primary><varname>$return_size_limit</varname></primary>
16608 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
16610 </listitem></varlistentry>
16612 <term><varname>$runrc</varname></term>
16615 <indexterm role="concept">
16616 <primary>return code</primary>
16617 <secondary>from <option>run</option> expansion</secondary>
16619 <indexterm role="concept">
16620 <primary><varname>$runrc</varname></primary>
16622 This variable contains the return code from a command that is run by the
16623 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
16624 assume the order in which option values are expanded, except for those
16625 preconditions whose order of testing is documented. Therefore, you cannot
16626 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
16629 </listitem></varlistentry>
16631 <term><varname>$self_hostname</varname></term>
16634 <indexterm role="concept">
16635 <primary><option>self</option> option</primary>
16636 <secondary>value of host name</secondary>
16638 <indexterm role="concept">
16639 <primary><varname>$self_hostname</varname></primary>
16641 When an address is routed to a supposedly remote host that turns out to be the
16642 local host, what happens is controlled by the <option>self</option> generic router option.
16643 One of its values causes the address to be passed to another router. When this
16644 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
16645 original router encountered. In other circumstances its contents are null.
16647 </listitem></varlistentry>
16649 <term><varname>$sender_address</varname></term>
16652 <indexterm role="concept">
16653 <primary><varname>$sender_address</varname></primary>
16655 When a message is being processed, this variable contains the sender’s address
16656 that was received in the message’s envelope. For bounce messages, the value of
16657 this variable is the empty string. See also <varname>$return_path</varname>.
16659 </listitem></varlistentry>
16661 <term><varname>$sender_address_data</varname></term>
16664 <indexterm role="concept">
16665 <primary><varname>$address_data</varname></primary>
16667 <indexterm role="concept">
16668 <primary><varname>$sender_address_data</varname></primary>
16670 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
16671 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
16672 distinguish it from data from a recipient address. The value does not persist
16673 after the end of the current ACL statement. If you want to preserve it for
16674 longer, you can save it in an ACL variable.
16676 </listitem></varlistentry>
16678 <term><varname>$sender_address_domain</varname></term>
16681 <indexterm role="concept">
16682 <primary><varname>$sender_address_domain</varname></primary>
16684 The domain portion of <varname>$sender_address</varname>.
16686 </listitem></varlistentry>
16688 <term><varname>$sender_address_local_part</varname></term>
16691 <indexterm role="concept">
16692 <primary><varname>$sender_address_local_part</varname></primary>
16694 The local part portion of <varname>$sender_address</varname>.
16696 </listitem></varlistentry>
16698 <term><varname>$sender_data</varname></term>
16701 <indexterm role="concept">
16702 <primary><varname>$sender_data</varname></primary>
16704 This variable is set after a lookup success in an ACL <option>senders</option> condition or
16705 in a router <option>senders</option> option. It contains the data from the lookup, and the
16706 value remains set until the next <option>senders</option> test. Thus, you can do things like
16710 <literal>require senders = cdb*@;/some/file</literal>
16711 <literal>deny </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
16714 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
16715 method in the address list, using the semicolon syntax as in the example above.
16716 The variable is not set for a lookup that is used as part of the string
16717 expansion that all such lists undergo before being interpreted.
16719 </listitem></varlistentry>
16721 <term><varname>$sender_fullhost</varname></term>
16724 <indexterm role="concept">
16725 <primary><varname>$sender_fullhost</varname></primary>
16727 When a message is received from a remote host, this variable contains the host
16728 name and IP address in a single string. It ends with the IP address in square
16729 brackets, followed by a colon and a port number if the logging of ports is
16730 enabled. The format of the rest of the string depends on whether the host
16731 issued a HELO or EHLO SMTP command, and whether the host name was verified by
16732 looking up its IP address. (Looking up the IP address can be forced by the
16733 <option>host_lookup</option> option, independent of verification.) A plain host name at the
16734 start of the string is a verified host name; if this is not present,
16735 verification either failed or was not requested. A host name in parentheses is
16736 the argument of a HELO or EHLO command. This is omitted if it is identical to
16737 the verified host name or to the host’s IP address in square brackets.
16739 </listitem></varlistentry>
16741 <term><varname>$sender_helo_name</varname></term>
16744 <indexterm role="concept">
16745 <primary><varname>$sender_hslo_name</varname></primary>
16747 When a message is received from a remote host that has issued a HELO or EHLO
16748 command, the argument of that command is placed in this variable. It is also
16749 set if HELO or EHLO is used when a message is received using SMTP locally via
16750 the <option>-bs</option> or <option>-bS</option> options.
16752 </listitem></varlistentry>
16754 <term><varname>$sender_host_address</varname></term>
16757 <indexterm role="concept">
16758 <primary><varname>$sender_host_address</varname></primary>
16760 When a message is received from a remote host, this variable contains that
16761 host’s IP address. For locally submitted messages, it is empty.
16763 </listitem></varlistentry>
16765 <term><varname>$sender_host_authenticated</varname></term>
16768 <indexterm role="concept">
16769 <primary><varname>$sender_host_authenticated</varname></primary>
16771 This variable contains the name (not the public name) of the authenticator
16772 driver that successfully authenticated the client from which the message was
16773 received. It is empty if there was no successful authentication. See also
16774 <varname>$authenticated_id</varname>.
16776 </listitem></varlistentry>
16778 <term><varname>$sender_host_name</varname></term>
16781 <indexterm role="concept">
16782 <primary><varname>$sender_host_name</varname></primary>
16784 When a message is received from a remote host, this variable contains the
16785 host’s name as obtained by looking up its IP address. For messages received by
16786 other means, this variable is empty.
16789 <indexterm role="concept">
16790 <primary><varname>$host_lookup_failed</varname></primary>
16792 If the host name has not previously been looked up, a reference to
16793 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
16794 A looked up name is accepted only if it leads back to the original IP address
16795 via a forward lookup. If either the reverse or the forward lookup fails to find
16796 any data, or if the forward lookup does not yield the original IP address,
16797 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
16800 <indexterm role="concept">
16801 <primary><varname>$host_lookup_deferred</varname></primary>
16803 However, if either of the lookups cannot be completed (for example, there is a
16804 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
16805 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
16808 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
16809 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
16810 in the same Exim process, but it does try again if <varname>$sender_host_deferred</varname>
16811 is set to <quote>1</quote>.
16814 Exim does not automatically look up every calling host’s name. If you want
16815 maximum efficiency, you should arrange your configuration so that it avoids
16816 these lookups altogether. The lookup happens only if one or more of the
16817 following are true:
16822 A string containing <varname>$sender_host_name</varname> is expanded.
16827 The calling host matches the list in <option>host_lookup</option>. In the default
16828 configuration, this option is set to *, so it must be changed if lookups are
16829 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
16834 Exim needs the host name in order to test an item in a host list. The items
16835 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
16836 <xref linkend="SECThoslispatnamsk"/>.
16841 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
16842 In this case, the host name is required to compare with the name quoted in any
16843 EHLO or HELO commands that the client issues.
16848 The remote host issues a EHLO or HELO command that quotes one of the
16849 domains in <option>helo_lookup_domains</option>. The default value of this option is
16851 <literallayout class="monospaced">
16852 helo_lookup_domains = @ : @[]
16855 which causes a lookup if a remote host (incorrectly) gives the server’s name or
16856 IP address in an EHLO or HELO command.
16860 </listitem></varlistentry>
16862 <term><varname>$sender_host_port</varname></term>
16865 <indexterm role="concept">
16866 <primary><varname>$sender_host_port</varname></primary>
16868 When a message is received from a remote host, this variable contains the port
16869 number that was used on the remote host.
16871 </listitem></varlistentry>
16873 <term><varname>$sender_ident</varname></term>
16876 <indexterm role="concept">
16877 <primary><varname>$sender_ident</varname></primary>
16879 When a message is received from a remote host, this variable contains the
16880 identification received in response to an RFC 1413 request. When a message has
16881 been received locally, this variable contains the login name of the user that
16884 </listitem></varlistentry>
16886 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
16889 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
16890 <option>ratelimit</option> ACL condition. Details are given in section
16891 <xref linkend="SECTratelimiting"/>.
16893 </listitem></varlistentry>
16895 <term><varname>$sender_rcvhost</varname></term>
16898 <indexterm role="concept">
16899 <primary>DNS</primary>
16900 <secondary>reverse lookup</secondary>
16902 <indexterm role="concept">
16903 <primary>reverse DNS lookup</primary>
16905 <indexterm role="concept">
16906 <primary><varname>$sender_rcvhost</varname></primary>
16908 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
16909 either the verified host name (as obtained from a reverse DNS lookup) or, if
16910 there is no verified host name, the IP address in square brackets. After that
16911 there may be text in parentheses. When the first item is a verified host name,
16912 the first thing in the parentheses is the IP address in square brackets,
16913 followed by a colon and a port number if port logging is enabled. When the
16914 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
16918 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
16919 was used and its argument was not identical to the real host name or IP
16920 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
16921 all three items are present in the parentheses, a newline and tab are inserted
16922 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
16924 </listitem></varlistentry>
16926 <term><varname>$sender_verify_failure</varname></term>
16929 <indexterm role="concept">
16930 <primary><varname>$sender_verify_failure</varname></primary>
16932 In an ACL, when a sender verification fails, this variable contains information
16933 about the failure. The details are the same as for
16934 <varname>$recipient_verify_failure</varname>.
16936 </listitem></varlistentry>
16938 <term><varname>$smtp_active_hostname</varname></term>
16941 <indexterm role="concept">
16942 <primary><varname>$smtp_active_hostname</varname></primary>
16944 During an SMTP session, this variable contains the value of the active host
16945 name, as specified by the <option>smtp_active_hostname</option> option. The value of
16946 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
16947 value can be consulted during routing and delivery.
16949 </listitem></varlistentry>
16951 <term><varname>$smtp_command</varname></term>
16954 <indexterm role="concept">
16955 <primary><varname>$smtp_command</varname></primary>
16957 During the processing of an incoming SMTP command, this variable contains the
16958 entire command. This makes it possible to distinguish between HELO and EHLO in
16959 the HELO ACL, and also to distinguish between commands such as these:
16961 <literallayout class="monospaced">
16963 MAIL FROM: <>
16966 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
16967 command, the address in <varname>$smtp_command</varname> is the original address before any
16968 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
16969 the address after SMTP-time rewriting.
16971 </listitem></varlistentry>
16973 <term><varname>$smtp_command_argument</varname></term>
16976 <indexterm role="concept">
16977 <primary>SMTP command</primary>
16978 <secondary>argument for</secondary>
16980 <indexterm role="concept">
16981 <primary><varname>$smtp_command_argument</varname></primary>
16983 While an ACL is running to check an SMTP command, this variable contains the
16984 argument, that is, the text that follows the command name, with leading white
16985 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
16986 somewhat redundant, but is retained for backwards compatibility.
16988 </listitem></varlistentry>
16990 <term><varname>$sn0</varname> – <varname>$sn9</varname></term>
16993 These variables are copies of the values of the <varname>$n0</varname> – <varname>$n9</varname> accumulators
16994 that were current at the end of the system filter file. This allows a system
16995 filter file to set values that can be tested in users’ filter files. For
16996 example, a system filter could set a value indicating how likely it is that a
16997 message is junk mail.
16999 </listitem></varlistentry>
17001 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
17004 A number of variables whose names start with <varname>$spam</varname> are available when Exim
17005 is compiled with the content-scanning extension. For details, see section
17006 <xref linkend="SECTscanspamass"/>.
17008 </listitem></varlistentry>
17010 <term><varname>$spool_directory</varname></term>
17013 <indexterm role="concept">
17014 <primary><varname>$spool_directory</varname></primary>
17016 The name of Exim’s spool directory.
17018 </listitem></varlistentry>
17020 <term><varname>$spool_inodes</varname></term>
17023 <indexterm role="concept">
17024 <primary><varname>$spool_inodes</varname></primary>
17026 The number of free inodes in the disk partition where Exim’s spool files are
17027 being written. The value is recalculated whenever the variable is referenced.
17028 If the relevant file system does not have the concept of inodes, the value of
17029 is -1. See also the <option>check_spool_inodes</option> option.
17031 </listitem></varlistentry>
17033 <term><varname>$spool_space</varname></term>
17036 <indexterm role="concept">
17037 <primary><varname>$spool_space</varname></primary>
17039 The amount of free space (as a number of kilobytes) in the disk partition where
17040 Exim’s spool files are being written. The value is recalculated whenever the
17041 variable is referenced. If the operating system does not have the ability to
17042 find the amount of free space (only true for experimental systems), the space
17043 value is -1. For example, to check in an ACL that there is at least 50
17044 megabytes free on the spool, you could write:
17046 <literallayout class="monospaced">
17047 condition = ${if > {$spool_space}{50000}}
17050 See also the <option>check_spool_space</option> option.
17052 </listitem></varlistentry>
17054 <term><varname>$thisaddress</varname></term>
17057 <indexterm role="concept">
17058 <primary><varname>$thisaddress</varname></primary>
17060 This variable is set only during the processing of the <option>foranyaddress</option>
17061 command in a filter file. Its use is explained in the description of that
17062 command, which can be found in the separate document entitled <emphasis>Exim’s
17063 interfaces to mail filtering</emphasis>.
17065 </listitem></varlistentry>
17067 <term><varname>$tls_certificate_verified</varname></term>
17070 <indexterm role="concept">
17071 <primary><varname>$tls_certificate_verified</varname></primary>
17073 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
17074 message was received, and <quote>0</quote> otherwise.
17076 </listitem></varlistentry>
17078 <term><varname>$tls_cipher</varname></term>
17081 <indexterm role="concept">
17082 <primary><varname>$tls_cipher</varname></primary>
17084 When a message is received from a remote host over an encrypted SMTP
17085 connection, this variable is set to the cipher suite that was negotiated, for
17086 example DES-CBC3-SHA. In other circumstances, in particular, for message
17087 received over unencrypted connections, the variable is empty. See chapter
17088 <xref linkend="CHAPTLS"/> for details of TLS support.
17090 </listitem></varlistentry>
17092 <term><varname>$tls_peerdn</varname></term>
17095 <indexterm role="concept">
17096 <primary><varname>$tls_peerdn</varname></primary>
17098 When a message is received from a remote host over an encrypted SMTP
17099 connection, and Exim is configured to request a certificate from the client,
17100 the value of the Distinguished Name of the certificate is made available in the
17101 <varname>$tls_peerdn</varname> during subsequent processing.
17103 </listitem></varlistentry>
17105 <term><varname>$tod_bsdinbox</varname></term>
17108 <indexterm role="concept">
17109 <primary><varname>$tod_bsdinbox</varname></primary>
17111 The time of day and the date, in the format required for BSD-style mailbox
17112 files, for example: Thu Oct 17 17:14:09 1995.
17114 </listitem></varlistentry>
17116 <term><varname>$tod_epoch</varname></term>
17119 <indexterm role="concept">
17120 <primary><varname>$tod_epoch</varname></primary>
17122 The time and date as a number of seconds since the start of the Unix epoch.
17124 </listitem></varlistentry>
17126 <term><varname>$tod_full</varname></term>
17129 <indexterm role="concept">
17130 <primary><varname>$tod_full</varname></primary>
17132 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
17133 +0100. The timezone is always given as a numerical offset from UTC, with
17134 positive values used for timezones that are ahead (east) of UTC, and negative
17135 values for those that are behind (west).
17137 </listitem></varlistentry>
17139 <term><varname>$tod_log</varname></term>
17142 <indexterm role="concept">
17143 <primary><varname>$tod_log</varname></primary>
17145 The time and date in the format used for writing Exim’s log files, for example:
17146 1995-10-12 15:32:29, but without a timezone.
17148 </listitem></varlistentry>
17150 <term><varname>$tod_logfile</varname></term>
17153 <indexterm role="concept">
17154 <primary><varname>$tod_logfile</varname></primary>
17156 This variable contains the date in the format yyyymmdd. This is the format that
17157 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
17160 </listitem></varlistentry>
17162 <term><varname>$tod_zone</varname></term>
17165 <indexterm role="concept">
17166 <primary><varname>$tod_zone</varname></primary>
17168 This variable contains the numerical value of the local timezone, for example:
17171 </listitem></varlistentry>
17173 <term><varname>$tod_zulu</varname></term>
17176 <indexterm role="concept">
17177 <primary><varname>$tod_zulu</varname></primary>
17179 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
17180 by ISO 8601, for example: 20030221154023Z.
17182 </listitem></varlistentry>
17184 <term><varname>$value</varname></term>
17187 <indexterm role="concept">
17188 <primary><varname>$value</varname></primary>
17190 This variable contains the result of an expansion lookup, extraction operation,
17191 or external command, as described above.
17193 </listitem></varlistentry>
17195 <term><varname>$version_number</varname></term>
17198 <indexterm role="concept">
17199 <primary><varname>$version_number</varname></primary>
17201 The version number of Exim.
17203 </listitem></varlistentry>
17205 <term><varname>$warn_message_delay</varname></term>
17208 <indexterm role="concept">
17209 <primary><varname>$warn_message_delay</varname></primary>
17211 This variable is set only during the creation of a message warning about a
17212 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
17214 </listitem></varlistentry>
17216 <term><varname>$warn_message_recipients</varname></term>
17219 <indexterm role="concept">
17220 <primary><varname>$warn_message_recipients</varname></primary>
17222 This variable is set only during the creation of a message warning about a
17223 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
17225 </listitem></varlistentry>
17228 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
17233 <chapter id="CHAPperl">
17234 <title>Embedded Perl</title>
17236 <indexterm role="concept" id="IIDperl" class="startofrange">
17237 <primary>Perl</primary>
17238 <secondary>calling from Exim</secondary>
17240 Exim can be built to include an embedded Perl interpreter. When this is done,
17241 Perl subroutines can be called as part of the string expansion process. To make
17242 use of the Perl support, you need version 5.004 or later of Perl installed on
17243 your system. To include the embedded interpreter in the Exim binary, include
17246 <literallayout class="monospaced">
17250 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
17253 <title>Setting up so Perl can be used</title>
17255 <indexterm role="concept">
17256 <primary><option>perl_startup</option></primary>
17258 Access to Perl subroutines is via a global configuration option called
17259 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
17260 no <option>perl_startup</option> option in the Exim configuration file then no Perl
17261 interpreter is started and there is almost no overhead for Exim (since none of
17262 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
17263 option then the associated value is taken to be Perl code which is executed in
17264 a newly created Perl interpreter.
17267 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
17268 need backslashes before any characters to escape special meanings. The option
17269 should usually be something like
17271 <literallayout class="monospaced">
17272 perl_startup = do '/etc/exim.pl'
17275 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
17276 use from Exim. Exim can be configured either to start up a Perl interpreter as
17277 soon as it is entered, or to wait until the first time it is needed. Starting
17278 the interpreter at the beginning ensures that it is done while Exim still has
17279 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
17280 fact used in a particular run. Also, note that this does not mean that Exim is
17281 necessarily running as root when Perl is called at a later time. By default,
17282 the interpreter is started only when it is needed, but this can be changed in
17288 <indexterm role="concept">
17289 <primary><option>perl_at_start</option></primary>
17291 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
17292 a startup when Exim is entered.
17297 The command line option <option>-ps</option> also requests a startup when Exim is entered,
17298 overriding the setting of <option>perl_at_start</option>.
17303 There is also a command line option <option>-pd</option> (for delay) which suppresses the
17304 initial startup, even if <option>perl_at_start</option> is set.
17308 <title>Calling Perl subroutines</title>
17310 When the configuration file includes a <option>perl_startup</option> option you can make use
17311 of the string expansion item to call the Perl subroutines that are defined
17312 by the <option>perl_startup</option> code. The operator is used in any of the following
17315 <literallayout class="monospaced">
17317 ${perl{foo}{argument}}
17318 ${perl{foo}{argument1}{argument2} ... }
17321 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
17322 arguments may be passed. Passing more than this results in an expansion failure
17323 with an error message of the form
17325 <literallayout class="monospaced">
17326 Too many arguments passed to Perl subroutine "foo" (max is 8)
17329 The return value of the Perl subroutine is evaluated in a scalar context before
17330 it is passed back to Exim to be inserted into the expanded string. If the
17331 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
17332 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
17333 by obeying Perl’s <option>die</option> function, the expansion fails with the error message
17334 that was passed to <option>die</option>.
17338 <title>Calling Exim functions from Perl</title>
17340 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
17341 is available to call back into Exim’s string expansion function. For example,
17344 <literallayout class="monospaced">
17345 my $lp = Exim::expand_string('$local_part');
17348 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
17349 Note those are single quotes and not double quotes to protect against
17350 <varname>$local_part</varname> being interpolated as a Perl variable.
17353 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
17354 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
17355 expansion string, the Perl call from the original expansion string fails with
17356 an appropriate error message, in the same way as if <option>die</option> were used.
17359 <indexterm role="concept">
17360 <primary>debugging</primary>
17361 <secondary>from embedded Perl</secondary>
17363 <indexterm role="concept">
17364 <primary>log</primary>
17365 <secondary>writing from embedded Perl</secondary>
17367 Two other Exim functions are available for use from within Perl code.
17368 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim’s
17369 debugging is enabled. If you want a newline at the end, you must supply it.
17370 <emphasis>Exim::log_write()</emphasis> writes a string to Exim’s main log, adding a leading
17371 timestamp. In this case, you should not supply a terminating newline.
17375 <title>Use of standard output and error by Perl</title>
17377 <indexterm role="concept">
17378 <primary>Perl</primary>
17379 <secondary>standard output and error</secondary>
17381 You should not write to the standard error or output streams from within your
17382 Perl code, as it is not defined how these are set up. In versions of Exim
17383 before 4.50, it is possible for the standard output or error to refer to the
17384 SMTP connection during message reception via the daemon. Writing to this stream
17385 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
17386 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
17387 avoided, but the output is lost.
17390 <indexterm role="concept">
17391 <primary>Perl</primary>
17392 <secondary>use of <option>warn</option></secondary>
17394 The Perl <option>warn</option> statement writes to the standard error stream by default.
17395 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
17396 you have no control. When Exim starts up the Perl interpreter, it arranges for
17397 output from the <option>warn</option> statement to be written to the Exim main log. You can
17398 change this by including appropriate Perl magic somewhere in your Perl code.
17399 For example, to discard <option>warn</option> output completely, you need this:
17401 <literallayout class="monospaced">
17402 $SIG{__WARN__} = sub { };
17405 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
17406 example, the code for the subroutine is empty, so it does nothing, but you can
17407 include any Perl code that you like. The text of the <option>warn</option> message is passed
17408 as the first subroutine argument.
17409 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
17414 <chapter id="CHAPinterfaces">
17415 <title>Starting the daemon and the use of network interfaces</title>
17416 <titleabbrev>Starting the daemon</titleabbrev>
17418 <indexterm role="concept">
17419 <primary>daemon</primary>
17420 <secondary>starting</secondary>
17422 <indexterm role="concept">
17423 <primary>interface</primary>
17424 <secondary>listening</secondary>
17426 <indexterm role="concept">
17427 <primary>network interface</primary>
17429 <indexterm role="concept">
17430 <primary>interface</primary>
17431 <secondary>network</secondary>
17433 <indexterm role="concept">
17434 <primary>IP address</primary>
17435 <secondary>for listening</secondary>
17437 <indexterm role="concept">
17438 <primary>daemon</primary>
17439 <secondary>listening IP addresses</secondary>
17441 <indexterm role="concept">
17442 <primary>TCP/IP</primary>
17443 <secondary>setting listening interfaces</secondary>
17445 <indexterm role="concept">
17446 <primary>TCP/IP</primary>
17447 <secondary>setting listening ports</secondary>
17449 A host that is connected to a TCP/IP network may have one or more physical
17450 hardware network interfaces. Each of these interfaces may be configured as one
17451 or more <quote>logical</quote> interfaces, which are the entities that a program actually
17452 works with. Each of these logical interfaces is associated with an IP address.
17453 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
17454 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
17455 knowledge about the host’s interfaces for use in three different circumstances:
17457 <orderedlist numeration="arabic">
17460 When a listening daemon is started, Exim needs to know which interfaces
17461 and ports to listen on.
17466 When Exim is routing an address, it needs to know which IP addresses
17467 are associated with local interfaces. This is required for the correct
17468 processing of MX lists by removing the local host and others with the
17469 same or higher priority values. Also, Exim needs to detect cases
17470 when an address is routed to an IP address that in fact belongs to the
17471 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
17472 option of the smtp transport is set (as appropriate), this is treated
17473 as an error situation.
17478 When Exim connects to a remote host, it may need to know which interface to use
17479 for the outgoing connection.
17484 Exim’s default behaviour is likely to be appropriate in the vast majority
17485 of cases. If your host has only one interface, and you want all its IP
17486 addresses to be treated in the same way, and you are using only the
17487 standard SMTP port, you should not need to take any special action. The
17488 rest of this chapter does not apply to you.
17491 In a more complicated situation you may want to listen only on certain
17492 interfaces, or on different ports, and for this reason there are a number of
17493 options that can be used to influence Exim’s behaviour. The rest of this
17494 chapter describes how they operate.
17497 When a message is received over TCP/IP, the interface and port that were
17498 actually used are set in <varname>$interface_address</varname> and <varname>$interface_port</varname>.
17501 <title>Starting a listening daemon</title>
17503 When a listening daemon is started (by means of the <option>-bd</option> command line
17504 option), the interfaces and ports on which it listens are controlled by the
17510 <option>daemon_smtp_ports</option> contains a list of default ports. (For backward
17511 compatibility, this option can also be specified in the singular.)
17516 <option>local_interfaces</option> contains list of interface IP addresses on which to
17517 listen. Each item may optionally also specify a port.
17522 The default list separator in both cases is a colon, but this can be changed as
17523 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
17524 it is usually best to change the separator to avoid having to double all the
17525 colons. For example:
17527 <literallayout class="monospaced">
17528 local_interfaces = <; 127.0.0.1 ; \
17531 3ffe:ffff:836f::fe86:a061
17534 There are two different formats for specifying a port along with an IP address
17535 in <option>local_interfaces</option>:
17537 <orderedlist numeration="arabic">
17540 The port is added onto the address with a dot separator. For example, to listen
17541 on port 1234 on two different IP addresses:
17543 <literallayout class="monospaced">
17544 local_interfaces = <; 192.168.23.65.1234 ; \
17545 3ffe:ffff:836f::fe86:a061.1234
17550 The IP address is enclosed in square brackets, and the port is added
17551 with a colon separator, for example:
17553 <literallayout class="monospaced">
17554 local_interfaces = <; [192.168.23.65]:1234 ; \
17555 [3ffe:ffff:836f::fe86:a061]:1234
17560 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
17561 default setting contains just one port:
17563 <literallayout class="monospaced">
17564 daemon_smtp_ports = smtp
17567 If more than one port is listed, each interface that does not have its own port
17568 specified listens on all of them. Ports that are listed in
17569 <option>daemon_smtp_ports</option> can be identified either by name (defined in
17570 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
17571 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
17575 <title>Special IP listening addresses</title>
17577 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
17578 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
17579 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
17580 instead of setting up separate listening sockets for each interface. The
17581 default value of <option>local_interfaces</option> is
17583 <literallayout class="monospaced">
17584 local_interfaces = 0.0.0.0
17587 when Exim is built without IPv6 support; otherwise it is:
17589 <literallayout class="monospaced">
17590 local_interfaces = <; ::0 ; 0.0.0.0
17593 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
17597 <title>Overriding local_interfaces and daemon_smtp_ports</title>
17599 The <option>-oX</option> command line option can be used to override the values of
17600 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
17601 instance. Another way of doing this would be to use macros and the <option>-D</option>
17602 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
17603 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
17607 The value of <option>-oX</option> is a list of items. The default colon separator can be
17608 changed in the usual way if required. If there are any items that do not
17609 contain dots or colons (that is, are not IP addresses), the value of
17610 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
17611 items that do contain dots or colons, the value of <option>local_interfaces</option> is
17612 replaced by those items. Thus, for example,
17614 <literallayout class="monospaced">
17618 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
17621 <literallayout class="monospaced">
17622 -oX 192.168.34.5.1125
17625 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
17626 (However, since <option>local_interfaces</option> now contains no items without ports, the
17627 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
17630 <section id="SECTsupobssmt">
17631 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
17633 <indexterm role="concept">
17634 <primary>ssmtp protocol</primary>
17636 <indexterm role="concept">
17637 <primary>smtps protocol</primary>
17639 <indexterm role="concept">
17640 <primary>SMTP</primary>
17641 <secondary>ssmtp protocol</secondary>
17643 <indexterm role="concept">
17644 <primary>SMTP</primary>
17645 <secondary>smtps protocol</secondary>
17647 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
17648 before the STARTTLS command was standardized for SMTP. Some legacy clients
17649 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
17650 list of port numbers, connections to those ports must use SSMTP. The most
17651 common use of this option is expected to be
17653 <literallayout class="monospaced">
17654 tls_on_connect_ports = 465
17657 because 465 is the usual port number used by the legacy clients. There is also
17658 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
17659 this way when a daemon is started.
17662 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
17663 daemon to listen on those ports. You must still specify them in
17664 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
17665 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
17666 connections via the daemon.)
17670 <title>IPv6 address scopes</title>
17672 <indexterm role="concept">
17673 <primary>IPv6</primary>
17674 <secondary>address scopes</secondary>
17676 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
17677 can, in principle, have the same link-local IPv6 address on different
17678 interfaces. Thus, additional information is needed, over and above the IP
17679 address, to distinguish individual interfaces. A convention of using a
17680 percent sign followed by something (often the interface name) has been
17681 adopted in some cases, leading to addresses like this:
17683 <literallayout class="monospaced">
17684 fe80::202:b3ff:fe03:45c1%eth0
17687 To accommodate this usage, a percent sign followed by an arbitrary string is
17688 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
17689 to convert a textual IPv6 address for actual use. This function recognizes the
17690 percent convention in operating systems that support it, and it processes the
17691 address appropriately. Unfortunately, some older libraries have problems with
17692 <function>getaddrinfo()</function>. If
17694 <literallayout class="monospaced">
17695 IPV6_USE_INET_PTON=yes
17698 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
17699 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
17700 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
17701 function.) Of course, this means that the additional functionality of
17702 <function>getaddrinfo()</function> – recognizing scoped addresses – is lost.
17705 <section revisionflag="changed">
17706 <title>Disabling IPv6</title>
17707 <para revisionflag="changed">
17708 <indexterm role="concept">
17709 <primary>IPv6</primary>
17710 <secondary>disabling</secondary>
17712 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
17713 run on a host whose kernel does not support IPv6. The binary will fall back to
17714 using IPv4, but it may waste resources looking up AAAA records, and trying to
17715 connect to IPv6 addresses, causing delays to mail delivery. If you set the
17716 <indexterm role="option">
17717 <primary><option>disable_ipv6</option></primary>
17719 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
17720 activities take place. AAAA records are never looked up, and any IPv6 addresses
17721 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
17722 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
17723 to handle IPv6 literal addresses.
17725 <para revisionflag="changed">
17726 On the other hand, when IPv6 is in use, there may be times when you want to
17727 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
17728 option to globally suppress the lookup of AAAA records for specified domains,
17729 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
17730 IPv6 addresses in an individual router.
17734 <title>Examples of starting a listening daemon</title>
17736 The default case in an IPv6 environment is
17738 <literallayout class="monospaced">
17739 daemon_smtp_ports = smtp
17740 local_interfaces = <; ::0 ; 0.0.0.0
17743 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
17744 Either one or two sockets may be used, depending on the characteristics of
17745 the TCP/IP stack. (This is complicated and messy; for more information,
17746 read the comments in the <filename>daemon.c</filename> source file.)
17749 To specify listening on ports 25 and 26 on all interfaces:
17751 <literallayout class="monospaced">
17752 daemon_smtp_ports = 25 : 26
17755 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
17757 <literallayout class="monospaced">
17758 local_interfaces = <; ::0.25 ; ::0.26 \
17759 0.0.0.0.25 ; 0.0.0.0.26
17762 To listen on the default port on all IPv4 interfaces, and on port 26 on the
17763 IPv4 loopback address only:
17765 <literallayout class="monospaced">
17766 local_interfaces = 0.0.0.0 : 127.0.0.1.26
17769 To specify listening on the default port on specific interfaces only:
17771 <literallayout class="monospaced">
17772 local_interfaces = 192.168.34.67 : 192.168.34.67
17775 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
17778 <section id="SECTreclocipadd">
17779 <title>Recognising the local host</title>
17781 The <option>local_interfaces</option> option is also used when Exim needs to determine
17782 whether or not an IP address refers to the local host. That is, the IP
17783 addresses of all the interfaces on which a daemon is listening are always
17787 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
17788 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
17789 available interfaces from the operating system, and extracts the relevant
17790 (that is, IPv4 or IPv6) addresses to use for checking.
17793 Some systems set up large numbers of virtual interfaces in order to provide
17794 many virtual web servers. In this situation, you may want to listen for
17795 email on only a few of the available interfaces, but nevertheless treat all
17796 interfaces as local when routing. You can do this by setting
17797 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
17798 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
17799 used for listening. Consider this example:
17801 <literallayout class="monospaced">
17802 local_interfaces = <; 127.0.0.1 ; ::1 ; \
17804 3ffe:2101:12:1:a00:20ff:fe86:a061
17806 extra_local_interfaces = <; ::0 ; 0.0.0.0
17809 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
17810 address, but all available interface addresses are treated as local when
17814 In some environments the local host name may be in an MX list, but with an IP
17815 address that is not assigned to any local interface. In other cases it may be
17816 desirable to treat other host names as if they referred to the local host. Both
17817 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
17818 This contains host names rather than IP addresses. When a host is referenced
17819 during routing, either via an MX record or directly, it is treated as the local
17820 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
17821 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
17825 <title>Delivering to a remote host</title>
17827 Delivery to a remote host is handled by the smtp transport. By default, it
17828 allows the system’s TCP/IP functions to choose which interface to use (if
17829 there is more than one) when connecting to a remote host. However, the
17830 <option>interface</option> option can be set to specify which interface is used. See the
17831 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
17837 <chapter id="CHAPmainconfig">
17838 <title>Main configuration</title>
17840 <indexterm role="concept" id="IIDconfima" class="startofrange">
17841 <primary>configuration file</primary>
17842 <secondary>main section</secondary>
17844 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
17845 <primary>main configuration</primary>
17847 The first part of the run time configuration file contains three types of item:
17852 Macro definitions: These lines start with an upper case letter. See section
17853 <xref linkend="SECTmacrodefs"/> for details of macro processing.
17858 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
17859 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
17860 section <xref linkend="SECTnamedlists"/>.
17865 Main configuration settings: Each setting occupies one line of the file
17866 (with possible continuations). If any setting is preceded by the word
17867 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
17868 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
17874 This chapter specifies all the main configuration options, along with their
17875 types and default values. For ease of finding a particular option, they appear
17876 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
17877 are now so many options, they are first listed briefly in functional groups, as
17878 an aid to finding the name of the option you are looking for. Some options are
17879 listed in more than one group.
17882 <title>Miscellaneous</title>
17883 <informaltable frame="none">
17884 <tgroup cols="2" colsep="0" rowsep="0">
17885 <colspec colwidth="190pt" align="left"/>
17886 <colspec colwidth="260pt" align="left"/>
17889 <entry><option>bi_command</option></entry>
17890 <entry>to run for <option>-bi</option> command line option</entry>
17893 <entry><option>disable_ipv6</option></entry>
17894 <entry>do no IPv6 processing</entry>
17897 <entry><option>keep_malformed</option></entry>
17898 <entry>for broken files – should not happen</entry>
17901 <entry><option>localhost_number</option></entry>
17902 <entry>for unique message ids in clusters</entry>
17905 <entry><option>message_body_visible</option></entry>
17906 <entry>how much to show in <varname>$message_body</varname></entry>
17909 <entry><option>mua_wrapper</option></entry>
17910 <entry>run in <quote>MUA wrapper</quote> mode</entry>
17913 <entry><option>print_topbitchars</option></entry>
17914 <entry>top-bit characters are printing</entry>
17917 <entry><option>timezone</option></entry>
17918 <entry>force time zone</entry>
17925 <title>Exim parameters</title>
17926 <informaltable frame="none">
17927 <tgroup cols="2" colsep="0" rowsep="0">
17928 <colspec colwidth="190pt" align="left"/>
17929 <colspec colwidth="260pt" align="left"/>
17932 <entry><option>exim_group</option></entry>
17933 <entry>override compiled-in value</entry>
17936 <entry><option>exim_path</option></entry>
17937 <entry>override compiled-in value</entry>
17940 <entry><option>exim_user</option></entry>
17941 <entry>override compiled-in value</entry>
17944 <entry><option>primary_hostname</option></entry>
17945 <entry>default from <function>uname()</function></entry>
17948 <entry><option>split_spool_directory</option></entry>
17949 <entry>use multiple directories</entry>
17952 <entry><option>spool_directory</option></entry>
17953 <entry>override compiled-in value</entry>
17960 <title>Privilege controls</title>
17961 <informaltable frame="none">
17962 <tgroup cols="2" colsep="0" rowsep="0">
17963 <colspec colwidth="190pt" align="left"/>
17964 <colspec colwidth="260pt" align="left"/>
17967 <entry><option>admin_groups</option></entry>
17968 <entry>groups that are Exim admin users</entry>
17971 <entry><option>deliver_drop_privilege</option></entry>
17972 <entry>drop root for delivery processes</entry>
17975 <entry><option>local_from_check</option></entry>
17976 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
17979 <entry><option>local_from_prefix</option></entry>
17980 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
17983 <entry><option>local_from_suffix</option></entry>
17984 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
17987 <entry><option>local_sender_retain</option></entry>
17988 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
17991 <entry><option>never_users</option></entry>
17992 <entry>do not run deliveries as these</entry>
17995 <entry><option>prod_requires_admin</option></entry>
17996 <entry>forced delivery requires admin user</entry>
17999 <entry><option>queue_list_requires_admin</option></entry>
18000 <entry>queue listing requires admin user</entry>
18003 <entry><option>trusted_groups</option></entry>
18004 <entry>groups that are trusted</entry>
18007 <entry><option>trusted_users</option></entry>
18008 <entry>users that are trusted</entry>
18015 <title>Logging</title>
18016 <informaltable frame="none">
18017 <tgroup cols="2" colsep="0" rowsep="0">
18018 <colspec colwidth="190pt" align="left"/>
18019 <colspec colwidth="260pt" align="left"/>
18022 <entry><option>hosts_connection_nolog</option></entry>
18023 <entry>exemption from connect logging</entry>
18026 <entry><option>log_file_path</option></entry>
18027 <entry>override compiled-in value</entry>
18030 <entry><option>log_selector</option></entry>
18031 <entry>set/unset optional logging</entry>
18034 <entry><option>log_timezone</option></entry>
18035 <entry>add timezone to log lines</entry>
18038 <entry><option>message_logs</option></entry>
18039 <entry>create per-message logs</entry>
18042 <entry><option>preserve_message_logs</option></entry>
18043 <entry>after message completion</entry>
18046 <entry><option>process_log_path</option></entry>
18047 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
18050 <entry><option>syslog_duplication</option></entry>
18051 <entry>controls duplicate log lines on syslog</entry>
18054 <entry><option>syslog_facility</option></entry>
18055 <entry>set syslog <quote>facility</quote> field</entry>
18058 <entry><option>syslog_processname</option></entry>
18059 <entry>set syslog <quote>ident</quote> field</entry>
18062 <entry><option>syslog_timestamp</option></entry>
18063 <entry>timestamp syslog lines</entry>
18066 <entry><option>write_rejectlog</option></entry>
18067 <entry>control use of message log</entry>
18074 <title>Frozen messages</title>
18075 <informaltable frame="none">
18076 <tgroup cols="2" colsep="0" rowsep="0">
18077 <colspec colwidth="190pt" align="left"/>
18078 <colspec colwidth="260pt" align="left"/>
18081 <entry><option>auto_thaw</option></entry>
18082 <entry>sets time for retrying frozen messages</entry>
18085 <entry><option>freeze_tell</option></entry>
18086 <entry>send message when freezing</entry>
18089 <entry><option>move_frozen_messages</option></entry>
18090 <entry>to another directory</entry>
18093 <entry><option>timeout_frozen_after</option></entry>
18094 <entry>keep frozen messages only so long</entry>
18101 <title>Data lookups</title>
18102 <informaltable frame="none">
18103 <tgroup cols="2" colsep="0" rowsep="0">
18104 <colspec colwidth="190pt" align="left"/>
18105 <colspec colwidth="260pt" align="left"/>
18108 <entry><option>ldap_default_servers</option></entry>
18109 <entry>used if no server in query</entry>
18112 <entry><option>ldap_version</option></entry>
18113 <entry>set protocol version</entry>
18116 <entry><option>lookup_open_max</option></entry>
18117 <entry>lookup files held open</entry>
18120 <entry><option>mysql_servers</option></entry>
18121 <entry>as it says</entry>
18124 <entry><option>oracle_servers</option></entry>
18125 <entry>as it says</entry>
18128 <entry><option>pgsql_servers</option></entry>
18129 <entry>as it says</entry>
18132 <entry><option>sqlite_lock_timeout</option></entry>
18133 <entry>as it says</entry>
18140 <title>Message ids</title>
18141 <informaltable frame="none">
18142 <tgroup cols="2" colsep="0" rowsep="0">
18143 <colspec colwidth="190pt" align="left"/>
18144 <colspec colwidth="260pt" align="left"/>
18147 <entry><option>message_id_header_domain</option></entry>
18148 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
18151 <entry><option>message_id_header_text</option></entry>
18152 <entry>ditto</entry>
18159 <title>Embedded Perl Startup</title>
18160 <informaltable frame="none">
18161 <tgroup cols="2" colsep="0" rowsep="0">
18162 <colspec colwidth="190pt" align="left"/>
18163 <colspec colwidth="260pt" align="left"/>
18166 <entry><option>perl_at_start</option></entry>
18167 <entry>always start the interpreter</entry>
18170 <entry><option>perl_startup</option></entry>
18171 <entry>code to obey when starting Perl</entry>
18178 <title>Daemon</title>
18179 <informaltable frame="none">
18180 <tgroup cols="2" colsep="0" rowsep="0">
18181 <colspec colwidth="190pt" align="left"/>
18182 <colspec colwidth="260pt" align="left"/>
18185 <entry><option>daemon_smtp_ports</option></entry>
18186 <entry>default ports</entry>
18189 <entry><option>daemon_startup_retries</option></entry>
18190 <entry>number of times to retry</entry>
18193 <entry><option>daemon_startup_sleep</option></entry>
18194 <entry>time to sleep between tries</entry>
18197 <entry><option>extra_local_interfaces</option></entry>
18198 <entry>not necessarily listened on</entry>
18201 <entry><option>local_interfaces</option></entry>
18202 <entry>on which to listen, with optional ports</entry>
18205 <entry><option>pid_file_path</option></entry>
18206 <entry>override compiled-in value</entry>
18209 <entry><option>queue_run_max</option></entry>
18210 <entry>maximum simultaneous queue runners</entry>
18217 <title>Resource control</title>
18218 <informaltable frame="none">
18219 <tgroup cols="2" colsep="0" rowsep="0">
18220 <colspec colwidth="190pt" align="left"/>
18221 <colspec colwidth="260pt" align="left"/>
18224 <entry><option>check_log_inodes</option></entry>
18225 <entry>before accepting a message</entry>
18228 <entry><option>check_log_space</option></entry>
18229 <entry>before accepting a message</entry>
18232 <entry><option>check_spool_inodes</option></entry>
18233 <entry>before accepting a message</entry>
18236 <entry><option>check_spool_space</option></entry>
18237 <entry>before accepting a message</entry>
18240 <entry><option>deliver_queue_load_max</option></entry>
18241 <entry>no queue deliveries if load high</entry>
18244 <entry><option>queue_only_load</option></entry>
18245 <entry>queue incoming if load high</entry>
18248 <entry><option>queue_run_max</option></entry>
18249 <entry>maximum simultaneous queue runners</entry>
18252 <entry><option>remote_max_parallel</option></entry>
18253 <entry>parallel SMTP delivery per message</entry>
18256 <entry><option>smtp_accept_max</option></entry>
18257 <entry>simultaneous incoming connections</entry>
18260 <entry><option>smtp_accept_max_nommail</option></entry>
18261 <entry>non-mail commands</entry>
18264 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
18265 <entry>hosts to which the limit applies</entry>
18268 <entry><option>smtp_accept_max_per_connection</option></entry>
18269 <entry>messages per connection</entry>
18272 <entry><option>smtp_accept_max_per_host</option></entry>
18273 <entry>connections from one host</entry>
18276 <entry><option>smtp_accept_queue</option></entry>
18277 <entry>queue mail if more connections</entry>
18280 <entry><option>smtp_accept_queue_per_connection</option></entry>
18281 <entry>queue if more messages per connection</entry>
18284 <entry><option>smtp_accept_reserve</option></entry>
18285 <entry>only reserve hosts if more connections</entry>
18288 <entry><option>smtp_check_spool_space</option></entry>
18289 <entry>from SIZE on MAIL command</entry>
18292 <entry><option>smtp_connect_backlog</option></entry>
18293 <entry>passed to TCP/IP stack</entry>
18296 <entry><option>smtp_load_reserve</option></entry>
18297 <entry>SMTP from reserved hosts if load high</entry>
18300 <entry><option>smtp_reserve_hosts</option></entry>
18301 <entry>these are the reserve hosts</entry>
18308 <title>Policy controls</title>
18309 <informaltable frame="none">
18310 <tgroup cols="2" colsep="0" rowsep="0">
18311 <colspec colwidth="190pt" align="left"/>
18312 <colspec colwidth="260pt" align="left"/>
18315 <entry><option>acl_not_smtp</option></entry>
18316 <entry>ACL for non-SMTP messages</entry>
18319 <entry><option>acl_not_smtp_mime</option></entry>
18320 <entry>ACL for non-SMTP MIME parts</entry>
18323 <entry><option>acl_smtp_auth</option></entry>
18324 <entry>ACL for AUTH</entry>
18327 <entry><option>acl_smtp_connect</option></entry>
18328 <entry>ACL for connection</entry>
18331 <entry><option>acl_smtp_data</option></entry>
18332 <entry>ACL for DATA</entry>
18335 <entry><option>acl_smtp_etrn</option></entry>
18336 <entry>ACL for ETRN</entry>
18339 <entry><option>acl_smtp_expn</option></entry>
18340 <entry>ACL for EXPN</entry>
18343 <entry><option>acl_smtp_helo</option></entry>
18344 <entry>ACL for EHLO or HELO</entry>
18347 <entry><option>acl_smtp_mail</option></entry>
18348 <entry>ACL for MAIL</entry>
18351 <entry><option>acl_smtp_mailauth</option></entry>
18352 <entry>ACL for AUTH on MAIL command</entry>
18355 <entry><option>acl_smtp_mime</option></entry>
18356 <entry>ACL for MIME parts</entry>
18359 <entry><option>acl_smtp_predata</option></entry>
18360 <entry>ACL for start of data</entry>
18363 <entry><option>acl_smtp_quit</option></entry>
18364 <entry>ACL for QUIT</entry>
18367 <entry><option>acl_smtp_rcpt</option></entry>
18368 <entry>ACL for RCPT</entry>
18371 <entry><option>acl_smtp_starttls</option></entry>
18372 <entry>ACL for STARTTLS</entry>
18375 <entry><option>acl_smtp_vrfy</option></entry>
18376 <entry>ACL for VRFY</entry>
18379 <entry><option>av_scanner</option></entry>
18380 <entry>specify virus scanner</entry>
18383 <entry><option>check_rfc2047_length</option></entry>
18384 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
18387 <entry><option>dns_csa_search_limit</option></entry>
18388 <entry>control CSA parent search depth</entry>
18391 <entry><option>dns_csa_use_reverse</option></entry>
18392 <entry>en/disable CSA IP reverse search</entry>
18395 <entry><option>header_maxsize</option></entry>
18396 <entry>total size of message header</entry>
18399 <entry><option>header_line_maxsize</option></entry>
18400 <entry>individual header line limit</entry>
18403 <entry><option>helo_accept_junk_hosts</option></entry>
18404 <entry>allow syntactic junk from these hosts</entry>
18407 <entry><option>helo_allow_chars</option></entry>
18408 <entry>allow illegal chars in HELO names</entry>
18411 <entry><option>helo_lookup_domains</option></entry>
18412 <entry>lookup hostname for these HELO names</entry>
18415 <entry><option>helo_try_verify_hosts</option></entry>
18416 <entry>HELO soft-checked for these hosts</entry>
18419 <entry><option>helo_verify_hosts</option></entry>
18420 <entry>HELO hard-checked for these hosts</entry>
18423 <entry><option>host_lookup</option></entry>
18424 <entry>host name looked up for these hosts</entry>
18427 <entry><option>host_lookup_order</option></entry>
18428 <entry>order of DNS and local name lookups</entry>
18431 <entry><option>host_reject_connection</option></entry>
18432 <entry>reject connection from these hosts</entry>
18435 <entry><option>hosts_treat_as_local</option></entry>
18436 <entry>useful in some cluster configurations</entry>
18439 <entry><option>local_scan_timeout</option></entry>
18440 <entry>timeout for <function>local_scan()</function></entry>
18443 <entry><option>message_size_limit</option></entry>
18444 <entry>for all messages</entry>
18447 <entry><option>percent_hack_domains</option></entry>
18448 <entry>recognize %-hack for these domains</entry>
18451 <entry><option>spamd_address</option></entry>
18452 <entry>set interface to SpamAssassin</entry>
18459 <title>Callout cache</title>
18460 <informaltable frame="none">
18461 <tgroup cols="2" colsep="0" rowsep="0">
18462 <colspec colwidth="190pt" align="left"/>
18463 <colspec colwidth="260pt" align="left"/>
18466 <entry><option>callout_domain_negative_expire</option></entry>
18467 <entry>timeout for negative domain cache item</entry>
18470 <entry><option>callout_domain_positive_expire</option></entry>
18471 <entry>timeout for positive domain cache item</entry>
18474 <entry><option>callout_negative_expire</option></entry>
18475 <entry>timeout for negative address cache item</entry>
18478 <entry><option>callout_positive_expire</option></entry>
18479 <entry>timeout for positive address cache item</entry>
18482 <entry><option>callout_random_local_part</option></entry>
18483 <entry>string to use for <quote>random</quote> testing</entry>
18491 <informaltable frame="none">
18492 <tgroup cols="2" colsep="0" rowsep="0">
18493 <colspec colwidth="190pt" align="left"/>
18494 <colspec colwidth="260pt" align="left"/>
18497 <entry><option>tls_advertise_hosts</option></entry>
18498 <entry>advertise TLS to these hosts</entry>
18501 <entry><option>tls_certificate</option></entry>
18502 <entry>location of server certificate</entry>
18505 <entry><option>tls_crl</option></entry>
18506 <entry>certificate revocation list</entry>
18509 <entry><option>tls_dhparam</option></entry>
18510 <entry>DH parameters for server</entry>
18513 <entry><option>tls_on_connect_ports</option></entry>
18514 <entry>specify SSMTP (SMTPS) ports</entry>
18517 <entry><option>tls_privatekey</option></entry>
18518 <entry>location of server private key</entry>
18521 <entry><option>tls_remember_esmtp</option></entry>
18522 <entry>don’t reset after starting TLS</entry>
18525 <entry><option>tls_require_ciphers</option></entry>
18526 <entry>specify acceptable cipers</entry>
18529 <entry><option>tls_try_verify_hosts</option></entry>
18530 <entry>try to verify client certificate</entry>
18533 <entry><option>tls_verify_certificates</option></entry>
18534 <entry>expected client certificates</entry>
18537 <entry><option>tls_verify_hosts</option></entry>
18538 <entry>insist on client certificate verify</entry>
18545 <title>Local user handling</title>
18546 <informaltable frame="none">
18547 <tgroup cols="2" colsep="0" rowsep="0">
18548 <colspec colwidth="190pt" align="left"/>
18549 <colspec colwidth="260pt" align="left"/>
18552 <entry><option>finduser_retries</option></entry>
18553 <entry>useful in NIS environments</entry>
18556 <entry><option>gecos_name</option></entry>
18557 <entry>used when creating <emphasis>Sender:</emphasis></entry>
18560 <entry><option>gecos_pattern</option></entry>
18561 <entry>ditto</entry>
18564 <entry><option>max_username_length</option></entry>
18565 <entry>for systems that truncate</entry>
18568 <entry><option>unknown_login</option></entry>
18569 <entry>used when no login name found</entry>
18572 <entry><option>unknown_username</option></entry>
18573 <entry>ditto</entry>
18576 <entry><option>uucp_from_pattern</option></entry>
18577 <entry>for recognizing <quote>From </quote> lines</entry>
18580 <entry><option>uucp_from_sender</option></entry>
18581 <entry>ditto</entry>
18588 <title>All incoming messages (SMTP and non-SMTP)</title>
18589 <informaltable frame="none">
18590 <tgroup cols="2" colsep="0" rowsep="0">
18591 <colspec colwidth="190pt" align="left"/>
18592 <colspec colwidth="260pt" align="left"/>
18595 <entry><option>header_maxsize</option></entry>
18596 <entry>total size of message header</entry>
18599 <entry><option>header_line_maxsize</option></entry>
18600 <entry>individual header line limit</entry>
18603 <entry><option>message_size_limit</option></entry>
18604 <entry>applies to all messages</entry>
18607 <entry><option>percent_hack_domains</option></entry>
18608 <entry>recognize %-hack for these domains</entry>
18611 <entry><option>received_header_text</option></entry>
18612 <entry>expanded to make <emphasis>Received:</emphasis></entry>
18615 <entry><option>received_headers_max</option></entry>
18616 <entry>for mail loop detection</entry>
18619 <entry><option>recipients_max</option></entry>
18620 <entry>limit per message</entry>
18623 <entry><option>recipients_max_reject</option></entry>
18624 <entry>permanently reject excess</entry>
18631 <title>Non-SMTP incoming messages</title>
18632 <informaltable frame="none">
18633 <tgroup cols="2" colsep="0" rowsep="0">
18634 <colspec colwidth="190pt" align="left"/>
18635 <colspec colwidth="260pt" align="left"/>
18638 <entry><option>receive_timeout</option></entry>
18639 <entry>for non-SMTP messages</entry>
18646 <title>Incoming SMTP messages</title>
18648 See also the <emphasis>Policy controls</emphasis> section above.
18650 <informaltable frame="none">
18651 <tgroup cols="2" colsep="0" rowsep="0">
18652 <colspec colwidth="190pt" align="left"/>
18653 <colspec colwidth="260pt" align="left"/>
18656 <entry><option>host_lookup</option></entry>
18657 <entry>host name looked up for these hosts</entry>
18660 <entry><option>host_lookup_order</option></entry>
18661 <entry>order of DNS and local name lookups</entry>
18664 <entry><option>recipient_unqualified_hosts</option></entry>
18665 <entry>may send unqualified recipients</entry>
18668 <entry><option>rfc1413_hosts</option></entry>
18669 <entry>make ident calls to these hosts</entry>
18672 <entry><option>rfc1413_query_timeout</option></entry>
18673 <entry>zero disables ident calls</entry>
18676 <entry><option>sender_unqualified_hosts</option></entry>
18677 <entry>may send unqualified senders</entry>
18680 <entry><option>smtp_accept_keepalive</option></entry>
18681 <entry>some TCP/IP magic</entry>
18684 <entry><option>smtp_accept_max</option></entry>
18685 <entry>simultaneous incoming connections</entry>
18688 <entry><option>smtp_accept_max_nonmail</option></entry>
18689 <entry>non-mail commands</entry>
18692 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
18693 <entry>hosts to which the limit applies</entry>
18696 <entry><option>smtp_accept_max_per_connection</option></entry>
18697 <entry>messages per connection</entry>
18700 <entry><option>smtp_accept_max_per_host</option></entry>
18701 <entry>connections from one host</entry>
18704 <entry><option>smtp_accept_queue</option></entry>
18705 <entry>queue mail if more connections</entry>
18708 <entry><option>smtp_accept_queue_per_connection</option></entry>
18709 <entry>queue if more messages per connection</entry>
18712 <entry><option>smtp_accept_reserve</option></entry>
18713 <entry>only reserve hosts if more connections</entry>
18716 <entry><option>smtp_active_hostname</option></entry>
18717 <entry>host name to use in messages</entry>
18720 <entry><option>smtp_banner</option></entry>
18721 <entry>text for welcome banner</entry>
18724 <entry><option>smtp_check_spool_space</option></entry>
18725 <entry>from SIZE on MAIL command</entry>
18728 <entry><option>smtp_connect_backlog</option></entry>
18729 <entry>passed to TCP/IP stack</entry>
18732 <entry><option>smtp_enforce_sync</option></entry>
18733 <entry>of SMTP command/responses</entry>
18736 <entry><option>smtp_etrn_command</option></entry>
18737 <entry>what to run for ETRN</entry>
18740 <entry><option>smtp_etrn_serialize</option></entry>
18741 <entry>only one at once</entry>
18744 <entry><option>smtp_load_reserve</option></entry>
18745 <entry>only reserve hosts if this load</entry>
18748 <entry><option>smtp_max_unknown_commands</option></entry>
18749 <entry>before dropping connection</entry>
18752 <entry><option>smtp_ratelimit_hosts</option></entry>
18753 <entry>apply ratelimiting to these hosts</entry>
18756 <entry><option>smtp_ratelimit_mail</option></entry>
18757 <entry>ratelimit for MAIL commands</entry>
18760 <entry><option>smtp_ratelimit_rcpt</option></entry>
18761 <entry>ratelimit for RCPT commands</entry>
18764 <entry><option>smtp_receive_timeout</option></entry>
18765 <entry>per command or data line</entry>
18768 <entry><option>smtp_reserve_hosts</option></entry>
18769 <entry>these are the reserve hosts</entry>
18772 <entry><option>smtp_return_error_details</option></entry>
18773 <entry>give detail on rejections</entry>
18780 <title>SMTP extensions</title>
18781 <informaltable frame="none">
18782 <tgroup cols="2" colsep="0" rowsep="0">
18783 <colspec colwidth="190pt" align="left"/>
18784 <colspec colwidth="260pt" align="left"/>
18787 <entry><option>accept_8bitmime</option></entry>
18788 <entry>advertise 8BITMIME</entry>
18791 <entry><option>auth_advertise_hosts</option></entry>
18792 <entry>advertise AUTH to these hosts</entry>
18795 <entry><option>ignore_fromline_hosts</option></entry>
18796 <entry>allow <quote>From </quote> from these hosts</entry>
18799 <entry><option>ignore_fromline_local</option></entry>
18800 <entry>allow <quote>From </quote> from local SMTP</entry>
18803 <entry><option>pipelining_advertise_hosts</option></entry>
18804 <entry>advertise pipelining to these hosts</entry>
18807 <entry><option>tls_advertise_hosts</option></entry>
18808 <entry>advertise TLS to these hosts</entry>
18815 <title>Processing messages</title>
18816 <informaltable frame="none">
18817 <tgroup cols="2" colsep="0" rowsep="0">
18818 <colspec colwidth="190pt" align="left"/>
18819 <colspec colwidth="260pt" align="left"/>
18822 <entry><option>allow_domain_literals</option></entry>
18823 <entry>recognize domain literal syntax</entry>
18826 <entry><option>allow_mx_to_ip</option></entry>
18827 <entry>allow MX to point to IP address</entry>
18830 <entry><option>allow_utf8_domains</option></entry>
18831 <entry>in addresses</entry>
18834 <entry><option>check_rfc2047_length</option></entry>
18835 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
18838 <entry><option>delivery_date_remove</option></entry>
18839 <entry>from incoming messages</entry>
18842 <entry><option>envelope_to_remote</option></entry>
18843 <entry>from incoming messages</entry>
18846 <entry><option>extract_addresses_remove_arguments</option></entry>
18847 <entry>affects <option>-t</option> processing</entry>
18850 <entry><option>headers_charset</option></entry>
18851 <entry>default for translations</entry>
18854 <entry><option>qualify_domain</option></entry>
18855 <entry>default for senders</entry>
18858 <entry><option>qualify_recipient</option></entry>
18859 <entry>default for recipients</entry>
18862 <entry><option>return_path_remove</option></entry>
18863 <entry>from incoming messages</entry>
18866 <entry><option>strip_excess_angle_brackets</option></entry>
18867 <entry>in addresses</entry>
18870 <entry><option>strip_trailing_dot</option></entry>
18871 <entry>at end of addresses</entry>
18874 <entry><option>untrusted_set_sender</option></entry>
18875 <entry>untrusted can set envelope sender</entry>
18882 <title>System filter</title>
18883 <informaltable frame="none">
18884 <tgroup cols="2" colsep="0" rowsep="0">
18885 <colspec colwidth="190pt" align="left"/>
18886 <colspec colwidth="260pt" align="left"/>
18889 <entry><option>system_filter</option></entry>
18890 <entry>locate system filter</entry>
18893 <entry><option>system_filter_directory_transport</option></entry>
18894 <entry>transport for delivery to a directory</entry>
18897 <entry><option>system_filter_file_transport</option></entry>
18898 <entry>transport for delivery to a file</entry>
18901 <entry><option>system_filter_group</option></entry>
18902 <entry>group for filter running</entry>
18905 <entry><option>system_filter_pipe_transport</option></entry>
18906 <entry>transport for delivery to a pipe</entry>
18909 <entry><option>system_filter_reply_transport</option></entry>
18910 <entry>transport for autoreply delivery</entry>
18913 <entry><option>system_filter_user</option></entry>
18914 <entry>user for filter running</entry>
18921 <title>Routing and delivery</title>
18922 <informaltable frame="none">
18923 <tgroup cols="2" colsep="0" rowsep="0">
18924 <colspec colwidth="190pt" align="left"/>
18925 <colspec colwidth="260pt" align="left"/>
18928 <entry><option>disable_ipv6</option></entry>
18929 <entry>do no IPv6 processing</entry>
18932 <entry><option>dns_again_means_nonexist</option></entry>
18933 <entry>for broken domains</entry>
18936 <entry><option>dns_check_names_pattern</option></entry>
18937 <entry>pre-DNS syntax check</entry>
18940 <entry><option>dns_ipv4_lookup</option></entry>
18941 <entry>only v4 lookup for these domains</entry>
18944 <entry><option>dns_retrans</option></entry>
18945 <entry>parameter for resolver</entry>
18948 <entry><option>dns_retry</option></entry>
18949 <entry>parameter for resolver</entry>
18952 <entry><option>hold_domains</option></entry>
18953 <entry>hold delivery for these domains</entry>
18956 <entry><option>local_interfaces</option></entry>
18957 <entry>for routing checks</entry>
18960 <entry><option>queue_domains</option></entry>
18961 <entry>no immediate delivery for these</entry>
18964 <entry><option>queue_only</option></entry>
18965 <entry>no immediate delivery at all</entry>
18968 <entry><option>queue_only_file</option></entry>
18969 <entry>no immediate delivery if file exists</entry>
18972 <entry><option>queue_only_load</option></entry>
18973 <entry>no immediate delivery if load is high</entry>
18976 <entry><option>queue_only_override</option></entry>
18977 <entry>allow command line to override</entry>
18980 <entry><option>queue_run_in_order</option></entry>
18981 <entry>order of arrival</entry>
18984 <entry><option>queue_run_max</option></entry>
18985 <entry>of simultaneous queue runners</entry>
18988 <entry><option>queue_smtp_domains</option></entry>
18989 <entry>no immediate SMTP delivery for these</entry>
18992 <entry><option>remote_max_parallel</option></entry>
18993 <entry>parallel SMTP delivery per message</entry>
18996 <entry><option>remote_sort_domains</option></entry>
18997 <entry>order of remote deliveries</entry>
19000 <entry><option>retry_data_expire</option></entry>
19001 <entry>timeout for retry data</entry>
19004 <entry><option>retry_interval_max</option></entry>
19005 <entry>safety net for retry rules</entry>
19012 <title>Bounce and warning messages</title>
19013 <informaltable frame="none">
19014 <tgroup cols="2" colsep="0" rowsep="0">
19015 <colspec colwidth="190pt" align="left"/>
19016 <colspec colwidth="260pt" align="left"/>
19019 <entry><option>bounce_message_file</option></entry>
19020 <entry>content of bounce</entry>
19023 <entry><option>bounce_message_text</option></entry>
19024 <entry>content of bounce</entry>
19027 <entry><option>bounce_return_body</option></entry>
19028 <entry>include body if returning message</entry>
19031 <entry><option>bounce_return_message</option></entry>
19032 <entry>include original message in bounce</entry>
19035 <entry><option>bounce_return_size_limit</option></entry>
19036 <entry>limit on returned message</entry>
19039 <entry><option>bounce_sender_authentication</option></entry>
19040 <entry>send authenticated sender with bounce</entry>
19043 <entry><option>errors_copy</option></entry>
19044 <entry>copy bounce messages</entry>
19047 <entry><option>errors_reply_to</option></entry>
19048 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
19051 <entry><option>delay_warning</option></entry>
19052 <entry>time schedule</entry>
19055 <entry><option>delay_warning_condition</option></entry>
19056 <entry>condition for warning messages</entry>
19059 <entry><option>ignore_bounce_errors_after</option></entry>
19060 <entry>discard undeliverable bounces</entry>
19063 <entry><option>smtp_return_error_details</option></entry>
19064 <entry>give detail on rejections</entry>
19067 <entry><option>warn_message_file</option></entry>
19068 <entry>content of warning message</entry>
19074 <section id="SECTalomo">
19075 <title>Alphabetical list of main options</title>
19077 Those options that undergo string expansion before use are marked with
19081 <indexterm role="option">
19082 <primary>accept_8bitmime</primary>
19085 <informaltable frame="all">
19086 <tgroup cols="4" colsep="0" rowsep="0">
19087 <colspec colwidth="8*" align="left"/>
19088 <colspec colwidth="5*" align="center"/>
19089 <colspec colwidth="5*" align="center"/>
19090 <colspec colwidth="6*" align="right"/>
19093 <entry><option>accept_8bitmime</option></entry>
19094 <entry>Use: <emphasis>main</emphasis></entry>
19095 <entry>Type: <emphasis>boolean</emphasis></entry>
19096 <entry>Default: <emphasis>false</emphasis></entry>
19102 <indexterm role="concept">
19103 <primary>8BITMIME</primary>
19105 <indexterm role="concept">
19106 <primary>8-bit characters</primary>
19108 This option causes Exim to send 8BITMIME in its response to an SMTP
19109 EHLO command, and to accept the BODY= parameter on MAIL commands.
19110 However, though Exim is 8-bit clean, it is not a protocol converter, and it
19111 takes no steps to do anything special with messages received by this route.
19112 Consequently, this option is turned off by default.
19115 <indexterm role="option">
19116 <primary>acl_not_smtp</primary>
19119 <informaltable frame="all">
19120 <tgroup cols="4" colsep="0" rowsep="0">
19121 <colspec colwidth="8*" align="left"/>
19122 <colspec colwidth="5*" align="center"/>
19123 <colspec colwidth="5*" align="center"/>
19124 <colspec colwidth="6*" align="right"/>
19127 <entry><option>acl_not_smtp</option></entry>
19128 <entry>Use: <emphasis>main</emphasis></entry>
19129 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19130 <entry>Default: <emphasis>unset</emphasis></entry>
19136 <indexterm role="concept">
19137 <primary>access control lists (ACLs)</primary>
19138 <secondary>for non-SMTP messages</secondary>
19140 <indexterm role="concept">
19141 <primary>non-SMTP messages</primary>
19142 <secondary>ACLs for</secondary>
19144 This option defines the ACL that is run when a non-SMTP message is on the point
19145 of being accepted. See chapter <xref linkend="CHAPACL"/> for further details.
19148 <indexterm role="option">
19149 <primary>acl_not_smtp_mime</primary>
19152 <informaltable frame="all">
19153 <tgroup cols="4" colsep="0" rowsep="0">
19154 <colspec colwidth="8*" align="left"/>
19155 <colspec colwidth="5*" align="center"/>
19156 <colspec colwidth="5*" align="center"/>
19157 <colspec colwidth="6*" align="right"/>
19160 <entry><option>acl_not_smtp_mime</option></entry>
19161 <entry>Use: <emphasis>main</emphasis></entry>
19162 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19163 <entry>Default: <emphasis>unset</emphasis></entry>
19169 This option defines the ACL that is run for individual MIME parts of non-SMTP
19170 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
19174 <indexterm role="option">
19175 <primary>acl_smtp_auth</primary>
19178 <informaltable frame="all">
19179 <tgroup cols="4" colsep="0" rowsep="0">
19180 <colspec colwidth="8*" align="left"/>
19181 <colspec colwidth="5*" align="center"/>
19182 <colspec colwidth="5*" align="center"/>
19183 <colspec colwidth="6*" align="right"/>
19186 <entry><option>acl_smtp_auth</option></entry>
19187 <entry>Use: <emphasis>main</emphasis></entry>
19188 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19189 <entry>Default: <emphasis>unset</emphasis></entry>
19195 <indexterm role="concept">
19196 <primary>access control lists (ACLs)</primary>
19197 <secondary>setting up for SMTP commands</secondary>
19199 <indexterm role="concept">
19200 <primary>AUTH</primary>
19201 <secondary>ACL for</secondary>
19203 This option defines the ACL that is run when an SMTP AUTH command is
19204 received. See chapter <xref linkend="CHAPACL"/> for further details.
19207 <indexterm role="option">
19208 <primary>acl_smtp_connect</primary>
19211 <informaltable frame="all">
19212 <tgroup cols="4" colsep="0" rowsep="0">
19213 <colspec colwidth="8*" align="left"/>
19214 <colspec colwidth="5*" align="center"/>
19215 <colspec colwidth="5*" align="center"/>
19216 <colspec colwidth="6*" align="right"/>
19219 <entry><option>acl_smtp_connect</option></entry>
19220 <entry>Use: <emphasis>main</emphasis></entry>
19221 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19222 <entry>Default: <emphasis>unset</emphasis></entry>
19228 <indexterm role="concept">
19229 <primary>access control lists (ACLs)</primary>
19230 <secondary>on SMTP connection</secondary>
19232 This option defines the ACL that is run when an SMTP connection is received.
19233 See chapter <xref linkend="CHAPACL"/> for further details.
19236 <indexterm role="option">
19237 <primary>acl_smtp_data</primary>
19240 <informaltable frame="all">
19241 <tgroup cols="4" colsep="0" rowsep="0">
19242 <colspec colwidth="8*" align="left"/>
19243 <colspec colwidth="5*" align="center"/>
19244 <colspec colwidth="5*" align="center"/>
19245 <colspec colwidth="6*" align="right"/>
19248 <entry><option>acl_smtp_data</option></entry>
19249 <entry>Use: <emphasis>main</emphasis></entry>
19250 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19251 <entry>Default: <emphasis>unset</emphasis></entry>
19257 <indexterm role="concept">
19258 <primary>DATA</primary>
19259 <secondary>ACL for</secondary>
19261 This option defines the ACL that is run after an SMTP DATA command has been
19262 processed and the message itself has been received, but before the final
19263 acknowledgement is sent. See chapter <xref linkend="CHAPACL"/> for further details.
19266 <indexterm role="option">
19267 <primary>acl_smtp_etrn</primary>
19270 <informaltable frame="all">
19271 <tgroup cols="4" colsep="0" rowsep="0">
19272 <colspec colwidth="8*" align="left"/>
19273 <colspec colwidth="5*" align="center"/>
19274 <colspec colwidth="5*" align="center"/>
19275 <colspec colwidth="6*" align="right"/>
19278 <entry><option>acl_smtp_etrn</option></entry>
19279 <entry>Use: <emphasis>main</emphasis></entry>
19280 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19281 <entry>Default: <emphasis>unset</emphasis></entry>
19287 <indexterm role="concept">
19288 <primary>ETRN</primary>
19289 <secondary>ACL for</secondary>
19291 This option defines the ACL that is run when an SMTP ETRN command is
19292 received. See chapter <xref linkend="CHAPACL"/> for further details.
19295 <indexterm role="option">
19296 <primary>acl_smtp_expn</primary>
19299 <informaltable frame="all">
19300 <tgroup cols="4" colsep="0" rowsep="0">
19301 <colspec colwidth="8*" align="left"/>
19302 <colspec colwidth="5*" align="center"/>
19303 <colspec colwidth="5*" align="center"/>
19304 <colspec colwidth="6*" align="right"/>
19307 <entry><option>acl_smtp_expn</option></entry>
19308 <entry>Use: <emphasis>main</emphasis></entry>
19309 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19310 <entry>Default: <emphasis>unset</emphasis></entry>
19316 <indexterm role="concept">
19317 <primary>EXPN</primary>
19318 <secondary>ACL for</secondary>
19320 This option defines the ACL that is run when an SMTP EXPN command is
19321 received. See chapter <xref linkend="CHAPACL"/> for further details.
19324 <indexterm role="option">
19325 <primary>acl_smtp_helo</primary>
19328 <informaltable frame="all">
19329 <tgroup cols="4" colsep="0" rowsep="0">
19330 <colspec colwidth="8*" align="left"/>
19331 <colspec colwidth="5*" align="center"/>
19332 <colspec colwidth="5*" align="center"/>
19333 <colspec colwidth="6*" align="right"/>
19336 <entry><option>acl_smtp_helo</option></entry>
19337 <entry>Use: <emphasis>main</emphasis></entry>
19338 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19339 <entry>Default: <emphasis>unset</emphasis></entry>
19345 <indexterm role="concept">
19346 <primary>EHLO</primary>
19347 <secondary>ACL for</secondary>
19349 <indexterm role="concept">
19350 <primary>HELO</primary>
19351 <secondary>ACL for</secondary>
19353 This option defines the ACL that is run when an SMTP EHLO or HELO
19354 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
19357 <indexterm role="option">
19358 <primary>acl_smtp_mail</primary>
19361 <informaltable frame="all">
19362 <tgroup cols="4" colsep="0" rowsep="0">
19363 <colspec colwidth="8*" align="left"/>
19364 <colspec colwidth="5*" align="center"/>
19365 <colspec colwidth="5*" align="center"/>
19366 <colspec colwidth="6*" align="right"/>
19369 <entry><option>acl_smtp_mail</option></entry>
19370 <entry>Use: <emphasis>main</emphasis></entry>
19371 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19372 <entry>Default: <emphasis>unset</emphasis></entry>
19378 <indexterm role="concept">
19379 <primary>MAIL</primary>
19380 <secondary>ACL for</secondary>
19382 This option defines the ACL that is run when an SMTP MAIL command is
19383 received. See chapter <xref linkend="CHAPACL"/> for further details.
19386 <indexterm role="option">
19387 <primary>acl_smtp_mailauth</primary>
19390 <informaltable frame="all">
19391 <tgroup cols="4" colsep="0" rowsep="0">
19392 <colspec colwidth="8*" align="left"/>
19393 <colspec colwidth="5*" align="center"/>
19394 <colspec colwidth="5*" align="center"/>
19395 <colspec colwidth="6*" align="right"/>
19398 <entry><option>acl_smtp_mailauth</option></entry>
19399 <entry>Use: <emphasis>main</emphasis></entry>
19400 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19401 <entry>Default: <emphasis>unset</emphasis></entry>
19407 <indexterm role="concept">
19408 <primary>AUTH</primary>
19409 <secondary>on MAIL command</secondary>
19411 This option defines the ACL that is run when there is an AUTH parameter on
19412 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
19413 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
19416 <indexterm role="option">
19417 <primary>acl_smtp_mime</primary>
19420 <informaltable frame="all">
19421 <tgroup cols="4" colsep="0" rowsep="0">
19422 <colspec colwidth="8*" align="left"/>
19423 <colspec colwidth="5*" align="center"/>
19424 <colspec colwidth="5*" align="center"/>
19425 <colspec colwidth="6*" align="right"/>
19428 <entry><option>acl_smtp_mime</option></entry>
19429 <entry>Use: <emphasis>main</emphasis></entry>
19430 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19431 <entry>Default: <emphasis>unset</emphasis></entry>
19437 <indexterm role="concept">
19438 <primary>MIME content scanning</primary>
19439 <secondary>ACL for</secondary>
19441 This option is available when Exim is built with the content-scanning
19442 extension. It defines the ACL that is run for each MIME part in a message. See
19443 section <xref linkend="SECTscanmimepart"/> for details.
19446 <indexterm role="option">
19447 <primary>acl_smtp_predata</primary>
19450 <informaltable frame="all">
19451 <tgroup cols="4" colsep="0" rowsep="0">
19452 <colspec colwidth="8*" align="left"/>
19453 <colspec colwidth="5*" align="center"/>
19454 <colspec colwidth="5*" align="center"/>
19455 <colspec colwidth="6*" align="right"/>
19458 <entry><option>acl_smtp_predata</option></entry>
19459 <entry>Use: <emphasis>main</emphasis></entry>
19460 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19461 <entry>Default: <emphasis>unset</emphasis></entry>
19467 This option defines the ACL that is run when an SMTP DATA command is
19468 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
19472 <indexterm role="option">
19473 <primary>acl_smtp_quit</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_quit</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>QUIT</primary>
19495 <secondary>ACL for</secondary>
19497 This option defines the ACL that is run when an SMTP QUIT command is
19498 received. See chapter <xref linkend="CHAPACL"/> for further details.
19501 <indexterm role="option">
19502 <primary>acl_smtp_rcpt</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_rcpt</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>RCPT</primary>
19524 <secondary>ACL for</secondary>
19526 This option defines the ACL that is run when an SMTP RCPT command is
19527 received. See chapter <xref linkend="CHAPACL"/> for further details.
19530 <indexterm role="option">
19531 <primary>acl_smtp_starttls</primary>
19534 <informaltable frame="all">
19535 <tgroup cols="4" colsep="0" rowsep="0">
19536 <colspec colwidth="8*" align="left"/>
19537 <colspec colwidth="5*" align="center"/>
19538 <colspec colwidth="5*" align="center"/>
19539 <colspec colwidth="6*" align="right"/>
19542 <entry><option>acl_smtp_starttls</option></entry>
19543 <entry>Use: <emphasis>main</emphasis></entry>
19544 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19545 <entry>Default: <emphasis>unset</emphasis></entry>
19551 <indexterm role="concept">
19552 <primary>STARTTLS</primary>
19553 <secondary>ACL for</secondary>
19555 This option defines the ACL that is run when an SMTP STARTTLS command is
19556 received. See chapter <xref linkend="CHAPACL"/> for further details.
19559 <indexterm role="option">
19560 <primary>acl_smtp_vrfy</primary>
19563 <informaltable frame="all">
19564 <tgroup cols="4" colsep="0" rowsep="0">
19565 <colspec colwidth="8*" align="left"/>
19566 <colspec colwidth="5*" align="center"/>
19567 <colspec colwidth="5*" align="center"/>
19568 <colspec colwidth="6*" align="right"/>
19571 <entry><option>acl_smtp_vrfy</option></entry>
19572 <entry>Use: <emphasis>main</emphasis></entry>
19573 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19574 <entry>Default: <emphasis>unset</emphasis></entry>
19580 <indexterm role="concept">
19581 <primary>VRFY</primary>
19582 <secondary>ACL for</secondary>
19584 This option defines the ACL that is run when an SMTP VRFY command is
19585 received. See chapter <xref linkend="CHAPACL"/> for further details.
19588 <indexterm role="option">
19589 <primary>admin_groups</primary>
19592 <informaltable frame="all">
19593 <tgroup cols="4" colsep="0" rowsep="0">
19594 <colspec colwidth="8*" align="left"/>
19595 <colspec colwidth="5*" align="center"/>
19596 <colspec colwidth="5*" align="center"/>
19597 <colspec colwidth="6*" align="right"/>
19600 <entry><option>admin_groups</option></entry>
19601 <entry>Use: <emphasis>main</emphasis></entry>
19602 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
19603 <entry>Default: <emphasis>unset</emphasis></entry>
19609 <indexterm role="concept">
19610 <primary>admin user</primary>
19612 This option is expanded just once, at the start of Exim’s processing. If the
19613 current group or any of the supplementary groups of an Exim caller is in this
19614 colon-separated list, the caller has admin privileges. If all your system
19615 programmers are in a specific group, for example, you can give them all Exim
19616 admin privileges by putting that group in <option>admin_groups</option>. However, this does
19617 not permit them to read Exim’s spool files (whose group owner is the Exim gid).
19618 To permit this, you have to add individuals to the Exim group.
19621 <indexterm role="option">
19622 <primary>allow_domain_literals</primary>
19625 <informaltable frame="all">
19626 <tgroup cols="4" colsep="0" rowsep="0">
19627 <colspec colwidth="8*" align="left"/>
19628 <colspec colwidth="5*" align="center"/>
19629 <colspec colwidth="5*" align="center"/>
19630 <colspec colwidth="6*" align="right"/>
19633 <entry><option>allow_domain_literals</option></entry>
19634 <entry>Use: <emphasis>main</emphasis></entry>
19635 <entry>Type: <emphasis>boolean</emphasis></entry>
19636 <entry>Default: <emphasis>false</emphasis></entry>
19642 <indexterm role="concept">
19643 <primary>domain literal</primary>
19645 If this option is set, the RFC 2822 domain literal format is permitted in
19646 email addresses. The option is not set by default, because the domain literal
19647 format is not normally required these days, and few people know about it. It
19648 has, however, been exploited by mail abusers.
19651 Unfortunately, it seems that some DNS black list maintainers are using this
19652 format to report black listing to postmasters. If you want to accept messages
19653 addressed to your hosts by IP address, you need to set
19654 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
19655 domains (defined in the named domain list <option>local_domains</option> in the default
19656 configuration). This <quote>magic string</quote> matches the domain literal form of all
19657 the local host’s IP addresses.
19660 <indexterm role="option">
19661 <primary>allow_mx_to_ip</primary>
19664 <informaltable frame="all">
19665 <tgroup cols="4" colsep="0" rowsep="0">
19666 <colspec colwidth="8*" align="left"/>
19667 <colspec colwidth="5*" align="center"/>
19668 <colspec colwidth="5*" align="center"/>
19669 <colspec colwidth="6*" align="right"/>
19672 <entry><option>allow_mx_to_ip</option></entry>
19673 <entry>Use: <emphasis>main</emphasis></entry>
19674 <entry>Type: <emphasis>boolean</emphasis></entry>
19675 <entry>Default: <emphasis>false</emphasis></entry>
19681 <indexterm role="concept">
19682 <primary>MX record</primary>
19683 <secondary>pointing to IP address</secondary>
19685 It appears that more and more DNS zone administrators are breaking the rules
19686 and putting domain names that look like IP addresses on the right hand side of
19687 MX records. Exim follows the rules and rejects this, giving an error message
19688 that explains the mis-configuration. However, some other MTAs support this
19689 practice, so to avoid <quote>Why can’t Exim do this?</quote> complaints,
19690 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
19691 recommended, except when you have no other choice.
19694 <indexterm role="option">
19695 <primary>allow_utf8_domains</primary>
19698 <informaltable frame="all">
19699 <tgroup cols="4" colsep="0" rowsep="0">
19700 <colspec colwidth="8*" align="left"/>
19701 <colspec colwidth="5*" align="center"/>
19702 <colspec colwidth="5*" align="center"/>
19703 <colspec colwidth="6*" align="right"/>
19706 <entry><option>allow_utf8_domains</option></entry>
19707 <entry>Use: <emphasis>main</emphasis></entry>
19708 <entry>Type: <emphasis>boolean</emphasis></entry>
19709 <entry>Default: <emphasis>false</emphasis></entry>
19715 <indexterm role="concept">
19716 <primary>domain</primary>
19717 <secondary>UTF-8 characters in</secondary>
19719 <indexterm role="concept">
19720 <primary>UTF-8</primary>
19721 <secondary>in domain name</secondary>
19723 Lots of discussion is going on about internationalized domain names. One
19724 camp is strongly in favour of just using UTF-8 characters, and it seems
19725 that at least two other MTAs permit this. This option allows Exim users to
19726 experiment if they wish.
19729 If it is set true, Exim’s domain parsing function allows valid
19730 UTF-8 multicharacters to appear in domain name components, in addition to
19731 letters, digits, and hyphens. However, just setting this option is not
19732 enough; if you want to look up these domain names in the DNS, you must also
19733 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
19734 suitable setting is:
19736 <literallayout class="monospaced">
19737 dns_check_names_pattern = (?i)^(?>(?(1)\.|())[a-z0-9\xc0-\xff]\
19738 (?>[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
19741 Alternatively, you can just disable this feature by setting
19743 <literallayout class="monospaced">
19744 dns_check_names_pattern =
19747 That is, set the option to an empty string so that no check is done.
19750 <indexterm role="option">
19751 <primary>auth_advertise_hosts</primary>
19754 <informaltable frame="all">
19755 <tgroup cols="4" colsep="0" rowsep="0">
19756 <colspec colwidth="8*" align="left"/>
19757 <colspec colwidth="5*" align="center"/>
19758 <colspec colwidth="5*" align="center"/>
19759 <colspec colwidth="6*" align="right"/>
19762 <entry><option>auth_advertise_hosts</option></entry>
19763 <entry>Use: <emphasis>main</emphasis></entry>
19764 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
19765 <entry>Default: <emphasis>*</emphasis></entry>
19771 <indexterm role="concept">
19772 <primary>authentication</primary>
19773 <secondary>advertising</secondary>
19775 <indexterm role="concept">
19776 <primary>AUTH</primary>
19777 <secondary>advertising</secondary>
19779 If any server authentication mechanisms are configured, Exim advertises them in
19780 response to an EHLO command only if the calling host matches this list.
19781 Otherwise, Exim does not advertise AUTH.
19782 Exim does not accept AUTH commands from clients to which it has not
19783 advertised the availability of AUTH. The advertising of individual
19784 authentication mechanisms can be controlled by the use of the
19785 <option>server_advertise_condition</option> generic authenticator option on the individual
19786 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
19789 Certain mail clients (for example, Netscape) require the user to provide a name
19790 and password for authentication if AUTH is advertised, even though it may
19791 not be needed (the host may accept messages from hosts on its local LAN without
19792 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
19793 to make these clients more friendly by excluding them from the set of hosts to
19794 which Exim advertises AUTH.
19797 <indexterm role="concept">
19798 <primary>AUTH</primary>
19799 <secondary>advertising when encrypted</secondary>
19801 If you want to advertise the availability of AUTH only when the connection
19802 is encrypted using TLS, you can make use of the fact that the value of this
19803 option is expanded, with a setting like this:
19805 <literallayout class="monospaced">
19806 auth_advertise_hosts = ${if eq{$tls_cipher}{}{}{*}}
19809 <indexterm role="concept">
19810 <primary><varname>$tls_cipher</varname></primary>
19812 If <varname>$tls_cipher</varname> is empty, the session is not encrypted, and the result of
19813 the expansion is empty, thus matching no hosts. Otherwise, the result of the
19814 expansion is *, which matches all hosts.
19817 <indexterm role="option">
19818 <primary>auto_thaw</primary>
19821 <informaltable frame="all">
19822 <tgroup cols="4" colsep="0" rowsep="0">
19823 <colspec colwidth="8*" align="left"/>
19824 <colspec colwidth="5*" align="center"/>
19825 <colspec colwidth="5*" align="center"/>
19826 <colspec colwidth="6*" align="right"/>
19829 <entry><option>auto_thaw</option></entry>
19830 <entry>Use: <emphasis>main</emphasis></entry>
19831 <entry>Type: <emphasis>time</emphasis></entry>
19832 <entry>Default: <emphasis>0s</emphasis></entry>
19838 <indexterm role="concept">
19839 <primary>thawing messages</primary>
19841 <indexterm role="concept">
19842 <primary>unfreezing messages</primary>
19844 If this option is set to a time greater than zero, a queue runner will try a
19845 new delivery attempt on any frozen message, other than a bounce message, if
19846 this much time has passed since it was frozen. This may result in the message
19847 being re-frozen if nothing has changed since the last attempt. It is a way of
19848 saying <quote>keep on trying, even though there are big problems</quote>.
19851 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
19852 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
19853 thought to be very useful any more, and its use should probably be avoided.
19856 <indexterm role="option">
19857 <primary>av_scanner</primary>
19860 <informaltable frame="all">
19861 <tgroup cols="4" colsep="0" rowsep="0">
19862 <colspec colwidth="8*" align="left"/>
19863 <colspec colwidth="5*" align="center"/>
19864 <colspec colwidth="5*" align="center"/>
19865 <colspec colwidth="6*" align="right"/>
19868 <entry><option>av_scanner</option></entry>
19869 <entry>Use: <emphasis>main</emphasis></entry>
19870 <entry>Type: <emphasis>string</emphasis></entry>
19871 <entry>Default: <emphasis>see below</emphasis></entry>
19877 This option is available if Exim is built with the content-scanning extension.
19878 It specifies which anti-virus scanner to use. The default value is:
19880 <literallayout class="monospaced">
19881 sophie:/var/run/sophie
19884 If the value of <option>av_scanner</option> starts with dollar character, it is expanded
19885 before use. See section <xref linkend="SECTscanvirus"/> for further details.
19888 <indexterm role="option">
19889 <primary>bi_command</primary>
19892 <informaltable frame="all">
19893 <tgroup cols="4" colsep="0" rowsep="0">
19894 <colspec colwidth="8*" align="left"/>
19895 <colspec colwidth="5*" align="center"/>
19896 <colspec colwidth="5*" align="center"/>
19897 <colspec colwidth="6*" align="right"/>
19900 <entry><option>bi_command</option></entry>
19901 <entry>Use: <emphasis>main</emphasis></entry>
19902 <entry>Type: <emphasis>string</emphasis></entry>
19903 <entry>Default: <emphasis>unset</emphasis></entry>
19909 <indexterm role="concept">
19910 <primary><option>-bi</option> option</primary>
19912 This option supplies the name of a command that is run when Exim is called with
19913 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
19914 just the command name, it is not a complete command line. If an argument is
19915 required, it must come from the <option>-oA</option> command line option.
19918 <indexterm role="option">
19919 <primary>bounce_message_file</primary>
19922 <informaltable frame="all">
19923 <tgroup cols="4" colsep="0" rowsep="0">
19924 <colspec colwidth="8*" align="left"/>
19925 <colspec colwidth="5*" align="center"/>
19926 <colspec colwidth="5*" align="center"/>
19927 <colspec colwidth="6*" align="right"/>
19930 <entry><option>bounce_message_file</option></entry>
19931 <entry>Use: <emphasis>main</emphasis></entry>
19932 <entry>Type: <emphasis>string</emphasis></entry>
19933 <entry>Default: <emphasis>unset</emphasis></entry>
19939 <indexterm role="concept">
19940 <primary>bounce message</primary>
19941 <secondary>customizing</secondary>
19943 <indexterm role="concept">
19944 <primary>customizing</primary>
19945 <secondary>bounce message</secondary>
19947 This option defines a template file containing paragraphs of text to be used
19948 for constructing bounce messages. Details of the file’s contents are given in
19949 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
19952 <indexterm role="option">
19953 <primary>bounce_message_text</primary>
19956 <informaltable frame="all">
19957 <tgroup cols="4" colsep="0" rowsep="0">
19958 <colspec colwidth="8*" align="left"/>
19959 <colspec colwidth="5*" align="center"/>
19960 <colspec colwidth="5*" align="center"/>
19961 <colspec colwidth="6*" align="right"/>
19964 <entry><option>bounce_message_text</option></entry>
19965 <entry>Use: <emphasis>main</emphasis></entry>
19966 <entry>Type: <emphasis>string</emphasis></entry>
19967 <entry>Default: <emphasis>unset</emphasis></entry>
19973 When this option is set, its contents are included in the default bounce
19974 message immediately after <quote>This message was created automatically by mail
19975 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
19978 <indexterm role="option">
19979 <primary>bounce_return_body</primary>
19982 <informaltable frame="all">
19983 <tgroup cols="4" colsep="0" rowsep="0">
19984 <colspec colwidth="8*" align="left"/>
19985 <colspec colwidth="5*" align="center"/>
19986 <colspec colwidth="5*" align="center"/>
19987 <colspec colwidth="6*" align="right"/>
19990 <entry><option>bounce_return_body</option></entry>
19991 <entry>Use: <emphasis>main</emphasis></entry>
19992 <entry>Type: <emphasis>boolean</emphasis></entry>
19993 <entry>Default: <emphasis>true</emphasis></entry>
19999 <indexterm role="concept">
20000 <primary>bounce message</primary>
20001 <secondary>including body</secondary>
20004 <para revisionflag="changed">
20005 This option controls whether the body of an incoming message is included in a
20006 bounce message when <option>bounce_return_message</option> is true. The default setting
20007 causes the entire message, both header and body, to be returned (subject to the
20008 value of <option>bounce_return_size_limit</option>). If this option is false, only the
20009 message header is included. In the case of a non-SMTP message containing an
20010 error that is detected during reception, only those header lines preceding the
20011 point at which the error was detected are returned.
20012 <indexterm role="concept">
20013 <primary>bounce message</primary>
20014 <secondary>including original</secondary>
20018 <indexterm role="option">
20019 <primary>bounce_return_message</primary>
20022 <informaltable frame="all">
20023 <tgroup cols="4" colsep="0" rowsep="0">
20024 <colspec colwidth="8*" align="left"/>
20025 <colspec colwidth="5*" align="center"/>
20026 <colspec colwidth="5*" align="center"/>
20027 <colspec colwidth="6*" align="right"/>
20030 <entry><option>bounce_return_message</option></entry>
20031 <entry>Use: <emphasis>main</emphasis></entry>
20032 <entry>Type: <emphasis>boolean</emphasis></entry>
20033 <entry>Default: <emphasis>true</emphasis></entry>
20038 <para revisionflag="changed">
20039 If this option is set false, none of the original message is included in
20040 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
20041 <option>bounce_return_body</option>.
20044 <indexterm role="option">
20045 <primary>bounce_return_size_limit</primary>
20048 <informaltable frame="all">
20049 <tgroup cols="4" colsep="0" rowsep="0">
20050 <colspec colwidth="8*" align="left"/>
20051 <colspec colwidth="5*" align="center"/>
20052 <colspec colwidth="5*" align="center"/>
20053 <colspec colwidth="6*" align="right"/>
20056 <entry><option>bounce_return_size_limit</option></entry>
20057 <entry>Use: <emphasis>main</emphasis></entry>
20058 <entry>Type: <emphasis>integer</emphasis></entry>
20059 <entry>Default: <emphasis>100K</emphasis></entry>
20065 <indexterm role="concept">
20066 <primary>size limit</primary>
20067 <secondary>of bounce</secondary>
20069 <indexterm role="concept">
20070 <primary>bounce message</primary>
20071 <secondary>size limit</secondary>
20073 <indexterm role="concept">
20074 <primary>limit</primary>
20075 <secondary>bounce message size</secondary>
20077 This option sets a limit in bytes on the size of messages that are returned to
20078 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
20079 limit should be less than the value of the global <option>message_size_limit</option> and of
20080 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
20081 that Exim generates. If this option is set to zero there is no limit.
20084 When the body of any message that is to be included in a bounce message is
20085 greater than the limit, it is truncated, and a comment pointing this out is
20086 added at the top. The actual cutoff may be greater than the value given, owing
20087 to the use of buffering for transferring the message in chunks (typically 8K in
20088 size). The idea is to save bandwidth on those undeliverable 15-megabyte
20092 <indexterm role="option">
20093 <primary>bounce_sender_authentication</primary>
20096 <informaltable frame="all">
20097 <tgroup cols="4" colsep="0" rowsep="0">
20098 <colspec colwidth="8*" align="left"/>
20099 <colspec colwidth="5*" align="center"/>
20100 <colspec colwidth="5*" align="center"/>
20101 <colspec colwidth="6*" align="right"/>
20104 <entry><option>bounce_sender_authentication</option></entry>
20105 <entry>Use: <emphasis>main</emphasis></entry>
20106 <entry>Type: <emphasis>string</emphasis></entry>
20107 <entry>Default: <emphasis>unset</emphasis></entry>
20113 <indexterm role="concept">
20114 <primary>bounce message</primary>
20115 <secondary>sender authentication</secondary>
20117 <indexterm role="concept">
20118 <primary>authentication</primary>
20119 <secondary>bounce message</secondary>
20121 <indexterm role="concept">
20122 <primary>AUTH</primary>
20123 <secondary>on bounce message</secondary>
20125 This option provides an authenticated sender address that is sent with any
20126 bounce messages generated by Exim that are sent over an authenticated SMTP
20127 connection. A typical setting might be:
20129 <literallayout class="monospaced">
20130 bounce_sender_authentication = mailer-daemon@my.domain.example
20133 which would cause bounce messages to be sent using the SMTP command:
20135 <literallayout class="monospaced">
20136 MAIL FROM:<> AUTH=mailer-daemon@my.domain.example
20139 The value of <option>bounce_sender_authentication</option> must always be a complete email
20143 <indexterm role="option">
20144 <primary>callout_domain_negative_expire</primary>
20147 <informaltable frame="all">
20148 <tgroup cols="4" colsep="0" rowsep="0">
20149 <colspec colwidth="8*" align="left"/>
20150 <colspec colwidth="5*" align="center"/>
20151 <colspec colwidth="5*" align="center"/>
20152 <colspec colwidth="6*" align="right"/>
20155 <entry><option>callout_domain_negative_expire</option></entry>
20156 <entry>Use: <emphasis>main</emphasis></entry>
20157 <entry>Type: <emphasis>time</emphasis></entry>
20158 <entry>Default: <emphasis>3h</emphasis></entry>
20164 <indexterm role="concept">
20165 <primary>caching</primary>
20166 <secondary>callout timeouts</secondary>
20168 <indexterm role="concept">
20169 <primary>callout</primary>
20170 <secondary>caching timeouts</secondary>
20172 This option specifies the expiry time for negative callout cache data for a
20173 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
20174 section <xref linkend="SECTcallvercache"/> for details of the caching.
20177 <indexterm role="option">
20178 <primary>callout_domain_positive_expire</primary>
20181 <informaltable frame="all">
20182 <tgroup cols="4" colsep="0" rowsep="0">
20183 <colspec colwidth="8*" align="left"/>
20184 <colspec colwidth="5*" align="center"/>
20185 <colspec colwidth="5*" align="center"/>
20186 <colspec colwidth="6*" align="right"/>
20189 <entry><option>callout_domain_positive_expire</option></entry>
20190 <entry>Use: <emphasis>main</emphasis></entry>
20191 <entry>Type: <emphasis>time</emphasis></entry>
20192 <entry>Default: <emphasis>7d</emphasis></entry>
20198 This option specifies the expiry time for positive callout cache data for a
20199 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
20200 section <xref linkend="SECTcallvercache"/> for details of the caching.
20203 <indexterm role="option">
20204 <primary>callout_negative_expire</primary>
20207 <informaltable frame="all">
20208 <tgroup cols="4" colsep="0" rowsep="0">
20209 <colspec colwidth="8*" align="left"/>
20210 <colspec colwidth="5*" align="center"/>
20211 <colspec colwidth="5*" align="center"/>
20212 <colspec colwidth="6*" align="right"/>
20215 <entry><option>callout_negative_expire</option></entry>
20216 <entry>Use: <emphasis>main</emphasis></entry>
20217 <entry>Type: <emphasis>time</emphasis></entry>
20218 <entry>Default: <emphasis>2h</emphasis></entry>
20224 This option specifies the expiry time for negative callout cache data for an
20225 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
20226 section <xref linkend="SECTcallvercache"/> for details of the caching.
20229 <indexterm role="option">
20230 <primary>callout_positive_expire</primary>
20233 <informaltable frame="all">
20234 <tgroup cols="4" colsep="0" rowsep="0">
20235 <colspec colwidth="8*" align="left"/>
20236 <colspec colwidth="5*" align="center"/>
20237 <colspec colwidth="5*" align="center"/>
20238 <colspec colwidth="6*" align="right"/>
20241 <entry><option>callout_positive_expire</option></entry>
20242 <entry>Use: <emphasis>main</emphasis></entry>
20243 <entry>Type: <emphasis>time</emphasis></entry>
20244 <entry>Default: <emphasis>24h</emphasis></entry>
20250 This option specifies the expiry time for positive callout cache data for an
20251 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
20252 section <xref linkend="SECTcallvercache"/> for details of the caching.
20255 <indexterm role="option">
20256 <primary>callout_random_local_part</primary>
20259 <informaltable frame="all">
20260 <tgroup cols="4" colsep="0" rowsep="0">
20261 <colspec colwidth="8*" align="left"/>
20262 <colspec colwidth="5*" align="center"/>
20263 <colspec colwidth="5*" align="center"/>
20264 <colspec colwidth="6*" align="right"/>
20267 <entry><option>callout_random_local_part</option></entry>
20268 <entry>Use: <emphasis>main</emphasis></entry>
20269 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20270 <entry>Default: <emphasis>see below</emphasis></entry>
20276 This option defines the <quote>random</quote> local part that can be used as part of
20277 callout verification. The default value is
20279 <literallayout class="monospaced">
20280 $primary_host_name-$tod_epoch-testing
20283 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
20286 <indexterm role="option">
20287 <primary>check_log_inodes</primary>
20290 <informaltable frame="all">
20291 <tgroup cols="4" colsep="0" rowsep="0">
20292 <colspec colwidth="8*" align="left"/>
20293 <colspec colwidth="5*" align="center"/>
20294 <colspec colwidth="5*" align="center"/>
20295 <colspec colwidth="6*" align="right"/>
20298 <entry><option>check_log_inodes</option></entry>
20299 <entry>Use: <emphasis>main</emphasis></entry>
20300 <entry>Type: <emphasis>integer</emphasis></entry>
20301 <entry>Default: <emphasis>0</emphasis></entry>
20307 See <option>check_spool_space</option> below.
20310 <indexterm role="option">
20311 <primary>check_log_space</primary>
20314 <informaltable frame="all">
20315 <tgroup cols="4" colsep="0" rowsep="0">
20316 <colspec colwidth="8*" align="left"/>
20317 <colspec colwidth="5*" align="center"/>
20318 <colspec colwidth="5*" align="center"/>
20319 <colspec colwidth="6*" align="right"/>
20322 <entry><option>check_log_space</option></entry>
20323 <entry>Use: <emphasis>main</emphasis></entry>
20324 <entry>Type: <emphasis>integer</emphasis></entry>
20325 <entry>Default: <emphasis>0</emphasis></entry>
20331 See <option>check_spool_space</option> below.
20334 <indexterm role="option">
20335 <primary><option>check_rfc2047_length</option></primary>
20337 <indexterm role="concept">
20338 <primary>RFC 2047</primary>
20339 <secondary>disabling length check</secondary>
20341 <indexterm role="option">
20342 <primary>check_rfc2047_length</primary>
20345 <informaltable frame="all">
20346 <tgroup cols="4" colsep="0" rowsep="0">
20347 <colspec colwidth="8*" align="left"/>
20348 <colspec colwidth="5*" align="center"/>
20349 <colspec colwidth="5*" align="center"/>
20350 <colspec colwidth="6*" align="right"/>
20353 <entry><option>check_rfc2047_length</option></entry>
20354 <entry>Use: <emphasis> User: main</emphasis></entry>
20355 <entry>Type: <emphasis>boolean</emphasis></entry>
20356 <entry>Default: <emphasis>true</emphasis></entry>
20362 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
20363 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
20364 word; strings to be encoded that exceed this length are supposed to use
20365 multiple encoded words. By default, Exim does not recognize encoded words that
20366 exceed the maximum length. However, it seems that some software, in violation
20367 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
20368 set false, Exim recognizes encoded words of any length.
20371 <indexterm role="option">
20372 <primary>check_spool_inodes</primary>
20375 <informaltable frame="all">
20376 <tgroup cols="4" colsep="0" rowsep="0">
20377 <colspec colwidth="8*" align="left"/>
20378 <colspec colwidth="5*" align="center"/>
20379 <colspec colwidth="5*" align="center"/>
20380 <colspec colwidth="6*" align="right"/>
20383 <entry><option>check_spool_inodes</option></entry>
20384 <entry>Use: <emphasis>main</emphasis></entry>
20385 <entry>Type: <emphasis>integer</emphasis></entry>
20386 <entry>Default: <emphasis>0</emphasis></entry>
20392 See <option>check_spool_space</option> below.
20395 <indexterm role="option">
20396 <primary>check_spool_space</primary>
20399 <informaltable frame="all">
20400 <tgroup cols="4" colsep="0" rowsep="0">
20401 <colspec colwidth="8*" align="left"/>
20402 <colspec colwidth="5*" align="center"/>
20403 <colspec colwidth="5*" align="center"/>
20404 <colspec colwidth="6*" align="right"/>
20407 <entry><option>check_spool_space</option></entry>
20408 <entry>Use: <emphasis>main</emphasis></entry>
20409 <entry>Type: <emphasis>integer</emphasis></entry>
20410 <entry>Default: <emphasis>0</emphasis></entry>
20416 <indexterm role="concept">
20417 <primary>checking disk space</primary>
20419 <indexterm role="concept">
20420 <primary>disk space</primary>
20421 <secondary>checking</secondary>
20423 <indexterm role="concept">
20424 <primary>spool directory</primary>
20425 <secondary>checking space</secondary>
20427 The four <option>check_...</option> options allow for checking of disk resources before a
20428 message is accepted.
20431 <indexterm role="concept">
20432 <primary><varname>$log_inodes</varname></primary>
20434 <indexterm role="concept">
20435 <primary><varname>$log_space</varname></primary>
20437 <indexterm role="concept">
20438 <primary><varname>$spool_inodes</varname></primary>
20440 <indexterm role="concept">
20441 <primary><varname>$spool_space</varname></primary>
20443 When any of these options are set, they apply to all incoming messages. If you
20444 want to apply different checks to different kinds of message, you can do so by
20445 testing the the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
20446 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
20449 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
20450 either value is greater than zero, for example:
20452 <literallayout class="monospaced">
20453 check_spool_space = 10M
20454 check_spool_inodes = 100
20457 The spool partition is the one that contains the directory defined by
20458 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
20462 <option>check_log_space</option> and <option>check_log_inodes</option> check the partition in which log
20463 files are written if either is greater than zero. These should be set only if
20464 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
20467 If there is less space or fewer inodes than requested, Exim refuses to accept
20468 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
20469 error response to the MAIL command. If ESMTP is in use and there was a
20470 SIZE parameter on the MAIL command, its value is added to the
20471 <option>check_spool_space</option> value, and the check is performed even if
20472 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
20475 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
20476 number of kilobytes. If a non-multiple of 1024 is specified, it is rounded up.
20479 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
20480 failure a message is written to stderr and Exim exits with a non-zero code, as
20481 it obviously cannot send an error message of any kind.
20484 <indexterm role="option">
20485 <primary>daemon_smtp_ports</primary>
20488 <informaltable frame="all">
20489 <tgroup cols="4" colsep="0" rowsep="0">
20490 <colspec colwidth="8*" align="left"/>
20491 <colspec colwidth="5*" align="center"/>
20492 <colspec colwidth="5*" align="center"/>
20493 <colspec colwidth="6*" align="right"/>
20496 <entry><option>daemon_smtp_ports</option></entry>
20497 <entry>Use: <emphasis>main</emphasis></entry>
20498 <entry>Type: <emphasis>string</emphasis></entry>
20499 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
20505 <indexterm role="concept">
20506 <primary>port</primary>
20507 <secondary>for daemon</secondary>
20509 <indexterm role="concept">
20510 <primary>TCP/IP</primary>
20511 <secondary>setting listening ports</secondary>
20513 This option specifies one or more default SMTP ports on which the Exim daemon
20514 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
20515 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
20518 <indexterm role="option">
20519 <primary>daemon_startup_retries</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>daemon_startup_retries</option></entry>
20531 <entry>Use: <emphasis>main</emphasis></entry>
20532 <entry>Type: <emphasis>integer</emphasis></entry>
20533 <entry>Default: <emphasis>9</emphasis></entry>
20539 <indexterm role="concept">
20540 <primary>daemon startup</primary>
20541 <secondary>retrying</secondary>
20543 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
20544 the daemon at startup when it cannot immediately bind a listening socket
20545 (typically because the socket is already in use): <option>daemon_startup_retries</option>
20546 defines the number of retries after the first failure, and
20547 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
20550 <indexterm role="option">
20551 <primary>daemon_startup_sleep</primary>
20554 <informaltable frame="all">
20555 <tgroup cols="4" colsep="0" rowsep="0">
20556 <colspec colwidth="8*" align="left"/>
20557 <colspec colwidth="5*" align="center"/>
20558 <colspec colwidth="5*" align="center"/>
20559 <colspec colwidth="6*" align="right"/>
20562 <entry><option>daemon_startup_sleep</option></entry>
20563 <entry>Use: <emphasis>main</emphasis></entry>
20564 <entry>Type: <emphasis>time</emphasis></entry>
20565 <entry>Default: <emphasis>30s</emphasis></entry>
20571 See <option>daemon_startup_retries</option>.
20574 <indexterm role="option">
20575 <primary>delay_warning</primary>
20578 <informaltable frame="all">
20579 <tgroup cols="4" colsep="0" rowsep="0">
20580 <colspec colwidth="8*" align="left"/>
20581 <colspec colwidth="5*" align="center"/>
20582 <colspec colwidth="5*" align="center"/>
20583 <colspec colwidth="6*" align="right"/>
20586 <entry><option>delay_warning</option></entry>
20587 <entry>Use: <emphasis>main</emphasis></entry>
20588 <entry>Type: <emphasis>time list</emphasis></entry>
20589 <entry>Default: <emphasis>24h</emphasis></entry>
20595 <indexterm role="concept">
20596 <primary>warning of delay</primary>
20598 <indexterm role="concept">
20599 <primary>delay warning</primary>
20600 <secondary>specifying</secondary>
20602 When a message is delayed, Exim sends a warning message to the sender at
20603 intervals specified by this option. The data is a colon-separated list of times
20604 after which to send warning messages. If the value of the option is an empty
20605 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
20606 message has been on the queue for longer than the last time, the last interval
20607 between the times is used to compute subsequent warning times. For example,
20610 <literallayout class="monospaced">
20611 delay_warning = 4h:8h:24h
20614 the first message is sent after 4 hours, the second after 8 hours, and
20615 the third one after 24 hours. After that, messages are sent every 16 hours,
20616 because that is the interval between the last two times on the list. If you set
20617 just one time, it specifies the repeat interval. For example, with:
20619 <literallayout class="monospaced">
20623 messages are repeated every six hours. To stop warnings after a given time, set
20624 a very large time at the end of the list. For example:
20626 <literallayout class="monospaced">
20627 delay_warning = 2h:12h:99d
20630 <indexterm role="option">
20631 <primary>delay_warning_condition</primary>
20634 <informaltable frame="all">
20635 <tgroup cols="4" colsep="0" rowsep="0">
20636 <colspec colwidth="8*" align="left"/>
20637 <colspec colwidth="5*" align="center"/>
20638 <colspec colwidth="5*" align="center"/>
20639 <colspec colwidth="6*" align="right"/>
20642 <entry><option>delay_warning_condition</option></entry>
20643 <entry>Use: <emphasis>main</emphasis></entry>
20644 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20645 <entry>Default: <emphasis>see below</emphasis></entry>
20651 <indexterm role="concept">
20652 <primary><varname>$domain</varname></primary>
20654 The string is expanded at the time a warning message might be sent. If all the
20655 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
20656 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
20657 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
20658 <quote>false</quote> (the comparison being done caselessly) then the warning message is
20659 not sent. The default is
20661 <literallayout class="monospaced">
20662 delay_warning_condition = \
20663 ${if match{$h_precedence:}{(?i)bulk|list|junk}{no}{yes}}
20666 which suppresses the sending of warnings about messages that have <quote>bulk</quote>,
20667 <quote>list</quote> or <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header.
20670 <indexterm role="option">
20671 <primary>deliver_drop_privilege</primary>
20674 <informaltable frame="all">
20675 <tgroup cols="4" colsep="0" rowsep="0">
20676 <colspec colwidth="8*" align="left"/>
20677 <colspec colwidth="5*" align="center"/>
20678 <colspec colwidth="5*" align="center"/>
20679 <colspec colwidth="6*" align="right"/>
20682 <entry><option>deliver_drop_privilege</option></entry>
20683 <entry>Use: <emphasis>main</emphasis></entry>
20684 <entry>Type: <emphasis>boolean</emphasis></entry>
20685 <entry>Default: <emphasis>false</emphasis></entry>
20691 <indexterm role="concept">
20692 <primary>unprivileged delivery</primary>
20694 <indexterm role="concept">
20695 <primary>delivery</primary>
20696 <secondary>unprivileged</secondary>
20698 If this option is set true, Exim drops its root privilege at the start of a
20699 delivery process, and runs as the Exim user throughout. This severely restricts
20700 the kinds of local delivery that are possible, but is viable in certain types
20701 of configuration. There is a discussion about the use of root privilege in
20702 chapter <xref linkend="CHAPsecurity"/>.
20705 <indexterm role="option">
20706 <primary>deliver_queue_load_max</primary>
20709 <informaltable frame="all">
20710 <tgroup cols="4" colsep="0" rowsep="0">
20711 <colspec colwidth="8*" align="left"/>
20712 <colspec colwidth="5*" align="center"/>
20713 <colspec colwidth="5*" align="center"/>
20714 <colspec colwidth="6*" align="right"/>
20717 <entry><option>deliver_queue_load_max</option></entry>
20718 <entry>Use: <emphasis>main</emphasis></entry>
20719 <entry>Type: <emphasis>fixed-point</emphasis></entry>
20720 <entry>Default: <emphasis>unset</emphasis></entry>
20726 <indexterm role="concept">
20727 <primary>load average</primary>
20729 <indexterm role="concept">
20730 <primary>queue runner</primary>
20731 <secondary>abandoning</secondary>
20733 When this option is set, a queue run is abandoned if the system load average
20734 becomes greater than the value of the option. The option has no effect on
20735 ancient operating systems on which Exim cannot determine the load average.
20736 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
20739 <indexterm role="option">
20740 <primary>delivery_date_remove</primary>
20743 <informaltable frame="all">
20744 <tgroup cols="4" colsep="0" rowsep="0">
20745 <colspec colwidth="8*" align="left"/>
20746 <colspec colwidth="5*" align="center"/>
20747 <colspec colwidth="5*" align="center"/>
20748 <colspec colwidth="6*" align="right"/>
20751 <entry><option>delivery_date_remove</option></entry>
20752 <entry>Use: <emphasis>main</emphasis></entry>
20753 <entry>Type: <emphasis>boolean</emphasis></entry>
20754 <entry>Default: <emphasis>true</emphasis></entry>
20760 <indexterm role="concept">
20761 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
20763 Exim’s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
20764 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
20765 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
20766 should not be present in incoming messages, and this option causes them to be
20767 removed at the time the message is received, to avoid any problems that might
20768 occur when a delivered message is subsequently sent on to some other recipient.
20770 <para revisionflag="changed">
20771 <indexterm role="option">
20772 <primary>disable_ipv6</primary>
20775 <informaltable frame="all" revisionflag="changed">
20776 <tgroup cols="4" colsep="0" rowsep="0">
20777 <colspec colwidth="8*" align="left"/>
20778 <colspec colwidth="5*" align="center"/>
20779 <colspec colwidth="5*" align="center"/>
20780 <colspec colwidth="6*" align="right"/>
20783 <entry><option>disable_ipv6</option></entry>
20784 <entry>Use: <emphasis>main</emphasis></entry>
20785 <entry>Type: <emphasis>boolean</emphasis></entry>
20786 <entry>Default: <emphasis>false</emphasis></entry>
20791 <para revisionflag="changed">
20792 <indexterm role="concept">
20793 <primary>IPv6</primary>
20794 <secondary>disabling</secondary>
20796 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
20797 activities take place. AAAA records are never looked up, and any IPv6 addresses
20798 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
20799 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
20800 to handle IPv6 literal addresses.
20803 <indexterm role="option">
20804 <primary>dns_again_means_nonexist</primary>
20807 <informaltable frame="all">
20808 <tgroup cols="4" colsep="0" rowsep="0">
20809 <colspec colwidth="8*" align="left"/>
20810 <colspec colwidth="5*" align="center"/>
20811 <colspec colwidth="5*" align="center"/>
20812 <colspec colwidth="6*" align="right"/>
20815 <entry><option>dns_again_means_nonexist</option></entry>
20816 <entry>Use: <emphasis>main</emphasis></entry>
20817 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
20818 <entry>Default: <emphasis>unset</emphasis></entry>
20824 <indexterm role="concept">
20825 <primary>DNS</primary>
20826 <secondary><quote>try again</quote> response; overriding</secondary>
20828 DNS lookups give a <quote>try again</quote> response for the DNS errors
20829 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
20830 keep trying to deliver a message, or to give repeated temporary errors to
20831 incoming mail. Sometimes the effect is caused by a badly set up name server and
20832 may persist for a long time. If a domain which exhibits this problem matches
20833 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
20834 This option should be used with care. You can make it apply to reverse lookups
20835 by a setting such as this:
20837 <literallayout class="monospaced">
20838 dns_again_means_nonexist = *.in-addr.arpa
20840 <para revisionflag="changed">
20841 This option applies to all DNS lookups that Exim does. It also applies when the
20842 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
20843 since these are most likely to be caused by DNS lookup problems. The
20844 <command>dnslookup</command> router has some options of its own for controlling what happens
20845 when lookups for MX or SRV records give temporary errors. These more specific
20846 options are applied after this global option.
20849 <indexterm role="option">
20850 <primary>dns_check_names_pattern</primary>
20853 <informaltable frame="all">
20854 <tgroup cols="4" colsep="0" rowsep="0">
20855 <colspec colwidth="8*" align="left"/>
20856 <colspec colwidth="5*" align="center"/>
20857 <colspec colwidth="5*" align="center"/>
20858 <colspec colwidth="6*" align="right"/>
20861 <entry><option>dns_check_names_pattern</option></entry>
20862 <entry>Use: <emphasis>main</emphasis></entry>
20863 <entry>Type: <emphasis>string</emphasis></entry>
20864 <entry>Default: <emphasis>see below</emphasis></entry>
20870 <indexterm role="concept">
20871 <primary>DNS</primary>
20872 <secondary>pre-check of name syntax</secondary>
20875 <para revisionflag="changed">
20876 When this option is set to a non-empty string, it causes Exim to check domain
20877 names for characters that are not allowed in host names before handing them to
20878 the DNS resolver, because some resolvers give temporary errors for names that
20879 contain unusual characters. If a domain name contains any unwanted characters,
20880 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
20881 done by matching the domain name against a regular expression, which is the
20882 value of this option. The default pattern is
20884 <literallayout class="monospaced" revisionflag="changed">
20885 dns_check_names_pattern = \
20886 (?i)^(?>(?(1)\.|())[^\W_](?>[a-z0-9/-]*[^\W_])?)+$
20888 <para revisionflag="changed">
20889 which permits only letters, digits, slashes, and hyphens in components, but
20890 they must start and end with a letter or digit. Hyphens are not, in fact,
20891 permitted in host names, but they are found in certain NS records (which can be
20892 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
20893 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
20897 <indexterm role="option">
20898 <primary>dns_csa_search_limit</primary>
20901 <informaltable frame="all">
20902 <tgroup cols="4" colsep="0" rowsep="0">
20903 <colspec colwidth="8*" align="left"/>
20904 <colspec colwidth="5*" align="center"/>
20905 <colspec colwidth="5*" align="center"/>
20906 <colspec colwidth="6*" align="right"/>
20909 <entry><option>dns_csa_search_limit</option></entry>
20910 <entry>Use: <emphasis>main</emphasis></entry>
20911 <entry>Type: <emphasis>integer</emphasis></entry>
20912 <entry>Default: <emphasis>5</emphasis></entry>
20918 This option controls the depth of parental searching for CSA SRV records in the
20919 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
20922 <indexterm role="option">
20923 <primary>dns_csa_use_reverse</primary>
20926 <informaltable frame="all">
20927 <tgroup cols="4" colsep="0" rowsep="0">
20928 <colspec colwidth="8*" align="left"/>
20929 <colspec colwidth="5*" align="center"/>
20930 <colspec colwidth="5*" align="center"/>
20931 <colspec colwidth="6*" align="right"/>
20934 <entry><option>dns_csa_use_reverse</option></entry>
20935 <entry>Use: <emphasis>main</emphasis></entry>
20936 <entry>Type: <emphasis>boolean</emphasis></entry>
20937 <entry>Default: <emphasis>true</emphasis></entry>
20943 This option controls whether or not an IP address, given as a CSA domain, is
20944 reversed and looked up in the reverse DNS, as described in more detail in
20945 section <xref linkend="SECTverifyCSA"/>.
20948 <indexterm role="option">
20949 <primary>dns_ipv4_lookup</primary>
20952 <informaltable frame="all">
20953 <tgroup cols="4" colsep="0" rowsep="0">
20954 <colspec colwidth="8*" align="left"/>
20955 <colspec colwidth="5*" align="center"/>
20956 <colspec colwidth="5*" align="center"/>
20957 <colspec colwidth="6*" align="right"/>
20960 <entry><option>dns_ipv4_lookup</option></entry>
20961 <entry>Use: <emphasis>main</emphasis></entry>
20962 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
20963 <entry>Default: <emphasis>unset</emphasis></entry>
20969 <indexterm role="concept">
20970 <primary>IPv6</primary>
20971 <secondary>DNS lookup for AAAA records</secondary>
20973 <indexterm role="concept">
20974 <primary>DNS</primary>
20975 <secondary>IPv6 lookup for AAAA records</secondary>
20978 <para revisionflag="changed">
20979 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
20980 looks for IPv6 address records (AAAA records) as well as IPv4 address records
20981 (A records) when trying to find IP addresses for hosts, unless the host’s
20982 domain matches this list.
20984 <para revisionflag="changed">
20985 This is a fudge to help with name servers that give big delays or otherwise do
20986 not work for the AAAA record type. In due course, when the world’s name
20987 servers have all been upgraded, there should be no need for this option.
20990 <indexterm role="option">
20991 <primary>dns_retrans</primary>
20994 <informaltable frame="all">
20995 <tgroup cols="4" colsep="0" rowsep="0">
20996 <colspec colwidth="8*" align="left"/>
20997 <colspec colwidth="5*" align="center"/>
20998 <colspec colwidth="5*" align="center"/>
20999 <colspec colwidth="6*" align="right"/>
21002 <entry><option>dns_retrans</option></entry>
21003 <entry>Use: <emphasis>main</emphasis></entry>
21004 <entry>Type: <emphasis>time</emphasis></entry>
21005 <entry>Default: <emphasis>0s</emphasis></entry>
21011 <indexterm role="concept">
21012 <primary>DNS</primary>
21013 <secondary>resolver options</secondary>
21015 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
21016 retransmission and retry parameters for DNS lookups. Values of zero (the
21017 defaults) leave the system default settings unchanged. The first value is the
21018 time between retries, and the second is the number of retries. It isn’t
21019 totally clear exactly how these settings affect the total time a DNS lookup may
21020 take. I haven’t found any documentation about timeouts on DNS lookups; these
21021 parameter values are available in the external resolver interface structure,
21022 but nowhere does it seem to describe how they are used or what you might want
21026 <indexterm role="option">
21027 <primary>dns_retry</primary>
21030 <informaltable frame="all">
21031 <tgroup cols="4" colsep="0" rowsep="0">
21032 <colspec colwidth="8*" align="left"/>
21033 <colspec colwidth="5*" align="center"/>
21034 <colspec colwidth="5*" align="center"/>
21035 <colspec colwidth="6*" align="right"/>
21038 <entry><option>dns_retry</option></entry>
21039 <entry>Use: <emphasis>main</emphasis></entry>
21040 <entry>Type: <emphasis>integer</emphasis></entry>
21041 <entry>Default: <emphasis>0</emphasis></entry>
21047 See <option>dns_retrans</option> above.
21050 <indexterm role="option">
21051 <primary>drop_cr</primary>
21054 <informaltable frame="all">
21055 <tgroup cols="4" colsep="0" rowsep="0">
21056 <colspec colwidth="8*" align="left"/>
21057 <colspec colwidth="5*" align="center"/>
21058 <colspec colwidth="5*" align="center"/>
21059 <colspec colwidth="6*" align="right"/>
21062 <entry><option>drop_cr</option></entry>
21063 <entry>Use: <emphasis>main</emphasis></entry>
21064 <entry>Type: <emphasis>boolean</emphasis></entry>
21065 <entry>Default: <emphasis>false</emphasis></entry>
21071 This is an obsolete option that is now a no-op. It used to affect the way Exim
21072 handled CR and LF characters in incoming messages. What happens now is
21073 described in section <xref linkend="SECTlineendings"/>.
21076 <indexterm role="option">
21077 <primary>envelope_to_remove</primary>
21080 <informaltable frame="all">
21081 <tgroup cols="4" colsep="0" rowsep="0">
21082 <colspec colwidth="8*" align="left"/>
21083 <colspec colwidth="5*" align="center"/>
21084 <colspec colwidth="5*" align="center"/>
21085 <colspec colwidth="6*" align="right"/>
21088 <entry><option>envelope_to_remove</option></entry>
21089 <entry>Use: <emphasis>main</emphasis></entry>
21090 <entry>Type: <emphasis>boolean</emphasis></entry>
21091 <entry>Default: <emphasis>true</emphasis></entry>
21097 <indexterm role="concept">
21098 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
21100 Exim’s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
21101 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
21102 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
21103 messages’s envelope that caused the delivery to happen. Such headers should not
21104 be present in incoming messages, and this option causes them to be removed at
21105 the time the message is received, to avoid any problems that might occur when a
21106 delivered message is subsequently sent on to some other recipient.
21109 <indexterm role="option">
21110 <primary>errors_copy</primary>
21113 <informaltable frame="all">
21114 <tgroup cols="4" colsep="0" rowsep="0">
21115 <colspec colwidth="8*" align="left"/>
21116 <colspec colwidth="5*" align="center"/>
21117 <colspec colwidth="5*" align="center"/>
21118 <colspec colwidth="6*" align="right"/>
21121 <entry><option>errors_copy</option></entry>
21122 <entry>Use: <emphasis>main</emphasis></entry>
21123 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
21124 <entry>Default: <emphasis>unset</emphasis></entry>
21130 <indexterm role="concept">
21131 <primary>bounce message</primary>
21132 <secondary>copy to other address</secondary>
21134 <indexterm role="concept">
21135 <primary>copy of bounce message</primary>
21137 Setting this option causes Exim to send bcc copies of bounce messages that it
21138 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
21139 coming from elsewhere. The value of the option is a colon-separated list of
21140 items. Each item consists of a pattern, terminated by white space, followed by
21141 a comma-separated list of email addresses. If a pattern contains spaces, it
21142 must be enclosed in double quotes.
21145 Each pattern is processed in the same way as a single item in an address list
21146 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
21147 the bounce message, the message is copied to the addresses on the list. The
21148 items are scanned in order, and once a matching one is found, no further items
21149 are examined. For example:
21151 <literallayout class="monospaced">
21152 errors_copy = spqr@mydomain postmaster@mydomain.example :\
21153 rqps@mydomain hostmaster@mydomain.example,\
21154 postmaster@mydomain.example
21157 <indexterm role="concept">
21158 <primary><varname>$domain</varname></primary>
21160 <indexterm role="concept">
21161 <primary><varname>$local_part</varname></primary>
21163 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
21164 and <varname>$domain</varname> are set from the original recipient of the error message, and if
21165 there was any wildcard matching in the pattern, the expansion
21166 <indexterm role="concept">
21167 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
21168 <secondary>in <option>errors_copy</option></secondary>
21170 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
21173 <indexterm role="option">
21174 <primary>errors_reply_to</primary>
21177 <informaltable frame="all">
21178 <tgroup cols="4" colsep="0" rowsep="0">
21179 <colspec colwidth="8*" align="left"/>
21180 <colspec colwidth="5*" align="center"/>
21181 <colspec colwidth="5*" align="center"/>
21182 <colspec colwidth="6*" align="right"/>
21185 <entry><option>errors_reply_to</option></entry>
21186 <entry>Use: <emphasis>main</emphasis></entry>
21187 <entry>Type: <emphasis>string</emphasis></entry>
21188 <entry>Default: <emphasis>unset</emphasis></entry>
21194 <indexterm role="concept">
21195 <primary>bounce message</primary>
21196 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
21199 <para revisionflag="changed">
21200 By default, Exim’s bounce and delivery warning messages contain the header line
21202 <literallayout revisionflag="changed">
21203 <literal>From: Mail Delivery System <Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>></literal>
21205 <para revisionflag="changed">
21206 <indexterm role="option">
21207 <primary><option>quota_warn_message</option></primary>
21209 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
21210 A warning message that is generated by the <option>quota_warn_message</option> option in an
21211 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
21212 overrides the default.
21214 <para revisionflag="changed">
21215 Experience shows that people reply to bounce messages. If the
21216 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
21217 and warning messages. For example:
21219 <literallayout class="monospaced" revisionflag="changed">
21220 errors_reply_to = postmaster@my.domain.example
21222 <para revisionflag="changed">
21223 The value of the option is not expanded. It must specify a valid RFC 2822
21224 address. However, if a warning message that is generated by the
21225 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
21226 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
21230 <indexterm role="option">
21231 <primary>exim_group</primary>
21234 <informaltable frame="all">
21235 <tgroup cols="4" colsep="0" rowsep="0">
21236 <colspec colwidth="8*" align="left"/>
21237 <colspec colwidth="5*" align="center"/>
21238 <colspec colwidth="5*" align="center"/>
21239 <colspec colwidth="6*" align="right"/>
21242 <entry><option>exim_group</option></entry>
21243 <entry>Use: <emphasis>main</emphasis></entry>
21244 <entry>Type: <emphasis>string</emphasis></entry>
21245 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
21251 <indexterm role="concept">
21252 <primary>gid (group id)</primary>
21253 <secondary>Exim’s own</secondary>
21255 <indexterm role="concept">
21256 <primary>Exim group</primary>
21258 This option changes the gid under which Exim runs when it gives up root
21259 privilege. The default value is compiled into the binary. The value of this
21260 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
21261 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
21262 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
21266 <indexterm role="option">
21267 <primary>exim_path</primary>
21270 <informaltable frame="all">
21271 <tgroup cols="4" colsep="0" rowsep="0">
21272 <colspec colwidth="8*" align="left"/>
21273 <colspec colwidth="5*" align="center"/>
21274 <colspec colwidth="5*" align="center"/>
21275 <colspec colwidth="6*" align="right"/>
21278 <entry><option>exim_path</option></entry>
21279 <entry>Use: <emphasis>main</emphasis></entry>
21280 <entry>Type: <emphasis>string</emphasis></entry>
21281 <entry>Default: <emphasis>see below</emphasis></entry>
21287 <indexterm role="concept">
21288 <primary>Exim binary</primary>
21289 <secondary>path name</secondary>
21291 This option specifies the path name of the Exim binary, which is used when Exim
21292 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
21293 the directory configured at compile time by the BIN_DIRECTORY setting. It
21294 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
21296 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
21297 you will break those Exim utilities that scan the configuration file to find
21298 where the binary is. (They then use the <option>-bP</option> option to extract option
21299 settings such as the value of <option>spool_directory</option>.)
21302 <indexterm role="option">
21303 <primary>exim_user</primary>
21306 <informaltable frame="all">
21307 <tgroup cols="4" colsep="0" rowsep="0">
21308 <colspec colwidth="8*" align="left"/>
21309 <colspec colwidth="5*" align="center"/>
21310 <colspec colwidth="5*" align="center"/>
21311 <colspec colwidth="6*" align="right"/>
21314 <entry><option>exim_user</option></entry>
21315 <entry>Use: <emphasis>main</emphasis></entry>
21316 <entry>Type: <emphasis>string</emphasis></entry>
21317 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
21323 <indexterm role="concept">
21324 <primary>uid (user id)</primary>
21325 <secondary>Exim’s own</secondary>
21327 <indexterm role="concept">
21328 <primary>Exim user</primary>
21330 This option changes the uid under which Exim runs when it gives up root
21331 privilege. The default value is compiled into the binary. Ownership of the run
21332 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
21333 options is checked against the values in the binary, not what is set here.
21336 Unless it consists entirely of digits, the string is looked up using
21337 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
21338 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
21339 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
21342 <indexterm role="option">
21343 <primary>extra_local_interfaces</primary>
21346 <informaltable frame="all">
21347 <tgroup cols="4" colsep="0" rowsep="0">
21348 <colspec colwidth="8*" align="left"/>
21349 <colspec colwidth="5*" align="center"/>
21350 <colspec colwidth="5*" align="center"/>
21351 <colspec colwidth="6*" align="right"/>
21354 <entry><option>extra_local_interfaces</option></entry>
21355 <entry>Use: <emphasis>main</emphasis></entry>
21356 <entry>Type: <emphasis>string list</emphasis></entry>
21357 <entry>Default: <emphasis>unset</emphasis></entry>
21363 This option defines network interfaces that are to be considered local when
21364 routing, but which are not used for listening by the daemon. See section
21365 <xref linkend="SECTreclocipadd"/> for details.
21368 <indexterm role="option">
21369 <primary>extract_addresses_remove_ arguments</primary>
21372 <informaltable frame="all">
21373 <tgroup cols="4" colsep="0" rowsep="0">
21374 <colspec colwidth="8*" align="left"/>
21375 <colspec colwidth="5*" align="center"/>
21376 <colspec colwidth="5*" align="center"/>
21377 <colspec colwidth="6*" align="right"/>
21380 <entry><option>extract_addresses_remove_ arguments</option></entry>
21381 <entry>Use: <emphasis>main</emphasis></entry>
21382 <entry>Type: <emphasis>boolean</emphasis></entry>
21383 <entry>Default: <emphasis>true</emphasis></entry>
21389 <indexterm role="concept">
21390 <primary><option>-t</option> option</primary>
21392 <indexterm role="concept">
21393 <primary>command line</primary>
21394 <secondary>addresses with <option>-t</option></secondary>
21396 <indexterm role="concept">
21397 <primary>Sendmail compatibility</primary>
21398 <secondary><option>-t</option> option</secondary>
21400 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
21401 are present on the command line when the <option>-t</option> option is used to build an
21402 envelope from a message’s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
21403 line addresses are removed from the recipients list. This is also how Smail
21404 behaves. However, other Sendmail documentation (the O’Reilly book) states that
21405 command line addresses are added to those obtained from the header lines. When
21406 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
21407 argument headers. If it is set false, Exim adds rather than removes argument
21411 <indexterm role="option">
21412 <primary>finduser_retries</primary>
21415 <informaltable frame="all">
21416 <tgroup cols="4" colsep="0" rowsep="0">
21417 <colspec colwidth="8*" align="left"/>
21418 <colspec colwidth="5*" align="center"/>
21419 <colspec colwidth="5*" align="center"/>
21420 <colspec colwidth="6*" align="right"/>
21423 <entry><option>finduser_retries</option></entry>
21424 <entry>Use: <emphasis>main</emphasis></entry>
21425 <entry>Type: <emphasis>integer</emphasis></entry>
21426 <entry>Default: <emphasis>0</emphasis></entry>
21432 <indexterm role="concept">
21433 <primary>NIS</primary>
21434 <secondary>looking up users; retrying</secondary>
21436 On systems running NIS or other schemes in which user and group information is
21437 distributed from a remote system, there can be times when <function>getpwnam()</function> and
21438 related functions fail, even when given valid data, because things time out.
21439 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
21440 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
21441 many extra times to find a user or a group, waiting for one second between
21445 <indexterm role="concept">
21446 <primary><filename>/etc/passwd</filename></primary>
21447 <secondary>multiple reading of</secondary>
21449 You should not set this option greater than zero if your user information is in
21450 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
21451 search the file multiple times for non-existent users, and also cause delay.
21454 <indexterm role="option">
21455 <primary>freeze_tell</primary>
21458 <informaltable frame="all">
21459 <tgroup cols="4" colsep="0" rowsep="0">
21460 <colspec colwidth="8*" align="left"/>
21461 <colspec colwidth="5*" align="center"/>
21462 <colspec colwidth="5*" align="center"/>
21463 <colspec colwidth="6*" align="right"/>
21466 <entry><option>freeze_tell</option></entry>
21467 <entry>Use: <emphasis>main</emphasis></entry>
21468 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
21469 <entry>Default: <emphasis>unset</emphasis></entry>
21475 <indexterm role="concept">
21476 <primary>freezing messages</primary>
21477 <secondary>sending a message when freezing</secondary>
21479 On encountering certain errors, or when configured to do so in a system filter,
21480 ACL, or special router, Exim freezes a message. This means that no further
21481 delivery attempts take place until an administrator thaws the message, or the
21482 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
21483 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
21484 warning message whenever it freezes something, unless the message it is
21485 freezing is a locally-generated bounce message. (Without this exception there
21486 is the possibility of looping.) The warning message is sent to the addresses
21487 supplied as the comma-separated value of this option. If several of the
21488 message’s addresses cause freezing, only a single message is sent. If the
21489 freezing was automatic, the reason(s) for freezing can be found in the message
21490 log. If you configure freezing in a filter or ACL, you must arrange for any
21491 logging that you require.
21494 <indexterm role="option">
21495 <primary>gecos_name</primary>
21498 <informaltable frame="all">
21499 <tgroup cols="4" colsep="0" rowsep="0">
21500 <colspec colwidth="8*" align="left"/>
21501 <colspec colwidth="5*" align="center"/>
21502 <colspec colwidth="5*" align="center"/>
21503 <colspec colwidth="6*" align="right"/>
21506 <entry><option>gecos_name</option></entry>
21507 <entry>Use: <emphasis>main</emphasis></entry>
21508 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
21509 <entry>Default: <emphasis>unset</emphasis></entry>
21515 <indexterm role="concept">
21516 <primary>HP-UX</primary>
21518 <indexterm role="concept">
21519 <primary><quote>gecos</quote> field</primary>
21520 <secondary>parsing</secondary>
21522 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
21523 password file to hold other information in addition to users’ real names. Exim
21524 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
21525 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
21526 of the field are used unchanged, except that, if an ampersand is encountered,
21527 it is replaced by the user’s login name with the first character forced to
21528 upper case, since this is a convention that is observed on many systems.
21531 When these options are set, <option>gecos_pattern</option> is treated as a regular
21532 expression that is to be applied to the field (again with & replaced by the
21533 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
21534 user’s name.
21537 <indexterm role="concept">
21538 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
21539 <secondary>in <option>gecos_name</option></secondary>
21541 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
21542 pick up sub-fields that were matched by the pattern. In HP-UX, where the user’s
21543 name terminates at the first comma, the following can be used:
21545 <literallayout class="monospaced">
21546 gecos_pattern = ([^,]*)
21550 <indexterm role="option">
21551 <primary>gecos_pattern</primary>
21554 <informaltable frame="all">
21555 <tgroup cols="4" colsep="0" rowsep="0">
21556 <colspec colwidth="8*" align="left"/>
21557 <colspec colwidth="5*" align="center"/>
21558 <colspec colwidth="5*" align="center"/>
21559 <colspec colwidth="6*" align="right"/>
21562 <entry><option>gecos_pattern</option></entry>
21563 <entry>Use: <emphasis>main</emphasis></entry>
21564 <entry>Type: <emphasis>string</emphasis></entry>
21565 <entry>Default: <emphasis>unset</emphasis></entry>
21571 See <option>gecos_name</option> above.
21574 <indexterm role="option">
21575 <primary>headers_charset</primary>
21578 <informaltable frame="all">
21579 <tgroup cols="4" colsep="0" rowsep="0">
21580 <colspec colwidth="8*" align="left"/>
21581 <colspec colwidth="5*" align="center"/>
21582 <colspec colwidth="5*" align="center"/>
21583 <colspec colwidth="6*" align="right"/>
21586 <entry><option>headers_charset</option></entry>
21587 <entry>Use: <emphasis>main</emphasis></entry>
21588 <entry>Type: <emphasis>string</emphasis></entry>
21589 <entry>Default: <emphasis>see below</emphasis></entry>
21595 This option sets a default character set for translating from encoded MIME
21596 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
21597 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
21598 ultimate default is ISO-8859-1. For more details see the description of header
21599 insertions in section <xref linkend="SECTexpansionitems"/>.
21602 <indexterm role="option">
21603 <primary>header_maxsize</primary>
21606 <informaltable frame="all">
21607 <tgroup cols="4" colsep="0" rowsep="0">
21608 <colspec colwidth="8*" align="left"/>
21609 <colspec colwidth="5*" align="center"/>
21610 <colspec colwidth="5*" align="center"/>
21611 <colspec colwidth="6*" align="right"/>
21614 <entry><option>header_maxsize</option></entry>
21615 <entry>Use: <emphasis>main</emphasis></entry>
21616 <entry>Type: <emphasis>integer</emphasis></entry>
21617 <entry>Default: <emphasis>see below</emphasis></entry>
21623 <indexterm role="concept">
21624 <primary>header section</primary>
21625 <secondary>maximum size of</secondary>
21627 <indexterm role="concept">
21628 <primary>limit</primary>
21629 <secondary>size of message header section</secondary>
21631 This option controls the overall maximum size of a message’s header
21632 section. The default is the value of HEADER_MAXSIZE in
21633 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
21634 sections are rejected.
21637 <indexterm role="option">
21638 <primary>header_line_maxsize</primary>
21641 <informaltable frame="all">
21642 <tgroup cols="4" colsep="0" rowsep="0">
21643 <colspec colwidth="8*" align="left"/>
21644 <colspec colwidth="5*" align="center"/>
21645 <colspec colwidth="5*" align="center"/>
21646 <colspec colwidth="6*" align="right"/>
21649 <entry><option>header_line_maxsize</option></entry>
21650 <entry>Use: <emphasis>main</emphasis></entry>
21651 <entry>Type: <emphasis>integer</emphasis></entry>
21652 <entry>Default: <emphasis>0</emphasis></entry>
21658 <indexterm role="concept">
21659 <primary>header lines</primary>
21660 <secondary>maximum size of</secondary>
21662 <indexterm role="concept">
21663 <primary>limit</primary>
21664 <secondary>size of one header line</secondary>
21666 This option limits the length of any individual header line in a message, after
21667 all the continuations have been joined together. Messages with individual
21668 header lines that are longer than the limit are rejected. The default value of
21669 zero means <quote>no limit</quote>.
21672 <indexterm role="option">
21673 <primary>helo_accept_junk_hosts</primary>
21676 <informaltable frame="all">
21677 <tgroup cols="4" colsep="0" rowsep="0">
21678 <colspec colwidth="8*" align="left"/>
21679 <colspec colwidth="5*" align="center"/>
21680 <colspec colwidth="5*" align="center"/>
21681 <colspec colwidth="6*" align="right"/>
21684 <entry><option>helo_accept_junk_hosts</option></entry>
21685 <entry>Use: <emphasis>main</emphasis></entry>
21686 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
21687 <entry>Default: <emphasis>unset</emphasis></entry>
21693 <indexterm role="concept">
21694 <primary>HELO</primary>
21695 <secondary>accepting junk data</secondary>
21697 <indexterm role="concept">
21698 <primary>EHLO</primary>
21699 <secondary>accepting junk data</secondary>
21701 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
21702 mail, and gives an error response for invalid data. Unfortunately, there are
21703 some SMTP clients that send syntactic junk. They can be accommodated by setting
21704 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
21705 if you want to do semantic checking.
21706 See also <option>helo_allow_chars</option> for a way of extending the permitted character
21710 <indexterm role="option">
21711 <primary>helo_allow_chars</primary>
21714 <informaltable frame="all">
21715 <tgroup cols="4" colsep="0" rowsep="0">
21716 <colspec colwidth="8*" align="left"/>
21717 <colspec colwidth="5*" align="center"/>
21718 <colspec colwidth="5*" align="center"/>
21719 <colspec colwidth="6*" align="right"/>
21722 <entry><option>helo_allow_chars</option></entry>
21723 <entry>Use: <emphasis>main</emphasis></entry>
21724 <entry>Type: <emphasis>string</emphasis></entry>
21725 <entry>Default: <emphasis>unset</emphasis></entry>
21731 <indexterm role="concept">
21732 <primary>HELO</primary>
21733 <secondary>underscores in</secondary>
21735 <indexterm role="concept">
21736 <primary>EHLO</primary>
21737 <secondary>underscores in</secondary>
21739 <indexterm role="concept">
21740 <primary>underscore in EHLO/HELO</primary>
21742 This option can be set to a string of rogue characters that are permitted in
21743 all EHLO and HELO names in addition to the standard letters, digits,
21744 hyphens, and dots. If you really must allow underscores, you can set
21746 <literallayout class="monospaced">
21747 helo_allow_chars = _
21750 Note that the value is one string, not a list.
21753 <indexterm role="option">
21754 <primary>helo_lookup_domains</primary>
21757 <informaltable frame="all">
21758 <tgroup cols="4" colsep="0" rowsep="0">
21759 <colspec colwidth="8*" align="left"/>
21760 <colspec colwidth="5*" align="center"/>
21761 <colspec colwidth="5*" align="center"/>
21762 <colspec colwidth="6*" align="right"/>
21765 <entry><option>helo_lookup_domains</option></entry>
21766 <entry>Use: <emphasis>main</emphasis></entry>
21767 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
21768 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
21774 <indexterm role="concept">
21775 <primary>HELO</primary>
21776 <secondary>forcing reverse lookup</secondary>
21778 <indexterm role="concept">
21779 <primary>EHLO</primary>
21780 <secondary>forcing reverse lookup</secondary>
21782 If the domain given by a client in a HELO or EHLO command matches this
21783 list, a reverse lookup is done in order to establish the host’s true name. The
21784 default forces a lookup if the client host gives the server’s name or any of
21785 its IP addresses (in brackets), something that broken clients have been seen to
21789 <indexterm role="option">
21790 <primary>helo_try_verify_hosts</primary>
21793 <informaltable frame="all">
21794 <tgroup cols="4" colsep="0" rowsep="0">
21795 <colspec colwidth="8*" align="left"/>
21796 <colspec colwidth="5*" align="center"/>
21797 <colspec colwidth="5*" align="center"/>
21798 <colspec colwidth="6*" align="right"/>
21801 <entry><option>helo_try_verify_hosts</option></entry>
21802 <entry>Use: <emphasis>main</emphasis></entry>
21803 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
21804 <entry>Default: <emphasis>unset</emphasis></entry>
21810 <indexterm role="concept">
21811 <primary>HELO verifying</primary>
21812 <secondary>optional</secondary>
21814 <indexterm role="concept">
21815 <primary>EHLO verifying</primary>
21816 <secondary>optional</secondary>
21818 By default, Exim just checks the syntax of HELO and EHLO commands (see
21819 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
21820 to do more extensive checking of the data supplied by these commands. The ACL
21821 condition <literal>verify</literal> <literal>=</literal> <literal>helo</literal> is provided to make this possible.
21822 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
21823 to force the check to occur. From release 4.53 onwards, this is no longer
21824 necessary. If the check has not been done before <literal>verify</literal> <literal>=</literal> <literal>helo</literal> is
21825 encountered, it is done at that time. Consequently, this option is obsolete.
21826 Its specification is retained here for backwards compatibility.
21829 When an EHLO or HELO command is received, if the calling host matches
21830 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
21831 EHLO command either:
21836 is an IP literal matching the calling address of the host, or
21841 <indexterm role="concept">
21842 <primary>DNS</primary>
21843 <secondary>reverse lookup</secondary>
21845 <indexterm role="concept">
21846 <primary>reverse DNS lookup</primary>
21848 matches the host name that Exim obtains by doing a reverse lookup of the
21849 calling host address, or
21854 when looked up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when
21855 available) yields the calling host address.
21860 However, the EHLO or HELO command is not rejected if any of the checks
21861 fail. Processing continues, but the result of the check is remembered, and can
21862 be detected later in an ACL by the <literal>verify</literal> <literal>=</literal> <literal>helo</literal> condition.
21865 <indexterm role="option">
21866 <primary>helo_verify_hosts</primary>
21869 <informaltable frame="all">
21870 <tgroup cols="4" colsep="0" rowsep="0">
21871 <colspec colwidth="8*" align="left"/>
21872 <colspec colwidth="5*" align="center"/>
21873 <colspec colwidth="5*" align="center"/>
21874 <colspec colwidth="6*" align="right"/>
21877 <entry><option>helo_verify_hosts</option></entry>
21878 <entry>Use: <emphasis>main</emphasis></entry>
21879 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
21880 <entry>Default: <emphasis>unset</emphasis></entry>
21886 <indexterm role="concept">
21887 <primary>HELO verifying</primary>
21888 <secondary>mandatory</secondary>
21890 <indexterm role="concept">
21891 <primary>EHLO verifying</primary>
21892 <secondary>mandatory</secondary>
21894 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
21895 backwards compatibility. For hosts that match this option, Exim checks the host
21896 name given in the HELO or EHLO in the same way as for
21897 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
21898 rejected with a 550 error, and entries are written to the main and reject logs.
21899 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
21903 <indexterm role="option">
21904 <primary>hold_domains</primary>
21907 <informaltable frame="all">
21908 <tgroup cols="4" colsep="0" rowsep="0">
21909 <colspec colwidth="8*" align="left"/>
21910 <colspec colwidth="5*" align="center"/>
21911 <colspec colwidth="5*" align="center"/>
21912 <colspec colwidth="6*" align="right"/>
21915 <entry><option>hold_domains</option></entry>
21916 <entry>Use: <emphasis>main</emphasis></entry>
21917 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
21918 <entry>Default: <emphasis>unset</emphasis></entry>
21924 <indexterm role="concept">
21925 <primary>domain</primary>
21926 <secondary>delaying delivery</secondary>
21928 <indexterm role="concept">
21929 <primary>delivery</primary>
21930 <secondary>delaying certain domains</secondary>
21932 This option allows mail for particular domains to be held on the queue
21933 manually. The option is overridden if a message delivery is forced with the
21934 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
21935 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
21936 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
21937 it is deferred every time the message is looked at.
21940 This option is intended as a temporary operational measure for delaying the
21941 delivery of mail while some problem is being sorted out, or some new
21942 configuration tested. If you just want to delay the processing of some
21943 domains until a queue run occurs, you should use <option>queue_domains</option> or
21944 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
21947 A setting of <option>hold_domains</option> does not override Exim’s code for removing
21948 messages from the queue if they have been there longer than the longest retry
21949 time in any retry rule. If you want to hold messages for longer than the normal
21950 retry times, insert a dummy retry rule with a long retry time.
21953 <indexterm role="option">
21954 <primary>host_lookup</primary>
21957 <informaltable frame="all">
21958 <tgroup cols="4" colsep="0" rowsep="0">
21959 <colspec colwidth="8*" align="left"/>
21960 <colspec colwidth="5*" align="center"/>
21961 <colspec colwidth="5*" align="center"/>
21962 <colspec colwidth="6*" align="right"/>
21965 <entry><option>host_lookup</option></entry>
21966 <entry>Use: <emphasis>main</emphasis></entry>
21967 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
21968 <entry>Default: <emphasis>unset</emphasis></entry>
21974 <indexterm role="concept">
21975 <primary>host name lookup</primary>
21976 <secondary>forcing</secondary>
21978 Exim does not look up the name of a calling host from its IP address unless it
21979 is required to compare against some host list, or the host matches
21980 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
21981 option (which normally contains IP addresses rather than host names). The
21982 default configuration file contains
21984 <literallayout class="monospaced">
21988 which causes a lookup to happen for all hosts. If the expense of these lookups
21989 is felt to be too great, the setting can be changed or removed.
21992 After a successful reverse lookup, Exim does a forward lookup on the name it
21993 has obtained, to verify that it yields the IP address that it started with. If
21994 this check fails, Exim behaves as if the name lookup failed.
21997 <indexterm role="concept">
21998 <primary><varname>$host_lookup_failed</varname></primary>
22000 <indexterm role="concept">
22001 <primary><varname>$sender_host_name</varname></primary>
22003 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
22004 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
22005 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and <literal>verify</literal> <literal>=</literal>
22006 <literal>reverse_host_lookup</literal> in ACLs.
22009 <indexterm role="option">
22010 <primary>host_lookup_order</primary>
22013 <informaltable frame="all">
22014 <tgroup cols="4" colsep="0" rowsep="0">
22015 <colspec colwidth="8*" align="left"/>
22016 <colspec colwidth="5*" align="center"/>
22017 <colspec colwidth="5*" align="center"/>
22018 <colspec colwidth="6*" align="right"/>
22021 <entry><option>host_lookup_order</option></entry>
22022 <entry>Use: <emphasis>main</emphasis></entry>
22023 <entry>Type: <emphasis>string list</emphasis></entry>
22024 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
22030 This option specifies the order of different lookup methods when Exim is trying
22031 to find a host name from an IP address. The default is to do a DNS lookup
22032 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
22033 if that fails. You can change the order of these lookups, or omit one entirely,
22037 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
22038 multiple PTR records in the DNS and the IP address is not listed in
22039 <filename>/etc/hosts</filename>. Different operating systems give different results in this
22040 case. That is why the default tries a DNS lookup first.
22043 <indexterm role="option">
22044 <primary>host_reject_connection</primary>
22047 <informaltable frame="all">
22048 <tgroup cols="4" colsep="0" rowsep="0">
22049 <colspec colwidth="8*" align="left"/>
22050 <colspec colwidth="5*" align="center"/>
22051 <colspec colwidth="5*" align="center"/>
22052 <colspec colwidth="6*" align="right"/>
22055 <entry><option>host_reject_connection</option></entry>
22056 <entry>Use: <emphasis>main</emphasis></entry>
22057 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
22058 <entry>Default: <emphasis>unset</emphasis></entry>
22064 <indexterm role="concept">
22065 <primary>host</primary>
22066 <secondary>rejecting connections from</secondary>
22068 If this option is set, incoming SMTP calls from the hosts listed are rejected
22069 as soon as the connection is made.
22070 This option is obsolete, and retained only for backward compatibility, because
22071 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
22072 connections immediately.
22075 The ability to give an immediate rejection (either by this option or using an
22076 ACL) is provided for use in unusual cases. Many hosts will just try again,
22077 sometimes without much delay. Normally, it is better to use an ACL to reject
22078 incoming messages at a later stage, such as after RCPT commands. See
22079 chapter <xref linkend="CHAPACL"/>.
22082 <indexterm role="option">
22083 <primary>hosts_connection_nolog</primary>
22086 <informaltable frame="all">
22087 <tgroup cols="4" colsep="0" rowsep="0">
22088 <colspec colwidth="8*" align="left"/>
22089 <colspec colwidth="5*" align="center"/>
22090 <colspec colwidth="5*" align="center"/>
22091 <colspec colwidth="6*" align="right"/>
22094 <entry><option>hosts_connection_nolog</option></entry>
22095 <entry>Use: <emphasis>main</emphasis></entry>
22096 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
22097 <entry>Default: <emphasis>unset</emphasis></entry>
22103 <indexterm role="concept">
22104 <primary>host</primary>
22105 <secondary>not logging connections from</secondary>
22107 This option defines a list of hosts for which connection logging does not
22108 happen, even though the <option>smtp_connection</option> log selector is set. For example,
22109 you might want not to log SMTP connections from local processes, or from
22110 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
22111 the daemon; you should therefore strive to restrict its value to a short inline
22112 list of IP addresses and networks. To disable logging SMTP connections from
22113 local processes, you must create a host list with an empty item. For example:
22115 <literallayout class="monospaced">
22116 hosts_connection_nolog = :
22119 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
22122 <indexterm role="option">
22123 <primary>hosts_treat_as_local</primary>
22126 <informaltable frame="all">
22127 <tgroup cols="4" colsep="0" rowsep="0">
22128 <colspec colwidth="8*" align="left"/>
22129 <colspec colwidth="5*" align="center"/>
22130 <colspec colwidth="5*" align="center"/>
22131 <colspec colwidth="6*" align="right"/>
22134 <entry><option>hosts_treat_as_local</option></entry>
22135 <entry>Use: <emphasis>main</emphasis></entry>
22136 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
22137 <entry>Default: <emphasis>unset</emphasis></entry>
22143 <indexterm role="concept">
22144 <primary>local host</primary>
22145 <secondary>domains treated as</secondary>
22147 <indexterm role="concept">
22148 <primary>host</primary>
22149 <secondary>treated as local</secondary>
22151 If this option is set, any host names that match the domain list are treated as
22152 if they were the local host when Exim is scanning host lists obtained from MX
22154 or other sources. Note that the value of this option is a domain list, not a
22155 host list, because it is always used to check host names, not IP addresses.
22158 This option also applies when Exim is matching the special items
22159 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
22160 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
22161 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
22162 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
22163 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
22164 interfaces and recognising the local host.
22167 <indexterm role="option">
22168 <primary>ignore_bounce_errors_after</primary>
22171 <informaltable frame="all">
22172 <tgroup cols="4" colsep="0" rowsep="0">
22173 <colspec colwidth="8*" align="left"/>
22174 <colspec colwidth="5*" align="center"/>
22175 <colspec colwidth="5*" align="center"/>
22176 <colspec colwidth="6*" align="right"/>
22179 <entry><option>ignore_bounce_errors_after</option></entry>
22180 <entry>Use: <emphasis>main</emphasis></entry>
22181 <entry>Type: <emphasis>time</emphasis></entry>
22182 <entry>Default: <emphasis>10w</emphasis></entry>
22188 <indexterm role="concept">
22189 <primary>bounce message</primary>
22190 <secondary>discarding</secondary>
22192 <indexterm role="concept">
22193 <primary>discarding bounce message</primary>
22195 This option affects the processing of bounce messages that cannot be delivered,
22196 that is, those that suffer a permanent delivery failure. (Bounce messages that
22197 suffer temporary delivery failures are of course retried in the usual way.)
22200 After a permanent delivery failure, bounce messages are frozen,
22201 because there is no sender to whom they can be returned. When a frozen bounce
22202 message has been on the queue for more than the given time, it is unfrozen at
22203 the next queue run, and a further delivery is attempted. If delivery fails
22204 again, the bounce message is discarded. This makes it possible to keep failed
22205 bounce messages around for a shorter time than the normal maximum retry time
22206 for frozen messages. For example,
22208 <literallayout class="monospaced">
22209 ignore_bounce_errors_after = 12h
22212 retries failed bounce message deliveries after 12 hours, discarding any further
22213 failures. If the value of this option is set to a zero time period, bounce
22214 failures are discarded immediately. Setting a very long time (as in the default
22215 value) has the effect of disabling this option. For ways of automatically
22216 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
22217 <option>timeout_frozen_after</option>.
22220 <indexterm role="option">
22221 <primary>ignore_fromline_hosts</primary>
22224 <informaltable frame="all">
22225 <tgroup cols="4" colsep="0" rowsep="0">
22226 <colspec colwidth="8*" align="left"/>
22227 <colspec colwidth="5*" align="center"/>
22228 <colspec colwidth="5*" align="center"/>
22229 <colspec colwidth="6*" align="right"/>
22232 <entry><option>ignore_fromline_hosts</option></entry>
22233 <entry>Use: <emphasis>main</emphasis></entry>
22234 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
22235 <entry>Default: <emphasis>unset</emphasis></entry>
22241 <indexterm role="concept">
22242 <primary><quote>From</quote> line</primary>
22244 <indexterm role="concept">
22245 <primary>UUCP</primary>
22246 <secondary><quote>From</quote> line</secondary>
22248 Some broken SMTP clients insist on sending a UUCP-like <quote>From </quote> line before
22249 the headers of a message. By default this is treated as the start of the
22250 message’s body, which means that any following headers are not recognized as
22251 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
22252 match those hosts that insist on sending it. If the sender is actually a local
22253 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
22254 <option>ignore_fromline_local</option> must be set to achieve this effect.
22257 <indexterm role="option">
22258 <primary>ignore_fromline_local</primary>
22261 <informaltable frame="all">
22262 <tgroup cols="4" colsep="0" rowsep="0">
22263 <colspec colwidth="8*" align="left"/>
22264 <colspec colwidth="5*" align="center"/>
22265 <colspec colwidth="5*" align="center"/>
22266 <colspec colwidth="6*" align="right"/>
22269 <entry><option>ignore_fromline_local</option></entry>
22270 <entry>Use: <emphasis>main</emphasis></entry>
22271 <entry>Type: <emphasis>boolean</emphasis></entry>
22272 <entry>Default: <emphasis>false</emphasis></entry>
22278 See <option>ignore_fromline_hosts</option> above.
22281 <indexterm role="option">
22282 <primary>keep_malformed</primary>
22285 <informaltable frame="all">
22286 <tgroup cols="4" colsep="0" rowsep="0">
22287 <colspec colwidth="8*" align="left"/>
22288 <colspec colwidth="5*" align="center"/>
22289 <colspec colwidth="5*" align="center"/>
22290 <colspec colwidth="6*" align="right"/>
22293 <entry><option>keep_malformed</option></entry>
22294 <entry>Use: <emphasis>main</emphasis></entry>
22295 <entry>Type: <emphasis>time</emphasis></entry>
22296 <entry>Default: <emphasis>4d</emphasis></entry>
22302 This option specifies the length of time to keep messages whose spool files
22303 have been corrupted in some way. This should, of course, never happen. At the
22304 next attempt to deliver such a message, it gets removed. The incident is
22308 <indexterm role="option">
22309 <primary>ldap_default_servers</primary>
22312 <informaltable frame="all">
22313 <tgroup cols="4" colsep="0" rowsep="0">
22314 <colspec colwidth="8*" align="left"/>
22315 <colspec colwidth="5*" align="center"/>
22316 <colspec colwidth="5*" align="center"/>
22317 <colspec colwidth="6*" align="right"/>
22320 <entry><option>ldap_default_servers</option></entry>
22321 <entry>Use: <emphasis>main</emphasis></entry>
22322 <entry>Type: <emphasis>string list</emphasis></entry>
22323 <entry>Default: <emphasis>unset</emphasis></entry>
22329 <indexterm role="concept">
22330 <primary>LDAP</primary>
22331 <secondary>default servers</secondary>
22333 This option provides a list of LDAP servers which are tried in turn when an
22334 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
22335 details of LDAP queries. This option is available only when Exim has been built
22339 <indexterm role="option">
22340 <primary>ldap_version</primary>
22343 <informaltable frame="all">
22344 <tgroup cols="4" colsep="0" rowsep="0">
22345 <colspec colwidth="8*" align="left"/>
22346 <colspec colwidth="5*" align="center"/>
22347 <colspec colwidth="5*" align="center"/>
22348 <colspec colwidth="6*" align="right"/>
22351 <entry><option>ldap_version</option></entry>
22352 <entry>Use: <emphasis>main</emphasis></entry>
22353 <entry>Type: <emphasis>integer</emphasis></entry>
22354 <entry>Default: <emphasis>unset</emphasis></entry>
22360 <indexterm role="concept">
22361 <primary>LDAP protocol version</primary>
22362 <secondary>forcing</secondary>
22364 This option can be used to force Exim to set a specific protocol version for
22365 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
22366 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
22367 the LDAP headers; otherwise it is 2. This option is available only when Exim
22368 has been built with LDAP support.
22371 <indexterm role="option">
22372 <primary>local_from_check</primary>
22375 <informaltable frame="all">
22376 <tgroup cols="4" colsep="0" rowsep="0">
22377 <colspec colwidth="8*" align="left"/>
22378 <colspec colwidth="5*" align="center"/>
22379 <colspec colwidth="5*" align="center"/>
22380 <colspec colwidth="6*" align="right"/>
22383 <entry><option>local_from_check</option></entry>
22384 <entry>Use: <emphasis>main</emphasis></entry>
22385 <entry>Type: <emphasis>boolean</emphasis></entry>
22386 <entry>Default: <emphasis>true</emphasis></entry>
22392 <indexterm role="concept">
22393 <primary><emphasis>Sender:</emphasis> header line</primary>
22394 <secondary>disabling addition of</secondary>
22396 <indexterm role="concept">
22397 <primary><emphasis>From:</emphasis> header line</primary>
22398 <secondary>disabling checking of</secondary>
22400 When a message is submitted locally (that is, not over a TCP/IP connection) by
22401 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
22402 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
22403 the domain specified by <option>qualify_domain</option>.
22406 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
22407 locally submitted message is automatically qualified by Exim, unless the
22408 <option>-bnq</option> command line option is used.
22411 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
22412 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
22413 <emphasis>Sender:</emphasis> header with an address constructed from the calling user’s login
22414 and the default qualify domain.
22417 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
22418 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
22419 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
22420 <option>local_sender_retain</option> to be true.
22423 <indexterm role="concept">
22424 <primary>envelope sender</primary>
22426 These options affect only the header lines in the message. The envelope sender
22427 is still forced to be the login id at the qualify domain unless
22428 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
22431 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
22432 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
22433 has more details about <emphasis>Sender:</emphasis> processing.
22436 <indexterm role="option">
22437 <primary>local_from_prefix</primary>
22440 <informaltable frame="all">
22441 <tgroup cols="4" colsep="0" rowsep="0">
22442 <colspec colwidth="8*" align="left"/>
22443 <colspec colwidth="5*" align="center"/>
22444 <colspec colwidth="5*" align="center"/>
22445 <colspec colwidth="6*" align="right"/>
22448 <entry><option>local_from_prefix</option></entry>
22449 <entry>Use: <emphasis>main</emphasis></entry>
22450 <entry>Type: <emphasis>string</emphasis></entry>
22451 <entry>Default: <emphasis>unset</emphasis></entry>
22457 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
22458 matching the login id (see <option>local_from_check</option> above), it can be configured to
22459 ignore certain prefixes and suffixes in the local part of the address. This is
22460 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
22461 appropriate lists, in the same form as the <option>local_part_prefix</option> and
22462 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
22465 <literallayout class="monospaced">
22466 local_from_prefix = *-
22469 is set, a <emphasis>From:</emphasis> line containing
22471 <literallayout class="monospaced">
22472 From: anything-user@your.domain.example
22475 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
22476 matches the actual sender address that is constructed from the login name and
22480 <indexterm role="option">
22481 <primary>local_from_suffix</primary>
22484 <informaltable frame="all">
22485 <tgroup cols="4" colsep="0" rowsep="0">
22486 <colspec colwidth="8*" align="left"/>
22487 <colspec colwidth="5*" align="center"/>
22488 <colspec colwidth="5*" align="center"/>
22489 <colspec colwidth="6*" align="right"/>
22492 <entry><option>local_from_suffix</option></entry>
22493 <entry>Use: <emphasis>main</emphasis></entry>
22494 <entry>Type: <emphasis>string</emphasis></entry>
22495 <entry>Default: <emphasis>unset</emphasis></entry>
22501 See <option>local_from_prefix</option> above.
22504 <indexterm role="option">
22505 <primary>local_interfaces</primary>
22508 <informaltable frame="all">
22509 <tgroup cols="4" colsep="0" rowsep="0">
22510 <colspec colwidth="8*" align="left"/>
22511 <colspec colwidth="5*" align="center"/>
22512 <colspec colwidth="5*" align="center"/>
22513 <colspec colwidth="6*" align="right"/>
22516 <entry><option>local_interfaces</option></entry>
22517 <entry>Use: <emphasis>main</emphasis></entry>
22518 <entry>Type: <emphasis>string list</emphasis></entry>
22519 <entry>Default: <emphasis>see below</emphasis></entry>
22525 This option controls which network interfaces are used by the daemon for
22526 listening; they are also used to identify the local host when routing. Chapter
22527 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
22528 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
22529 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
22530 <option>local_interfaces</option> is
22532 <literallayout class="monospaced">
22533 local_interfaces = 0.0.0.0
22536 when Exim is built without IPv6 support; otherwise it is
22538 <literallayout class="monospaced">
22539 local_interfaces = <; ::0 ; 0.0.0.0
22542 <indexterm role="option">
22543 <primary>local_scan_timeout</primary>
22546 <informaltable frame="all">
22547 <tgroup cols="4" colsep="0" rowsep="0">
22548 <colspec colwidth="8*" align="left"/>
22549 <colspec colwidth="5*" align="center"/>
22550 <colspec colwidth="5*" align="center"/>
22551 <colspec colwidth="6*" align="right"/>
22554 <entry><option>local_scan_timeout</option></entry>
22555 <entry>Use: <emphasis>main</emphasis></entry>
22556 <entry>Type: <emphasis>time</emphasis></entry>
22557 <entry>Default: <emphasis>5m</emphasis></entry>
22563 <indexterm role="concept">
22564 <primary>timeout</primary>
22565 <secondary>for <function>local_scan()</function> function</secondary>
22567 <indexterm role="concept">
22568 <primary><function>local_scan()</function> function</primary>
22569 <secondary>timeout</secondary>
22571 This timeout applies to the <function>local_scan()</function> function (see chapter
22572 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
22573 the incoming message is rejected with a temporary error if it is an SMTP
22574 message. For a non-SMTP message, the message is dropped and Exim ends with a
22575 non-zero code. The incident is logged on the main and reject logs.
22578 <indexterm role="option">
22579 <primary>local_sender_retain</primary>
22582 <informaltable frame="all">
22583 <tgroup cols="4" colsep="0" rowsep="0">
22584 <colspec colwidth="8*" align="left"/>
22585 <colspec colwidth="5*" align="center"/>
22586 <colspec colwidth="5*" align="center"/>
22587 <colspec colwidth="6*" align="right"/>
22590 <entry><option>local_sender_retain</option></entry>
22591 <entry>Use: <emphasis>main</emphasis></entry>
22592 <entry>Type: <emphasis>boolean</emphasis></entry>
22593 <entry>Default: <emphasis>false</emphasis></entry>
22599 <indexterm role="concept">
22600 <primary><emphasis>Sender:</emphasis> header line</primary>
22601 <secondary>retaining from local submission</secondary>
22603 When a message is submitted locally (that is, not over a TCP/IP connection) by
22604 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
22605 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
22606 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
22607 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
22608 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
22611 <indexterm role="option">
22612 <primary>localhost_number</primary>
22615 <informaltable frame="all">
22616 <tgroup cols="4" colsep="0" rowsep="0">
22617 <colspec colwidth="8*" align="left"/>
22618 <colspec colwidth="5*" align="center"/>
22619 <colspec colwidth="5*" align="center"/>
22620 <colspec colwidth="6*" align="right"/>
22623 <entry><option>localhost_number</option></entry>
22624 <entry>Use: <emphasis>main</emphasis></entry>
22625 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
22626 <entry>Default: <emphasis>unset</emphasis></entry>
22632 <indexterm role="concept">
22633 <primary>host</primary>
22634 <secondary>locally unique number for</secondary>
22636 <indexterm role="concept">
22637 <primary>message ids</primary>
22638 <secondary>with multiple hosts</secondary>
22640 <indexterm role="concept">
22641 <primary><varname>$localhost_number</varname></primary>
22643 Exim’s message ids are normally unique only within the local host. If
22644 uniqueness among a set of hosts is required, each host must set a different
22645 value for the <option>localhost_number</option> option. The string is expanded immediately
22646 after reading the configuration file (so that a number can be computed from the
22647 host name, for example) and the result of the expansion must be a number in the
22648 range 0–16 (or 0–10 on operating systems with case-insensitive file
22649 systems). This is available in subsequent string expansions via the variable
22650 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
22651 characters of the message id, instead of just being a fractional part of the
22652 time, are computed from the time and the local host number as described in
22653 section <xref linkend="SECTmessiden"/>.
22656 <indexterm role="option">
22657 <primary>log_file_path</primary>
22660 <informaltable frame="all">
22661 <tgroup cols="4" colsep="0" rowsep="0">
22662 <colspec colwidth="8*" align="left"/>
22663 <colspec colwidth="5*" align="center"/>
22664 <colspec colwidth="5*" align="center"/>
22665 <colspec colwidth="6*" align="right"/>
22668 <entry><option>log_file_path</option></entry>
22669 <entry>Use: <emphasis>main</emphasis></entry>
22670 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
22671 <entry>Default: <emphasis>set at compile time</emphasis></entry>
22677 <indexterm role="concept">
22678 <primary>log</primary>
22679 <secondary>file path for</secondary>
22681 This option sets the path which is used to determine the names of Exim’s log
22682 files, or indicates that logging is to be to syslog, or both. It is expanded
22683 when Exim is entered, so it can, for example, contain a reference to the host
22684 name. If no specific path is set for the log files at compile or run time, they
22685 are written in a sub-directory called <filename>log</filename> in Exim’s spool directory.
22686 Chapter <xref linkend="CHAPlog"/> contains further details about Exim’s logging, and
22687 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
22688 used. If this string is fixed at your installation (contains no expansion
22689 variables) it is recommended that you do not set this option in the
22690 configuration file, but instead supply the path using LOG_FILE_PATH in
22691 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
22692 early on – in particular, failure to read the configuration file.
22695 <indexterm role="option">
22696 <primary>log_selector</primary>
22699 <informaltable frame="all">
22700 <tgroup cols="4" colsep="0" rowsep="0">
22701 <colspec colwidth="8*" align="left"/>
22702 <colspec colwidth="5*" align="center"/>
22703 <colspec colwidth="5*" align="center"/>
22704 <colspec colwidth="6*" align="right"/>
22707 <entry><option>log_selector</option></entry>
22708 <entry>Use: <emphasis>main</emphasis></entry>
22709 <entry>Type: <emphasis>string</emphasis></entry>
22710 <entry>Default: <emphasis>unset</emphasis></entry>
22716 <indexterm role="concept">
22717 <primary>log</primary>
22718 <secondary>selectors</secondary>
22720 This option can be used to reduce or increase the number of things that Exim
22721 writes to its log files. Its argument is made up of names preceded by plus or
22722 minus characters. For example:
22724 <literallayout class="monospaced">
22725 log_selector = +arguments -retry_defer
22728 A list of possible names and what they control is given in the chapter on
22729 logging, in section <xref linkend="SECTlogselector"/>.
22732 <indexterm role="option">
22733 <primary>log_timezone</primary>
22736 <informaltable frame="all">
22737 <tgroup cols="4" colsep="0" rowsep="0">
22738 <colspec colwidth="8*" align="left"/>
22739 <colspec colwidth="5*" align="center"/>
22740 <colspec colwidth="5*" align="center"/>
22741 <colspec colwidth="6*" align="right"/>
22744 <entry><option>log_timezone</option></entry>
22745 <entry>Use: <emphasis>main</emphasis></entry>
22746 <entry>Type: <emphasis>boolean</emphasis></entry>
22747 <entry>Default: <emphasis>false</emphasis></entry>
22753 <indexterm role="concept">
22754 <primary>log</primary>
22755 <secondary>timezone for entries</secondary>
22757 <indexterm role="concept">
22758 <primary><varname>$tod_log</varname></primary>
22760 <indexterm role="concept">
22761 <primary><varname>$tod_zone</varname></primary>
22763 By default, the timestamps on log lines are in local time without the
22764 timezone. This means that if your timezone changes twice a year, the timestamps
22765 in log lines are ambiguous for an hour when the clocks go back. One way of
22766 avoiding this problem is to set the timezone to UTC. An alternative is to set
22767 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
22768 timestamps in log lines. Turning on this option can add quite a lot to the size
22769 of log files because each line is extended by 6 characters. Note that the
22770 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
22771 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
22774 <indexterm role="option">
22775 <primary>lookup_open_max</primary>
22778 <informaltable frame="all">
22779 <tgroup cols="4" colsep="0" rowsep="0">
22780 <colspec colwidth="8*" align="left"/>
22781 <colspec colwidth="5*" align="center"/>
22782 <colspec colwidth="5*" align="center"/>
22783 <colspec colwidth="6*" align="right"/>
22786 <entry><option>lookup_open_max</option></entry>
22787 <entry>Use: <emphasis>main</emphasis></entry>
22788 <entry>Type: <emphasis>integer</emphasis></entry>
22789 <entry>Default: <emphasis>25</emphasis></entry>
22795 <indexterm role="concept">
22796 <primary>too many open files</primary>
22798 <indexterm role="concept">
22799 <primary>open files</primary>
22800 <secondary>too many</secondary>
22802 <indexterm role="concept">
22803 <primary>file</primary>
22804 <secondary>too many open</secondary>
22806 <indexterm role="concept">
22807 <primary>lookup</primary>
22808 <secondary>maximum open files</secondary>
22810 <indexterm role="concept">
22811 <primary>limit</primary>
22812 <secondary>open files for lookups</secondary>
22814 This option limits the number of simultaneously open files for single-key
22815 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
22816 Exim normally keeps these files open during routing, because often the same
22817 file is required several times. If the limit is reached, Exim closes the least
22818 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
22819 actually opens two files for each logical DBM database, though it still counts
22820 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
22821 open files</quote> errors with NDBM, you need to reduce the value of
22822 <option>lookup_open_max</option>.
22825 <indexterm role="option">
22826 <primary>max_username_length</primary>
22829 <informaltable frame="all">
22830 <tgroup cols="4" colsep="0" rowsep="0">
22831 <colspec colwidth="8*" align="left"/>
22832 <colspec colwidth="5*" align="center"/>
22833 <colspec colwidth="5*" align="center"/>
22834 <colspec colwidth="6*" align="right"/>
22837 <entry><option>max_username_length</option></entry>
22838 <entry>Use: <emphasis>main</emphasis></entry>
22839 <entry>Type: <emphasis>integer</emphasis></entry>
22840 <entry>Default: <emphasis>0</emphasis></entry>
22846 <indexterm role="concept">
22847 <primary>length</primary>
22848 <secondary>of login name</secondary>
22850 <indexterm role="concept">
22851 <primary>user name</primary>
22852 <secondary>maximum length</secondary>
22854 <indexterm role="concept">
22855 <primary>limit</primary>
22856 <secondary>user name length</secondary>
22858 Some operating systems are broken in that they truncate long arguments to
22859 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
22860 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
22861 an argument that is longer behaves as if <function>getpwnam()</function> failed.
22864 <indexterm role="option">
22865 <primary>message_body_visible</primary>
22868 <informaltable frame="all">
22869 <tgroup cols="4" colsep="0" rowsep="0">
22870 <colspec colwidth="8*" align="left"/>
22871 <colspec colwidth="5*" align="center"/>
22872 <colspec colwidth="5*" align="center"/>
22873 <colspec colwidth="6*" align="right"/>
22876 <entry><option>message_body_visible</option></entry>
22877 <entry>Use: <emphasis>main</emphasis></entry>
22878 <entry>Type: <emphasis>integer</emphasis></entry>
22879 <entry>Default: <emphasis>500</emphasis></entry>
22885 <indexterm role="concept">
22886 <primary>body of message</primary>
22887 <secondary>visible size</secondary>
22889 <indexterm role="concept">
22890 <primary>message body</primary>
22891 <secondary>visible size</secondary>
22893 <indexterm role="concept">
22894 <primary><varname>$message_body</varname></primary>
22896 <indexterm role="concept">
22897 <primary><varname>$message_body_end</varname></primary>
22899 This option specifies how much of a message’s body is to be included in the
22900 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
22903 <indexterm role="option">
22904 <primary>message_id_header_domain</primary>
22907 <informaltable frame="all">
22908 <tgroup cols="4" colsep="0" rowsep="0">
22909 <colspec colwidth="8*" align="left"/>
22910 <colspec colwidth="5*" align="center"/>
22911 <colspec colwidth="5*" align="center"/>
22912 <colspec colwidth="6*" align="right"/>
22915 <entry><option>message_id_header_domain</option></entry>
22916 <entry>Use: <emphasis>main</emphasis></entry>
22917 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
22918 <entry>Default: <emphasis>unset</emphasis></entry>
22924 <indexterm role="concept">
22925 <primary><emphasis>Message-ID:</emphasis> header line</primary>
22927 If this option is set, the string is expanded and used as the right hand side
22928 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
22929 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
22930 means <quote>not received over TCP/IP.</quote>
22931 Otherwise, the primary host name is used.
22932 Only letters, digits, dot and hyphen are accepted; any other characters are
22933 replaced by hyphens. If the expansion is forced to fail, or if the result is an
22934 empty string, the option is ignored.
22937 <indexterm role="option">
22938 <primary>message_id_header_text</primary>
22941 <informaltable frame="all">
22942 <tgroup cols="4" colsep="0" rowsep="0">
22943 <colspec colwidth="8*" align="left"/>
22944 <colspec colwidth="5*" align="center"/>
22945 <colspec colwidth="5*" align="center"/>
22946 <colspec colwidth="6*" align="right"/>
22949 <entry><option>message_id_header_text</option></entry>
22950 <entry>Use: <emphasis>main</emphasis></entry>
22951 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
22952 <entry>Default: <emphasis>unset</emphasis></entry>
22958 If this variable is set, the string is expanded and used to augment the text of
22959 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
22960 message does not have one. The text of this header is required by RFC 2822 to
22961 take the form of an address. By default, Exim uses its internal message id as
22962 the local part, and the primary host name as the domain. If this option is set,
22963 it is expanded, and provided the expansion is not forced to fail, and does not
22964 yield an empty string, the result is inserted into the header immediately
22965 before the @, separated from the internal message id by a dot. Any characters
22966 that are illegal in an address are automatically converted into hyphens. This
22967 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
22968 colons will become hyphens.
22971 <indexterm role="option">
22972 <primary>message_logs</primary>
22975 <informaltable frame="all">
22976 <tgroup cols="4" colsep="0" rowsep="0">
22977 <colspec colwidth="8*" align="left"/>
22978 <colspec colwidth="5*" align="center"/>
22979 <colspec colwidth="5*" align="center"/>
22980 <colspec colwidth="6*" align="right"/>
22983 <entry><option>message_logs</option></entry>
22984 <entry>Use: <emphasis>main</emphasis></entry>
22985 <entry>Type: <emphasis>boolean</emphasis></entry>
22986 <entry>Default: <emphasis>true</emphasis></entry>
22992 <indexterm role="concept">
22993 <primary>message log</primary>
22994 <secondary>disabling</secondary>
22996 <indexterm role="concept">
22997 <primary>log</primary>
22998 <secondary>message log; disabling</secondary>
23000 If this option is turned off, per-message log files are not created in the
23001 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
23002 Exim, by reducing the number of files involved in handling a message from a
23003 minimum of four (header spool file, body spool file, delivery journal, and
23004 per-message log) to three. The other major I/O activity is Exim’s main log,
23005 which is not affected by this option.
23008 <indexterm role="option">
23009 <primary>message_size_limit</primary>
23012 <informaltable frame="all">
23013 <tgroup cols="4" colsep="0" rowsep="0">
23014 <colspec colwidth="8*" align="left"/>
23015 <colspec colwidth="5*" align="center"/>
23016 <colspec colwidth="5*" align="center"/>
23017 <colspec colwidth="6*" align="right"/>
23020 <entry><option>message_size_limit</option></entry>
23021 <entry>Use: <emphasis>main</emphasis></entry>
23022 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
23023 <entry>Default: <emphasis>50M</emphasis></entry>
23029 <indexterm role="concept">
23030 <primary>message</primary>
23031 <secondary>size limit</secondary>
23033 <indexterm role="concept">
23034 <primary>limit</primary>
23035 <secondary>message size</secondary>
23037 <indexterm role="concept">
23038 <primary>size of message</primary>
23039 <secondary>limit</secondary>
23041 This option limits the maximum size of message that Exim will process. The
23042 value is expanded for each incoming
23043 connection so, for example, it can be made to depend on the IP address of the
23044 remote host for messages arriving via TCP/IP. <emphasis role="bold">Note</emphasis>: This limit cannot be
23045 made to depend on a message’s sender or any other properties of an individual
23046 message, because it has to be advertised in the server’s response to EHLO.
23047 String expansion failure causes a temporary error. A value of zero means no
23048 limit, but its use is not recommended. See also <option>bounce_return_size_limit</option>.
23051 Incoming SMTP messages are failed with a 552 error if the limit is
23052 exceeded; locally-generated messages either get a stderr message or a delivery
23053 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
23054 an oversized message is logged in both the main and the reject logs. See also
23055 the generic transport option <option>message_size_limit</option>, which limits the size of
23056 message that an individual transport can process.
23059 <indexterm role="option">
23060 <primary>move_frozen_messages</primary>
23063 <informaltable frame="all">
23064 <tgroup cols="4" colsep="0" rowsep="0">
23065 <colspec colwidth="8*" align="left"/>
23066 <colspec colwidth="5*" align="center"/>
23067 <colspec colwidth="5*" align="center"/>
23068 <colspec colwidth="6*" align="right"/>
23071 <entry><option>move_frozen_messages</option></entry>
23072 <entry>Use: <emphasis>main</emphasis></entry>
23073 <entry>Type: <emphasis>boolean</emphasis></entry>
23074 <entry>Default: <emphasis>false</emphasis></entry>
23080 <indexterm role="concept">
23081 <primary>frozen messages</primary>
23082 <secondary>moving</secondary>
23084 This option, which is available only if Exim has been built with the setting
23086 <literallayout class="monospaced">
23087 SUPPORT_MOVE_FROZEN_MESSAGES=yes
23090 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
23091 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
23092 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
23093 standard utilities for handling such moved messages, and they do not show up in
23094 lists generated by <option>-bp</option> or by the Exim monitor.
23097 <indexterm role="option">
23098 <primary>mua_wrapper</primary>
23101 <informaltable frame="all">
23102 <tgroup cols="4" colsep="0" rowsep="0">
23103 <colspec colwidth="8*" align="left"/>
23104 <colspec colwidth="5*" align="center"/>
23105 <colspec colwidth="5*" align="center"/>
23106 <colspec colwidth="6*" align="right"/>
23109 <entry><option>mua_wrapper</option></entry>
23110 <entry>Use: <emphasis>main</emphasis></entry>
23111 <entry>Type: <emphasis>boolean</emphasis></entry>
23112 <entry>Default: <emphasis>false</emphasis></entry>
23118 Setting this option true causes Exim to run in a very restrictive mode in which
23119 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
23120 contains a full description of this facility.
23123 <indexterm role="option">
23124 <primary>mysql_servers</primary>
23127 <informaltable frame="all">
23128 <tgroup cols="4" colsep="0" rowsep="0">
23129 <colspec colwidth="8*" align="left"/>
23130 <colspec colwidth="5*" align="center"/>
23131 <colspec colwidth="5*" align="center"/>
23132 <colspec colwidth="6*" align="right"/>
23135 <entry><option>mysql_servers</option></entry>
23136 <entry>Use: <emphasis>main</emphasis></entry>
23137 <entry>Type: <emphasis>string list</emphasis></entry>
23138 <entry>Default: <emphasis>unset</emphasis></entry>
23144 <indexterm role="concept">
23145 <primary>MySQL</primary>
23146 <secondary>server list</secondary>
23148 This option provides a list of MySQL servers and associated connection data, to
23149 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECTsql"/>). The
23150 option is available only if Exim has been built with MySQL support.
23153 <indexterm role="option">
23154 <primary>never_users</primary>
23157 <informaltable frame="all">
23158 <tgroup cols="4" colsep="0" rowsep="0">
23159 <colspec colwidth="8*" align="left"/>
23160 <colspec colwidth="5*" align="center"/>
23161 <colspec colwidth="5*" align="center"/>
23162 <colspec colwidth="6*" align="right"/>
23165 <entry><option>never_users</option></entry>
23166 <entry>Use: <emphasis>main</emphasis></entry>
23167 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
23168 <entry>Default: <emphasis>unset</emphasis></entry>
23174 This option is expanded just once, at the start of Exim’s processing. Local
23175 message deliveries are normally run in processes that are setuid to the
23176 recipient, and remote deliveries are normally run under Exim’s own uid and gid.
23177 It is usually desirable to prevent any deliveries from running as root, as a
23181 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
23182 list of users that must not be used for local deliveries. This list is fixed in
23183 the binary and cannot be overridden by the configuration file. By default, it
23184 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
23185 can be used to add more users to the fixed list.
23188 If a message is to be delivered as one of the users on the fixed list or the
23189 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
23192 <literallayout class="monospaced">
23193 never_users = root:daemon:bin
23196 Including root is redundant if it is also on the fixed list, but it does no
23197 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
23201 <indexterm role="option">
23202 <primary>oracle_servers</primary>
23205 <informaltable frame="all">
23206 <tgroup cols="4" colsep="0" rowsep="0">
23207 <colspec colwidth="8*" align="left"/>
23208 <colspec colwidth="5*" align="center"/>
23209 <colspec colwidth="5*" align="center"/>
23210 <colspec colwidth="6*" align="right"/>
23213 <entry><option>oracle_servers</option></entry>
23214 <entry>Use: <emphasis>main</emphasis></entry>
23215 <entry>Type: <emphasis>string list</emphasis></entry>
23216 <entry>Default: <emphasis>unset</emphasis></entry>
23222 <indexterm role="concept">
23223 <primary>Oracle</primary>
23224 <secondary>server list</secondary>
23226 This option provides a list of Oracle servers and associated connection data,
23227 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECTsql"/>).
23228 The option is available only if Exim has been built with Oracle support.
23231 <indexterm role="option">
23232 <primary>percent_hack_domains</primary>
23235 <informaltable frame="all">
23236 <tgroup cols="4" colsep="0" rowsep="0">
23237 <colspec colwidth="8*" align="left"/>
23238 <colspec colwidth="5*" align="center"/>
23239 <colspec colwidth="5*" align="center"/>
23240 <colspec colwidth="6*" align="right"/>
23243 <entry><option>percent_hack_domains</option></entry>
23244 <entry>Use: <emphasis>main</emphasis></entry>
23245 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
23246 <entry>Default: <emphasis>unset</emphasis></entry>
23252 <indexterm role="concept">
23253 <primary><quote>percent hack</quote></primary>
23255 <indexterm role="concept">
23256 <primary>source routing</primary>
23257 <secondary>in email address</secondary>
23259 <indexterm role="concept">
23260 <primary>address</primary>
23261 <secondary>source-routed</secondary>
23263 The <quote>percent hack</quote> is the convention whereby a local part containing a
23264 percent sign is re-interpreted as a new email address, with the percent
23265 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
23266 also applied to RFC 2822 addresses that begin with an @ character. If this
23267 option is set, Exim implements the percent facility for those domains listed,
23268 but no others. This happens before an incoming SMTP address is tested against
23272 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
23273 trying to get round relaying restrictions. For this reason, it is best avoided
23274 if at all possible. Unfortunately, a number of less security-conscious MTAs
23275 implement it unconditionally. If you are running Exim on a gateway host, and
23276 routing mail through to internal MTAs without processing the local parts, it is
23277 a good idea to reject recipient addresses with percent characters in their
23278 local parts. Exim’s default configuration does this.
23281 <indexterm role="option">
23282 <primary>perl_at_start</primary>
23285 <informaltable frame="all">
23286 <tgroup cols="4" colsep="0" rowsep="0">
23287 <colspec colwidth="8*" align="left"/>
23288 <colspec colwidth="5*" align="center"/>
23289 <colspec colwidth="5*" align="center"/>
23290 <colspec colwidth="6*" align="right"/>
23293 <entry><option>perl_at_start</option></entry>
23294 <entry>Use: <emphasis>main</emphasis></entry>
23295 <entry>Type: <emphasis>boolean</emphasis></entry>
23296 <entry>Default: <emphasis>false</emphasis></entry>
23302 This option is available only when Exim is built with an embedded Perl
23303 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
23306 <indexterm role="option">
23307 <primary>perl_startup</primary>
23310 <informaltable frame="all">
23311 <tgroup cols="4" colsep="0" rowsep="0">
23312 <colspec colwidth="8*" align="left"/>
23313 <colspec colwidth="5*" align="center"/>
23314 <colspec colwidth="5*" align="center"/>
23315 <colspec colwidth="6*" align="right"/>
23318 <entry><option>perl_startup</option></entry>
23319 <entry>Use: <emphasis>main</emphasis></entry>
23320 <entry>Type: <emphasis>string</emphasis></entry>
23321 <entry>Default: <emphasis>unset</emphasis></entry>
23327 This option is available only when Exim is built with an embedded Perl
23328 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
23331 <indexterm role="option">
23332 <primary>pgsql_servers</primary>
23335 <informaltable frame="all">
23336 <tgroup cols="4" colsep="0" rowsep="0">
23337 <colspec colwidth="8*" align="left"/>
23338 <colspec colwidth="5*" align="center"/>
23339 <colspec colwidth="5*" align="center"/>
23340 <colspec colwidth="6*" align="right"/>
23343 <entry><option>pgsql_servers</option></entry>
23344 <entry>Use: <emphasis>main</emphasis></entry>
23345 <entry>Type: <emphasis>string list</emphasis></entry>
23346 <entry>Default: <emphasis>unset</emphasis></entry>
23352 <indexterm role="concept">
23353 <primary>PostgreSQL lookup type</primary>
23354 <secondary>server list</secondary>
23356 This option provides a list of PostgreSQL servers and associated connection
23357 data, to be used in conjunction with <command>pgsql</command> lookups (see section
23358 <xref linkend="SECTsql"/>). The option is available only if Exim has been built with
23359 PostgreSQL support.
23362 <indexterm role="option">
23363 <primary>pid_file_path</primary>
23366 <informaltable frame="all">
23367 <tgroup cols="4" colsep="0" rowsep="0">
23368 <colspec colwidth="8*" align="left"/>
23369 <colspec colwidth="5*" align="center"/>
23370 <colspec colwidth="5*" align="center"/>
23371 <colspec colwidth="6*" align="right"/>
23374 <entry><option>pid_file_path</option></entry>
23375 <entry>Use: <emphasis>main</emphasis></entry>
23376 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
23377 <entry>Default: <emphasis>set at compile time</emphasis></entry>
23383 <indexterm role="concept">
23384 <primary>daemon</primary>
23385 <secondary>pid file path</secondary>
23387 <indexterm role="concept">
23388 <primary>pid file</primary>
23389 <secondary>path for</secondary>
23391 This option sets the name of the file to which the Exim daemon writes its
23392 process id. The string is expanded, so it can contain, for example, references
23395 <literallayout class="monospaced">
23396 pid_file_path = /var/log/$primary_hostname/exim.pid
23399 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim’s
23401 The value set by the option can be overridden by the <option>-oP</option> command line
23402 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
23403 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
23406 <indexterm role="option">
23407 <primary>pipelining_advertise_hosts</primary>
23410 <informaltable frame="all">
23411 <tgroup cols="4" colsep="0" rowsep="0">
23412 <colspec colwidth="8*" align="left"/>
23413 <colspec colwidth="5*" align="center"/>
23414 <colspec colwidth="5*" align="center"/>
23415 <colspec colwidth="6*" align="right"/>
23418 <entry><option>pipelining_advertise_hosts</option></entry>
23419 <entry>Use: <emphasis>main</emphasis></entry>
23420 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
23421 <entry>Default: <emphasis>*</emphasis></entry>
23427 <indexterm role="concept">
23428 <primary>PIPELINING advertising</primary>
23429 <secondary>suppressing</secondary>
23431 This option can be used to suppress the advertisement of the SMTP
23432 PIPELINING extension to specific hosts. When PIPELINING is not
23433 advertised and <option>smtp_enforce_sync</option> is true, an Exim server enforces strict
23434 synchronization for each SMTP command and response.
23435 When PIPELINING is advertised, Exim assumes that clients will use it; <quote>out
23436 of order</quote> commands that are <quote>expected</quote> do not count as protocol errors (see
23437 <option>smtp_max_synprot_errors</option>).
23440 <indexterm role="option">
23441 <primary>preserve_message_logs</primary>
23444 <informaltable frame="all">
23445 <tgroup cols="4" colsep="0" rowsep="0">
23446 <colspec colwidth="8*" align="left"/>
23447 <colspec colwidth="5*" align="center"/>
23448 <colspec colwidth="5*" align="center"/>
23449 <colspec colwidth="6*" align="right"/>
23452 <entry><option>preserve_message_logs</option></entry>
23453 <entry>Use: <emphasis>main</emphasis></entry>
23454 <entry>Type: <emphasis>boolean</emphasis></entry>
23455 <entry>Default: <emphasis>false</emphasis></entry>
23461 <indexterm role="concept">
23462 <primary>message logs</primary>
23463 <secondary>preserving</secondary>
23465 If this option is set, message log files are not deleted when messages are
23466 completed. Instead, they are moved to a sub-directory of the spool directory
23467 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
23468 purposes. This is a dangerous option to set on systems with any appreciable
23469 volume of mail. Use with care!
23472 <indexterm role="option">
23473 <primary>primary_hostname</primary>
23476 <informaltable frame="all">
23477 <tgroup cols="4" colsep="0" rowsep="0">
23478 <colspec colwidth="8*" align="left"/>
23479 <colspec colwidth="5*" align="center"/>
23480 <colspec colwidth="5*" align="center"/>
23481 <colspec colwidth="6*" align="right"/>
23484 <entry><option>primary_hostname</option></entry>
23485 <entry>Use: <emphasis>main</emphasis></entry>
23486 <entry>Type: <emphasis>string</emphasis></entry>
23487 <entry>Default: <emphasis>see below</emphasis></entry>
23493 <indexterm role="concept">
23494 <primary>name</primary>
23495 <secondary>of local host</secondary>
23497 <indexterm role="concept">
23498 <primary>host</primary>
23499 <secondary>name of local</secondary>
23501 <indexterm role="concept">
23502 <primary>local host</primary>
23503 <secondary>name of</secondary>
23505 <indexterm role="concept">
23506 <primary><varname>$primary_hostname</varname></primary>
23508 This specifies the name of the current host. It is used in the default EHLO or
23509 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
23510 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
23511 The value is also used by default in some SMTP response messages from an Exim
23512 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
23515 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
23516 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
23517 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
23518 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
23519 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
23520 explicitly by this option, or defaulted.
23523 <indexterm role="option">
23524 <primary>print_topbitchars</primary>
23527 <informaltable frame="all">
23528 <tgroup cols="4" colsep="0" rowsep="0">
23529 <colspec colwidth="8*" align="left"/>
23530 <colspec colwidth="5*" align="center"/>
23531 <colspec colwidth="5*" align="center"/>
23532 <colspec colwidth="6*" align="right"/>
23535 <entry><option>print_topbitchars</option></entry>
23536 <entry>Use: <emphasis>main</emphasis></entry>
23537 <entry>Type: <emphasis>boolean</emphasis></entry>
23538 <entry>Default: <emphasis>false</emphasis></entry>
23544 <indexterm role="concept">
23545 <primary>printing characters</primary>
23547 <indexterm role="concept">
23548 <primary>8-bit characters</primary>
23550 By default, Exim considers only those characters whose codes lie in the range
23551 32–126 to be printing characters. In a number of circumstances (for example,
23552 when writing log entries) non-printing characters are converted into escape
23553 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
23554 is set, code values of 128 and above are also considered to be printing
23558 <indexterm role="option">
23559 <primary>process_log_path</primary>
23562 <informaltable frame="all">
23563 <tgroup cols="4" colsep="0" rowsep="0">
23564 <colspec colwidth="8*" align="left"/>
23565 <colspec colwidth="5*" align="center"/>
23566 <colspec colwidth="5*" align="center"/>
23567 <colspec colwidth="6*" align="right"/>
23570 <entry><option>process_log_path</option></entry>
23571 <entry>Use: <emphasis>main</emphasis></entry>
23572 <entry>Type: <emphasis>string</emphasis></entry>
23573 <entry>Default: <emphasis>unset</emphasis></entry>
23579 <indexterm role="concept">
23580 <primary>process log path</primary>
23582 <indexterm role="concept">
23583 <primary>log</primary>
23584 <secondary>process log</secondary>
23586 <indexterm role="concept">
23587 <primary><emphasis>exiwhat</emphasis></primary>
23589 This option sets the name of the file to which an Exim process writes its
23590 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
23591 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
23592 in Exim’s spool directory is used. The ability to specify the name explicitly
23593 can be useful in environments where two different Exims are running, using
23594 different spool directories.
23597 <indexterm role="option">
23598 <primary>prod_requires_admin</primary>
23601 <informaltable frame="all">
23602 <tgroup cols="4" colsep="0" rowsep="0">
23603 <colspec colwidth="8*" align="left"/>
23604 <colspec colwidth="5*" align="center"/>
23605 <colspec colwidth="5*" align="center"/>
23606 <colspec colwidth="6*" align="right"/>
23609 <entry><option>prod_requires_admin</option></entry>
23610 <entry>Use: <emphasis>main</emphasis></entry>
23611 <entry>Type: <emphasis>boolean</emphasis></entry>
23612 <entry>Default: <emphasis>true</emphasis></entry>
23618 <indexterm role="concept">
23619 <primary><option>-M</option> option</primary>
23621 <indexterm role="concept">
23622 <primary><option>-R</option> option</primary>
23624 <indexterm role="concept">
23625 <primary><option>-q</option> option</primary>
23627 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
23628 admin user unless <option>prod_requires_admin</option> is set false. See also
23629 <option>queue_list_requires_admin</option>.
23632 <indexterm role="option">
23633 <primary>qualify_domain</primary>
23636 <informaltable frame="all">
23637 <tgroup cols="4" colsep="0" rowsep="0">
23638 <colspec colwidth="8*" align="left"/>
23639 <colspec colwidth="5*" align="center"/>
23640 <colspec colwidth="5*" align="center"/>
23641 <colspec colwidth="6*" align="right"/>
23644 <entry><option>qualify_domain</option></entry>
23645 <entry>Use: <emphasis>main</emphasis></entry>
23646 <entry>Type: <emphasis>string</emphasis></entry>
23647 <entry>Default: <emphasis>see below</emphasis></entry>
23653 <indexterm role="concept">
23654 <primary>domain</primary>
23655 <secondary>for qualifying addresses</secondary>
23657 <indexterm role="concept">
23658 <primary>address</primary>
23659 <secondary>qualification</secondary>
23661 This option specifies the domain name that is added to any envelope sender
23662 addresses that do not have a domain qualification. It also applies to
23663 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
23664 are accepted by default only for locally-generated messages. Qualification is
23665 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
23666 locally-generated messages, unless the <option>-bnq</option> command line option is used.
23669 Messages from external sources must always contain fully qualified addresses,
23670 unless the sending host matches <option>sender_unqualified_hosts</option> or
23671 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
23672 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
23673 necessary. Internally, Exim always works with fully qualified envelope
23674 addresses. If <option>qualify_domain</option> is not set, it defaults to the
23675 <option>primary_hostname</option> value.
23678 <indexterm role="option">
23679 <primary>qualify_recipient</primary>
23682 <informaltable frame="all">
23683 <tgroup cols="4" colsep="0" rowsep="0">
23684 <colspec colwidth="8*" align="left"/>
23685 <colspec colwidth="5*" align="center"/>
23686 <colspec colwidth="5*" align="center"/>
23687 <colspec colwidth="6*" align="right"/>
23690 <entry><option>qualify_recipient</option></entry>
23691 <entry>Use: <emphasis>main</emphasis></entry>
23692 <entry>Type: <emphasis>string</emphasis></entry>
23693 <entry>Default: <emphasis>see below</emphasis></entry>
23699 This option allows you to specify a different domain for qualifying recipient
23700 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
23703 <indexterm role="option">
23704 <primary>queue_domains</primary>
23707 <informaltable frame="all">
23708 <tgroup cols="4" colsep="0" rowsep="0">
23709 <colspec colwidth="8*" align="left"/>
23710 <colspec colwidth="5*" align="center"/>
23711 <colspec colwidth="5*" align="center"/>
23712 <colspec colwidth="6*" align="right"/>
23715 <entry><option>queue_domains</option></entry>
23716 <entry>Use: <emphasis>main</emphasis></entry>
23717 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
23718 <entry>Default: <emphasis>unset</emphasis></entry>
23724 <indexterm role="concept">
23725 <primary>domain</primary>
23726 <secondary>specifying non-immediate delivery</secondary>
23728 <indexterm role="concept">
23729 <primary>queueing incoming messages</primary>
23731 <indexterm role="concept">
23732 <primary>message</primary>
23733 <secondary>queueing certain domains</secondary>
23735 This option lists domains for which immediate delivery is not required.
23736 A delivery process is started whenever a message is received, but only those
23737 domains that do not match are processed. All other deliveries wait until the
23738 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
23741 <indexterm role="option">
23742 <primary>queue_list_requires_admin</primary>
23745 <informaltable frame="all">
23746 <tgroup cols="4" colsep="0" rowsep="0">
23747 <colspec colwidth="8*" align="left"/>
23748 <colspec colwidth="5*" align="center"/>
23749 <colspec colwidth="5*" align="center"/>
23750 <colspec colwidth="6*" align="right"/>
23753 <entry><option>queue_list_requires_admin</option></entry>
23754 <entry>Use: <emphasis>main</emphasis></entry>
23755 <entry>Type: <emphasis>boolean</emphasis></entry>
23756 <entry>Default: <emphasis>true</emphasis></entry>
23762 <indexterm role="concept">
23763 <primary><option>-bp</option> option</primary>
23765 The <option>-bp</option> command-line option, which lists the messages that are on the
23766 queue, requires the caller to be an admin user unless
23767 <option>queue_list_requires_admin</option> is set false. See also <option>prod_requires_admin</option>.
23770 <indexterm role="option">
23771 <primary>queue_only</primary>
23774 <informaltable frame="all">
23775 <tgroup cols="4" colsep="0" rowsep="0">
23776 <colspec colwidth="8*" align="left"/>
23777 <colspec colwidth="5*" align="center"/>
23778 <colspec colwidth="5*" align="center"/>
23779 <colspec colwidth="6*" align="right"/>
23782 <entry><option>queue_only</option></entry>
23783 <entry>Use: <emphasis>main</emphasis></entry>
23784 <entry>Type: <emphasis>boolean</emphasis></entry>
23785 <entry>Default: <emphasis>false</emphasis></entry>
23791 <indexterm role="concept">
23792 <primary>queueing incoming messages</primary>
23794 <indexterm role="concept">
23795 <primary>message</primary>
23796 <secondary>queueing unconditionally</secondary>
23798 If <option>queue_only</option> is set, a delivery process is not automatically started
23799 whenever a message is received. Instead, the message waits on the queue for the
23800 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
23801 delivered immediately when certain conditions (such as heavy load) occur.
23804 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
23805 and <option>-odi</option> command line options override <option>queue_only</option> unless
23806 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
23807 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
23810 <indexterm role="option">
23811 <primary>queue_only_file</primary>
23814 <informaltable frame="all">
23815 <tgroup cols="4" colsep="0" rowsep="0">
23816 <colspec colwidth="8*" align="left"/>
23817 <colspec colwidth="5*" align="center"/>
23818 <colspec colwidth="5*" align="center"/>
23819 <colspec colwidth="6*" align="right"/>
23822 <entry><option>queue_only_file</option></entry>
23823 <entry>Use: <emphasis>main</emphasis></entry>
23824 <entry>Type: <emphasis>string</emphasis></entry>
23825 <entry>Default: <emphasis>unset</emphasis></entry>
23831 <indexterm role="concept">
23832 <primary>queueing incoming messages</primary>
23834 <indexterm role="concept">
23835 <primary>message</primary>
23836 <secondary>queueing by file existence</secondary>
23838 This option can be set to a colon-separated list of absolute path names, each
23839 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
23840 it tests for the existence of each listed path using a call to <function>stat()</function>. For
23841 each path that exists, the corresponding queuing option is set.
23842 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
23843 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
23845 <literallayout class="monospaced">
23846 queue_only_file = smtp/some/file
23849 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
23850 <filename>/some/file</filename> exists.
23853 <indexterm role="option">
23854 <primary>queue_only_load</primary>
23857 <informaltable frame="all">
23858 <tgroup cols="4" colsep="0" rowsep="0">
23859 <colspec colwidth="8*" align="left"/>
23860 <colspec colwidth="5*" align="center"/>
23861 <colspec colwidth="5*" align="center"/>
23862 <colspec colwidth="6*" align="right"/>
23865 <entry><option>queue_only_load</option></entry>
23866 <entry>Use: <emphasis>main</emphasis></entry>
23867 <entry>Type: <emphasis>fixed-point</emphasis></entry>
23868 <entry>Default: <emphasis>unset</emphasis></entry>
23874 <indexterm role="concept">
23875 <primary>load average</primary>
23877 <indexterm role="concept">
23878 <primary>queueing incoming messages</primary>
23880 <indexterm role="concept">
23881 <primary>message</primary>
23882 <secondary>queueing by load</secondary>
23884 If the system load average is higher than this value, incoming messages from
23885 all sources are queued, and no automatic deliveries are started. If this
23886 happens during local or remote SMTP input, all subsequent messages on the same
23887 connection are queued. Deliveries will subsequently be performed by queue
23888 runner processes. This option has no effect on ancient operating systems on
23889 which Exim cannot determine the load average. See also
23890 <option>deliver_queue_load_max</option> and <option>smtp_load_reserve</option>.
23893 <indexterm role="option">
23894 <primary>queue_only_override</primary>
23897 <informaltable frame="all">
23898 <tgroup cols="4" colsep="0" rowsep="0">
23899 <colspec colwidth="8*" align="left"/>
23900 <colspec colwidth="5*" align="center"/>
23901 <colspec colwidth="5*" align="center"/>
23902 <colspec colwidth="6*" align="right"/>
23905 <entry><option>queue_only_override</option></entry>
23906 <entry>Use: <emphasis>main</emphasis></entry>
23907 <entry>Type: <emphasis>boolean</emphasis></entry>
23908 <entry>Default: <emphasis>true</emphasis></entry>
23914 <indexterm role="concept">
23915 <primary>queueing incoming messages</primary>
23917 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
23918 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
23919 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
23920 to override; they are accepted, but ignored.
23923 <indexterm role="option">
23924 <primary>queue_run_in_order</primary>
23927 <informaltable frame="all">
23928 <tgroup cols="4" colsep="0" rowsep="0">
23929 <colspec colwidth="8*" align="left"/>
23930 <colspec colwidth="5*" align="center"/>
23931 <colspec colwidth="5*" align="center"/>
23932 <colspec colwidth="6*" align="right"/>
23935 <entry><option>queue_run_in_order</option></entry>
23936 <entry>Use: <emphasis>main</emphasis></entry>
23937 <entry>Type: <emphasis>boolean</emphasis></entry>
23938 <entry>Default: <emphasis>false</emphasis></entry>
23944 <indexterm role="concept">
23945 <primary>queue runner</primary>
23946 <secondary>processing messages in order</secondary>
23948 If this option is set, queue runs happen in order of message arrival instead of
23949 in an arbitrary order. For this to happen, a complete list of the entire queue
23950 must be set up before the deliveries start. When the queue is all held in a
23951 single directory (the default),
23954 a single list is created for both the ordered and the non-ordered cases.
23955 However, if <option>split_spool_directory</option> is set, a single list is not created when
23956 <option>queue_run_in_order</option> is false. In this case, the sub-directories are
23957 processed one at a time (in a random order), and this avoids setting up one
23958 huge list for the whole queue. Thus, setting <option>queue_run_in_order</option> with
23959 <option>split_spool_directory</option> may degrade performance when the queue is large,
23960 because of the extra work in setting up the single, large list. In most
23961 situations, <option>queue_run_in_order</option> should not be set.
23964 <indexterm role="option">
23965 <primary>queue_run_max</primary>
23968 <informaltable frame="all">
23969 <tgroup cols="4" colsep="0" rowsep="0">
23970 <colspec colwidth="8*" align="left"/>
23971 <colspec colwidth="5*" align="center"/>
23972 <colspec colwidth="5*" align="center"/>
23973 <colspec colwidth="6*" align="right"/>
23976 <entry><option>queue_run_max</option></entry>
23977 <entry>Use: <emphasis>main</emphasis></entry>
23978 <entry>Type: <emphasis>integer</emphasis></entry>
23979 <entry>Default: <emphasis>5</emphasis></entry>
23985 <indexterm role="concept">
23986 <primary>queue runner</primary>
23987 <secondary>maximum number of</secondary>
23989 This controls the maximum number of queue runner processes that an Exim daemon
23990 can run simultaneously. This does not mean that it starts them all at once,
23991 but rather that if the maximum number are still running when the time comes to
23992 start another one, it refrains from starting another one. This can happen with
23993 very large queues and/or very sluggish deliveries. This option does not,
23994 however, interlock with other processes, so additional queue runners can be
23995 started by other means, or by killing and restarting the daemon.
23998 Setting this option to zero does not suppress queue runs; rather, it disables
23999 the limit, allowing any number of simultaneous queue runner processes to be
24000 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
24001 the daemon’s command line.
24004 <indexterm role="option">
24005 <primary>queue_smtp_domains</primary>
24008 <informaltable frame="all">
24009 <tgroup cols="4" colsep="0" rowsep="0">
24010 <colspec colwidth="8*" align="left"/>
24011 <colspec colwidth="5*" align="center"/>
24012 <colspec colwidth="5*" align="center"/>
24013 <colspec colwidth="6*" align="right"/>
24016 <entry><option>queue_smtp_domains</option></entry>
24017 <entry>Use: <emphasis>main</emphasis></entry>
24018 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
24019 <entry>Default: <emphasis>unset</emphasis></entry>
24025 <indexterm role="concept">
24026 <primary>queueing incoming messages</primary>
24028 <indexterm role="concept">
24029 <primary>message</primary>
24030 <secondary>queueing remote deliveries</secondary>
24032 When this option is set, a delivery process is started whenever a message is
24033 received, routing is performed, and local deliveries take place.
24034 However, if any SMTP deliveries are required for domains that match
24035 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
24036 message waits on the queue for the next queue run. Since routing of the message
24037 has taken place, Exim knows to which remote hosts it must be delivered, and so
24038 when the queue run happens, multiple messages for the same host are delivered
24039 over a single SMTP connection. The <option>-odqs</option> command line option causes all
24040 SMTP deliveries to be queued in this way, and is equivalent to setting
24041 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
24042 <option>queue_domains</option>.
24045 <indexterm role="option">
24046 <primary>receive_timeout</primary>
24049 <informaltable frame="all">
24050 <tgroup cols="4" colsep="0" rowsep="0">
24051 <colspec colwidth="8*" align="left"/>
24052 <colspec colwidth="5*" align="center"/>
24053 <colspec colwidth="5*" align="center"/>
24054 <colspec colwidth="6*" align="right"/>
24057 <entry><option>receive_timeout</option></entry>
24058 <entry>Use: <emphasis>main</emphasis></entry>
24059 <entry>Type: <emphasis>time</emphasis></entry>
24060 <entry>Default: <emphasis>0s</emphasis></entry>
24066 <indexterm role="concept">
24067 <primary>timeout</primary>
24068 <secondary>for non-SMTP input</secondary>
24070 This option sets the timeout for accepting a non-SMTP message, that is, the
24071 maximum time that Exim waits when reading a message on the standard input. If
24072 the value is zero, it will wait for ever. This setting is overridden by the
24073 <option>-or</option> command line option. The timeout for incoming SMTP messages is
24074 controlled by <option>smtp_receive_timeout</option>.
24077 <indexterm role="option">
24078 <primary>received_header_text</primary>
24081 <informaltable frame="all">
24082 <tgroup cols="4" colsep="0" rowsep="0">
24083 <colspec colwidth="8*" align="left"/>
24084 <colspec colwidth="5*" align="center"/>
24085 <colspec colwidth="5*" align="center"/>
24086 <colspec colwidth="6*" align="right"/>
24089 <entry><option>received_header_text</option></entry>
24090 <entry>Use: <emphasis>main</emphasis></entry>
24091 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
24092 <entry>Default: <emphasis>see below</emphasis></entry>
24098 <indexterm role="concept">
24099 <primary>customizing</primary>
24100 <secondary><emphasis>Received:</emphasis> header</secondary>
24102 <indexterm role="concept">
24103 <primary><emphasis>Received:</emphasis> header line</primary>
24104 <secondary>customizing</secondary>
24106 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
24107 added to each message, except for the timestamp, which is automatically added
24108 on at the end (preceded by a semicolon). The string is expanded each time it is
24109 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
24110 added to the message. Otherwise, the string should start with the text
24111 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
24112 header lines. The default setting is:
24114 <literallayout class="monospaced">
24115 received_header_text = Received: \
24116 ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
24117 {${if def:sender_ident \
24118 {from ${quote_local_part:$sender_ident} }}\
24119 ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
24120 by $primary_hostname \
24121 ${if def:received_protocol {with $received_protocol}} \
24122 ${if def:tls_cipher {($tls_cipher)\n\t}}\
24123 (Exim $version_number)\n\t\
24124 ${if def:sender_address \
24125 {(envelope-from <$sender_address>)\n\t}}\
24126 id $message_exim_id\
24127 ${if def:received_for {\n\tfor $received_for}}
24130 The reference to the TLS cipher is omitted when Exim is built without TLS
24131 support. The use of conditional expansions ensures that this works for both
24132 locally generated messages and messages received from remote hosts, giving
24133 header lines such as the following:
24135 <literallayout class="monospaced">
24136 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
24137 by marley.carol.example with esmtp (Exim 4.00)
24138 (envelope-from <bob@carol.example>)
24139 id 16IOWa-00019l-00
24140 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
24141 Received: by scrooge.carol.example with local (Exim 4.00)
24142 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
24145 Until the body of the message has been received, the timestamp is the time when
24146 the message started to be received. Once the body has arrived, and all policy
24147 checks have taken place, the timestamp is updated to the time at which the
24148 message was accepted.
24151 <indexterm role="option">
24152 <primary>received_headers_max</primary>
24155 <informaltable frame="all">
24156 <tgroup cols="4" colsep="0" rowsep="0">
24157 <colspec colwidth="8*" align="left"/>
24158 <colspec colwidth="5*" align="center"/>
24159 <colspec colwidth="5*" align="center"/>
24160 <colspec colwidth="6*" align="right"/>
24163 <entry><option>received_headers_max</option></entry>
24164 <entry>Use: <emphasis>main</emphasis></entry>
24165 <entry>Type: <emphasis>integer</emphasis></entry>
24166 <entry>Default: <emphasis>30</emphasis></entry>
24172 <indexterm role="concept">
24173 <primary>loop</primary>
24174 <secondary>prevention</secondary>
24176 <indexterm role="concept">
24177 <primary>mail loop prevention</primary>
24179 <indexterm role="concept">
24180 <primary><emphasis>Received:</emphasis> header line</primary>
24181 <secondary>counting</secondary>
24183 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
24184 counted, and if it is greater than this parameter, a mail loop is assumed to
24185 have occurred, the delivery is abandoned, and an error message is generated.
24186 This applies to both local and remote deliveries.
24189 <indexterm role="option">
24190 <primary>recipient_unqualified_hosts</primary>
24193 <informaltable frame="all">
24194 <tgroup cols="4" colsep="0" rowsep="0">
24195 <colspec colwidth="8*" align="left"/>
24196 <colspec colwidth="5*" align="center"/>
24197 <colspec colwidth="5*" align="center"/>
24198 <colspec colwidth="6*" align="right"/>
24201 <entry><option>recipient_unqualified_hosts</option></entry>
24202 <entry>Use: <emphasis>main</emphasis></entry>
24203 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
24204 <entry>Default: <emphasis>unset</emphasis></entry>
24210 <indexterm role="concept">
24211 <primary>unqualified addresses</primary>
24213 <indexterm role="concept">
24214 <primary>host</primary>
24215 <secondary>unqualified addresses from</secondary>
24217 This option lists those hosts from which Exim is prepared to accept unqualified
24218 recipient addresses in message envelopes. The addresses are made fully
24219 qualified by the addition of the <option>qualify_recipient</option> value. This option also
24220 affects message header lines. Exim does not reject unqualified recipient
24221 addresses in headers, but it qualifies them only if the message came from a
24222 host that matches <option>recipient_unqualified_hosts</option>,
24223 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
24224 option was not set.
24227 <indexterm role="option">
24228 <primary>recipients_max</primary>
24231 <informaltable frame="all">
24232 <tgroup cols="4" colsep="0" rowsep="0">
24233 <colspec colwidth="8*" align="left"/>
24234 <colspec colwidth="5*" align="center"/>
24235 <colspec colwidth="5*" align="center"/>
24236 <colspec colwidth="6*" align="right"/>
24239 <entry><option>recipients_max</option></entry>
24240 <entry>Use: <emphasis>main</emphasis></entry>
24241 <entry>Type: <emphasis>integer</emphasis></entry>
24242 <entry>Default: <emphasis>0</emphasis></entry>
24248 <indexterm role="concept">
24249 <primary>limit</primary>
24250 <secondary>number of recipients</secondary>
24252 <indexterm role="concept">
24253 <primary>recipient</primary>
24254 <secondary>maximum number</secondary>
24256 If this option is set greater than zero, it specifies the maximum number of
24257 original recipients for any message. Additional recipients that are generated
24258 by aliasing or forwarding do not count. SMTP messages get a 452 response for
24259 all recipients over the limit; earlier recipients are delivered as normal.
24260 Non-SMTP messages with too many recipients are failed, and no deliveries are
24264 <indexterm role="concept">
24265 <primary>RCPT</primary>
24266 <secondary>maximum number of incoming</secondary>
24268 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
24269 RCPT commands in a single message.
24272 <indexterm role="option">
24273 <primary>recipients_max_reject</primary>
24276 <informaltable frame="all">
24277 <tgroup cols="4" colsep="0" rowsep="0">
24278 <colspec colwidth="8*" align="left"/>
24279 <colspec colwidth="5*" align="center"/>
24280 <colspec colwidth="5*" align="center"/>
24281 <colspec colwidth="6*" align="right"/>
24284 <entry><option>recipients_max_reject</option></entry>
24285 <entry>Use: <emphasis>main</emphasis></entry>
24286 <entry>Type: <emphasis>boolean</emphasis></entry>
24287 <entry>Default: <emphasis>false</emphasis></entry>
24293 If this option is set true, Exim rejects SMTP messages containing too many
24294 recipients by giving 552 errors to the surplus RCPT commands, and a 554
24295 error to the eventual DATA command. Otherwise (the default) it gives a 452
24296 error to the surplus RCPT commands and accepts the message on behalf of the
24297 initial set of recipients. The remote server should then re-send the message
24298 for the remaining recipients at a later time.
24301 <indexterm role="option">
24302 <primary>remote_max_parallel</primary>
24305 <informaltable frame="all">
24306 <tgroup cols="4" colsep="0" rowsep="0">
24307 <colspec colwidth="8*" align="left"/>
24308 <colspec colwidth="5*" align="center"/>
24309 <colspec colwidth="5*" align="center"/>
24310 <colspec colwidth="6*" align="right"/>
24313 <entry><option>remote_max_parallel</option></entry>
24314 <entry>Use: <emphasis>main</emphasis></entry>
24315 <entry>Type: <emphasis>integer</emphasis></entry>
24316 <entry>Default: <emphasis>2</emphasis></entry>
24322 <indexterm role="concept">
24323 <primary>delivery</primary>
24324 <secondary>parallelism for remote</secondary>
24326 This option controls parallel delivery of one message to a number of remote
24327 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
24328 does all the remote deliveries for a message one by one. Otherwise, if a single
24329 message has to be delivered to more than one remote host, or if several copies
24330 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
24331 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
24332 deliveries are required, the maximum number of processes are started, and as
24333 each one finishes, another is begun. The order of starting processes is the
24334 same as if sequential delivery were being done, and can be controlled by the
24335 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
24336 with debugging turned on, the debugging output from each delivery process is
24337 tagged with its process id.
24340 This option controls only the maximum number of parallel deliveries for one
24341 message in one Exim delivery process. Because Exim has no central queue
24342 manager, there is no way of controlling the total number of simultaneous
24343 deliveries if the configuration allows a delivery attempt as soon as a message
24347 <indexterm role="concept">
24348 <primary>number of deliveries</primary>
24350 <indexterm role="concept">
24351 <primary>delivery</primary>
24352 <secondary>maximum number of</secondary>
24354 If you want to control the total number of deliveries on the system, you
24355 need to set the <option>queue_only</option> option. This ensures that all incoming messages
24356 are added to the queue without starting a delivery process. Then set up an Exim
24357 daemon to start queue runner processes at appropriate intervals (probably
24358 fairly often, for example, every minute), and limit the total number of queue
24359 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
24360 delivers only one message at a time, the maximum number of deliveries that can
24361 then take place at once is <option>queue_run_max</option> multiplied by
24362 <option>remote_max_parallel</option>.
24365 If it is purely remote deliveries you want to control, use
24366 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
24367 doing the SMTP routing before queuing, so that several messages for the same
24368 host will eventually get delivered down the same connection.
24371 <indexterm role="option">
24372 <primary>remote_sort_domains</primary>
24375 <informaltable frame="all">
24376 <tgroup cols="4" colsep="0" rowsep="0">
24377 <colspec colwidth="8*" align="left"/>
24378 <colspec colwidth="5*" align="center"/>
24379 <colspec colwidth="5*" align="center"/>
24380 <colspec colwidth="6*" align="right"/>
24383 <entry><option>remote_sort_domains</option></entry>
24384 <entry>Use: <emphasis>main</emphasis></entry>
24385 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
24386 <entry>Default: <emphasis>unset</emphasis></entry>
24392 <indexterm role="concept">
24393 <primary>sorting remote deliveries</primary>
24395 <indexterm role="concept">
24396 <primary>delivery</primary>
24397 <secondary>sorting remote</secondary>
24399 When there are a number of remote deliveries for a message, they are sorted by
24400 domain into the order given by this list. For example,
24402 <literallayout class="monospaced">
24403 remote_sort_domains = *.cam.ac.uk:*.uk
24406 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
24407 then to those in the <option>uk</option> domain, then to any others.
24410 <indexterm role="option">
24411 <primary>retry_data_expire</primary>
24414 <informaltable frame="all">
24415 <tgroup cols="4" colsep="0" rowsep="0">
24416 <colspec colwidth="8*" align="left"/>
24417 <colspec colwidth="5*" align="center"/>
24418 <colspec colwidth="5*" align="center"/>
24419 <colspec colwidth="6*" align="right"/>
24422 <entry><option>retry_data_expire</option></entry>
24423 <entry>Use: <emphasis>main</emphasis></entry>
24424 <entry>Type: <emphasis>time</emphasis></entry>
24425 <entry>Default: <emphasis>7d</emphasis></entry>
24431 <indexterm role="concept">
24432 <primary>hints database</primary>
24433 <secondary>data expiry</secondary>
24435 This option sets a <quote>use before</quote> time on retry information in Exim’s hints
24436 database. Any older retry data is ignored. This means that, for example, once a
24437 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
24441 <indexterm role="option">
24442 <primary>retry_interval_max</primary>
24445 <informaltable frame="all">
24446 <tgroup cols="4" colsep="0" rowsep="0">
24447 <colspec colwidth="8*" align="left"/>
24448 <colspec colwidth="5*" align="center"/>
24449 <colspec colwidth="5*" align="center"/>
24450 <colspec colwidth="6*" align="right"/>
24453 <entry><option>retry_interval_max</option></entry>
24454 <entry>Use: <emphasis>main</emphasis></entry>
24455 <entry>Type: <emphasis>time</emphasis></entry>
24456 <entry>Default: <emphasis>24h</emphasis></entry>
24462 <indexterm role="concept">
24463 <primary>retry</primary>
24464 <secondary>limit on interval</secondary>
24466 <indexterm role="concept">
24467 <primary>limit</primary>
24468 <secondary>on retry interval</secondary>
24471 <para revisionflag="changed">
24472 Chapter <xref linkend="CHAPretry"/> describes Exim’s mechanisms for controlling the
24473 intervals between delivery attempts for messages that cannot be delivered
24474 straight away. This option sets an overall limit to the length of time between
24475 retries. It cannot be set greater than 24 hours; any attempt to do so forces
24479 <indexterm role="option">
24480 <primary>return_path_remove</primary>
24483 <informaltable frame="all">
24484 <tgroup cols="4" colsep="0" rowsep="0">
24485 <colspec colwidth="8*" align="left"/>
24486 <colspec colwidth="5*" align="center"/>
24487 <colspec colwidth="5*" align="center"/>
24488 <colspec colwidth="6*" align="right"/>
24491 <entry><option>return_path_remove</option></entry>
24492 <entry>Use: <emphasis>main</emphasis></entry>
24493 <entry>Type: <emphasis>boolean</emphasis></entry>
24494 <entry>Default: <emphasis>true</emphasis></entry>
24500 <indexterm role="concept">
24501 <primary><emphasis>Return-path:</emphasis> header line</primary>
24502 <secondary>removing</secondary>
24504 RFC 2821, section 4.4, states that an SMTP server must insert a
24505 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
24506 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
24507 MAIL command. This description implies that this header should not be present
24508 in an incoming message. If <option>return_path_remove</option> is true, any existing
24509 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
24510 received. Exim’s transports have options for adding <emphasis>Return-path:</emphasis> headers at
24511 the time of delivery. They are normally used only for final local deliveries.
24514 <indexterm role="option">
24515 <primary>return_size_limit</primary>
24518 <informaltable frame="all">
24519 <tgroup cols="4" colsep="0" rowsep="0">
24520 <colspec colwidth="8*" align="left"/>
24521 <colspec colwidth="5*" align="center"/>
24522 <colspec colwidth="5*" align="center"/>
24523 <colspec colwidth="6*" align="right"/>
24526 <entry><option>return_size_limit</option></entry>
24527 <entry>Use: <emphasis>main</emphasis></entry>
24528 <entry>Type: <emphasis>integer</emphasis></entry>
24529 <entry>Default: <emphasis>100K</emphasis></entry>
24535 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
24538 <indexterm role="option">
24539 <primary>rfc1413_hosts</primary>
24542 <informaltable frame="all">
24543 <tgroup cols="4" colsep="0" rowsep="0">
24544 <colspec colwidth="8*" align="left"/>
24545 <colspec colwidth="5*" align="center"/>
24546 <colspec colwidth="5*" align="center"/>
24547 <colspec colwidth="6*" align="right"/>
24550 <entry><option>rfc1413_hosts</option></entry>
24551 <entry>Use: <emphasis>main</emphasis></entry>
24552 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
24553 <entry>Default: <emphasis>*</emphasis></entry>
24559 <indexterm role="concept">
24560 <primary>RFC 1413</primary>
24562 <indexterm role="concept">
24563 <primary>host</primary>
24564 <secondary>for RFC 1413 calls</secondary>
24566 RFC 1413 identification calls are made to any client host which matches an item
24569 <para revisionflag="changed">
24570 <indexterm role="option">
24571 <primary>rfc1413_query_timeout</primary>
24574 <informaltable frame="all" revisionflag="changed">
24575 <tgroup cols="4" colsep="0" rowsep="0">
24576 <colspec colwidth="8*" align="left"/>
24577 <colspec colwidth="5*" align="center"/>
24578 <colspec colwidth="5*" align="center"/>
24579 <colspec colwidth="6*" align="right"/>
24582 <entry><option>rfc1413_query_timeout</option></entry>
24583 <entry>Use: <emphasis>main</emphasis></entry>
24584 <entry>Type: <emphasis>time</emphasis></entry>
24585 <entry>Default: <emphasis>5s</emphasis></entry>
24591 <indexterm role="concept">
24592 <primary>RFC 1413</primary>
24593 <secondary>query timeout</secondary>
24595 <indexterm role="concept">
24596 <primary>timeout</primary>
24597 <secondary>for RFC 1413 call</secondary>
24599 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
24600 no RFC 1413 calls are ever made.
24603 <indexterm role="option">
24604 <primary>sender_unqualified_hosts</primary>
24607 <informaltable frame="all">
24608 <tgroup cols="4" colsep="0" rowsep="0">
24609 <colspec colwidth="8*" align="left"/>
24610 <colspec colwidth="5*" align="center"/>
24611 <colspec colwidth="5*" align="center"/>
24612 <colspec colwidth="6*" align="right"/>
24615 <entry><option>sender_unqualified_hosts</option></entry>
24616 <entry>Use: <emphasis>main</emphasis></entry>
24617 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
24618 <entry>Default: <emphasis>unset</emphasis></entry>
24624 <indexterm role="concept">
24625 <primary>unqualified addresses</primary>
24627 <indexterm role="concept">
24628 <primary>host</primary>
24629 <secondary>unqualified addresses from</secondary>
24631 This option lists those hosts from which Exim is prepared to accept unqualified
24632 sender addresses. The addresses are made fully qualified by the addition of
24633 <option>qualify_domain</option>. This option also affects message header lines. Exim does
24634 not reject unqualified addresses in headers that contain sender addresses, but
24635 it qualifies them only if the message came from a host that matches
24636 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
24637 using TCP/IP), and the <option>-bnq</option> option was not set.
24640 <indexterm role="option">
24641 <primary>smtp_accept_keepalive</primary>
24644 <informaltable frame="all">
24645 <tgroup cols="4" colsep="0" rowsep="0">
24646 <colspec colwidth="8*" align="left"/>
24647 <colspec colwidth="5*" align="center"/>
24648 <colspec colwidth="5*" align="center"/>
24649 <colspec colwidth="6*" align="right"/>
24652 <entry><option>smtp_accept_keepalive</option></entry>
24653 <entry>Use: <emphasis>main</emphasis></entry>
24654 <entry>Type: <emphasis>boolean</emphasis></entry>
24655 <entry>Default: <emphasis>true</emphasis></entry>
24661 <indexterm role="concept">
24662 <primary>keepalive</primary>
24663 <secondary>on incoming connection</secondary>
24665 This option controls the setting of the SO_KEEPALIVE option on incoming
24666 TCP/IP socket connections. When set, it causes the kernel to probe idle
24667 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
24668 other end of the connection should send an acknowledgement if the connection is
24669 still okay or a reset if the connection has been aborted. The reason for doing
24670 this is that it has the beneficial effect of freeing up certain types of
24671 connection that can get stuck when the remote host is disconnected without
24672 tidying up the TCP/IP call properly. The keepalive mechanism takes several
24673 hours to detect unreachable hosts.
24676 <indexterm role="option">
24677 <primary>smtp_accept_max</primary>
24680 <informaltable frame="all">
24681 <tgroup cols="4" colsep="0" rowsep="0">
24682 <colspec colwidth="8*" align="left"/>
24683 <colspec colwidth="5*" align="center"/>
24684 <colspec colwidth="5*" align="center"/>
24685 <colspec colwidth="6*" align="right"/>
24688 <entry><option>smtp_accept_max</option></entry>
24689 <entry>Use: <emphasis>main</emphasis></entry>
24690 <entry>Type: <emphasis>integer</emphasis></entry>
24691 <entry>Default: <emphasis>20</emphasis></entry>
24697 <indexterm role="concept">
24698 <primary>limit</primary>
24699 <secondary>incoming SMTP connections</secondary>
24701 <indexterm role="concept">
24702 <primary>SMTP</primary>
24703 <secondary>incoming connection count</secondary>
24705 <indexterm role="concept">
24706 <primary>inetd</primary>
24708 This option specifies the maximum number of simultaneous incoming SMTP calls
24709 that Exim will accept. It applies only to the listening daemon; there is no
24710 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
24711 value is set to zero, no limit is applied. However, it is required to be
24712 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
24713 set. See also <option>smtp_accept_reserve</option>.
24716 <indexterm role="option">
24717 <primary>smtp_accept_max_nonmail</primary>
24720 <informaltable frame="all">
24721 <tgroup cols="4" colsep="0" rowsep="0">
24722 <colspec colwidth="8*" align="left"/>
24723 <colspec colwidth="5*" align="center"/>
24724 <colspec colwidth="5*" align="center"/>
24725 <colspec colwidth="6*" align="right"/>
24728 <entry><option>smtp_accept_max_nonmail</option></entry>
24729 <entry>Use: <emphasis>main</emphasis></entry>
24730 <entry>Type: <emphasis>integer</emphasis></entry>
24731 <entry>Default: <emphasis>10</emphasis></entry>
24737 <indexterm role="concept">
24738 <primary>limit</primary>
24739 <secondary>non-mail SMTP commands</secondary>
24741 <indexterm role="concept">
24742 <primary>SMTP</primary>
24743 <secondary>limiting non-mail commands</secondary>
24745 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
24746 the connection if there are too many. This option defines <quote>too many</quote>. The
24747 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
24748 client looping sending EHLO, for example. The check is applied only if the
24749 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
24752 When a new message is expected, one occurrence of RSET is not counted. This
24753 allows a client to send one RSET between messages (this is not necessary,
24754 but some clients do it). Exim also allows one uncounted occurence of HELO
24755 or EHLO, and one occurrence of STARTTLS between messages. After
24756 starting up a TLS session, another EHLO is expected, and so it too is not
24757 counted. The first occurrence of AUTH in a connection, or immediately
24758 following STARTTLS is not counted. Otherwise, all commands other than
24759 MAIL, RCPT, DATA, and QUIT are counted.
24762 <indexterm role="option">
24763 <primary>smtp_accept_max_nonmail_hosts</primary>
24766 <informaltable frame="all">
24767 <tgroup cols="4" colsep="0" rowsep="0">
24768 <colspec colwidth="8*" align="left"/>
24769 <colspec colwidth="5*" align="center"/>
24770 <colspec colwidth="5*" align="center"/>
24771 <colspec colwidth="6*" align="right"/>
24774 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
24775 <entry>Use: <emphasis>main</emphasis></entry>
24776 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
24777 <entry>Default: <emphasis>*</emphasis></entry>
24783 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
24784 check by setting this option. The default value makes it apply to all hosts. By
24785 changing the value, you can exclude any badly-behaved hosts that you have to
24789 <indexterm role="option">
24790 <primary>smtp_accept_max_per_connection</primary>
24793 <informaltable frame="all">
24794 <tgroup cols="4" colsep="0" rowsep="0">
24795 <colspec colwidth="8*" align="left"/>
24796 <colspec colwidth="5*" align="center"/>
24797 <colspec colwidth="5*" align="center"/>
24798 <colspec colwidth="6*" align="right"/>
24801 <entry><option>smtp_accept_max_per_connection</option></entry>
24802 <entry>Use: <emphasis>main</emphasis></entry>
24803 <entry>Type: <emphasis>integer</emphasis></entry>
24804 <entry>Default: <emphasis>1000</emphasis></entry>
24810 <indexterm role="concept">
24811 <primary>SMTP incoming message count</primary>
24812 <secondary>limiting</secondary>
24814 <indexterm role="concept">
24815 <primary>limit</primary>
24816 <secondary>messages per SMTP connection</secondary>
24818 The value of this option limits the number of MAIL commands that Exim is
24819 prepared to accept over a single SMTP connection, whether or not each command
24820 results in the transfer of a message. After the limit is reached, a 421
24821 response is given to subsequent MAIL commands. This limit is a safety
24822 precaution against a client that goes mad (incidents of this type have been
24826 <indexterm role="option">
24827 <primary>smtp_accept_max_per_host</primary>
24830 <informaltable frame="all">
24831 <tgroup cols="4" colsep="0" rowsep="0">
24832 <colspec colwidth="8*" align="left"/>
24833 <colspec colwidth="5*" align="center"/>
24834 <colspec colwidth="5*" align="center"/>
24835 <colspec colwidth="6*" align="right"/>
24838 <entry><option>smtp_accept_max_per_host</option></entry>
24839 <entry>Use: <emphasis>main</emphasis></entry>
24840 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
24841 <entry>Default: <emphasis>unset</emphasis></entry>
24847 <indexterm role="concept">
24848 <primary>limit</primary>
24849 <secondary>SMTP connections from one host</secondary>
24851 <indexterm role="concept">
24852 <primary>host</primary>
24853 <secondary>limiting SMTP connections from</secondary>
24855 This option restricts the number of simultaneous IP connections from a single
24856 host (strictly, from a single IP address) to the Exim daemon. The option is
24857 expanded, to enable different limits to be applied to different hosts by
24858 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
24859 connection attempts from the same host are rejected with error code 421. The
24860 default value of zero imposes no limit. If this option is set, it is required
24861 that <option>smtp_accept_max</option> be non-zero.
24864 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
24865 constructions that take an appreciable amount of time. The expansion and test
24866 happen in the main daemon loop, in order to reject additional connections
24867 without forking additional processes (otherwise a denial-of-service attack
24868 could cause a vast number or processes to be created). While the daemon is
24869 doing this processing, it cannot accept any other incoming connections.
24872 <indexterm role="option">
24873 <primary>smtp_accept_queue</primary>
24876 <informaltable frame="all">
24877 <tgroup cols="4" colsep="0" rowsep="0">
24878 <colspec colwidth="8*" align="left"/>
24879 <colspec colwidth="5*" align="center"/>
24880 <colspec colwidth="5*" align="center"/>
24881 <colspec colwidth="6*" align="right"/>
24884 <entry><option>smtp_accept_queue</option></entry>
24885 <entry>Use: <emphasis>main</emphasis></entry>
24886 <entry>Type: <emphasis>integer</emphasis></entry>
24887 <entry>Default: <emphasis>0</emphasis></entry>
24893 <indexterm role="concept">
24894 <primary>SMTP</primary>
24895 <secondary>incoming connection count</secondary>
24897 <indexterm role="concept">
24898 <primary>queueing incoming messages</primary>
24900 <indexterm role="concept">
24901 <primary>message</primary>
24902 <secondary>queueing by SMTP connection count</secondary>
24904 If the number of simultaneous incoming SMTP calls handled via the listening
24905 daemon exceeds this value, messages received by SMTP are just placed on the
24906 queue; no delivery processes are started automatically. A value of zero implies
24907 no limit, and clearly any non-zero value is useful only if it is less than the
24908 <option>smtp_accept_max</option> value (unless that is zero). See also <option>queue_only</option>,
24909 <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the various <option>-od</option><emphasis>x</emphasis>
24910 command line options.
24913 <indexterm role="option">
24914 <primary>smtp_accept_queue_per_connection</primary>
24917 <informaltable frame="all">
24918 <tgroup cols="4" colsep="0" rowsep="0">
24919 <colspec colwidth="8*" align="left"/>
24920 <colspec colwidth="5*" align="center"/>
24921 <colspec colwidth="5*" align="center"/>
24922 <colspec colwidth="6*" align="right"/>
24925 <entry><option>smtp_accept_queue_per_connection</option></entry>
24926 <entry>Use: <emphasis>main</emphasis></entry>
24927 <entry>Type: <emphasis>integer</emphasis></entry>
24928 <entry>Default: <emphasis>10</emphasis></entry>
24934 <indexterm role="concept">
24935 <primary>queueing incoming messages</primary>
24937 <indexterm role="concept">
24938 <primary>message</primary>
24939 <secondary>queueing by message count</secondary>
24941 This option limits the number of delivery processes that Exim starts
24942 automatically when receiving messages via SMTP, whether via the daemon or by
24943 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
24944 and the number of messages received in a single SMTP session exceeds this
24945 number, subsequent messages are placed on the queue, but no delivery processes
24946 are started. This helps to limit the number of Exim processes when a server
24947 restarts after downtime and there is a lot of mail waiting for it on other
24948 systems. On large systems, the default should probably be increased, and on
24949 dial-in client systems it should probably be set to zero (that is, disabled).
24952 <indexterm role="option">
24953 <primary>smtp_accept_reserve</primary>
24956 <informaltable frame="all">
24957 <tgroup cols="4" colsep="0" rowsep="0">
24958 <colspec colwidth="8*" align="left"/>
24959 <colspec colwidth="5*" align="center"/>
24960 <colspec colwidth="5*" align="center"/>
24961 <colspec colwidth="6*" align="right"/>
24964 <entry><option>smtp_accept_reserve</option></entry>
24965 <entry>Use: <emphasis>main</emphasis></entry>
24966 <entry>Type: <emphasis>integer</emphasis></entry>
24967 <entry>Default: <emphasis>0</emphasis></entry>
24973 <indexterm role="concept">
24974 <primary>SMTP</primary>
24975 <secondary>incoming call count</secondary>
24977 <indexterm role="concept">
24978 <primary>host</primary>
24979 <secondary>reserved</secondary>
24981 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
24982 number of SMTP connections that are reserved for connections from the hosts
24983 that are specified in <option>smtp_reserve_hosts</option>. The value set in
24984 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
24985 restricted to this number of connections; the option specifies a minimum number
24986 of connection slots for them, not a maximum. It is a guarantee that that group
24987 of hosts can always get at least <option>smtp_accept_reserve</option> connections.
24990 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
24991 set to 5, once there are 45 active connections (from any hosts), new
24992 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>.
24993 See also <option>smtp_accept_max_per_host</option>.
24996 <indexterm role="option">
24997 <primary>smtp_active_hostname</primary>
25000 <informaltable frame="all">
25001 <tgroup cols="4" colsep="0" rowsep="0">
25002 <colspec colwidth="8*" align="left"/>
25003 <colspec colwidth="5*" align="center"/>
25004 <colspec colwidth="5*" align="center"/>
25005 <colspec colwidth="6*" align="right"/>
25008 <entry><option>smtp_active_hostname</option></entry>
25009 <entry>Use: <emphasis>main</emphasis></entry>
25010 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
25011 <entry>Default: <emphasis>unset</emphasis></entry>
25017 <indexterm role="concept">
25018 <primary>host</primary>
25019 <secondary>name in SMTP responses</secondary>
25021 <indexterm role="concept">
25022 <primary>SMTP</primary>
25023 <secondary>host name in responses</secondary>
25025 <indexterm role="concept">
25026 <primary><varname>$primary_hostname</varname></primary>
25028 This option is provided for multi-homed servers that want to masquerade as
25029 several different hosts. At the start of an SMTP connection, its value is
25030 expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
25031 responses. For example, it is used as domain name in the response to an
25032 incoming HELO or EHLO command.
25035 <indexterm role="concept">
25036 <primary><varname>$smtp_active_hostname</varname></primary>
25038 It is also used in HELO commands for callout verification. The active hostname
25039 is placed in the <varname>$smtp_active_hostname</varname> variable, which is saved with any
25040 messages that are received. It is therefore available for use in routers and
25041 transports when the message is later delivered.
25044 If this option is unset, or if its expansion is forced to fail, or if the
25045 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
25046 used. Other expansion failures cause a message to be written to the main and
25047 panic logs, and the SMTP command receives a temporary error. Typically, the
25048 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
25051 <literallayout class="monospaced">
25052 smtp_active_hostname = ${if eq{$interface_address}{10.0.0.1}\
25053 {cox.mydomain}{box.mydomain}}
25056 <indexterm role="option">
25057 <primary>smtp_banner</primary>
25060 <informaltable frame="all">
25061 <tgroup cols="4" colsep="0" rowsep="0">
25062 <colspec colwidth="8*" align="left"/>
25063 <colspec colwidth="5*" align="center"/>
25064 <colspec colwidth="5*" align="center"/>
25065 <colspec colwidth="6*" align="right"/>
25068 <entry><option>smtp_banner</option></entry>
25069 <entry>Use: <emphasis>main</emphasis></entry>
25070 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
25071 <entry>Default: <emphasis>see below</emphasis></entry>
25077 <indexterm role="concept">
25078 <primary>SMTP</primary>
25079 <secondary>welcome banner</secondary>
25081 <indexterm role="concept">
25082 <primary>banner for SMTP</primary>
25084 <indexterm role="concept">
25085 <primary>welcome banner for SMTP</primary>
25087 <indexterm role="concept">
25088 <primary>customizing</primary>
25089 <secondary>SMTP banner</secondary>
25091 This string, which is expanded every time it is used, is output as the initial
25092 positive response to an SMTP connection. The default setting is:
25094 <literallayout class="monospaced">
25095 smtp_banner = $smtp_active_hostname ESMTP Exim \
25096 $version_number $tod_full
25099 Failure to expand the string causes a panic error. If you want to create a
25100 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
25101 appropriate points, but not at the end. Note that the 220 code is not included
25102 in this string. Exim adds it automatically (several times in the case of a
25103 multiline response).
25106 <indexterm role="option">
25107 <primary>smtp_check_spool_space</primary>
25110 <informaltable frame="all">
25111 <tgroup cols="4" colsep="0" rowsep="0">
25112 <colspec colwidth="8*" align="left"/>
25113 <colspec colwidth="5*" align="center"/>
25114 <colspec colwidth="5*" align="center"/>
25115 <colspec colwidth="6*" align="right"/>
25118 <entry><option>smtp_check_spool_space</option></entry>
25119 <entry>Use: <emphasis>main</emphasis></entry>
25120 <entry>Type: <emphasis>boolean</emphasis></entry>
25121 <entry>Default: <emphasis>true</emphasis></entry>
25127 <indexterm role="concept">
25128 <primary>checking disk space</primary>
25130 <indexterm role="concept">
25131 <primary>disk space</primary>
25132 <secondary>checking</secondary>
25134 <indexterm role="concept">
25135 <primary>spool directory</primary>
25136 <secondary>checking space</secondary>
25138 When this option is set, if an incoming SMTP session encounters the SIZE
25139 option on a MAIL command, it checks that there is enough space in the
25140 spool directory’s partition to accept a message of that size, while still
25141 leaving free the amount specified by <option>check_spool_space</option> (even if that value
25142 is zero). If there isn’t enough space, a temporary error code is returned.
25145 <indexterm role="option">
25146 <primary>smtp_connect_backlog</primary>
25149 <informaltable frame="all">
25150 <tgroup cols="4" colsep="0" rowsep="0">
25151 <colspec colwidth="8*" align="left"/>
25152 <colspec colwidth="5*" align="center"/>
25153 <colspec colwidth="5*" align="center"/>
25154 <colspec colwidth="6*" align="right"/>
25157 <entry><option>smtp_connect_backlog</option></entry>
25158 <entry>Use: <emphasis>main</emphasis></entry>
25159 <entry>Type: <emphasis>integer</emphasis></entry>
25160 <entry>Default: <emphasis>20</emphasis></entry>
25166 <indexterm role="concept">
25167 <primary>connection backlog</primary>
25169 <indexterm role="concept">
25170 <primary>SMTP</primary>
25171 <secondary>connection backlog</secondary>
25173 <indexterm role="concept">
25174 <primary>backlog of connections</primary>
25176 This option specifies a maximum number of waiting SMTP connections. Exim passes
25177 this value to the TCP/IP system when it sets up its listener. Once this number
25178 of connections are waiting for the daemon’s attention, subsequent connection
25179 attempts are refused at the TCP/IP level. At least, that is what the manuals
25180 say; in some circumstances such connection attempts have been observed to time
25181 out instead. For large systems it is probably a good idea to increase the
25182 value (to 50, say). It also gives some protection against denial-of-service
25183 attacks by SYN flooding.
25186 <indexterm role="option">
25187 <primary>smtp_enforce_sync</primary>
25190 <informaltable frame="all">
25191 <tgroup cols="4" colsep="0" rowsep="0">
25192 <colspec colwidth="8*" align="left"/>
25193 <colspec colwidth="5*" align="center"/>
25194 <colspec colwidth="5*" align="center"/>
25195 <colspec colwidth="6*" align="right"/>
25198 <entry><option>smtp_enforce_sync</option></entry>
25199 <entry>Use: <emphasis>main</emphasis></entry>
25200 <entry>Type: <emphasis>boolean</emphasis></entry>
25201 <entry>Default: <emphasis>true</emphasis></entry>
25207 <indexterm role="concept">
25208 <primary>SMTP</primary>
25209 <secondary>synchronization checking</secondary>
25211 <indexterm role="concept">
25212 <primary>synchronization checking in SMTP</primary>
25214 The SMTP protocol specification requires the client to wait for a response from
25215 the server at certain points in the dialogue. Without PIPELINING these
25216 synchronization points are after every command; with PIPELINING they are
25217 fewer, but they still exist.
25220 Some spamming sites send out a complete set of SMTP commands without waiting
25221 for any response. Exim protects against this by rejecting a message if the
25222 client has sent further input when it should not have. The error response <quote>554
25223 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
25224 for this error cannot be perfect because of transmission delays (unexpected
25225 input may be on its way but not yet received when Exim checks). However, it
25226 does detect many instances.
25229 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
25230 If you want to disable the check selectively (for example, only for certain
25231 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
25232 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
25235 <indexterm role="option">
25236 <primary>smtp_etrn_command</primary>
25239 <informaltable frame="all">
25240 <tgroup cols="4" colsep="0" rowsep="0">
25241 <colspec colwidth="8*" align="left"/>
25242 <colspec colwidth="5*" align="center"/>
25243 <colspec colwidth="5*" align="center"/>
25244 <colspec colwidth="6*" align="right"/>
25247 <entry><option>smtp_etrn_command</option></entry>
25248 <entry>Use: <emphasis>main</emphasis></entry>
25249 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
25250 <entry>Default: <emphasis>unset</emphasis></entry>
25256 <indexterm role="concept">
25257 <primary>ETRN</primary>
25258 <secondary>command to be run</secondary>
25260 <indexterm role="concept">
25261 <primary><varname>$domain</varname></primary>
25263 If this option is set, the given command is run whenever an SMTP ETRN
25264 command is received from a host that is permitted to issue such commands (see
25265 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
25266 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
25267 argument of the ETRN command, and no syntax checking is done on it. For
25270 <literallayout class="monospaced">
25271 smtp_etrn_command = /etc/etrn_command $domain \
25272 $sender_host_address
25275 A new process is created to run the command, but Exim does not wait for it to
25276 complete. Consequently, its status cannot be checked. If the command cannot be
25277 run, a line is written to the panic log, but the ETRN caller still receives
25278 a 250 success response. Exim is normally running under its own uid when
25279 receiving SMTP, so it is not possible for it to change the uid before running
25283 <indexterm role="option">
25284 <primary>smtp_etrn_serialize</primary>
25287 <informaltable frame="all">
25288 <tgroup cols="4" colsep="0" rowsep="0">
25289 <colspec colwidth="8*" align="left"/>
25290 <colspec colwidth="5*" align="center"/>
25291 <colspec colwidth="5*" align="center"/>
25292 <colspec colwidth="6*" align="right"/>
25295 <entry><option>smtp_etrn_serialize</option></entry>
25296 <entry>Use: <emphasis>main</emphasis></entry>
25297 <entry>Type: <emphasis>boolean</emphasis></entry>
25298 <entry>Default: <emphasis>true</emphasis></entry>
25304 <indexterm role="concept">
25305 <primary>ETRN</primary>
25306 <secondary>serializing</secondary>
25308 When this option is set, it prevents the simultaneous execution of more than
25309 one identical command as a result of ETRN in an SMTP connection. See
25310 section <xref linkend="SECTETRN"/> for details.
25313 <indexterm role="option">
25314 <primary>smtp_load_reserve</primary>
25317 <informaltable frame="all">
25318 <tgroup cols="4" colsep="0" rowsep="0">
25319 <colspec colwidth="8*" align="left"/>
25320 <colspec colwidth="5*" align="center"/>
25321 <colspec colwidth="5*" align="center"/>
25322 <colspec colwidth="6*" align="right"/>
25325 <entry><option>smtp_load_reserve</option></entry>
25326 <entry>Use: <emphasis>main</emphasis></entry>
25327 <entry>Type: <emphasis>fixed-point</emphasis></entry>
25328 <entry>Default: <emphasis>unset</emphasis></entry>
25334 <indexterm role="concept">
25335 <primary>load average</primary>
25337 If the system load average ever gets higher than this, incoming SMTP calls are
25338 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
25339 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
25340 the load is over the limit. The option has no effect on ancient operating
25341 systems on which Exim cannot determine the load average. See also
25342 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
25345 <indexterm role="option">
25346 <primary>smtp_max_synprot_errors</primary>
25349 <informaltable frame="all">
25350 <tgroup cols="4" colsep="0" rowsep="0">
25351 <colspec colwidth="8*" align="left"/>
25352 <colspec colwidth="5*" align="center"/>
25353 <colspec colwidth="5*" align="center"/>
25354 <colspec colwidth="6*" align="right"/>
25357 <entry><option>smtp_max_synprot_errors</option></entry>
25358 <entry>Use: <emphasis>main</emphasis></entry>
25359 <entry>Type: <emphasis>integer</emphasis></entry>
25360 <entry>Default: <emphasis>3</emphasis></entry>
25366 <indexterm role="concept">
25367 <primary>SMTP</primary>
25368 <secondary>limiting syntax and protocol errors</secondary>
25370 <indexterm role="concept">
25371 <primary>limit</primary>
25372 <secondary>SMTP syntax and protocol errors</secondary>
25374 Exim rejects SMTP commands that contain syntax or protocol errors. In
25375 particular, a syntactically invalid email address, as in this command:
25377 <literallayout class="monospaced">
25378 RCPT TO:<abc xyz@a.b.c>
25381 causes immediate rejection of the command, before any other tests are done.
25382 (The ACL cannot be run if there is no valid address to set up for it.) An
25383 example of a protocol error is receiving RCPT before MAIL. If there are
25384 too many syntax or protocol errors in one SMTP session, the connection is
25385 dropped. The limit is set by this option.
25388 <indexterm role="concept">
25389 <primary>PIPELINING</primary>
25390 <secondary>expected errors</secondary>
25392 When the PIPELINING extension to SMTP is in use, some protocol errors are
25393 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
25394 Exim assumes that PIPELINING will be used if it advertises it (see
25395 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
25396 not count towards the limit.
25399 <indexterm role="option">
25400 <primary>smtp_max_unknown_commands</primary>
25403 <informaltable frame="all">
25404 <tgroup cols="4" colsep="0" rowsep="0">
25405 <colspec colwidth="8*" align="left"/>
25406 <colspec colwidth="5*" align="center"/>
25407 <colspec colwidth="5*" align="center"/>
25408 <colspec colwidth="6*" align="right"/>
25411 <entry><option>smtp_max_unknown_commands</option></entry>
25412 <entry>Use: <emphasis>main</emphasis></entry>
25413 <entry>Type: <emphasis>integer</emphasis></entry>
25414 <entry>Default: <emphasis>3</emphasis></entry>
25420 <indexterm role="concept">
25421 <primary>SMTP</primary>
25422 <secondary>limiting unknown commands</secondary>
25424 <indexterm role="concept">
25425 <primary>limit</primary>
25426 <secondary>unknown SMTP commands</secondary>
25428 If there are too many unrecognized commands in an incoming SMTP session, an
25429 Exim server drops the connection. This is a defence against some kinds of abuse
25432 into making connections to SMTP ports; in these circumstances, a number of
25433 non-SMTP command lines are sent first.
25436 <indexterm role="option">
25437 <primary>smtp_ratelimit_hosts</primary>
25440 <informaltable frame="all">
25441 <tgroup cols="4" colsep="0" rowsep="0">
25442 <colspec colwidth="8*" align="left"/>
25443 <colspec colwidth="5*" align="center"/>
25444 <colspec colwidth="5*" align="center"/>
25445 <colspec colwidth="6*" align="right"/>
25448 <entry><option>smtp_ratelimit_hosts</option></entry>
25449 <entry>Use: <emphasis>main</emphasis></entry>
25450 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
25451 <entry>Default: <emphasis>unset</emphasis></entry>
25457 <indexterm role="concept">
25458 <primary>SMTP</primary>
25459 <secondary>rate limiting</secondary>
25461 <indexterm role="concept">
25462 <primary>limit</primary>
25463 <secondary>rate of message arrival</secondary>
25465 <indexterm role="concept">
25466 <primary>RCPT</primary>
25467 <secondary>rate limiting</secondary>
25469 Some sites find it helpful to be able to limit the rate at which certain hosts
25470 can send them messages, and the rate at which an individual message can specify
25474 Exim has two rate-limiting facilities. This section describes the older
25475 facility, which can limit rates within a single connection. The newer
25476 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
25477 <xref linkend="SECTratelimiting"/> for details of the newer facility.
25480 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
25481 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
25482 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
25483 respectively. Each option, if set, must contain a set of four comma-separated
25489 A threshold, before which there is no rate limiting.
25494 An initial time delay. Unlike other times in Exim, numbers with decimal
25495 fractional parts are allowed here.
25500 A factor by which to increase the delay each time.
25505 A maximum value for the delay. This should normally be less than 5 minutes,
25506 because after that time, the client is liable to timeout the SMTP command.
25511 For example, these settings have been used successfully at the site which
25512 first suggested this feature, for controlling mail from their customers:
25514 <literallayout class="monospaced">
25515 smtp_ratelimit_mail = 2,0.5s,1.05,4m
25516 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
25519 The first setting specifies delays that are applied to MAIL commands after
25520 two have been received over a single connection. The initial delay is 0.5
25521 seconds, increasing by a factor of 1.05 each time. The second setting applies
25522 delays to RCPT commands when more than four occur in a single message.
25525 <indexterm role="option">
25526 <primary>smtp_ratelimit_mail</primary>
25529 <informaltable frame="all">
25530 <tgroup cols="4" colsep="0" rowsep="0">
25531 <colspec colwidth="8*" align="left"/>
25532 <colspec colwidth="5*" align="center"/>
25533 <colspec colwidth="5*" align="center"/>
25534 <colspec colwidth="6*" align="right"/>
25537 <entry><option>smtp_ratelimit_mail</option></entry>
25538 <entry>Use: <emphasis>main</emphasis></entry>
25539 <entry>Type: <emphasis>string</emphasis></entry>
25540 <entry>Default: <emphasis>unset</emphasis></entry>
25546 See <option>smtp_ratelimit_hosts</option> above.
25549 <indexterm role="option">
25550 <primary>smtp_ratelimit_rcpt</primary>
25553 <informaltable frame="all">
25554 <tgroup cols="4" colsep="0" rowsep="0">
25555 <colspec colwidth="8*" align="left"/>
25556 <colspec colwidth="5*" align="center"/>
25557 <colspec colwidth="5*" align="center"/>
25558 <colspec colwidth="6*" align="right"/>
25561 <entry><option>smtp_ratelimit_rcpt</option></entry>
25562 <entry>Use: <emphasis>main</emphasis></entry>
25563 <entry>Type: <emphasis>string</emphasis></entry>
25564 <entry>Default: <emphasis>unset</emphasis></entry>
25570 See <option>smtp_ratelimit_hosts</option> above.
25573 <indexterm role="option">
25574 <primary>smtp_receive_timeout</primary>
25577 <informaltable frame="all">
25578 <tgroup cols="4" colsep="0" rowsep="0">
25579 <colspec colwidth="8*" align="left"/>
25580 <colspec colwidth="5*" align="center"/>
25581 <colspec colwidth="5*" align="center"/>
25582 <colspec colwidth="6*" align="right"/>
25585 <entry><option>smtp_receive_timeout</option></entry>
25586 <entry>Use: <emphasis>main</emphasis></entry>
25587 <entry>Type: <emphasis>time</emphasis></entry>
25588 <entry>Default: <emphasis>5m</emphasis></entry>
25594 <indexterm role="concept">
25595 <primary>timeout</primary>
25596 <secondary>for SMTP input</secondary>
25598 <indexterm role="concept">
25599 <primary>SMTP timeout</primary>
25600 <secondary>input</secondary>
25602 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
25603 input, including batch SMTP. If a line of input (either an SMTP command or a
25604 data line) is not received within this time, the SMTP connection is dropped and
25605 the message is abandoned.
25606 A line is written to the log containing one of the following messages:
25608 <literallayout class="monospaced">
25609 SMTP command timeout on connection from...
25610 SMTP data timeout on connection from...
25613 The former means that Exim was expecting to read an SMTP command; the latter
25614 means that it was in the DATA phase, reading the contents of a message.
25617 <indexterm role="concept">
25618 <primary><option>-os</option> option</primary>
25620 The value set by this option can be overridden by the
25621 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
25622 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
25623 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
25624 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
25627 <indexterm role="option">
25628 <primary>smtp_reserve_hosts</primary>
25631 <informaltable frame="all">
25632 <tgroup cols="4" colsep="0" rowsep="0">
25633 <colspec colwidth="8*" align="left"/>
25634 <colspec colwidth="5*" align="center"/>
25635 <colspec colwidth="5*" align="center"/>
25636 <colspec colwidth="6*" align="right"/>
25639 <entry><option>smtp_reserve_hosts</option></entry>
25640 <entry>Use: <emphasis>main</emphasis></entry>
25641 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
25642 <entry>Default: <emphasis>unset</emphasis></entry>
25648 This option defines hosts for which SMTP connections are reserved; see
25649 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
25652 <indexterm role="option">
25653 <primary>smtp_return_error_details</primary>
25656 <informaltable frame="all">
25657 <tgroup cols="4" colsep="0" rowsep="0">
25658 <colspec colwidth="8*" align="left"/>
25659 <colspec colwidth="5*" align="center"/>
25660 <colspec colwidth="5*" align="center"/>
25661 <colspec colwidth="6*" align="right"/>
25664 <entry><option>smtp_return_error_details</option></entry>
25665 <entry>Use: <emphasis>main</emphasis></entry>
25666 <entry>Type: <emphasis>boolean</emphasis></entry>
25667 <entry>Default: <emphasis>false</emphasis></entry>
25673 <indexterm role="concept">
25674 <primary>SMTP</primary>
25675 <secondary>details policy failures</secondary>
25677 <indexterm role="concept">
25678 <primary>policy control rejection</primary>
25679 <secondary>returning details</secondary>
25681 In the default state, Exim uses bland messages such as
25682 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
25683 reasons. Many sysadmins like this because it gives away little information
25684 to spammers. However, some other syadmins who are applying strict checking
25685 policies want to give out much fuller information about failures. Setting
25686 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
25687 example, instead of <quote>Administrative prohibition</quote>, it might give:
25689 <literallayout class="monospaced">
25690 550-Rejected after DATA: '>' missing at end of address:
25691 550 failing address in "From" header is: <user@dom.ain
25694 <indexterm role="option">
25695 <primary>spamd_address</primary>
25698 <informaltable frame="all">
25699 <tgroup cols="4" colsep="0" rowsep="0">
25700 <colspec colwidth="8*" align="left"/>
25701 <colspec colwidth="5*" align="center"/>
25702 <colspec colwidth="5*" align="center"/>
25703 <colspec colwidth="6*" align="right"/>
25706 <entry><option>spamd_address</option></entry>
25707 <entry>Use: <emphasis>main</emphasis></entry>
25708 <entry>Type: <emphasis>string</emphasis></entry>
25709 <entry>Default: <emphasis>see below</emphasis></entry>
25715 This option is available when Exim is compiled with the content-scanning
25716 extension. It specifies how Exim connects to SpamAssassin’s <option>spamd</option> daemon.
25717 The default value is
25719 <literallayout class="monospaced">
25723 See section <xref linkend="SECTscanspamass"/> for more details.
25726 <indexterm role="option">
25727 <primary>split_spool_directory</primary>
25730 <informaltable frame="all">
25731 <tgroup cols="4" colsep="0" rowsep="0">
25732 <colspec colwidth="8*" align="left"/>
25733 <colspec colwidth="5*" align="center"/>
25734 <colspec colwidth="5*" align="center"/>
25735 <colspec colwidth="6*" align="right"/>
25738 <entry><option>split_spool_directory</option></entry>
25739 <entry>Use: <emphasis>main</emphasis></entry>
25740 <entry>Type: <emphasis>boolean</emphasis></entry>
25741 <entry>Default: <emphasis>false</emphasis></entry>
25747 <indexterm role="concept">
25748 <primary>multiple spool directories</primary>
25750 <indexterm role="concept">
25751 <primary>spool directory</primary>
25752 <secondary>split</secondary>
25754 <indexterm role="concept">
25755 <primary>directories</primary>
25756 <secondary>multiple</secondary>
25758 If this option is set, it causes Exim to split its input directory into 62
25759 subdirectories, each with a single alphanumeric character as its name. The
25760 sixth character of the message id is used to allocate messages to
25761 subdirectories; this is the least significant base-62 digit of the time of
25762 arrival of the message.
25765 Splitting up the spool in this way may provide better performance on systems
25766 where there are long mail queues, by reducing the number of files in any one
25767 directory. The msglog directory is also split up in a similar way to the input
25768 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
25769 are still placed in the single directory <filename>msglog.OLD</filename>.
25772 It is not necessary to take any special action for existing messages when
25773 changing <option>split_spool_directory</option>. Exim notices messages that are in the
25774 <quote>wrong</quote> place, and continues to process them. If the option is turned off
25775 after a period of being on, the subdirectories will eventually empty and be
25776 automatically deleted.
25779 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
25780 changes. Instead of creating a list of all messages in the queue, and then
25781 trying to deliver each one in turn, it constructs a list of those in one
25782 sub-directory and tries to deliver them, before moving on to the next
25783 sub-directory. The sub-directories are processed in a random order. This
25784 spreads out the scanning of the input directories, and uses less memory. It is
25785 particularly beneficial when there are lots of messages on the queue. However,
25786 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
25787 entire queue has to be scanned and sorted before any deliveries can start.
25790 <indexterm role="option">
25791 <primary>spool_directory</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>spool_directory</option></entry>
25803 <entry>Use: <emphasis>main</emphasis></entry>
25804 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
25805 <entry>Default: <emphasis>set at compile time</emphasis></entry>
25811 <indexterm role="concept">
25812 <primary>spool directory</primary>
25813 <secondary>path to</secondary>
25815 This defines the directory in which Exim keeps its spool, that is, the messages
25816 it is waiting to deliver. The default value is taken from the compile-time
25817 configuration setting, if there is one. If not, this option must be set. The
25818 string is expanded, so it can contain, for example, a reference to
25819 <varname>$primary_hostname</varname>.
25822 If the spool directory name is fixed on your installation, it is recommended
25823 that you set it at build time rather than from this option, particularly if the
25824 log files are being written to the spool directory (see <option>log_file_path</option>).
25825 Otherwise log files cannot be used for errors that are detected early on, such
25826 as failures in the configuration file.
25829 By using this option to override the compiled-in path, it is possible to run
25830 tests of Exim without using the standard spool.
25833 <indexterm role="option">
25834 <primary>sqlite_lock_timeout</primary>
25837 <informaltable frame="all">
25838 <tgroup cols="4" colsep="0" rowsep="0">
25839 <colspec colwidth="8*" align="left"/>
25840 <colspec colwidth="5*" align="center"/>
25841 <colspec colwidth="5*" align="center"/>
25842 <colspec colwidth="6*" align="right"/>
25845 <entry><option>sqlite_lock_timeout</option></entry>
25846 <entry>Use: <emphasis>main</emphasis></entry>
25847 <entry>Type: <emphasis>time</emphasis></entry>
25848 <entry>Default: <emphasis>5s</emphasis></entry>
25854 <indexterm role="concept">
25855 <primary>sqlite</primary>
25856 <secondary>lock timeout</secondary>
25858 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
25859 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
25862 <indexterm role="option">
25863 <primary>strip_excess_angle_brackets</primary>
25866 <informaltable frame="all">
25867 <tgroup cols="4" colsep="0" rowsep="0">
25868 <colspec colwidth="8*" align="left"/>
25869 <colspec colwidth="5*" align="center"/>
25870 <colspec colwidth="5*" align="center"/>
25871 <colspec colwidth="6*" align="right"/>
25874 <entry><option>strip_excess_angle_brackets</option></entry>
25875 <entry>Use: <emphasis>main</emphasis></entry>
25876 <entry>Type: <emphasis>boolean</emphasis></entry>
25877 <entry>Default: <emphasis>false</emphasis></entry>
25883 <indexterm role="concept">
25884 <primary>angle brackets</primary>
25885 <secondary>excess</secondary>
25887 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
25888 items in addresses are stripped. For example, <emphasis><<xxx@a.b.c.d>></emphasis> is
25889 treated as <emphasis><xxx@a.b.c.d></emphasis>. If this is in the envelope and the message is
25890 passed on to another MTA, the excess angle brackets are not passed on. If this
25891 option is not set, multiple pairs of angle brackets cause a syntax error.
25894 <indexterm role="option">
25895 <primary>strip_trailing_dot</primary>
25898 <informaltable frame="all">
25899 <tgroup cols="4" colsep="0" rowsep="0">
25900 <colspec colwidth="8*" align="left"/>
25901 <colspec colwidth="5*" align="center"/>
25902 <colspec colwidth="5*" align="center"/>
25903 <colspec colwidth="6*" align="right"/>
25906 <entry><option>strip_trailing_dot</option></entry>
25907 <entry>Use: <emphasis>main</emphasis></entry>
25908 <entry>Type: <emphasis>boolean</emphasis></entry>
25909 <entry>Default: <emphasis>false</emphasis></entry>
25915 <indexterm role="concept">
25916 <primary>trailing dot on domain</primary>
25918 <indexterm role="concept">
25919 <primary>dot</primary>
25920 <secondary>trailing on domain</secondary>
25922 If this option is set, a trailing dot at the end of a domain in an address is
25923 ignored. If this is in the envelope and the message is passed on to another
25924 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
25925 domain causes a syntax error.
25926 However, addresses in header lines are checked only when an ACL requests header
25930 <indexterm role="option">
25931 <primary>syslog_duplication</primary>
25934 <informaltable frame="all">
25935 <tgroup cols="4" colsep="0" rowsep="0">
25936 <colspec colwidth="8*" align="left"/>
25937 <colspec colwidth="5*" align="center"/>
25938 <colspec colwidth="5*" align="center"/>
25939 <colspec colwidth="6*" align="right"/>
25942 <entry><option>syslog_duplication</option></entry>
25943 <entry>Use: <emphasis>main</emphasis></entry>
25944 <entry>Type: <emphasis>boolean</emphasis></entry>
25945 <entry>Default: <emphasis>true</emphasis></entry>
25951 <indexterm role="concept">
25952 <primary>syslog</primary>
25953 <secondary>duplicate log lines; suppressing</secondary>
25955 When Exim is logging to syslog, it writes the log lines for its three
25956 separate logs at different syslog priorities so that they can in principle
25957 be separated on the logging hosts. Some installations do not require this
25958 separation, and in those cases, the duplication of certain log lines is a
25959 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
25960 particular log line is written to syslog. For lines that normally go to
25961 both the main log and the reject log, the reject log version (possibly
25962 containing message header lines) is written, at LOG_NOTICE priority.
25963 Lines that normally go to both the main and the panic log are written at
25964 the LOG_ALERT priority.
25967 <indexterm role="option">
25968 <primary>syslog_facility</primary>
25971 <informaltable frame="all">
25972 <tgroup cols="4" colsep="0" rowsep="0">
25973 <colspec colwidth="8*" align="left"/>
25974 <colspec colwidth="5*" align="center"/>
25975 <colspec colwidth="5*" align="center"/>
25976 <colspec colwidth="6*" align="right"/>
25979 <entry><option>syslog_facility</option></entry>
25980 <entry>Use: <emphasis>main</emphasis></entry>
25981 <entry>Type: <emphasis>string</emphasis></entry>
25982 <entry>Default: <emphasis>unset</emphasis></entry>
25988 <indexterm role="concept">
25989 <primary>syslog</primary>
25990 <secondary>facility; setting</secondary>
25992 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
25993 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
25994 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
25995 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
25996 details of Exim’s logging.
25999 <indexterm role="option">
26000 <primary>syslog_processname</primary>
26003 <informaltable frame="all">
26004 <tgroup cols="4" colsep="0" rowsep="0">
26005 <colspec colwidth="8*" align="left"/>
26006 <colspec colwidth="5*" align="center"/>
26007 <colspec colwidth="5*" align="center"/>
26008 <colspec colwidth="6*" align="right"/>
26011 <entry><option>syslog_processname</option></entry>
26012 <entry>Use: <emphasis>main</emphasis></entry>
26013 <entry>Type: <emphasis>string</emphasis></entry>
26014 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
26020 <indexterm role="concept">
26021 <primary>syslog</primary>
26022 <secondary>process name; setting</secondary>
26024 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
26025 syslog. The value must be no longer than 32 characters. See chapter
26026 <xref linkend="CHAPlog"/> for details of Exim’s logging.
26029 <indexterm role="option">
26030 <primary>syslog_timestamp</primary>
26033 <informaltable frame="all">
26034 <tgroup cols="4" colsep="0" rowsep="0">
26035 <colspec colwidth="8*" align="left"/>
26036 <colspec colwidth="5*" align="center"/>
26037 <colspec colwidth="5*" align="center"/>
26038 <colspec colwidth="6*" align="right"/>
26041 <entry><option>syslog_timestamp</option></entry>
26042 <entry>Use: <emphasis>main</emphasis></entry>
26043 <entry>Type: <emphasis>boolean</emphasis></entry>
26044 <entry>Default: <emphasis>true</emphasis></entry>
26050 <indexterm role="concept">
26051 <primary>syslog</primary>
26052 <secondary>timestamps</secondary>
26054 If <option>syslog_timestamp</option> is set false, the timestamps on Exim’s log lines are
26055 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
26056 details of Exim’s logging.
26059 <indexterm role="option">
26060 <primary>system_filter</primary>
26063 <informaltable frame="all">
26064 <tgroup cols="4" colsep="0" rowsep="0">
26065 <colspec colwidth="8*" align="left"/>
26066 <colspec colwidth="5*" align="center"/>
26067 <colspec colwidth="5*" align="center"/>
26068 <colspec colwidth="6*" align="right"/>
26071 <entry><option>system_filter</option></entry>
26072 <entry>Use: <emphasis>main</emphasis></entry>
26073 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26074 <entry>Default: <emphasis>unset</emphasis></entry>
26080 <indexterm role="concept">
26081 <primary>filter</primary>
26082 <secondary>system filter</secondary>
26084 <indexterm role="concept">
26085 <primary>system filter</primary>
26086 <secondary>specifying</secondary>
26088 <indexterm role="concept">
26089 <primary>Sieve filter</primary>
26090 <secondary>not available for system filter</secondary>
26092 This option specifies an Exim filter file that is applied to all messages at
26093 the start of each delivery attempt, before any routing is done. System filters
26094 must be Exim filters; they cannot be Sieve filters. If the system filter
26095 generates any deliveries to files or pipes, or any new mail messages, the
26096 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
26097 which transports are to be used. Details of this facility are given in chapter
26098 <xref linkend="CHAPsystemfilter"/>.
26101 <indexterm role="option">
26102 <primary>system_filter_directory_transport</primary>
26105 <informaltable frame="all">
26106 <tgroup cols="4" colsep="0" rowsep="0">
26107 <colspec colwidth="8*" align="left"/>
26108 <colspec colwidth="5*" align="center"/>
26109 <colspec colwidth="5*" align="center"/>
26110 <colspec colwidth="6*" align="right"/>
26113 <entry><option>system_filter_directory_transport</option></entry>
26114 <entry>Use: <emphasis>main</emphasis></entry>
26115 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26116 <entry>Default: <emphasis>unset</emphasis></entry>
26122 <indexterm role="concept">
26123 <primary><varname>$address_file</varname></primary>
26125 This sets the name of the transport driver that is to be used when the
26126 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
26127 implying delivery of each message into a separate file in some directory.
26128 During the delivery, the variable <varname>$address_file</varname> contains the path name.
26131 <indexterm role="option">
26132 <primary>system_filter_file_transport</primary>
26135 <informaltable frame="all">
26136 <tgroup cols="4" colsep="0" rowsep="0">
26137 <colspec colwidth="8*" align="left"/>
26138 <colspec colwidth="5*" align="center"/>
26139 <colspec colwidth="5*" align="center"/>
26140 <colspec colwidth="6*" align="right"/>
26143 <entry><option>system_filter_file_transport</option></entry>
26144 <entry>Use: <emphasis>main</emphasis></entry>
26145 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26146 <entry>Default: <emphasis>unset</emphasis></entry>
26152 <indexterm role="concept">
26153 <primary>file</primary>
26154 <secondary>transport for system filter</secondary>
26156 This sets the name of the transport driver that is to be used when the <option>save</option>
26157 command in a system message filter specifies a path not ending in <quote>/</quote>. During
26158 the delivery, the variable <varname>$address_file</varname> contains the path name.
26161 <indexterm role="option">
26162 <primary>system_filter_group</primary>
26165 <informaltable frame="all">
26166 <tgroup cols="4" colsep="0" rowsep="0">
26167 <colspec colwidth="8*" align="left"/>
26168 <colspec colwidth="5*" align="center"/>
26169 <colspec colwidth="5*" align="center"/>
26170 <colspec colwidth="6*" align="right"/>
26173 <entry><option>system_filter_group</option></entry>
26174 <entry>Use: <emphasis>main</emphasis></entry>
26175 <entry>Type: <emphasis>string</emphasis></entry>
26176 <entry>Default: <emphasis>unset</emphasis></entry>
26182 <indexterm role="concept">
26183 <primary>gid (group id)</primary>
26184 <secondary>system filter</secondary>
26186 This option is used only when <option>system_filter_user</option> is also set. It sets the
26187 gid under which the system filter is run, overriding any gid that is associated
26188 with the user. The value may be numerical or symbolic.
26191 <indexterm role="option">
26192 <primary>system_filter_pipe_transport</primary>
26195 <informaltable frame="all">
26196 <tgroup cols="4" colsep="0" rowsep="0">
26197 <colspec colwidth="8*" align="left"/>
26198 <colspec colwidth="5*" align="center"/>
26199 <colspec colwidth="5*" align="center"/>
26200 <colspec colwidth="6*" align="right"/>
26203 <entry><option>system_filter_pipe_transport</option></entry>
26204 <entry>Use: <emphasis>main</emphasis></entry>
26205 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26206 <entry>Default: <emphasis>unset</emphasis></entry>
26212 <indexterm role="concept">
26213 <primary><command>pipe</command> transport</primary>
26214 <secondary>for system filter</secondary>
26216 <indexterm role="concept">
26217 <primary><varname>$address_pipe</varname></primary>
26219 This specifies the transport driver that is to be used when a <option>pipe</option> command
26220 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
26221 contains the pipe command.
26224 <indexterm role="option">
26225 <primary>system_filter_reply_transport</primary>
26228 <informaltable frame="all">
26229 <tgroup cols="4" colsep="0" rowsep="0">
26230 <colspec colwidth="8*" align="left"/>
26231 <colspec colwidth="5*" align="center"/>
26232 <colspec colwidth="5*" align="center"/>
26233 <colspec colwidth="6*" align="right"/>
26236 <entry><option>system_filter_reply_transport</option></entry>
26237 <entry>Use: <emphasis>main</emphasis></entry>
26238 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26239 <entry>Default: <emphasis>unset</emphasis></entry>
26245 <indexterm role="concept">
26246 <primary><command>autoreply</command> transport</primary>
26247 <secondary>for system filter</secondary>
26249 This specifies the transport driver that is to be used when a <option>mail</option> command
26250 is used in a system filter.
26253 <indexterm role="option">
26254 <primary>system_filter_user</primary>
26257 <informaltable frame="all">
26258 <tgroup cols="4" colsep="0" rowsep="0">
26259 <colspec colwidth="8*" align="left"/>
26260 <colspec colwidth="5*" align="center"/>
26261 <colspec colwidth="5*" align="center"/>
26262 <colspec colwidth="6*" align="right"/>
26265 <entry><option>system_filter_user</option></entry>
26266 <entry>Use: <emphasis>main</emphasis></entry>
26267 <entry>Type: <emphasis>string</emphasis></entry>
26268 <entry>Default: <emphasis>unset</emphasis></entry>
26274 <indexterm role="concept">
26275 <primary>uid (user id)</primary>
26276 <secondary>system filter</secondary>
26278 If this option is not set, the system filter is run in the main Exim delivery
26279 process, as root. When the option is set, the system filter runs in a separate
26280 process, as the given user. Unless the string consists entirely of digits, it
26281 is looked up in the password data. Failure to find the named user causes a
26282 configuration error. The gid is either taken from the password data, or
26283 specified by <option>system_filter_group</option>. When the uid is specified numerically,
26284 <option>system_filter_group</option> is required to be set.
26287 If the system filter generates any pipe, file, or reply deliveries, the uid
26288 under which the filter is run is used when transporting them, unless a
26289 transport option overrides. Normally you should set <option>system_filter_user</option> if
26290 your system filter generates these kinds of delivery.
26293 <indexterm role="option">
26294 <primary>tcp_nodelay</primary>
26297 <informaltable frame="all">
26298 <tgroup cols="4" colsep="0" rowsep="0">
26299 <colspec colwidth="8*" align="left"/>
26300 <colspec colwidth="5*" align="center"/>
26301 <colspec colwidth="5*" align="center"/>
26302 <colspec colwidth="6*" align="right"/>
26305 <entry><option>tcp_nodelay</option></entry>
26306 <entry>Use: <emphasis>main</emphasis></entry>
26307 <entry>Type: <emphasis>boolean</emphasis></entry>
26308 <entry>Default: <emphasis>true</emphasis></entry>
26314 <indexterm role="concept">
26315 <primary>daemon</primary>
26316 <secondary>TCP_NODELAY on sockets</secondary>
26318 <indexterm role="concept">
26319 <primary>Nagle algorithm</primary>
26321 <indexterm role="concept">
26322 <primary>TCP_NODELAY on listening sockets</primary>
26324 If this option is set false, it stops the Exim daemon setting the
26325 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
26326 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
26327 performance in interactive (character-by-character) situations. Turning it off
26328 should improve Exim’s performance a bit, so that is what happens by default.
26329 However, it appears that some broken clients cannot cope, and time out. Hence
26330 this option. It affects only those sockets that are set up for listening by the
26331 daemon. Sockets created by the smtp transport for delivering mail always set
26335 <indexterm role="option">
26336 <primary>timeout_frozen_after</primary>
26339 <informaltable frame="all">
26340 <tgroup cols="4" colsep="0" rowsep="0">
26341 <colspec colwidth="8*" align="left"/>
26342 <colspec colwidth="5*" align="center"/>
26343 <colspec colwidth="5*" align="center"/>
26344 <colspec colwidth="6*" align="right"/>
26347 <entry><option>timeout_frozen_after</option></entry>
26348 <entry>Use: <emphasis>main</emphasis></entry>
26349 <entry>Type: <emphasis>time</emphasis></entry>
26350 <entry>Default: <emphasis>0s</emphasis></entry>
26356 <indexterm role="concept">
26357 <primary>frozen messages</primary>
26358 <secondary>timing out</secondary>
26360 <indexterm role="concept">
26361 <primary>timeout</primary>
26362 <secondary>frozen messages</secondary>
26364 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
26365 message of any kind that has been on the queue for longer than the given
26366 time is automatically cancelled at the next queue run. If it is a bounce
26367 message, it is just discarded; otherwise, a bounce is sent to the sender, in a
26368 similar manner to cancellation by the <option>-Mg</option> command line option. If you want
26369 to timeout frozen bounce messages earlier than other kinds of frozen message,
26370 see <option>ignore_bounce_errors_after</option>.
26373 <indexterm role="option">
26374 <primary>timezone</primary>
26377 <informaltable frame="all">
26378 <tgroup cols="4" colsep="0" rowsep="0">
26379 <colspec colwidth="8*" align="left"/>
26380 <colspec colwidth="5*" align="center"/>
26381 <colspec colwidth="5*" align="center"/>
26382 <colspec colwidth="6*" align="right"/>
26385 <entry><option>timezone</option></entry>
26386 <entry>Use: <emphasis>main</emphasis></entry>
26387 <entry>Type: <emphasis>string</emphasis></entry>
26388 <entry>Default: <emphasis>unset</emphasis></entry>
26394 <indexterm role="concept">
26395 <primary>timezone</primary>
26396 <secondary>setting</secondary>
26398 The value of <option>timezone</option> is used to set the environment variable TZ while
26399 running Exim (if it is different on entry). This ensures that all timestamps
26400 created by Exim are in the required timezone. If you want all your timestamps
26401 to be in UTC (aka GMT) you should set
26403 <literallayout class="monospaced">
26407 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
26408 or, if that is not set, from the value of the TZ environment variable when Exim
26409 is built. If <option>timezone</option> is set to the empty string, either at build or run
26410 time, any existing TZ variable is removed from the environment when Exim
26411 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
26412 unfortunately not all, operating systems.
26415 <indexterm role="option">
26416 <primary>tls_advertise_hosts</primary>
26419 <informaltable frame="all">
26420 <tgroup cols="4" colsep="0" rowsep="0">
26421 <colspec colwidth="8*" align="left"/>
26422 <colspec colwidth="5*" align="center"/>
26423 <colspec colwidth="5*" align="center"/>
26424 <colspec colwidth="6*" align="right"/>
26427 <entry><option>tls_advertise_hosts</option></entry>
26428 <entry>Use: <emphasis>main</emphasis></entry>
26429 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
26430 <entry>Default: <emphasis>unset</emphasis></entry>
26436 <indexterm role="concept">
26437 <primary>TLS</primary>
26438 <secondary>advertising</secondary>
26440 <indexterm role="concept">
26441 <primary>encryption</primary>
26442 <secondary>on SMTP connection</secondary>
26444 <indexterm role="concept">
26445 <primary>SMTP</primary>
26446 <secondary>encrypted connection</secondary>
26448 When Exim is built with support for TLS encrypted connections, the availability
26449 of the STARTTLS command to set up an encrypted session is advertised in
26450 response to EHLO only to those client hosts that match this option. See
26451 chapter <xref linkend="CHAPTLS"/> for details of Exim’s support for TLS.
26454 <indexterm role="option">
26455 <primary>tls_certificate</primary>
26458 <informaltable frame="all">
26459 <tgroup cols="4" colsep="0" rowsep="0">
26460 <colspec colwidth="8*" align="left"/>
26461 <colspec colwidth="5*" align="center"/>
26462 <colspec colwidth="5*" align="center"/>
26463 <colspec colwidth="6*" align="right"/>
26466 <entry><option>tls_certificate</option></entry>
26467 <entry>Use: <emphasis>main</emphasis></entry>
26468 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26469 <entry>Default: <emphasis>unset</emphasis></entry>
26475 <indexterm role="concept">
26476 <primary>TLS</primary>
26477 <secondary>server certificate; location of</secondary>
26479 <indexterm role="concept">
26480 <primary>certificate for server</primary>
26481 <secondary>location of</secondary>
26483 The value of this option is expanded, and must then be the absolute path to a
26484 file which contains the server’s certificates. The server’s private key is also
26485 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
26486 <xref linkend="CHAPTLS"/> for further details.
26489 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
26490 receiving incoming messages as a server. If you want to supply certificates for
26491 use when sending messages as a client, you must set the <option>tls_certificate</option>
26492 option in the relevant <command>smtp</command> transport.
26495 <indexterm role="option">
26496 <primary>tls_crl</primary>
26499 <informaltable frame="all">
26500 <tgroup cols="4" colsep="0" rowsep="0">
26501 <colspec colwidth="8*" align="left"/>
26502 <colspec colwidth="5*" align="center"/>
26503 <colspec colwidth="5*" align="center"/>
26504 <colspec colwidth="6*" align="right"/>
26507 <entry><option>tls_crl</option></entry>
26508 <entry>Use: <emphasis>main</emphasis></entry>
26509 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26510 <entry>Default: <emphasis>unset</emphasis></entry>
26516 <indexterm role="concept">
26517 <primary>TLS</primary>
26518 <secondary>server certificate revocation list</secondary>
26520 <indexterm role="concept">
26521 <primary>certificate</primary>
26522 <secondary>revocation list for server</secondary>
26524 This option specifies a certificate revocation list. The expanded value must
26525 be the name of a file that contains a CRL in PEM format.
26528 <indexterm role="option">
26529 <primary>tls_dhparam</primary>
26532 <informaltable frame="all">
26533 <tgroup cols="4" colsep="0" rowsep="0">
26534 <colspec colwidth="8*" align="left"/>
26535 <colspec colwidth="5*" align="center"/>
26536 <colspec colwidth="5*" align="center"/>
26537 <colspec colwidth="6*" align="right"/>
26540 <entry><option>tls_dhparam</option></entry>
26541 <entry>Use: <emphasis>main</emphasis></entry>
26542 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26543 <entry>Default: <emphasis>unset</emphasis></entry>
26549 <indexterm role="concept">
26550 <primary>TLS</primary>
26551 <secondary>D-H parameters for server</secondary>
26553 The value of this option is expanded, and must then be the absolute path to
26554 a file which contains the server’s DH parameter values.
26555 This is used only for OpenSSL. When Exim is linked with GnuTLS, this option is
26556 ignored. See section <xref linkend="SECTopenvsgnu"/> for further details.
26559 <indexterm role="option">
26560 <primary>tls_on_connect_ports</primary>
26563 <informaltable frame="all">
26564 <tgroup cols="4" colsep="0" rowsep="0">
26565 <colspec colwidth="8*" align="left"/>
26566 <colspec colwidth="5*" align="center"/>
26567 <colspec colwidth="5*" align="center"/>
26568 <colspec colwidth="6*" align="right"/>
26571 <entry><option>tls_on_connect_ports</option></entry>
26572 <entry>Use: <emphasis>main</emphasis></entry>
26573 <entry>Type: <emphasis>string list</emphasis></entry>
26574 <entry>Default: <emphasis>unset</emphasis></entry>
26580 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
26581 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
26582 set up without waiting for the client to issue a STARTTLS command. For
26583 further details, see section <xref linkend="SECTsupobssmt"/>.
26586 <indexterm role="option">
26587 <primary>tls_privatekey</primary>
26590 <informaltable frame="all">
26591 <tgroup cols="4" colsep="0" rowsep="0">
26592 <colspec colwidth="8*" align="left"/>
26593 <colspec colwidth="5*" align="center"/>
26594 <colspec colwidth="5*" align="center"/>
26595 <colspec colwidth="6*" align="right"/>
26598 <entry><option>tls_privatekey</option></entry>
26599 <entry>Use: <emphasis>main</emphasis></entry>
26600 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26601 <entry>Default: <emphasis>unset</emphasis></entry>
26607 <indexterm role="concept">
26608 <primary>TLS</primary>
26609 <secondary>server private key; location of</secondary>
26612 <para revisionflag="changed">
26613 The value of this option is expanded, and must then be the absolute path to a
26614 file which contains the server’s private key. If this option is unset, or if
26615 the expansion is forced to fail, or the result is an empty string, the private
26616 key is assumed to be in the same file as the server’s certificates. See chapter
26617 <xref linkend="CHAPTLS"/> for further details.
26620 <indexterm role="option">
26621 <primary>tls_remember_esmtp</primary>
26624 <informaltable frame="all">
26625 <tgroup cols="4" colsep="0" rowsep="0">
26626 <colspec colwidth="8*" align="left"/>
26627 <colspec colwidth="5*" align="center"/>
26628 <colspec colwidth="5*" align="center"/>
26629 <colspec colwidth="6*" align="right"/>
26632 <entry><option>tls_remember_esmtp</option></entry>
26633 <entry>Use: <emphasis>main</emphasis></entry>
26634 <entry>Type: <emphasis>boolean</emphasis></entry>
26635 <entry>Default: <emphasis>false</emphasis></entry>
26641 <indexterm role="concept">
26642 <primary>TLS</primary>
26643 <secondary>esmtp state; remembering</secondary>
26645 <indexterm role="concept">
26646 <primary>TLS</primary>
26647 <secondary>broken clients</secondary>
26649 If this option is set true, Exim violates the RFCs by remembering that it is in
26650 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
26651 support for broken clients that fail to send a new EHLO after starting a
26655 <indexterm role="option">
26656 <primary>tls_require_ciphers</primary>
26659 <informaltable frame="all">
26660 <tgroup cols="4" colsep="0" rowsep="0">
26661 <colspec colwidth="8*" align="left"/>
26662 <colspec colwidth="5*" align="center"/>
26663 <colspec colwidth="5*" align="center"/>
26664 <colspec colwidth="6*" align="right"/>
26667 <entry><option>tls_require_ciphers</option></entry>
26668 <entry>Use: <emphasis>main</emphasis></entry>
26669 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26670 <entry>Default: <emphasis>unset</emphasis></entry>
26676 <indexterm role="concept">
26677 <primary>TLS</primary>
26678 <secondary>requiring specific ciphers</secondary>
26680 <indexterm role="concept">
26681 <primary>cipher</primary>
26682 <secondary>requiring specific</secondary>
26684 This option controls which ciphers can be used for incoming TLS connections.
26685 The <command>smtp</command> transport has an option of the same name for controlling outgoing
26686 connections. This option is expanded for each connection, so can be varied for
26687 different clients if required. The value of this option must be a list of
26688 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
26689 in somewhat different ways. If GnuTLS is being used, the client controls the
26690 preference order of the available ciphers. Details are given in sections
26691 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
26694 <indexterm role="option">
26695 <primary>tls_try_verify_hosts</primary>
26698 <informaltable frame="all">
26699 <tgroup cols="4" colsep="0" rowsep="0">
26700 <colspec colwidth="8*" align="left"/>
26701 <colspec colwidth="5*" align="center"/>
26702 <colspec colwidth="5*" align="center"/>
26703 <colspec colwidth="6*" align="right"/>
26706 <entry><option>tls_try_verify_hosts</option></entry>
26707 <entry>Use: <emphasis>main</emphasis></entry>
26708 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
26709 <entry>Default: <emphasis>unset</emphasis></entry>
26715 <indexterm role="concept">
26716 <primary>TLS</primary>
26717 <secondary>client certificate verification</secondary>
26719 <indexterm role="concept">
26720 <primary>certificate</primary>
26721 <secondary>verification of client</secondary>
26723 See <option>tls_verify_hosts</option> below.
26726 <indexterm role="option">
26727 <primary>tls_verify_certificates</primary>
26730 <informaltable frame="all">
26731 <tgroup cols="4" colsep="0" rowsep="0">
26732 <colspec colwidth="8*" align="left"/>
26733 <colspec colwidth="5*" align="center"/>
26734 <colspec colwidth="5*" align="center"/>
26735 <colspec colwidth="6*" align="right"/>
26738 <entry><option>tls_verify_certificates</option></entry>
26739 <entry>Use: <emphasis>main</emphasis></entry>
26740 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26741 <entry>Default: <emphasis>unset</emphasis></entry>
26747 <indexterm role="concept">
26748 <primary>TLS</primary>
26749 <secondary>client certificate verification</secondary>
26751 <indexterm role="concept">
26752 <primary>certificate</primary>
26753 <secondary>verification of client</secondary>
26755 The value of this option is expanded, and must then be the absolute path to
26756 a file containing permitted certificates for clients that
26757 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>. Alternatively, if you
26758 are using OpenSSL, you can set <option>tls_verify_certificates</option> to the name of a
26759 directory containing certificate files. This does not work with GnuTLS; the
26760 option must be set to the name of a single file if you are using GnuTLS.
26763 <indexterm role="option">
26764 <primary>tls_verify_hosts</primary>
26767 <informaltable frame="all">
26768 <tgroup cols="4" colsep="0" rowsep="0">
26769 <colspec colwidth="8*" align="left"/>
26770 <colspec colwidth="5*" align="center"/>
26771 <colspec colwidth="5*" align="center"/>
26772 <colspec colwidth="6*" align="right"/>
26775 <entry><option>tls_verify_hosts</option></entry>
26776 <entry>Use: <emphasis>main</emphasis></entry>
26777 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
26778 <entry>Default: <emphasis>unset</emphasis></entry>
26784 <indexterm role="concept">
26785 <primary>TLS</primary>
26786 <secondary>client certificate verification</secondary>
26788 <indexterm role="concept">
26789 <primary>certificate</primary>
26790 <secondary>verification of client</secondary>
26792 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
26793 certificates from clients.
26794 The expected certificates are defined by <option>tls_verify_certificates</option>, which
26795 must be set. A configuration error occurs if either <option>tls_verify_hosts</option> or
26796 <option>tls_try_verify_hosts</option> is set and <option>tls_verify_certificates</option> is not set.
26799 Any client that matches <option>tls_verify_hosts</option> is constrained by
26800 <option>tls_verify_certificates</option>. The client must present one of the listed
26801 certificates. If it does not, the connection is aborted.
26804 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
26805 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
26806 certificate and checks it against <option>tls_verify_certificates</option>, but does not
26807 abort the connection if there is no certificate or if it does not match. This
26808 state can be detected in an ACL, which makes it possible to implement policies
26809 such as <quote>accept for relay only if a verified certificate has been received,
26810 but accept for local delivery if encrypted, even without a verified
26811 certificate</quote>.
26814 Client hosts that match neither of these lists are not asked to present
26818 <indexterm role="option">
26819 <primary>trusted_groups</primary>
26822 <informaltable frame="all">
26823 <tgroup cols="4" colsep="0" rowsep="0">
26824 <colspec colwidth="8*" align="left"/>
26825 <colspec colwidth="5*" align="center"/>
26826 <colspec colwidth="5*" align="center"/>
26827 <colspec colwidth="6*" align="right"/>
26830 <entry><option>trusted_groups</option></entry>
26831 <entry>Use: <emphasis>main</emphasis></entry>
26832 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
26833 <entry>Default: <emphasis>unset</emphasis></entry>
26839 <indexterm role="concept">
26840 <primary>trusted group</primary>
26842 <indexterm role="concept">
26843 <primary>group</primary>
26844 <secondary>trusted</secondary>
26846 This option is expanded just once, at the start of Exim’s processing. If this
26847 option is set, any process that is running in one of the listed groups, or
26848 which has one of them as a supplementary group, is trusted. The groups can be
26849 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
26850 details of what trusted callers are permitted to do. If neither
26851 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
26855 <indexterm role="option">
26856 <primary>trusted_users</primary>
26859 <informaltable frame="all">
26860 <tgroup cols="4" colsep="0" rowsep="0">
26861 <colspec colwidth="8*" align="left"/>
26862 <colspec colwidth="5*" align="center"/>
26863 <colspec colwidth="5*" align="center"/>
26864 <colspec colwidth="6*" align="right"/>
26867 <entry><option>trusted_users</option></entry>
26868 <entry>Use: <emphasis>main</emphasis></entry>
26869 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
26870 <entry>Default: <emphasis>unset</emphasis></entry>
26876 <indexterm role="concept">
26877 <primary>trusted user</primary>
26879 <indexterm role="concept">
26880 <primary>user</primary>
26881 <secondary>trusted</secondary>
26883 This option is expanded just once, at the start of Exim’s processing. If this
26884 option is set, any process that is running as one of the listed users is
26885 trusted. The users can be specified numerically or by name. See section
26886 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
26887 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
26888 Exim user are trusted.
26891 <indexterm role="option">
26892 <primary>unknown_login</primary>
26895 <informaltable frame="all">
26896 <tgroup cols="4" colsep="0" rowsep="0">
26897 <colspec colwidth="8*" align="left"/>
26898 <colspec colwidth="5*" align="center"/>
26899 <colspec colwidth="5*" align="center"/>
26900 <colspec colwidth="6*" align="right"/>
26903 <entry><option>unknown_login</option></entry>
26904 <entry>Use: <emphasis>main</emphasis></entry>
26905 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26906 <entry>Default: <emphasis>unset</emphasis></entry>
26912 <indexterm role="concept">
26913 <primary>uid (user id)</primary>
26914 <secondary>unknown caller</secondary>
26916 <indexterm role="concept">
26917 <primary><varname>$caller_uid</varname></primary>
26919 This is a specialized feature for use in unusual configurations. By default, if
26920 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
26921 gives up. The <option>unknown_login</option> option can be used to set a login name to be
26922 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
26923 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
26924 is used for the user’s real name (gecos field), unless this has been set by the
26925 <option>-F</option> option.
26928 <indexterm role="option">
26929 <primary>unknown_username</primary>
26932 <informaltable frame="all">
26933 <tgroup cols="4" colsep="0" rowsep="0">
26934 <colspec colwidth="8*" align="left"/>
26935 <colspec colwidth="5*" align="center"/>
26936 <colspec colwidth="5*" align="center"/>
26937 <colspec colwidth="6*" align="right"/>
26940 <entry><option>unknown_username</option></entry>
26941 <entry>Use: <emphasis>main</emphasis></entry>
26942 <entry>Type: <emphasis>string</emphasis></entry>
26943 <entry>Default: <emphasis>unset</emphasis></entry>
26949 See <option>unknown_login</option>.
26952 <indexterm role="option">
26953 <primary>untrusted_set_sender</primary>
26956 <informaltable frame="all">
26957 <tgroup cols="4" colsep="0" rowsep="0">
26958 <colspec colwidth="8*" align="left"/>
26959 <colspec colwidth="5*" align="center"/>
26960 <colspec colwidth="5*" align="center"/>
26961 <colspec colwidth="6*" align="right"/>
26964 <entry><option>untrusted_set_sender</option></entry>
26965 <entry>Use: <emphasis>main</emphasis></entry>
26966 <entry>Type: <emphasis>address list</emphasis>†<emphasis></emphasis></entry>
26967 <entry>Default: <emphasis>unset</emphasis></entry>
26973 <indexterm role="concept">
26974 <primary>trusted user</primary>
26976 <indexterm role="concept">
26977 <primary>sender</primary>
26978 <secondary>setting by untrusted user</secondary>
26980 <indexterm role="concept">
26981 <primary>untrusted user</primary>
26982 <secondary>setting sender</secondary>
26984 <indexterm role="concept">
26985 <primary>user</primary>
26986 <secondary>untrusted setting sender</secondary>
26988 <indexterm role="concept">
26989 <primary>envelope sender</primary>
26991 When an untrusted user submits a message to Exim using the standard input, Exim
26992 normally creates an envelope sender address from the user’s login and the
26993 default qualification domain. Data from the <option>-f</option> option (for setting envelope
26994 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
26995 is used) is ignored.
26998 However, untrusted users are permitted to set an empty envelope sender address,
26999 to declare that a message should never generate any bounces. For example:
27001 <literallayout class="monospaced">
27002 exim -f '<>' user@domain.example
27005 <indexterm role="concept">
27006 <primary><varname>$sender_ident</varname></primary>
27008 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
27009 other envelope sender addresses in a controlled way. When it is set, untrusted
27010 users are allowed to set envelope sender addresses that match any of the
27011 patterns in the list. Like all address lists, the string is expanded. The
27012 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
27013 users to setting senders that start with their login ids
27014 followed by a hyphen
27015 by a setting like this:
27017 <literallayout class="monospaced">
27018 untrusted_set_sender = ^$sender_ident-
27021 If you want to allow untrusted users to set envelope sender addresses without
27022 restriction, you can use
27024 <literallayout class="monospaced">
27025 untrusted_set_sender = *
27028 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
27029 only to the setting of the envelope sender. It does not permit untrusted users
27030 to use the other options which trusted user can use to override message
27031 parameters. Furthermore, it does not stop Exim from removing an existing
27032 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
27033 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
27034 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
27035 described in section <xref linkend="SECTthesenhea"/>.
27038 The log line for a message’s arrival shows the envelope sender following
27039 <quote><=</quote>. For local messages, the user’s login always follows, after <quote>U=</quote>. In
27040 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
27041 envelope sender address, the user’s login is shown in parentheses after the
27045 <indexterm role="option">
27046 <primary>uucp_from_pattern</primary>
27049 <informaltable frame="all">
27050 <tgroup cols="4" colsep="0" rowsep="0">
27051 <colspec colwidth="8*" align="left"/>
27052 <colspec colwidth="5*" align="center"/>
27053 <colspec colwidth="5*" align="center"/>
27054 <colspec colwidth="6*" align="right"/>
27057 <entry><option>uucp_from_pattern</option></entry>
27058 <entry>Use: <emphasis>main</emphasis></entry>
27059 <entry>Type: <emphasis>string</emphasis></entry>
27060 <entry>Default: <emphasis>see below</emphasis></entry>
27066 <indexterm role="concept">
27067 <primary><quote>From</quote> line</primary>
27069 <indexterm role="concept">
27070 <primary>UUCP</primary>
27071 <secondary><quote>From</quote> line</secondary>
27073 Some applications that pass messages to an MTA via a command line interface use
27074 an initial line starting with <quote>From </quote> to pass the envelope sender. In
27075 particular, this is used by UUCP software. Exim recognizes such a line by means
27076 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
27077 matches, the sender address is constructed by expanding the contents of
27078 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
27079 default pattern recognizes lines in the following two forms:
27081 <literallayout class="monospaced">
27082 From ph10 Fri Jan 5 12:35 GMT 1996
27083 From ph10 Fri, 7 Jan 97 14:00:00 GMT
27086 The pattern can be seen by running
27088 <literallayout class="monospaced">
27089 exim -bP uucp_from_pattern
27092 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
27093 year in the second case. The first word after <quote>From </quote> is matched in the
27094 regular expression by a parenthesized subpattern. The default value for
27095 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
27096 (<quote>ph10</quote> in the example above) as the message’s sender. See also
27097 <option>ignore_fromline_hosts</option>.
27100 <indexterm role="option">
27101 <primary>uucp_from_sender</primary>
27104 <informaltable frame="all">
27105 <tgroup cols="4" colsep="0" rowsep="0">
27106 <colspec colwidth="8*" align="left"/>
27107 <colspec colwidth="5*" align="center"/>
27108 <colspec colwidth="5*" align="center"/>
27109 <colspec colwidth="6*" align="right"/>
27112 <entry><option>uucp_from_sender</option></entry>
27113 <entry>Use: <emphasis>main</emphasis></entry>
27114 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27115 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
27121 See <option>uucp_from_pattern</option> above.
27124 <indexterm role="option">
27125 <primary>warn_message_file</primary>
27128 <informaltable frame="all">
27129 <tgroup cols="4" colsep="0" rowsep="0">
27130 <colspec colwidth="8*" align="left"/>
27131 <colspec colwidth="5*" align="center"/>
27132 <colspec colwidth="5*" align="center"/>
27133 <colspec colwidth="6*" align="right"/>
27136 <entry><option>warn_message_file</option></entry>
27137 <entry>Use: <emphasis>main</emphasis></entry>
27138 <entry>Type: <emphasis>string</emphasis></entry>
27139 <entry>Default: <emphasis>unset</emphasis></entry>
27145 <indexterm role="concept">
27146 <primary>warning of delay</primary>
27147 <secondary>customizing the message</secondary>
27149 <indexterm role="concept">
27150 <primary>customizing</primary>
27151 <secondary>warning message</secondary>
27153 This option defines a template file containing paragraphs of text to be used
27154 for constructing the warning message which is sent by Exim when a message has
27155 been on the queue for a specified amount of time, as specified by
27156 <option>delay_warning</option>. Details of the file’s contents are given in chapter
27157 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
27160 <indexterm role="option">
27161 <primary>write_rejectlog</primary>
27164 <informaltable frame="all">
27165 <tgroup cols="4" colsep="0" rowsep="0">
27166 <colspec colwidth="8*" align="left"/>
27167 <colspec colwidth="5*" align="center"/>
27168 <colspec colwidth="5*" align="center"/>
27169 <colspec colwidth="6*" align="right"/>
27172 <entry><option>write_rejectlog</option></entry>
27173 <entry>Use: <emphasis>main</emphasis></entry>
27174 <entry>Type: <emphasis>boolean</emphasis></entry>
27175 <entry>Default: <emphasis>true</emphasis></entry>
27181 <indexterm role="concept">
27182 <primary>reject log</primary>
27183 <secondary>disabling</secondary>
27185 If this option is set false, Exim no longer writes anything to the reject log.
27186 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
27187 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
27188 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
27193 <chapter id="CHAProutergeneric">
27194 <title>Generic options for routers</title>
27196 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
27197 <primary>options</primary>
27198 <secondary>generic; for routers</secondary>
27200 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
27201 <primary>generic options</primary>
27202 <secondary>router</secondary>
27204 This chapter describes the generic options that apply to all routers.
27205 Those that are preconditions are marked with ‡ in the <quote>use</quote> field.
27208 For a general description of how a router operates, see sections
27209 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
27210 which the preconditions are tested. The order of expansion of the options that
27211 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
27212 <option>headers_remove</option>, <option>transport</option>.
27215 <indexterm role="option">
27216 <primary>address_data</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>address_data</option></entry>
27228 <entry>Use: <emphasis>routers</emphasis></entry>
27229 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27230 <entry>Default: <emphasis>unset</emphasis></entry>
27236 <indexterm role="concept">
27237 <primary>router</primary>
27238 <secondary>data attached to address</secondary>
27240 The string is expanded just before the router is run, that is, after all the
27241 precondition tests have succeeded. If the expansion is forced to fail, the
27242 router declines, the value of <option>address_data</option> remains unchanged, and the
27243 <option>more</option> option controls what happens next. Other expansion failures cause
27244 delivery of the address to be deferred.
27247 <indexterm role="concept">
27248 <primary><varname>$address_data</varname></primary>
27250 When the expansion succeeds, the value is retained with the address, and can be
27251 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
27252 routers, and the eventual transport.
27255 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
27256 that runs a user’s filter file, the contents of <varname>$address_data</varname> are accessible
27257 in the filter. This is not normally a problem, because such data is usually
27258 either not confidential or it <quote>belongs</quote> to the current user, but if you do
27259 put confidential data into <varname>$address_data</varname> you need to remember this point.
27262 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
27263 with the address, though it can be changed by another <option>address_data</option> setting
27264 on a subsequent router. If a router generates child addresses, the value of
27265 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
27266 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
27269 The idea of <option>address_data</option> is that you can use it to look up a lot of data
27270 for the address once, and then pick out parts of the data later. For example,
27271 you could use a single LDAP lookup to return a string of the form
27273 <literallayout class="monospaced">
27274 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
27277 In the transport you could pick out the mailbox by a setting such as
27279 <literallayout class="monospaced">
27280 file = ${extract{mailbox}{$address_data}}
27283 This makes the configuration file less messy, and also reduces the number of
27284 lookups (though Exim does cache lookups).
27287 The <option>address_data</option> facility is also useful as a means of passing information
27288 from one router to another, and from a router to a transport. In addition, if
27291 <indexterm role="concept">
27292 <primary><varname>$sender_address_data</varname></primary>
27294 <indexterm role="concept">
27295 <primary><varname>$address_data</varname></primary>
27297 When <varname>$address_data</varname> is set by a router when verifying a recipient address
27298 from an ACL, it remains available for use in the rest of the ACL statement.
27299 After verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
27302 <indexterm role="option">
27303 <primary>address_test</primary>
27306 <informaltable frame="all">
27307 <tgroup cols="4" colsep="0" rowsep="0">
27308 <colspec colwidth="8*" align="left"/>
27309 <colspec colwidth="5*" align="center"/>
27310 <colspec colwidth="5*" align="center"/>
27311 <colspec colwidth="6*" align="right"/>
27314 <entry><option>address_test</option></entry>
27315 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
27316 <entry>Type: <emphasis>boolean</emphasis></entry>
27317 <entry>Default: <emphasis>true</emphasis></entry>
27323 <indexterm role="concept">
27324 <primary><option>-bt</option> option</primary>
27326 <indexterm role="concept">
27327 <primary>router</primary>
27328 <secondary>skipping when address testing</secondary>
27330 If this option is set false, the router is skipped when routing is being tested
27331 by means of the <option>-bt</option> command line option. This can be a convenience when
27332 your first router sends messages to an external scanner, because it saves you
27333 having to set the <quote>already scanned</quote> indicator when testing real address
27337 <indexterm role="option">
27338 <primary>cannot_route_message</primary>
27341 <informaltable frame="all">
27342 <tgroup cols="4" colsep="0" rowsep="0">
27343 <colspec colwidth="8*" align="left"/>
27344 <colspec colwidth="5*" align="center"/>
27345 <colspec colwidth="5*" align="center"/>
27346 <colspec colwidth="6*" align="right"/>
27349 <entry><option>cannot_route_message</option></entry>
27350 <entry>Use: <emphasis>routers</emphasis></entry>
27351 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27352 <entry>Default: <emphasis>unset</emphasis></entry>
27358 <indexterm role="concept">
27359 <primary>router</primary>
27360 <secondary>customizing <quote>cannot route</quote> message</secondary>
27362 <indexterm role="concept">
27363 <primary>customizing</primary>
27364 <secondary><quote>cannot route</quote> message</secondary>
27366 This option specifies a text message that is used when an address cannot be
27367 routed because Exim has run out of routers. The default message is
27368 <quote>Unrouteable address</quote>. This option is useful only on routers that have
27369 <option>more</option> set false, or on the very last router in a configuration, because the
27370 value that is used is taken from the last router that is considered. This
27371 includes a router that is skipped because its preconditions are not met, as
27372 well as a router that declines. For example, using the default configuration,
27375 <literallayout class="monospaced">
27376 cannot_route_message = Remote domain not found in DNS
27379 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
27382 <literallayout class="monospaced">
27383 cannot_route_message = Unknown local user
27386 on the final router that checks for local users. If string expansion fails for
27387 this option, the default message is used. Unless the expansion failure was
27388 explicitly forced, a message about the failure is written to the main and panic
27389 logs, in addition to the normal message about the routing failure.
27392 <indexterm role="option">
27393 <primary>caseful_local_part</primary>
27396 <informaltable frame="all">
27397 <tgroup cols="4" colsep="0" rowsep="0">
27398 <colspec colwidth="8*" align="left"/>
27399 <colspec colwidth="5*" align="center"/>
27400 <colspec colwidth="5*" align="center"/>
27401 <colspec colwidth="6*" align="right"/>
27404 <entry><option>caseful_local_part</option></entry>
27405 <entry>Use: <emphasis>routers</emphasis></entry>
27406 <entry>Type: <emphasis>boolean</emphasis></entry>
27407 <entry>Default: <emphasis>false</emphasis></entry>
27413 <indexterm role="concept">
27414 <primary>case of local parts</primary>
27416 <indexterm role="concept">
27417 <primary>router</primary>
27418 <secondary>case of local parts</secondary>
27420 By default, routers handle the local parts of addresses in a case-insensitive
27421 manner, though the actual case is preserved for transmission with the message.
27422 If you want the case of letters to be significant in a router, you must set
27423 this option true. For individual router options that contain address or local
27424 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
27425 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
27429 <indexterm role="concept">
27430 <primary><varname>$local_part</varname></primary>
27432 <indexterm role="concept">
27433 <primary><varname>$original_local_part</varname></primary>
27435 <indexterm role="concept">
27436 <primary><varname>$parent_local_part</varname></primary>
27438 The value of the <varname>$local_part</varname> variable is forced to lower case while a
27439 router is running unless <option>caseful_local_part</option> is set. When a router assigns
27440 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
27441 is the same as it was in the router. Similarly, when a router generates child
27442 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
27443 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
27446 This option applies to the processing of an address by a router. When a
27447 recipient address is being processed in an ACL, there is a separate <option>control</option>
27448 modifier that can be used to specify case-sensitive processing within the ACL
27449 (see section <xref linkend="SECTcontrols"/>).
27452 <indexterm role="option">
27453 <primary>check_local_user</primary>
27456 <informaltable frame="all">
27457 <tgroup cols="4" colsep="0" rowsep="0">
27458 <colspec colwidth="8*" align="left"/>
27459 <colspec colwidth="5*" align="center"/>
27460 <colspec colwidth="5*" align="center"/>
27461 <colspec colwidth="6*" align="right"/>
27464 <entry><option>check_local_user</option></entry>
27465 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
27466 <entry>Type: <emphasis>boolean</emphasis></entry>
27467 <entry>Default: <emphasis>false</emphasis></entry>
27473 <indexterm role="concept">
27474 <primary>local user</primary>
27475 <secondary>checking in router</secondary>
27477 <indexterm role="concept">
27478 <primary>router</primary>
27479 <secondary>checking for local user</secondary>
27481 <indexterm role="concept">
27482 <primary><filename>/etc/passwd</filename></primary>
27484 <indexterm role="concept">
27485 <primary><varname>$home</varname></primary>
27487 When this option is true, Exim checks that the local part of the recipient
27488 address (with affixes removed if relevant) is the name of an account on the
27489 local system. The check is done by calling the <function>getpwnam()</function> function rather
27490 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
27491 holding password data (such as NIS) are supported. If the local part is a local
27492 user, <varname>$home</varname> is set from the password data, and can be tested in other
27493 preconditions that are evaluated after this one (the order of evaluation is
27494 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
27495 overridden by <option>router_home_directory</option>. If the local part is not a local user,
27496 the router is skipped.
27499 If you want to check that the local part is either the name of a local user
27500 or matches something else, you cannot combine <option>check_local_user</option> with a
27501 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
27502 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
27503 setting to achieve this. For example:
27505 <literallayout class="monospaced">
27506 local_parts = passwd;$local_part : lsearch;/etc/other/users
27509 Note, however, that the side effects of <option>check_local_user</option> (such as setting
27510 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
27511 <option>local_parts</option> (or any other) precondition.
27514 <indexterm role="option">
27515 <primary>condition</primary>
27518 <informaltable frame="all">
27519 <tgroup cols="4" colsep="0" rowsep="0">
27520 <colspec colwidth="8*" align="left"/>
27521 <colspec colwidth="5*" align="center"/>
27522 <colspec colwidth="5*" align="center"/>
27523 <colspec colwidth="6*" align="right"/>
27526 <entry><option>condition</option></entry>
27527 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
27528 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27529 <entry>Default: <emphasis>unset</emphasis></entry>
27535 <indexterm role="concept">
27536 <primary>router</primary>
27537 <secondary>customized precondition</secondary>
27539 This option specifies a general precondition test that has to succeed for the
27540 router to be called. The <option>condition</option> option is the last precondition to be
27541 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
27542 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
27543 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
27544 router is skipped, and the address is offered to the next one.
27547 If the result is any other value, the router is run (as this is the last
27548 precondition to be evaluated, all the other preconditions must be true).
27551 The <option>condition</option> option provides a means of applying custom conditions to the
27552 running of routers. Note that in the case of a simple conditional expansion,
27553 the default expansion values are exactly what is wanted. For example:
27555 <literallayout class="monospaced">
27556 condition = ${if >{$message_age}{600}}
27559 Because of the default behaviour of the string expansion, this is equivalent to
27561 <literallayout class="monospaced">
27562 condition = ${if >{$message_age}{600}{true}{}}
27565 If the expansion fails (other than forced failure) delivery is deferred. Some
27566 of the other precondition options are common special cases that could in fact
27567 be specified using <option>condition</option>.
27570 <indexterm role="option">
27571 <primary>debug_print</primary>
27574 <informaltable frame="all">
27575 <tgroup cols="4" colsep="0" rowsep="0">
27576 <colspec colwidth="8*" align="left"/>
27577 <colspec colwidth="5*" align="center"/>
27578 <colspec colwidth="5*" align="center"/>
27579 <colspec colwidth="6*" align="right"/>
27582 <entry><option>debug_print</option></entry>
27583 <entry>Use: <emphasis>routers</emphasis></entry>
27584 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27585 <entry>Default: <emphasis>unset</emphasis></entry>
27591 <indexterm role="concept">
27592 <primary>testing</primary>
27593 <secondary>variables in drivers</secondary>
27595 If this option is set and debugging is enabled (see the <option>-d</option> command line
27596 option), the string is expanded and included in the debugging output.
27597 If expansion of the string fails, the error message is written to the debugging
27598 output, and Exim carries on processing.
27599 This option is provided to help with checking out the values of variables and
27600 so on when debugging router configurations. For example, if a <option>condition</option>
27601 option appears not to be working, <option>debug_print</option> can be used to output the
27602 variables it references. The output happens after checks for <option>domains</option>,
27603 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
27604 are tested. A newline is added to the text if it does not end with one.
27607 <indexterm role="option">
27608 <primary>disable_logging</primary>
27611 <informaltable frame="all">
27612 <tgroup cols="4" colsep="0" rowsep="0">
27613 <colspec colwidth="8*" align="left"/>
27614 <colspec colwidth="5*" align="center"/>
27615 <colspec colwidth="5*" align="center"/>
27616 <colspec colwidth="6*" align="right"/>
27619 <entry><option>disable_logging</option></entry>
27620 <entry>Use: <emphasis>routers</emphasis></entry>
27621 <entry>Type: <emphasis>boolean</emphasis></entry>
27622 <entry>Default: <emphasis>false</emphasis></entry>
27628 If this option is set true, nothing is logged for any routing errors
27629 or for any deliveries caused by this router. You should not set this option
27630 unless you really, really know what you are doing. See also the generic
27631 transport option of the same name.
27634 <indexterm role="option">
27635 <primary>domains</primary>
27638 <informaltable frame="all">
27639 <tgroup cols="4" colsep="0" rowsep="0">
27640 <colspec colwidth="8*" align="left"/>
27641 <colspec colwidth="5*" align="center"/>
27642 <colspec colwidth="5*" align="center"/>
27643 <colspec colwidth="6*" align="right"/>
27646 <entry><option>domains</option></entry>
27647 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
27648 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
27649 <entry>Default: <emphasis>unset</emphasis></entry>
27655 <indexterm role="concept">
27656 <primary>router</primary>
27657 <secondary>restricting to specific domains</secondary>
27659 <indexterm role="concept">
27660 <primary><varname>$domain_data</varname></primary>
27662 If this option is set, the router is skipped unless the current domain matches
27663 the list. If the match is achieved by means of a file lookup, the data that the
27664 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
27665 expansions of the driver’s private options. See section <xref linkend="SECTrouprecon"/> for
27666 a list of the order in which preconditions are evaluated.
27669 <indexterm role="option">
27670 <primary>driver</primary>
27673 <informaltable frame="all">
27674 <tgroup cols="4" colsep="0" rowsep="0">
27675 <colspec colwidth="8*" align="left"/>
27676 <colspec colwidth="5*" align="center"/>
27677 <colspec colwidth="5*" align="center"/>
27678 <colspec colwidth="6*" align="right"/>
27681 <entry><option>driver</option></entry>
27682 <entry>Use: <emphasis>routers</emphasis></entry>
27683 <entry>Type: <emphasis>string</emphasis></entry>
27684 <entry>Default: <emphasis>unset</emphasis></entry>
27690 This option must always be set. It specifies which of the available routers is
27694 <indexterm role="option">
27695 <primary>errors_to</primary>
27698 <informaltable frame="all">
27699 <tgroup cols="4" colsep="0" rowsep="0">
27700 <colspec colwidth="8*" align="left"/>
27701 <colspec colwidth="5*" align="center"/>
27702 <colspec colwidth="5*" align="center"/>
27703 <colspec colwidth="6*" align="right"/>
27706 <entry><option>errors_to</option></entry>
27707 <entry>Use: <emphasis>routers</emphasis></entry>
27708 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27709 <entry>Default: <emphasis>unset</emphasis></entry>
27715 <indexterm role="concept">
27716 <primary>envelope sender</primary>
27718 <indexterm role="concept">
27719 <primary>router</primary>
27720 <secondary>changing address for errors</secondary>
27722 If a router successfully handles an address, it may assign the address to a
27723 transport for delivery or it may generate child addresses. In both cases, if
27724 there is a delivery problem during later processing, the resulting bounce
27725 message is sent to the address that results from expanding this string,
27726 provided that the address verifies successfully. The <option>errors_to</option> option is
27727 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
27730 The <option>errors_to</option> setting associated with an address can be overridden if it
27731 subsequently passes through other routers that have their own <option>errors_to</option>
27732 settings, or if the message is delivered by a transport with a <option>return_path</option>
27736 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
27737 the expansion fails to verify, the errors address associated with the incoming
27738 address is used. At top level, this is the envelope sender. A non-forced
27739 expansion failure causes delivery to be deferred.
27742 If an address for which <option>errors_to</option> has been set ends up being delivered over
27743 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
27744 any bounces that are generated by other MTAs on the delivery route are also
27745 sent there. You can set <option>errors_to</option> to the empty string by either of these
27748 <literallayout class="monospaced">
27753 An expansion item that yields an empty string has the same effect. If you do
27754 this, a locally detected delivery error for addresses processed by this router
27755 no longer gives rise to a bounce message; the error is discarded. If the
27756 address is delivered to a remote host, the return path is set to <literal><></literal>, unless
27757 overridden by the <option>return_path</option> option on the transport.
27760 <indexterm role="concept">
27761 <primary><varname>$address_data</varname></primary>
27763 If for some reason you want to discard local errors, but use a non-empty
27764 MAIL command for remote delivery, you can preserve the original return
27765 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
27766 setting <option>return_path</option>.
27769 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
27770 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
27771 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
27774 <indexterm role="option">
27775 <primary>expn</primary>
27778 <informaltable frame="all">
27779 <tgroup cols="4" colsep="0" rowsep="0">
27780 <colspec colwidth="8*" align="left"/>
27781 <colspec colwidth="5*" align="center"/>
27782 <colspec colwidth="5*" align="center"/>
27783 <colspec colwidth="6*" align="right"/>
27786 <entry><option>expn</option></entry>
27787 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
27788 <entry>Type: <emphasis>boolean</emphasis></entry>
27789 <entry>Default: <emphasis>true</emphasis></entry>
27795 <indexterm role="concept">
27796 <primary>address</primary>
27797 <secondary>testing</secondary>
27799 <indexterm role="concept">
27800 <primary>testing</primary>
27801 <secondary>addresses</secondary>
27803 <indexterm role="concept">
27804 <primary>EXPN</primary>
27805 <secondary>router skipping</secondary>
27807 <indexterm role="concept">
27808 <primary>router</primary>
27809 <secondary>skipping for EXPN</secondary>
27811 If this option is turned off, the router is skipped when testing an address
27812 as a result of processing an SMTP EXPN command. You might, for example,
27813 want to turn it off on a router for users’ <filename>.forward</filename> files, while leaving it
27814 on for the system alias file.
27815 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
27819 The use of the SMTP EXPN command is controlled by an ACL (see chapter
27820 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
27821 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
27824 <indexterm role="option">
27825 <primary>fail_verify</primary>
27828 <informaltable frame="all">
27829 <tgroup cols="4" colsep="0" rowsep="0">
27830 <colspec colwidth="8*" align="left"/>
27831 <colspec colwidth="5*" align="center"/>
27832 <colspec colwidth="5*" align="center"/>
27833 <colspec colwidth="6*" align="right"/>
27836 <entry><option>fail_verify</option></entry>
27837 <entry>Use: <emphasis>routers</emphasis></entry>
27838 <entry>Type: <emphasis>boolean</emphasis></entry>
27839 <entry>Default: <emphasis>false</emphasis></entry>
27845 <indexterm role="concept">
27846 <primary>router</primary>
27847 <secondary>forcing verification failure</secondary>
27849 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
27850 <option>fail_verify_recipient</option> to the same value.
27853 <indexterm role="option">
27854 <primary>fail_verify_recipient</primary>
27857 <informaltable frame="all">
27858 <tgroup cols="4" colsep="0" rowsep="0">
27859 <colspec colwidth="8*" align="left"/>
27860 <colspec colwidth="5*" align="center"/>
27861 <colspec colwidth="5*" align="center"/>
27862 <colspec colwidth="6*" align="right"/>
27865 <entry><option>fail_verify_recipient</option></entry>
27866 <entry>Use: <emphasis>routers</emphasis></entry>
27867 <entry>Type: <emphasis>boolean</emphasis></entry>
27868 <entry>Default: <emphasis>false</emphasis></entry>
27874 If this option is true and an address is accepted by this router when
27875 verifying a recipient, verification fails.
27878 <indexterm role="option">
27879 <primary>fail_verify_sender</primary>
27882 <informaltable frame="all">
27883 <tgroup cols="4" colsep="0" rowsep="0">
27884 <colspec colwidth="8*" align="left"/>
27885 <colspec colwidth="5*" align="center"/>
27886 <colspec colwidth="5*" align="center"/>
27887 <colspec colwidth="6*" align="right"/>
27890 <entry><option>fail_verify_sender</option></entry>
27891 <entry>Use: <emphasis>routers</emphasis></entry>
27892 <entry>Type: <emphasis>boolean</emphasis></entry>
27893 <entry>Default: <emphasis>false</emphasis></entry>
27899 If this option is true and an address is accepted by this router when
27900 verifying a sender, verification fails.
27903 <indexterm role="option">
27904 <primary>fallback_hosts</primary>
27907 <informaltable frame="all">
27908 <tgroup cols="4" colsep="0" rowsep="0">
27909 <colspec colwidth="8*" align="left"/>
27910 <colspec colwidth="5*" align="center"/>
27911 <colspec colwidth="5*" align="center"/>
27912 <colspec colwidth="6*" align="right"/>
27915 <entry><option>fallback_hosts</option></entry>
27916 <entry>Use: <emphasis>routers</emphasis></entry>
27917 <entry>Type: <emphasis>string list</emphasis></entry>
27918 <entry>Default: <emphasis>unset</emphasis></entry>
27924 <indexterm role="concept">
27925 <primary>router</primary>
27926 <secondary>fallback hosts</secondary>
27928 <indexterm role="concept">
27929 <primary>fallback</primary>
27930 <secondary>hosts specified on router</secondary>
27932 String expansion is not applied to this option. The argument must be a
27933 colon-separated list of host names or IP addresses. The list separator can be
27934 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
27935 each name or address. In fact, the format of each item is exactly the same as
27936 defined for the list of hosts in a <command>manualroute</command> router (see section
27937 <xref linkend="SECTformatonehostitem"/>).
27940 If a router queues an address for a remote transport, this host list is
27941 associated with the address, and used instead of the transport’s fallback host
27942 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
27943 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
27944 transport for further details.
27947 <indexterm role="option">
27948 <primary>group</primary>
27951 <informaltable frame="all">
27952 <tgroup cols="4" colsep="0" rowsep="0">
27953 <colspec colwidth="8*" align="left"/>
27954 <colspec colwidth="5*" align="center"/>
27955 <colspec colwidth="5*" align="center"/>
27956 <colspec colwidth="6*" align="right"/>
27959 <entry><option>group</option></entry>
27960 <entry>Use: <emphasis>routers</emphasis></entry>
27961 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27962 <entry>Default: <emphasis>see below</emphasis></entry>
27968 <indexterm role="concept">
27969 <primary>gid (group id)</primary>
27970 <secondary>local delivery</secondary>
27972 <indexterm role="concept">
27973 <primary>local transports</primary>
27974 <secondary>uid and gid</secondary>
27976 <indexterm role="concept">
27977 <primary>transport</primary>
27978 <secondary>local</secondary>
27980 <indexterm role="concept">
27981 <primary>router</primary>
27982 <secondary>setting group</secondary>
27984 When a router queues an address for a transport, and the transport does not
27985 specify a group, the group given here is used when running the delivery
27987 The group may be specified numerically or by name. If expansion fails, the
27988 error is logged and delivery is deferred.
27989 The default is unset, unless <option>check_local_user</option> is set, when the default
27990 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
27991 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
27994 <indexterm role="option">
27995 <primary>headers_add</primary>
27998 <informaltable frame="all">
27999 <tgroup cols="4" colsep="0" rowsep="0">
28000 <colspec colwidth="8*" align="left"/>
28001 <colspec colwidth="5*" align="center"/>
28002 <colspec colwidth="5*" align="center"/>
28003 <colspec colwidth="6*" align="right"/>
28006 <entry><option>headers_add</option></entry>
28007 <entry>Use: <emphasis>routers</emphasis></entry>
28008 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28009 <entry>Default: <emphasis>unset</emphasis></entry>
28015 <indexterm role="concept">
28016 <primary>header lines</primary>
28017 <secondary>adding</secondary>
28019 <indexterm role="concept">
28020 <primary>router</primary>
28021 <secondary>adding header lines</secondary>
28023 This option specifies a string of text that is expanded at routing time, and
28024 associated with any addresses that are accepted by the router. However, this
28025 option has no effect when an address is just being verified. The way in which
28026 the text is used to add header lines at transport time is described in section
28027 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
28028 message is in the process of being transported. This means that references to
28029 header lines in string expansions in the transport’s configuration do not
28030 <quote>see</quote> the added header lines.
28033 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
28034 <option>headers_remove</option> and <option>transport</option>. If the expanded string is empty, or if
28035 the expansion is forced to fail, the option has no effect. Other expansion
28036 failures are treated as configuration errors.
28039 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
28040 router that has the <option>one_time</option> option set.
28043 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
28044 additions are deleted when the address is passed on to subsequent routers.
28047 <indexterm role="option">
28048 <primary>headers_remove</primary>
28051 <informaltable frame="all">
28052 <tgroup cols="4" colsep="0" rowsep="0">
28053 <colspec colwidth="8*" align="left"/>
28054 <colspec colwidth="5*" align="center"/>
28055 <colspec colwidth="5*" align="center"/>
28056 <colspec colwidth="6*" align="right"/>
28059 <entry><option>headers_remove</option></entry>
28060 <entry>Use: <emphasis>routers</emphasis></entry>
28061 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28062 <entry>Default: <emphasis>unset</emphasis></entry>
28068 <indexterm role="concept">
28069 <primary>header lines</primary>
28070 <secondary>removing</secondary>
28072 <indexterm role="concept">
28073 <primary>router</primary>
28074 <secondary>removing header lines</secondary>
28076 This option specifies a string of text that is expanded at routing time, and
28077 associated with any addresses that are accepted by the router. However, this
28078 option has no effect when an address is just being verified. The way in which
28079 the text is used to remove header lines at transport time is described in
28080 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
28081 the message is in the process of being transported. This means that references
28082 to header lines in string expansions in the transport’s configuration still
28083 <quote>see</quote> the original header lines.
28086 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
28087 <option>headers_add</option>, but before <option>transport</option>. If the expansion is forced to fail,
28088 the option has no effect. Other expansion failures are treated as configuration
28092 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
28093 router that has the <option>one_time</option> option set.
28096 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
28097 removal requests are deleted when the address is passed on to subsequent
28101 <indexterm role="option">
28102 <primary>ignore_target_hosts</primary>
28105 <informaltable frame="all">
28106 <tgroup cols="4" colsep="0" rowsep="0">
28107 <colspec colwidth="8*" align="left"/>
28108 <colspec colwidth="5*" align="center"/>
28109 <colspec colwidth="5*" align="center"/>
28110 <colspec colwidth="6*" align="right"/>
28113 <entry><option>ignore_target_hosts</option></entry>
28114 <entry>Use: <emphasis>routers</emphasis></entry>
28115 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
28116 <entry>Default: <emphasis>unset</emphasis></entry>
28122 <indexterm role="concept">
28123 <primary>IP address</primary>
28124 <secondary>discarding</secondary>
28126 <indexterm role="concept">
28127 <primary>router</primary>
28128 <secondary>discarding IP addresses</secondary>
28130 Although this option is a host list, it should normally contain IP address
28131 entries rather than names. If any host that is looked up by the router has an
28132 IP address that matches an item in this list, Exim behaves as if that IP
28133 address did not exist. This option allows you to cope with rogue DNS entries
28136 <literallayout class="monospaced">
28137 remote.domain.example. A 127.0.0.1
28142 <literallayout class="monospaced">
28143 ignore_target_hosts = 127.0.0.1
28146 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
28147 discarded in this way, the router declines. In a conventional configuration, an
28148 attempt to mail to such a domain would normally provoke the <quote>unrouteable
28149 domain</quote> error, and an attempt to verify an address in the domain would fail.
28150 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
28151 router declines if presented with one of the listed addresses.
28154 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
28155 means of the first or the second of the following settings, respectively:
28157 <literallayout class="monospaced">
28158 ignore_target_hosts = 0.0.0.0/0
28159 ignore_target_hosts = <; 0::0/0
28162 The pattern in the first line matches all IPv4 addresses, whereas the pattern
28163 in the second line matches all IPv6 addresses.
28166 This option may also be useful for ignoring link-local and site-local IPv6
28167 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
28168 is expanded before use as a list, it is possible to make it dependent on the
28169 domain that is being routed.
28172 <indexterm role="concept">
28173 <primary><varname>$host_address</varname></primary>
28175 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
28179 <indexterm role="option">
28180 <primary>initgroups</primary>
28183 <informaltable frame="all">
28184 <tgroup cols="4" colsep="0" rowsep="0">
28185 <colspec colwidth="8*" align="left"/>
28186 <colspec colwidth="5*" align="center"/>
28187 <colspec colwidth="5*" align="center"/>
28188 <colspec colwidth="6*" align="right"/>
28191 <entry><option>initgroups</option></entry>
28192 <entry>Use: <emphasis>routers</emphasis></entry>
28193 <entry>Type: <emphasis>boolean</emphasis></entry>
28194 <entry>Default: <emphasis>false</emphasis></entry>
28200 <indexterm role="concept">
28201 <primary>additional groups</primary>
28203 <indexterm role="concept">
28204 <primary>groups</primary>
28205 <secondary>additional</secondary>
28207 <indexterm role="concept">
28208 <primary>local transports</primary>
28209 <secondary>uid and gid</secondary>
28211 <indexterm role="concept">
28212 <primary>transport</primary>
28213 <secondary>local</secondary>
28215 If the router queues an address for a transport, and this option is true, and
28216 the uid supplied by the router is not overridden by the transport, the
28217 <function>initgroups()</function> function is called when running the transport to ensure that
28218 any additional groups associated with the uid are set up. See also <option>group</option>
28219 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
28222 <indexterm role="option">
28223 <primary>local_part_prefix</primary>
28226 <informaltable frame="all">
28227 <tgroup cols="4" colsep="0" rowsep="0">
28228 <colspec colwidth="8*" align="left"/>
28229 <colspec colwidth="5*" align="center"/>
28230 <colspec colwidth="5*" align="center"/>
28231 <colspec colwidth="6*" align="right"/>
28234 <entry><option>local_part_prefix</option></entry>
28235 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
28236 <entry>Type: <emphasis>string list</emphasis></entry>
28237 <entry>Default: <emphasis>unset</emphasis></entry>
28243 <indexterm role="concept">
28244 <primary>router</primary>
28245 <secondary>prefix for local part</secondary>
28247 <indexterm role="concept">
28248 <primary>prefix</primary>
28249 <secondary>for local part; used in router</secondary>
28251 If this option is set, the router is skipped unless the local part starts with
28252 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
28253 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
28257 The list is scanned from left to right, and the first prefix that matches is
28258 used. A limited form of wildcard is available; if the prefix begins with an
28259 asterisk, it matches the longest possible sequence of arbitrary characters at
28260 the start of the local part. An asterisk should therefore always be followed by
28261 some character that does not occur in normal local parts.
28262 <indexterm role="concept">
28263 <primary>multiple mailboxes</primary>
28265 <indexterm role="concept">
28266 <primary>mailbox</primary>
28267 <secondary>multiple</secondary>
28269 Wildcarding can be used to set up multiple user mailboxes, as described in
28270 section <xref linkend="SECTmulbox"/>.
28273 <indexterm role="concept">
28274 <primary><varname>$local_part</varname></primary>
28276 <indexterm role="concept">
28277 <primary><varname>$local_part_prefix</varname></primary>
28279 During the testing of the <option>local_parts</option> option, and while the router is
28280 running, the prefix is removed from the local part, and is available in the
28281 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
28282 the router accepts the address, this remains true during subsequent delivery by
28283 a transport. In particular, the local part that is transmitted in the RCPT
28284 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
28285 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
28286 the relevant transport.
28289 When an address is being verified, <option>local_part_prefix</option> affects only the
28290 behaviour of the router. If the callout feature of verification is in use, this
28291 means that the full address, including the prefix, will be used during the
28295 The prefix facility is commonly used to handle local parts of the form
28296 <option>owner-something</option>. Another common use is to support local parts of the form
28297 <option>real-username</option> to bypass a user’s <filename>.forward</filename> file – helpful when trying
28298 to tell a user their forwarding is broken – by placing a router like this one
28299 immediately before the router that handles <filename>.forward</filename> files:
28301 <literallayout class="monospaced">
28304 local_part_prefix = real-
28306 transport = local_delivery
28309 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
28310 both conditions must be met if not optional. Care must be taken if wildcards
28311 are used in both a prefix and a suffix on the same router. Different
28312 separator characters must be used to avoid ambiguity.
28315 <indexterm role="option">
28316 <primary>local_part_prefix_optional</primary>
28319 <informaltable frame="all">
28320 <tgroup cols="4" colsep="0" rowsep="0">
28321 <colspec colwidth="8*" align="left"/>
28322 <colspec colwidth="5*" align="center"/>
28323 <colspec colwidth="5*" align="center"/>
28324 <colspec colwidth="6*" align="right"/>
28327 <entry><option>local_part_prefix_optional</option></entry>
28328 <entry>Use: <emphasis>routers</emphasis></entry>
28329 <entry>Type: <emphasis>boolean</emphasis></entry>
28330 <entry>Default: <emphasis>false</emphasis></entry>
28336 See <option>local_part_prefix</option> above.
28339 <indexterm role="option">
28340 <primary>local_part_suffix</primary>
28343 <informaltable frame="all">
28344 <tgroup cols="4" colsep="0" rowsep="0">
28345 <colspec colwidth="8*" align="left"/>
28346 <colspec colwidth="5*" align="center"/>
28347 <colspec colwidth="5*" align="center"/>
28348 <colspec colwidth="6*" align="right"/>
28351 <entry><option>local_part_suffix</option></entry>
28352 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
28353 <entry>Type: <emphasis>string list</emphasis></entry>
28354 <entry>Default: <emphasis>unset</emphasis></entry>
28360 <indexterm role="concept">
28361 <primary>router</primary>
28362 <secondary>suffix for local part</secondary>
28364 <indexterm role="concept">
28365 <primary>suffix for local part</primary>
28366 <secondary>used in router</secondary>
28368 This option operates in the same way as <option>local_part_prefix</option>, except that the
28369 local part must end (rather than start) with the given string, the
28370 <option>local_part_suffix_optional</option> option determines whether the suffix is
28371 mandatory, and the wildcard * character, if present, must be the last
28372 character of the suffix. This option facility is commonly used to handle local
28373 parts of the form <option>something-request</option> and multiple user mailboxes of the form
28374 <option>username-foo</option>.
28377 <indexterm role="option">
28378 <primary>local_part_suffix_optional</primary>
28381 <informaltable frame="all">
28382 <tgroup cols="4" colsep="0" rowsep="0">
28383 <colspec colwidth="8*" align="left"/>
28384 <colspec colwidth="5*" align="center"/>
28385 <colspec colwidth="5*" align="center"/>
28386 <colspec colwidth="6*" align="right"/>
28389 <entry><option>local_part_suffix_optional</option></entry>
28390 <entry>Use: <emphasis>routers</emphasis></entry>
28391 <entry>Type: <emphasis>boolean</emphasis></entry>
28392 <entry>Default: <emphasis>false</emphasis></entry>
28398 See <option>local_part_suffix</option> above.
28401 <indexterm role="option">
28402 <primary>local_parts</primary>
28405 <informaltable frame="all">
28406 <tgroup cols="4" colsep="0" rowsep="0">
28407 <colspec colwidth="8*" align="left"/>
28408 <colspec colwidth="5*" align="center"/>
28409 <colspec colwidth="5*" align="center"/>
28410 <colspec colwidth="6*" align="right"/>
28413 <entry><option>local_parts</option></entry>
28414 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
28415 <entry>Type: <emphasis>local part list</emphasis>†<emphasis></emphasis></entry>
28416 <entry>Default: <emphasis>unset</emphasis></entry>
28422 <indexterm role="concept">
28423 <primary>router</primary>
28424 <secondary>restricting to specific local parts</secondary>
28426 <indexterm role="concept">
28427 <primary>local part</primary>
28428 <secondary>checking in router</secondary>
28430 The router is run only if the local part of the address matches the list.
28431 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
28433 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
28434 string is expanded, it is possible to make it depend on the domain, for
28437 <literallayout class="monospaced">
28438 local_parts = dbm;/usr/local/specials/$domain
28441 <indexterm role="concept">
28442 <primary><varname>$local_part_data</varname></primary>
28444 If the match is achieved by a lookup, the data that the lookup returned
28445 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
28446 expansions of the router’s private options. You might use this option, for
28447 example, if you have a large number of local virtual domains, and you want to
28448 send all postmaster mail to the same place without having to set up an alias in
28449 each virtual domain:
28451 <literallayout class="monospaced">
28454 local_parts = postmaster
28455 data = postmaster@real.domain.example
28458 <indexterm role="option">
28459 <primary>log_as_local</primary>
28462 <informaltable frame="all">
28463 <tgroup cols="4" colsep="0" rowsep="0">
28464 <colspec colwidth="8*" align="left"/>
28465 <colspec colwidth="5*" align="center"/>
28466 <colspec colwidth="5*" align="center"/>
28467 <colspec colwidth="6*" align="right"/>
28470 <entry><option>log_as_local</option></entry>
28471 <entry>Use: <emphasis>routers</emphasis></entry>
28472 <entry>Type: <emphasis>boolean</emphasis></entry>
28473 <entry>Default: <emphasis>see below</emphasis></entry>
28479 <indexterm role="concept">
28480 <primary>log</primary>
28481 <secondary>delivery line</secondary>
28483 <indexterm role="concept">
28484 <primary>delivery</primary>
28485 <secondary>log line format</secondary>
28487 Exim has two logging styles for delivery, the idea being to make local
28488 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
28489 recipient address is given just as the local part, without a domain. The use of
28490 this style is controlled by this option. It defaults to true for the <command>accept</command>
28491 router, and false for all the others. This option applies only when a
28492 router assigns an address to a transport. It has no effect on routers that
28493 redirect addresses.
28496 <indexterm role="option">
28497 <primary>more</primary>
28500 <informaltable frame="all">
28501 <tgroup cols="4" colsep="0" rowsep="0">
28502 <colspec colwidth="8*" align="left"/>
28503 <colspec colwidth="5*" align="center"/>
28504 <colspec colwidth="5*" align="center"/>
28505 <colspec colwidth="6*" align="right"/>
28508 <entry><option>more</option></entry>
28509 <entry>Use: <emphasis>routers</emphasis></entry>
28510 <entry>Type: <emphasis>boolean</emphasis>†<emphasis></emphasis></entry>
28511 <entry>Default: <emphasis>true</emphasis></entry>
28517 The result of string expansion for this option must be a valid boolean value,
28518 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
28519 result causes an error, and delivery is deferred. If the expansion is forced to
28520 fail, the default value for the option (true) is used. Other failures cause
28521 delivery to be deferred.
28524 If this option is set false, and the router declines to handle the address, no
28525 further routers are tried, routing fails, and the address is bounced.
28526 <indexterm role="concept">
28527 <primary><option>self</option> option</primary>
28529 However, if the router explicitly passes an address to the following router by
28530 means of the setting
28532 <literallayout class="monospaced">
28536 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
28537 does not affect the behaviour if one of the precondition tests fails. In that
28538 case, the address is always passed to the next router.
28541 Note that <option>address_data</option> is not considered to be a precondition. If its
28542 expansion is forced to fail, the router declines, and the value of <option>more</option>
28543 controls what happens next.
28546 <indexterm role="option">
28547 <primary>pass_on_timeout</primary>
28550 <informaltable frame="all">
28551 <tgroup cols="4" colsep="0" rowsep="0">
28552 <colspec colwidth="8*" align="left"/>
28553 <colspec colwidth="5*" align="center"/>
28554 <colspec colwidth="5*" align="center"/>
28555 <colspec colwidth="6*" align="right"/>
28558 <entry><option>pass_on_timeout</option></entry>
28559 <entry>Use: <emphasis>routers</emphasis></entry>
28560 <entry>Type: <emphasis>boolean</emphasis></entry>
28561 <entry>Default: <emphasis>false</emphasis></entry>
28567 <indexterm role="concept">
28568 <primary>timeout</primary>
28569 <secondary>of router</secondary>
28571 <indexterm role="concept">
28572 <primary>router</primary>
28573 <secondary>timeout</secondary>
28575 If a router times out during a host lookup, it normally causes deferral of the
28576 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
28577 router, overriding <option>no_more</option>. This may be helpful for systems that are
28578 intermittently connected to the Internet, or those that want to pass to a smart
28579 host any messages that cannot immediately be delivered.
28582 There are occasional other temporary errors that can occur while doing DNS
28583 lookups. They are treated in the same way as a timeout, and this option
28584 applies to all of them.
28587 <indexterm role="option">
28588 <primary>pass_router</primary>
28591 <informaltable frame="all">
28592 <tgroup cols="4" colsep="0" rowsep="0">
28593 <colspec colwidth="8*" align="left"/>
28594 <colspec colwidth="5*" align="center"/>
28595 <colspec colwidth="5*" align="center"/>
28596 <colspec colwidth="6*" align="right"/>
28599 <entry><option>pass_router</option></entry>
28600 <entry>Use: <emphasis>routers</emphasis></entry>
28601 <entry>Type: <emphasis>string</emphasis></entry>
28602 <entry>Default: <emphasis>unset</emphasis></entry>
28608 <indexterm role="concept">
28609 <primary>router</primary>
28610 <secondary>go to after <quote>pass</quote></secondary>
28612 When a router returns <quote>pass</quote>, the address is normally handed on to the next
28613 router in sequence. This can be changed by setting <option>pass_router</option> to the name
28614 of another router. However (unlike <option>redirect_router</option>) the named router must
28615 be below the current router, to avoid loops. Note that this option applies only
28616 to the special case of <quote>pass</quote>. It does not apply when a router returns
28617 <quote>decline</quote>.
28620 <indexterm role="option">
28621 <primary>redirect_router</primary>
28624 <informaltable frame="all">
28625 <tgroup cols="4" colsep="0" rowsep="0">
28626 <colspec colwidth="8*" align="left"/>
28627 <colspec colwidth="5*" align="center"/>
28628 <colspec colwidth="5*" align="center"/>
28629 <colspec colwidth="6*" align="right"/>
28632 <entry><option>redirect_router</option></entry>
28633 <entry>Use: <emphasis>routers</emphasis></entry>
28634 <entry>Type: <emphasis>string</emphasis></entry>
28635 <entry>Default: <emphasis>unset</emphasis></entry>
28641 <indexterm role="concept">
28642 <primary>router</primary>
28643 <secondary>start at after redirection</secondary>
28645 Sometimes an administrator knows that it is pointless to reprocess addresses
28646 generated from alias or forward files with the same router again. For
28647 example, if an alias file translates real names into login ids there is no
28648 point searching the alias file a second time, especially if it is a large file.
28651 The <option>redirect_router</option> option can be set to the name of any router instance.
28652 It causes the routing of any generated addresses to start at the named router
28653 instead of at the first router. This option has no effect if the router in
28654 which it is set does not generate new addresses.
28657 <indexterm role="option">
28658 <primary>require_files</primary>
28661 <informaltable frame="all">
28662 <tgroup cols="4" colsep="0" rowsep="0">
28663 <colspec colwidth="8*" align="left"/>
28664 <colspec colwidth="5*" align="center"/>
28665 <colspec colwidth="5*" align="center"/>
28666 <colspec colwidth="6*" align="right"/>
28669 <entry><option>require_files</option></entry>
28670 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
28671 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
28672 <entry>Default: <emphasis>unset</emphasis></entry>
28678 <indexterm role="concept">
28679 <primary>file</primary>
28680 <secondary>requiring for router</secondary>
28682 <indexterm role="concept">
28683 <primary>router</primary>
28684 <secondary>requiring file existence</secondary>
28686 This option provides a general mechanism for predicating the running of a
28687 router on the existence or non-existence of certain files or directories.
28688 Before running a router, as one of its precondition tests, Exim works its way
28689 through the <option>require_files</option> list, expanding each item separately.
28692 Because the list is split before expansion, any colons in expansion items must
28693 be doubled, or the facility for using a different list separator must be used.
28694 If any expansion is forced to fail, the item is ignored. Other expansion
28695 failures cause routing of the address to be deferred.
28698 If any expanded string is empty, it is ignored. Otherwise, except as described
28699 below, each string must be a fully qualified file path, optionally preceded by
28700 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
28701 existence of the files or directories. The router is skipped if any paths not
28702 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
28705 <indexterm role="concept">
28706 <primary>NFS</primary>
28708 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
28709 the message is deferred. This can happen when NFS-mounted filesystems are
28713 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
28714 options, so you cannot use it to check for the existence of a file in which to
28715 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
28716 full list of the order in which preconditions are evaluated.) However, as
28717 these options are all expanded, you can use the <option>exists</option> expansion condition
28718 to make such tests. The <option>require_files</option> option is intended for checking files
28719 that the router may be going to use internally, or which are needed by a
28720 transport (for example <filename>.procmailrc</filename>).
28723 During delivery, the <function>stat()</function> function is run as root, but there is a
28724 facility for some checking of the accessibility of a file by another user.
28725 This is not a proper permissions check, but just a <quote>rough</quote> check that
28726 operates as follows:
28729 If an item in a <option>require_files</option> list does not contain any forward slash
28730 characters, it is taken to be the user (and optional group, separated by a
28731 comma) to be checked for subsequent files in the list. If no group is specified
28732 but the user is specified symbolically, the gid associated with the uid is
28735 <literallayout class="monospaced">
28736 require_files = mail:/some/file
28737 require_files = $local_part:$home/.procmailrc
28740 If a user or group name in a <option>require_files</option> list does not exist, the
28741 <option>require_files</option> condition fails.
28744 Exim performs the check by scanning along the components of the file path, and
28745 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
28746 directories, and <quote>r</quote> access on the final file. Note that this means that file
28747 access control lists, if the operating system has them, are ignored.
28750 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
28751 incoming SMTP message, Exim is not running as root, but under its own uid. This
28752 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
28753 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
28754 user is not permitted to read one of the directories on the file’s path.
28757 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
28758 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
28759 without root access. In this case, if a check for access by a particular user
28760 is requested, Exim creates a subprocess that runs as that user, and tries the
28761 check again in that process.
28764 The default action for handling an unresolved EACCES is to consider it to
28765 be caused by a configuration error, and routing is deferred because the
28766 existence or non-existence of the file cannot be determined. However, in some
28767 circumstances it may be desirable to treat this condition as if the file did
28768 not exist. If the file name (or the exclamation mark that precedes the file
28769 name for non-existence) is preceded by a plus sign, the EACCES error is treated
28770 as if the file did not exist. For example:
28772 <literallayout class="monospaced">
28773 require_files = +/some/file
28776 If the router is not an essential part of verification (for example, it
28777 handles users’ <filename>.forward</filename> files), another solution is to set the <option>verify</option>
28778 option false so that the router is skipped when verifying.
28781 <indexterm role="option">
28782 <primary>retry_use_local_part</primary>
28785 <informaltable frame="all">
28786 <tgroup cols="4" colsep="0" rowsep="0">
28787 <colspec colwidth="8*" align="left"/>
28788 <colspec colwidth="5*" align="center"/>
28789 <colspec colwidth="5*" align="center"/>
28790 <colspec colwidth="6*" align="right"/>
28793 <entry><option>retry_use_local_part</option></entry>
28794 <entry>Use: <emphasis>routers</emphasis></entry>
28795 <entry>Type: <emphasis>boolean</emphasis></entry>
28796 <entry>Default: <emphasis>see below</emphasis></entry>
28802 <indexterm role="concept">
28803 <primary>hints database</primary>
28804 <secondary>retry keys</secondary>
28806 <indexterm role="concept">
28807 <primary>local part</primary>
28808 <secondary>in retry keys</secondary>
28810 When a delivery suffers a temporary routing failure, a retry record is created
28811 in Exim’s hints database. For addresses whose routing depends only on the
28812 domain, the key for the retry record should not involve the local part, but for
28813 other addresses, both the domain and the local part should be included.
28814 Usually, remote routing is of the former kind, and local routing is of the
28818 This option controls whether the local part is used to form the key for retry
28819 hints for addresses that suffer temporary errors while being handled by this
28820 router. The default value is true for any router that has <option>check_local_user</option>
28821 set, and false otherwise. Note that this option does not apply to hints keys
28822 for transport delays; they are controlled by a generic transport option of the
28826 The setting of <option>retry_use_local_part</option> applies only to the router on which it
28827 appears. If the router generates child addresses, they are routed
28828 independently; this setting does not become attached to them.
28831 <indexterm role="option">
28832 <primary>router_home_directory</primary>
28835 <informaltable frame="all">
28836 <tgroup cols="4" colsep="0" rowsep="0">
28837 <colspec colwidth="8*" align="left"/>
28838 <colspec colwidth="5*" align="center"/>
28839 <colspec colwidth="5*" align="center"/>
28840 <colspec colwidth="6*" align="right"/>
28843 <entry><option>router_home_directory</option></entry>
28844 <entry>Use: <emphasis>routers</emphasis></entry>
28845 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28846 <entry>Default: <emphasis>unset</emphasis></entry>
28852 <indexterm role="concept">
28853 <primary>router</primary>
28854 <secondary>home directory for</secondary>
28856 <indexterm role="concept">
28857 <primary>home directory</primary>
28858 <secondary>for router</secondary>
28860 <indexterm role="concept">
28861 <primary><varname>$home</varname></primary>
28863 This option sets a home directory for use while the router is running. (Compare
28864 <option>transport_home_directory</option>, which sets a home directory for later
28865 transporting.) In particular, if used on a <command>redirect</command> router, this option
28866 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
28867 forced expansion failure causes the option to be ignored – other failures
28868 cause the router to defer.
28871 Expansion of <option>router_home_directory</option> happens immediately after the
28872 <option>check_local_user</option> test (if configured), before any further expansions take
28874 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
28876 While the router is running, <option>router_home_directory</option> overrides the value of
28877 <varname>$home</varname> that came from <option>check_local_user</option>.
28879 <para revisionflag="changed">
28880 When a router accepts an address and assigns it to a local transport (including
28881 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
28882 delivery), the home directory setting for the transport is taken from the first
28883 of these values that is set:
28888 The <option>home_directory</option> option on the transport;
28893 The <option>transport_home_directory</option> option on the router;
28898 The password data if <option>check_local_user</option> is set on the router;
28903 The <option>router_home_directory</option> option on the router.
28908 In other words, <option>router_home_directory</option> overrides the password data for the
28909 router, but not for the transport.
28912 <indexterm role="option">
28913 <primary>self</primary>
28916 <informaltable frame="all">
28917 <tgroup cols="4" colsep="0" rowsep="0">
28918 <colspec colwidth="8*" align="left"/>
28919 <colspec colwidth="5*" align="center"/>
28920 <colspec colwidth="5*" align="center"/>
28921 <colspec colwidth="6*" align="right"/>
28924 <entry><option>self</option></entry>
28925 <entry>Use: <emphasis>routers</emphasis></entry>
28926 <entry>Type: <emphasis>string</emphasis></entry>
28927 <entry>Default: <emphasis>freeze</emphasis></entry>
28933 <indexterm role="concept">
28934 <primary>MX record</primary>
28935 <secondary>pointing to local host</secondary>
28937 <indexterm role="concept">
28938 <primary>local host</primary>
28939 <secondary>MX pointing to</secondary>
28941 This option applies to those routers that use a recipient address to find a
28942 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
28943 and <command>manualroute</command> routers.
28944 Certain configurations of the <command>queryprogram</command> router can also specify a list
28946 Usually such routers are configured to send the message to a remote host via an
28947 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
28948 host on the list turns out to be the local host.
28949 The way in which Exim checks for the local host is described in section
28950 <xref linkend="SECTreclocipadd"/>.
28953 Normally this situation indicates either an error in Exim’s configuration (for
28954 example, the router should be configured not to process this domain), or an
28955 error in the DNS (for example, the MX should not point to this host). For this
28956 reason, the default action is to log the incident, defer the address, and
28957 freeze the message. The following alternatives are provided for use in special
28962 <term><option>defer</option></term>
28965 Delivery of the message is tried again later, but the message is not frozen.
28967 </listitem></varlistentry>
28969 <term><option>reroute</option>: <<emphasis>domain</emphasis>></term>
28972 The domain is changed to the given domain, and the address is passed back to
28973 be reprocessed by the routers. No rewriting of headers takes place. This
28974 behaviour is essentially a redirection.
28976 </listitem></varlistentry>
28978 <term><option>reroute: rewrite:</option> <<emphasis>domain</emphasis>></term>
28981 The domain is changed to the given domain, and the address is passed back to be
28982 reprocessed by the routers. Any headers that contain the original domain are
28985 </listitem></varlistentry>
28987 <term><option>pass</option></term>
28990 <indexterm role="concept">
28991 <primary><option>more</option> option</primary>
28993 <indexterm role="concept">
28994 <primary><varname>$self_hostname</varname></primary>
28996 The router passes the address to the next router, or to the router named in the
28997 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
28998 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
28999 name of the local host that the router encountered. This can be used to
29000 distinguish between different cases for hosts with multiple names. The
29003 <literallayout class="monospaced">
29008 ensures that only those addresses that routed to the local host are passed on.
29009 Without <option>no_more</option>, addresses that were declined for other reasons would also
29010 be passed to the next router.
29012 </listitem></varlistentry>
29014 <term><option>fail</option></term>
29017 Delivery fails and an error report is generated.
29019 </listitem></varlistentry>
29021 <term><option>send</option></term>
29024 <indexterm role="concept">
29025 <primary>local host</primary>
29026 <secondary>sending to</secondary>
29028 The anomaly is ignored and the address is queued for the transport. This
29029 setting should be used with extreme caution. For an <command>smtp</command> transport, it
29030 makes sense only in cases where the program that is listening on the SMTP port
29031 is not this version of Exim. That is, it must be some other MTA, or Exim with a
29032 different configuration file that handles the domain in another way.
29034 </listitem></varlistentry>
29037 <indexterm role="option">
29038 <primary>senders</primary>
29041 <informaltable frame="all">
29042 <tgroup cols="4" colsep="0" rowsep="0">
29043 <colspec colwidth="8*" align="left"/>
29044 <colspec colwidth="5*" align="center"/>
29045 <colspec colwidth="5*" align="center"/>
29046 <colspec colwidth="6*" align="right"/>
29049 <entry><option>senders</option></entry>
29050 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29051 <entry>Type: <emphasis>address list</emphasis>†<emphasis></emphasis></entry>
29052 <entry>Default: <emphasis>unset</emphasis></entry>
29058 <indexterm role="concept">
29059 <primary>router</primary>
29060 <secondary>checking senders</secondary>
29062 If this option is set, the router is skipped unless the message’s sender
29063 address matches something on the list.
29064 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29068 There are issues concerning verification when the running of routers is
29069 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
29070 setting, it sets the sender to the null string. When using the <option>-bt</option> option
29071 to check a configuration file, it is necessary also to use the <option>-f</option> option to
29072 set an appropriate sender. For incoming mail, the sender is unset when
29073 verifying the sender, but is available when verifying any recipients. If the
29074 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
29078 <indexterm role="option">
29079 <primary>translate_ip_address</primary>
29082 <informaltable frame="all">
29083 <tgroup cols="4" colsep="0" rowsep="0">
29084 <colspec colwidth="8*" align="left"/>
29085 <colspec colwidth="5*" align="center"/>
29086 <colspec colwidth="5*" align="center"/>
29087 <colspec colwidth="6*" align="right"/>
29090 <entry><option>translate_ip_address</option></entry>
29091 <entry>Use: <emphasis>routers</emphasis></entry>
29092 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29093 <entry>Default: <emphasis>unset</emphasis></entry>
29099 <indexterm role="concept">
29100 <primary>IP address</primary>
29101 <secondary>translating</secondary>
29103 <indexterm role="concept">
29104 <primary>packet radio</primary>
29106 <indexterm role="concept">
29107 <primary>router</primary>
29108 <secondary>IP address translation</secondary>
29110 There exist some rare networking situations (for example, packet radio) where
29111 it is helpful to be able to translate IP addresses generated by normal routing
29112 mechanisms into other IP addresses, thus performing a kind of manual IP
29113 routing. This should be done only if the normal IP routing of the TCP/IP stack
29114 is inadequate or broken. Because this is an extremely uncommon requirement, the
29115 code to support this option is not included in the Exim binary unless
29116 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
29119 <indexterm role="concept">
29120 <primary><varname>$host_address</varname></primary>
29122 The <option>translate_ip_address</option> string is expanded for every IP address generated
29123 by the router, with the generated address set in <varname>$host_address</varname>. If the
29124 expansion is forced to fail, no action is taken.
29125 For any other expansion error, delivery of the message is deferred.
29126 If the result of the expansion is an IP address, that replaces the original
29127 address; otherwise the result is assumed to be a host name – this is looked
29128 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
29129 produce one or more replacement IP addresses. For example, to subvert all IP
29130 addresses in some specific networks, this could be added to a router:
29132 <literallayout class="monospaced">
29133 translate_ip_address = \
29134 ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
29138 The file would contain lines like
29140 <literallayout class="monospaced">
29141 10.2.3.128/26 some.host
29142 10.8.4.34/26 10.44.8.15
29145 You should not make use of this facility unless you really understand what you
29149 <indexterm role="option">
29150 <primary>transport</primary>
29153 <informaltable frame="all">
29154 <tgroup cols="4" colsep="0" rowsep="0">
29155 <colspec colwidth="8*" align="left"/>
29156 <colspec colwidth="5*" align="center"/>
29157 <colspec colwidth="5*" align="center"/>
29158 <colspec colwidth="6*" align="right"/>
29161 <entry><option>transport</option></entry>
29162 <entry>Use: <emphasis>routers</emphasis></entry>
29163 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29164 <entry>Default: <emphasis>unset</emphasis></entry>
29170 This option specifies the transport to be used when a router accepts an address
29171 and sets it up for delivery. A transport is never needed if a router is used
29172 only for verification. The value of the option is expanded at routing time,
29173 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
29174 and result must be the name of one of the configured transports. If it is not,
29175 delivery is deferred.
29178 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
29179 have some private options that set up transports for pipe and file deliveries
29180 (see chapter <xref linkend="CHAPredirect"/>).
29183 <indexterm role="option">
29184 <primary>transport_current_directory</primary>
29187 <informaltable frame="all">
29188 <tgroup cols="4" colsep="0" rowsep="0">
29189 <colspec colwidth="8*" align="left"/>
29190 <colspec colwidth="5*" align="center"/>
29191 <colspec colwidth="5*" align="center"/>
29192 <colspec colwidth="6*" align="right"/>
29195 <entry><option>transport_current_directory</option></entry>
29196 <entry>Use: <emphasis>routers</emphasis></entry>
29197 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29198 <entry>Default: <emphasis>unset</emphasis></entry>
29204 <indexterm role="concept">
29205 <primary>current directory for local transport</primary>
29207 This option associates a current directory with any address that is routed
29208 to a local transport. This can happen either because a transport is
29209 explicitly configured for the router, or because it generates a delivery to a
29210 file or a pipe. During the delivery process (that is, at transport time), this
29211 option string is expanded and is set as the current directory, unless
29212 overridden by a setting on the transport.
29213 If the expansion fails for any reason, including forced failure, an error is
29214 logged, and delivery is deferred.
29215 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
29219 <indexterm role="option">
29220 <primary>transport_home_directory</primary>
29223 <informaltable frame="all">
29224 <tgroup cols="4" colsep="0" rowsep="0">
29225 <colspec colwidth="8*" align="left"/>
29226 <colspec colwidth="5*" align="center"/>
29227 <colspec colwidth="5*" align="center"/>
29228 <colspec colwidth="6*" align="right"/>
29231 <entry><option>transport_home_directory</option></entry>
29232 <entry>Use: <emphasis>routers</emphasis></entry>
29233 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29234 <entry>Default: <emphasis>see below</emphasis></entry>
29240 <indexterm role="concept">
29241 <primary>home directory</primary>
29242 <secondary>for local transport</secondary>
29244 This option associates a home directory with any address that is routed to a
29245 local transport. This can happen either because a transport is explicitly
29246 configured for the router, or because it generates a delivery to a file or a
29247 pipe. During the delivery process (that is, at transport time), the option
29248 string is expanded and is set as the home directory, unless overridden by a
29249 setting of <option>home_directory</option> on the transport.
29250 If the expansion fails for any reason, including forced failure, an error is
29251 logged, and delivery is deferred.
29254 If the transport does not specify a home directory, and
29255 <option>transport_home_directory</option> is not set for the router, the home directory for
29256 the tranport is taken from the password data if <option>check_local_user</option> is set for
29257 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
29258 is set; if not, no home directory is set for the transport.
29261 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
29265 <indexterm role="option">
29266 <primary>unseen</primary>
29269 <informaltable frame="all">
29270 <tgroup cols="4" colsep="0" rowsep="0">
29271 <colspec colwidth="8*" align="left"/>
29272 <colspec colwidth="5*" align="center"/>
29273 <colspec colwidth="5*" align="center"/>
29274 <colspec colwidth="6*" align="right"/>
29277 <entry><option>unseen</option></entry>
29278 <entry>Use: <emphasis>routers</emphasis></entry>
29279 <entry>Type: <emphasis>boolean</emphasis>†<emphasis></emphasis></entry>
29280 <entry>Default: <emphasis>false</emphasis></entry>
29286 <indexterm role="concept">
29287 <primary>router</primary>
29288 <secondary>carrying on after success</secondary>
29290 The result of string expansion for this option must be a valid boolean value,
29291 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
29292 result causes an error, and delivery is deferred. If the expansion is forced to
29293 fail, the default value for the option (false) is used. Other failures cause
29294 delivery to be deferred.
29297 When this option is set true, routing does not cease if the router accepts the
29298 address. Instead, a copy of the incoming address is passed to the next router,
29299 overriding a false setting of <option>more</option>. There is little point in setting
29300 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
29301 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
29302 sometimes true and sometimes false).
29305 <indexterm role="concept">
29306 <primary>copy of message (<option>unseen</option> option)</primary>
29308 The <option>unseen</option> option can be used to cause copies of messages to be delivered
29309 to some other destination, while also carrying out a normal delivery. In
29310 effect, the current address is made into a <quote>parent</quote> that has two children –
29311 one that is delivered as specified by this router, and a clone that goes on to
29312 be routed further. For this reason, <option>unseen</option> may not be combined with the
29313 <option>one_time</option> option in a <command>redirect</command> router.
29316 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
29317 this router or by previous routers affect the <quote>unseen</quote> copy of the message
29318 only. The clone that continues to be processed by further routers starts with
29319 no added headers and none specified for removal. However, any data that was set
29320 by the <option>address_data</option> option in the current or previous routers is passed on.
29321 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
29322 qualifier in filter files.
29325 <indexterm role="option">
29326 <primary>user</primary>
29329 <informaltable frame="all">
29330 <tgroup cols="4" colsep="0" rowsep="0">
29331 <colspec colwidth="8*" align="left"/>
29332 <colspec colwidth="5*" align="center"/>
29333 <colspec colwidth="5*" align="center"/>
29334 <colspec colwidth="6*" align="right"/>
29337 <entry><option>user</option></entry>
29338 <entry>Use: <emphasis>routers</emphasis></entry>
29339 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29340 <entry>Default: <emphasis>see below</emphasis></entry>
29346 <indexterm role="concept">
29347 <primary>uid (user id)</primary>
29348 <secondary>local delivery</secondary>
29350 <indexterm role="concept">
29351 <primary>local transports</primary>
29352 <secondary>uid and gid</secondary>
29354 <indexterm role="concept">
29355 <primary>transport</primary>
29356 <secondary>local</secondary>
29358 <indexterm role="concept">
29359 <primary>router</primary>
29360 <secondary>user for filter processing</secondary>
29362 <indexterm role="concept">
29363 <primary>filter</primary>
29364 <secondary>user for processing</secondary>
29366 When a router queues an address for a transport, and the transport does not
29367 specify a user, the user given here is used when running the delivery process.
29368 The user may be specified numerically or by name. If expansion fails, the
29369 error is logged and delivery is deferred.
29370 This user is also used by the <command>redirect</command> router when running a filter file.
29371 The default is unset, except when <option>check_local_user</option> is set. In this case,
29372 the default is taken from the password information. If the user is specified as
29373 a name, and <option>group</option> is not set, the group associated with the user is used.
29374 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
29375 <xref linkend="CHAPenvironment"/>.
29378 <indexterm role="option">
29379 <primary>verify</primary>
29382 <informaltable frame="all">
29383 <tgroup cols="4" colsep="0" rowsep="0">
29384 <colspec colwidth="8*" align="left"/>
29385 <colspec colwidth="5*" align="center"/>
29386 <colspec colwidth="5*" align="center"/>
29387 <colspec colwidth="6*" align="right"/>
29390 <entry><option>verify</option></entry>
29391 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29392 <entry>Type: <emphasis>boolean</emphasis></entry>
29393 <entry>Default: <emphasis>true</emphasis></entry>
29399 Setting this option has the effect of setting <option>verify_sender</option> and
29400 <option>verify_recipient</option> to the same value.
29403 <indexterm role="option">
29404 <primary>verify_only</primary>
29407 <informaltable frame="all">
29408 <tgroup cols="4" colsep="0" rowsep="0">
29409 <colspec colwidth="8*" align="left"/>
29410 <colspec colwidth="5*" align="center"/>
29411 <colspec colwidth="5*" align="center"/>
29412 <colspec colwidth="6*" align="right"/>
29415 <entry><option>verify_only</option></entry>
29416 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29417 <entry>Type: <emphasis>boolean</emphasis></entry>
29418 <entry>Default: <emphasis>false</emphasis></entry>
29424 <indexterm role="concept">
29425 <primary>EXPN</primary>
29426 <secondary>with <option>verify_only</option></secondary>
29428 <indexterm role="concept">
29429 <primary><option>-bv</option> option</primary>
29431 <indexterm role="concept">
29432 <primary>router</primary>
29433 <secondary>used only when verifying</secondary>
29435 If this option is set, the router is used only when verifying an address or
29436 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
29437 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
29438 restricted to verifying only senders or recipients by means of
29439 <option>verify_sender</option> and <option>verify_recipient</option>.
29442 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
29443 SMTP message, Exim is not running as root, but under its own uid. If the router
29444 accesses any files, you need to make sure that they are accessible to the Exim
29448 <indexterm role="option">
29449 <primary>verify_recipient</primary>
29452 <informaltable frame="all">
29453 <tgroup cols="4" colsep="0" rowsep="0">
29454 <colspec colwidth="8*" align="left"/>
29455 <colspec colwidth="5*" align="center"/>
29456 <colspec colwidth="5*" align="center"/>
29457 <colspec colwidth="6*" align="right"/>
29460 <entry><option>verify_recipient</option></entry>
29461 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29462 <entry>Type: <emphasis>boolean</emphasis></entry>
29463 <entry>Default: <emphasis>true</emphasis></entry>
29469 If this option is false, the router is skipped when verifying recipient
29471 or testing recipient verification using <option>-bv</option>.
29472 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29476 <indexterm role="option">
29477 <primary>verify_sender</primary>
29480 <informaltable frame="all">
29481 <tgroup cols="4" colsep="0" rowsep="0">
29482 <colspec colwidth="8*" align="left"/>
29483 <colspec colwidth="5*" align="center"/>
29484 <colspec colwidth="5*" align="center"/>
29485 <colspec colwidth="6*" align="right"/>
29488 <entry><option>verify_sender</option></entry>
29489 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29490 <entry>Type: <emphasis>boolean</emphasis></entry>
29491 <entry>Default: <emphasis>true</emphasis></entry>
29497 If this option is false, the router is skipped when verifying sender addresses
29498 or testing sender verification using <option>-bvs</option>.
29499 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29501 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
29502 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
29507 <title>The accept router</title>
29509 <indexterm role="concept">
29510 <primary><command>accept</command> router</primary>
29512 <indexterm role="concept">
29513 <primary>routers</primary>
29514 <secondary><command>accept</command></secondary>
29516 The <command>accept</command> router has no private options of its own. Unless it is being
29517 used purely for verification (see <option>verify_only</option>) a transport is required to
29518 be defined by the generic <option>transport</option> option. If the preconditions that are
29519 specified by generic options are met, the router accepts the address and queues
29520 it for the given transport. The most common use of this router is for setting
29521 up deliveries to local mailboxes. For example:
29523 <literallayout class="monospaced">
29526 domains = mydomain.example
29528 transport = local_delivery
29531 The <option>domains</option> condition in this example checks the domain of the address, and
29532 <option>check_local_user</option> checks that the local part is the login of a local user.
29533 When both preconditions are met, the <command>accept</command> router runs, and queues the
29534 address for the <command>local_delivery</command> transport.
29538 <chapter id="CHAPdnslookup">
29539 <title>The dnslookup router</title>
29541 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
29542 <primary><command>dnslookup</command> router</primary>
29544 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
29545 <primary>routers</primary>
29546 <secondary><command>dnslookup</command></secondary>
29548 The <command>dnslookup</command> router looks up the hosts that handle mail for the
29549 recipient’s domain in the DNS. A transport must always be set for this router,
29550 unless <option>verify_only</option> is set.
29553 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
29554 SRV records. If none are found, or if SRV support is not configured,
29555 MX records are looked up. If no MX records exist, address records are sought.
29556 However, <option>mx_domains</option> can be set to disable the direct use of address
29560 MX records of equal priority are sorted by Exim into a random order. Exim then
29561 looks for address records for the host names obtained from MX or SRV records.
29562 When a host has more than one IP address, they are sorted into a random order,
29563 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
29564 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
29565 generic option, the router declines.
29568 Unless they have the highest priority (lowest MX value), MX records that point
29569 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
29570 are discarded, together with any other MX records of equal or lower priority.
29573 <indexterm role="concept">
29574 <primary>MX record</primary>
29575 <secondary>pointing to local host</secondary>
29577 <indexterm role="concept">
29578 <primary>local host</primary>
29579 <secondary>MX pointing to</secondary>
29581 <indexterm role="concept">
29582 <primary><option>self</option> option</primary>
29583 <secondary>in <command>dnslookup</command> router</secondary>
29585 If the host pointed to by the highest priority MX record, or looked up as an
29586 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
29587 happens is controlled by the generic <option>self</option> option.
29589 <section id="SECTprowitdnsloo">
29590 <title>Problems with DNS lookups</title>
29592 There have been problems with DNS servers when SRV records are looked up.
29593 Some mis-behaving servers return a DNS error or timeout when a non-existent
29594 SRV record is sought. Similar problems have in the past been reported for
29595 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
29596 problem, but it is heavy-handed because it is a global option.
29599 For this reason, there are two options, <option>srv_fail_domains</option> and
29600 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
29601 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
29602 an attempt to look up an SRV or MX record causes one of these results, and the
29603 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
29604 such record</quote>. In the case of an SRV lookup, this means that the router
29605 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
29606 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
29607 case routing fails.
29611 <title>Private options for dnslookup</title>
29613 <indexterm role="concept">
29614 <primary>options</primary>
29615 <secondary><command>dnslookup</command> router</secondary>
29617 The private options for the <command>dnslookup</command> router are as follows:
29620 <indexterm role="option">
29621 <primary>check_secondary_mx</primary>
29624 <informaltable frame="all">
29625 <tgroup cols="4" colsep="0" rowsep="0">
29626 <colspec colwidth="8*" align="left"/>
29627 <colspec colwidth="5*" align="center"/>
29628 <colspec colwidth="5*" align="center"/>
29629 <colspec colwidth="6*" align="right"/>
29632 <entry><option>check_secondary_mx</option></entry>
29633 <entry>Use: <emphasis>dnslookup</emphasis></entry>
29634 <entry>Type: <emphasis>boolean</emphasis></entry>
29635 <entry>Default: <emphasis>false</emphasis></entry>
29641 <indexterm role="concept">
29642 <primary>MX record</primary>
29643 <secondary>checking for secondary</secondary>
29645 If this option is set, the router declines unless the local host is found in
29646 (and removed from) the list of hosts obtained by MX lookup. This can be used to
29647 process domains for which the local host is a secondary mail exchanger
29648 differently to other domains. The way in which Exim decides whether a host is
29649 the local host is described in section <xref linkend="SECTreclocipadd"/>.
29652 <indexterm role="option">
29653 <primary>check_srv</primary>
29656 <informaltable frame="all">
29657 <tgroup cols="4" colsep="0" rowsep="0">
29658 <colspec colwidth="8*" align="left"/>
29659 <colspec colwidth="5*" align="center"/>
29660 <colspec colwidth="5*" align="center"/>
29661 <colspec colwidth="6*" align="right"/>
29664 <entry><option>check_srv</option></entry>
29665 <entry>Use: <emphasis>dnslookup</emphasis></entry>
29666 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29667 <entry>Default: <emphasis>unset</emphasis></entry>
29673 <indexterm role="concept">
29674 <primary>SRV record</primary>
29675 <secondary>enabling use of</secondary>
29677 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
29678 addition to MX and address records. The support is disabled by default. To
29679 enable SRV support, set the <option>check_srv</option> option to the name of the service
29680 required. For example,
29682 <literallayout class="monospaced">
29686 looks for SRV records that refer to the normal smtp service. The option is
29687 expanded, so the service name can vary from message to message or address
29688 to address. This might be helpful if SRV records are being used for a
29689 submission service. If the expansion is forced to fail, the <option>check_srv</option>
29690 option is ignored, and the router proceeds to look for MX records in the
29694 When the expansion succeeds, the router searches first for SRV records for
29695 the given service (it assumes TCP protocol). A single SRV record with a
29696 host name that consists of just a single dot indicates <quote>no such service for
29697 this domain</quote>; if this is encountered, the router declines. If other kinds of
29698 SRV record are found, they are used to construct a host list for delivery
29699 according to the rules of RFC 2782. MX records are not sought in this case.
29702 When no SRV records are found, MX records (and address records) are sought in
29703 the traditional way. In other words, SRV records take precedence over MX
29704 records, just as MX records take precedence over address records. Note that
29705 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
29706 defined it. It is apparently believed that MX records are sufficient for email
29707 and that SRV records should not be used for this purpose. However, SRV records
29708 have an additional <quote>weight</quote> feature which some people might find useful when
29709 trying to split an SMTP load between hosts of different power.
29712 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim’s behaviour
29713 when there is a DNS lookup error.
29716 <indexterm role="option">
29717 <primary>mx_domains</primary>
29720 <informaltable frame="all">
29721 <tgroup cols="4" colsep="0" rowsep="0">
29722 <colspec colwidth="8*" align="left"/>
29723 <colspec colwidth="5*" align="center"/>
29724 <colspec colwidth="5*" align="center"/>
29725 <colspec colwidth="6*" align="right"/>
29728 <entry><option>mx_domains</option></entry>
29729 <entry>Use: <emphasis>dnslookup</emphasis></entry>
29730 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
29731 <entry>Default: <emphasis>unset</emphasis></entry>
29737 <indexterm role="concept">
29738 <primary>MX record</primary>
29739 <secondary>required to exist</secondary>
29741 <indexterm role="concept">
29742 <primary>SRV record</primary>
29743 <secondary>required to exist</secondary>
29745 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
29746 record in order to be recognised. (The name of this option could be improved.)
29747 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
29748 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
29751 <literallayout class="monospaced">
29752 mx_domains = ! *.discworld.fict.example : *.fict.example
29755 This specifies that messages addressed to a domain that matches the list but
29756 has no MX record should be bounced immediately instead of being routed using
29757 the address record.
29760 <indexterm role="option">
29761 <primary>mx_fail_domains</primary>
29764 <informaltable frame="all">
29765 <tgroup cols="4" colsep="0" rowsep="0">
29766 <colspec colwidth="8*" align="left"/>
29767 <colspec colwidth="5*" align="center"/>
29768 <colspec colwidth="5*" align="center"/>
29769 <colspec colwidth="6*" align="right"/>
29772 <entry><option>mx_fail_domains</option></entry>
29773 <entry>Use: <emphasis>dnslookup</emphasis></entry>
29774 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
29775 <entry>Default: <emphasis>unset</emphasis></entry>
29781 If the DNS lookup for MX records for one of the domains in this list causes a
29782 DNS lookup error, Exim behaves as if no MX records were found. See section
29783 <xref linkend="SECTprowitdnsloo"/> for more discussion.
29786 <indexterm role="option">
29787 <primary>qualify_single</primary>
29790 <informaltable frame="all">
29791 <tgroup cols="4" colsep="0" rowsep="0">
29792 <colspec colwidth="8*" align="left"/>
29793 <colspec colwidth="5*" align="center"/>
29794 <colspec colwidth="5*" align="center"/>
29795 <colspec colwidth="6*" align="right"/>
29798 <entry><option>qualify_single</option></entry>
29799 <entry>Use: <emphasis>dnslookup</emphasis></entry>
29800 <entry>Type: <emphasis>boolean</emphasis></entry>
29801 <entry>Default: <emphasis>true</emphasis></entry>
29807 <indexterm role="concept">
29808 <primary>DNS</primary>
29809 <secondary>resolver options</secondary>
29811 <indexterm role="concept">
29812 <primary>DNS</primary>
29813 <secondary>qualifying single-component names</secondary>
29815 When this option is true, the resolver option RES_DEFNAMES is set for DNS
29816 lookups. Typically, but not standardly, this causes the resolver to qualify
29817 single-component names with the default domain. For example, on a machine
29818 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
29819 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
29820 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
29821 <emphasis>resolv.conf</emphasis>.
29824 <indexterm role="option">
29825 <primary>rewrite_headers</primary>
29828 <informaltable frame="all">
29829 <tgroup cols="4" colsep="0" rowsep="0">
29830 <colspec colwidth="8*" align="left"/>
29831 <colspec colwidth="5*" align="center"/>
29832 <colspec colwidth="5*" align="center"/>
29833 <colspec colwidth="6*" align="right"/>
29836 <entry><option>rewrite_headers</option></entry>
29837 <entry>Use: <emphasis>dnslookup</emphasis></entry>
29838 <entry>Type: <emphasis>boolean</emphasis></entry>
29839 <entry>Default: <emphasis>true</emphasis></entry>
29845 <indexterm role="concept">
29846 <primary>rewriting</primary>
29847 <secondary>header lines</secondary>
29849 <indexterm role="concept">
29850 <primary>header lines</primary>
29851 <secondary>rewriting</secondary>
29853 If the domain name in the address that is being processed is not fully
29854 qualified, it may be expanded to its full form by a DNS lookup. For example, if
29855 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
29856 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
29857 occur as a result of setting the <option>widen_domains</option> option. If
29858 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
29859 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
29860 header lines of the message are rewritten with the full domain name.
29863 This option should be turned off only when it is known that no message is
29864 ever going to be sent outside an environment where the abbreviation makes
29868 When an MX record is looked up in the DNS and matches a wildcard record, name
29869 servers normally return a record containing the name that has been looked up,
29870 making it impossible to detect whether a wildcard was present or not. However,
29871 some name servers have recently been seen to return the wildcard entry. If the
29872 name returned by a DNS lookup begins with an asterisk, it is not used for
29876 <indexterm role="option">
29877 <primary>same_domain_copy_routing</primary>
29880 <informaltable frame="all">
29881 <tgroup cols="4" colsep="0" rowsep="0">
29882 <colspec colwidth="8*" align="left"/>
29883 <colspec colwidth="5*" align="center"/>
29884 <colspec colwidth="5*" align="center"/>
29885 <colspec colwidth="6*" align="right"/>
29888 <entry><option>same_domain_copy_routing</option></entry>
29889 <entry>Use: <emphasis>dnslookup</emphasis></entry>
29890 <entry>Type: <emphasis>boolean</emphasis></entry>
29891 <entry>Default: <emphasis>false</emphasis></entry>
29897 <indexterm role="concept">
29898 <primary>address</primary>
29899 <secondary>copying routing</secondary>
29901 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
29902 to the same list of hosts. However, this cannot be presumed, because the router
29903 options and preconditions may refer to the local part of the address. By
29904 default, therefore, Exim routes each address in a message independently. DNS
29905 servers run caches, so repeated DNS lookups are not normally expensive, and in
29906 any case, personal messages rarely have more than a few recipients.
29909 If you are running mailing lists with large numbers of subscribers at the same
29910 domain, and you are using a <command>dnslookup</command> router which is independent of the
29911 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
29912 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
29913 routes an address to a remote transport, any other unrouted addresses in the
29914 message that have the same domain are automatically given the same routing
29915 without processing them independently,
29916 provided the following conditions are met:
29921 No router that processed the address specified <option>headers_add</option> or
29922 <option>headers_remove</option>.
29927 The router did not change the address in any way, for example, by <quote>widening</quote>
29933 <indexterm role="option">
29934 <primary>search_parents</primary>
29937 <informaltable frame="all">
29938 <tgroup cols="4" colsep="0" rowsep="0">
29939 <colspec colwidth="8*" align="left"/>
29940 <colspec colwidth="5*" align="center"/>
29941 <colspec colwidth="5*" align="center"/>
29942 <colspec colwidth="6*" align="right"/>
29945 <entry><option>search_parents</option></entry>
29946 <entry>Use: <emphasis>dnslookup</emphasis></entry>
29947 <entry>Type: <emphasis>boolean</emphasis></entry>
29948 <entry>Default: <emphasis>false</emphasis></entry>
29954 <indexterm role="concept">
29955 <primary>DNS</primary>
29956 <secondary>resolver options</secondary>
29958 When this option is true, the resolver option RES_DNSRCH is set for DNS
29959 lookups. This is different from the <option>qualify_single</option> option in that it
29960 applies to domains containing dots. Typically, but not standardly, it causes
29961 the resolver to search for the name in the current domain and in parent
29962 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
29963 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
29964 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
29965 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
29968 Setting this option true can cause problems in domains that have a wildcard MX
29969 record, because any domain that does not have its own MX record matches the
29973 <indexterm role="option">
29974 <primary>srv_fail_domains</primary>
29977 <informaltable frame="all">
29978 <tgroup cols="4" colsep="0" rowsep="0">
29979 <colspec colwidth="8*" align="left"/>
29980 <colspec colwidth="5*" align="center"/>
29981 <colspec colwidth="5*" align="center"/>
29982 <colspec colwidth="6*" align="right"/>
29985 <entry><option>srv_fail_domains</option></entry>
29986 <entry>Use: <emphasis>dnslookup</emphasis></entry>
29987 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
29988 <entry>Default: <emphasis>unset</emphasis></entry>
29994 If the DNS lookup for SRV records for one of the domains in this list causes a
29995 DNS lookup error, Exim behaves as if no SRV records were found. See section
29996 <xref linkend="SECTprowitdnsloo"/> for more discussion.
29999 <indexterm role="option">
30000 <primary>widen_domains</primary>
30003 <informaltable frame="all">
30004 <tgroup cols="4" colsep="0" rowsep="0">
30005 <colspec colwidth="8*" align="left"/>
30006 <colspec colwidth="5*" align="center"/>
30007 <colspec colwidth="5*" align="center"/>
30008 <colspec colwidth="6*" align="right"/>
30011 <entry><option>widen_domains</option></entry>
30012 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30013 <entry>Type: <emphasis>string list</emphasis></entry>
30014 <entry>Default: <emphasis>unset</emphasis></entry>
30020 <indexterm role="concept">
30021 <primary>domain</primary>
30022 <secondary>partial; widening</secondary>
30024 If a DNS lookup fails and this option is set, each of its strings in turn is
30025 added onto the end of the domain, and the lookup is tried again. For example,
30028 <literallayout class="monospaced">
30029 widen_domains = fict.example:ref.example
30032 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
30033 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
30034 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
30035 and <option>search_parents</option> options can cause some widening to be undertaken inside
30036 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
30037 when verifying, unless <option>rewrite_headers</option> is false (not the default).
30041 <title>Effect of qualify_single and search_parents</title>
30043 When a domain from an envelope recipient is changed by the resolver as a result
30044 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
30045 corresponding address in the message’s header lines unless <option>rewrite_headers</option>
30046 is set false. Exim then re-routes the address, using the full domain.
30049 These two options affect only the DNS lookup that takes place inside the router
30050 for the domain of the address that is being routed. They do not affect lookups
30051 such as that implied by
30053 <literallayout class="monospaced">
30057 that may happen while processing a router precondition before the router is
30058 entered. No widening ever takes place for these lookups.
30059 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
30060 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
30066 <title>The ipliteral router</title>
30068 <indexterm role="concept">
30069 <primary><command>ipliteral</command> router</primary>
30071 <indexterm role="concept">
30072 <primary>domain literal</primary>
30073 <secondary>routing</secondary>
30075 <indexterm role="concept">
30076 <primary>routers</primary>
30077 <secondary><command>ipliteral</command></secondary>
30079 This router has no private options. Unless it is being used purely for
30080 verification (see <option>verify_only</option>) a transport is required to be defined by the
30081 generic <option>transport</option> option. The router accepts the address if its domain part
30082 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
30083 router handles the address
30085 <literallayout class="monospaced">
30088 <para revisionflag="changed">
30089 by setting up delivery to the host with that IP address. IPv4 domain literals
30090 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
30091 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
30093 <literallayout class="monospaced" revisionflag="changed">
30094 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
30096 <para revisionflag="changed">
30097 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
30098 grounds that sooner or later somebody will try it.
30101 <indexterm role="concept">
30102 <primary><option>self</option> option</primary>
30103 <secondary>in <command>ipliteral</command> router</secondary>
30105 If the IP address matches something in <option>ignore_target_hosts</option>, the router
30106 declines. If an IP literal turns out to refer to the local host, the generic
30107 <option>self</option> option determines what happens.
30110 The RFCs require support for domain literals; however, their use is
30111 controversial in today’s Internet. If you want to use this router, you must
30112 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
30113 Exim will not recognize the domain literal syntax in addresses.
30118 <title>The iplookup router</title>
30120 <indexterm role="concept">
30121 <primary><command>iplookup</command> router</primary>
30123 <indexterm role="concept">
30124 <primary>routers</primary>
30125 <secondary><command>iplookup</command></secondary>
30127 The <command>iplookup</command> router was written to fulfil a specific requirement in
30128 Cambridge University (which in fact no longer exists). For this reason, it is
30129 not included in the binary of Exim by default. If you want to include it, you
30132 <literallayout class="monospaced">
30133 ROUTER_IPLOOKUP=yes
30136 in your <filename>Local/Makefile</filename> configuration file.
30139 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
30140 connection to one or more specific hosts. The host can then return the same or
30141 a different address – in effect rewriting the recipient address in the
30142 message’s envelope. The new address is then passed on to subsequent routers. If
30143 this process fails, the address can be passed on to other routers, or delivery
30144 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
30145 must not be specified for it.
30148 <indexterm role="concept">
30149 <primary>options</primary>
30150 <secondary><command>iplookup</command> router</secondary>
30152 <indexterm role="option">
30153 <primary>hosts</primary>
30156 <informaltable frame="all">
30157 <tgroup cols="4" colsep="0" rowsep="0">
30158 <colspec colwidth="8*" align="left"/>
30159 <colspec colwidth="5*" align="center"/>
30160 <colspec colwidth="5*" align="center"/>
30161 <colspec colwidth="6*" align="right"/>
30164 <entry><option>hosts</option></entry>
30165 <entry>Use: <emphasis>iplookup</emphasis></entry>
30166 <entry>Type: <emphasis>string</emphasis></entry>
30167 <entry>Default: <emphasis>unset</emphasis></entry>
30173 This option must be supplied. Its value is a colon-separated list of host
30174 names. The hosts are looked up using <function>gethostbyname()</function>
30175 (or <function>getipnodebyname()</function> when available)
30176 and are tried in order until one responds to the query. If none respond, what
30177 happens is controlled by <option>optional</option>.
30180 <indexterm role="option">
30181 <primary>optional</primary>
30184 <informaltable frame="all">
30185 <tgroup cols="4" colsep="0" rowsep="0">
30186 <colspec colwidth="8*" align="left"/>
30187 <colspec colwidth="5*" align="center"/>
30188 <colspec colwidth="5*" align="center"/>
30189 <colspec colwidth="6*" align="right"/>
30192 <entry><option>optional</option></entry>
30193 <entry>Use: <emphasis>iplookup</emphasis></entry>
30194 <entry>Type: <emphasis>boolean</emphasis></entry>
30195 <entry>Default: <emphasis>false</emphasis></entry>
30201 If <option>optional</option> is true, if no response is obtained from any host, the address
30202 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
30203 delivery to the address is deferred.
30206 <indexterm role="option">
30207 <primary>port</primary>
30210 <informaltable frame="all">
30211 <tgroup cols="4" colsep="0" rowsep="0">
30212 <colspec colwidth="8*" align="left"/>
30213 <colspec colwidth="5*" align="center"/>
30214 <colspec colwidth="5*" align="center"/>
30215 <colspec colwidth="6*" align="right"/>
30218 <entry><option>port</option></entry>
30219 <entry>Use: <emphasis>iplookup</emphasis></entry>
30220 <entry>Type: <emphasis>integer</emphasis></entry>
30221 <entry>Default: <emphasis>0</emphasis></entry>
30227 <indexterm role="concept">
30228 <primary>port</primary>
30229 <secondary><command>iplookup</command> router</secondary>
30231 This option must be supplied. It specifies the port number for the TCP or UDP
30235 <indexterm role="option">
30236 <primary>protocol</primary>
30239 <informaltable frame="all">
30240 <tgroup cols="4" colsep="0" rowsep="0">
30241 <colspec colwidth="8*" align="left"/>
30242 <colspec colwidth="5*" align="center"/>
30243 <colspec colwidth="5*" align="center"/>
30244 <colspec colwidth="6*" align="right"/>
30247 <entry><option>protocol</option></entry>
30248 <entry>Use: <emphasis>iplookup</emphasis></entry>
30249 <entry>Type: <emphasis>string</emphasis></entry>
30250 <entry>Default: <emphasis>udp</emphasis></entry>
30256 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
30257 protocols is to be used.
30260 <indexterm role="option">
30261 <primary>query</primary>
30264 <informaltable frame="all">
30265 <tgroup cols="4" colsep="0" rowsep="0">
30266 <colspec colwidth="8*" align="left"/>
30267 <colspec colwidth="5*" align="center"/>
30268 <colspec colwidth="5*" align="center"/>
30269 <colspec colwidth="6*" align="right"/>
30272 <entry><option>query</option></entry>
30273 <entry>Use: <emphasis>iplookup</emphasis></entry>
30274 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30275 <entry>Default: <emphasis><literal>$local_part@$domain $local_part@$domain</literal></emphasis></entry>
30281 This defines the content of the query that is sent to the remote hosts. The
30282 repetition serves as a way of checking that a response is to the correct query
30283 in the default case (see <option>response_pattern</option> below).
30286 <indexterm role="option">
30287 <primary>reroute</primary>
30290 <informaltable frame="all">
30291 <tgroup cols="4" colsep="0" rowsep="0">
30292 <colspec colwidth="8*" align="left"/>
30293 <colspec colwidth="5*" align="center"/>
30294 <colspec colwidth="5*" align="center"/>
30295 <colspec colwidth="6*" align="right"/>
30298 <entry><option>reroute</option></entry>
30299 <entry>Use: <emphasis>iplookup</emphasis></entry>
30300 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30301 <entry>Default: <emphasis>unset</emphasis></entry>
30307 If this option is not set, the rerouted address is precisely the byte string
30308 returned by the remote host, up to the first white space, if any. If set, the
30309 string is expanded to form the rerouted address. It can include parts matched
30310 in the response by <option>response_pattern</option> by means of numeric variables such as
30311 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
30312 whether or not a pattern is in use. In all cases, the rerouted address must end
30313 up in the form <emphasis>local_part@domain</emphasis>.
30316 <indexterm role="option">
30317 <primary>response_pattern</primary>
30320 <informaltable frame="all">
30321 <tgroup cols="4" colsep="0" rowsep="0">
30322 <colspec colwidth="8*" align="left"/>
30323 <colspec colwidth="5*" align="center"/>
30324 <colspec colwidth="5*" align="center"/>
30325 <colspec colwidth="6*" align="right"/>
30328 <entry><option>response_pattern</option></entry>
30329 <entry>Use: <emphasis>iplookup</emphasis></entry>
30330 <entry>Type: <emphasis>string</emphasis></entry>
30331 <entry>Default: <emphasis>unset</emphasis></entry>
30337 This option can be set to a regular expression that is applied to the string
30338 returned from the remote host. If the pattern does not match the response, the
30339 router declines. If <option>response_pattern</option> is not set, no checking of the
30340 response is done, unless the query was defaulted, in which case there is a
30341 check that the text returned after the first white space is the original
30342 address. This checks that the answer that has been received is in response to
30343 the correct question. For example, if the response is just a new domain, the
30344 following could be used:
30346 <literallayout class="monospaced">
30347 response_pattern = ^([^@]+)$
30348 reroute = $local_part@$1
30351 <indexterm role="option">
30352 <primary>timeout</primary>
30355 <informaltable frame="all">
30356 <tgroup cols="4" colsep="0" rowsep="0">
30357 <colspec colwidth="8*" align="left"/>
30358 <colspec colwidth="5*" align="center"/>
30359 <colspec colwidth="5*" align="center"/>
30360 <colspec colwidth="6*" align="right"/>
30363 <entry><option>timeout</option></entry>
30364 <entry>Use: <emphasis>iplookup</emphasis></entry>
30365 <entry>Type: <emphasis>time</emphasis></entry>
30366 <entry>Default: <emphasis>5s</emphasis></entry>
30372 This specifies the amount of time to wait for a response from the remote
30373 machine. The same timeout is used for the <function>connect()</function> function for a TCP
30374 call. It does not apply to UDP.
30379 <title>The manualroute router</title>
30381 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
30382 <primary><command>manualroute</command> router</primary>
30384 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
30385 <primary>routers</primary>
30386 <secondary><command>manualroute</command></secondary>
30388 <indexterm role="concept">
30389 <primary>domain</primary>
30390 <secondary>manually routing</secondary>
30392 The <command>manualroute</command> router is so-called because it provides a way of manually
30393 routing an address according to its domain. It is mainly used when you want to
30394 route addresses to remote hosts according to your own rules, bypassing the
30395 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
30396 route to local transports, a facility that may be useful if you want to save
30397 messages for dial-in hosts in local files.
30400 The <command>manualroute</command> router compares a list of domain patterns with the domain
30401 it is trying to route. If there is no match, the router declines. Each pattern
30402 has associated with it a list of hosts and some other optional data, which may
30403 include a transport. The combination of a pattern and its data is called a
30404 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
30405 generic <option>transport</option> option must specify a transport, unless the router is
30406 being used purely for verification (see <option>verify_only</option>).
30409 <indexterm role="concept">
30410 <primary><varname>$host</varname></primary>
30412 In the case of verification, matching the domain pattern is sufficient for the
30413 router to accept the address. When actually routing an address for delivery,
30414 an address that matches a domain pattern is queued for the associated
30415 transport. If the transport is not a local one, a host list must be associated
30416 with the pattern; IP addresses are looked up for the hosts, and these are
30417 passed to the transport along with the mail address. For local transports, a
30418 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
30422 The list of routing rules can be provided as an inline string in
30423 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
30424 or database by setting <option>route_data</option>. Only one of these settings may appear in
30425 any one instance of <command>manualroute</command>. The format of routing rules is described
30426 below, following the list of private options.
30428 <section id="SECTprioptman">
30429 <title>Private options for manualroute</title>
30431 <indexterm role="concept">
30432 <primary>options</primary>
30433 <secondary><command>manualroute</command> router</secondary>
30435 The private options for the <command>manualroute</command> router are as follows:
30438 <indexterm role="option">
30439 <primary>host_find_failed</primary>
30442 <informaltable frame="all">
30443 <tgroup cols="4" colsep="0" rowsep="0">
30444 <colspec colwidth="8*" align="left"/>
30445 <colspec colwidth="5*" align="center"/>
30446 <colspec colwidth="5*" align="center"/>
30447 <colspec colwidth="6*" align="right"/>
30450 <entry><option>host_find_failed</option></entry>
30451 <entry>Use: <emphasis>manualroute</emphasis></entry>
30452 <entry>Type: <emphasis>string</emphasis></entry>
30453 <entry>Default: <emphasis>freeze</emphasis></entry>
30459 This option controls what happens when <command>manualroute</command> tries to find an IP
30460 address for a host, and the host does not exist. The option can be set to one
30463 <literallayout class="monospaced">
30471 The default assumes that this state is a serious configuration error. The
30472 difference between <quote>pass</quote> and <quote>decline</quote> is that the former forces the
30473 address to be passed to the next router (or the router defined by
30474 <option>pass_router</option>),
30475 <indexterm role="concept">
30476 <primary><option>more</option> option</primary>
30478 overriding <option>no_more</option>, whereas the latter passes the address to the next
30479 router only if <option>more</option> is true.
30482 This option applies only to a definite <quote>does not exist</quote> state; if a host
30483 lookup gets a temporary error, delivery is deferred unless the generic
30484 <option>pass_on_timeout</option> option is set.
30487 <indexterm role="option">
30488 <primary>hosts_randomize</primary>
30491 <informaltable frame="all">
30492 <tgroup cols="4" colsep="0" rowsep="0">
30493 <colspec colwidth="8*" align="left"/>
30494 <colspec colwidth="5*" align="center"/>
30495 <colspec colwidth="5*" align="center"/>
30496 <colspec colwidth="6*" align="right"/>
30499 <entry><option>hosts_randomize</option></entry>
30500 <entry>Use: <emphasis>manualroute</emphasis></entry>
30501 <entry>Type: <emphasis>boolean</emphasis></entry>
30502 <entry>Default: <emphasis>false</emphasis></entry>
30508 <indexterm role="concept">
30509 <primary>randomized host list</primary>
30511 <indexterm role="concept">
30512 <primary>host</primary>
30513 <secondary>list of; randomized</secondary>
30515 If this option is set, the order of the items in a host list in a routing rule
30516 is randomized each time the list is used, unless an option in the routing rule
30517 overrides (see below). Randomizing the order of a host list can be used to do
30518 crude load sharing. However, if more than one mail address is routed by the
30519 same router to the same host list, the host lists are considered to be the same
30520 (even though they may be randomized into different orders) for the purpose of
30521 deciding whether to batch the deliveries into a single SMTP transaction.
30524 When <option>hosts_randomize</option> is true, a host list may be split
30525 into groups whose order is separately randomized. This makes it possible to
30526 set up MX-like behaviour. The boundaries between groups are indicated by an
30527 item that is just <literal>+</literal> in the host list. For example:
30529 <literallayout class="monospaced">
30530 route_list = * host1:host2:host3:+:host4:host5
30533 The order of the first three hosts and the order of the last two hosts is
30534 randomized for each use, but the first three always end up before the last two.
30535 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
30536 randomized host list is passed to an <command>smtp</command> transport that also has
30537 <option>hosts_randomize set</option>, the list is not re-randomized.
30540 <indexterm role="option">
30541 <primary>route_data</primary>
30544 <informaltable frame="all">
30545 <tgroup cols="4" colsep="0" rowsep="0">
30546 <colspec colwidth="8*" align="left"/>
30547 <colspec colwidth="5*" align="center"/>
30548 <colspec colwidth="5*" align="center"/>
30549 <colspec colwidth="6*" align="right"/>
30552 <entry><option>route_data</option></entry>
30553 <entry>Use: <emphasis>manualroute</emphasis></entry>
30554 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30555 <entry>Default: <emphasis>unset</emphasis></entry>
30561 If this option is set, it must expand to yield the data part of a routing rule.
30562 Typically, the expansion string includes a lookup based on the domain. For
30565 <literallayout class="monospaced">
30566 route_data = ${lookup{$domain}dbm{/etc/routes}}
30569 If the expansion is forced to fail, or the result is an empty string, the
30570 router declines. Other kinds of expansion failure cause delivery to be
30574 <indexterm role="option">
30575 <primary>route_list</primary>
30578 <informaltable frame="all">
30579 <tgroup cols="4" colsep="0" rowsep="0">
30580 <colspec colwidth="8*" align="left"/>
30581 <colspec colwidth="5*" align="center"/>
30582 <colspec colwidth="5*" align="center"/>
30583 <colspec colwidth="6*" align="right"/>
30586 <entry><option>route_list</option></entry>
30587 <entry>Use: <emphasis>manualroute</emphasis></entry>
30588 <entry>Type: <emphasis> </emphasis></entry>
30589 <entry>Default: <emphasis>string</emphasis></entry>
30595 This string is a list of routing rules, in the form defined below. Note that,
30596 unlike most string lists, the items are separated by semicolons. This is so
30597 that they may contain colon-separated host lists.
30600 <indexterm role="option">
30601 <primary>same_domain_copy_routing</primary>
30604 <informaltable frame="all">
30605 <tgroup cols="4" colsep="0" rowsep="0">
30606 <colspec colwidth="8*" align="left"/>
30607 <colspec colwidth="5*" align="center"/>
30608 <colspec colwidth="5*" align="center"/>
30609 <colspec colwidth="6*" align="right"/>
30612 <entry><option>same_domain_copy_routing</option></entry>
30613 <entry>Use: <emphasis>manualroute</emphasis></entry>
30614 <entry>Type: <emphasis>boolean</emphasis></entry>
30615 <entry>Default: <emphasis>false</emphasis></entry>
30621 <indexterm role="concept">
30622 <primary>address</primary>
30623 <secondary>copying routing</secondary>
30625 Addresses with the same domain are normally routed by the <command>manualroute</command>
30626 router to the same list of hosts. However, this cannot be presumed, because the
30627 router options and preconditions may refer to the local part of the address. By
30628 default, therefore, Exim routes each address in a message independently. DNS
30629 servers run caches, so repeated DNS lookups are not normally expensive, and in
30630 any case, personal messages rarely have more than a few recipients.
30633 If you are running mailing lists with large numbers of subscribers at the same
30634 domain, and you are using a <command>manualroute</command> router which is independent of the
30635 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
30636 lookups for identical domains in one message. In this case, when
30637 <command>manualroute</command> routes an address to a remote transport, any other unrouted
30638 addresses in the message that have the same domain are automatically given the
30639 same routing without processing them independently. However, this is only done
30640 if <option>headers_add</option> and <option>headers_remove</option> are unset.
30644 <title>Routing rules in route_list</title>
30646 The value of <option>route_list</option> is a string consisting of a sequence of routing
30647 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
30648 entered as two semicolons. Alternatively, the list separator can be changed as
30649 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
30650 Empty rules are ignored. The format of each rule is
30653 <<emphasis>domain pattern</emphasis>> <<emphasis>list of hosts</emphasis>> <<emphasis>options</emphasis>>
30656 The following example contains two rules, each with a simple domain pattern and
30659 <literallayout class="monospaced">
30661 dict.ref.example mail-1.ref.example:mail-2.ref.example ; \
30662 thes.ref.example mail-3.ref.example:mail-4.ref.example
30665 The three parts of a rule are separated by white space. The pattern and the
30666 list of hosts can be enclosed in quotes if necessary, and if they are, the
30667 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
30668 single domain pattern, which is the only mandatory item in the rule. The
30669 pattern is in the same format as one item in a domain list (see section
30670 <xref linkend="SECTdomainlist"/>),
30671 except that it may not be the name of an interpolated file.
30672 That is, it may be wildcarded, or a regular expression, or a file or database
30673 lookup (with semicolons doubled, because of the use of semicolon as a separator
30674 in a <option>route_list</option>).
30677 The rules in <option>route_list</option> are searched in order until one of the patterns
30678 matches the domain that is being routed. The list of hosts and then options are
30679 then used as described below. If there is no match, the router declines. When
30680 <option>route_list</option> is set, <option>route_data</option> must not be set.
30684 <title>Routing rules in route_data</title>
30686 The use of <option>route_list</option> is convenient when there are only a small number of
30687 routing rules. For larger numbers, it is easier to use a file or database to
30688 hold the routing information, and use the <option>route_data</option> option instead.
30689 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
30690 Most commonly, <option>route_data</option> is set as a string that contains an
30691 expansion lookup. For example, suppose we place two routing rules in a file
30694 <literallayout class="monospaced">
30695 dict.ref.example: mail-1.ref.example:mail-2.ref.example
30696 thes.ref.example: mail-3.ref.example:mail-4.ref.example
30699 This data can be accessed by setting
30701 <literallayout class="monospaced">
30702 route_data = ${lookup{$domain}lsearch{/the/file/name}}
30705 Failure of the lookup results in an empty string, causing the router to
30706 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
30707 requirement is that the result of expanding the string is a list of hosts,
30708 possibly followed by options, separated by white space. The list of hosts must
30709 be enclosed in quotes if it contains white space.
30713 <title>Format of the list of hosts</title>
30715 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
30716 always separately expanded before use. If the expansion fails, the router
30717 declines. The result of the expansion must be a colon-separated list of names
30718 and/or IP addresses, optionally also including ports. The format of each item
30719 in the list is described in the next section. The list separator can be changed
30720 as described in section <xref linkend="SECTlistconstruct"/>.
30723 If the list of hosts was obtained from a <option>route_list</option> item, the following
30724 variables are set during its expansion:
30729 <indexterm role="concept">
30730 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
30731 <secondary>in <command>manualroute</command> router</secondary>
30733 If the domain was matched against a regular expression, the numeric variables
30734 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
30736 <literallayout class="monospaced">
30737 route_list = ^domain(\d+) host-$1.text.example
30742 <varname>$0</varname> is always set to the entire domain.
30747 <varname>$1</varname> is also set when partial matching is done in a file lookup.
30752 <indexterm role="concept">
30753 <primary><varname>$value</varname></primary>
30755 If the pattern that matched the domain was a lookup item, the data that was
30756 looked up is available in the expansion variable <varname>$value</varname>. For example:
30758 <literallayout class="monospaced">
30759 route_list = lsearch;;/some/file.routes $value
30764 Note the doubling of the semicolon in the pattern that is necessary because
30765 semicolon is the default route list separator.
30768 <section id="SECTformatonehostitem">
30769 <title>Format of one host item</title>
30771 Each item in the list of hosts is either a host name or an IP address,
30772 optionally with an attached port number. When no port is given, an IP address
30773 is not enclosed in brackets. When a port is specified, it overrides the port
30774 specification on the transport. The port is separated from the name or address
30775 by a colon. This leads to some complications:
30780 Because colon is the default separator for the list of hosts, either
30781 the colon that specifies a port must be doubled, or the list separator must
30782 be changed. The following two examples have the same effect:
30784 <literallayout class="monospaced">
30785 route_list = * "host1.tld::1225 : host2.tld::1226"
30786 route_list = * "<+ host1.tld:1225 + host2.tld:1226"
30791 When IPv6 addresses are involved, it gets worse, because they contain
30792 colons of their own. To make this case easier, it is permitted to
30793 enclose an IP address (either v4 or v6) in square brackets if a port
30794 number follows. For example:
30796 <literallayout class="monospaced">
30797 route_list = * "</ [10.1.1.1]:1225 / [::1]:1226"
30802 <section id="SECThostshowused">
30803 <title>How the list of hosts is used</title>
30805 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
30806 the hosts is tried, in the order specified, when carrying out the SMTP
30807 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
30808 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
30812 Hosts may be listed by name or by IP address. An unadorned name in the list of
30813 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
30814 interpreted as an indirection to a sublist of hosts obtained by looking up MX
30815 records in the DNS. For example:
30817 <literallayout class="monospaced">
30818 route_list = * x.y.z:p.q.r/MX:e.f.g
30821 If this feature is used with a port specifier, the port must come last. For
30824 <literallayout class="monospaced">
30825 route_list = * dom1.tld/mx::1225
30828 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
30829 randomized before any lookups are done. Exim then scans the list; for any name
30830 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
30831 be an interface on the local host and the item is not the first in the list,
30832 Exim discards it and any subsequent items. If it is the first item, what
30833 happens is controlled by the
30834 <indexterm role="concept">
30835 <primary><option>self</option> option</primary>
30836 <secondary>in <command>manualroute</command> router</secondary>
30838 <option>self</option> option of the router.
30841 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
30842 hosts obtained by looking up MX records for the name. This is always a DNS
30843 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
30844 below) are not relevant here. The order of these hosts is determined by the
30845 preference values in the MX records, according to the usual rules. Because
30846 randomizing happens before the MX lookup, it does not affect the order that is
30847 defined by MX preferences.
30850 If the local host is present in the sublist obtained from MX records, but is
30851 not the most preferred host in that list, it and any equally or less
30852 preferred hosts are removed before the sublist is inserted into the main list.
30855 If the local host is the most preferred host in the MX list, what happens
30856 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
30857 is not the first item (that is, there are previous hosts in the main list),
30858 Exim discards this name and any subsequent items in the main list.
30861 If the MX item is first in the list of hosts, and the local host is the
30862 most preferred host, what happens is controlled by the <option>self</option> option of the
30866 DNS failures when lookup up the MX records are treated in the same way as DNS
30867 failures when looking up IP addresses: <option>pass_on_timeout</option> and
30868 <option>host_find_failed</option> are used when relevant.
30871 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
30872 whether obtained from an MX lookup or not.
30875 <section id="SECThowoptused">
30876 <title>How the options are used</title>
30878 The options are a sequence of words; in practice no more than three are ever
30879 present. One of the words can be the name of a transport; this overrides the
30880 <option>transport</option> option on the router for this particular routing rule only. The
30881 other words (if present) control randomization of the list of hosts on a
30882 per-rule basis, and how the IP addresses of the hosts are to be found when
30883 routing to a remote transport. These options are as follows:
30888 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
30889 setting of <option>hosts_randomize</option> for this routing rule only.
30894 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
30895 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
30900 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
30901 find IP addresses. This function may ultimately cause a DNS lookup, but it may
30902 also look in <filename>/etc/hosts</filename> or other sources of information.
30907 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
30908 no address records are found. If there is a temporary DNS error (such as a
30909 timeout), delivery is deferred.
30916 <literallayout class="monospaced">
30917 route_list = domain1 host1:host2:host3 randomize bydns;\
30918 domain2 host4:host5
30921 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
30922 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
30923 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
30924 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
30928 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
30929 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
30930 instead of TRY_AGAIN. That is why the default action is to try a DNS
30931 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
30935 If no IP address for a host can be found, what happens is controlled by the
30936 <option>host_find_failed</option> option.
30939 <indexterm role="concept">
30940 <primary><varname>$host</varname></primary>
30942 When an address is routed to a local transport, IP addresses are not looked up.
30943 The host list is passed to the transport in the <varname>$host</varname> variable.
30947 <title>Manualroute examples</title>
30949 In some of the examples that follow, the presence of the <option>remote_smtp</option>
30950 transport, as defined in the default configuration file, is assumed:
30955 <indexterm role="concept">
30956 <primary>smart host</primary>
30957 <secondary>example router</secondary>
30959 The <command>manualroute</command> router can be used to forward all external mail to a
30960 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
30961 named domain list that contains your local domains, for example:
30963 <literallayout class="monospaced">
30964 domainlist local_domains = my.domain.example
30967 You can arrange for all other domains to be routed to a smart host by making
30968 your first router something like this:
30970 <literallayout class="monospaced">
30972 driver = manualroute
30973 domains = !+local_domains
30974 transport = remote_smtp
30975 route_list = * smarthost.ref.example
30978 This causes all non-local addresses to be sent to the single host
30979 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
30980 they are tried in order
30981 (but you can use <option>hosts_randomize</option> to vary the order each time).
30982 Another way of configuring the same thing is this:
30984 <literallayout class="monospaced">
30986 driver = manualroute
30987 transport = remote_smtp
30988 route_list = !+local_domains smarthost.ref.example
30991 There is no difference in behaviour between these two routers as they stand.
30992 However, they behave differently if <option>no_more</option> is added to them. In the first
30993 example, the router is skipped if the domain does not match the <option>domains</option>
30994 precondition; the following router is always tried. If the router runs, it
30995 always matches the domain and so can never decline. Therefore, <option>no_more</option>
30996 would have no effect. In the second case, the router is never skipped; it
30997 always runs. However, if it doesn’t match the domain, it declines. In this case
30998 <option>no_more</option> would prevent subsequent routers from running.
31003 <indexterm role="concept">
31004 <primary>mail hub example</primary>
31006 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
31007 records in the DNS and delivers it via its own private routing mechanism. Often
31008 the final destinations are behind a firewall, with the mail hub being the one
31009 machine that can connect to machines both inside and outside the firewall. The
31010 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
31011 to the correct hosts. For a small number of domains, the routing can be inline,
31012 using the <option>route_list</option> option, but for a larger number a file or database
31013 lookup is easier to manage.
31016 If the domain names are in fact the names of the machines to which the mail is
31017 to be sent by the mail hub, the configuration can be quite simple. For
31020 <literallayout class="monospaced">
31022 driver = manualroute
31023 transport = remote_smtp
31024 route_list = *.rhodes.tvs.example $domain
31027 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
31028 whose names are the same as the mail domains. A similar approach can be taken
31029 if the host name can be obtained from the domain name by a string manipulation
31030 that the expansion facilities can handle. Otherwise, a lookup based on the
31031 domain can be used to find the host:
31033 <literallayout class="monospaced">
31035 driver = manualroute
31036 transport = remote_smtp
31037 route_data = ${lookup {$domain} cdb {/internal/host/routes}}
31040 The result of the lookup must be the name or IP address of the host (or
31041 hosts) to which the address is to be routed. If the lookup fails, the route
31042 data is empty, causing the router to decline. The address then passes to the
31048 <indexterm role="concept">
31049 <primary>batched SMTP output example</primary>
31051 <indexterm role="concept">
31052 <primary>SMTP</primary>
31053 <secondary>batched outgoing; example</secondary>
31055 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
31056 SMTP format for onward transportation by some other means. This is one way of
31057 storing mail for a dial-up host when it is not connected. The route list entry
31058 can be as simple as a single domain name in a configuration like this:
31060 <literallayout class="monospaced">
31062 driver = manualroute
31063 transport = batchsmtp_appendfile
31064 route_list = saved.domain.example
31067 though often a pattern is used to pick up more than one domain. If there are
31068 several domains or groups of domains with different transport requirements,
31069 different transports can be listed in the routing information:
31071 <literallayout class="monospaced">
31073 driver = manualroute
31075 *.saved.domain1.example $domain batch_appendfile; \
31076 *.saved.domain2.example \
31077 ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
31081 <indexterm role="concept">
31082 <primary><varname>$domain</varname></primary>
31084 <indexterm role="concept">
31085 <primary><varname>$host</varname></primary>
31087 The first of these just passes the domain in the <varname>$host</varname> variable, which
31088 doesn’t achieve much (since it is also in <varname>$domain</varname>), but the second does a
31089 file lookup to find a value to pass, causing the router to decline to handle
31090 the address if the lookup fails.
31095 <indexterm role="concept">
31096 <primary>UUCP</primary>
31097 <secondary>example of router for</secondary>
31099 Routing mail directly to UUCP software is a specific case of the use of
31100 <command>manualroute</command> in a gateway to another mail environment. This is an example of
31101 one way it can be done:
31103 <literallayout class="monospaced">
31108 command = /usr/local/bin/uux -r - \
31109 ${substr_-5:$host}!rmail ${local_part}
31110 return_fail_output = true
31115 driver = manualroute
31117 ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
31120 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
31122 <literallayout class="monospaced">
31123 darksite.ethereal.example: darksite.UUCP
31126 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
31127 makes clear the distinction between the domain name
31128 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
31133 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
31134 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
31139 <chapter id="CHAPdriverlast">
31140 <title>The queryprogram router</title>
31142 <indexterm role="concept" id="IIDquerou1" class="startofrange">
31143 <primary><command>queryprogram</command> router</primary>
31145 <indexterm role="concept" id="IIDquerou2" class="startofrange">
31146 <primary>routers</primary>
31147 <secondary><command>queryprogram</command></secondary>
31149 <indexterm role="concept">
31150 <primary>routing</primary>
31151 <secondary>by external program</secondary>
31153 The <command>queryprogram</command> router routes an address by running an external command
31154 and acting on its output. This is an expensive way to route, and is intended
31155 mainly for use in lightly-loaded systems, or for performing experiments.
31156 However, if it is possible to use the precondition options (<option>domains</option>,
31157 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
31158 be used in special cases, even on a busy host. There are the following private
31160 <indexterm role="concept">
31161 <primary>options</primary>
31162 <secondary><command>queryprogram</command> router</secondary>
31166 <indexterm role="option">
31167 <primary>command</primary>
31170 <informaltable frame="all">
31171 <tgroup cols="4" colsep="0" rowsep="0">
31172 <colspec colwidth="8*" align="left"/>
31173 <colspec colwidth="5*" align="center"/>
31174 <colspec colwidth="5*" align="center"/>
31175 <colspec colwidth="6*" align="right"/>
31178 <entry><option>command</option></entry>
31179 <entry>Use: <emphasis>queryprogram</emphasis></entry>
31180 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
31181 <entry>Default: <emphasis>unset</emphasis></entry>
31187 This option must be set. It specifies the command that is to be run. The
31188 command is split up into a command name and arguments, and then each is
31189 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
31190 <xref linkend="CHAPpipetransport"/>).
31193 <indexterm role="option">
31194 <primary>command_group</primary>
31197 <informaltable frame="all">
31198 <tgroup cols="4" colsep="0" rowsep="0">
31199 <colspec colwidth="8*" align="left"/>
31200 <colspec colwidth="5*" align="center"/>
31201 <colspec colwidth="5*" align="center"/>
31202 <colspec colwidth="6*" align="right"/>
31205 <entry><option>command_group</option></entry>
31206 <entry>Use: <emphasis>queryprogram</emphasis></entry>
31207 <entry>Type: <emphasis>string</emphasis></entry>
31208 <entry>Default: <emphasis>unset</emphasis></entry>
31214 <indexterm role="concept">
31215 <primary>gid (group id)</primary>
31216 <secondary>in <command>queryprogram</command> router</secondary>
31219 <para revisionflag="changed">
31220 This option specifies a gid to be set when running the command while routing an
31221 address for deliver. It must be set if <option>command_user</option> specifies a numerical
31222 uid. If it begins with a digit, it is interpreted as the numerical value of the
31223 gid. Otherwise it is looked up using <function>getgrnam()</function>.
31226 <indexterm role="option">
31227 <primary>command_user</primary>
31230 <informaltable frame="all">
31231 <tgroup cols="4" colsep="0" rowsep="0">
31232 <colspec colwidth="8*" align="left"/>
31233 <colspec colwidth="5*" align="center"/>
31234 <colspec colwidth="5*" align="center"/>
31235 <colspec colwidth="6*" align="right"/>
31238 <entry><option>command_user</option></entry>
31239 <entry>Use: <emphasis>queryprogram</emphasis></entry>
31240 <entry>Type: <emphasis>string</emphasis></entry>
31241 <entry>Default: <emphasis>unset</emphasis></entry>
31247 <indexterm role="concept">
31248 <primary>uid (user id)</primary>
31249 <secondary>for <command>queryprogram</command></secondary>
31252 <para revisionflag="changed">
31253 This option must be set. It specifies the uid which is set when running the
31254 command while routing an address for delivery. If the value begins with a digit,
31255 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
31256 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
31257 not set, a value for the gid also.
31259 <para revisionflag="changed">
31260 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
31261 root, which it does during a normal delivery in a conventional configuration.
31262 However, when an address is being verified during message reception, Exim is
31263 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
31264 is called from a non-root process, Exim cannot change uid or gid before running
31265 the command. In this circumstance the command runs under the current uid and
31269 <indexterm role="option">
31270 <primary>current_directory</primary>
31273 <informaltable frame="all">
31274 <tgroup cols="4" colsep="0" rowsep="0">
31275 <colspec colwidth="8*" align="left"/>
31276 <colspec colwidth="5*" align="center"/>
31277 <colspec colwidth="5*" align="center"/>
31278 <colspec colwidth="6*" align="right"/>
31281 <entry><option>current_directory</option></entry>
31282 <entry>Use: <emphasis>queryprogram</emphasis></entry>
31283 <entry>Type: <emphasis>string</emphasis></entry>
31284 <entry>Default: <emphasis>/</emphasis></entry>
31290 This option specifies an absolute path which is made the current directory
31291 before running the command.
31294 <indexterm role="option">
31295 <primary>timeout</primary>
31298 <informaltable frame="all">
31299 <tgroup cols="4" colsep="0" rowsep="0">
31300 <colspec colwidth="8*" align="left"/>
31301 <colspec colwidth="5*" align="center"/>
31302 <colspec colwidth="5*" align="center"/>
31303 <colspec colwidth="6*" align="right"/>
31306 <entry><option>timeout</option></entry>
31307 <entry>Use: <emphasis>queryprogram</emphasis></entry>
31308 <entry>Type: <emphasis>time</emphasis></entry>
31309 <entry>Default: <emphasis>1h</emphasis></entry>
31315 If the command does not complete within the timeout period, its process group
31316 is killed and the message is frozen. A value of zero time specifies no
31320 The standard output of the command is connected to a pipe, which is read when
31321 the command terminates. It should consist of a single line of output,
31322 containing up to five fields, separated by white space. The maximum length of
31323 the line is 1023 characters. Longer lines are silently truncated. The first
31324 field is one of the following words (case-insensitive):
31329 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
31335 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
31336 <option>no_more</option> is set.
31341 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
31342 subsequent text on the line is an error message. If the router is run as part
31343 of address verification during an incoming SMTP message, the message is
31344 included in the SMTP response.
31349 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
31350 subsequent text on the line is an error message which is logged. It is not
31351 included in any SMTP response.
31356 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
31361 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
31362 <option>pass_router</option>), overriding <option>no_more</option>.
31367 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
31368 new addresses, which are routed independently, starting with the first router,
31369 or the router specified by <option>redirect_router</option>, if set.
31374 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
31375 number of keyed data values, as follows (split into two lines here, to fit on
31378 <literallayout class="monospaced">
31379 ACCEPT TRANSPORT=<transport> HOSTS=<list of hosts>
31380 LOOKUP=byname|bydns DATA=<text>
31383 The data items can be given in any order, and all are optional. If no transport
31384 is included, the transport specified by the generic <option>transport</option> option is
31385 used. The list of hosts and the lookup type are needed only if the transport is
31386 an <command>smtp</command> transport that does not itself supply a list of hosts.
31389 The format of the list of hosts is the same as for the <command>manualroute</command> router.
31390 As well as host names and IP addresses with optional port numbers, as described
31391 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
31392 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
31393 (see section <xref linkend="SECThostshowused"/>).
31396 If the lookup type is not specified, Exim behaves as follows when trying to
31397 find an IP address for each host: First, a DNS lookup is done. If this yields
31398 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
31399 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
31400 result of the lookup is the result of that call.
31403 <indexterm role="concept">
31404 <primary><varname>$address_data</varname></primary>
31406 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
31407 variable. For example, this return line
31409 <literallayout class="monospaced">
31410 accept hosts=x1.y.example:x2.y.example data="rule1"
31413 routes the address to the default transport, passing a list of two hosts. When
31414 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
31415 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
31416 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
31420 <chapter id="CHAPredirect">
31421 <title>The redirect router</title>
31423 <indexterm role="concept" id="IIDredrou1" class="startofrange">
31424 <primary><command>redirect</command> router</primary>
31426 <indexterm role="concept" id="IIDredrou2" class="startofrange">
31427 <primary>routers</primary>
31428 <secondary><command>redirect</command></secondary>
31430 <indexterm role="concept">
31431 <primary>alias file</primary>
31432 <secondary>in a <command>redirect</command> router</secondary>
31434 <indexterm role="concept">
31435 <primary>address redirection</primary>
31436 <secondary><command>redirect</command> router</secondary>
31438 The <command>redirect</command> router handles several kinds of address redirection. Its most
31439 common uses are for resolving local part aliases from a central alias file
31440 (usually called <filename>/etc/aliases</filename>) and for handling users’ personal <filename>.forward</filename>
31441 files, but it has many other potential uses. The incoming address can be
31442 redirected in several different ways:
31447 It can be replaced by one or more new addresses which are themselves routed
31453 It can be routed to be delivered to a given file or directory.
31458 It can be routed to be delivered to a specified pipe command.
31463 It can cause an automatic reply to be generated.
31468 It can be forced to fail, with a custom error message.
31473 It can be temporarily deferred.
31478 It can be discarded.
31483 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
31484 However, there are some private options which define transports for delivery to
31485 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
31486 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
31489 <title>Redirection data</title>
31491 The router operates by interpreting a text string which it obtains either by
31492 expanding the contents of the <option>data</option> option, or by reading the entire
31493 contents of a file whose name is given in the <option>file</option> option. These two
31494 options are mutually exclusive. The first is commonly used for handling system
31495 aliases, in a configuration like this:
31497 <literallayout class="monospaced">
31500 data = ${lookup{$local_part}lsearch{/etc/aliases}}
31503 If the lookup fails, the expanded string in this example is empty. When the
31504 expansion of <option>data</option> results in an empty string, the router declines. A forced
31505 expansion failure also causes the router to decline; other expansion failures
31506 cause delivery to be deferred.
31509 A configuration using <option>file</option> is commonly used for handling users’
31510 <filename>.forward</filename> files, like this:
31512 <literallayout class="monospaced">
31516 file = $home/.forward
31520 If the file does not exist, or causes no action to be taken (for example, it is
31521 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
31522 is not the case when the file contains syntactically valid items that happen to
31523 yield empty addresses, for example, items containing only RFC 2822 address
31528 <title>Forward files and address verification</title>
31530 <indexterm role="concept">
31531 <primary>address redirection</primary>
31532 <secondary>while verifying</secondary>
31534 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users’
31535 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
31540 When Exim is receiving an incoming SMTP message from a remote host, it is
31541 running under the Exim uid, not as root.
31542 No additional groups are set up, even if the Exim uid is a member of other
31543 groups (that is, the <function>initgroups()</function> function is not run).
31544 Exim is unable to change uid to read the file as the user, and it may not be
31545 able to read it as the Exim user. So in practice the router may not be able to
31551 However, even when the router can operate, the existence of a <filename>.forward</filename> file
31552 is unimportant when verifying an address. What should be checked is whether the
31553 local part is a valid user name or not. Cutting out the redirection processing
31554 saves some resources.
31560 <title>Interpreting redirection data</title>
31562 <indexterm role="concept">
31563 <primary>Sieve filter</primary>
31564 <secondary>specifying in redirection data</secondary>
31566 <indexterm role="concept">
31567 <primary>filter</primary>
31568 <secondary>specifying in redirection data</secondary>
31570 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
31571 can be interpreted in two different ways:
31576 If the <option>allow_filter</option> option is set true, and the data begins with the text
31577 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
31578 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
31579 respectively. Details of the syntax and semantics of filter files are described
31580 in a separate document entitled <emphasis>Exim’s interfaces to mail filtering</emphasis>; this
31581 document is intended for use by end users.
31586 Otherwise, the data must be a comma-separated list of redirection items, as
31587 described in the next section.
31592 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
31593 in a non-filter redirection list must always be an absolute path. A filter may
31594 generate a relative path – how this is handled depends on the transport’s
31595 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
31596 for the <command>appendfile</command> transport.
31599 <section id="SECTitenonfilred">
31600 <title>Items in a non-filter redirection list</title>
31602 <indexterm role="concept">
31603 <primary>address redirection</primary>
31604 <secondary>non-filter list items</secondary>
31606 When the redirection data is not an Exim or Sieve filter, for example, if it
31607 comes from a conventional alias or forward file, it consists of a list of
31608 addresses, file names, pipe commands, or certain special items (see section
31609 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
31610 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
31611 depending on their default values. The items in the list are separated by
31612 commas or newlines.
31613 If a comma is required in an item, the entire item must be enclosed in double
31617 Lines starting with a # character are comments, and are ignored, and # may
31618 also appear following a comma, in which case everything between the # and the
31619 next newline character is ignored.
31622 If an item is entirely enclosed in double quotes, these are removed. Otherwise
31623 double quotes are retained because some forms of mail address require their use
31624 (but never to enclose the entire address). In the following description,
31625 <quote>item</quote> refers to what remains after any surrounding double quotes have been
31629 <indexterm role="concept">
31630 <primary><varname>$local_part</varname></primary>
31632 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
31633 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
31634 of the <option>quote_local_part</option> expansion operator, in case the local part contains
31635 special characters. For example, to redirect all mail for the domain
31636 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
31639 <literallayout class="monospaced">
31640 data = ${quote_local_part:$local_part}@newdomain.example
31643 <section id="SECTredlocmai">
31644 <title>Redirecting to a local mailbox</title>
31646 <indexterm role="concept">
31647 <primary>routing</primary>
31648 <secondary>loops in</secondary>
31650 <indexterm role="concept">
31651 <primary>loop while routing</primary>
31652 <secondary>avoidance of</secondary>
31654 <indexterm role="concept">
31655 <primary>address redirection</primary>
31656 <secondary>to local mailbox</secondary>
31658 A redirection item may safely be the same as the address currently under
31659 consideration. This does not cause a routing loop, because a router is
31660 automatically skipped if any ancestor of the address that is being processed
31661 is the same as the current address and was processed by the current router.
31662 Such an address is therefore passed to the following routers, so it is handled
31663 as if there were no redirection. When making this loop-avoidance test, the
31664 complete local part, including any prefix or suffix, is used.
31667 <indexterm role="concept">
31668 <primary>address redirection</primary>
31669 <secondary>local part without domain</secondary>
31671 Specifying the same local part without a domain is a common usage in personal
31672 filter files when the user wants to have messages delivered to the local
31673 mailbox and also forwarded elsewhere. For example, the user whose login is
31674 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
31676 <literallayout class="monospaced">
31677 cleo, cleopatra@egypt.example
31680 <indexterm role="concept">
31681 <primary>backslash in alias file</primary>
31683 <indexterm role="concept">
31684 <primary>alias file</primary>
31685 <secondary>backslash in</secondary>
31687 For compatibility with other MTAs, such unqualified local parts may be
31688 preceeded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
31689 it does make a difference if more than one domain is being handled
31693 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
31694 2822 address that does not include a domain, the item is qualified using the
31695 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
31696 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
31697 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
31700 Care must be taken if there are alias names for local users.
31701 Consider an MTA handling a single local domain where the system alias file
31704 <literallayout class="monospaced">
31708 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
31709 messages in the local mailbox, and also forward copies elsewhere. He creates
31712 <literallayout class="monospaced">
31713 Sam.Reman, spqr@reme.elsewhere.example
31716 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
31717 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
31718 second time round, because it has previously routed it,
31719 and the following routers presumably cannot handle the alias. The forward file
31720 should really contain
31722 <literallayout class="monospaced">
31723 spqr, spqr@reme.elsewhere.example
31726 but because this is such a common error, the <option>check_ancestor</option> option (see
31727 below) exists to provide a way to get round it. This is normally set on a
31728 <command>redirect</command> router that is handling users’ <filename>.forward</filename> files.
31731 <section id="SECTspecitredli">
31732 <title>Special items in redirection lists</title>
31734 In addition to addresses, the following types of item may appear in redirection
31735 lists (that is, in non-filter redirection data):
31740 <indexterm role="concept">
31741 <primary>pipe</primary>
31742 <secondary>in redirection list</secondary>
31744 <indexterm role="concept">
31745 <primary>address redirection</primary>
31746 <secondary>to pipe</secondary>
31748 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
31749 as a valid RFC 2822 address that includes a domain. A transport for running the
31750 command must be specified by the <option>pipe_transport</option> option.
31751 Normally, either the router or the transport specifies a user and a group under
31752 which to run the delivery. The default is to use the Exim user and group.
31755 Single or double quotes can be used for enclosing the individual arguments of
31756 the pipe command; no interpretation of escapes is done for single quotes. If
31757 the command contains a comma character, it is necessary to put the whole item
31758 in double quotes, for example:
31760 <literallayout class="monospaced">
31761 "|/some/command ready,steady,go"
31764 since items in redirection lists are terminated by commas. Do not, however,
31765 quote just the command. An item such as
31767 <literallayout class="monospaced">
31768 |"/some/command ready,steady,go"
31771 is interpreted as a pipe with a rather strange command name, and no arguments.
31776 <indexterm role="concept">
31777 <primary>file</primary>
31778 <secondary>in redirection list</secondary>
31780 <indexterm role="concept">
31781 <primary>address redirection</primary>
31782 <secondary>to file</secondary>
31784 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
31785 parse as a valid RFC 2822 address that includes a domain. For example,
31787 <literallayout class="monospaced">
31788 /home/world/minbari
31791 is treated as a file name, but
31793 <literallayout class="monospaced">
31794 /s=molari/o=babylon/@x400gate.way
31797 is treated as an address. For a file name, a transport must be specified using
31798 the <option>file_transport</option> option. However, if the generated path name ends with a
31799 forward slash character, it is interpreted as a directory name rather than a
31800 file name, and <option>directory_transport</option> is used instead.
31803 Normally, either the router or the transport specifies a user and a group under
31804 which to run the delivery. The default is to use the Exim user and group.
31807 <indexterm role="concept">
31808 <primary><filename>/dev/null</filename></primary>
31810 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
31811 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
31812 instead of a transport name. In this case the user and group are not used.
31817 <indexterm role="concept">
31818 <primary>included address list</primary>
31820 <indexterm role="concept">
31821 <primary>address redirection</primary>
31822 <secondary>included external list</secondary>
31824 If an item is of the form
31826 <literallayout class="monospaced">
31827 :include:<path name>
31830 a list of further items is taken from the given file and included at that
31831 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
31832 out-of-line addition to the list. The items in the included list are separated
31833 by commas or newlines and are not subject to expansion. If this is the first
31834 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
31835 the alias name. This example is incorrect:
31837 <literallayout class="monospaced">
31838 list1 :include:/opt/lists/list1
31841 It must be given as
31843 <literallayout class="monospaced">
31844 list1: :include:/opt/lists/list1
31849 <indexterm role="concept">
31850 <primary>address redirection</primary>
31851 <secondary>to black hole</secondary>
31853 Sometimes you want to throw away mail to a particular local part. Making the
31854 <option>data</option> option expand to an empty string does not work, because that causes
31855 the router to decline. Instead, the alias item
31856 <indexterm role="concept">
31857 <primary>black hole</primary>
31859 <indexterm role="concept">
31860 <primary>abandoning mail</primary>
31863 <literallayout class="monospaced">
31867 can be used. It does what its name implies. No delivery is done, and no error
31868 message is generated. This has the same effect as specifing <filename>/dev/null</filename>, but
31869 can be independently disabled.
31872 <emphasis role="bold">Warning</emphasis>: If <literal>:blackhole:</literal> appears anywhere in a redirection list, no
31873 delivery is done for the original local part, even if other redirection items
31874 are present. If you are generating a multi-item list (for example, by reading a
31875 database) and need the ability to provide a no-op item, you must use
31876 <filename>/dev/null</filename>.
31881 <indexterm role="concept">
31882 <primary>delivery</primary>
31883 <secondary>forcing failure</secondary>
31885 <indexterm role="concept">
31886 <primary>delivery</primary>
31887 <secondary>forcing deferral</secondary>
31889 <indexterm role="concept">
31890 <primary>failing delivery</primary>
31891 <secondary>forcing</secondary>
31893 <indexterm role="concept">
31894 <primary>deferred delivery</primary>
31895 <secondary>forcing</secondary>
31897 <indexterm role="concept">
31898 <primary>customizing</primary>
31899 <secondary>failure message</secondary>
31901 An attempt to deliver a particular address can be deferred or forced to fail by
31902 redirection items of the form
31904 <literallayout class="monospaced">
31909 respectively. When a redirection list contains such an item, it applies to the
31910 entire redirection; any other items in the list are ignored (<emphasis>:blackhole:</emphasis> is
31911 different). Any text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error
31912 text associated with the failure. For example, an alias file might contain:
31914 <literallayout class="monospaced">
31915 X.Employee: :fail: Gone away, no forwarding address
31918 In the case of an address that is being verified from an ACL or as the subject
31920 <indexterm role="concept">
31921 <primary>VRFY error text</primary>
31922 <secondary>display of</secondary>
31924 VRFY command, the text is included in the SMTP error response by
31926 <indexterm role="concept">
31927 <primary>EXPN error text</primary>
31928 <secondary>display of</secondary>
31930 The text is not included in the response to an EXPN command.
31933 <indexterm role="concept">
31934 <primary><varname>$acl_verify_message</varname></primary>
31936 In an ACL, an explicitly provided message overrides the default, but the
31937 default message is available in the variable <varname>$acl_verify_message</varname> and can
31938 therefore be included in a custom message if this is desired. Exim sends a 451
31939 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for <emphasis>:fail:</emphasis>. In non-SMTP cases the text
31940 is included in the error message that Exim generates.
31943 Normally the error text is the rest of the redirection list – a comma does
31944 not terminate it – but a newline does act as a terminator. Newlines are not
31945 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
31946 as part of the continuation process, but they may exist in other kinds of
31947 lookup and in <emphasis>:include:</emphasis> files.
31950 During routing for message delivery (as opposed to verification), a redirection
31951 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
31952 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
31953 subsequent delivery attempt can happen at a later time. If an address is
31954 deferred for too long, it will ultimately fail, because the normal retry
31960 <indexterm role="concept">
31961 <primary>alias file</primary>
31962 <secondary>exception to default</secondary>
31964 Sometimes it is useful to use a single-key search type with a default (see
31965 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
31966 for exceptions to the default. These can be handled by aliasing them to
31968 <literallayout class="monospaced">
31972 This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command> router to
31973 decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which results in
31974 an empty redirection list has the same effect.
31980 <title>Duplicate addresses</title>
31982 <indexterm role="concept">
31983 <primary>duplicate addresses</primary>
31985 <indexterm role="concept">
31986 <primary>address duplicate</primary>
31987 <secondary>discarding</secondary>
31989 <indexterm role="concept">
31990 <primary>pipe</primary>
31991 <secondary>duplicated</secondary>
31993 Exim removes duplicate addresses from the list to which it is delivering, so as
31994 to deliver just one copy to each address. This does not apply to deliveries
31995 routed to pipes by different immediate parent addresses, but an indirect
31996 aliasing scheme of the type
31998 <literallayout class="monospaced">
31999 pipe: |/some/command $local_part
32004 does not work with a message that is addressed to both local parts, because
32005 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
32006 discarded as being the same as a previously handled address. However, a scheme
32009 <literallayout class="monospaced">
32010 localpart1: |/some/command $local_part
32011 localpart2: |/some/command $local_part
32014 does result in two different pipe deliveries, because the immediate parents of
32015 the pipes are distinct.
32019 <title>Repeated redirection expansion</title>
32021 <indexterm role="concept">
32022 <primary>repeated redirection expansion</primary>
32024 <indexterm role="concept">
32025 <primary>address redirection</primary>
32026 <secondary>repeated for each delivery attempt</secondary>
32028 When a message cannot be delivered to all of its recipients immediately,
32029 leading to two or more delivery attempts, redirection expansion is carried out
32030 afresh each time for those addresses whose children were not all previously
32031 delivered. If redirection is being used as a mailing list, this can lead to new
32032 members of the list receiving copies of old messages. The <option>one_time</option> option
32033 can be used to avoid this.
32037 <title>Errors in redirection lists</title>
32039 <indexterm role="concept">
32040 <primary>address redirection</primary>
32041 <secondary>errors</secondary>
32043 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
32044 error is skipped, and an entry is written to the main log. This may be useful
32045 for mailing lists that are automatically managed. Otherwise, if an error is
32046 detected while generating the list of new addresses, the original address is
32047 deferred. See also <option>syntax_errors_to</option>.
32051 <title>Private options for the redirect router</title>
32053 <indexterm role="concept">
32054 <primary>options</primary>
32055 <secondary><command>redirect</command> router</secondary>
32057 The private options for the <command>redirect</command> router are as follows:
32060 <indexterm role="option">
32061 <primary>allow_defer</primary>
32064 <informaltable frame="all">
32065 <tgroup cols="4" colsep="0" rowsep="0">
32066 <colspec colwidth="8*" align="left"/>
32067 <colspec colwidth="5*" align="center"/>
32068 <colspec colwidth="5*" align="center"/>
32069 <colspec colwidth="6*" align="right"/>
32072 <entry><option>allow_defer</option></entry>
32073 <entry>Use: <emphasis>redirect</emphasis></entry>
32074 <entry>Type: <emphasis>boolean</emphasis></entry>
32075 <entry>Default: <emphasis>false</emphasis></entry>
32081 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
32082 data, or the <option>defer</option> command in an Exim filter file.
32085 <indexterm role="option">
32086 <primary>allow_fail</primary>
32089 <informaltable frame="all">
32090 <tgroup cols="4" colsep="0" rowsep="0">
32091 <colspec colwidth="8*" align="left"/>
32092 <colspec colwidth="5*" align="center"/>
32093 <colspec colwidth="5*" align="center"/>
32094 <colspec colwidth="6*" align="right"/>
32097 <entry><option>allow_fail</option></entry>
32098 <entry>Use: <emphasis>redirect</emphasis></entry>
32099 <entry>Type: <emphasis>boolean</emphasis></entry>
32100 <entry>Default: <emphasis>false</emphasis></entry>
32106 <indexterm role="concept">
32107 <primary>failing delivery</primary>
32108 <secondary>from filter</secondary>
32110 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
32111 and the <option>fail</option> command may be used in an Exim filter file.
32114 <indexterm role="option">
32115 <primary>allow_filter</primary>
32118 <informaltable frame="all">
32119 <tgroup cols="4" colsep="0" rowsep="0">
32120 <colspec colwidth="8*" align="left"/>
32121 <colspec colwidth="5*" align="center"/>
32122 <colspec colwidth="5*" align="center"/>
32123 <colspec colwidth="6*" align="right"/>
32126 <entry><option>allow_filter</option></entry>
32127 <entry>Use: <emphasis>redirect</emphasis></entry>
32128 <entry>Type: <emphasis>boolean</emphasis></entry>
32129 <entry>Default: <emphasis>false</emphasis></entry>
32135 <indexterm role="concept">
32136 <primary>filter</primary>
32137 <secondary>enabling use of</secondary>
32139 <indexterm role="concept">
32140 <primary>Sieve filter</primary>
32141 <secondary>enabling use of</secondary>
32143 Setting this option allows Exim to interpret redirection data that starts with
32144 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
32145 are some features of Exim filter files that some administrators may wish to
32146 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
32149 It is also possible to lock out Exim filters or Sieve filters while allowing
32150 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
32153 The filter is run using the uid and gid set by the generic <option>user</option> and
32154 <option>group</option> options. These take their defaults from the password data if
32155 <option>check_local_user</option> is set, so in the normal case of users’ personal filter
32156 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
32157 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
32160 <indexterm role="option">
32161 <primary>allow_freeze</primary>
32164 <informaltable frame="all">
32165 <tgroup cols="4" colsep="0" rowsep="0">
32166 <colspec colwidth="8*" align="left"/>
32167 <colspec colwidth="5*" align="center"/>
32168 <colspec colwidth="5*" align="center"/>
32169 <colspec colwidth="6*" align="right"/>
32172 <entry><option>allow_freeze</option></entry>
32173 <entry>Use: <emphasis>redirect</emphasis></entry>
32174 <entry>Type: <emphasis>boolean</emphasis></entry>
32175 <entry>Default: <emphasis>false</emphasis></entry>
32181 <indexterm role="concept">
32182 <primary>freezing messages</primary>
32183 <secondary>allowing in filter</secondary>
32185 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
32186 This command is more normally encountered in system filters, and is disabled by
32187 default for redirection filters because it isn’t something you usually want to
32188 let ordinary users do.
32191 <indexterm role="option">
32192 <primary>check_ancestor</primary>
32195 <informaltable frame="all">
32196 <tgroup cols="4" colsep="0" rowsep="0">
32197 <colspec colwidth="8*" align="left"/>
32198 <colspec colwidth="5*" align="center"/>
32199 <colspec colwidth="5*" align="center"/>
32200 <colspec colwidth="6*" align="right"/>
32203 <entry><option>check_ancestor</option></entry>
32204 <entry>Use: <emphasis>redirect</emphasis></entry>
32205 <entry>Type: <emphasis>boolean</emphasis></entry>
32206 <entry>Default: <emphasis>false</emphasis></entry>
32212 This option is concerned with handling generated addresses that are the same
32213 as some address in the list of redirection ancestors of the current address.
32214 Although it is turned off by default in the code, it is set in the default
32215 configuration file for handling users’ <filename>.forward</filename> files. It is recommended
32216 for this use of the <command>redirect</command> router.
32219 When <option>check_ancestor</option> is set, if a generated address (including the domain)
32220 is the same as any ancestor of the current address, it is replaced by a copy of
32221 the current address. This helps in the case where local part A is aliased to B,
32222 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
32223 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
32224 <filename> jb/.forward</filename> contains:
32226 <literallayout class="monospaced">
32227 \Joe.Bloggs, <other item(s)>
32230 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
32231 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
32232 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
32233 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
32234 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
32235 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
32236 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
32237 original address. See also the <option>repeat_use</option> option below.
32240 <indexterm role="option">
32241 <primary>check_group</primary>
32244 <informaltable frame="all">
32245 <tgroup cols="4" colsep="0" rowsep="0">
32246 <colspec colwidth="8*" align="left"/>
32247 <colspec colwidth="5*" align="center"/>
32248 <colspec colwidth="5*" align="center"/>
32249 <colspec colwidth="6*" align="right"/>
32252 <entry><option>check_group</option></entry>
32253 <entry>Use: <emphasis>redirect</emphasis></entry>
32254 <entry>Type: <emphasis>boolean</emphasis></entry>
32255 <entry>Default: <emphasis>see below</emphasis></entry>
32261 When the <option>file</option> option is used, the group owner of the file is checked only
32262 when this option is set. The permitted groups are those listed in the
32263 <option>owngroups</option> option, together with the user’s default group if
32264 <option>check_local_user</option> is set. If the file has the wrong group, routing is
32265 deferred. The default setting for this option is true if <option>check_local_user</option>
32266 is set and the <option>modemask</option> option permits the group write bit, or if the
32267 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
32270 <indexterm role="option">
32271 <primary>check_owner</primary>
32274 <informaltable frame="all">
32275 <tgroup cols="4" colsep="0" rowsep="0">
32276 <colspec colwidth="8*" align="left"/>
32277 <colspec colwidth="5*" align="center"/>
32278 <colspec colwidth="5*" align="center"/>
32279 <colspec colwidth="6*" align="right"/>
32282 <entry><option>check_owner</option></entry>
32283 <entry>Use: <emphasis>redirect</emphasis></entry>
32284 <entry>Type: <emphasis>boolean</emphasis></entry>
32285 <entry>Default: <emphasis>see below</emphasis></entry>
32291 When the <option>file</option> option is used, the owner of the file is checked only when
32292 this option is set. If <option>check_local_user</option> is set, the local user is
32293 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
32294 option. The default value for this option is true if <option>check_local_user</option> or
32295 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
32298 <indexterm role="option">
32299 <primary>data</primary>
32302 <informaltable frame="all">
32303 <tgroup cols="4" colsep="0" rowsep="0">
32304 <colspec colwidth="8*" align="left"/>
32305 <colspec colwidth="5*" align="center"/>
32306 <colspec colwidth="5*" align="center"/>
32307 <colspec colwidth="6*" align="right"/>
32310 <entry><option>data</option></entry>
32311 <entry>Use: <emphasis>redirect</emphasis></entry>
32312 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
32313 <entry>Default: <emphasis>unset</emphasis></entry>
32319 This option is mutually exclusive with <option>file</option>. One or other of them must be
32320 set, but not both. The contents of <option>data</option> are expanded, and then used as the
32321 list of forwarding items, or as a set of filtering instructions. If the
32322 expansion is forced to fail, or the result is an empty string or a string that
32323 has no effect (consists entirely of comments), the router declines.
32326 When filtering instructions are used, the string must begin with <quote>#Exim
32327 filter</quote>, and all comments in the string, including this initial one, must be
32328 terminated with newline characters. For example:
32330 <literallayout class="monospaced">
32331 data = #Exim filter\n\
32332 if $h_to: contains Exim then save $home/mail/exim endif
32335 If you are reading the data from a database where newlines cannot be included,
32336 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
32337 choice into a newline.
32340 <indexterm role="option">
32341 <primary>directory_transport</primary>
32344 <informaltable frame="all">
32345 <tgroup cols="4" colsep="0" rowsep="0">
32346 <colspec colwidth="8*" align="left"/>
32347 <colspec colwidth="5*" align="center"/>
32348 <colspec colwidth="5*" align="center"/>
32349 <colspec colwidth="6*" align="right"/>
32352 <entry><option>directory_transport</option></entry>
32353 <entry>Use: <emphasis>redirect</emphasis></entry>
32354 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
32355 <entry>Default: <emphasis>unset</emphasis></entry>
32361 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
32362 ending with a slash is specified as a new <quote>address</quote>. The transport used is
32363 specified by this option, which, after expansion, must be the name of a
32364 configured transport. This should normally be an <command>appendfile</command> transport.
32367 <indexterm role="option">
32368 <primary>file</primary>
32371 <informaltable frame="all">
32372 <tgroup cols="4" colsep="0" rowsep="0">
32373 <colspec colwidth="8*" align="left"/>
32374 <colspec colwidth="5*" align="center"/>
32375 <colspec colwidth="5*" align="center"/>
32376 <colspec colwidth="6*" align="right"/>
32379 <entry><option>file</option></entry>
32380 <entry>Use: <emphasis>redirect</emphasis></entry>
32381 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
32382 <entry>Default: <emphasis>unset</emphasis></entry>
32388 This option specifies the name of a file that contains the redirection data. It
32389 is mutually exclusive with the <option>data</option> option. The string is expanded before
32390 use; if the expansion is forced to fail, the router declines. Other expansion
32391 failures cause delivery to be deferred. The result of a successful expansion
32392 must be an absolute path. The entire file is read and used as the redirection
32393 data. If the data is an empty string or a string that has no effect (consists
32394 entirely of comments), the router declines.
32397 <indexterm role="concept">
32398 <primary>NFS</primary>
32399 <secondary>checking for file existence</secondary>
32401 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
32402 runs a check on the containing directory,
32403 unless <option>ignore_enotdir</option> is true (see below).
32404 If the directory does not appear to exist, delivery is deferred. This can
32405 happen when users’ <filename>.forward</filename> files are in NFS-mounted directories, and there
32406 is a mount problem. If the containing directory does exist, but the file does
32407 not, the router declines.
32410 <indexterm role="option">
32411 <primary>file_transport</primary>
32414 <informaltable frame="all">
32415 <tgroup cols="4" colsep="0" rowsep="0">
32416 <colspec colwidth="8*" align="left"/>
32417 <colspec colwidth="5*" align="center"/>
32418 <colspec colwidth="5*" align="center"/>
32419 <colspec colwidth="6*" align="right"/>
32422 <entry><option>file_transport</option></entry>
32423 <entry>Use: <emphasis>redirect</emphasis></entry>
32424 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
32425 <entry>Default: <emphasis>unset</emphasis></entry>
32431 <indexterm role="concept">
32432 <primary><varname>$address_file</varname></primary>
32434 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
32435 ending in a slash is specified as a new <quote>address</quote>. The transport used is
32436 specified by this option, which, after expansion, must be the name of a
32437 configured transport. This should normally be an <command>appendfile</command> transport. When
32438 it is running, the file name is in <varname>$address_file</varname>.
32441 <indexterm role="option">
32442 <primary>forbid_blackhole</primary>
32445 <informaltable frame="all">
32446 <tgroup cols="4" colsep="0" rowsep="0">
32447 <colspec colwidth="8*" align="left"/>
32448 <colspec colwidth="5*" align="center"/>
32449 <colspec colwidth="5*" align="center"/>
32450 <colspec colwidth="6*" align="right"/>
32453 <entry><option>forbid_blackhole</option></entry>
32454 <entry>Use: <emphasis>redirect</emphasis></entry>
32455 <entry>Type: <emphasis>boolean</emphasis></entry>
32456 <entry>Default: <emphasis>false</emphasis></entry>
32462 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
32466 <indexterm role="option">
32467 <primary>forbid_exim_filter</primary>
32470 <informaltable frame="all">
32471 <tgroup cols="4" colsep="0" rowsep="0">
32472 <colspec colwidth="8*" align="left"/>
32473 <colspec colwidth="5*" align="center"/>
32474 <colspec colwidth="5*" align="center"/>
32475 <colspec colwidth="6*" align="right"/>
32478 <entry><option>forbid_exim_filter</option></entry>
32479 <entry>Use: <emphasis>redirect</emphasis></entry>
32480 <entry>Type: <emphasis>boolean</emphasis></entry>
32481 <entry>Default: <emphasis>false</emphasis></entry>
32487 If this option is set true, only Sieve filters are permitted when
32488 <option>allow_filter</option> is true.
32491 <indexterm role="option">
32492 <primary>forbid_file</primary>
32495 <informaltable frame="all">
32496 <tgroup cols="4" colsep="0" rowsep="0">
32497 <colspec colwidth="8*" align="left"/>
32498 <colspec colwidth="5*" align="center"/>
32499 <colspec colwidth="5*" align="center"/>
32500 <colspec colwidth="6*" align="right"/>
32503 <entry><option>forbid_file</option></entry>
32504 <entry>Use: <emphasis>redirect</emphasis></entry>
32505 <entry>Type: <emphasis>boolean</emphasis></entry>
32506 <entry>Default: <emphasis>false</emphasis></entry>
32512 <indexterm role="concept">
32513 <primary>delivery</primary>
32514 <secondary>to file; forbidding</secondary>
32516 <indexterm role="concept">
32517 <primary>Sieve filter</primary>
32518 <secondary>forbidding delivery to a file</secondary>
32520 <indexterm role="concept">
32521 <primary>Sieve filter</primary>
32522 <secondary><quote>keep</quote> facility; disabling</secondary>
32524 If this option is true, this router may not generate a new address that
32525 specifies delivery to a local file or directory, either from a filter or from a
32526 conventional forward file. This option is forced to be true if <option>one_time</option> is
32527 set. It applies to Sieve filters as well as to Exim filters, but if true, it
32528 locks out the Sieve’s <quote>keep</quote> facility.
32531 <indexterm role="option">
32532 <primary>forbid_filter_dlfunc</primary>
32535 <informaltable frame="all">
32536 <tgroup cols="4" colsep="0" rowsep="0">
32537 <colspec colwidth="8*" align="left"/>
32538 <colspec colwidth="5*" align="center"/>
32539 <colspec colwidth="5*" align="center"/>
32540 <colspec colwidth="6*" align="right"/>
32543 <entry><option>forbid_filter_dlfunc</option></entry>
32544 <entry>Use: <emphasis>redirect</emphasis></entry>
32545 <entry>Type: <emphasis>boolean</emphasis></entry>
32546 <entry>Default: <emphasis>false</emphasis></entry>
32552 <indexterm role="concept">
32553 <primary>filter</primary>
32554 <secondary>locking out certain features</secondary>
32556 If this option is true, string expansions in Exim filters are not allowed to
32557 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
32561 <indexterm role="option">
32562 <primary>forbid_filter_existstest</primary>
32565 <informaltable frame="all">
32566 <tgroup cols="4" colsep="0" rowsep="0">
32567 <colspec colwidth="8*" align="left"/>
32568 <colspec colwidth="5*" align="center"/>
32569 <colspec colwidth="5*" align="center"/>
32570 <colspec colwidth="6*" align="right"/>
32573 <entry><option>forbid_filter_existstest</option></entry>
32574 <entry>Use: <emphasis>redirect</emphasis></entry>
32575 <entry>Type: <emphasis>boolean</emphasis></entry>
32576 <entry>Default: <emphasis>false</emphasis></entry>
32582 <indexterm role="concept">
32583 <primary>expansion</primary>
32584 <secondary>statting a file</secondary>
32586 If this option is true, string expansions in Exim filters are not allowed to
32587 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
32590 <indexterm role="option">
32591 <primary>forbid_filter_logwrite</primary>
32594 <informaltable frame="all">
32595 <tgroup cols="4" colsep="0" rowsep="0">
32596 <colspec colwidth="8*" align="left"/>
32597 <colspec colwidth="5*" align="center"/>
32598 <colspec colwidth="5*" align="center"/>
32599 <colspec colwidth="6*" align="right"/>
32602 <entry><option>forbid_filter_logwrite</option></entry>
32603 <entry>Use: <emphasis>redirect</emphasis></entry>
32604 <entry>Type: <emphasis>boolean</emphasis></entry>
32605 <entry>Default: <emphasis>false</emphasis></entry>
32611 If this option is true, use of the logging facility in Exim filters is not
32612 permitted. Logging is in any case available only if the filter is being run
32613 under some unprivileged uid (which is normally the case for ordinary users’
32614 <filename>.forward</filename> files).
32617 <indexterm role="option">
32618 <primary>forbid_filter_lookup</primary>
32621 <informaltable frame="all">
32622 <tgroup cols="4" colsep="0" rowsep="0">
32623 <colspec colwidth="8*" align="left"/>
32624 <colspec colwidth="5*" align="center"/>
32625 <colspec colwidth="5*" align="center"/>
32626 <colspec colwidth="6*" align="right"/>
32629 <entry><option>forbid_filter_lookup</option></entry>
32630 <entry>Use: <emphasis>redirect</emphasis></entry>
32631 <entry>Type: <emphasis>boolean</emphasis></entry>
32632 <entry>Default: <emphasis>false</emphasis></entry>
32638 If this option is true, string expansions in Exim filter files are not allowed
32639 to make use of <option>lookup</option> items.
32642 <indexterm role="option">
32643 <primary>forbid_filter_perl</primary>
32646 <informaltable frame="all">
32647 <tgroup cols="4" colsep="0" rowsep="0">
32648 <colspec colwidth="8*" align="left"/>
32649 <colspec colwidth="5*" align="center"/>
32650 <colspec colwidth="5*" align="center"/>
32651 <colspec colwidth="6*" align="right"/>
32654 <entry><option>forbid_filter_perl</option></entry>
32655 <entry>Use: <emphasis>redirect</emphasis></entry>
32656 <entry>Type: <emphasis>boolean</emphasis></entry>
32657 <entry>Default: <emphasis>false</emphasis></entry>
32663 This option has an effect only if Exim is built with embedded Perl support. If
32664 it is true, string expansions in Exim filter files are not allowed to make use
32665 of the embedded Perl support.
32668 <indexterm role="option">
32669 <primary>forbid_filter_readfile</primary>
32672 <informaltable frame="all">
32673 <tgroup cols="4" colsep="0" rowsep="0">
32674 <colspec colwidth="8*" align="left"/>
32675 <colspec colwidth="5*" align="center"/>
32676 <colspec colwidth="5*" align="center"/>
32677 <colspec colwidth="6*" align="right"/>
32680 <entry><option>forbid_filter_readfile</option></entry>
32681 <entry>Use: <emphasis>redirect</emphasis></entry>
32682 <entry>Type: <emphasis>boolean</emphasis></entry>
32683 <entry>Default: <emphasis>false</emphasis></entry>
32689 If this option is true, string expansions in Exim filter files are not allowed
32690 to make use of <option>readfile</option> items.
32693 <indexterm role="option">
32694 <primary>forbid_filter_readsocket</primary>
32697 <informaltable frame="all">
32698 <tgroup cols="4" colsep="0" rowsep="0">
32699 <colspec colwidth="8*" align="left"/>
32700 <colspec colwidth="5*" align="center"/>
32701 <colspec colwidth="5*" align="center"/>
32702 <colspec colwidth="6*" align="right"/>
32705 <entry><option>forbid_filter_readsocket</option></entry>
32706 <entry>Use: <emphasis>redirect</emphasis></entry>
32707 <entry>Type: <emphasis>boolean</emphasis></entry>
32708 <entry>Default: <emphasis>false</emphasis></entry>
32714 If this option is true, string expansions in Exim filter files are not allowed
32715 to make use of <option>readsocket</option> items.
32718 <indexterm role="option">
32719 <primary>forbid_filter_reply</primary>
32722 <informaltable frame="all">
32723 <tgroup cols="4" colsep="0" rowsep="0">
32724 <colspec colwidth="8*" align="left"/>
32725 <colspec colwidth="5*" align="center"/>
32726 <colspec colwidth="5*" align="center"/>
32727 <colspec colwidth="6*" align="right"/>
32730 <entry><option>forbid_filter_reply</option></entry>
32731 <entry>Use: <emphasis>redirect</emphasis></entry>
32732 <entry>Type: <emphasis>boolean</emphasis></entry>
32733 <entry>Default: <emphasis>false</emphasis></entry>
32739 If this option is true, this router may not generate an automatic reply
32740 message. Automatic replies can be generated only from Exim or Sieve filter
32741 files, not from traditional forward files. This option is forced to be true if
32742 <option>one_time</option> is set.
32745 <indexterm role="option">
32746 <primary>forbid_filter_run</primary>
32749 <informaltable frame="all">
32750 <tgroup cols="4" colsep="0" rowsep="0">
32751 <colspec colwidth="8*" align="left"/>
32752 <colspec colwidth="5*" align="center"/>
32753 <colspec colwidth="5*" align="center"/>
32754 <colspec colwidth="6*" align="right"/>
32757 <entry><option>forbid_filter_run</option></entry>
32758 <entry>Use: <emphasis>redirect</emphasis></entry>
32759 <entry>Type: <emphasis>boolean</emphasis></entry>
32760 <entry>Default: <emphasis>false</emphasis></entry>
32766 If this option is true, string expansions in Exim filter files are not allowed
32767 to make use of <option>run</option> items.
32770 <indexterm role="option">
32771 <primary>forbid_include</primary>
32774 <informaltable frame="all">
32775 <tgroup cols="4" colsep="0" rowsep="0">
32776 <colspec colwidth="8*" align="left"/>
32777 <colspec colwidth="5*" align="center"/>
32778 <colspec colwidth="5*" align="center"/>
32779 <colspec colwidth="6*" align="right"/>
32782 <entry><option>forbid_include</option></entry>
32783 <entry>Use: <emphasis>redirect</emphasis></entry>
32784 <entry>Type: <emphasis>boolean</emphasis></entry>
32785 <entry>Default: <emphasis>false</emphasis></entry>
32791 If this option is true, items of the form
32793 <literallayout class="monospaced">
32794 :include:<path name>
32797 are not permitted in non-filter redirection lists.
32800 <indexterm role="option">
32801 <primary>forbid_pipe</primary>
32804 <informaltable frame="all">
32805 <tgroup cols="4" colsep="0" rowsep="0">
32806 <colspec colwidth="8*" align="left"/>
32807 <colspec colwidth="5*" align="center"/>
32808 <colspec colwidth="5*" align="center"/>
32809 <colspec colwidth="6*" align="right"/>
32812 <entry><option>forbid_pipe</option></entry>
32813 <entry>Use: <emphasis>redirect</emphasis></entry>
32814 <entry>Type: <emphasis>boolean</emphasis></entry>
32815 <entry>Default: <emphasis>false</emphasis></entry>
32821 <indexterm role="concept">
32822 <primary>delivery</primary>
32823 <secondary>to pipe; forbidding</secondary>
32825 If this option is true, this router may not generate a new address which
32826 specifies delivery to a pipe, either from an Exim filter or from a conventional
32827 forward file. This option is forced to be true if <option>one_time</option> is set.
32830 <indexterm role="option">
32831 <primary>forbid_sieve_filter</primary>
32834 <informaltable frame="all">
32835 <tgroup cols="4" colsep="0" rowsep="0">
32836 <colspec colwidth="8*" align="left"/>
32837 <colspec colwidth="5*" align="center"/>
32838 <colspec colwidth="5*" align="center"/>
32839 <colspec colwidth="6*" align="right"/>
32842 <entry><option>forbid_sieve_filter</option></entry>
32843 <entry>Use: <emphasis>redirect</emphasis></entry>
32844 <entry>Type: <emphasis>boolean</emphasis></entry>
32845 <entry>Default: <emphasis>false</emphasis></entry>
32851 If this option is set true, only Exim filters are permitted when
32852 <option>allow_filter</option> is true.
32855 <indexterm role="option">
32856 <primary>hide_child_in_errmsg</primary>
32859 <informaltable frame="all">
32860 <tgroup cols="4" colsep="0" rowsep="0">
32861 <colspec colwidth="8*" align="left"/>
32862 <colspec colwidth="5*" align="center"/>
32863 <colspec colwidth="5*" align="center"/>
32864 <colspec colwidth="6*" align="right"/>
32867 <entry><option>hide_child_in_errmsg</option></entry>
32868 <entry>Use: <emphasis>redirect</emphasis></entry>
32869 <entry>Type: <emphasis>boolean</emphasis></entry>
32870 <entry>Default: <emphasis>false</emphasis></entry>
32876 <indexterm role="concept">
32877 <primary>bounce message</primary>
32878 <secondary>redirection details; suppressing</secondary>
32880 If this option is true, it prevents Exim from quoting a child address if it
32881 generates a bounce or delay message for it. Instead it says <quote>an address
32882 generated from <<emphasis>the top level address</emphasis>></quote>. Of course, this applies only to
32883 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
32884 bounce may well quote the generated address.
32887 <indexterm role="option">
32888 <primary>ignore_eacces</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>ignore_eacces</option></entry>
32900 <entry>Use: <emphasis>redirect</emphasis></entry>
32901 <entry>Type: <emphasis>boolean</emphasis></entry>
32902 <entry>Default: <emphasis>false</emphasis></entry>
32908 <indexterm role="concept">
32909 <primary>EACCES</primary>
32911 If this option is set and an attempt to open a redirection file yields the
32912 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
32913 file did not exist.
32916 <indexterm role="option">
32917 <primary>ignore_enotdir</primary>
32920 <informaltable frame="all">
32921 <tgroup cols="4" colsep="0" rowsep="0">
32922 <colspec colwidth="8*" align="left"/>
32923 <colspec colwidth="5*" align="center"/>
32924 <colspec colwidth="5*" align="center"/>
32925 <colspec colwidth="6*" align="right"/>
32928 <entry><option>ignore_enotdir</option></entry>
32929 <entry>Use: <emphasis>redirect</emphasis></entry>
32930 <entry>Type: <emphasis>boolean</emphasis></entry>
32931 <entry>Default: <emphasis>false</emphasis></entry>
32937 <indexterm role="concept">
32938 <primary>ENOTDIR</primary>
32940 If this option is set and an attempt to open a redirection file yields the
32941 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
32942 router behaves as if the file did not exist.
32945 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
32946 router that has the <option>file</option> option set discovers that the file does not exist
32947 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
32948 against unmounted NFS directories. If the parent can not be statted, delivery
32949 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
32950 is set, because that option tells Exim to ignore <quote>something on the path is not
32951 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
32952 that some operating systems give ENOENT where others give ENOTDIR.
32955 <indexterm role="option">
32956 <primary>include_directory</primary>
32959 <informaltable frame="all">
32960 <tgroup cols="4" colsep="0" rowsep="0">
32961 <colspec colwidth="8*" align="left"/>
32962 <colspec colwidth="5*" align="center"/>
32963 <colspec colwidth="5*" align="center"/>
32964 <colspec colwidth="6*" align="right"/>
32967 <entry><option>include_directory</option></entry>
32968 <entry>Use: <emphasis>redirect</emphasis></entry>
32969 <entry>Type: <emphasis>string</emphasis></entry>
32970 <entry>Default: <emphasis>unset</emphasis></entry>
32976 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
32977 redirection list must start with this directory.
32980 <indexterm role="option">
32981 <primary>modemask</primary>
32984 <informaltable frame="all">
32985 <tgroup cols="4" colsep="0" rowsep="0">
32986 <colspec colwidth="8*" align="left"/>
32987 <colspec colwidth="5*" align="center"/>
32988 <colspec colwidth="5*" align="center"/>
32989 <colspec colwidth="6*" align="right"/>
32992 <entry><option>modemask</option></entry>
32993 <entry>Use: <emphasis>redirect</emphasis></entry>
32994 <entry>Type: <emphasis>octal integer</emphasis></entry>
32995 <entry>Default: <emphasis>022</emphasis></entry>
33001 This specifies mode bits which must not be set for a file specified by the
33002 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
33005 <indexterm role="option">
33006 <primary>one_time</primary>
33009 <informaltable frame="all">
33010 <tgroup cols="4" colsep="0" rowsep="0">
33011 <colspec colwidth="8*" align="left"/>
33012 <colspec colwidth="5*" align="center"/>
33013 <colspec colwidth="5*" align="center"/>
33014 <colspec colwidth="6*" align="right"/>
33017 <entry><option>one_time</option></entry>
33018 <entry>Use: <emphasis>redirect</emphasis></entry>
33019 <entry>Type: <emphasis>boolean</emphasis></entry>
33020 <entry>Default: <emphasis>false</emphasis></entry>
33026 <indexterm role="concept">
33027 <primary>one-time aliasing/forwarding expansion</primary>
33029 <indexterm role="concept">
33030 <primary>alias file</primary>
33031 <secondary>one-time expansion</secondary>
33033 <indexterm role="concept">
33034 <primary>forward file</primary>
33035 <secondary>one-time expansion</secondary>
33037 <indexterm role="concept">
33038 <primary>mailing lists</primary>
33039 <secondary>one-time expansion</secondary>
33041 <indexterm role="concept">
33042 <primary>address redirection</primary>
33043 <secondary>one-time expansion</secondary>
33045 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
33046 files each time it tries to deliver a message causes a problem when one or more
33047 of the generated addresses fails be delivered at the first attempt. The problem
33048 is not one of duplicate delivery – Exim is clever enough to handle that –
33049 but of what happens when the redirection list changes during the time that the
33050 message is on Exim’s queue. This is particularly true in the case of mailing
33051 lists, where new subscribers might receive copies of messages that were posted
33052 before they subscribed.
33055 If <option>one_time</option> is set and any addresses generated by the router fail to
33056 deliver at the first attempt, the failing addresses are added to the message as
33057 <quote>top level</quote> addresses, and the parent address that generated them is marked
33058 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
33062 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
33063 router would be lost if delivery did not succeed at the first attempt. For this
33064 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
33065 permitted when <option>one_time</option> is set.
33068 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
33069 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
33070 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
33073 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
33074 <option>one_time</option>.
33077 The original top-level address is remembered with each of the generated
33078 addresses, and is output in any log messages. However, any intermediate parent
33079 addresses are not recorded. This makes a difference to the log only if
33080 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
33081 typically be used for mailing lists, where there is normally just one level of
33085 <indexterm role="option">
33086 <primary>owners</primary>
33089 <informaltable frame="all">
33090 <tgroup cols="4" colsep="0" rowsep="0">
33091 <colspec colwidth="8*" align="left"/>
33092 <colspec colwidth="5*" align="center"/>
33093 <colspec colwidth="5*" align="center"/>
33094 <colspec colwidth="6*" align="right"/>
33097 <entry><option>owners</option></entry>
33098 <entry>Use: <emphasis>redirect</emphasis></entry>
33099 <entry>Type: <emphasis>string list</emphasis></entry>
33100 <entry>Default: <emphasis>unset</emphasis></entry>
33106 <indexterm role="concept">
33107 <primary>ownership</primary>
33108 <secondary>alias file</secondary>
33110 <indexterm role="concept">
33111 <primary>ownership</primary>
33112 <secondary>forward file</secondary>
33114 <indexterm role="concept">
33115 <primary>alias file</primary>
33116 <secondary>ownership</secondary>
33118 <indexterm role="concept">
33119 <primary>forward file</primary>
33120 <secondary>ownership</secondary>
33122 This specifies a list of permitted owners for the file specified by <option>file</option>.
33123 This list is in addition to the local user when <option>check_local_user</option> is set.
33124 See <option>check_owner</option> above.
33127 <indexterm role="option">
33128 <primary>owngroups</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>owngroups</option></entry>
33140 <entry>Use: <emphasis>redirect</emphasis></entry>
33141 <entry>Type: <emphasis>string list</emphasis></entry>
33142 <entry>Default: <emphasis>unset</emphasis></entry>
33148 This specifies a list of permitted groups for the file specified by <option>file</option>.
33149 The list is in addition to the local user’s primary group when
33150 <option>check_local_user</option> is set. See <option>check_group</option> above.
33153 <indexterm role="option">
33154 <primary>pipe_transport</primary>
33157 <informaltable frame="all">
33158 <tgroup cols="4" colsep="0" rowsep="0">
33159 <colspec colwidth="8*" align="left"/>
33160 <colspec colwidth="5*" align="center"/>
33161 <colspec colwidth="5*" align="center"/>
33162 <colspec colwidth="6*" align="right"/>
33165 <entry><option>pipe_transport</option></entry>
33166 <entry>Use: <emphasis>redirect</emphasis></entry>
33167 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33168 <entry>Default: <emphasis>unset</emphasis></entry>
33174 <indexterm role="concept">
33175 <primary><varname>$address_pipe</varname></primary>
33177 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
33178 starting with a vertical bar character is specified as a new <quote>address</quote>. The
33179 transport used is specified by this option, which, after expansion, must be the
33180 name of a configured transport. This should normally be a <command>pipe</command> transport.
33181 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
33184 <indexterm role="option">
33185 <primary>qualify_domain</primary>
33188 <informaltable frame="all">
33189 <tgroup cols="4" colsep="0" rowsep="0">
33190 <colspec colwidth="8*" align="left"/>
33191 <colspec colwidth="5*" align="center"/>
33192 <colspec colwidth="5*" align="center"/>
33193 <colspec colwidth="6*" align="right"/>
33196 <entry><option>qualify_domain</option></entry>
33197 <entry>Use: <emphasis>redirect</emphasis></entry>
33198 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33199 <entry>Default: <emphasis>unset</emphasis></entry>
33205 <indexterm role="concept">
33206 <primary><varname>$qualify_recipient</varname></primary>
33209 <para revisionflag="changed">
33210 If this option is set, and an unqualified address (one without a domain) is
33211 generated, and that address would normally be qualified by the global setting
33212 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
33213 expanding this string. If the expansion fails, the router declines. If you want
33214 to revert to the default, you can have the expansion generate
33215 <varname>$qualify_recipient</varname>.
33217 <para revisionflag="changed">
33218 This option applies to all unqualified addresses generated by Exim filters,
33219 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
33220 not preceded by a backslash. Sieve filters cannot generate unqualified
33224 <indexterm role="option">
33225 <primary>qualify_preserve_domain</primary>
33228 <informaltable frame="all">
33229 <tgroup cols="4" colsep="0" rowsep="0">
33230 <colspec colwidth="8*" align="left"/>
33231 <colspec colwidth="5*" align="center"/>
33232 <colspec colwidth="5*" align="center"/>
33233 <colspec colwidth="6*" align="right"/>
33236 <entry><option>qualify_preserve_domain</option></entry>
33237 <entry>Use: <emphasis>redirect</emphasis></entry>
33238 <entry>Type: <emphasis>boolean</emphasis></entry>
33239 <entry>Default: <emphasis>false</emphasis></entry>
33245 <indexterm role="concept">
33246 <primary>domain</primary>
33247 <secondary>in redirection; preserving</secondary>
33249 <indexterm role="concept">
33250 <primary>preserving domain in redirection</primary>
33252 <indexterm role="concept">
33253 <primary>address redirection</primary>
33254 <secondary>domain; preserving</secondary>
33257 <para revisionflag="changed">
33258 If this option is set, the router’s local <option>qualify_domain</option> option must not be
33259 set (a configuration error occurs if it is). If an unqualified address (one
33260 without a domain) is generated, it is qualified with the domain of the parent
33261 address (the immediately preceding ancestor) instead of the global
33262 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
33263 this applies whether or not the address is preceded by a backslash.
33266 <indexterm role="option">
33267 <primary>repeat_use</primary>
33270 <informaltable frame="all">
33271 <tgroup cols="4" colsep="0" rowsep="0">
33272 <colspec colwidth="8*" align="left"/>
33273 <colspec colwidth="5*" align="center"/>
33274 <colspec colwidth="5*" align="center"/>
33275 <colspec colwidth="6*" align="right"/>
33278 <entry><option>repeat_use</option></entry>
33279 <entry>Use: <emphasis>redirect</emphasis></entry>
33280 <entry>Type: <emphasis>boolean</emphasis></entry>
33281 <entry>Default: <emphasis>true</emphasis></entry>
33287 If this option is set false, the router is skipped for a child address that has
33288 any ancestor that was routed by this router. This test happens before any of
33289 the other preconditions are tested. Exim’s default anti-looping rules skip
33290 only when the ancestor is the same as the current address. See also
33291 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
33294 <indexterm role="option">
33295 <primary>reply_transport</primary>
33298 <informaltable frame="all">
33299 <tgroup cols="4" colsep="0" rowsep="0">
33300 <colspec colwidth="8*" align="left"/>
33301 <colspec colwidth="5*" align="center"/>
33302 <colspec colwidth="5*" align="center"/>
33303 <colspec colwidth="6*" align="right"/>
33306 <entry><option>reply_transport</option></entry>
33307 <entry>Use: <emphasis>redirect</emphasis></entry>
33308 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33309 <entry>Default: <emphasis>unset</emphasis></entry>
33315 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
33316 <option>vacation</option> command is used in a filter file. The transport used is specified
33317 by this option, which, after expansion, must be the name of a configured
33318 transport. This should normally be an <command>autoreply</command> transport. Other transports
33319 are unlikely to do anything sensible or useful.
33322 <indexterm role="option">
33323 <primary>rewrite</primary>
33326 <informaltable frame="all">
33327 <tgroup cols="4" colsep="0" rowsep="0">
33328 <colspec colwidth="8*" align="left"/>
33329 <colspec colwidth="5*" align="center"/>
33330 <colspec colwidth="5*" align="center"/>
33331 <colspec colwidth="6*" align="right"/>
33334 <entry><option>rewrite</option></entry>
33335 <entry>Use: <emphasis>redirect</emphasis></entry>
33336 <entry>Type: <emphasis>boolean</emphasis></entry>
33337 <entry>Default: <emphasis>true</emphasis></entry>
33343 <indexterm role="concept">
33344 <primary>address redirection</primary>
33345 <secondary>disabling rewriting</secondary>
33347 If this option is set false, addresses generated by the router are not
33348 subject to address rewriting. Otherwise, they are treated like new addresses
33349 and are rewritten according to the global rewriting rules.
33352 <indexterm role="option">
33353 <primary>sieve_subaddress</primary>
33356 <informaltable frame="all">
33357 <tgroup cols="4" colsep="0" rowsep="0">
33358 <colspec colwidth="8*" align="left"/>
33359 <colspec colwidth="5*" align="center"/>
33360 <colspec colwidth="5*" align="center"/>
33361 <colspec colwidth="6*" align="right"/>
33364 <entry><option>sieve_subaddress</option></entry>
33365 <entry>Use: <emphasis>redirect</emphasis></entry>
33366 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33367 <entry>Default: <emphasis>unset</emphasis></entry>
33373 The value of this option is passed to a Sieve filter to specify the
33374 :subaddress part of an address.
33377 <indexterm role="option">
33378 <primary>sieve_useraddress</primary>
33381 <informaltable frame="all">
33382 <tgroup cols="4" colsep="0" rowsep="0">
33383 <colspec colwidth="8*" align="left"/>
33384 <colspec colwidth="5*" align="center"/>
33385 <colspec colwidth="5*" align="center"/>
33386 <colspec colwidth="6*" align="right"/>
33389 <entry><option>sieve_useraddress</option></entry>
33390 <entry>Use: <emphasis>redirect</emphasis></entry>
33391 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33392 <entry>Default: <emphasis>unset</emphasis></entry>
33398 The value of this option is passed to a Sieve filter to specify the :user part
33399 of an address. However, if it is unset, the entire original local part
33400 (including any prefix or suffix) is used for :user.
33403 <indexterm role="option">
33404 <primary>sieve_vacation_directory</primary>
33407 <informaltable frame="all">
33408 <tgroup cols="4" colsep="0" rowsep="0">
33409 <colspec colwidth="8*" align="left"/>
33410 <colspec colwidth="5*" align="center"/>
33411 <colspec colwidth="5*" align="center"/>
33412 <colspec colwidth="6*" align="right"/>
33415 <entry><option>sieve_vacation_directory</option></entry>
33416 <entry>Use: <emphasis>redirect</emphasis></entry>
33417 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33418 <entry>Default: <emphasis>unset</emphasis></entry>
33424 <indexterm role="concept">
33425 <primary>Sieve filter</primary>
33426 <secondary>vacation directory</secondary>
33428 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
33429 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
33430 (do not put anything else in that directory), and ensure that the
33431 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
33432 needs their own directory; Exim will create it if necessary.
33435 <indexterm role="option">
33436 <primary>skip_syntax_errors</primary>
33439 <informaltable frame="all">
33440 <tgroup cols="4" colsep="0" rowsep="0">
33441 <colspec colwidth="8*" align="left"/>
33442 <colspec colwidth="5*" align="center"/>
33443 <colspec colwidth="5*" align="center"/>
33444 <colspec colwidth="6*" align="right"/>
33447 <entry><option>skip_syntax_errors</option></entry>
33448 <entry>Use: <emphasis>redirect</emphasis></entry>
33449 <entry>Type: <emphasis>boolean</emphasis></entry>
33450 <entry>Default: <emphasis>false</emphasis></entry>
33456 <indexterm role="concept">
33457 <primary>forward file</primary>
33458 <secondary>broken</secondary>
33460 <indexterm role="concept">
33461 <primary>address redirection</primary>
33462 <secondary>broken files</secondary>
33464 <indexterm role="concept">
33465 <primary>alias file</primary>
33466 <secondary>broken</secondary>
33468 <indexterm role="concept">
33469 <primary>broken alias or forward files</primary>
33471 <indexterm role="concept">
33472 <primary>ignoring faulty addresses</primary>
33474 <indexterm role="concept">
33475 <primary>skipping faulty addresses</primary>
33477 <indexterm role="concept">
33478 <primary>error</primary>
33479 <secondary>skipping bad syntax</secondary>
33481 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
33482 non-filter redirection data are skipped, and each failing address is logged. If
33483 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
33484 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
33485 are expanded and placed at the head of the error message generated by
33486 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
33487 be the same address as the generic <option>errors_to</option> option. The
33488 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
33491 If all the addresses in a redirection list are skipped because of syntax
33492 errors, the router declines to handle the original address, and it is passed to
33493 the following routers.
33496 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
33497 error in the filter causes filtering to be abandoned without any action being
33498 taken. The incident is logged, and the router declines to handle the address,
33499 so it is passed to the following routers.
33502 <indexterm role="concept">
33503 <primary>Sieve filter</primary>
33504 <secondary>syntax errors in</secondary>
33506 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
33507 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
33508 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
33511 <option>skip_syntax_errors</option> can be used to specify that errors in users’ forward
33512 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
33513 option, used with an address that does not get redirected, can be used to
33514 notify users of these errors, by means of a router like this:
33516 <literallayout class="monospaced">
33521 file = $home/.forward
33522 file_transport = address_file
33523 pipe_transport = address_pipe
33524 reply_transport = address_reply
33527 syntax_errors_to = real-$local_part@$domain
33528 syntax_errors_text = \
33529 This is an automatically generated message. An error has\n\
33530 been found in your .forward file. Details of the error are\n\
33531 reported below. While this error persists, you will receive\n\
33532 a copy of this message for every message that is addressed\n\
33533 to you. If your .forward file is a filter file, or if it is\n\
33534 a non-filter file containing no valid forwarding addresses,\n\
33535 a copy of each incoming message will be put in your normal\n\
33536 mailbox. If a non-filter file contains at least one valid\n\
33537 forwarding address, forwarding to the valid addresses will\n\
33538 happen, and those will be the only deliveries that occur.
33541 You also need a router to ensure that local addresses that are prefixed by
33542 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
33543 put this immediately before the <command>userforward</command> router:
33545 <literallayout class="monospaced">
33549 local_part_prefix = real-
33550 transport = local_delivery
33553 <indexterm role="option">
33554 <primary>syntax_errors_text</primary>
33557 <informaltable frame="all">
33558 <tgroup cols="4" colsep="0" rowsep="0">
33559 <colspec colwidth="8*" align="left"/>
33560 <colspec colwidth="5*" align="center"/>
33561 <colspec colwidth="5*" align="center"/>
33562 <colspec colwidth="6*" align="right"/>
33565 <entry><option>syntax_errors_text</option></entry>
33566 <entry>Use: <emphasis>redirect</emphasis></entry>
33567 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33568 <entry>Default: <emphasis>unset</emphasis></entry>
33574 See <option>skip_syntax_errors</option> above.
33577 <indexterm role="option">
33578 <primary>syntax_errors_to</primary>
33581 <informaltable frame="all">
33582 <tgroup cols="4" colsep="0" rowsep="0">
33583 <colspec colwidth="8*" align="left"/>
33584 <colspec colwidth="5*" align="center"/>
33585 <colspec colwidth="5*" align="center"/>
33586 <colspec colwidth="6*" align="right"/>
33589 <entry><option>syntax_errors_to</option></entry>
33590 <entry>Use: <emphasis>redirect</emphasis></entry>
33591 <entry>Type: <emphasis>string</emphasis></entry>
33592 <entry>Default: <emphasis>unset</emphasis></entry>
33598 See <option>skip_syntax_errors</option> above.
33599 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
33600 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
33605 <chapter id="CHAPenvironment">
33606 <title>Environment for running local transports</title>
33607 <titleabbrev>Environment for local transports</titleabbrev>
33609 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
33610 <primary>local transports</primary>
33611 <secondary>environment for</secondary>
33613 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
33614 <primary>environment for local transports</primary>
33616 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
33617 <primary>transport</primary>
33618 <secondary>local; environment for</secondary>
33620 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
33621 transport can be thought of as similar to a pipe.) Exim always runs transports
33622 in subprocesses, under specified uids and gids. Typical deliveries to local
33623 mailboxes run under the uid and gid of the local user.
33626 Exim also sets a specific current directory while running the transport; for
33627 some transports a home directory setting is also relevant. The <command>pipe</command>
33628 transport is the only one that sets up environment variables; see section
33629 <xref linkend="SECTpipeenv"/> for details.
33632 The values used for the uid, gid, and the directories may come from several
33633 different places. In many cases, the router that handles the address associates
33634 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
33635 or <option>user</option> options. However, values may also be given in the transport’s own
33636 configuration, and these override anything that comes from the router.
33639 <title>Concurrent deliveries</title>
33641 <indexterm role="concept">
33642 <primary>concurrent deliveries</primary>
33644 <indexterm role="concept">
33645 <primary>simultaneous deliveries</primary>
33647 If two different messages for the same local recpient arrive more or less
33648 simultaneously, the two delivery processes are likely to run concurrently. When
33649 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
33650 rules to stop concurrent processes from writing to the same file at the same
33654 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
33655 locking that is needed. Here is a silly example:
33657 <literallayout class="monospaced">
33660 command = /bin/sh -c 'cat >>/some/file'
33663 This is supposed to write the message at the end of the file. However, if two
33664 messages arrive at the same time, the file will be scrambled. You can use the
33665 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
33666 file using the same algorithm that Exim itself uses.
33669 <section id="SECTenvuidgid">
33670 <title>Uids and gids</title>
33672 <indexterm role="concept">
33673 <primary>local transports</primary>
33674 <secondary>uid and gid</secondary>
33676 <indexterm role="concept">
33677 <primary>transport</primary>
33678 <secondary>local; uid and gid</secondary>
33680 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
33681 overrides any group that the router set in the address, even if <option>user</option> is not
33682 set for the transport. This makes it possible, for example, to run local mail
33683 delivery under the uid of the recipient (set by the router), but in a special
33684 group (set by the transport). For example:
33686 <literallayout class="monospaced">
33688 # User/group are set by check_local_user in this router
33692 transport = group_delivery
33695 # This transport overrides the group
33697 driver = appendfile
33698 file = /var/spool/mail/$local_part
33702 If <option>user</option> is set for a transport, its value overrides what is set in the
33703 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
33704 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
33708 <indexterm role="concept">
33709 <primary><option>initgroups</option> option</primary>
33711 When the uid is taken from the transport’s configuration, the <function>initgroups()</function>
33712 function is called for the groups associated with that uid if the
33713 <option>initgroups</option> option is set for the transport. When the uid is not specified
33714 by the transport, but is associated with the address by a router, the option
33715 for calling <function>initgroups()</function> is taken from the router configuration.
33718 <indexterm role="concept">
33719 <primary><command>pipe</command> transport</primary>
33720 <secondary>uid for</secondary>
33722 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
33723 is set and <option>user</option> is not set, the uid of the process that called Exim to
33724 receive the message is used, and if <option>group</option> is not set, the corresponding
33725 original gid is also used.
33728 This is the detailed preference order for obtaining a gid; the first of the
33729 following that is set is used:
33734 A <option>group</option> setting of the transport;
33739 A <option>group</option> setting of the router;
33744 A gid associated with a user setting of the router, either as a result of
33745 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
33750 The group associated with a non-numeric <option>user</option> setting of the transport;
33755 In a <command>pipe</command> transport, the creator’s gid if <option>deliver_as_creator</option> is set and
33756 the uid is the creator’s uid;
33761 The Exim gid if the Exim uid is being used as a default.
33766 If, for example, the user is specified numerically on the router and there are
33767 no group settings, no gid is available. In this situation, an error occurs.
33768 This is different for the uid, for which there always is an ultimate default.
33769 The first of the following that is set is used:
33774 A <option>user</option> setting of the transport;
33779 In a <command>pipe</command> transport, the creator’s uid if <option>deliver_as_creator</option> is set;
33784 A <option>user</option> setting of the router;
33789 A <option>check_local_user</option> setting of the router;
33799 Of course, an error will still occur if the uid that is chosen is on the
33800 <option>never_users</option> list.
33804 <title>Current and home directories</title>
33806 <indexterm role="concept">
33807 <primary>current directory for local transport</primary>
33809 <indexterm role="concept">
33810 <primary>home directory</primary>
33811 <secondary>for local transport</secondary>
33813 <indexterm role="concept">
33814 <primary>transport</primary>
33815 <secondary>local; home directory for</secondary>
33817 <indexterm role="concept">
33818 <primary>transport</primary>
33819 <secondary>local; current directory for</secondary>
33821 Routers may set current and home directories for local transports by means of
33822 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
33823 However, if the transport’s <option>current_directory</option> or <option>home_directory</option> options
33824 are set, they override the router’s values. In detail, the home directory
33825 for a local transport is taken from the first of these values that is set:
33830 The <option>home_directory</option> option on the transport;
33835 The <option>transport_home_directory</option> option on the router;
33840 The password data if <option>check_local_user</option> is set on the router;
33845 The <option>router_home_directory</option> option on the router.
33850 The current directory is taken from the first of these values that is set:
33855 The <option>current_directory</option> option on the transport;
33860 The <option>transport_current_directory</option> option on the router.
33865 If neither the router nor the transport sets a current directory, Exim uses the
33866 value of the home directory, if it is set. Otherwise it sets the current
33867 directory to <filename>/</filename> before running a local transport.
33871 <title>Expansion variables derived from the address</title>
33873 <indexterm role="concept">
33874 <primary><varname>$domain</varname></primary>
33876 <indexterm role="concept">
33877 <primary><varname>$local_part</varname></primary>
33879 <indexterm role="concept">
33880 <primary><varname>$original_domain</varname></primary>
33882 Normally a local delivery is handling a single address, and in that case the
33883 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
33884 deliveries. However, in some circumstances more than one address may be handled
33885 at once (for example, while writing batch SMTP for onward transmission by some
33886 other means). In this case, the variables associated with the local part are
33887 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
33888 and <varname>$original_domain</varname> is never set.
33889 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
33890 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
33891 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
33896 <chapter id="CHAPtransportgeneric">
33897 <title>Generic options for transports</title>
33899 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
33900 <primary>generic options</primary>
33901 <secondary>transport</secondary>
33903 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
33904 <primary>options</primary>
33905 <secondary>generic; for transports</secondary>
33907 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
33908 <primary>transport</primary>
33909 <secondary>generic options for</secondary>
33911 The following generic options apply to all transports:
33914 <indexterm role="option">
33915 <primary>body_only</primary>
33918 <informaltable frame="all">
33919 <tgroup cols="4" colsep="0" rowsep="0">
33920 <colspec colwidth="8*" align="left"/>
33921 <colspec colwidth="5*" align="center"/>
33922 <colspec colwidth="5*" align="center"/>
33923 <colspec colwidth="6*" align="right"/>
33926 <entry><option>body_only</option></entry>
33927 <entry>Use: <emphasis>transports</emphasis></entry>
33928 <entry>Type: <emphasis>boolean</emphasis></entry>
33929 <entry>Default: <emphasis>false</emphasis></entry>
33935 <indexterm role="concept">
33936 <primary>transport</primary>
33937 <secondary>body only</secondary>
33939 <indexterm role="concept">
33940 <primary>message</primary>
33941 <secondary>transporting body only</secondary>
33943 <indexterm role="concept">
33944 <primary>body of message</primary>
33945 <secondary>transporting</secondary>
33947 If this option is set, the message’s headers are not transported. It is
33948 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
33949 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
33950 <option>message_suffix</option> should be checked, because this option does not
33951 automatically suppress them.
33954 <indexterm role="option">
33955 <primary>current_directory</primary>
33958 <informaltable frame="all">
33959 <tgroup cols="4" colsep="0" rowsep="0">
33960 <colspec colwidth="8*" align="left"/>
33961 <colspec colwidth="5*" align="center"/>
33962 <colspec colwidth="5*" align="center"/>
33963 <colspec colwidth="6*" align="right"/>
33966 <entry><option>current_directory</option></entry>
33967 <entry>Use: <emphasis>transports</emphasis></entry>
33968 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33969 <entry>Default: <emphasis>unset</emphasis></entry>
33975 <indexterm role="concept">
33976 <primary>transport</primary>
33977 <secondary>current directory for</secondary>
33979 This specifies the current directory that is to be set while running the
33980 transport, overriding any value that may have been set by the router.
33981 If the expansion fails for any reason, including forced failure, an error is
33982 logged, and delivery is deferred.
33985 <indexterm role="option">
33986 <primary>disable_logging</primary>
33989 <informaltable frame="all">
33990 <tgroup cols="4" colsep="0" rowsep="0">
33991 <colspec colwidth="8*" align="left"/>
33992 <colspec colwidth="5*" align="center"/>
33993 <colspec colwidth="5*" align="center"/>
33994 <colspec colwidth="6*" align="right"/>
33997 <entry><option>disable_logging</option></entry>
33998 <entry>Use: <emphasis>transports</emphasis></entry>
33999 <entry>Type: <emphasis>boolean</emphasis></entry>
34000 <entry>Default: <emphasis>false</emphasis></entry>
34006 If this option is set true, nothing is logged for any
34007 deliveries by the transport or for any
34008 transport errors. You should not set this option unless you really, really know
34009 what you are doing.
34012 <indexterm role="option">
34013 <primary>debug_print</primary>
34016 <informaltable frame="all">
34017 <tgroup cols="4" colsep="0" rowsep="0">
34018 <colspec colwidth="8*" align="left"/>
34019 <colspec colwidth="5*" align="center"/>
34020 <colspec colwidth="5*" align="center"/>
34021 <colspec colwidth="6*" align="right"/>
34024 <entry><option>debug_print</option></entry>
34025 <entry>Use: <emphasis>transports</emphasis></entry>
34026 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34027 <entry>Default: <emphasis>unset</emphasis></entry>
34033 <indexterm role="concept">
34034 <primary>testing</primary>
34035 <secondary>variables in drivers</secondary>
34037 If this option is set and debugging is enabled (see the <option>-d</option> command line
34038 option), the string is expanded and included in the debugging output when the
34040 If expansion of the string fails, the error message is written to the debugging
34041 output, and Exim carries on processing.
34042 This facility is provided to help with checking out the values of variables and
34043 so on when debugging driver configurations. For example, if a <option>headers_add</option>
34044 option is not working properly, <option>debug_print</option> could be used to output the
34045 variables it references. A newline is added to the text if it does not end with
34049 <indexterm role="option">
34050 <primary>delivery_date_add</primary>
34053 <informaltable frame="all">
34054 <tgroup cols="4" colsep="0" rowsep="0">
34055 <colspec colwidth="8*" align="left"/>
34056 <colspec colwidth="5*" align="center"/>
34057 <colspec colwidth="5*" align="center"/>
34058 <colspec colwidth="6*" align="right"/>
34061 <entry><option>delivery_date_add</option></entry>
34062 <entry>Use: <emphasis>transports</emphasis></entry>
34063 <entry>Type: <emphasis>boolean</emphasis></entry>
34064 <entry>Default: <emphasis>false</emphasis></entry>
34070 <indexterm role="concept">
34071 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
34073 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
34074 This gives the actual time the delivery was made. As this is not a standard
34075 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
34076 requests its removal from incoming messages, so that delivered messages can
34077 safely be resent to other recipients.
34080 <indexterm role="option">
34081 <primary>driver</primary>
34084 <informaltable frame="all">
34085 <tgroup cols="4" colsep="0" rowsep="0">
34086 <colspec colwidth="8*" align="left"/>
34087 <colspec colwidth="5*" align="center"/>
34088 <colspec colwidth="5*" align="center"/>
34089 <colspec colwidth="6*" align="right"/>
34092 <entry><option>driver</option></entry>
34093 <entry>Use: <emphasis>transports</emphasis></entry>
34094 <entry>Type: <emphasis>string</emphasis></entry>
34095 <entry>Default: <emphasis>unset</emphasis></entry>
34101 This specifies which of the available transport drivers is to be used.
34102 There is no default, and this option must be set for every transport.
34105 <indexterm role="option">
34106 <primary>envelope_to_add</primary>
34109 <informaltable frame="all">
34110 <tgroup cols="4" colsep="0" rowsep="0">
34111 <colspec colwidth="8*" align="left"/>
34112 <colspec colwidth="5*" align="center"/>
34113 <colspec colwidth="5*" align="center"/>
34114 <colspec colwidth="6*" align="right"/>
34117 <entry><option>envelope_to_add</option></entry>
34118 <entry>Use: <emphasis>transports</emphasis></entry>
34119 <entry>Type: <emphasis>boolean</emphasis></entry>
34120 <entry>Default: <emphasis>false</emphasis></entry>
34126 <indexterm role="concept">
34127 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
34129 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
34130 This gives the original address(es) in the incoming envelope that caused this
34131 delivery to happen. More than one address may be present if the transport is
34132 configured to handle several addresses at once, or if more than one original
34133 address was redirected to the same final address. As this is not a standard
34134 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
34135 its removal from incoming messages, so that delivered messages can safely be
34136 resent to other recipients.
34139 <indexterm role="option">
34140 <primary>group</primary>
34143 <informaltable frame="all">
34144 <tgroup cols="4" colsep="0" rowsep="0">
34145 <colspec colwidth="8*" align="left"/>
34146 <colspec colwidth="5*" align="center"/>
34147 <colspec colwidth="5*" align="center"/>
34148 <colspec colwidth="6*" align="right"/>
34151 <entry><option>group</option></entry>
34152 <entry>Use: <emphasis>transports</emphasis></entry>
34153 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34154 <entry>Default: <emphasis>Exim group</emphasis></entry>
34160 <indexterm role="concept">
34161 <primary>transport</primary>
34162 <secondary>group; specifying</secondary>
34164 This option specifies a gid for running the transport process, overriding any
34165 value that the router supplies, and also overriding any value associated with
34166 <option>user</option> (see below).
34169 <indexterm role="option">
34170 <primary>headers_add</primary>
34173 <informaltable frame="all">
34174 <tgroup cols="4" colsep="0" rowsep="0">
34175 <colspec colwidth="8*" align="left"/>
34176 <colspec colwidth="5*" align="center"/>
34177 <colspec colwidth="5*" align="center"/>
34178 <colspec colwidth="6*" align="right"/>
34181 <entry><option>headers_add</option></entry>
34182 <entry>Use: <emphasis>transports</emphasis></entry>
34183 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34184 <entry>Default: <emphasis>unset</emphasis></entry>
34190 <indexterm role="concept">
34191 <primary>header lines</primary>
34192 <secondary>adding in transport</secondary>
34194 <indexterm role="concept">
34195 <primary>transport</primary>
34196 <secondary>header lines; adding</secondary>
34198 This option specifies a string of text that is expanded and added to the header
34199 portion of a message as it is transported, as described in section
34200 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
34201 routers. If the result of the expansion is an empty string, or if the expansion
34202 is forced to fail, no action is taken. Other expansion failures are treated as
34203 errors and cause the delivery to be deferred.
34206 <indexterm role="option">
34207 <primary>headers_only</primary>
34210 <informaltable frame="all">
34211 <tgroup cols="4" colsep="0" rowsep="0">
34212 <colspec colwidth="8*" align="left"/>
34213 <colspec colwidth="5*" align="center"/>
34214 <colspec colwidth="5*" align="center"/>
34215 <colspec colwidth="6*" align="right"/>
34218 <entry><option>headers_only</option></entry>
34219 <entry>Use: <emphasis>transports</emphasis></entry>
34220 <entry>Type: <emphasis>boolean</emphasis></entry>
34221 <entry>Default: <emphasis>false</emphasis></entry>
34227 <indexterm role="concept">
34228 <primary>transport</primary>
34229 <secondary>header lines only</secondary>
34231 <indexterm role="concept">
34232 <primary>message</primary>
34233 <secondary>transporting headers only</secondary>
34235 <indexterm role="concept">
34236 <primary>header lines</primary>
34237 <secondary>transporting</secondary>
34239 If this option is set, the message’s body is not transported. It is mutually
34240 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
34241 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
34242 checked, since this option does not automatically suppress them.
34245 <indexterm role="option">
34246 <primary>headers_remove</primary>
34249 <informaltable frame="all">
34250 <tgroup cols="4" colsep="0" rowsep="0">
34251 <colspec colwidth="8*" align="left"/>
34252 <colspec colwidth="5*" align="center"/>
34253 <colspec colwidth="5*" align="center"/>
34254 <colspec colwidth="6*" align="right"/>
34257 <entry><option>headers_remove</option></entry>
34258 <entry>Use: <emphasis>transports</emphasis></entry>
34259 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34260 <entry>Default: <emphasis>unset</emphasis></entry>
34266 <indexterm role="concept">
34267 <primary>header lines</primary>
34268 <secondary>removing</secondary>
34270 <indexterm role="concept">
34271 <primary>transport</primary>
34272 <secondary>header lines; removing</secondary>
34274 This option specifies a string that is expanded into a list of header names;
34275 these headers are omitted from the message as it is transported, as described
34276 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
34277 routers. If the result of the expansion is an empty string, or if the expansion
34278 is forced to fail, no action is taken. Other expansion failures are treated as
34279 errors and cause the delivery to be deferred.
34282 <indexterm role="option">
34283 <primary>headers_rewrite</primary>
34286 <informaltable frame="all">
34287 <tgroup cols="4" colsep="0" rowsep="0">
34288 <colspec colwidth="8*" align="left"/>
34289 <colspec colwidth="5*" align="center"/>
34290 <colspec colwidth="5*" align="center"/>
34291 <colspec colwidth="6*" align="right"/>
34294 <entry><option>headers_rewrite</option></entry>
34295 <entry>Use: <emphasis>transports</emphasis></entry>
34296 <entry>Type: <emphasis>string</emphasis></entry>
34297 <entry>Default: <emphasis>unset</emphasis></entry>
34303 <indexterm role="concept">
34304 <primary>transport</primary>
34305 <secondary>header lines; rewriting</secondary>
34307 <indexterm role="concept">
34308 <primary>rewriting</primary>
34309 <secondary>at transport time</secondary>
34311 This option allows addresses in header lines to be rewritten at transport time,
34312 that is, as the message is being copied to its destination. The contents of the
34313 option are a colon-separated list of rewriting rules. Each rule is in exactly
34314 the same form as one of the general rewriting rules that are applied when a
34315 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
34318 <literallayout class="monospaced">
34319 headers_rewrite = a@b c@d f : \
34323 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
34324 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
34325 header lines just before they are written out at transport time, so they affect
34326 only those copies of the message that pass through the transport. However, only
34327 the message’s original header lines, and any that were added by a system
34328 filter, are rewritten. If a router or transport adds header lines, they are not
34329 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
34330 envelope. You can change the return path using <option>return_path</option>, but you cannot
34331 change envelope recipients at this time.
34334 <indexterm role="option">
34335 <primary>home_directory</primary>
34338 <informaltable frame="all">
34339 <tgroup cols="4" colsep="0" rowsep="0">
34340 <colspec colwidth="8*" align="left"/>
34341 <colspec colwidth="5*" align="center"/>
34342 <colspec colwidth="5*" align="center"/>
34343 <colspec colwidth="6*" align="right"/>
34346 <entry><option>home_directory</option></entry>
34347 <entry>Use: <emphasis>transports</emphasis></entry>
34348 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34349 <entry>Default: <emphasis>unset</emphasis></entry>
34355 <indexterm role="concept">
34356 <primary>transport</primary>
34357 <secondary>home directory for</secondary>
34359 <indexterm role="concept">
34360 <primary><varname>$home</varname></primary>
34362 This option specifies a home directory setting for <phrase revisionflag="changed">a local</phrase> transport,
34363 overriding any value that may be set by the router. The home directory is
34364 placed in <varname>$home</varname> while expanding the transport’s private options. It is also
34365 used as the current directory if no current directory is set by the
34366 <option>current_directory</option> option on the transport or the
34367 <option>transport_current_directory</option> option on the router. If the expansion fails
34368 for any reason, including forced failure, an error is logged, and delivery is
34372 <indexterm role="option">
34373 <primary>initgroups</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>initgroups</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>additional groups</primary>
34396 <indexterm role="concept">
34397 <primary>groups</primary>
34398 <secondary>additional</secondary>
34400 <indexterm role="concept">
34401 <primary>transport</primary>
34402 <secondary>group; additional</secondary>
34404 If this option is true and the uid for the delivery process is provided by the
34405 transport, the <function>initgroups()</function> function is called when running the transport
34406 to ensure that any additional groups associated with the uid are set up.
34409 <indexterm role="option">
34410 <primary>message_size_limit</primary>
34413 <informaltable frame="all">
34414 <tgroup cols="4" colsep="0" rowsep="0">
34415 <colspec colwidth="8*" align="left"/>
34416 <colspec colwidth="5*" align="center"/>
34417 <colspec colwidth="5*" align="center"/>
34418 <colspec colwidth="6*" align="right"/>
34421 <entry><option>message_size_limit</option></entry>
34422 <entry>Use: <emphasis>transports</emphasis></entry>
34423 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34424 <entry>Default: <emphasis>0</emphasis></entry>
34430 <indexterm role="concept">
34431 <primary>limit</primary>
34432 <secondary>message size per transport</secondary>
34434 <indexterm role="concept">
34435 <primary>size of message</primary>
34436 <secondary>limit</secondary>
34438 <indexterm role="concept">
34439 <primary>transport</primary>
34440 <secondary>message size; limiting</secondary>
34442 This option controls the size of messages passed through the transport. It is
34443 expanded before use; the result of the expansion must be a sequence of digits,
34444 optionally followed by K or M.
34445 If the expansion fails for any reason, including forced failure, or if the
34446 result is not of the required form, delivery is deferred.
34447 If the value is greater than zero and the size of a message exceeds this
34448 limit, the address is failed. If there is any chance that the resulting bounce
34449 message could be routed to the same transport, you should ensure that
34450 <option>return_size_limit</option> is less than the transport’s <option>message_size_limit</option>, as
34451 otherwise the bounce message will fail to get delivered.
34454 <indexterm role="option">
34455 <primary>rcpt_include_affixes</primary>
34458 <informaltable frame="all">
34459 <tgroup cols="4" colsep="0" rowsep="0">
34460 <colspec colwidth="8*" align="left"/>
34461 <colspec colwidth="5*" align="center"/>
34462 <colspec colwidth="5*" align="center"/>
34463 <colspec colwidth="6*" align="right"/>
34466 <entry><option>rcpt_include_affixes</option></entry>
34467 <entry>Use: <emphasis>transports</emphasis></entry>
34468 <entry>Type: <emphasis>boolean</emphasis></entry>
34469 <entry>Default: <emphasis>false</emphasis></entry>
34475 <indexterm role="concept">
34476 <primary>prefix</primary>
34477 <secondary>for local part; including in envelope</secondary>
34479 <indexterm role="concept">
34480 <primary>suffix</primary>
34481 <secondary>for local part; including in envelope</secondary>
34483 <indexterm role="concept">
34484 <primary>local part</primary>
34485 <secondary>prefix</secondary>
34487 <indexterm role="concept">
34488 <primary>local part</primary>
34489 <secondary>suffix</secondary>
34491 When this option is false (the default), and an address that has had any
34492 affixes (prefixes or suffixes) removed from the local part is delivered by any
34493 form of SMTP or LMTP, the affixes are not included. For example, if a router
34496 <literallayout class="monospaced">
34497 local_part_prefix = *-
34500 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
34503 <literallayout class="monospaced">
34504 RCPT TO:<xyz@some.domain>
34507 This is also the case when an ACL-time callout is being used to verify a
34508 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
34509 whole local part is included in the RCPT command. This option applies to BSMTP
34510 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
34511 <command>lmtp</command> and <command>smtp</command> transports.
34514 <indexterm role="option">
34515 <primary>retry_use_local_part</primary>
34518 <informaltable frame="all">
34519 <tgroup cols="4" colsep="0" rowsep="0">
34520 <colspec colwidth="8*" align="left"/>
34521 <colspec colwidth="5*" align="center"/>
34522 <colspec colwidth="5*" align="center"/>
34523 <colspec colwidth="6*" align="right"/>
34526 <entry><option>retry_use_local_part</option></entry>
34527 <entry>Use: <emphasis>transports</emphasis></entry>
34528 <entry>Type: <emphasis>boolean</emphasis></entry>
34529 <entry>Default: <emphasis>see below</emphasis></entry>
34535 <indexterm role="concept">
34536 <primary>hints database</primary>
34537 <secondary>retry keys</secondary>
34539 When a delivery suffers a temporary failure, a retry record is created
34540 in Exim’s hints database. For remote deliveries, the key for the retry record
34541 is based on the name and/or IP address of the failing remote host. For local
34542 deliveries, the key is normally the entire address, including both the local
34543 part and the domain. This is suitable for most common cases of local delivery
34544 temporary failure – for example, exceeding a mailbox quota should delay only
34545 deliveries to that mailbox, not to the whole domain.
34548 However, in some special cases you may want to treat a temporary local delivery
34549 as a failure associated with the domain, and not with a particular local part.
34550 (For example, if you are storing all mail for some domain in files.) You can do
34551 this by setting <option>retry_use_local_part</option> false.
34554 For all the local transports, its default value is true. For remote transports,
34555 the default value is false for tidiness, but changing the value has no effect
34556 on a remote transport in the current implementation.
34559 <indexterm role="option">
34560 <primary>return_path</primary>
34563 <informaltable frame="all">
34564 <tgroup cols="4" colsep="0" rowsep="0">
34565 <colspec colwidth="8*" align="left"/>
34566 <colspec colwidth="5*" align="center"/>
34567 <colspec colwidth="5*" align="center"/>
34568 <colspec colwidth="6*" align="right"/>
34571 <entry><option>return_path</option></entry>
34572 <entry>Use: <emphasis>transports</emphasis></entry>
34573 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34574 <entry>Default: <emphasis>unset</emphasis></entry>
34580 <indexterm role="concept">
34581 <primary>envelope sender</primary>
34583 <indexterm role="concept">
34584 <primary>transport</primary>
34585 <secondary>return path; changing</secondary>
34587 <indexterm role="concept">
34588 <primary>return path</primary>
34589 <secondary>changing in transport</secondary>
34591 If this option is set, the string is expanded at transport time and replaces
34592 the existing return path (envelope sender) value in the copy of the message
34593 that is being delivered. An empty return path is permitted. This feature is
34594 designed for remote deliveries, where the value of this option is used in the
34595 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
34596 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
34597 header line, if one is added to the message (see the next option).
34600 <indexterm role="concept">
34601 <primary><varname>$return_path</varname></primary>
34603 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
34604 either the message’s envelope sender, or an address set by the
34605 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
34606 replacement occurs; if it fails for another reason, delivery is deferred. This
34607 option can be used to support VERP (Variable Envelope Return Paths) – see
34608 section <xref linkend="SECTverp"/>.
34610 <para revisionflag="changed">
34611 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
34612 remote server rejects a message at SMTP time, the bounce message is not sent to
34613 the value of this option. It is sent to the previously set errors address.
34614 This defaults to the incoming sender address, but can be changed by setting
34615 <option>errors_to</option> in a router.
34618 <indexterm role="option">
34619 <primary>return_path_add</primary>
34622 <informaltable frame="all">
34623 <tgroup cols="4" colsep="0" rowsep="0">
34624 <colspec colwidth="8*" align="left"/>
34625 <colspec colwidth="5*" align="center"/>
34626 <colspec colwidth="5*" align="center"/>
34627 <colspec colwidth="6*" align="right"/>
34630 <entry><option>return_path_add</option></entry>
34631 <entry>Use: <emphasis>transports</emphasis></entry>
34632 <entry>Type: <emphasis>boolean</emphasis></entry>
34633 <entry>Default: <emphasis>false</emphasis></entry>
34639 <indexterm role="concept">
34640 <primary><emphasis>Return-path:</emphasis> header line</primary>
34642 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
34643 Although the return path is normally available in the prefix line of BSD
34644 mailboxes, this is commonly not displayed by MUAs, and so the user does not
34645 have easy access to it.
34648 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
34649 the delivery SMTP server makes the final delivery</quote>. This implies that this
34650 header should not be present in incoming messages. Exim has a configuration
34651 option, <option>return_path_remove</option>, which requests removal of this header from
34652 incoming messages, so that delivered messages can safely be resent to other
34656 <indexterm role="option">
34657 <primary>shadow_condition</primary>
34660 <informaltable frame="all">
34661 <tgroup cols="4" colsep="0" rowsep="0">
34662 <colspec colwidth="8*" align="left"/>
34663 <colspec colwidth="5*" align="center"/>
34664 <colspec colwidth="5*" align="center"/>
34665 <colspec colwidth="6*" align="right"/>
34668 <entry><option>shadow_condition</option></entry>
34669 <entry>Use: <emphasis>transports</emphasis></entry>
34670 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34671 <entry>Default: <emphasis>unset</emphasis></entry>
34677 See <option>shadow_transport</option> below.
34680 <indexterm role="option">
34681 <primary>shadow_transport</primary>
34684 <informaltable frame="all">
34685 <tgroup cols="4" colsep="0" rowsep="0">
34686 <colspec colwidth="8*" align="left"/>
34687 <colspec colwidth="5*" align="center"/>
34688 <colspec colwidth="5*" align="center"/>
34689 <colspec colwidth="6*" align="right"/>
34692 <entry><option>shadow_transport</option></entry>
34693 <entry>Use: <emphasis>transports</emphasis></entry>
34694 <entry>Type: <emphasis>string</emphasis></entry>
34695 <entry>Default: <emphasis>unset</emphasis></entry>
34701 <indexterm role="concept">
34702 <primary>shadow transport</primary>
34704 <indexterm role="concept">
34705 <primary>transport</primary>
34706 <secondary>shadow</secondary>
34708 A local transport may set the <option>shadow_transport</option> option to the name of
34709 another local transport. Shadow remote transports are not supported.
34712 Whenever a delivery to the main transport succeeds, and either
34713 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
34714 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
34715 passed to the shadow transport, with the same delivery address or addresses. If
34716 expansion fails, no action is taken except that non-forced expansion failures
34717 cause a log line to be written.
34720 The result of the shadow transport is discarded and does not affect the
34721 subsequent processing of the message. Only a single level of shadowing is
34722 provided; the <option>shadow_transport</option> option is ignored on any transport when it
34723 is running as a shadow. Options concerned with output from pipes are also
34724 ignored. The log line for the successful delivery has an item added on the end,
34727 <literallayout class="monospaced">
34728 ST=<shadow transport name>
34731 If the shadow transport did not succeed, the error message is put in
34732 parentheses afterwards. Shadow transports can be used for a number of different
34733 purposes, including keeping more detailed log information than Exim normally
34734 provides, and implementing automatic acknowledgement policies based on message
34735 headers that some sites insist on.
34738 <indexterm role="option">
34739 <primary>transport_filter</primary>
34742 <informaltable frame="all">
34743 <tgroup cols="4" colsep="0" rowsep="0">
34744 <colspec colwidth="8*" align="left"/>
34745 <colspec colwidth="5*" align="center"/>
34746 <colspec colwidth="5*" align="center"/>
34747 <colspec colwidth="6*" align="right"/>
34750 <entry><option>transport_filter</option></entry>
34751 <entry>Use: <emphasis>transports</emphasis></entry>
34752 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34753 <entry>Default: <emphasis>unset</emphasis></entry>
34759 <indexterm role="concept">
34760 <primary>transport</primary>
34761 <secondary>filter</secondary>
34763 <indexterm role="concept">
34764 <primary>filter</primary>
34765 <secondary>transport filter</secondary>
34767 This option sets up a filtering (in the Unix shell sense) process for messages
34768 at transport time. It should not be confused with mail filtering as set up by
34769 individual users or via a system filter.
34772 When the message is about to be written out, the command specified by
34773 <option>transport_filter</option> is started up in a separate, parallel process, and
34774 the entire message, including the header lines, is passed to it on its standard
34775 input (this in fact is done from a third process, to avoid deadlock). The
34776 command must be specified as an absolute path.
34779 The lines of the message that are written to the transport filter are
34780 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
34781 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
34782 lines beginning with a dot, and also before any processing implied by the
34783 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
34784 <command>pipe</command> transports.
34787 The standard error for the filter process is set to the same destination as its
34788 standard output; this is read and written to the message’s ultimate
34789 destination. The process that writes the message to the filter, the
34790 filter itself, and the original process that reads the result and delivers it
34791 are all run in parallel, like a shell pipeline.
34794 The filter can perform any transformations it likes, but of course should take
34795 care not to break RFC 2822 syntax. A demonstration Perl script is provided in
34796 <filename>util/transport-filter.pl</filename>; this makes a few arbitrary modifications just to
34797 show the possibilities. Exim does not check the result, except to test for a
34798 final newline when SMTP is in use. All messages transmitted over SMTP must end
34799 with a newline, so Exim supplies one if it is missing.
34802 <indexterm role="concept">
34803 <primary>content scanning</primary>
34804 <secondary>per user</secondary>
34806 A transport filter can be used to provide content-scanning on a per-user basis
34807 at delivery time if the only required effect of the scan is to modify the
34808 message. For example, a content scan could insert a new header line containing
34809 a spam score. This could be interpreted by a filter in the user’s MUA. It is
34810 not possible to discard a message at this stage.
34813 <indexterm role="concept">
34814 <primary>SMTP</primary>
34815 <secondary>SIZE</secondary>
34817 A problem might arise if the filter increases the size of a message that is
34818 being sent down an SMTP connection. If the receiving SMTP server has indicated
34819 support for the SIZE parameter, Exim will have sent the size of the message
34820 at the start of the SMTP session. If what is actually sent is substantially
34821 more, the server might reject the message. This can be worked round by setting
34822 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
34823 additions to the message, or to disable the use of SIZE altogether.
34826 <indexterm role="concept">
34827 <primary><varname>$pipe_addresses</varname></primary>
34829 The value of the <option>transport_filter</option> option is the command string for starting
34830 the filter, which is run directly from Exim, not under a shell. The string is
34831 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
34832 Exim breaks it up into arguments and then expands each argument separately (see
34833 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
34834 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
34835 of arguments, one for each address that applies to this delivery. (This isn’t
34836 an ideal name for this feature here, but as it was already implemented for the
34837 <command>pipe</command> transport, it seemed sensible not to change it.)
34840 <indexterm role="concept">
34841 <primary><varname>$host</varname></primary>
34843 <indexterm role="concept">
34844 <primary><varname>$host_address</varname></primary>
34846 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
34847 transport is a remote one. They contain the name and IP address of the host to
34848 which the message is being sent. For example:
34850 <literallayout class="monospaced">
34851 transport_filter = /some/directory/transport-filter.pl \
34852 $host $host_address $sender_address $pipe_addresses
34854 <para revisionflag="changed">
34855 Two problems arise if you want to use more complicated expansion items to
34856 generate transport filter commands, both of which due to the fact that the
34857 command is split up <emphasis>before</emphasis> expansion.
34859 <itemizedlist revisionflag="changed">
34861 <para revisionflag="changed">
34862 If an expansion item contains white space, you must quote it, so that it is all
34863 part of the same command item. If the entire option setting is one such
34864 expansion item, you have to take care what kind of quoting you use. For
34867 <literallayout class="monospaced" revisionflag="changed">
34868 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
34870 <para revisionflag="changed">
34871 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
34872 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
34873 stripped by Exim when it read the option’s value. When the value is used, if
34874 the single quotes were missing, the line would be split into two items,
34875 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
34876 Exim tried to expand the first one.
34880 <para revisionflag="changed">
34881 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
34882 expansion cannot generate multiple arguments, or a command name followed by
34883 arguments. Consider this example:
34885 <literallayout class="monospaced" revisionflag="changed">
34886 transport_filter = ${lookup{$host}lsearch{/some/file}\
34887 {$value}{/bin/cat}}
34889 <para revisionflag="changed">
34890 The result of the lookup is interpreted as the name of the command, even
34891 if it contains white space. The simplest way round this is to use a shell:
34893 <literallayout class="monospaced" revisionflag="changed">
34894 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/some/file}\
34895 {$value}{/bin/cat}}
34900 The filter process is run under the same uid and gid as the normal delivery.
34901 For remote deliveries this is the Exim uid/gid by default. The command should
34902 normally yield a zero return code. Transport filters are not supposed to fail.
34903 A non-zero code is taken to mean that the transport filter encountered some
34904 serious problem. Delivery of the message is deferred; the message remains on
34905 the queue and is tried again later. It is not possible to cause a message to be
34906 bounced from a transport filter.
34909 If a transport filter is set on an autoreply transport, the original message is
34910 passed through the filter as it is being copied into the newly generated
34911 message, which happens if the <option>return_message</option> option is set.
34914 <indexterm role="option">
34915 <primary>transport_filter_timeout</primary>
34918 <informaltable frame="all">
34919 <tgroup cols="4" colsep="0" rowsep="0">
34920 <colspec colwidth="8*" align="left"/>
34921 <colspec colwidth="5*" align="center"/>
34922 <colspec colwidth="5*" align="center"/>
34923 <colspec colwidth="6*" align="right"/>
34926 <entry><option>transport_filter_timeout</option></entry>
34927 <entry>Use: <emphasis>transports</emphasis></entry>
34928 <entry>Type: <emphasis>time</emphasis></entry>
34929 <entry>Default: <emphasis>5m</emphasis></entry>
34935 <indexterm role="concept">
34936 <primary>transport filter</primary>
34937 <secondary>timeout</secondary>
34939 When Exim is reading the output of a transport filter, it a applies a timeout
34940 that can be set by this option. Exceeding the timeout is normally treated as a
34941 temporary delivery failure. However, if a transport filter is used with a
34942 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
34943 way as a timeout in the pipe command itself. By default, a timeout is a hard
34944 error, but if the <command>pipe</command> transport’s <option>timeout_defer</option> option is set true, it
34945 becomes a temporary error.
34948 <indexterm role="option">
34949 <primary>user</primary>
34952 <informaltable frame="all">
34953 <tgroup cols="4" colsep="0" rowsep="0">
34954 <colspec colwidth="8*" align="left"/>
34955 <colspec colwidth="5*" align="center"/>
34956 <colspec colwidth="5*" align="center"/>
34957 <colspec colwidth="6*" align="right"/>
34960 <entry><option>user</option></entry>
34961 <entry>Use: <emphasis>transports</emphasis></entry>
34962 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34963 <entry>Default: <emphasis>Exim user</emphasis></entry>
34969 <indexterm role="concept">
34970 <primary>uid (user id)</primary>
34971 <secondary>local delivery</secondary>
34973 <indexterm role="concept">
34974 <primary>transport user</primary>
34975 <secondary>specifying</secondary>
34977 This option specifies the user under whose uid the delivery process is to be
34978 run, overriding any uid that may have been set by the router. If the user is
34979 given as a name, the uid is looked up from the password data, and the
34980 associated group is taken as the value of the gid to be used if the <option>group</option>
34984 For deliveries that use local transports, a user and group are normally
34985 specified explicitly or implicitly (for example, as a result of
34986 <option>check_local_user</option>) by the router or transport.
34989 <indexterm role="concept">
34990 <primary>hints database</primary>
34991 <secondary>access by remote transport</secondary>
34993 For remote transports, you should leave this option unset unless you really are
34994 sure you know what you are doing. When a remote transport is running, it needs
34995 to be able to access Exim’s hints databases, because each host may have its own
34997 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
34998 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
34999 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
35003 <chapter id="CHAPbatching">
35004 <title>Address batching in local transports</title>
35005 <titleabbrev>Address batching</titleabbrev>
35007 <indexterm role="concept">
35008 <primary>transport</primary>
35009 <secondary>local; address batching in</secondary>
35011 The only remote transport (<command>smtp</command>) is normally configured to handle more than
35012 one address at a time, so that when several addresses are routed to the same
35013 remote host, just one copy of the message is sent. Local transports, however,
35014 normally handle one address at a time. That is, a separate instance of the
35015 transport is run for each address that is routed to the transport. A separate
35016 copy of the message is delivered each time.
35019 <indexterm role="concept">
35020 <primary>batched local delivery</primary>
35022 <indexterm role="concept">
35023 <primary><option>batch_max</option></primary>
35025 <indexterm role="concept">
35026 <primary><option>batch_id</option></primary>
35028 In special cases, it may be desirable to handle several addresses at once in a
35029 local transport, for example:
35034 In an <command>appendfile</command> transport, when storing messages in files for later
35035 delivery by some other means, a single copy of the message with multiple
35036 recipients saves space.
35041 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
35042 a single copy saves time, and is the normal way LMTP is expected to work.
35047 In a <command>pipe</command> transport, when passing the message
35048 to a scanner program or
35049 to some other delivery mechanism such as UUCP, multiple recipients may be
35055 The three local transports (<command>appendfile</command>, <command>lmtp</command>, and <command>pipe</command>) all have
35056 the same options for controlling multiple (<quote>batched</quote>) deliveries, namely
35057 <option>batch_max</option> and <option>batch_id</option>. To save repeating the information for each
35058 transport, these options are described here.
35061 The <option>batch_max</option> option specifies the maximum number of addresses that can be
35062 delivered together in a single run of the transport. Its default value is one.
35063 When more than one address is routed to a transport that has a <option>batch_max</option>
35064 value greater than one, the addresses are delivered in a batch (that is, in a
35065 single run of the transport), subject to certain conditions:
35070 <indexterm role="concept">
35071 <primary><varname>$local_part</varname></primary>
35073 If any of the transport’s options contain a reference to <varname>$local_part</varname>, no
35074 batching is possible.
35079 <indexterm role="concept">
35080 <primary><varname>$domain</varname></primary>
35082 If any of the transport’s options contain a reference to <varname>$domain</varname>, only
35083 addresses with the same domain are batched.
35088 <indexterm role="concept">
35089 <primary>customizing</primary>
35090 <secondary>batching condition</secondary>
35092 If <option>batch_id</option> is set, it is expanded for each address, and only those
35093 addresses with the same expanded value are batched. This allows you to specify
35094 customized batching conditions.
35095 Failure of the expansion for any reason, including forced failure, disables
35096 batching, but it does not stop the delivery from taking place.
35101 Batched addresses must also have the same errors address (where to send
35102 delivery errors), the same header additions and removals, the same user and
35103 group for the transport, and if a host list is present, the first host must
35109 <indexterm role="concept">
35110 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
35112 If the generic <option>envelope_to_add</option> option is set for the transport, the
35113 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
35114 that are batched together.
35117 The <command>appendfile</command> and <command>pipe</command> transports have an option called <option>use_bsmtp</option>,
35118 which causes them to deliver the message in <quote>batched SMTP</quote> format, with the
35119 envelope represented as SMTP commands. The <option>check_string</option> and
35120 <option>escape_string</option> options are forced to the values
35122 <literallayout class="monospaced">
35124 escape_string = ".."
35127 when batched SMTP is in use. A full description of the batch SMTP mechanism is
35128 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
35129 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
35132 <indexterm role="concept">
35133 <primary><command>pipe</command> transport</primary>
35134 <secondary>with multiple addresses</secondary>
35136 <indexterm role="concept">
35137 <primary><varname>$pipe_addresses</varname></primary>
35139 If you are not using BSMTP, but are using a <command>pipe</command> transport, you can include
35140 <varname>$pipe_addresses</varname> as part of the command. This is not a true variable; it is
35141 a bit of magic that causes each of the recipient addresses to be inserted into
35142 the command as a separate argument. This provides a way of accessing all the
35143 addresses that are being delivered in the batch.
35146 If you are using a batching <command>appendfile</command> transport without <option>use_bsmtp</option>, the
35147 only way to preserve the recipient addresses is to set the <option>envelope_to_add</option>
35148 option. This causes an <emphasis>Envelope-to:</emphasis> header line to be added to the message,
35149 containing all the recipients.
35153 <chapter id="CHAPappendfile">
35154 <title>The appendfile transport</title>
35156 <indexterm role="concept" id="IIDapptra1" class="startofrange">
35157 <primary><command>appendfile</command> transport</primary>
35159 <indexterm role="concept" id="IIDapptra2" class="startofrange">
35160 <primary>transports</primary>
35161 <secondary><command>appendfile</command></secondary>
35163 <indexterm role="concept">
35164 <primary>directory creation</primary>
35166 <indexterm role="concept">
35167 <primary>creating directories</primary>
35169 The <command>appendfile</command> transport delivers a message by appending it to an existing
35170 file, or by creating an entirely new file in a specified directory. Single
35171 files to which messages are appended can be in the traditional Unix mailbox
35172 format, or optionally in the MBX format supported by the Pine MUA and
35173 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
35174 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
35175 to give added protection against failures that happen part-way through the
35176 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
35177 supported. For all file formats, Exim attempts to create as many levels of
35178 directory as necessary, provided that <option>create_directory</option> is set.
35181 The code for the optional formats is not included in the Exim binary by
35182 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
35183 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
35187 <indexterm role="concept">
35188 <primary>quota</primary>
35189 <secondary>system</secondary>
35191 Exim recognises system quota errors, and generates an appropriate message. Exim
35192 also supports its own quota control within the transport, for use when the
35193 system facility is unavailable or cannot be used for some reason.
35196 If there is an error while appending to a file (for example, quota exceeded or
35197 partition filled), Exim attempts to reset the file’s length and last
35198 modification time back to what they were before. If there is an error while
35199 creating an entirely new file, the new file is removed.
35202 Before appending to a file, a number of security checks are made, and the
35203 file is locked. A detailed description is given below, after the list of
35207 The <command>appendfile</command> transport is most commonly used for local deliveries to
35208 users’ mailboxes. However, it can also be used as a pseudo-remote transport for
35209 putting messages into files for remote delivery by some means other than Exim.
35210 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
35213 <section id="SECTfildiropt">
35214 <title>The file and directory options</title>
35216 The <option>file</option> option specifies a single file, to which the message is appended;
35217 the <option>directory</option> option specifies a directory, in which a new file containing
35218 the message is created. Only one of these two options can be set, and for
35219 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
35222 <indexterm role="concept">
35223 <primary><varname>$address_file</varname></primary>
35225 <indexterm role="concept">
35226 <primary><varname>$local_part</varname></primary>
35228 However, <command>appendfile</command> is also used for delivering messages to files or
35229 directories whose names (or parts of names) are obtained from alias,
35230 forwarding, or filtering operations (for example, a <option>save</option> command in a
35231 user’s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
35232 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
35233 name (or partial name) of the file or directory generated by the redirection
35234 operation. There are two cases:
35239 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
35240 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
35241 common case when users with local accounts use filtering to sort mail into
35242 different folders. See for example, the <command>address_file</command> transport in the
35243 default configuration. If the path ends with a slash, it is assumed to be the
35244 name of a directory. A delivery to a directory can also be forced by setting
35245 <option>maildir_format</option> or <option>mailstore_format</option>.
35250 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
35251 used to determine the file or directory name for the delivery. Normally, the
35252 contents of <varname>$address_file</varname> are used in some way in the string expansion.
35257 <indexterm role="concept">
35258 <primary>Sieve filter</primary>
35259 <secondary>configuring <command>appendfile</command></secondary>
35261 <indexterm role="concept">
35262 <primary>Sieve filter</primary>
35263 <secondary>relative mailbox path handling</secondary>
35265 As an example of the second case, consider an environment where users do not
35266 have home directories. They may be permitted to use Exim filter commands of the
35269 <literallayout class="monospaced">
35273 or Sieve filter commands of the form:
35275 <literallayout class="monospaced">
35276 require "fileinto";
35277 fileinto "folder23";
35280 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
35281 must transform the relative path into an appropriate absolute file name. In the
35282 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
35283 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
35284 way of handling this requirement:
35286 <literallayout class="monospaced">
35287 file = ${if eq{$address_file}{inbox} \
35288 {/var/mail/$local_part} \
35289 {${if eq{${substr_0_1:$address_file}}{/} \
35291 {$home/mail/$address_file} \
35296 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
35297 location, absolute paths are used without change, and other folders are in the
35298 <filename>mail</filename> directory within the home directory.
35301 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
35302 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
35303 the router. In particular, this is the case if <option>check_local_user</option> is set. If
35304 you want to prevent this happening at routing time, you can set
35305 <option>router_home_directory</option> empty. This forces the router to pass the relative
35306 path to the transport.
35309 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
35310 the <option>file</option> or <option>directory</option> option is still used if it is set.
35314 <title>Private options for appendfile</title>
35316 <indexterm role="concept">
35317 <primary>options</primary>
35318 <secondary><command>appendfile</command> transport</secondary>
35322 <indexterm role="option">
35323 <primary>allow_fifo</primary>
35326 <informaltable frame="all">
35327 <tgroup cols="4" colsep="0" rowsep="0">
35328 <colspec colwidth="8*" align="left"/>
35329 <colspec colwidth="5*" align="center"/>
35330 <colspec colwidth="5*" align="center"/>
35331 <colspec colwidth="6*" align="right"/>
35334 <entry><option>allow_fifo</option></entry>
35335 <entry>Use: <emphasis>appendfile</emphasis></entry>
35336 <entry>Type: <emphasis>boolean</emphasis></entry>
35337 <entry>Default: <emphasis>false</emphasis></entry>
35343 <indexterm role="concept">
35344 <primary>fifo (named pipe)</primary>
35346 <indexterm role="concept">
35347 <primary>named pipe (fifo)</primary>
35349 <indexterm role="concept">
35350 <primary>pipe</primary>
35351 <secondary>named (fifo)</secondary>
35353 Setting this option permits delivery to named pipes (FIFOs) as well as to
35354 regular files. If no process is reading the named pipe at delivery time, the
35355 delivery is deferred.
35358 <indexterm role="option">
35359 <primary>allow_symlink</primary>
35362 <informaltable frame="all">
35363 <tgroup cols="4" colsep="0" rowsep="0">
35364 <colspec colwidth="8*" align="left"/>
35365 <colspec colwidth="5*" align="center"/>
35366 <colspec colwidth="5*" align="center"/>
35367 <colspec colwidth="6*" align="right"/>
35370 <entry><option>allow_symlink</option></entry>
35371 <entry>Use: <emphasis>appendfile</emphasis></entry>
35372 <entry>Type: <emphasis>boolean</emphasis></entry>
35373 <entry>Default: <emphasis>false</emphasis></entry>
35379 <indexterm role="concept">
35380 <primary>symbolic link</primary>
35381 <secondary>to mailbox</secondary>
35383 <indexterm role="concept">
35384 <primary>mailbox</primary>
35385 <secondary>symbolic link</secondary>
35387 By default, <command>appendfile</command> will not deliver if the path name for the file is
35388 that of a symbolic link. Setting this option relaxes that constraint, but there
35389 are security issues involved in the use of symbolic links. Be sure you know
35390 what you are doing if you set this. Details of exactly what this option affects
35391 are included in the discussion which follows this list of options.
35394 <indexterm role="option">
35395 <primary>batch_id</primary>
35398 <informaltable frame="all">
35399 <tgroup cols="4" colsep="0" rowsep="0">
35400 <colspec colwidth="8*" align="left"/>
35401 <colspec colwidth="5*" align="center"/>
35402 <colspec colwidth="5*" align="center"/>
35403 <colspec colwidth="6*" align="right"/>
35406 <entry><option>batch_id</option></entry>
35407 <entry>Use: <emphasis>appendfile</emphasis></entry>
35408 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35409 <entry>Default: <emphasis>unset</emphasis></entry>
35415 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
35416 However, batching is automatically disabled for <command>appendfile</command> deliveries that
35417 happen as a result of forwarding or aliasing or other redirection directly to a
35421 <indexterm role="option">
35422 <primary>batch_max</primary>
35425 <informaltable frame="all">
35426 <tgroup cols="4" colsep="0" rowsep="0">
35427 <colspec colwidth="8*" align="left"/>
35428 <colspec colwidth="5*" align="center"/>
35429 <colspec colwidth="5*" align="center"/>
35430 <colspec colwidth="6*" align="right"/>
35433 <entry><option>batch_max</option></entry>
35434 <entry>Use: <emphasis>appendfile</emphasis></entry>
35435 <entry>Type: <emphasis>integer</emphasis></entry>
35436 <entry>Default: <emphasis>1</emphasis></entry>
35442 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
35445 <indexterm role="option">
35446 <primary>check_group</primary>
35449 <informaltable frame="all">
35450 <tgroup cols="4" colsep="0" rowsep="0">
35451 <colspec colwidth="8*" align="left"/>
35452 <colspec colwidth="5*" align="center"/>
35453 <colspec colwidth="5*" align="center"/>
35454 <colspec colwidth="6*" align="right"/>
35457 <entry><option>check_group</option></entry>
35458 <entry>Use: <emphasis>appendfile</emphasis></entry>
35459 <entry>Type: <emphasis>boolean</emphasis></entry>
35460 <entry>Default: <emphasis>false</emphasis></entry>
35466 When this option is set, the group owner of the file defined by the <option>file</option>
35467 option is checked to see that it is the same as the group under which the
35468 delivery process is running. The default setting is false because the default
35469 file mode is 0600, which means that the group is irrelevant.
35472 <indexterm role="option">
35473 <primary>check_owner</primary>
35476 <informaltable frame="all">
35477 <tgroup cols="4" colsep="0" rowsep="0">
35478 <colspec colwidth="8*" align="left"/>
35479 <colspec colwidth="5*" align="center"/>
35480 <colspec colwidth="5*" align="center"/>
35481 <colspec colwidth="6*" align="right"/>
35484 <entry><option>check_owner</option></entry>
35485 <entry>Use: <emphasis>appendfile</emphasis></entry>
35486 <entry>Type: <emphasis>boolean</emphasis></entry>
35487 <entry>Default: <emphasis>true</emphasis></entry>
35493 When this option is set, the owner of the file defined by the <option>file</option> option
35494 is checked to ensure that it is the same as the user under which the delivery
35495 process is running.
35498 <indexterm role="option">
35499 <primary>check_string</primary>
35502 <informaltable frame="all">
35503 <tgroup cols="4" colsep="0" rowsep="0">
35504 <colspec colwidth="8*" align="left"/>
35505 <colspec colwidth="5*" align="center"/>
35506 <colspec colwidth="5*" align="center"/>
35507 <colspec colwidth="6*" align="right"/>
35510 <entry><option>check_string</option></entry>
35511 <entry>Use: <emphasis>appendfile</emphasis></entry>
35512 <entry>Type: <emphasis>string</emphasis></entry>
35513 <entry>Default: <emphasis>see below</emphasis></entry>
35519 <indexterm role="concept">
35520 <primary><quote>From</quote> line</primary>
35522 As <command>appendfile</command> writes the message, the start of each line is tested for
35523 matching <option>check_string</option>, and if it does, the initial matching characters are
35524 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
35525 a literal string, not a regular expression, and the case of any letters it
35526 contains is significant.
35529 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
35530 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
35531 configuration are ignored. Otherwise, they default to <quote>From </quote> and
35532 <quote>>From </quote> when the <option>file</option> option is set, and unset when any of the
35533 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
35536 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
35537 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
35538 <quote>From </quote> indicates the start of a new message. All four options need changing
35539 if another format is used. For example, to deliver to mailboxes in MMDF format:
35540 <indexterm role="concept">
35541 <primary>MMDF format mailbox</primary>
35543 <indexterm role="concept">
35544 <primary>mailbox</primary>
35545 <secondary>MMDF format</secondary>
35548 <literallayout class="monospaced">
35549 check_string = "\1\1\1\1\n"
35550 escape_string = "\1\1\1\1 \n"
35551 message_prefix = "\1\1\1\1\n"
35552 message_suffix = "\1\1\1\1\n"
35555 <indexterm role="option">
35556 <primary>create_directory</primary>
35559 <informaltable frame="all">
35560 <tgroup cols="4" colsep="0" rowsep="0">
35561 <colspec colwidth="8*" align="left"/>
35562 <colspec colwidth="5*" align="center"/>
35563 <colspec colwidth="5*" align="center"/>
35564 <colspec colwidth="6*" align="right"/>
35567 <entry><option>create_directory</option></entry>
35568 <entry>Use: <emphasis>appendfile</emphasis></entry>
35569 <entry>Type: <emphasis>boolean</emphasis></entry>
35570 <entry>Default: <emphasis>true</emphasis></entry>
35576 <indexterm role="concept">
35577 <primary>directory creation</primary>
35579 When this option is true, Exim attempts to create any missing superior
35580 directories for the file that it is about to write. A created directory’s mode
35581 is given by the <option>directory_mode</option> option.
35584 The group ownership of a newly created directory is highly dependent on the
35585 operating system (and possibly the file system) that is being used. For
35586 example, in Solaris, if the parent directory has the setgid bit set, its group
35587 is propagated to the child; if not, the currently set group is used. However,
35588 in FreeBSD, the parent’s group is always used.
35591 <indexterm role="option">
35592 <primary>create_file</primary>
35595 <informaltable frame="all">
35596 <tgroup cols="4" colsep="0" rowsep="0">
35597 <colspec colwidth="8*" align="left"/>
35598 <colspec colwidth="5*" align="center"/>
35599 <colspec colwidth="5*" align="center"/>
35600 <colspec colwidth="6*" align="right"/>
35603 <entry><option>create_file</option></entry>
35604 <entry>Use: <emphasis>appendfile</emphasis></entry>
35605 <entry>Type: <emphasis>string</emphasis></entry>
35606 <entry>Default: <emphasis>anywhere</emphasis></entry>
35612 This option constrains the location of files and directories that are created
35613 by this transport. It applies to files defined by the <option>file</option> option and
35614 directories defined by the <option>directory</option> option. In the case of maildir
35615 delivery, it applies to the top level directory, not the maildir directories
35619 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
35620 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
35621 set for the transport. This option is not useful when an explicit file name is
35622 given for normal mailbox deliveries. It is intended for the case when file
35623 names are generated from users’ <filename>.forward</filename> files. These are usually handled
35624 by an <command>appendfile</command> transport called <option>address_file</option>. See also
35625 <option>file_must_exist</option>.
35628 <indexterm role="option">
35629 <primary>directory</primary>
35632 <informaltable frame="all">
35633 <tgroup cols="4" colsep="0" rowsep="0">
35634 <colspec colwidth="8*" align="left"/>
35635 <colspec colwidth="5*" align="center"/>
35636 <colspec colwidth="5*" align="center"/>
35637 <colspec colwidth="6*" align="right"/>
35640 <entry><option>directory</option></entry>
35641 <entry>Use: <emphasis>appendfile</emphasis></entry>
35642 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35643 <entry>Default: <emphasis>unset</emphasis></entry>
35649 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
35650 or <option>directory</option> must be set, unless the delivery is the direct result of a
35651 redirection (see section <xref linkend="SECTfildiropt"/>).
35654 When <option>directory</option> is set, the string is expanded, and the message is delivered
35655 into a new file or files in or below the given directory, instead of being
35656 appended to a single mailbox file. A number of different formats are provided
35657 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
35658 <xref linkend="SECTopdir"/> for further details of this form of delivery.
35661 <indexterm role="option">
35662 <primary>directory_file</primary>
35665 <informaltable frame="all">
35666 <tgroup cols="4" colsep="0" rowsep="0">
35667 <colspec colwidth="8*" align="left"/>
35668 <colspec colwidth="5*" align="center"/>
35669 <colspec colwidth="5*" align="center"/>
35670 <colspec colwidth="6*" align="right"/>
35673 <entry><option>directory_file</option></entry>
35674 <entry>Use: <emphasis>appendfile</emphasis></entry>
35675 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35676 <entry>Default: <emphasis><literal>q${base62:$tod_epoch}-$inode</literal></emphasis></entry>
35682 <indexterm role="concept">
35683 <primary>base62</primary>
35685 <indexterm role="concept">
35686 <primary><varname>$inode</varname></primary>
35688 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
35689 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
35690 whose name is obtained by expanding this string. The default value generates a
35691 unique name from the current time, in base 62 form, and the inode of the file.
35692 The variable <varname>$inode</varname> is available only when expanding this option.
35695 <indexterm role="option">
35696 <primary>directory_mode</primary>
35699 <informaltable frame="all">
35700 <tgroup cols="4" colsep="0" rowsep="0">
35701 <colspec colwidth="8*" align="left"/>
35702 <colspec colwidth="5*" align="center"/>
35703 <colspec colwidth="5*" align="center"/>
35704 <colspec colwidth="6*" align="right"/>
35707 <entry><option>directory_mode</option></entry>
35708 <entry>Use: <emphasis>appendfile</emphasis></entry>
35709 <entry>Type: <emphasis>octal integer</emphasis></entry>
35710 <entry>Default: <emphasis>0700</emphasis></entry>
35716 If <command>appendfile</command> creates any directories as a result of the
35717 <option>create_directory</option> option, their mode is specified by this option.
35720 <indexterm role="option">
35721 <primary>escape_string</primary>
35724 <informaltable frame="all">
35725 <tgroup cols="4" colsep="0" rowsep="0">
35726 <colspec colwidth="8*" align="left"/>
35727 <colspec colwidth="5*" align="center"/>
35728 <colspec colwidth="5*" align="center"/>
35729 <colspec colwidth="6*" align="right"/>
35732 <entry><option>escape_string</option></entry>
35733 <entry>Use: <emphasis>appendfile</emphasis></entry>
35734 <entry>Type: <emphasis>string</emphasis></entry>
35735 <entry>Default: <emphasis>see description</emphasis></entry>
35741 See <option>check_string</option> above.
35744 <indexterm role="option">
35745 <primary>file</primary>
35748 <informaltable frame="all">
35749 <tgroup cols="4" colsep="0" rowsep="0">
35750 <colspec colwidth="8*" align="left"/>
35751 <colspec colwidth="5*" align="center"/>
35752 <colspec colwidth="5*" align="center"/>
35753 <colspec colwidth="6*" align="right"/>
35756 <entry><option>file</option></entry>
35757 <entry>Use: <emphasis>appendfile</emphasis></entry>
35758 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35759 <entry>Default: <emphasis>unset</emphasis></entry>
35765 This option is mutually exclusive with the <option>directory</option> option, but one of
35766 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
35767 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
35768 specifies a single file, to which the message is appended. One or more of
35769 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
35770 <option>file</option>.
35773 <indexterm role="concept">
35774 <primary>NFS</primary>
35775 <secondary>lock file</secondary>
35777 <indexterm role="concept">
35778 <primary>locking files</primary>
35780 <indexterm role="concept">
35781 <primary>lock files</primary>
35783 If you are using more than one host to deliver over NFS into the same
35784 mailboxes, you should always use lock files.
35787 The string value is expanded for each delivery, and must yield an absolute
35788 path. The most common settings of this option are variations on one of these
35791 <literallayout class="monospaced">
35792 file = /var/spool/mail/$local_part
35793 file = /home/$local_part/inbox
35797 <indexterm role="concept">
35798 <primary><quote>sticky</quote> bit</primary>
35800 In the first example, all deliveries are done into the same directory. If Exim
35801 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
35802 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
35803 deliveries to be possible, or alternatively the <option>group</option> option can be used to
35804 run the delivery under a group id which has write access to the directory.
35807 <indexterm role="option">
35808 <primary>file_format</primary>
35811 <informaltable frame="all">
35812 <tgroup cols="4" colsep="0" rowsep="0">
35813 <colspec colwidth="8*" align="left"/>
35814 <colspec colwidth="5*" align="center"/>
35815 <colspec colwidth="5*" align="center"/>
35816 <colspec colwidth="6*" align="right"/>
35819 <entry><option>file_format</option></entry>
35820 <entry>Use: <emphasis>appendfile</emphasis></entry>
35821 <entry>Type: <emphasis>string</emphasis></entry>
35822 <entry>Default: <emphasis>unset</emphasis></entry>
35828 <indexterm role="concept">
35829 <primary>file</primary>
35830 <secondary>mailbox; checking existing format</secondary>
35832 This option requests the transport to check the format of an existing file
35833 before adding to it. The check consists of matching a specific string at the
35834 start of the file. The value of the option consists of an even number of
35835 colon-separated strings. The first of each pair is the test string, and the
35836 second is the name of a transport. If the transport associated with a matched
35837 string is not the current transport, control is passed over to the other
35838 transport. For example, suppose the standard <command>local_delivery</command> transport has
35841 <literallayout class="monospaced">
35842 file_format = "From : local_delivery :\
35843 \1\1\1\1\n : local_mmdf_delivery"
35846 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
35847 a mailbox begins with four binary ones followed by a newline, control is passed
35848 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
35849 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
35850 is assumed to match the current transport. If the start of a mailbox doesn’t
35851 match any string, or if the transport named for a given string is not defined,
35852 delivery is deferred.
35855 <indexterm role="option">
35856 <primary>file_must_exist</primary>
35859 <informaltable frame="all">
35860 <tgroup cols="4" colsep="0" rowsep="0">
35861 <colspec colwidth="8*" align="left"/>
35862 <colspec colwidth="5*" align="center"/>
35863 <colspec colwidth="5*" align="center"/>
35864 <colspec colwidth="6*" align="right"/>
35867 <entry><option>file_must_exist</option></entry>
35868 <entry>Use: <emphasis>appendfile</emphasis></entry>
35869 <entry>Type: <emphasis>boolean</emphasis></entry>
35870 <entry>Default: <emphasis>false</emphasis></entry>
35876 If this option is true, the file specified by the <option>file</option> option must exist,
35877 and an error occurs if it does not. Otherwise, it is created if it does not
35881 <indexterm role="option">
35882 <primary>lock_fcntl_timeout</primary>
35885 <informaltable frame="all">
35886 <tgroup cols="4" colsep="0" rowsep="0">
35887 <colspec colwidth="8*" align="left"/>
35888 <colspec colwidth="5*" align="center"/>
35889 <colspec colwidth="5*" align="center"/>
35890 <colspec colwidth="6*" align="right"/>
35893 <entry><option>lock_fcntl_timeout</option></entry>
35894 <entry>Use: <emphasis>appendfile</emphasis></entry>
35895 <entry>Type: <emphasis>time</emphasis></entry>
35896 <entry>Default: <emphasis>0s</emphasis></entry>
35902 <indexterm role="concept">
35903 <primary>timeout</primary>
35904 <secondary>mailbox locking</secondary>
35906 <indexterm role="concept">
35907 <primary>mailbox locking</primary>
35908 <secondary>blocking and non-blocking</secondary>
35910 <indexterm role="concept">
35911 <primary>locking files</primary>
35913 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
35914 when locking an open mailbox file. If the call fails, the delivery process
35915 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
35916 Non-blocking calls are used so that the file is not kept open during the wait
35917 for the lock; the reason for this is to make it as safe as possible for
35918 deliveries over NFS in the case when processes might be accessing an NFS
35919 mailbox without using a lock file. This should not be done, but
35920 misunderstandings and hence misconfigurations are not unknown.
35923 On a busy system, however, the performance of a non-blocking lock approach is
35924 not as good as using a blocking lock with a timeout. In this case, the waiting
35925 is done inside the system call, and Exim’s delivery process acquires the lock
35926 and can proceed as soon as the previous lock holder releases it.
35929 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
35930 timeout, are used. There may still be some retrying: the maximum number of
35933 <literallayout class="monospaced">
35934 (lock_retries * lock_interval) / lock_fcntl_timeout
35937 rounded up to the next whole number. In other words, the total time during
35938 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
35939 <option>lock_fcntl_timeout</option> is set very large.
35942 You should consider setting this option if you are getting a lot of delayed
35943 local deliveries because of errors of the form
35945 <literallayout class="monospaced">
35946 failed to lock mailbox /some/file (fcntl)
35949 <indexterm role="option">
35950 <primary>lock_flock_timeout</primary>
35953 <informaltable frame="all">
35954 <tgroup cols="4" colsep="0" rowsep="0">
35955 <colspec colwidth="8*" align="left"/>
35956 <colspec colwidth="5*" align="center"/>
35957 <colspec colwidth="5*" align="center"/>
35958 <colspec colwidth="6*" align="right"/>
35961 <entry><option>lock_flock_timeout</option></entry>
35962 <entry>Use: <emphasis>appendfile</emphasis></entry>
35963 <entry>Type: <emphasis>time</emphasis></entry>
35964 <entry>Default: <emphasis>0s</emphasis></entry>
35970 This timeout applies to file locking when using <function>flock()</function> (see
35971 <option>use_flock</option>); the timeout operates in a similar manner to
35972 <option>lock_fcntl_timeout</option>.
35975 <indexterm role="option">
35976 <primary>lock_interval</primary>
35979 <informaltable frame="all">
35980 <tgroup cols="4" colsep="0" rowsep="0">
35981 <colspec colwidth="8*" align="left"/>
35982 <colspec colwidth="5*" align="center"/>
35983 <colspec colwidth="5*" align="center"/>
35984 <colspec colwidth="6*" align="right"/>
35987 <entry><option>lock_interval</option></entry>
35988 <entry>Use: <emphasis>appendfile</emphasis></entry>
35989 <entry>Type: <emphasis>time</emphasis></entry>
35990 <entry>Default: <emphasis>3s</emphasis></entry>
35996 This specifies the time to wait between attempts to lock the file. See below
35997 for details of locking.
36000 <indexterm role="option">
36001 <primary>lock_retries</primary>
36004 <informaltable frame="all">
36005 <tgroup cols="4" colsep="0" rowsep="0">
36006 <colspec colwidth="8*" align="left"/>
36007 <colspec colwidth="5*" align="center"/>
36008 <colspec colwidth="5*" align="center"/>
36009 <colspec colwidth="6*" align="right"/>
36012 <entry><option>lock_retries</option></entry>
36013 <entry>Use: <emphasis>appendfile</emphasis></entry>
36014 <entry>Type: <emphasis>integer</emphasis></entry>
36015 <entry>Default: <emphasis>10</emphasis></entry>
36021 This specifies the maximum number of attempts to lock the file. A value of zero
36022 is treated as 1. See below for details of locking.
36025 <indexterm role="option">
36026 <primary>lockfile_mode</primary>
36029 <informaltable frame="all">
36030 <tgroup cols="4" colsep="0" rowsep="0">
36031 <colspec colwidth="8*" align="left"/>
36032 <colspec colwidth="5*" align="center"/>
36033 <colspec colwidth="5*" align="center"/>
36034 <colspec colwidth="6*" align="right"/>
36037 <entry><option>lockfile_mode</option></entry>
36038 <entry>Use: <emphasis>appendfile</emphasis></entry>
36039 <entry>Type: <emphasis>octal integer</emphasis></entry>
36040 <entry>Default: <emphasis>0600</emphasis></entry>
36046 This specifies the mode of the created lock file, when a lock file is being
36047 used (see <option>use_lockfile</option>).
36050 <indexterm role="option">
36051 <primary>lockfile_timeout</primary>
36054 <informaltable frame="all">
36055 <tgroup cols="4" colsep="0" rowsep="0">
36056 <colspec colwidth="8*" align="left"/>
36057 <colspec colwidth="5*" align="center"/>
36058 <colspec colwidth="5*" align="center"/>
36059 <colspec colwidth="6*" align="right"/>
36062 <entry><option>lockfile_timeout</option></entry>
36063 <entry>Use: <emphasis>appendfile</emphasis></entry>
36064 <entry>Type: <emphasis>time</emphasis></entry>
36065 <entry>Default: <emphasis>30m</emphasis></entry>
36071 <indexterm role="concept">
36072 <primary>timeout</primary>
36073 <secondary>mailbox locking</secondary>
36075 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
36076 exists and is older than this value, it is assumed to have been left behind by
36077 accident, and Exim attempts to remove it.
36080 <indexterm role="option">
36081 <primary>mailbox_filecount</primary>
36084 <informaltable frame="all">
36085 <tgroup cols="4" colsep="0" rowsep="0">
36086 <colspec colwidth="8*" align="left"/>
36087 <colspec colwidth="5*" align="center"/>
36088 <colspec colwidth="5*" align="center"/>
36089 <colspec colwidth="6*" align="right"/>
36092 <entry><option>mailbox_filecount</option></entry>
36093 <entry>Use: <emphasis>appendfile</emphasis></entry>
36094 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36095 <entry>Default: <emphasis>unset</emphasis></entry>
36101 <indexterm role="concept">
36102 <primary>mailbox</primary>
36103 <secondary>specifying size of</secondary>
36105 <indexterm role="concept">
36106 <primary>size</primary>
36107 <secondary>of mailbox</secondary>
36109 If this option is set, it is expanded, and the result is taken as the current
36110 number of files in the mailbox. It must be a decimal number, optionally
36111 followed by K or M. This provides a way of obtaining this information from an
36112 external source that maintains the data.
36115 <indexterm role="option">
36116 <primary>mailbox_size</primary>
36119 <informaltable frame="all">
36120 <tgroup cols="4" colsep="0" rowsep="0">
36121 <colspec colwidth="8*" align="left"/>
36122 <colspec colwidth="5*" align="center"/>
36123 <colspec colwidth="5*" align="center"/>
36124 <colspec colwidth="6*" align="right"/>
36127 <entry><option>mailbox_size</option></entry>
36128 <entry>Use: <emphasis>appendfile</emphasis></entry>
36129 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36130 <entry>Default: <emphasis>unset</emphasis></entry>
36136 <indexterm role="concept">
36137 <primary>mailbox</primary>
36138 <secondary>specifying size of</secondary>
36140 <indexterm role="concept">
36141 <primary>size</primary>
36142 <secondary>of mailbox</secondary>
36144 If this option is set, it is expanded, and the result is taken as the current
36145 size the mailbox. It must be a decimal number, optionally followed by K or M.
36146 This provides a way of obtaining this information from an external source that
36147 maintains the data. This is likely to be helpful for maildir deliveries where
36148 it is computationally expensive to compute the size of a mailbox.
36151 <indexterm role="option">
36152 <primary>maildir_format</primary>
36155 <informaltable frame="all">
36156 <tgroup cols="4" colsep="0" rowsep="0">
36157 <colspec colwidth="8*" align="left"/>
36158 <colspec colwidth="5*" align="center"/>
36159 <colspec colwidth="5*" align="center"/>
36160 <colspec colwidth="6*" align="right"/>
36163 <entry><option>maildir_format</option></entry>
36164 <entry>Use: <emphasis>appendfile</emphasis></entry>
36165 <entry>Type: <emphasis>boolean</emphasis></entry>
36166 <entry>Default: <emphasis>false</emphasis></entry>
36172 <indexterm role="concept">
36173 <primary>maildir format</primary>
36174 <secondary>specifying</secondary>
36176 If this option is set with the <option>directory</option> option, the delivery is into a new
36177 file, in the <quote>maildir</quote> format that is used by other mail software. When the
36178 transport is activated directly from a <command>redirect</command> router (for example, the
36179 <command>address_file</command> transport in the default configuration), setting
36180 <option>maildir_format</option> causes the path received from the router to be treated as a
36181 directory, whether or not it ends with <literal>/</literal>. This option is available only if
36182 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
36183 <xref linkend="SECTmaildirdelivery"/> below for further details.
36186 <indexterm role="option">
36187 <primary>maildir_quota_directory_regex</primary>
36190 <informaltable frame="all">
36191 <tgroup cols="4" colsep="0" rowsep="0">
36192 <colspec colwidth="8*" align="left"/>
36193 <colspec colwidth="5*" align="center"/>
36194 <colspec colwidth="5*" align="center"/>
36195 <colspec colwidth="6*" align="right"/>
36198 <entry><option>maildir_quota_directory_regex</option></entry>
36199 <entry>Use: <emphasis>appendfile</emphasis></entry>
36200 <entry>Type: <emphasis>string</emphasis></entry>
36201 <entry>Default: <emphasis>See below</emphasis></entry>
36207 <indexterm role="concept">
36208 <primary>maildir format</primary>
36209 <secondary>quota; directories included in</secondary>
36211 <indexterm role="concept">
36212 <primary>quota</primary>
36213 <secondary>maildir; directories included in</secondary>
36215 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
36216 a regular expression for specifying directories that should be included in the
36217 quota calculation. The default value is
36219 <literallayout class="monospaced">
36220 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
36223 which includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
36224 (directories whose names begin with a dot). If you want to exclude the
36225 <filename>Trash</filename>
36226 folder from the count (as some sites do), you need to change this setting to
36228 <literallayout class="monospaced">
36229 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
36232 This uses a negative lookahead in the regular expression to exclude the
36233 directory whose name is <filename>.Trash</filename>.
36236 <indexterm role="option">
36237 <primary>maildir_retries</primary>
36240 <informaltable frame="all">
36241 <tgroup cols="4" colsep="0" rowsep="0">
36242 <colspec colwidth="8*" align="left"/>
36243 <colspec colwidth="5*" align="center"/>
36244 <colspec colwidth="5*" align="center"/>
36245 <colspec colwidth="6*" align="right"/>
36248 <entry><option>maildir_retries</option></entry>
36249 <entry>Use: <emphasis>appendfile</emphasis></entry>
36250 <entry>Type: <emphasis>integer</emphasis></entry>
36251 <entry>Default: <emphasis>10</emphasis></entry>
36257 This option specifies the number of times to retry when writing a file in
36258 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
36261 <indexterm role="option">
36262 <primary>maildir_tag</primary>
36265 <informaltable frame="all">
36266 <tgroup cols="4" colsep="0" rowsep="0">
36267 <colspec colwidth="8*" align="left"/>
36268 <colspec colwidth="5*" align="center"/>
36269 <colspec colwidth="5*" align="center"/>
36270 <colspec colwidth="6*" align="right"/>
36273 <entry><option>maildir_tag</option></entry>
36274 <entry>Use: <emphasis>appendfile</emphasis></entry>
36275 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36276 <entry>Default: <emphasis>unset</emphasis></entry>
36282 This option applies only to deliveries in maildir format, and is described in
36283 section <xref linkend="SECTmaildirdelivery"/> below.
36286 <indexterm role="option">
36287 <primary>maildir_use_size_file</primary>
36290 <informaltable frame="all">
36291 <tgroup cols="4" colsep="0" rowsep="0">
36292 <colspec colwidth="8*" align="left"/>
36293 <colspec colwidth="5*" align="center"/>
36294 <colspec colwidth="5*" align="center"/>
36295 <colspec colwidth="6*" align="right"/>
36298 <entry><option>maildir_use_size_file</option></entry>
36299 <entry>Use: <emphasis>appendfile</emphasis></entry>
36300 <entry>Type: <emphasis>boolean</emphasis></entry>
36301 <entry>Default: <emphasis>false</emphasis></entry>
36307 <indexterm role="concept">
36308 <primary>maildir format</primary>
36309 <secondary><filename>maildirsize</filename> file</secondary>
36311 Setting this option true enables support for <filename>maildirsize</filename> files. Exim
36312 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
36313 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
36314 value is zero. See section <xref linkend="SECTmaildirdelivery"/> below for further details.
36317 <indexterm role="option">
36318 <primary>mailstore_format</primary>
36321 <informaltable frame="all">
36322 <tgroup cols="4" colsep="0" rowsep="0">
36323 <colspec colwidth="8*" align="left"/>
36324 <colspec colwidth="5*" align="center"/>
36325 <colspec colwidth="5*" align="center"/>
36326 <colspec colwidth="6*" align="right"/>
36329 <entry><option>mailstore_format</option></entry>
36330 <entry>Use: <emphasis>appendfile</emphasis></entry>
36331 <entry>Type: <emphasis>boolean</emphasis></entry>
36332 <entry>Default: <emphasis>false</emphasis></entry>
36338 <indexterm role="concept">
36339 <primary>mailstore format</primary>
36340 <secondary>specifying</secondary>
36342 If this option is set with the <option>directory</option> option, the delivery is into two
36343 new files in <quote>mailstore</quote> format. The option is available only if
36344 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
36345 below for further details.
36348 <indexterm role="option">
36349 <primary>mailstore_prefix</primary>
36352 <informaltable frame="all">
36353 <tgroup cols="4" colsep="0" rowsep="0">
36354 <colspec colwidth="8*" align="left"/>
36355 <colspec colwidth="5*" align="center"/>
36356 <colspec colwidth="5*" align="center"/>
36357 <colspec colwidth="6*" align="right"/>
36360 <entry><option>mailstore_prefix</option></entry>
36361 <entry>Use: <emphasis>appendfile</emphasis></entry>
36362 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36363 <entry>Default: <emphasis>unset</emphasis></entry>
36369 This option applies only to deliveries in mailstore format, and is described in
36370 section <xref linkend="SECTopdir"/> below.
36373 <indexterm role="option">
36374 <primary>mailstore_suffix</primary>
36377 <informaltable frame="all">
36378 <tgroup cols="4" colsep="0" rowsep="0">
36379 <colspec colwidth="8*" align="left"/>
36380 <colspec colwidth="5*" align="center"/>
36381 <colspec colwidth="5*" align="center"/>
36382 <colspec colwidth="6*" align="right"/>
36385 <entry><option>mailstore_suffix</option></entry>
36386 <entry>Use: <emphasis>appendfile</emphasis></entry>
36387 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36388 <entry>Default: <emphasis>unset</emphasis></entry>
36394 This option applies only to deliveries in mailstore format, and is described in
36395 section <xref linkend="SECTopdir"/> below.
36398 <indexterm role="option">
36399 <primary>mbx_format</primary>
36402 <informaltable frame="all">
36403 <tgroup cols="4" colsep="0" rowsep="0">
36404 <colspec colwidth="8*" align="left"/>
36405 <colspec colwidth="5*" align="center"/>
36406 <colspec colwidth="5*" align="center"/>
36407 <colspec colwidth="6*" align="right"/>
36410 <entry><option>mbx_format</option></entry>
36411 <entry>Use: <emphasis>appendfile</emphasis></entry>
36412 <entry>Type: <emphasis>boolean</emphasis></entry>
36413 <entry>Default: <emphasis>false</emphasis></entry>
36419 <indexterm role="concept">
36420 <primary>locking files</primary>
36422 <indexterm role="concept">
36423 <primary>file</primary>
36424 <secondary>locking</secondary>
36426 <indexterm role="concept">
36427 <primary>file</primary>
36428 <secondary>MBX format</secondary>
36430 <indexterm role="concept">
36431 <primary>MBX format</primary>
36432 <secondary>specifying</secondary>
36434 This option is available only if Exim has been compiled with SUPPORT_MBX
36435 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
36436 the message is appended to the mailbox file in MBX format instead of
36437 traditional Unix format. This format is supported by Pine4 and its associated
36438 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
36441 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
36442 automatically changed by the use of <option>mbx_format</option>. They should normally be set
36443 empty when using MBX format, so this option almost always appears in this
36446 <literallayout class="monospaced">
36452 If none of the locking options are mentioned in the configuration,
36453 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
36454 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
36455 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
36456 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
36457 should not be used if any program that does not use this form of locking is
36458 going to access the mailbox, nor should it be used if the mailbox file is NFS
36459 mounted, because it works only when the mailbox is accessed from a single host.
36462 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
36463 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
36464 (this means for the whole of a Pine or IMAP session), Exim will not be able to
36465 append messages to it.
36468 <indexterm role="option">
36469 <primary>message_prefix</primary>
36472 <informaltable frame="all">
36473 <tgroup cols="4" colsep="0" rowsep="0">
36474 <colspec colwidth="8*" align="left"/>
36475 <colspec colwidth="5*" align="center"/>
36476 <colspec colwidth="5*" align="center"/>
36477 <colspec colwidth="6*" align="right"/>
36480 <entry><option>message_prefix</option></entry>
36481 <entry>Use: <emphasis>appendfile</emphasis></entry>
36482 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36483 <entry>Default: <emphasis>see below</emphasis></entry>
36489 <indexterm role="concept">
36490 <primary><quote>From</quote> line</primary>
36492 The string specified here is expanded and output at the start of every message.
36493 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
36494 in which case it is:
36496 <literallayout class="monospaced">
36497 message_prefix = "From ${if def:return_path{$return_path}\
36498 {MAILER-DAEMON}} $tod_bsdinbox\n"
36501 <indexterm role="option">
36502 <primary>message_suffix</primary>
36505 <informaltable frame="all">
36506 <tgroup cols="4" colsep="0" rowsep="0">
36507 <colspec colwidth="8*" align="left"/>
36508 <colspec colwidth="5*" align="center"/>
36509 <colspec colwidth="5*" align="center"/>
36510 <colspec colwidth="6*" align="right"/>
36513 <entry><option>message_suffix</option></entry>
36514 <entry>Use: <emphasis>appendfile</emphasis></entry>
36515 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36516 <entry>Default: <emphasis>see below</emphasis></entry>
36522 The string specified here is expanded and output at the end of every message.
36523 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
36524 in which case it is a single newline character. The suffix can be suppressed by
36527 <literallayout class="monospaced">
36531 <indexterm role="option">
36532 <primary>mode</primary>
36535 <informaltable frame="all">
36536 <tgroup cols="4" colsep="0" rowsep="0">
36537 <colspec colwidth="8*" align="left"/>
36538 <colspec colwidth="5*" align="center"/>
36539 <colspec colwidth="5*" align="center"/>
36540 <colspec colwidth="6*" align="right"/>
36543 <entry><option>mode</option></entry>
36544 <entry>Use: <emphasis>appendfile</emphasis></entry>
36545 <entry>Type: <emphasis>octal integer</emphasis></entry>
36546 <entry>Default: <emphasis>0600</emphasis></entry>
36552 If the output file is created, it is given this mode. If it already exists and
36553 has wider permissions, they are reduced to this mode. If it has narrower
36554 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
36555 if the delivery is the result of a <option>save</option> command in a filter file specifing
36556 a particular mode, the mode of the output file is always forced to take that
36557 value, and this option is ignored.
36560 <indexterm role="option">
36561 <primary>mode_fail_narrower</primary>
36564 <informaltable frame="all">
36565 <tgroup cols="4" colsep="0" rowsep="0">
36566 <colspec colwidth="8*" align="left"/>
36567 <colspec colwidth="5*" align="center"/>
36568 <colspec colwidth="5*" align="center"/>
36569 <colspec colwidth="6*" align="right"/>
36572 <entry><option>mode_fail_narrower</option></entry>
36573 <entry>Use: <emphasis>appendfile</emphasis></entry>
36574 <entry>Type: <emphasis>boolean</emphasis></entry>
36575 <entry>Default: <emphasis>true</emphasis></entry>
36581 This option applies in the case when an existing mailbox file has a narrower
36582 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
36583 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
36584 continues with the delivery attempt, using the existing mode of the file.
36587 <indexterm role="option">
36588 <primary>notify_comsat</primary>
36591 <informaltable frame="all">
36592 <tgroup cols="4" colsep="0" rowsep="0">
36593 <colspec colwidth="8*" align="left"/>
36594 <colspec colwidth="5*" align="center"/>
36595 <colspec colwidth="5*" align="center"/>
36596 <colspec colwidth="6*" align="right"/>
36599 <entry><option>notify_comsat</option></entry>
36600 <entry>Use: <emphasis>appendfile</emphasis></entry>
36601 <entry>Type: <emphasis>boolean</emphasis></entry>
36602 <entry>Default: <emphasis>false</emphasis></entry>
36608 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
36609 successful delivery to a user mailbox. This is the daemon that notifies logged
36610 on users about incoming mail.
36613 <indexterm role="option">
36614 <primary>quota</primary>
36617 <informaltable frame="all">
36618 <tgroup cols="4" colsep="0" rowsep="0">
36619 <colspec colwidth="8*" align="left"/>
36620 <colspec colwidth="5*" align="center"/>
36621 <colspec colwidth="5*" align="center"/>
36622 <colspec colwidth="6*" align="right"/>
36625 <entry><option>quota</option></entry>
36626 <entry>Use: <emphasis>appendfile</emphasis></entry>
36627 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36628 <entry>Default: <emphasis>unset</emphasis></entry>
36634 <indexterm role="concept">
36635 <primary>quota</primary>
36636 <secondary>imposed by Exim</secondary>
36638 This option imposes a limit on the size of the file to which Exim is appending,
36639 or to the total space used in the directory tree when the <option>directory</option> option
36640 is set. In the latter case, computation of the space used is expensive, because
36641 all the files in the directory (and any sub-directories) have to be
36642 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
36643 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
36644 have no shell access to their mailboxes).
36647 As there is no interlock against two simultaneous deliveries into a
36648 multi-file mailbox, it is possible for the quota to be overrun in this case.
36649 For single-file mailboxes, of course, an interlock is a necessity.
36652 A file’s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
36653 may be a lot less than the actual amount of disk space allocated to the file.
36654 If the sizes of a number of files are being added up, the rounding effect can
36655 become quite noticeable, especially on systems that have large block sizes.
36656 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
36657 the obvious value which users understand most easily.
36660 The value of the option is expanded, and must then be a numerical value
36661 (decimal point allowed), optionally followed by one of the letters K, M, or G,
36662 for kilobytes, megabytes, or gigabytes. If Exim is running on a system with
36663 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
36667 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
36670 The expansion happens while Exim is running as root, before it changes uid for
36671 the delivery. This means that files that are inaccessible to the end user can
36672 be used to hold quota values that are looked up in the expansion. When delivery
36673 fails because this quota is exceeded, the handling of the error is as for
36674 system quota failures.
36677 By default, Exim’s quota checking mimics system quotas, and restricts the
36678 mailbox to the specified maximum size, though the value is not accurate to the
36679 last byte, owing to separator lines and additional headers that may get added
36680 during message delivery. When a mailbox is nearly full, large messages may get
36681 refused even though small ones are accepted, because the size of the current
36682 message is added to the quota when the check is made. This behaviour can be
36683 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
36684 for exceeding the quota does not include the current message. Thus, deliveries
36685 continue until the quota has been exceeded; thereafter, no further messages are
36686 delivered. See also <option>quota_warn_threshold</option>.
36689 <indexterm role="option">
36690 <primary>quota_directory</primary>
36693 <informaltable frame="all">
36694 <tgroup cols="4" colsep="0" rowsep="0">
36695 <colspec colwidth="8*" align="left"/>
36696 <colspec colwidth="5*" align="center"/>
36697 <colspec colwidth="5*" align="center"/>
36698 <colspec colwidth="6*" align="right"/>
36701 <entry><option>quota_directory</option></entry>
36702 <entry>Use: <emphasis>appendfile</emphasis></entry>
36703 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36704 <entry>Default: <emphasis>unset</emphasis></entry>
36710 This option defines the directory to check for quota purposes when delivering
36711 into individual files. The default is the delivery directory, or, if a file
36712 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
36713 delivery directory.
36716 <indexterm role="option">
36717 <primary>quota_filecount</primary>
36720 <informaltable frame="all">
36721 <tgroup cols="4" colsep="0" rowsep="0">
36722 <colspec colwidth="8*" align="left"/>
36723 <colspec colwidth="5*" align="center"/>
36724 <colspec colwidth="5*" align="center"/>
36725 <colspec colwidth="6*" align="right"/>
36728 <entry><option>quota_filecount</option></entry>
36729 <entry>Use: <emphasis>appendfile</emphasis></entry>
36730 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36731 <entry>Default: <emphasis>0</emphasis></entry>
36736 <para revisionflag="changed">
36737 This option applies when the <option>directory</option> option is set. It limits the total
36738 number of files in the directory (compare the inode limit in system quotas). It
36739 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
36740 failure causes delivery to be deferred. A value of zero is interpreted as
36741 <quote>no quota</quote>.
36744 <indexterm role="option">
36745 <primary>quota_is_inclusive</primary>
36748 <informaltable frame="all">
36749 <tgroup cols="4" colsep="0" rowsep="0">
36750 <colspec colwidth="8*" align="left"/>
36751 <colspec colwidth="5*" align="center"/>
36752 <colspec colwidth="5*" align="center"/>
36753 <colspec colwidth="6*" align="right"/>
36756 <entry><option>quota_is_inclusive</option></entry>
36757 <entry>Use: <emphasis>appendfile</emphasis></entry>
36758 <entry>Type: <emphasis>boolean</emphasis></entry>
36759 <entry>Default: <emphasis>true</emphasis></entry>
36765 See <option>quota</option> above.
36768 <indexterm role="option">
36769 <primary>quota_size_regex</primary>
36772 <informaltable frame="all">
36773 <tgroup cols="4" colsep="0" rowsep="0">
36774 <colspec colwidth="8*" align="left"/>
36775 <colspec colwidth="5*" align="center"/>
36776 <colspec colwidth="5*" align="center"/>
36777 <colspec colwidth="6*" align="right"/>
36780 <entry><option>quota_size_regex</option></entry>
36781 <entry>Use: <emphasis>appendfile</emphasis></entry>
36782 <entry>Type: <emphasis>string</emphasis></entry>
36783 <entry>Default: <emphasis>unset</emphasis></entry>
36789 This option applies when one of the delivery modes that writes a separate file
36790 for each message is being used. When Exim wants to find the size of one of
36791 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
36792 If this is set to a regular expression that matches the file name, and it
36793 captures one string, that string is interpreted as a representation of the
36794 file’s size. The value of <option>quota_size_regex</option> is not expanded.
36797 This feature is useful only when users have no shell access to their mailboxes
36798 – otherwise they could defeat the quota simply by renaming the files. This
36799 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
36800 the file length to the file name. For example:
36802 <literallayout class="monospaced">
36803 maildir_tag = ,S=$message_size
36804 quota_size_regex = ,S=(\d+)
36807 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
36808 number of lines in the message.
36811 The regular expression should not assume that the length is at the end of the
36812 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
36813 sometimes add other information onto the ends of message file names.
36816 <indexterm role="option">
36817 <primary>quota_warn_message</primary>
36820 <informaltable frame="all">
36821 <tgroup cols="4" colsep="0" rowsep="0">
36822 <colspec colwidth="8*" align="left"/>
36823 <colspec colwidth="5*" align="center"/>
36824 <colspec colwidth="5*" align="center"/>
36825 <colspec colwidth="6*" align="right"/>
36828 <entry><option>quota_warn_message</option></entry>
36829 <entry>Use: <emphasis>appendfile</emphasis></entry>
36830 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36831 <entry>Default: <emphasis>see below</emphasis></entry>
36837 See below for the use of this option. If it is not set when
36838 <option>quota_warn_threshold</option> is set, it defaults to
36840 <literallayout class="monospaced">
36841 quota_warn_message = "\
36842 To: $local_part@$domain\n\
36843 Subject: Your mailbox\n\n\
36844 This message is automatically created \
36845 by mail delivery software.\n\n\
36846 The size of your mailbox has exceeded \
36847 a warning threshold that is\n\
36848 set by the system administrator.\n"
36851 <indexterm role="option">
36852 <primary>quota_warn_threshold</primary>
36855 <informaltable frame="all">
36856 <tgroup cols="4" colsep="0" rowsep="0">
36857 <colspec colwidth="8*" align="left"/>
36858 <colspec colwidth="5*" align="center"/>
36859 <colspec colwidth="5*" align="center"/>
36860 <colspec colwidth="6*" align="right"/>
36863 <entry><option>quota_warn_threshold</option></entry>
36864 <entry>Use: <emphasis>appendfile</emphasis></entry>
36865 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36866 <entry>Default: <emphasis>0</emphasis></entry>
36872 <indexterm role="concept">
36873 <primary>quota</primary>
36874 <secondary>warning threshold</secondary>
36876 <indexterm role="concept">
36877 <primary>mailbox</primary>
36878 <secondary>size warning</secondary>
36880 <indexterm role="concept">
36881 <primary>size</primary>
36882 <secondary>of mailbox</secondary>
36884 This option is expanded in the same way as <option>quota</option> (see above). If the
36885 resulting value is greater than zero, and delivery of the message causes the
36886 size of the file or total space in the directory tree to cross the given
36887 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
36888 may be specified as a percentage of it by following the value with a percent
36891 <literallayout class="monospaced">
36893 quota_warn_threshold = 75%
36896 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
36897 percent sign is ignored.
36899 <para revisionflag="changed">
36900 The warning message itself is specified by the <option>quota_warn_message</option> option,
36901 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
36902 warning message. These do not necessarily have to include the recipient(s) of
36903 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
36904 can include any other header lines that you want. If you do not include a
36905 <emphasis>From:</emphasis> line, the default is:
36907 <literallayout class="monospaced" revisionflag="changed">
36908 From: Mail Delivery System <mailer-daemon@$qualify_domain_sender>
36910 <para revisionflag="changed">
36911 <indexterm role="option">
36912 <primary><option>errors_reply_to</option></primary>
36914 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
36918 The <option>quota</option> option does not have to be set in order to use this option; they
36919 are independent of one another except when the threshold is specified as a
36923 <indexterm role="option">
36924 <primary>use_bsmtp</primary>
36927 <informaltable frame="all">
36928 <tgroup cols="4" colsep="0" rowsep="0">
36929 <colspec colwidth="8*" align="left"/>
36930 <colspec colwidth="5*" align="center"/>
36931 <colspec colwidth="5*" align="center"/>
36932 <colspec colwidth="6*" align="right"/>
36935 <entry><option>use_bsmtp</option></entry>
36936 <entry>Use: <emphasis>appendfile</emphasis></entry>
36937 <entry>Type: <emphasis>boolean</emphasis></entry>
36938 <entry>Default: <emphasis>false</emphasis></entry>
36944 <indexterm role="concept">
36945 <primary>envelope sender</primary>
36947 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
36948 format, with the envelope sender and recipient(s) included as SMTP commands. If
36949 you want to include a leading HELO command with such messages, you can do
36950 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
36951 for details of batch SMTP.
36954 <indexterm role="option">
36955 <primary>use_crlf</primary>
36958 <informaltable frame="all">
36959 <tgroup cols="4" colsep="0" rowsep="0">
36960 <colspec colwidth="8*" align="left"/>
36961 <colspec colwidth="5*" align="center"/>
36962 <colspec colwidth="5*" align="center"/>
36963 <colspec colwidth="6*" align="right"/>
36966 <entry><option>use_crlf</option></entry>
36967 <entry>Use: <emphasis>appendfile</emphasis></entry>
36968 <entry>Type: <emphasis>boolean</emphasis></entry>
36969 <entry>Default: <emphasis>false</emphasis></entry>
36975 <indexterm role="concept">
36976 <primary>carriage return</primary>
36978 <indexterm role="concept">
36979 <primary>linefeed</primary>
36981 This option causes lines to be terminated with the two-character CRLF sequence
36982 (carriage return, linefeed) instead of just a linefeed character. In the case
36983 of batched SMTP, the byte sequence written to the file is then an exact image
36984 of what would be sent down a real SMTP connection.
36987 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
36988 written verbatim, so must contain their own carriage return characters if these
36989 are needed. In cases where these options have non-empty defaults, the values
36990 end with a single linefeed, so they must be changed to end with <literal>\r\n</literal> if
36991 <option>use_crlf</option> is set.
36994 <indexterm role="option">
36995 <primary>use_fcntl_lock</primary>
36998 <informaltable frame="all">
36999 <tgroup cols="4" colsep="0" rowsep="0">
37000 <colspec colwidth="8*" align="left"/>
37001 <colspec colwidth="5*" align="center"/>
37002 <colspec colwidth="5*" align="center"/>
37003 <colspec colwidth="6*" align="right"/>
37006 <entry><option>use_fcntl_lock</option></entry>
37007 <entry>Use: <emphasis>appendfile</emphasis></entry>
37008 <entry>Type: <emphasis>boolean</emphasis></entry>
37009 <entry>Default: <emphasis>see below</emphasis></entry>
37015 This option controls the use of the <function>fcntl()</function> function to lock a file for
37016 exclusive use when a message is being appended. It is set by default unless
37017 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
37018 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
37019 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
37022 <indexterm role="option">
37023 <primary>use_flock_lock</primary>
37026 <informaltable frame="all">
37027 <tgroup cols="4" colsep="0" rowsep="0">
37028 <colspec colwidth="8*" align="left"/>
37029 <colspec colwidth="5*" align="center"/>
37030 <colspec colwidth="5*" align="center"/>
37031 <colspec colwidth="6*" align="right"/>
37034 <entry><option>use_flock_lock</option></entry>
37035 <entry>Use: <emphasis>appendfile</emphasis></entry>
37036 <entry>Type: <emphasis>boolean</emphasis></entry>
37037 <entry>Default: <emphasis>false</emphasis></entry>
37043 This option is provided to support the use of <function>flock()</function> for file locking, for
37044 the few situations where it is needed. Most modern operating systems support
37045 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
37046 each other. Exim uses <function>fcntl()</function> locking by default.
37049 This option is required only if you are using an operating system where
37050 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
37051 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
37052 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
37055 <indexterm role="concept">
37056 <primary>Solaris</primary>
37057 <secondary><function>flock()</function> support</secondary>
37059 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
37060 have it (and some, I think, provide a not quite right version built on top of
37061 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
37062 the ability to use it, and any attempt to do so will cause a configuration
37066 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
37067 is just being mapped onto <function>fcntl()</function> by the OS).
37070 <indexterm role="option">
37071 <primary>use_lockfile</primary>
37074 <informaltable frame="all">
37075 <tgroup cols="4" colsep="0" rowsep="0">
37076 <colspec colwidth="8*" align="left"/>
37077 <colspec colwidth="5*" align="center"/>
37078 <colspec colwidth="5*" align="center"/>
37079 <colspec colwidth="6*" align="right"/>
37082 <entry><option>use_lockfile</option></entry>
37083 <entry>Use: <emphasis>appendfile</emphasis></entry>
37084 <entry>Type: <emphasis>boolean</emphasis></entry>
37085 <entry>Default: <emphasis>see below</emphasis></entry>
37091 If this option is turned off, Exim does not attempt to create a lock file when
37092 appending to a mailbox file. In this situation, the only locking is by
37093 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
37094 sure that every MUA that is ever going to look at your users’ mailboxes uses
37095 <function>fcntl()</function> rather than a lock file, and even then only when you are not
37096 delivering over NFS from more than one host.
37099 <indexterm role="concept">
37100 <primary>NFS</primary>
37101 <secondary>lock file</secondary>
37103 In order to append to an NFS file safely from more than one host, it is
37104 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
37105 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
37109 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
37110 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
37111 except when <option>mbx_format</option> is set.
37114 <indexterm role="option">
37115 <primary>use_mbx_lock</primary>
37118 <informaltable frame="all">
37119 <tgroup cols="4" colsep="0" rowsep="0">
37120 <colspec colwidth="8*" align="left"/>
37121 <colspec colwidth="5*" align="center"/>
37122 <colspec colwidth="5*" align="center"/>
37123 <colspec colwidth="6*" align="right"/>
37126 <entry><option>use_mbx_lock</option></entry>
37127 <entry>Use: <emphasis>appendfile</emphasis></entry>
37128 <entry>Type: <emphasis>boolean</emphasis></entry>
37129 <entry>Default: <emphasis>see below</emphasis></entry>
37135 This option is available only if Exim has been compiled with SUPPORT_MBX
37136 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
37137 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
37138 of the locking options are mentioned in the configuration. The locking rules
37139 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
37140 the IMAP4 and POP daemons that come with it (see the discussion below). The
37141 rules allow for shared access to the mailbox. However, this kind of locking
37142 does not work when the mailbox is NFS mounted.
37145 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
37146 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
37147 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
37148 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
37151 <section id="SECTopappend">
37152 <title>Operational details for appending</title>
37154 <indexterm role="concept">
37155 <primary>appending to a file</primary>
37157 <indexterm role="concept">
37158 <primary>file</primary>
37159 <secondary>appending</secondary>
37161 Before appending to a file, the following preparations are made:
37166 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
37172 <indexterm role="concept">
37173 <primary>directory creation</primary>
37175 If any directories on the file’s path are missing, Exim creates them if the
37176 <option>create_directory</option> option is set. A created directory’s mode is given by the
37177 <option>directory_mode</option> option.
37182 If <option>file_format</option> is set, the format of an existing file is checked. If this
37183 indicates that a different transport should be used, control is passed to that
37189 <indexterm role="concept">
37190 <primary>file</primary>
37191 <secondary>locking</secondary>
37193 <indexterm role="concept">
37194 <primary>locking files</primary>
37196 <indexterm role="concept">
37197 <primary>NFS</primary>
37198 <secondary>lock file</secondary>
37200 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
37201 reliably over NFS, as follows:
37203 <orderedlist numeration="arabic">
37206 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
37207 current time, primary host name, and process id added, by opening for writing
37208 as a new file. If this fails with an access error, delivery is deferred.
37213 Close the hitching post file, and hard link it to the lock file name.
37218 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
37219 Unlink the hitching post name.
37224 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
37225 then unlink hitching post name. If the number of links is exactly two, creation
37226 of the lock file succeeded but something (for example, an NFS server crash and
37227 restart) caused this fact not to be communicated to the <function>link()</function> call.
37232 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
37233 up to <option>lock_retries</option> times. However, since any program that writes to a
37234 mailbox should complete its task very quickly, it is reasonable to time out old
37235 lock files that are normally the result of user agent and system crashes. If an
37236 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
37237 it before trying again.
37244 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
37245 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
37246 than non-existence, delivery is deferred.
37251 <indexterm role="concept">
37252 <primary>symbolic link</primary>
37253 <secondary>to mailbox</secondary>
37255 <indexterm role="concept">
37256 <primary>mailbox</primary>
37257 <secondary>symbolic link</secondary>
37259 If the file does exist and is a symbolic link, delivery is deferred, unless the
37260 <option>allow_symlink</option> option is set, in which case the ownership of the link is
37261 checked, and then <function>stat()</function> is called to find out about the real file, which
37262 is then subjected to the checks below. The check on the top-level link
37263 ownership prevents one user creating a link for another’s mailbox in a sticky
37264 directory, though allowing symbolic links in this case is definitely not a good
37265 idea. If there is a chain of symbolic links, the intermediate ones are not
37271 If the file already exists but is not a regular file, or if the file’s owner
37272 and group (if the group is being checked – see <option>check_group</option> above) are
37273 different from the user and group under which the delivery is running,
37274 delivery is deferred.
37279 If the file’s permissions are more generous than specified, they are reduced.
37280 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
37281 is set false, in which case the delivery is tried using the existing
37287 The file’s inode number is saved, and the file is then opened for appending.
37288 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
37289 hadn’t existed (see below). For any other failures, delivery is deferred.
37294 If the file is opened successfully, check that the inode number hasn’t
37295 changed, that it is still a regular file, and that the owner and permissions
37296 have not changed. If anything is wrong, defer delivery and freeze the message.
37301 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
37302 option is set. Otherwise, check that the file is being created in a permitted
37303 directory if the <option>create_file</option> option is set (deferring on failure), and then
37304 open for writing as a new file, with the O_EXCL and O_CREAT options,
37305 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
37306 set). In this case, which can happen if the link points to a non-existent file,
37307 the file is opened for writing using O_CREAT but not O_EXCL, because
37308 that prevents link following.
37313 <indexterm role="concept">
37314 <primary>loop</primary>
37315 <secondary>while file testing</secondary>
37317 If opening fails because the file exists, obey the tests given above for
37318 existing files. However, to avoid looping in a situation where the file is
37319 being continuously created and destroyed, the exists/not-exists loop is broken
37320 after 10 repetitions, and the message is then frozen.
37325 If opening fails with any other error, defer delivery.
37330 <indexterm role="concept">
37331 <primary>file</primary>
37332 <secondary>locking</secondary>
37334 <indexterm role="concept">
37335 <primary>locking files</primary>
37337 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
37338 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
37339 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
37340 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
37341 file, and an exclusive lock on the file whose name is
37343 <literallayout class="monospaced">
37344 /tmp/.<device-number>.<inode-number>
37347 using the device and inode numbers of the open mailbox file, in accordance with
37348 the MBX locking rules.
37351 If Exim fails to lock the file, there are two possible courses of action,
37352 depending on the value of the locking timeout. This is obtained from
37353 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
37356 If the timeout value is zero, the file is closed, Exim waits for
37357 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
37358 to lock it again. This happens up to <option>lock_retries</option> times, after which the
37359 delivery is deferred.
37362 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
37363 <function>flock()</function> are used (with the given timeout), so there has already been some
37364 waiting involved by the time locking fails. Nevertheless, Exim does not give up
37365 immediately. It retries up to
37367 <literallayout class="monospaced">
37368 (lock_retries * lock_interval) / <timeout>
37371 times (rounded up).
37376 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
37377 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
37380 <section id="SECTopdir">
37381 <title>Operational details for delivery to a new file</title>
37383 <indexterm role="concept">
37384 <primary>delivery</primary>
37385 <secondary>to single file</secondary>
37387 <indexterm role="concept">
37388 <primary><quote>From</quote> line</primary>
37390 When the <option>directory</option> option is set instead of <option>file</option>, each message is
37391 delivered into a newly-created file or set of files. When <command>appendfile</command> is
37392 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
37393 <option>directory</option> is normally set, because the path for delivery is supplied by the
37394 router. (See for example, the <command>address_file</command> transport in the default
37395 configuration.) In this case, delivery is to a new file if either the path name
37396 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
37399 No locking is required while writing the message to a new file, so the various
37400 locking options of the transport are ignored. The <quote>From</quote> line that by default
37401 separates messages in a single file is not normally needed, nor is the escaping
37402 of message lines that start with <quote>From</quote>, and there is no need to ensure a
37403 newline at the end of each message. Consequently, the default values for
37404 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
37405 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
37408 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
37409 the files in the delivery directory by default. However, you can specify a
37410 different directory by setting <option>quota_directory</option>. Also, for maildir
37411 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
37414 <indexterm role="concept">
37415 <primary>maildir format</primary>
37417 <indexterm role="concept">
37418 <primary>mailstore format</primary>
37420 There are three different ways in which delivery to individual files can be
37421 done, controlled by the settings of the <option>maildir_format</option> and
37422 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
37423 formats is not included in the binary unless SUPPORT_MAILDIR or
37424 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
37427 <indexterm role="concept">
37428 <primary>directory creation</primary>
37430 In all three cases an attempt is made to create the directory and any necessary
37431 sub-directories if they do not exist, provided that the <option>create_directory</option>
37432 option is set (the default). The location of a created directory can be
37433 constrained by setting <option>create_file</option>. A created directory’s mode is given by
37434 the <option>directory_mode</option> option. If creation fails, or if the
37435 <option>create_directory</option> option is not set when creation is required, delivery is
37439 <section id="SECTmaildirdelivery">
37440 <title>Maildir delivery</title>
37442 <indexterm role="concept">
37443 <primary>maildir format</primary>
37444 <secondary>description of</secondary>
37446 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
37447 it to a file whose name is <filename>tmp/<stime>.H<mtime>P<pid>.<host></filename> in the
37448 given directory. If the delivery is successful, the file is renamed into the
37449 <filename>new</filename> subdirectory.
37452 In the file name, <<emphasis>stime</emphasis>> is the current time of day in seconds, and
37453 <<emphasis>mtime</emphasis>> is the microsecond fraction of the time. After a maildir delivery,
37454 Exim checks that the time-of-day clock has moved on by at least one microsecond
37455 before terminating the delivery process. This guarantees uniqueness for the
37456 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
37457 opening it. If any response other than ENOENT (does not exist) is given,
37458 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
37461 <indexterm role="concept">
37462 <primary>quota</primary>
37463 <secondary>in maildir delivery</secondary>
37465 <indexterm role="concept">
37466 <primary>maildir++</primary>
37468 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
37469 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
37470 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
37471 Exim assumes the directory is a maildir++ folder directory, which is one level
37472 down from the user’s top level mailbox directory. This causes it to start at
37473 the parent directory instead of the current directory when calculating the
37474 amount of space used.
37477 One problem with delivering into a multi-file mailbox is that it is
37478 computationally expensive to compute the size of the mailbox for quota
37479 checking. Various approaches have been taken to reduce the amount of work
37480 needed. The next two sections describe two of them. A third alternative is to
37481 use some external process for maintaining the size data, and use the expansion
37482 of the <option>mailbox_size</option> option as a way of importing it into Exim.
37486 <title>Using tags to record message sizes</title>
37488 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
37489 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
37490 tag is added to its name. However, if adding the tag takes the length of the
37491 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
37492 the tag is dropped and the maildir file is created with no tag.
37495 <indexterm role="concept">
37496 <primary><varname>$message_size</varname></primary>
37498 Tags can be used to encode the size of files in their names; see
37499 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
37500 happens after the message has been written. The value of the <varname>$message_size</varname>
37501 variable is set to the number of bytes actually written. If the expansion is
37502 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
37503 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
37504 Non-printing characters in the string are ignored; if the resulting string is
37505 empty, it is ignored. If it starts with an alphanumeric character, a leading
37510 <title>Using a maildirsize file</title>
37512 <indexterm role="concept">
37513 <primary>quota</primary>
37514 <secondary>in maildir delivery</secondary>
37516 <indexterm role="concept">
37517 <primary>maildir format</primary>
37518 <secondary><filename>maildirsize</filename> file</secondary>
37520 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
37521 storing quota and message size information in a file called <filename>maildirsize</filename>
37522 within the maildir directory. If this file does not exist, Exim creates it,
37523 setting the quota from the <option>quota</option> option of the transport. If the maildir
37524 directory itself does not exist, it is created before any attempt to write a
37525 <filename>maildirsize</filename> file.
37528 The <filename>maildirsize</filename> file is used to hold information about the sizes of
37529 messages in the maildir, thus speeding up quota calculations. The quota value
37530 in the file is just a cache; if the quota is changed in the transport, the new
37531 value overrides the cached value when the next message is delivered. The cache
37532 is maintained for the benefit of other programs that access the maildir and
37533 need to know the quota.
37536 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
37537 file is maintained (with a zero quota setting), but no quota is imposed.
37540 A regular expression is available for controlling which directories in the
37541 maildir participate in quota calculations. See the description of the
37542 <option>maildir_quota_directory_regex</option> option above for details.
37546 <title>Mailstore delivery</title>
37548 <indexterm role="concept">
37549 <primary>mailstore format</primary>
37550 <secondary>description of</secondary>
37552 If the <option>mailstore_format</option> option is true, each message is written as two
37553 files in the given directory. A unique base name is constructed from the
37554 message id and the current delivery process, and the files that are written use
37555 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
37556 contains the message’s envelope, and the <filename>.msg</filename> file contains the message
37557 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
37560 During delivery, the envelope is first written to a file with the suffix
37561 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
37562 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
37563 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
37564 file before accessing either of them. An alternative approach is to wait for
37565 the absence of a <filename>.tmp</filename> file.
37568 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
37569 option, expanded and terminated by a newline if there isn’t one. Then follows
37570 the sender address on one line, then all the recipient addresses, one per line.
37571 There can be more than one recipient only if the <option>batch_max</option> option is set
37572 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
37573 appended to the file, followed by a newline if it does not end with one.
37576 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
37577 failure, it is ignored. Other expansion errors are treated as serious
37578 configuration errors, and delivery is deferred. The variable
37579 <varname>$mailstore_basename</varname> is available for use during these expansions.
37583 <title>Non-special new file delivery</title>
37585 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
37586 file is created directly in the named directory. For example, when delivering
37587 messages into files in batched SMTP format for later delivery to some host (see
37588 section <xref linkend="SECTbatchSMTP"/>), a setting such as
37590 <literallayout class="monospaced">
37591 directory = /var/bsmtp/$host
37594 might be used. A message is written to a file with a temporary name, which is
37595 then renamed when the delivery is complete. The final name is obtained by
37596 expanding the contents of the <option>directory_file</option> option.
37597 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
37598 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
37604 <title>The autoreply transport</title>
37606 <indexterm role="concept" id="IIDauttra1" class="startofrange">
37607 <primary>transports</primary>
37608 <secondary><command>autoreply</command></secondary>
37610 <indexterm role="concept" id="IIDauttra2" class="startofrange">
37611 <primary><command>autoreply</command> transport</primary>
37614 <para revisionflag="changed">
37615 The <command>autoreply</command> transport is not a true transport in that it does not cause
37616 the message to be transmitted. Instead, it generates a new mail message as an
37617 automatic reply to the incoming message. <emphasis>References:</emphasis> and
37618 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
37619 to the rules in RFCs 2822 and 3834, respectively.
37622 If the router that passes the message to this transport does not have the
37623 <option>unseen</option> option set, the original message (for the current recipient) is not
37624 delivered anywhere. However, when the <option>unseen</option> option is set on the router
37625 that passes the message to this transport, routing of the address continues, so
37626 another router can set up a normal message delivery.
37629 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
37630 <quote>vacation</quote> message being the standard example. However, it can also be run
37631 directly from a router like any other transport. To reduce the possibility of
37632 message cascades, messages created by the <command>autoreply</command> transport always have
37633 empty envelope sender addresses, like bounce messages.
37636 The parameters of the message to be sent can be specified in the configuration
37637 by options described below. However, these are used only when the address
37638 passed to the transport does not contain its own reply information. When the
37639 transport is run as a consequence of a
37640 <option>mail</option>
37641 or <option>vacation</option> command in a filter file, the parameters of the message are
37642 supplied by the filter, and passed with the address. The transport’s options
37643 that define the message are then ignored (so they are not usually set in this
37644 case). The message is specified entirely by the filter or by the transport; it
37645 is never built from a mixture of options. However, the <option>file_optional</option>,
37646 <option>mode</option>, and <option>return_message</option> options apply in all cases.
37649 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
37650 command in a user’s filter file, <command>autoreply</command> normally runs under the uid and
37651 gid of the user, and with appropriate current and home directories (see chapter
37652 <xref linkend="CHAPenvironment"/>).
37655 There is a subtle difference between routing a message to a <command>pipe</command> transport
37656 that generates some text to be returned to the sender, and routing it to an
37657 <command>autoreply</command> transport. This difference is noticeable only if more than one
37658 address from the same message is so handled. In the case of a pipe, the
37659 separate outputs from the different addresses are gathered up and returned to
37660 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
37661 message is generated for each address that is passed to it.
37664 Non-printing characters are not permitted in the header lines generated for the
37665 message that <command>autoreply</command> creates, with the exception of newlines that are
37666 immediately followed by white space. If any non-printing characters are found,
37667 the transport defers.
37668 Whether characters with the top bit set count as printing characters or not is
37669 controlled by the <option>print_topbitchars</option> global option.
37672 If any of the generic options for manipulating headers (for example,
37673 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
37674 of the original message that is included in the generated message when
37675 <option>return_message</option> is set. They do not apply to the generated message itself.
37678 <indexterm role="concept">
37679 <primary><varname>$sender_address</varname></primary>
37681 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
37682 the message, indicating that there were no recipients, it does not treat this
37683 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
37684 is empty (because the incoming message is a bounce message) do not cause
37685 problems. They are just discarded.
37688 <title>Private options for autoreply</title>
37690 <indexterm role="concept">
37691 <primary>options</primary>
37692 <secondary><command>autoreply</command> transport</secondary>
37696 <indexterm role="option">
37697 <primary>bcc</primary>
37700 <informaltable frame="all">
37701 <tgroup cols="4" colsep="0" rowsep="0">
37702 <colspec colwidth="8*" align="left"/>
37703 <colspec colwidth="5*" align="center"/>
37704 <colspec colwidth="5*" align="center"/>
37705 <colspec colwidth="6*" align="right"/>
37708 <entry><option>bcc</option></entry>
37709 <entry>Use: <emphasis>autoreply</emphasis></entry>
37710 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37711 <entry>Default: <emphasis>unset</emphasis></entry>
37717 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
37718 message when the message is specified by the transport.
37721 <indexterm role="option">
37722 <primary>cc</primary>
37725 <informaltable frame="all">
37726 <tgroup cols="4" colsep="0" rowsep="0">
37727 <colspec colwidth="8*" align="left"/>
37728 <colspec colwidth="5*" align="center"/>
37729 <colspec colwidth="5*" align="center"/>
37730 <colspec colwidth="6*" align="right"/>
37733 <entry><option>cc</option></entry>
37734 <entry>Use: <emphasis>autoreply</emphasis></entry>
37735 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37736 <entry>Default: <emphasis>unset</emphasis></entry>
37742 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
37743 when the message is specified by the transport.
37746 <indexterm role="option">
37747 <primary>file</primary>
37750 <informaltable frame="all">
37751 <tgroup cols="4" colsep="0" rowsep="0">
37752 <colspec colwidth="8*" align="left"/>
37753 <colspec colwidth="5*" align="center"/>
37754 <colspec colwidth="5*" align="center"/>
37755 <colspec colwidth="6*" align="right"/>
37758 <entry><option>file</option></entry>
37759 <entry>Use: <emphasis>autoreply</emphasis></entry>
37760 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37761 <entry>Default: <emphasis>unset</emphasis></entry>
37767 The contents of the file are sent as the body of the message when the message
37768 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
37769 string comes first.
37772 <indexterm role="option">
37773 <primary>file_expand</primary>
37776 <informaltable frame="all">
37777 <tgroup cols="4" colsep="0" rowsep="0">
37778 <colspec colwidth="8*" align="left"/>
37779 <colspec colwidth="5*" align="center"/>
37780 <colspec colwidth="5*" align="center"/>
37781 <colspec colwidth="6*" align="right"/>
37784 <entry><option>file_expand</option></entry>
37785 <entry>Use: <emphasis>autoreply</emphasis></entry>
37786 <entry>Type: <emphasis>boolean</emphasis></entry>
37787 <entry>Default: <emphasis>false</emphasis></entry>
37793 If this is set, the contents of the file named by the <option>file</option> option are
37794 subjected to string expansion as they are added to the message.
37797 <indexterm role="option">
37798 <primary>file_optional</primary>
37801 <informaltable frame="all">
37802 <tgroup cols="4" colsep="0" rowsep="0">
37803 <colspec colwidth="8*" align="left"/>
37804 <colspec colwidth="5*" align="center"/>
37805 <colspec colwidth="5*" align="center"/>
37806 <colspec colwidth="6*" align="right"/>
37809 <entry><option>file_optional</option></entry>
37810 <entry>Use: <emphasis>autoreply</emphasis></entry>
37811 <entry>Type: <emphasis>boolean</emphasis></entry>
37812 <entry>Default: <emphasis>false</emphasis></entry>
37818 If this option is true, no error is generated if the file named by the <option>file</option>
37819 option or passed with the address does not exist or cannot be read.
37822 <indexterm role="option">
37823 <primary>from</primary>
37826 <informaltable frame="all">
37827 <tgroup cols="4" colsep="0" rowsep="0">
37828 <colspec colwidth="8*" align="left"/>
37829 <colspec colwidth="5*" align="center"/>
37830 <colspec colwidth="5*" align="center"/>
37831 <colspec colwidth="6*" align="right"/>
37834 <entry><option>from</option></entry>
37835 <entry>Use: <emphasis>autoreply</emphasis></entry>
37836 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37837 <entry>Default: <emphasis>unset</emphasis></entry>
37843 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
37844 specified by the transport.
37847 <indexterm role="option">
37848 <primary>headers</primary>
37851 <informaltable frame="all">
37852 <tgroup cols="4" colsep="0" rowsep="0">
37853 <colspec colwidth="8*" align="left"/>
37854 <colspec colwidth="5*" align="center"/>
37855 <colspec colwidth="5*" align="center"/>
37856 <colspec colwidth="6*" align="right"/>
37859 <entry><option>headers</option></entry>
37860 <entry>Use: <emphasis>autoreply</emphasis></entry>
37861 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37862 <entry>Default: <emphasis>unset</emphasis></entry>
37868 This specifies additional RFC 2822 headers that are to be added to the message
37869 when the message is specified by the transport. Several can be given by using
37870 <quote>\n</quote> to separate them. There is no check on the format.
37873 <indexterm role="option">
37874 <primary>log</primary>
37877 <informaltable frame="all">
37878 <tgroup cols="4" colsep="0" rowsep="0">
37879 <colspec colwidth="8*" align="left"/>
37880 <colspec colwidth="5*" align="center"/>
37881 <colspec colwidth="5*" align="center"/>
37882 <colspec colwidth="6*" align="right"/>
37885 <entry><option>log</option></entry>
37886 <entry>Use: <emphasis>autoreply</emphasis></entry>
37887 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37888 <entry>Default: <emphasis>unset</emphasis></entry>
37894 This option names a file in which a record of every message sent is logged when
37895 the message is specified by the transport.
37898 <indexterm role="option">
37899 <primary>mode</primary>
37902 <informaltable frame="all">
37903 <tgroup cols="4" colsep="0" rowsep="0">
37904 <colspec colwidth="8*" align="left"/>
37905 <colspec colwidth="5*" align="center"/>
37906 <colspec colwidth="5*" align="center"/>
37907 <colspec colwidth="6*" align="right"/>
37910 <entry><option>mode</option></entry>
37911 <entry>Use: <emphasis>autoreply</emphasis></entry>
37912 <entry>Type: <emphasis>octal integer</emphasis></entry>
37913 <entry>Default: <emphasis>0600</emphasis></entry>
37919 If either the log file or the <quote>once</quote> file has to be created, this mode is
37923 <indexterm role="option">
37924 <primary>never_mail</primary>
37927 <informaltable frame="all">
37928 <tgroup cols="4" colsep="0" rowsep="0">
37929 <colspec colwidth="8*" align="left"/>
37930 <colspec colwidth="5*" align="center"/>
37931 <colspec colwidth="5*" align="center"/>
37932 <colspec colwidth="6*" align="right"/>
37935 <entry><option>never_mail</option></entry>
37936 <entry>Use: <emphasis>autoreply</emphasis></entry>
37937 <entry>Type: <emphasis>address list</emphasis>†<emphasis></emphasis></entry>
37938 <entry>Default: <emphasis>unset</emphasis></entry>
37944 If any run of the transport creates a message with a recipient that matches any
37945 item in the list, that recipient is quietly discarded. If all recipients are
37946 discarded, no message is created.
37949 <indexterm role="option">
37950 <primary>once</primary>
37953 <informaltable frame="all">
37954 <tgroup cols="4" colsep="0" rowsep="0">
37955 <colspec colwidth="8*" align="left"/>
37956 <colspec colwidth="5*" align="center"/>
37957 <colspec colwidth="5*" align="center"/>
37958 <colspec colwidth="6*" align="right"/>
37961 <entry><option>once</option></entry>
37962 <entry>Use: <emphasis>autoreply</emphasis></entry>
37963 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37964 <entry>Default: <emphasis>unset</emphasis></entry>
37970 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
37971 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
37972 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
37975 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
37976 By default, if <option>once</option> is set to a non-empty file name, the message
37977 is not sent if a potential recipient is already listed in the database.
37978 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
37979 message is sent if that much time has elapsed since a message was last sent to
37980 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
37981 prevents a message from being sent a second time – in this case, zero means
37985 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
37986 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
37987 greater than zero, it changes the way Exim implements the <option>once</option> option.
37988 Instead of using a DBM file to record every recipient it sends to, it uses a
37989 regular file, whose size will never get larger than the given value.
37992 In the file, Exim keeps a linear list of recipient addresses and the times at
37993 which they were sent messages. If the file is full when a new address needs to
37994 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
37995 means that a given recipient may receive multiple messages, but at
37996 unpredictable intervals that depend on the rate of turnover of addresses in the
37997 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
38000 <indexterm role="option">
38001 <primary>once_file_size</primary>
38004 <informaltable frame="all">
38005 <tgroup cols="4" colsep="0" rowsep="0">
38006 <colspec colwidth="8*" align="left"/>
38007 <colspec colwidth="5*" align="center"/>
38008 <colspec colwidth="5*" align="center"/>
38009 <colspec colwidth="6*" align="right"/>
38012 <entry><option>once_file_size</option></entry>
38013 <entry>Use: <emphasis>autoreply</emphasis></entry>
38014 <entry>Type: <emphasis>integer</emphasis></entry>
38015 <entry>Default: <emphasis>0</emphasis></entry>
38021 See <option>once</option> above.
38024 <indexterm role="option">
38025 <primary>once_repeat</primary>
38028 <informaltable frame="all">
38029 <tgroup cols="4" colsep="0" rowsep="0">
38030 <colspec colwidth="8*" align="left"/>
38031 <colspec colwidth="5*" align="center"/>
38032 <colspec colwidth="5*" align="center"/>
38033 <colspec colwidth="6*" align="right"/>
38036 <entry><option>once_repeat</option></entry>
38037 <entry>Use: <emphasis>autoreply</emphasis></entry>
38038 <entry>Type: <emphasis>time</emphasis>†<emphasis></emphasis></entry>
38039 <entry>Default: <emphasis>0s</emphasis></entry>
38045 See <option>once</option> above.
38046 After expansion, the value of this option must be a valid time value.
38049 <indexterm role="option">
38050 <primary>reply_to</primary>
38053 <informaltable frame="all">
38054 <tgroup cols="4" colsep="0" rowsep="0">
38055 <colspec colwidth="8*" align="left"/>
38056 <colspec colwidth="5*" align="center"/>
38057 <colspec colwidth="5*" align="center"/>
38058 <colspec colwidth="6*" align="right"/>
38061 <entry><option>reply_to</option></entry>
38062 <entry>Use: <emphasis>autoreply</emphasis></entry>
38063 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38064 <entry>Default: <emphasis>unset</emphasis></entry>
38070 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
38071 specified by the transport.
38074 <indexterm role="option">
38075 <primary>return_message</primary>
38078 <informaltable frame="all">
38079 <tgroup cols="4" colsep="0" rowsep="0">
38080 <colspec colwidth="8*" align="left"/>
38081 <colspec colwidth="5*" align="center"/>
38082 <colspec colwidth="5*" align="center"/>
38083 <colspec colwidth="6*" align="right"/>
38086 <entry><option>return_message</option></entry>
38087 <entry>Use: <emphasis>autoreply</emphasis></entry>
38088 <entry>Type: <emphasis>boolean</emphasis></entry>
38089 <entry>Default: <emphasis>false</emphasis></entry>
38095 If this is set, a copy of the original message is returned with the new
38096 message, subject to the maximum size set in the <option>return_size_limit</option> global
38097 configuration option.
38100 <indexterm role="option">
38101 <primary>subject</primary>
38104 <informaltable frame="all">
38105 <tgroup cols="4" colsep="0" rowsep="0">
38106 <colspec colwidth="8*" align="left"/>
38107 <colspec colwidth="5*" align="center"/>
38108 <colspec colwidth="5*" align="center"/>
38109 <colspec colwidth="6*" align="right"/>
38112 <entry><option>subject</option></entry>
38113 <entry>Use: <emphasis>autoreply</emphasis></entry>
38114 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38115 <entry>Default: <emphasis>unset</emphasis></entry>
38121 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
38122 specified by the transport. It is tempting to quote the original subject in
38123 automatic responses. For example:
38125 <literallayout class="monospaced">
38126 subject = Re: $h_subject:
38129 There is a danger in doing this, however. It may allow a third party to
38130 subscribe your users to an opt-in mailing list, provided that the list accepts
38131 bounce messages as subscription confirmations. Well-managed lists require a
38132 non-bounce message to confirm a subscription, so the danger is relatively
38136 <indexterm role="option">
38137 <primary>text</primary>
38140 <informaltable frame="all">
38141 <tgroup cols="4" colsep="0" rowsep="0">
38142 <colspec colwidth="8*" align="left"/>
38143 <colspec colwidth="5*" align="center"/>
38144 <colspec colwidth="5*" align="center"/>
38145 <colspec colwidth="6*" align="right"/>
38148 <entry><option>text</option></entry>
38149 <entry>Use: <emphasis>autoreply</emphasis></entry>
38150 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38151 <entry>Default: <emphasis>unset</emphasis></entry>
38157 This specifies a single string to be used as the body of the message when the
38158 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
38159 the text comes first.
38162 <indexterm role="option">
38163 <primary>to</primary>
38166 <informaltable frame="all">
38167 <tgroup cols="4" colsep="0" rowsep="0">
38168 <colspec colwidth="8*" align="left"/>
38169 <colspec colwidth="5*" align="center"/>
38170 <colspec colwidth="5*" align="center"/>
38171 <colspec colwidth="6*" align="right"/>
38174 <entry><option>to</option></entry>
38175 <entry>Use: <emphasis>autoreply</emphasis></entry>
38176 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38177 <entry>Default: <emphasis>unset</emphasis></entry>
38183 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
38184 when the message is specified by the transport.
38185 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
38186 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
38191 <chapter id="CHAPLMTP">
38192 <title>The lmtp transport</title>
38194 <indexterm role="concept">
38195 <primary>transports</primary>
38196 <secondary><command>lmtp</command></secondary>
38198 <indexterm role="concept">
38199 <primary><command>lmtp</command> transport</primary>
38201 <indexterm role="concept">
38202 <primary>LMTP</primary>
38203 <secondary>over a pipe</secondary>
38205 <indexterm role="concept">
38206 <primary>LMTP</primary>
38207 <secondary>over a socket</secondary>
38209 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
38211 or by interacting with a Unix domain socket.
38212 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
38213 transports. Exim also has support for using LMTP over TCP/IP; this is
38214 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
38215 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
38216 has it commented out. You need to ensure that
38218 <literallayout class="monospaced">
38222 <indexterm role="concept">
38223 <primary>options</primary>
38224 <secondary><command>lmtp</command> transport</secondary>
38226 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
38227 included in the Exim binary. The private options of the <command>lmtp</command> transport are
38231 <indexterm role="option">
38232 <primary>batch_id</primary>
38235 <informaltable frame="all">
38236 <tgroup cols="4" colsep="0" rowsep="0">
38237 <colspec colwidth="8*" align="left"/>
38238 <colspec colwidth="5*" align="center"/>
38239 <colspec colwidth="5*" align="center"/>
38240 <colspec colwidth="6*" align="right"/>
38243 <entry><option>batch_id</option></entry>
38244 <entry>Use: <emphasis>lmtp</emphasis></entry>
38245 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38246 <entry>Default: <emphasis>unset</emphasis></entry>
38252 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
38255 <indexterm role="option">
38256 <primary>batch_max</primary>
38259 <informaltable frame="all">
38260 <tgroup cols="4" colsep="0" rowsep="0">
38261 <colspec colwidth="8*" align="left"/>
38262 <colspec colwidth="5*" align="center"/>
38263 <colspec colwidth="5*" align="center"/>
38264 <colspec colwidth="6*" align="right"/>
38267 <entry><option>batch_max</option></entry>
38268 <entry>Use: <emphasis>lmtp</emphasis></entry>
38269 <entry>Type: <emphasis>integer</emphasis></entry>
38270 <entry>Default: <emphasis>1</emphasis></entry>
38276 This limits the number of addresses that can be handled in a single delivery.
38277 Most LMTP servers can handle several addresses at once, so it is normally a
38278 good idea to increase this value. See the description of local delivery
38279 batching in chapter <xref linkend="CHAPbatching"/>.
38282 <indexterm role="option">
38283 <primary>command</primary>
38286 <informaltable frame="all">
38287 <tgroup cols="4" colsep="0" rowsep="0">
38288 <colspec colwidth="8*" align="left"/>
38289 <colspec colwidth="5*" align="center"/>
38290 <colspec colwidth="5*" align="center"/>
38291 <colspec colwidth="6*" align="right"/>
38294 <entry><option>command</option></entry>
38295 <entry>Use: <emphasis>lmtp</emphasis></entry>
38296 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38297 <entry>Default: <emphasis>unset</emphasis></entry>
38303 This option must be set if <option>socket</option> is not set. The string is a command which
38304 is run in a separate process. It is split up into a command name and list of
38305 arguments, each of which is separately expanded (so expansion cannot change the
38306 number of arguments). The command is run directly, not via a shell. The message
38307 is passed to the new process using the standard input and output to operate the
38311 <indexterm role="option">
38312 <primary>ignore_quota</primary>
38315 <informaltable frame="all">
38316 <tgroup cols="4" colsep="0" rowsep="0">
38317 <colspec colwidth="8*" align="left"/>
38318 <colspec colwidth="5*" align="center"/>
38319 <colspec colwidth="5*" align="center"/>
38320 <colspec colwidth="6*" align="right"/>
38323 <entry><option>ignore_quota</option></entry>
38324 <entry>Use: <emphasis>lmtp</emphasis></entry>
38325 <entry>Type: <emphasis>boolean</emphasis></entry>
38326 <entry>Default: <emphasis>false</emphasis></entry>
38332 <indexterm role="concept">
38333 <primary>LMTP</primary>
38334 <secondary>ignoring quota errors</secondary>
38336 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
38337 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
38338 in its response to the LHLO command.
38341 <indexterm role="option">
38342 <primary>socket</primary>
38345 <informaltable frame="all">
38346 <tgroup cols="4" colsep="0" rowsep="0">
38347 <colspec colwidth="8*" align="left"/>
38348 <colspec colwidth="5*" align="center"/>
38349 <colspec colwidth="5*" align="center"/>
38350 <colspec colwidth="6*" align="right"/>
38353 <entry><option>socket</option></entry>
38354 <entry>Use: <emphasis>lmtp</emphasis></entry>
38355 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38356 <entry>Default: <emphasis>unset</emphasis></entry>
38362 This option must be set if <option>command</option> is not set. The result of expansion must
38363 be the name of a Unix domain socket. The transport connects to the socket and
38364 delivers the message to it using the LMTP protocol.
38367 <indexterm role="option">
38368 <primary>timeout</primary>
38371 <informaltable frame="all">
38372 <tgroup cols="4" colsep="0" rowsep="0">
38373 <colspec colwidth="8*" align="left"/>
38374 <colspec colwidth="5*" align="center"/>
38375 <colspec colwidth="5*" align="center"/>
38376 <colspec colwidth="6*" align="right"/>
38379 <entry><option>timeout</option></entry>
38380 <entry>Use: <emphasis>lmtp</emphasis></entry>
38381 <entry>Type: <emphasis>time</emphasis></entry>
38382 <entry>Default: <emphasis>5m</emphasis></entry>
38388 The transport is aborted if the created process
38389 or Unix domain socket
38390 does not respond to LMTP commands or message input within this timeout.
38393 Here is an example of a typical LMTP transport:
38395 <literallayout class="monospaced">
38398 command = /some/local/lmtp/delivery/program
38403 This delivers up to 20 addresses at a time, in a mixture of domains if
38404 necessary, running as the user <emphasis>exim</emphasis>.
38408 <chapter id="CHAPpipetransport">
38409 <title>The pipe transport</title>
38411 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
38412 <primary>transports</primary>
38413 <secondary><command>pipe</command></secondary>
38415 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
38416 <primary><command>pipe</command> transport</primary>
38418 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
38419 running in another process. One example is the use of <command>pipe</command> as a
38420 pseudo-remote transport for passing messages to some other delivery mechanism
38421 (such as UUCP). Another is the use by individual users to automatically process
38422 their incoming messages. The <command>pipe</command> transport can be used in one of the
38428 <indexterm role="concept">
38429 <primary><varname>$local_part</varname></primary>
38431 A router routes one address to a transport in the normal way, and the
38432 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
38433 contains the local part of the address (as usual), and the command that is run
38434 is specified by the <option>command</option> option on the transport.
38439 <indexterm role="concept">
38440 <primary><varname>$pipe_addresses</varname></primary>
38442 If the <option>batch_max</option> option is set greater than 1 (the default), the transport
38443 can be called upon to handle more than one address in a single run. In this
38444 case, <varname>$local_part</varname> is not set (because it is not unique). However, the
38445 pseudo-variable <varname>$pipe_addresses</varname> (described in section
38446 <xref linkend="SECThowcommandrun"/> below) contains all the addresses that are being
38452 <indexterm role="concept">
38453 <primary><varname>$address_pipe</varname></primary>
38455 A router redirects an address directly to a pipe command (for example, from an
38456 alias or forward file). In this case, <varname>$local_part</varname> contains the local part
38457 that was redirected, and <varname>$address_pipe</varname> contains the text of the pipe
38458 command itself. The <option>command</option> option on the transport is ignored.
38463 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
38464 deliver messages over pipes using the LMTP interactive protocol. This is
38465 implemented by the <command>lmtp</command> transport.
38468 In the case when <command>pipe</command> is run as a consequence of an entry in a local user’s
38469 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
38470 other cases, the uid and gid have to be specified explicitly, either on the
38471 transport or on the router that handles the address. Current and <quote>home</quote>
38472 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
38473 details of the local delivery environment.
38476 <title>Concurrent delivery</title>
38478 If two messages arrive at almost the same time, and both are routed to a pipe
38479 delivery, the two pipe transports may be run concurrently. You must ensure that
38480 any pipe commands you set up are robust against this happening. If the commands
38481 write to a file, the <option>exim_lock</option> utility might be of use.
38485 <title>Returned status and data</title>
38487 <indexterm role="concept">
38488 <primary><command>pipe</command> transport</primary>
38489 <secondary>returned data</secondary>
38491 If the command exits with a non-zero return code, the delivery is deemed to
38492 have failed, unless either the <option>ignore_status</option> option is set (in which case
38493 the return code is treated as zero), or the return code is one of those listed
38494 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
38495 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
38496 logged, but are not included in the bounce message, which merely contains
38497 <quote>local delivery failed</quote>.
38500 If the return code is greater than 128 and the command being run is a shell
38501 script, it normally means that the script was terminated by a signal whose
38502 value is the return code minus 128.
38505 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
38506 return code is set to 127. This is the value that a shell returns if it is
38507 asked to run a non-existent command. The wording for the log line suggests that
38508 a non-existent command may be the problem.
38511 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
38512 set and the command produces any output on its standard output or standard
38513 error streams, the command is considered to have failed, even if it gave a zero
38514 return code or if <option>ignore_status</option> is set. The output from the command is
38515 included as part of the bounce message. The <option>return_fail_output</option> option is
38516 similar, except that output is returned only when the command exits with a
38517 failure return code, that is, a value other than zero or a code that matches
38518 <option>temp_errors</option>.
38521 <section id="SECThowcommandrun">
38522 <title>How the command is run</title>
38524 <indexterm role="concept">
38525 <primary><command>pipe</command> transport</primary>
38526 <secondary>path for command</secondary>
38528 The command line is (by default) broken down into a command name and arguments
38529 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
38530 <option>restrict_to_path</option> options can be used to restrict the commands that may be
38534 <indexterm role="concept">
38535 <primary>quoting</primary>
38536 <secondary>in pipe command</secondary>
38538 Unquoted arguments are delimited by white space. If an argument appears in
38539 double quotes, backslash is interpreted as an escape character in the usual
38540 way. If an argument appears in single quotes, no escaping is done.
38543 String expansion is applied to the command line except when it comes from a
38544 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
38545 expansion is applied to each argument in turn rather than to the whole line.
38546 For this reason, any string expansion item that contains white space must be
38547 quoted so as to be contained within a single argument. A setting such as
38549 <literallayout class="monospaced">
38550 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
38553 will not work, because the expansion item gets split between several
38554 arguments. You have to write
38556 <literallayout class="monospaced">
38557 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
38559 <para revisionflag="changed">
38560 to ensure that it is all in one argument. The expansion is done in this way,
38561 argument by argument, so that the number of arguments cannot be changed as a
38562 result of expansion, and quotes or backslashes in inserted variables do not
38563 interact with external quoting. However, this leads to problems if you want to
38564 generate multiple arguments (or the command name plus arguments) from a single
38565 expansion. In this situation, the simplest solution is to use a shell. For
38568 <literallayout class="monospaced" revisionflag="changed">
38569 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
38572 <indexterm role="concept">
38573 <primary>transport</primary>
38574 <secondary>filter</secondary>
38576 <indexterm role="concept">
38577 <primary>filter</primary>
38578 <secondary>transport filter</secondary>
38580 <indexterm role="concept">
38581 <primary><varname>$pipe_addresses</varname></primary>
38583 Special handling takes place when an argument consists of precisely the text
38584 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
38585 place this string is recognized is when it appears as an argument for a pipe or
38586 transport filter command. It causes each address that is being handled to be
38587 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
38588 avoids any problems with spaces or shell metacharacters, and is of use when a
38589 <command>pipe</command> transport is handling groups of addresses in a batch.
38592 After splitting up into arguments and expansion, the resulting command is run
38593 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
38594 message that is being delivered is supplied on the standard input, and the
38595 standard output and standard error are both connected to a single pipe that is
38596 read by Exim. The <option>max_output</option> option controls how much output the command
38597 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
38598 control what is done with it.
38601 Not running the command under a shell (by default) lessens the security risks
38602 in cases when a command from a user’s filter file is built out of data that was
38603 taken from an incoming message. If a shell is required, it can of course be
38604 explicitly specified as the command to be run. However, there are circumstances
38605 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
38606 under a shell and cannot easily be modified. To allow for these cases, there is
38607 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
38608 works. Instead of breaking up the command line as just described, it expands it
38609 as a single string and passes the result to <filename>/bin/sh</filename>. The
38610 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
38611 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
38614 <section id="SECTpipeenv">
38615 <title>Environment variables</title>
38617 <indexterm role="concept">
38618 <primary><command>pipe</command> transport</primary>
38619 <secondary>environment for command</secondary>
38621 <indexterm role="concept">
38622 <primary>environment for pipe transport</primary>
38624 The environment variables listed below are set up when the command is invoked.
38625 This list is a compromise for maximum compatibility with other MTAs. Note that
38626 the <option>environment</option> option can be used to add additional variables to this
38630 <literal>DOMAIN </literal> the domain of the address
38631 <literal>HOME </literal> the home directory, if set
38632 <literal>HOST </literal> the host name when called from a router (see below)
38633 <literal>LOCAL_PART </literal> see below
38634 <literal>LOCAL_PART_PREFIX </literal> see below
38635 <literal>LOCAL_PART_SUFFIX </literal> see below
38636 <literal>LOGNAME </literal> see below
38637 <literal>MESSAGE_ID </literal> Exim’s local ID for the message
38638 <literal>PATH </literal> as specified by the <option>path</option> option below
38639 <literal>QUALIFY_DOMAIN </literal> the sender qualification domain
38640 <literal>RECIPIENT </literal> the complete recipient address
38641 <literal>SENDER </literal> the sender of the message (empty if a bounce)
38642 <literal>SHELL </literal> <literal>/bin/sh</literal>
38643 <literal>TZ </literal> the value of the <option>timezone</option> option, if set
38644 <literal>USER </literal> see below
38647 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
38648 router, LOCAL_PART is set to the local part of the address. When it is
38649 called as a result of a forward or alias expansion, LOCAL_PART is set to
38650 the local part of the address that was expanded. In both cases, any affixes are
38651 removed from the local part, and made available in LOCAL_PART_PREFIX and
38652 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
38653 same value as LOCAL_PART for compatibility with other MTAs.
38656 <indexterm role="concept">
38657 <primary>HOST</primary>
38659 HOST is set only when a <command>pipe</command> transport is called from a router that
38660 associates hosts with an address, typically when using <command>pipe</command> as a
38661 pseudo-remote transport. HOST is set to the first host name specified by
38665 <indexterm role="concept">
38666 <primary>HOME</primary>
38668 If the transport’s generic <option>home_directory</option> option is set, its value is used
38669 for the HOME environment variable. Otherwise, a home directory may be set
38670 by the router’s <option>transport_home_directory</option> option, which defaults to the
38671 user’s home directory if <option>check_local_user</option> is set.
38675 <title>Private options for pipe</title>
38677 <indexterm role="concept">
38678 <primary>options</primary>
38679 <secondary><command>pipe</command> transport</secondary>
38683 <indexterm role="option">
38684 <primary>allow_commands</primary>
38687 <informaltable frame="all">
38688 <tgroup cols="4" colsep="0" rowsep="0">
38689 <colspec colwidth="8*" align="left"/>
38690 <colspec colwidth="5*" align="center"/>
38691 <colspec colwidth="5*" align="center"/>
38692 <colspec colwidth="6*" align="right"/>
38695 <entry><option>allow_commands</option></entry>
38696 <entry>Use: <emphasis>pipe</emphasis></entry>
38697 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
38698 <entry>Default: <emphasis>unset</emphasis></entry>
38704 <indexterm role="concept">
38705 <primary><command>pipe</command> transport</primary>
38706 <secondary>permitted commands</secondary>
38708 The string is expanded, and is then interpreted as a colon-separated list of
38709 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
38710 permitted are those in the <option>allow_commands</option> list. They need not be absolute
38711 paths; the <option>path</option> option is still used for relative paths. If
38712 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
38713 in the <option>allow_commands</option> list, or a name without any slashes that is found on
38714 the path. In other words, if neither <option>allow_commands</option> nor
38715 <option>restrict_to_path</option> is set, there is no restriction on the command, but
38716 otherwise only commands that are permitted by one or the other are allowed. For
38719 <literallayout class="monospaced">
38720 allow_commands = /usr/bin/vacation
38723 and <option>restrict_to_path</option> is not set, the only permitted command is
38724 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
38725 <option>use_shell</option> is set.
38728 <indexterm role="option">
38729 <primary>batch_id</primary>
38732 <informaltable frame="all">
38733 <tgroup cols="4" colsep="0" rowsep="0">
38734 <colspec colwidth="8*" align="left"/>
38735 <colspec colwidth="5*" align="center"/>
38736 <colspec colwidth="5*" align="center"/>
38737 <colspec colwidth="6*" align="right"/>
38740 <entry><option>batch_id</option></entry>
38741 <entry>Use: <emphasis>pipe</emphasis></entry>
38742 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38743 <entry>Default: <emphasis>unset</emphasis></entry>
38749 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
38752 <indexterm role="option">
38753 <primary>batch_max</primary>
38756 <informaltable frame="all">
38757 <tgroup cols="4" colsep="0" rowsep="0">
38758 <colspec colwidth="8*" align="left"/>
38759 <colspec colwidth="5*" align="center"/>
38760 <colspec colwidth="5*" align="center"/>
38761 <colspec colwidth="6*" align="right"/>
38764 <entry><option>batch_max</option></entry>
38765 <entry>Use: <emphasis>pipe</emphasis></entry>
38766 <entry>Type: <emphasis>integer</emphasis></entry>
38767 <entry>Default: <emphasis>1</emphasis></entry>
38773 This limits the number of addresses that can be handled in a single delivery.
38774 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
38777 <indexterm role="option">
38778 <primary>check_string</primary>
38781 <informaltable frame="all">
38782 <tgroup cols="4" colsep="0" rowsep="0">
38783 <colspec colwidth="8*" align="left"/>
38784 <colspec colwidth="5*" align="center"/>
38785 <colspec colwidth="5*" align="center"/>
38786 <colspec colwidth="6*" align="right"/>
38789 <entry><option>check_string</option></entry>
38790 <entry>Use: <emphasis>pipe</emphasis></entry>
38791 <entry>Type: <emphasis>string</emphasis></entry>
38792 <entry>Default: <emphasis>unset</emphasis></entry>
38798 As <command>pipe</command> writes the message, the start of each line is tested for matching
38799 <option>check_string</option>, and if it does, the initial matching characters are replaced
38800 by the contents of <option>escape_string</option>, provided both are set. The value of
38801 <option>check_string</option> is a literal string, not a regular expression, and the case of
38802 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
38803 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
38804 the SMTP escaping protocol. Any settings made in the configuration file are
38808 <indexterm role="option">
38809 <primary>command</primary>
38812 <informaltable frame="all">
38813 <tgroup cols="4" colsep="0" rowsep="0">
38814 <colspec colwidth="8*" align="left"/>
38815 <colspec colwidth="5*" align="center"/>
38816 <colspec colwidth="5*" align="center"/>
38817 <colspec colwidth="6*" align="right"/>
38820 <entry><option>command</option></entry>
38821 <entry>Use: <emphasis>pipe</emphasis></entry>
38822 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38823 <entry>Default: <emphasis>unset</emphasis></entry>
38829 This option need not be set when <command>pipe</command> is being used to deliver to pipes
38830 obtained directly from address redirections. In other cases, the option must be
38831 set, to provide a command to be run. It need not yield an absolute path (see
38832 the <option>path</option> option below). The command is split up into separate arguments by
38833 Exim, and each argument is separately expanded, as described in section
38834 <xref linkend="SECThowcommandrun"/> above.
38837 <indexterm role="option">
38838 <primary>environment</primary>
38841 <informaltable frame="all">
38842 <tgroup cols="4" colsep="0" rowsep="0">
38843 <colspec colwidth="8*" align="left"/>
38844 <colspec colwidth="5*" align="center"/>
38845 <colspec colwidth="5*" align="center"/>
38846 <colspec colwidth="6*" align="right"/>
38849 <entry><option>environment</option></entry>
38850 <entry>Use: <emphasis>pipe</emphasis></entry>
38851 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38852 <entry>Default: <emphasis>unset</emphasis></entry>
38858 <indexterm role="concept">
38859 <primary><command>pipe</command> transport</primary>
38860 <secondary>environment for command</secondary>
38862 <indexterm role="concept">
38863 <primary>environment for <command>pipe</command> transport</primary>
38865 This option is used to add additional variables to the environment in which the
38866 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
38867 a string which is expanded, and then interpreted as a colon-separated list of
38868 environment settings of the form <<emphasis>name</emphasis>>=<<emphasis>value</emphasis>>.
38871 <indexterm role="option">
38872 <primary>escape_string</primary>
38875 <informaltable frame="all">
38876 <tgroup cols="4" colsep="0" rowsep="0">
38877 <colspec colwidth="8*" align="left"/>
38878 <colspec colwidth="5*" align="center"/>
38879 <colspec colwidth="5*" align="center"/>
38880 <colspec colwidth="6*" align="right"/>
38883 <entry><option>escape_string</option></entry>
38884 <entry>Use: <emphasis>pipe</emphasis></entry>
38885 <entry>Type: <emphasis>string</emphasis></entry>
38886 <entry>Default: <emphasis>unset</emphasis></entry>
38892 See <option>check_string</option> above.
38895 <indexterm role="option">
38896 <primary>freeze_exec_fail</primary>
38899 <informaltable frame="all">
38900 <tgroup cols="4" colsep="0" rowsep="0">
38901 <colspec colwidth="8*" align="left"/>
38902 <colspec colwidth="5*" align="center"/>
38903 <colspec colwidth="5*" align="center"/>
38904 <colspec colwidth="6*" align="right"/>
38907 <entry><option>freeze_exec_fail</option></entry>
38908 <entry>Use: <emphasis>pipe</emphasis></entry>
38909 <entry>Type: <emphasis>boolean</emphasis></entry>
38910 <entry>Default: <emphasis>false</emphasis></entry>
38916 <indexterm role="concept">
38917 <primary>exec failure</primary>
38919 <indexterm role="concept">
38920 <primary>failure of exec</primary>
38922 <indexterm role="concept">
38923 <primary><command>pipe</command> transport</primary>
38924 <secondary>failure of exec</secondary>
38926 Failure to exec the command in a pipe transport is by default treated like
38927 any other failure while running the command. However, if <option>freeze_exec_fail</option>
38928 is set, failure to exec is treated specially, and causes the message to be
38929 frozen, whatever the setting of <option>ignore_status</option>.
38932 <indexterm role="option">
38933 <primary>ignore_status</primary>
38936 <informaltable frame="all">
38937 <tgroup cols="4" colsep="0" rowsep="0">
38938 <colspec colwidth="8*" align="left"/>
38939 <colspec colwidth="5*" align="center"/>
38940 <colspec colwidth="5*" align="center"/>
38941 <colspec colwidth="6*" align="right"/>
38944 <entry><option>ignore_status</option></entry>
38945 <entry>Use: <emphasis>pipe</emphasis></entry>
38946 <entry>Type: <emphasis>boolean</emphasis></entry>
38947 <entry>Default: <emphasis>false</emphasis></entry>
38953 If this option is true, the status returned by the subprocess that is set up to
38954 run the command is ignored, and Exim behaves as if zero had been returned.
38955 Otherwise, a non-zero status or termination by signal causes an error return
38956 from the transport unless the status value is one of those listed in
38957 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
38960 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
38961 See the <option>timeout_defer</option> option for how timeouts are handled.
38964 <indexterm role="option">
38965 <primary>log_defer_output</primary>
38968 <informaltable frame="all">
38969 <tgroup cols="4" colsep="0" rowsep="0">
38970 <colspec colwidth="8*" align="left"/>
38971 <colspec colwidth="5*" align="center"/>
38972 <colspec colwidth="5*" align="center"/>
38973 <colspec colwidth="6*" align="right"/>
38976 <entry><option>log_defer_output</option></entry>
38977 <entry>Use: <emphasis>pipe</emphasis></entry>
38978 <entry>Type: <emphasis>boolean</emphasis></entry>
38979 <entry>Default: <emphasis>false</emphasis></entry>
38985 <indexterm role="concept">
38986 <primary><command>pipe</command> transport</primary>
38987 <secondary>logging output</secondary>
38989 If this option is set, and the status returned by the command is
38990 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
38991 and any output was produced, the first line of it is written to the main log.
38994 <indexterm role="option">
38995 <primary>log_fail_output</primary>
38998 <informaltable frame="all">
38999 <tgroup cols="4" colsep="0" rowsep="0">
39000 <colspec colwidth="8*" align="left"/>
39001 <colspec colwidth="5*" align="center"/>
39002 <colspec colwidth="5*" align="center"/>
39003 <colspec colwidth="6*" align="right"/>
39006 <entry><option>log_fail_output</option></entry>
39007 <entry>Use: <emphasis>pipe</emphasis></entry>
39008 <entry>Type: <emphasis>boolean</emphasis></entry>
39009 <entry>Default: <emphasis>false</emphasis></entry>
39015 If this option is set, and the command returns any output, and also ends with a
39016 return code that is neither zero nor one of the return codes listed in
39017 <option>temp_errors</option> (that is, the delivery failed), the first line of output is
39018 written to the main log. This option and <option>log_output</option> are mutually exclusive.
39019 Only one of them may be set.
39022 <indexterm role="option">
39023 <primary>log_output</primary>
39026 <informaltable frame="all">
39027 <tgroup cols="4" colsep="0" rowsep="0">
39028 <colspec colwidth="8*" align="left"/>
39029 <colspec colwidth="5*" align="center"/>
39030 <colspec colwidth="5*" align="center"/>
39031 <colspec colwidth="6*" align="right"/>
39034 <entry><option>log_output</option></entry>
39035 <entry>Use: <emphasis>pipe</emphasis></entry>
39036 <entry>Type: <emphasis>boolean</emphasis></entry>
39037 <entry>Default: <emphasis>false</emphasis></entry>
39043 If this option is set and the command returns any output, the first line of
39044 output is written to the main log, whatever the return code. This option and
39045 <option>log_fail_output</option> are mutually exclusive. Only one of them may be set.
39048 <indexterm role="option">
39049 <primary>max_output</primary>
39052 <informaltable frame="all">
39053 <tgroup cols="4" colsep="0" rowsep="0">
39054 <colspec colwidth="8*" align="left"/>
39055 <colspec colwidth="5*" align="center"/>
39056 <colspec colwidth="5*" align="center"/>
39057 <colspec colwidth="6*" align="right"/>
39060 <entry><option>max_output</option></entry>
39061 <entry>Use: <emphasis>pipe</emphasis></entry>
39062 <entry>Type: <emphasis>integer</emphasis></entry>
39063 <entry>Default: <emphasis>20K</emphasis></entry>
39069 This specifies the maximum amount of output that the command may produce on its
39070 standard output and standard error file combined. If the limit is exceeded, the
39071 process running the command is killed. This is intended as a safety measure to
39072 catch runaway processes. The limit is applied independently of the settings of
39073 the options that control what is done with such output (for example,
39074 <option>return_output</option>). Because of buffering effects, the amount of output may
39075 exceed the limit by a small amount before Exim notices.
39078 <indexterm role="option">
39079 <primary>message_prefix</primary>
39082 <informaltable frame="all">
39083 <tgroup cols="4" colsep="0" rowsep="0">
39084 <colspec colwidth="8*" align="left"/>
39085 <colspec colwidth="5*" align="center"/>
39086 <colspec colwidth="5*" align="center"/>
39087 <colspec colwidth="6*" align="right"/>
39090 <entry><option>message_prefix</option></entry>
39091 <entry>Use: <emphasis>pipe</emphasis></entry>
39092 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39093 <entry>Default: <emphasis>see below</emphasis></entry>
39099 The string specified here is expanded and output at the start of every message.
39100 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
39102 <literallayout class="monospaced">
39104 From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
39108 <indexterm role="concept">
39109 <primary>Cyrus</primary>
39111 <indexterm role="concept">
39112 <primary><option>tmail</option></primary>
39114 <indexterm role="concept">
39115 <primary><quote>From</quote> line</primary>
39117 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
39118 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
39119 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
39122 <literallayout class="monospaced">
39126 <indexterm role="option">
39127 <primary>message_suffix</primary>
39130 <informaltable frame="all">
39131 <tgroup cols="4" colsep="0" rowsep="0">
39132 <colspec colwidth="8*" align="left"/>
39133 <colspec colwidth="5*" align="center"/>
39134 <colspec colwidth="5*" align="center"/>
39135 <colspec colwidth="6*" align="right"/>
39138 <entry><option>message_suffix</option></entry>
39139 <entry>Use: <emphasis>pipe</emphasis></entry>
39140 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39141 <entry>Default: <emphasis>see below</emphasis></entry>
39147 The string specified here is expanded and output at the end of every message.
39148 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
39149 The suffix can be suppressed by setting
39151 <literallayout class="monospaced">
39155 <indexterm role="option">
39156 <primary>path</primary>
39159 <informaltable frame="all">
39160 <tgroup cols="4" colsep="0" rowsep="0">
39161 <colspec colwidth="8*" align="left"/>
39162 <colspec colwidth="5*" align="center"/>
39163 <colspec colwidth="5*" align="center"/>
39164 <colspec colwidth="6*" align="right"/>
39167 <entry><option>path</option></entry>
39168 <entry>Use: <emphasis>pipe</emphasis></entry>
39169 <entry>Type: <emphasis>string</emphasis></entry>
39170 <entry>Default: <emphasis><literal>/bin:/usr/bin</literal></emphasis></entry>
39176 This option specifies the string that is set up in the PATH environment
39177 variable of the subprocess. If the <option>command</option> option does not yield an
39178 absolute path name, the command is sought in the PATH directories, in the usual
39179 way. <emphasis role="bold">Warning</emphasis>: This does not apply to a command specified as a transport
39183 <indexterm role="option">
39184 <primary>pipe_as_creator</primary>
39187 <informaltable frame="all">
39188 <tgroup cols="4" colsep="0" rowsep="0">
39189 <colspec colwidth="8*" align="left"/>
39190 <colspec colwidth="5*" align="center"/>
39191 <colspec colwidth="5*" align="center"/>
39192 <colspec colwidth="6*" align="right"/>
39195 <entry><option>pipe_as_creator</option></entry>
39196 <entry>Use: <emphasis>pipe</emphasis></entry>
39197 <entry>Type: <emphasis>boolean</emphasis></entry>
39198 <entry>Default: <emphasis>false</emphasis></entry>
39204 <indexterm role="concept">
39205 <primary>uid (user id)</primary>
39206 <secondary>local delivery</secondary>
39208 If the generic <option>user</option> option is not set and this option is true, the delivery
39209 process is run under the uid that was in force when Exim was originally called
39210 to accept the message. If the group id is not otherwise set (via the generic
39211 <option>group</option> option), the gid that was in force when Exim was originally called to
39212 accept the message is used.
39215 <indexterm role="option">
39216 <primary>restrict_to_path</primary>
39219 <informaltable frame="all">
39220 <tgroup cols="4" colsep="0" rowsep="0">
39221 <colspec colwidth="8*" align="left"/>
39222 <colspec colwidth="5*" align="center"/>
39223 <colspec colwidth="5*" align="center"/>
39224 <colspec colwidth="6*" align="right"/>
39227 <entry><option>restrict_to_path</option></entry>
39228 <entry>Use: <emphasis>pipe</emphasis></entry>
39229 <entry>Type: <emphasis>boolean</emphasis></entry>
39230 <entry>Default: <emphasis>false</emphasis></entry>
39236 When this option is set, any command name not listed in <option>allow_commands</option> must
39237 contain no slashes. The command is searched for only in the directories listed
39238 in the <option>path</option> option. This option is intended for use in the case when a pipe
39239 command has been generated from a user’s <filename>.forward</filename> file. This is usually
39240 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
39243 <indexterm role="option">
39244 <primary>return_fail_output</primary>
39247 <informaltable frame="all">
39248 <tgroup cols="4" colsep="0" rowsep="0">
39249 <colspec colwidth="8*" align="left"/>
39250 <colspec colwidth="5*" align="center"/>
39251 <colspec colwidth="5*" align="center"/>
39252 <colspec colwidth="6*" align="right"/>
39255 <entry><option>return_fail_output</option></entry>
39256 <entry>Use: <emphasis>pipe</emphasis></entry>
39257 <entry>Type: <emphasis>boolean</emphasis></entry>
39258 <entry>Default: <emphasis>false</emphasis></entry>
39264 If this option is true, and the command produced any output and ended with a
39265 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
39266 is, the delivery failed), the output is returned in the bounce message.
39267 However, if the message has a null sender (that is, it is itself a bounce
39268 message), output from the command is discarded. This option and
39269 <option>return_output</option> are mutually exclusive. Only one of them may be set.
39272 <indexterm role="option">
39273 <primary>return_output</primary>
39276 <informaltable frame="all">
39277 <tgroup cols="4" colsep="0" rowsep="0">
39278 <colspec colwidth="8*" align="left"/>
39279 <colspec colwidth="5*" align="center"/>
39280 <colspec colwidth="5*" align="center"/>
39281 <colspec colwidth="6*" align="right"/>
39284 <entry><option>return_output</option></entry>
39285 <entry>Use: <emphasis>pipe</emphasis></entry>
39286 <entry>Type: <emphasis>boolean</emphasis></entry>
39287 <entry>Default: <emphasis>false</emphasis></entry>
39293 If this option is true, and the command produced any output, the delivery is
39294 deemed to have failed whatever the return code from the command, and the output
39295 is returned in the bounce message. Otherwise, the output is just discarded.
39296 However, if the message has a null sender (that is, it is a bounce message),
39297 output from the command is always discarded, whatever the setting of this
39298 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
39299 of them may be set.
39302 <indexterm role="option">
39303 <primary>temp_errors</primary>
39306 <informaltable frame="all">
39307 <tgroup cols="4" colsep="0" rowsep="0">
39308 <colspec colwidth="8*" align="left"/>
39309 <colspec colwidth="5*" align="center"/>
39310 <colspec colwidth="5*" align="center"/>
39311 <colspec colwidth="6*" align="right"/>
39314 <entry><option>temp_errors</option></entry>
39315 <entry>Use: <emphasis>pipe</emphasis></entry>
39316 <entry>Type: <emphasis>string list</emphasis></entry>
39317 <entry>Default: <emphasis>see below</emphasis></entry>
39323 <indexterm role="concept">
39324 <primary><command>pipe</command> transport</primary>
39325 <secondary>temporary failure</secondary>
39327 This option contains either a colon-separated list of numbers, or a single
39328 asterisk. If <option>ignore_status</option> is false
39329 and <option>return_output</option> is not set,
39330 and the command exits with a non-zero return code, the failure is treated as
39331 temporary and the delivery is deferred if the return code matches one of the
39332 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
39333 codes are treated as permanent errors. The default setting contains the codes
39334 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
39335 compiled on a system that does not define these macros, it assumes values of 75
39336 and 73, respectively.
39339 <indexterm role="option">
39340 <primary>timeout</primary>
39343 <informaltable frame="all">
39344 <tgroup cols="4" colsep="0" rowsep="0">
39345 <colspec colwidth="8*" align="left"/>
39346 <colspec colwidth="5*" align="center"/>
39347 <colspec colwidth="5*" align="center"/>
39348 <colspec colwidth="6*" align="right"/>
39351 <entry><option>timeout</option></entry>
39352 <entry>Use: <emphasis>pipe</emphasis></entry>
39353 <entry>Type: <emphasis>time</emphasis></entry>
39354 <entry>Default: <emphasis>1h</emphasis></entry>
39360 If the command fails to complete within this time, it is killed. This normally
39361 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
39362 specifies no timeout. In order to ensure that any subprocesses created by the
39363 command are also killed, Exim makes the initial process a process group leader,
39364 and kills the whole process group on a timeout. However, this can be defeated
39365 if one of the processes starts a new process group.
39368 <indexterm role="option">
39369 <primary>timeout_defer</primary>
39372 <informaltable frame="all">
39373 <tgroup cols="4" colsep="0" rowsep="0">
39374 <colspec colwidth="8*" align="left"/>
39375 <colspec colwidth="5*" align="center"/>
39376 <colspec colwidth="5*" align="center"/>
39377 <colspec colwidth="6*" align="right"/>
39380 <entry><option>timeout_defer</option></entry>
39381 <entry>Use: <emphasis>pipe</emphasis></entry>
39382 <entry>Type: <emphasis>boolean</emphasis></entry>
39383 <entry>Default: <emphasis>false</emphasis></entry>
39389 A timeout in a <command>pipe</command> transport, either in the command that the transport
39390 runs, or in a transport filter that is associated with it, is by default
39391 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
39392 is set true, both kinds of timeout become temporary errors, causing the
39393 delivery to be deferred.
39396 <indexterm role="option">
39397 <primary>umask</primary>
39400 <informaltable frame="all">
39401 <tgroup cols="4" colsep="0" rowsep="0">
39402 <colspec colwidth="8*" align="left"/>
39403 <colspec colwidth="5*" align="center"/>
39404 <colspec colwidth="5*" align="center"/>
39405 <colspec colwidth="6*" align="right"/>
39408 <entry><option>umask</option></entry>
39409 <entry>Use: <emphasis>pipe</emphasis></entry>
39410 <entry>Type: <emphasis>octal integer</emphasis></entry>
39411 <entry>Default: <emphasis>022</emphasis></entry>
39417 This specifies the umask setting for the subprocess that runs the command.
39420 <indexterm role="option">
39421 <primary>use_bsmtp</primary>
39424 <informaltable frame="all">
39425 <tgroup cols="4" colsep="0" rowsep="0">
39426 <colspec colwidth="8*" align="left"/>
39427 <colspec colwidth="5*" align="center"/>
39428 <colspec colwidth="5*" align="center"/>
39429 <colspec colwidth="6*" align="right"/>
39432 <entry><option>use_bsmtp</option></entry>
39433 <entry>Use: <emphasis>pipe</emphasis></entry>
39434 <entry>Type: <emphasis>boolean</emphasis></entry>
39435 <entry>Default: <emphasis>false</emphasis></entry>
39441 <indexterm role="concept">
39442 <primary>envelope sender</primary>
39444 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
39445 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
39446 commands. If you want to include a leading HELO command with such messages,
39447 you can do so by setting the <option>message_prefix</option> option. See section
39448 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
39450 <para revisionflag="changed">
39451 <indexterm role="option">
39452 <primary>use_classresources</primary>
39455 <informaltable frame="all" revisionflag="changed">
39456 <tgroup cols="4" colsep="0" rowsep="0">
39457 <colspec colwidth="8*" align="left"/>
39458 <colspec colwidth="5*" align="center"/>
39459 <colspec colwidth="5*" align="center"/>
39460 <colspec colwidth="6*" align="right"/>
39463 <entry><option>use_classresources</option></entry>
39464 <entry>Use: <emphasis>pipe</emphasis></entry>
39465 <entry>Type: <emphasis>boolean</emphasis></entry>
39466 <entry>Default: <emphasis>false</emphasis></entry>
39471 <para revisionflag="changed">
39472 <indexterm role="concept">
39473 <primary>class resources (BSD)</primary>
39475 This option is available only when Exim is running on FreeBSD, NetBSD, or
39476 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
39477 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
39478 limits for the uid under which the pipe is to run are obtained from the login
39482 <indexterm role="option">
39483 <primary>use_crlf</primary>
39486 <informaltable frame="all">
39487 <tgroup cols="4" colsep="0" rowsep="0">
39488 <colspec colwidth="8*" align="left"/>
39489 <colspec colwidth="5*" align="center"/>
39490 <colspec colwidth="5*" align="center"/>
39491 <colspec colwidth="6*" align="right"/>
39494 <entry><option>use_crlf</option></entry>
39495 <entry>Use: <emphasis>pipe</emphasis></entry>
39496 <entry>Type: <emphasis>boolean</emphasis></entry>
39497 <entry>Default: <emphasis>false</emphasis></entry>
39503 <indexterm role="concept">
39504 <primary>carriage return</primary>
39506 <indexterm role="concept">
39507 <primary>linefeed</primary>
39509 This option causes lines to be terminated with the two-character CRLF sequence
39510 (carriage return, linefeed) instead of just a linefeed character. In the case
39511 of batched SMTP, the byte sequence written to the pipe is then an exact image
39512 of what would be sent down a real SMTP connection.
39515 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
39516 written verbatim, so must contain their own carriage return characters if these
39517 are needed. Since the default values for both <option>message_prefix</option> and
39518 <option>message_suffix</option> end with a single linefeed, their values must be changed to
39519 end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
39522 <indexterm role="option">
39523 <primary>use_shell</primary>
39526 <informaltable frame="all">
39527 <tgroup cols="4" colsep="0" rowsep="0">
39528 <colspec colwidth="8*" align="left"/>
39529 <colspec colwidth="5*" align="center"/>
39530 <colspec colwidth="5*" align="center"/>
39531 <colspec colwidth="6*" align="right"/>
39534 <entry><option>use_shell</option></entry>
39535 <entry>Use: <emphasis>pipe</emphasis></entry>
39536 <entry>Type: <emphasis>boolean</emphasis></entry>
39537 <entry>Default: <emphasis>false</emphasis></entry>
39543 <indexterm role="concept">
39544 <primary><varname>$pipe_addresses</varname></primary>
39546 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
39547 instead of being run directly from the transport, as described in section
39548 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
39549 where the command is expected to be run under a shell and cannot easily be
39550 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
39551 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
39552 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
39553 its <option>-c</option> option.
39557 <title>Using an external local delivery agent</title>
39559 <indexterm role="concept">
39560 <primary>local delivery</primary>
39561 <secondary>using an external agent</secondary>
39563 <indexterm role="concept">
39564 <primary><emphasis>procmail</emphasis></primary>
39566 <indexterm role="concept">
39567 <primary>external local delivery</primary>
39569 <indexterm role="concept">
39570 <primary>delivery</primary>
39571 <secondary><emphasis>procmail</emphasis></secondary>
39573 <indexterm role="concept">
39574 <primary>delivery</primary>
39575 <secondary>by external agent</secondary>
39577 The <command>pipe</command> transport can be used to pass all messages that require local
39578 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
39579 this, care must be taken to ensure that the pipe is run under an appropriate
39580 uid and gid. In some configurations one wants this to be a uid that is trusted
39581 by the delivery agent to supply the correct sender of the message. It may be
39582 necessary to recompile or reconfigure the delivery agent so that it trusts an
39583 appropriate user. The following is an example transport and router
39584 configuration for <option>procmail</option>:
39586 <literallayout class="monospaced">
39590 command = /usr/local/bin/procmail -d $local_part
39594 check_string = "From "
39595 escape_string = ">From "
39603 transport = procmail_pipe
39606 In this example, the pipe is run as the local user, but with the group set to
39607 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
39608 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
39609 user to supply a correct sender address. If you do not specify either a
39610 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
39611 home directory is the user’s home directory by default.
39614 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
39616 <literallayout class="monospaced">
39620 as shown in some <option>procmail</option> documentation, because Exim does not by default
39621 use a shell to run pipe commands.
39624 <indexterm role="concept">
39625 <primary>Cyrus</primary>
39627 The next example shows a transport and a router for a system where local
39628 deliveries are handled by the Cyrus IMAP server.
39630 <literallayout class="monospaced">
39632 local_delivery_cyrus:
39634 command = /usr/cyrus/bin/deliver \
39635 -m ${substr_1:$local_part_suffix} -- $local_part
39647 local_part_suffix = .*
39648 transport = local_delivery_cyrus
39651 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
39652 <option>return_output</option> to cause any text written by Cyrus to be returned to the
39654 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
39655 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
39660 <chapter id="CHAPsmtptrans">
39661 <title>The smtp transport</title>
39663 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
39664 <primary>transports</primary>
39665 <secondary><command>smtp</command></secondary>
39667 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
39668 <primary><command>smtp</command> transport</primary>
39670 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
39671 or LMTP protocol. The list of hosts to try can either be taken from the address
39672 that is being processed (having been set up by the router), or specified
39673 explicitly for the transport. Timeout and retry processing (see chapter
39674 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
39677 <title>Multiple messages on a single connection</title>
39679 The sending of multiple messages over a single TCP/IP connection can arise in
39685 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
39686 routed to the same host, more than one copy of the message has to be sent to
39687 that host. In this situation, multiple copies may be sent in a single run of
39688 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
39689 does when it has too many addresses to send in one message also depends on the
39690 value of the global <option>remote_max_parallel</option> option. Details are given in
39691 section <xref linkend="SECToutSMTPTCP"/>.)
39696 <indexterm role="concept">
39697 <primary>hints database</primary>
39698 <secondary>remembering routing</secondary>
39700 When a message has been successfully delivered over a TCP/IP connection, Exim
39701 looks in its hints database to see if there are any other messages awaiting a
39702 connection to the same host. If there are, a new delivery process is started
39703 for one of them, and the current TCP/IP connection is passed on to it. The new
39704 process may in turn send multiple copies and possibly create yet another
39710 For each copy sent over the same TCP/IP connection, a sequence counter is
39711 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
39712 no further messages are sent over that connection.
39716 <title>Use of the $host variable</title>
39718 <indexterm role="concept">
39719 <primary><varname>$host</varname></primary>
39721 <indexterm role="concept">
39722 <primary><varname>$host_address</varname></primary>
39724 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
39725 <varname>$host_address</varname> are the name and IP address of the first host on the host list
39726 passed by the router. However, when the transport is about to connect to a
39727 specific host, and while it is connected to that host, <varname>$host</varname> and
39728 <varname>$host_address</varname> are set to the values for that host. These are the values
39729 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
39730 <option>serialize_hosts</option>, and the various TLS options are expanded.
39734 <title>Private options for smtp</title>
39736 <indexterm role="concept">
39737 <primary>options</primary>
39738 <secondary><command>smtp</command> transport</secondary>
39740 The private options of the <command>smtp</command> transport are as follows:
39743 <indexterm role="option">
39744 <primary>allow_localhost</primary>
39747 <informaltable frame="all">
39748 <tgroup cols="4" colsep="0" rowsep="0">
39749 <colspec colwidth="8*" align="left"/>
39750 <colspec colwidth="5*" align="center"/>
39751 <colspec colwidth="5*" align="center"/>
39752 <colspec colwidth="6*" align="right"/>
39755 <entry><option>allow_localhost</option></entry>
39756 <entry>Use: <emphasis>smtp</emphasis></entry>
39757 <entry>Type: <emphasis>boolean</emphasis></entry>
39758 <entry>Default: <emphasis>false</emphasis></entry>
39764 <indexterm role="concept">
39765 <primary>local host</primary>
39766 <secondary>sending to</secondary>
39768 <indexterm role="concept">
39769 <primary>fallback</primary>
39770 <secondary>hosts specified on transport</secondary>
39772 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
39773 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
39774 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
39775 the delivery anyway. This should be used only in special cases when the
39776 configuration ensures that no looping will result (for example, a differently
39777 configured Exim is listening on the port to which the message is sent).
39780 <indexterm role="option">
39781 <primary>authenticated_sender</primary>
39784 <informaltable frame="all">
39785 <tgroup cols="4" colsep="0" rowsep="0">
39786 <colspec colwidth="8*" align="left"/>
39787 <colspec colwidth="5*" align="center"/>
39788 <colspec colwidth="5*" align="center"/>
39789 <colspec colwidth="6*" align="right"/>
39792 <entry><option>authenticated_sender</option></entry>
39793 <entry>Use: <emphasis>smtp</emphasis></entry>
39794 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39795 <entry>Default: <emphasis>unset</emphasis></entry>
39801 <indexterm role="concept">
39802 <primary>Cyrus</primary>
39805 <para revisionflag="changed">
39806 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
39807 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
39808 overriding any existing authenticated sender value. If the string expansion is
39809 forced to fail, the option is ignored. Other expansion failures cause delivery
39810 to be deferred. If the result of expansion is an empty string, that is also
39813 <para revisionflag="changed">
39814 If the SMTP session is not authenticated, the expansion of
39815 <option>authenticated_sender</option> still happens (and can cause the delivery to be
39816 deferred if it fails), but no AUTH= item is added to MAIL commands
39817 unless <option>authenticated_sender_force</option> is true.
39820 This option allows you to use the <command>smtp</command> transport in LMTP mode to
39821 deliver mail to Cyrus IMAP and provide the proper local part as the
39822 <quote>authenticated sender</quote>, via a setting such as:
39824 <literallayout class="monospaced">
39825 authenticated_sender = $local_part
39828 This removes the need for IMAP subfolders to be assigned special ACLs to
39829 allow direct delivery to those subfolders.
39832 Because of expected uses such as that just described for Cyrus (when no
39833 domain is involved), there is no checking on the syntax of the provided
39836 <para revisionflag="changed">
39837 <indexterm role="option">
39838 <primary>authenticated_sender_force</primary>
39841 <informaltable frame="all" revisionflag="changed">
39842 <tgroup cols="4" colsep="0" rowsep="0">
39843 <colspec colwidth="8*" align="left"/>
39844 <colspec colwidth="5*" align="center"/>
39845 <colspec colwidth="5*" align="center"/>
39846 <colspec colwidth="6*" align="right"/>
39849 <entry><option>authenticated_sender_force</option></entry>
39850 <entry>Use: <emphasis>smtp</emphasis></entry>
39851 <entry>Type: <emphasis>boolean</emphasis></entry>
39852 <entry>Default: <emphasis>false</emphasis></entry>
39857 <para revisionflag="changed">
39858 If this option is set true, the <option>authenticated_sender</option> option’s value
39859 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
39860 authenticated as a client.
39863 <indexterm role="option">
39864 <primary>command_timeout</primary>
39867 <informaltable frame="all">
39868 <tgroup cols="4" colsep="0" rowsep="0">
39869 <colspec colwidth="8*" align="left"/>
39870 <colspec colwidth="5*" align="center"/>
39871 <colspec colwidth="5*" align="center"/>
39872 <colspec colwidth="6*" align="right"/>
39875 <entry><option>command_timeout</option></entry>
39876 <entry>Use: <emphasis>smtp</emphasis></entry>
39877 <entry>Type: <emphasis>time</emphasis></entry>
39878 <entry>Default: <emphasis>5m</emphasis></entry>
39884 This sets a timeout for receiving a response to an SMTP command that has been
39885 sent out. It is also used when waiting for the initial banner line from the
39886 remote host. Its value must not be zero.
39889 <indexterm role="option">
39890 <primary>connect_timeout</primary>
39893 <informaltable frame="all">
39894 <tgroup cols="4" colsep="0" rowsep="0">
39895 <colspec colwidth="8*" align="left"/>
39896 <colspec colwidth="5*" align="center"/>
39897 <colspec colwidth="5*" align="center"/>
39898 <colspec colwidth="6*" align="right"/>
39901 <entry><option>connect_timeout</option></entry>
39902 <entry>Use: <emphasis>smtp</emphasis></entry>
39903 <entry>Type: <emphasis>time</emphasis></entry>
39904 <entry>Default: <emphasis>5m</emphasis></entry>
39910 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
39911 to a remote host. A setting of zero allows the system timeout (typically
39912 several minutes) to act. To have any effect, the value of this option must be
39913 less than the system timeout. However, it has been observed that on some
39914 systems there is no system timeout, which is why the default value for this
39915 option is 5 minutes, a value recommended by RFC 1123.
39918 <indexterm role="option">
39919 <primary>connection_max_messages</primary>
39922 <informaltable frame="all">
39923 <tgroup cols="4" colsep="0" rowsep="0">
39924 <colspec colwidth="8*" align="left"/>
39925 <colspec colwidth="5*" align="center"/>
39926 <colspec colwidth="5*" align="center"/>
39927 <colspec colwidth="6*" align="right"/>
39930 <entry><option>connection_max_messages</option></entry>
39931 <entry>Use: <emphasis>smtp</emphasis></entry>
39932 <entry>Type: <emphasis>integer</emphasis></entry>
39933 <entry>Default: <emphasis>500</emphasis></entry>
39939 <indexterm role="concept">
39940 <primary>SMTP</primary>
39941 <secondary>passed connection</secondary>
39943 <indexterm role="concept">
39944 <primary>SMTP</primary>
39945 <secondary>multiple deliveries</secondary>
39947 <indexterm role="concept">
39948 <primary>multiple SMTP deliveries</primary>
39950 This controls the maximum number of separate message deliveries that are sent
39951 over a single TCP/IP connection. If the value is zero, there is no limit.
39952 For testing purposes, this value can be overridden by the <option>-oB</option> command line
39956 <indexterm role="option">
39957 <primary>data_timeout</primary>
39960 <informaltable frame="all">
39961 <tgroup cols="4" colsep="0" rowsep="0">
39962 <colspec colwidth="8*" align="left"/>
39963 <colspec colwidth="5*" align="center"/>
39964 <colspec colwidth="5*" align="center"/>
39965 <colspec colwidth="6*" align="right"/>
39968 <entry><option>data_timeout</option></entry>
39969 <entry>Use: <emphasis>smtp</emphasis></entry>
39970 <entry>Type: <emphasis>time</emphasis></entry>
39971 <entry>Default: <emphasis>5m</emphasis></entry>
39977 This sets a timeout for the transmission of each block in the data portion of
39978 the message. As a result, the overall timeout for a message depends on the size
39979 of the message. Its value must not be zero. See also <option>final_timeout</option>.
39982 <indexterm role="option">
39983 <primary>delay_after_cutoff</primary>
39986 <informaltable frame="all">
39987 <tgroup cols="4" colsep="0" rowsep="0">
39988 <colspec colwidth="8*" align="left"/>
39989 <colspec colwidth="5*" align="center"/>
39990 <colspec colwidth="5*" align="center"/>
39991 <colspec colwidth="6*" align="right"/>
39994 <entry><option>delay_after_cutoff</option></entry>
39995 <entry>Use: <emphasis>smtp</emphasis></entry>
39996 <entry>Type: <emphasis>boolean</emphasis></entry>
39997 <entry>Default: <emphasis>true</emphasis></entry>
40003 This option controls what happens when all remote IP addresses for a given
40004 domain have been inaccessible for so long that they have passed their retry
40008 In the default state, if the next retry time has not been reached for any of
40009 them, the address is bounced without trying any deliveries. In other words,
40010 Exim delays retrying an IP address after the final cutoff time until a new
40011 retry time is reached, and can therefore bounce an address without ever trying
40012 a delivery, when machines have been down for a long time. Some people are
40013 unhappy at this prospect, so...
40016 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
40017 addresses are past their final cutoff time, Exim tries to deliver to those
40018 IP addresses that have not been tried since the message arrived. If there are
40019 none, of if they all fail, the address is bounced. In other words, it does not
40020 delay when a new message arrives, but immediately tries those expired IP
40021 addresses that haven’t been tried since the message arrived. If there is a
40022 continuous stream of messages for the dead hosts, unsetting
40023 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
40027 <indexterm role="option">
40028 <primary>dns_qualify_single</primary>
40031 <informaltable frame="all">
40032 <tgroup cols="4" colsep="0" rowsep="0">
40033 <colspec colwidth="8*" align="left"/>
40034 <colspec colwidth="5*" align="center"/>
40035 <colspec colwidth="5*" align="center"/>
40036 <colspec colwidth="6*" align="right"/>
40039 <entry><option>dns_qualify_single</option></entry>
40040 <entry>Use: <emphasis>smtp</emphasis></entry>
40041 <entry>Type: <emphasis>boolean</emphasis></entry>
40042 <entry>Default: <emphasis>true</emphasis></entry>
40048 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
40049 and the <option>gethostbyname</option> option is false,
40050 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
40051 in chapter <xref linkend="CHAPdnslookup"/> for more details.
40054 <indexterm role="option">
40055 <primary>dns_search_parents</primary>
40058 <informaltable frame="all">
40059 <tgroup cols="4" colsep="0" rowsep="0">
40060 <colspec colwidth="8*" align="left"/>
40061 <colspec colwidth="5*" align="center"/>
40062 <colspec colwidth="5*" align="center"/>
40063 <colspec colwidth="6*" align="right"/>
40066 <entry><option>dns_search_parents</option></entry>
40067 <entry>Use: <emphasis>smtp</emphasis></entry>
40068 <entry>Type: <emphasis>boolean</emphasis></entry>
40069 <entry>Default: <emphasis>false</emphasis></entry>
40075 <indexterm role="concept">
40076 <primary><option>search_parents</option></primary>
40078 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
40079 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
40080 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
40084 <indexterm role="option">
40085 <primary>fallback_hosts</primary>
40088 <informaltable frame="all">
40089 <tgroup cols="4" colsep="0" rowsep="0">
40090 <colspec colwidth="8*" align="left"/>
40091 <colspec colwidth="5*" align="center"/>
40092 <colspec colwidth="5*" align="center"/>
40093 <colspec colwidth="6*" align="right"/>
40096 <entry><option>fallback_hosts</option></entry>
40097 <entry>Use: <emphasis>smtp</emphasis></entry>
40098 <entry>Type: <emphasis>string list</emphasis></entry>
40099 <entry>Default: <emphasis>unset</emphasis></entry>
40105 <indexterm role="concept">
40106 <primary>fallback</primary>
40107 <secondary>hosts specified on transport</secondary>
40109 String expansion is not applied to this option. The argument must be a
40110 colon-separated list of host names or IP addresses, optionally also including
40111 port numbers, though the separator can be changed, as described in section
40112 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
40113 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
40114 in section <xref linkend="SECTformatonehostitem"/>.
40117 Fallback hosts can also be specified on routers, which associate them with the
40118 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
40119 <option>fallback_hosts</option> specified on the transport is used only if the address does
40120 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
40121 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
40122 However, <option>hosts_randomize</option> does apply to fallback host lists.
40125 If Exim is unable to deliver to any of the hosts for a particular address, and
40126 the errors are not permanent rejections, the address is put on a separate
40127 transport queue with its host list replaced by the fallback hosts, unless the
40128 address was routed via MX records and the current host was in the original MX
40129 list. In that situation, the fallback host list is not used.
40132 Once normal deliveries are complete, the fallback queue is delivered by
40133 re-running the same transports with the new host lists. If several failing
40134 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
40135 copy of the message is sent.
40138 The resolution of the host names on the fallback list is controlled by the
40139 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
40140 both to cases when the host list comes with the address and when it is taken
40141 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
40142 fails</quote> facility.
40145 <indexterm role="option">
40146 <primary>final_timeout</primary>
40149 <informaltable frame="all">
40150 <tgroup cols="4" colsep="0" rowsep="0">
40151 <colspec colwidth="8*" align="left"/>
40152 <colspec colwidth="5*" align="center"/>
40153 <colspec colwidth="5*" align="center"/>
40154 <colspec colwidth="6*" align="right"/>
40157 <entry><option>final_timeout</option></entry>
40158 <entry>Use: <emphasis>smtp</emphasis></entry>
40159 <entry>Type: <emphasis>time</emphasis></entry>
40160 <entry>Default: <emphasis>10m</emphasis></entry>
40166 This is the timeout that applies while waiting for the response to the final
40167 line containing just <quote>.</quote> that terminates a message. Its value must not be
40171 <indexterm role="option">
40172 <primary>gethostbyname</primary>
40175 <informaltable frame="all">
40176 <tgroup cols="4" colsep="0" rowsep="0">
40177 <colspec colwidth="8*" align="left"/>
40178 <colspec colwidth="5*" align="center"/>
40179 <colspec colwidth="5*" align="center"/>
40180 <colspec colwidth="6*" align="right"/>
40183 <entry><option>gethostbyname</option></entry>
40184 <entry>Use: <emphasis>smtp</emphasis></entry>
40185 <entry>Type: <emphasis>boolean</emphasis></entry>
40186 <entry>Default: <emphasis>false</emphasis></entry>
40192 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
40193 being used, names are looked up using <function>gethostbyname()</function>
40194 (or <function>getipnodebyname()</function> when available)
40195 instead of using the DNS. Of course, that function may in fact use the DNS, but
40196 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
40199 <indexterm role="option">
40200 <primary>helo_data</primary>
40203 <informaltable frame="all">
40204 <tgroup cols="4" colsep="0" rowsep="0">
40205 <colspec colwidth="8*" align="left"/>
40206 <colspec colwidth="5*" align="center"/>
40207 <colspec colwidth="5*" align="center"/>
40208 <colspec colwidth="6*" align="right"/>
40211 <entry><option>helo_data</option></entry>
40212 <entry>Use: <emphasis>smtp</emphasis></entry>
40213 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40214 <entry>Default: <emphasis><literal>$primary_hostname</literal></emphasis></entry>
40220 <indexterm role="concept">
40221 <primary>HELO argument</primary>
40222 <secondary>setting</secondary>
40224 <indexterm role="concept">
40225 <primary>EHLO argument</primary>
40226 <secondary>setting</secondary>
40228 The value of this option is expanded, and used as the argument for the EHLO or
40229 HELO command that starts the outgoing SMTP session. The variables <varname>$host</varname> and
40230 <varname>$host_address</varname> are set to the identity of the remote host, and can be used to
40231 generate different values for different servers.
40234 <indexterm role="option">
40235 <primary>hosts</primary>
40238 <informaltable frame="all">
40239 <tgroup cols="4" colsep="0" rowsep="0">
40240 <colspec colwidth="8*" align="left"/>
40241 <colspec colwidth="5*" align="center"/>
40242 <colspec colwidth="5*" align="center"/>
40243 <colspec colwidth="6*" align="right"/>
40246 <entry><option>hosts</option></entry>
40247 <entry>Use: <emphasis>smtp</emphasis></entry>
40248 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
40249 <entry>Default: <emphasis>unset</emphasis></entry>
40255 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
40256 finds the hosts by looking up the address domain in the DNS, or by
40257 <command>manualroute</command>, which has lists of hosts in its configuration. However,
40258 email addresses can be passed to the <command>smtp</command> transport by any router, and not
40259 all of them can provide an associated list of hosts.
40262 The <option>hosts</option> option specifies a list of hosts to be used if the address being
40263 processed does not have any hosts associated with it. The hosts specified by
40264 <option>hosts</option> are also used, whether or not the address has its own hosts, if
40265 <option>hosts_override</option> is set.
40268 The string is first expanded, before being interpreted as a colon-separated
40269 list of host names or IP addresses, possibly including port numbers. The
40270 separator may be changed to something other than colon, as described in section
40271 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
40272 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
40273 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
40274 of the <command>manualroute</command> router is not available here.
40277 If the expansion fails, delivery is deferred. Unless the failure was caused by
40278 the inability to complete a lookup, the error is logged to the panic log as
40279 well as the main log. Host names are looked up either by searching directly for
40280 address records in the DNS or by calling <function>gethostbyname()</function> (or
40281 <function>getipnodebyname()</function> when available), depending on the setting of the
40282 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
40283 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
40287 During delivery, the hosts are tried in order, subject to their retry status,
40288 unless <option>hosts_randomize</option> is set.
40291 <indexterm role="option">
40292 <primary>hosts_avoid_esmtp</primary>
40295 <informaltable frame="all">
40296 <tgroup cols="4" colsep="0" rowsep="0">
40297 <colspec colwidth="8*" align="left"/>
40298 <colspec colwidth="5*" align="center"/>
40299 <colspec colwidth="5*" align="center"/>
40300 <colspec colwidth="6*" align="right"/>
40303 <entry><option>hosts_avoid_esmtp</option></entry>
40304 <entry>Use: <emphasis>smtp</emphasis></entry>
40305 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
40306 <entry>Default: <emphasis>unset</emphasis></entry>
40312 <indexterm role="concept">
40313 <primary>ESMTP</primary>
40314 <secondary>avoiding use of</secondary>
40316 <indexterm role="concept">
40317 <primary>HELO</primary>
40318 <secondary>forcing use of</secondary>
40320 <indexterm role="concept">
40321 <primary>EHLO</primary>
40322 <secondary>avoiding use of</secondary>
40324 <indexterm role="concept">
40325 <primary>PIPELINING</primary>
40326 <secondary>avoiding the use of</secondary>
40328 This option is for use with broken hosts that announce ESMTP facilities (for
40329 example, PIPELINING) and then fail to implement them properly. When a host
40330 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
40331 start of the SMTP session. This means that it cannot use any of the ESMTP
40332 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
40335 <indexterm role="option">
40336 <primary>hosts_avoid_tls</primary>
40339 <informaltable frame="all">
40340 <tgroup cols="4" colsep="0" rowsep="0">
40341 <colspec colwidth="8*" align="left"/>
40342 <colspec colwidth="5*" align="center"/>
40343 <colspec colwidth="5*" align="center"/>
40344 <colspec colwidth="6*" align="right"/>
40347 <entry><option>hosts_avoid_tls</option></entry>
40348 <entry>Use: <emphasis>smtp</emphasis></entry>
40349 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
40350 <entry>Default: <emphasis>unset</emphasis></entry>
40356 <indexterm role="concept">
40357 <primary>TLS</primary>
40358 <secondary>avoiding for certain hosts</secondary>
40360 Exim will not try to start a TLS session when delivering to any host that
40361 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
40364 <indexterm role="option">
40365 <primary>hosts_max_try</primary>
40368 <informaltable frame="all">
40369 <tgroup cols="4" colsep="0" rowsep="0">
40370 <colspec colwidth="8*" align="left"/>
40371 <colspec colwidth="5*" align="center"/>
40372 <colspec colwidth="5*" align="center"/>
40373 <colspec colwidth="6*" align="right"/>
40376 <entry><option>hosts_max_try</option></entry>
40377 <entry>Use: <emphasis>smtp</emphasis></entry>
40378 <entry>Type: <emphasis>integer</emphasis></entry>
40379 <entry>Default: <emphasis>5</emphasis></entry>
40385 <indexterm role="concept">
40386 <primary>host</primary>
40387 <secondary>maximum number to try</secondary>
40389 <indexterm role="concept">
40390 <primary>limit</primary>
40391 <secondary>number of hosts tried</secondary>
40393 <indexterm role="concept">
40394 <primary>limit</primary>
40395 <secondary>number of MX tried</secondary>
40397 <indexterm role="concept">
40398 <primary>MX record</primary>
40399 <secondary>maximum tried</secondary>
40401 This option limits the number of IP addresses that are tried for any one
40402 delivery in cases where there are temporary delivery errors. Section
40403 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
40406 <indexterm role="option">
40407 <primary>hosts_max_try_hardlimit</primary>
40410 <informaltable frame="all">
40411 <tgroup cols="4" colsep="0" rowsep="0">
40412 <colspec colwidth="8*" align="left"/>
40413 <colspec colwidth="5*" align="center"/>
40414 <colspec colwidth="5*" align="center"/>
40415 <colspec colwidth="6*" align="right"/>
40418 <entry><option>hosts_max_try_hardlimit</option></entry>
40419 <entry>Use: <emphasis>smtp</emphasis></entry>
40420 <entry>Type: <emphasis>integer</emphasis></entry>
40421 <entry>Default: <emphasis>50</emphasis></entry>
40427 This is an additional check on the maximum number of IP addresses that Exim
40428 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
40432 <indexterm role="option">
40433 <primary>hosts_nopass_tls</primary>
40436 <informaltable frame="all">
40437 <tgroup cols="4" colsep="0" rowsep="0">
40438 <colspec colwidth="8*" align="left"/>
40439 <colspec colwidth="5*" align="center"/>
40440 <colspec colwidth="5*" align="center"/>
40441 <colspec colwidth="6*" align="right"/>
40444 <entry><option>hosts_nopass_tls</option></entry>
40445 <entry>Use: <emphasis>smtp</emphasis></entry>
40446 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
40447 <entry>Default: <emphasis>unset</emphasis></entry>
40453 <indexterm role="concept">
40454 <primary>TLS</primary>
40455 <secondary>passing connection</secondary>
40457 <indexterm role="concept">
40458 <primary>multiple SMTP deliveries</primary>
40460 <indexterm role="concept">
40461 <primary>TLS</primary>
40462 <secondary>multiple message deliveries</secondary>
40464 For any host that matches this list, a connection on which a TLS session has
40465 been started will not be passed to a new delivery process for sending another
40466 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
40467 explanation of when this might be needed.
40470 <indexterm role="option">
40471 <primary>hosts_override</primary>
40474 <informaltable frame="all">
40475 <tgroup cols="4" colsep="0" rowsep="0">
40476 <colspec colwidth="8*" align="left"/>
40477 <colspec colwidth="5*" align="center"/>
40478 <colspec colwidth="5*" align="center"/>
40479 <colspec colwidth="6*" align="right"/>
40482 <entry><option>hosts_override</option></entry>
40483 <entry>Use: <emphasis>smtp</emphasis></entry>
40484 <entry>Type: <emphasis>boolean</emphasis></entry>
40485 <entry>Default: <emphasis>false</emphasis></entry>
40491 If this option is set and the <option>hosts</option> option is also set, any hosts that are
40492 attached to the address are ignored, and instead the hosts specified by the
40493 <option>hosts</option> option are always used. This option does not apply to
40494 <option>fallback_hosts</option>.
40497 <indexterm role="option">
40498 <primary>hosts_randomize</primary>
40501 <informaltable frame="all">
40502 <tgroup cols="4" colsep="0" rowsep="0">
40503 <colspec colwidth="8*" align="left"/>
40504 <colspec colwidth="5*" align="center"/>
40505 <colspec colwidth="5*" align="center"/>
40506 <colspec colwidth="6*" align="right"/>
40509 <entry><option>hosts_randomize</option></entry>
40510 <entry>Use: <emphasis>smtp</emphasis></entry>
40511 <entry>Type: <emphasis>boolean</emphasis></entry>
40512 <entry>Default: <emphasis>false</emphasis></entry>
40518 <indexterm role="concept">
40519 <primary>randomized host list</primary>
40521 <indexterm role="concept">
40522 <primary>host</primary>
40523 <secondary>list of; randomized</secondary>
40525 <indexterm role="concept">
40526 <primary>fallback</primary>
40527 <secondary>randomized hosts</secondary>
40529 If this option is set, and either the list of hosts is taken from the
40530 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
40531 were not obtained from MX records (this includes fallback hosts from the
40532 router), and were not randomizied by the router, the order of trying the hosts
40533 is randomized each time the transport runs. Randomizing the order of a host
40534 list can be used to do crude load sharing.
40537 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
40538 order is separately randomized. This makes it possible to set up MX-like
40539 behaviour. The boundaries between groups are indicated by an item that is just
40540 <literal>+</literal> in the host list. For example:
40542 <literallayout class="monospaced">
40543 hosts = host1:host2:host3:+:host4:host5
40546 The order of the first three hosts and the order of the last two hosts is
40547 randomized for each use, but the first three always end up before the last two.
40548 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
40551 <indexterm role="option">
40552 <primary>hosts_require_auth</primary>
40555 <informaltable frame="all">
40556 <tgroup cols="4" colsep="0" rowsep="0">
40557 <colspec colwidth="8*" align="left"/>
40558 <colspec colwidth="5*" align="center"/>
40559 <colspec colwidth="5*" align="center"/>
40560 <colspec colwidth="6*" align="right"/>
40563 <entry><option>hosts_require_auth</option></entry>
40564 <entry>Use: <emphasis>smtp</emphasis></entry>
40565 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
40566 <entry>Default: <emphasis>unset</emphasis></entry>
40572 <indexterm role="concept">
40573 <primary>authentication</primary>
40574 <secondary>required by client</secondary>
40576 This option provides a list of servers for which authentication must succeed
40577 before Exim will try to transfer a message. If authentication fails for
40578 servers which are not in this list, Exim tries to send unauthenticated. If
40579 authentication fails for one of these servers, delivery is deferred. This
40580 temporary error is detectable in the retry rules, so it can be turned into a
40581 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
40582 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
40585 <indexterm role="option">
40586 <primary>hosts_require_tls</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>hosts_require_tls</option></entry>
40598 <entry>Use: <emphasis>smtp</emphasis></entry>
40599 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
40600 <entry>Default: <emphasis>unset</emphasis></entry>
40606 <indexterm role="concept">
40607 <primary>TLS</primary>
40608 <secondary>requiring for certain servers</secondary>
40610 Exim will insist on using a TLS session when delivering to any host that
40611 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
40612 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
40613 incoming messages, use an appropriate ACL.
40616 <indexterm role="option">
40617 <primary>hosts_try_auth</primary>
40620 <informaltable frame="all">
40621 <tgroup cols="4" colsep="0" rowsep="0">
40622 <colspec colwidth="8*" align="left"/>
40623 <colspec colwidth="5*" align="center"/>
40624 <colspec colwidth="5*" align="center"/>
40625 <colspec colwidth="6*" align="right"/>
40628 <entry><option>hosts_try_auth</option></entry>
40629 <entry>Use: <emphasis>smtp</emphasis></entry>
40630 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
40631 <entry>Default: <emphasis>unset</emphasis></entry>
40637 <indexterm role="concept">
40638 <primary>authentication</primary>
40639 <secondary>optional in client</secondary>
40641 This option provides a list of servers to which, provided they announce
40642 authentication support, Exim will attempt to authenticate as a client when it
40643 connects. If authentication fails, Exim will try to transfer the message
40644 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
40645 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
40648 <indexterm role="option">
40649 <primary>interface</primary>
40652 <informaltable frame="all">
40653 <tgroup cols="4" colsep="0" rowsep="0">
40654 <colspec colwidth="8*" align="left"/>
40655 <colspec colwidth="5*" align="center"/>
40656 <colspec colwidth="5*" align="center"/>
40657 <colspec colwidth="6*" align="right"/>
40660 <entry><option>interface</option></entry>
40661 <entry>Use: <emphasis>smtp</emphasis></entry>
40662 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
40663 <entry>Default: <emphasis>unset</emphasis></entry>
40669 <indexterm role="concept">
40670 <primary>bind IP address</primary>
40672 <indexterm role="concept">
40673 <primary>IP address</primary>
40674 <secondary>binding</secondary>
40676 <indexterm role="concept">
40677 <primary><varname>$host</varname></primary>
40679 <indexterm role="concept">
40680 <primary><varname>$host_address</varname></primary>
40682 This option specifies which interface to bind to when making an outgoing SMTP
40683 call. The variables <varname>$host</varname> and <varname>$host_address</varname> refer to the host to which a
40684 connection is about to be made during the expansion of the string. Forced
40685 expansion failure, or an empty string result causes the option to be ignored.
40686 Otherwise, after expansion,
40687 the string must be a list of IP addresses, colon-separated by default, but the
40688 separator can be changed in the usual way.
40691 <literallayout class="monospaced">
40692 interface = <; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
40695 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
40696 connection. If none of them are the correct type, the option is ignored. If
40697 <option>interface</option> is not set, or is ignored, the system’s IP functions choose which
40698 interface to use if the host has more than one.
40701 <indexterm role="option">
40702 <primary>keepalive</primary>
40705 <informaltable frame="all">
40706 <tgroup cols="4" colsep="0" rowsep="0">
40707 <colspec colwidth="8*" align="left"/>
40708 <colspec colwidth="5*" align="center"/>
40709 <colspec colwidth="5*" align="center"/>
40710 <colspec colwidth="6*" align="right"/>
40713 <entry><option>keepalive</option></entry>
40714 <entry>Use: <emphasis>smtp</emphasis></entry>
40715 <entry>Type: <emphasis>boolean</emphasis></entry>
40716 <entry>Default: <emphasis>true</emphasis></entry>
40722 <indexterm role="concept">
40723 <primary>keepalive</primary>
40724 <secondary>on outgoing connection</secondary>
40726 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
40727 connections. When set, it causes the kernel to probe idle connections
40728 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
40729 of the connection should send a acknowledgement if the connection is still okay
40730 or a reset if the connection has been aborted. The reason for doing this is
40731 that it has the beneficial effect of freeing up certain types of connection
40732 that can get stuck when the remote host is disconnected without tidying up the
40733 TCP/IP call properly. The keepalive mechanism takes several hours to detect
40737 <indexterm role="option">
40738 <primary>lmtp_ignore_quota</primary>
40741 <informaltable frame="all">
40742 <tgroup cols="4" colsep="0" rowsep="0">
40743 <colspec colwidth="8*" align="left"/>
40744 <colspec colwidth="5*" align="center"/>
40745 <colspec colwidth="5*" align="center"/>
40746 <colspec colwidth="6*" align="right"/>
40749 <entry><option>lmtp_ignore_quota</option></entry>
40750 <entry>Use: <emphasis>smtp</emphasis></entry>
40751 <entry>Type: <emphasis>boolean</emphasis></entry>
40752 <entry>Default: <emphasis>false</emphasis></entry>
40758 <indexterm role="concept">
40759 <primary>LMTP</primary>
40760 <secondary>ignoring quota errors</secondary>
40762 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
40763 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
40764 has advertised support for IGNOREQUOTA in its response to the LHLO command.
40767 <indexterm role="option">
40768 <primary>max_rcpt</primary>
40771 <informaltable frame="all">
40772 <tgroup cols="4" colsep="0" rowsep="0">
40773 <colspec colwidth="8*" align="left"/>
40774 <colspec colwidth="5*" align="center"/>
40775 <colspec colwidth="5*" align="center"/>
40776 <colspec colwidth="6*" align="right"/>
40779 <entry><option>max_rcpt</option></entry>
40780 <entry>Use: <emphasis>smtp</emphasis></entry>
40781 <entry>Type: <emphasis>integer</emphasis></entry>
40782 <entry>Default: <emphasis>100</emphasis></entry>
40788 <indexterm role="concept">
40789 <primary>RCPT</primary>
40790 <secondary>maximum number of outgoing</secondary>
40792 This option limits the number of RCPT commands that are sent in a single
40793 SMTP message transaction. Each set of addresses is treated independently, and
40794 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
40798 <indexterm role="option">
40799 <primary>multi_domain</primary>
40802 <informaltable frame="all">
40803 <tgroup cols="4" colsep="0" rowsep="0">
40804 <colspec colwidth="8*" align="left"/>
40805 <colspec colwidth="5*" align="center"/>
40806 <colspec colwidth="5*" align="center"/>
40807 <colspec colwidth="6*" align="right"/>
40810 <entry><option>multi_domain</option></entry>
40811 <entry>Use: <emphasis>smtp</emphasis></entry>
40812 <entry>Type: <emphasis>boolean</emphasis></entry>
40813 <entry>Default: <emphasis>true</emphasis></entry>
40819 <indexterm role="concept">
40820 <primary><varname>$domain</varname></primary>
40822 When this option is set, the <command>smtp</command> transport can handle a number of
40823 addresses containing a mixture of different domains provided they all resolve
40824 to the same list of hosts. Turning the option off restricts the transport to
40825 handling only one domain at a time. This is useful if you want to use
40826 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
40827 is a single domain involved in a remote delivery.
40830 <indexterm role="option">
40831 <primary>port</primary>
40834 <informaltable frame="all">
40835 <tgroup cols="4" colsep="0" rowsep="0">
40836 <colspec colwidth="8*" align="left"/>
40837 <colspec colwidth="5*" align="center"/>
40838 <colspec colwidth="5*" align="center"/>
40839 <colspec colwidth="6*" align="right"/>
40842 <entry><option>port</option></entry>
40843 <entry>Use: <emphasis>smtp</emphasis></entry>
40844 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40845 <entry>Default: <emphasis>see below</emphasis></entry>
40851 <indexterm role="concept">
40852 <primary>port</primary>
40853 <secondary>sending TCP/IP</secondary>
40855 <indexterm role="concept">
40856 <primary>TCP/IP</primary>
40857 <secondary>setting outgoing port</secondary>
40859 This option specifies the TCP/IP port on the server to which Exim connects. If
40860 it begins with a digit it is taken as a port number; otherwise it is looked up
40861 using <function>getservbyname()</function>. The default value is normally <quote>smtp</quote>, but if
40862 <option>protocol</option> is set to <quote>lmtp</quote>, the default is <quote>lmtp</quote>.
40863 If the expansion fails, or if a port number cannot be found, delivery is
40867 <indexterm role="option">
40868 <primary>protocol</primary>
40871 <informaltable frame="all">
40872 <tgroup cols="4" colsep="0" rowsep="0">
40873 <colspec colwidth="8*" align="left"/>
40874 <colspec colwidth="5*" align="center"/>
40875 <colspec colwidth="5*" align="center"/>
40876 <colspec colwidth="6*" align="right"/>
40879 <entry><option>protocol</option></entry>
40880 <entry>Use: <emphasis>smtp</emphasis></entry>
40881 <entry>Type: <emphasis>string</emphasis></entry>
40882 <entry>Default: <emphasis>smtp</emphasis></entry>
40888 <indexterm role="concept">
40889 <primary>LMTP</primary>
40890 <secondary>over TCP/IP</secondary>
40892 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
40893 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
40894 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
40895 deliveries into closed message stores. Exim also has support for running LMTP
40896 over a pipe to a local process – see chapter <xref linkend="CHAPLMTP"/>.
40899 <indexterm role="option">
40900 <primary>retry_include_ip_address</primary>
40903 <informaltable frame="all">
40904 <tgroup cols="4" colsep="0" rowsep="0">
40905 <colspec colwidth="8*" align="left"/>
40906 <colspec colwidth="5*" align="center"/>
40907 <colspec colwidth="5*" align="center"/>
40908 <colspec colwidth="6*" align="right"/>
40911 <entry><option>retry_include_ip_address</option></entry>
40912 <entry>Use: <emphasis>smtp</emphasis></entry>
40913 <entry>Type: <emphasis>boolean</emphasis></entry>
40914 <entry>Default: <emphasis>true</emphasis></entry>
40920 Exim normally includes both the host name and the IP address in the key it
40921 constructs for indexing retry data after a temporary delivery failure. This
40922 means that when one of several IP addresses for a host is failing, it gets
40923 tried periodically (controlled by the retry rules), but use of the other IP
40924 addresses is not affected.
40927 However, in some dialup environments hosts are assigned a different IP address
40928 each time they connect. In this situation the use of the IP address as part of
40929 the retry key leads to undesirable behaviour. Setting this option false causes
40930 Exim to use only the host name. This should normally be done on a separate
40931 instance of the <command>smtp</command> transport, set up specially to handle the dialup
40935 <indexterm role="option">
40936 <primary>serialize_hosts</primary>
40939 <informaltable frame="all">
40940 <tgroup cols="4" colsep="0" rowsep="0">
40941 <colspec colwidth="8*" align="left"/>
40942 <colspec colwidth="5*" align="center"/>
40943 <colspec colwidth="5*" align="center"/>
40944 <colspec colwidth="6*" align="right"/>
40947 <entry><option>serialize_hosts</option></entry>
40948 <entry>Use: <emphasis>smtp</emphasis></entry>
40949 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
40950 <entry>Default: <emphasis>unset</emphasis></entry>
40956 <indexterm role="concept">
40957 <primary>serializing connections</primary>
40959 <indexterm role="concept">
40960 <primary>host</primary>
40961 <secondary>serializing connections</secondary>
40963 Because Exim operates in a distributed manner, if several messages for the same
40964 host arrive at around the same time, more than one simultaneous connection to
40965 the remote host can occur. This is not usually a problem except when there is a
40966 slow link between the hosts. In that situation it may be helpful to restrict
40967 Exim to one connection at a time. This can be done by setting
40968 <option>serialize_hosts</option> to match the relevant hosts.
40971 <indexterm role="concept">
40972 <primary>hints database</primary>
40973 <secondary>serializing deliveries to a host</secondary>
40975 Exim implements serialization by means of a hints database in which a record is
40976 written whenever a process connects to one of the restricted hosts. The record
40977 is deleted when the connection is completed. Obviously there is scope for
40978 records to get left lying around if there is a system or program crash. To
40979 guard against this, Exim ignores any records that are more than six hours old.
40982 If you set up this kind of serialization, you should also arrange to delete the
40983 relevant hints database whenever your system reboots. The names of the files
40984 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
40985 may be one or two files, depending on the type of DBM in use. The same files
40986 are used for ETRN serialization.
40989 <indexterm role="option">
40990 <primary>size_addition</primary>
40993 <informaltable frame="all">
40994 <tgroup cols="4" colsep="0" rowsep="0">
40995 <colspec colwidth="8*" align="left"/>
40996 <colspec colwidth="5*" align="center"/>
40997 <colspec colwidth="5*" align="center"/>
40998 <colspec colwidth="6*" align="right"/>
41001 <entry><option>size_addition</option></entry>
41002 <entry>Use: <emphasis>smtp</emphasis></entry>
41003 <entry>Type: <emphasis>integer</emphasis></entry>
41004 <entry>Default: <emphasis>1024</emphasis></entry>
41010 <indexterm role="concept">
41011 <primary>SMTP</primary>
41012 <secondary>SIZE</secondary>
41014 <indexterm role="concept">
41015 <primary>message</primary>
41016 <secondary>size issue for transport filter</secondary>
41018 <indexterm role="concept">
41019 <primary>size</primary>
41020 <secondary>of message</secondary>
41022 <indexterm role="concept">
41023 <primary>transport</primary>
41024 <secondary>filter</secondary>
41026 <indexterm role="concept">
41027 <primary>filter</primary>
41028 <secondary>transport filter</secondary>
41030 If a remote SMTP server indicates that it supports the SIZE option of the
41031 MAIL command, Exim uses this to pass over the message size at the start of
41032 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
41033 sends, to allow for headers and other text that may be added during delivery by
41034 configuration options or in a transport filter. It may be necessary to increase
41035 this if a lot of text is added to messages.
41038 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
41039 the use of the SIZE option altogether.
41042 <indexterm role="option">
41043 <primary>tls_certificate</primary>
41046 <informaltable frame="all">
41047 <tgroup cols="4" colsep="0" rowsep="0">
41048 <colspec colwidth="8*" align="left"/>
41049 <colspec colwidth="5*" align="center"/>
41050 <colspec colwidth="5*" align="center"/>
41051 <colspec colwidth="6*" align="right"/>
41054 <entry><option>tls_certificate</option></entry>
41055 <entry>Use: <emphasis>smtp</emphasis></entry>
41056 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
41057 <entry>Default: <emphasis>unset</emphasis></entry>
41063 <indexterm role="concept">
41064 <primary>TLS client certificate</primary>
41065 <secondary>location of</secondary>
41067 <indexterm role="concept">
41068 <primary>certificate for client</primary>
41069 <secondary>location of</secondary>
41071 <indexterm role="concept">
41072 <primary><varname>$host</varname></primary>
41074 <indexterm role="concept">
41075 <primary><varname>$host_address</varname></primary>
41077 The value of this option must be the absolute path to a file which contains the
41078 client’s certificate, for possible use when sending a message over an encrypted
41079 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
41080 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
41084 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
41085 certificate when sending messages as a client. The global option of the same
41086 name specifies the certificate for Exim as a server; it is not automatically
41087 assumed that the same certificate should be used when Exim is operating as a
41091 <indexterm role="option">
41092 <primary>tls_crl</primary>
41095 <informaltable frame="all">
41096 <tgroup cols="4" colsep="0" rowsep="0">
41097 <colspec colwidth="8*" align="left"/>
41098 <colspec colwidth="5*" align="center"/>
41099 <colspec colwidth="5*" align="center"/>
41100 <colspec colwidth="6*" align="right"/>
41103 <entry><option>tls_crl</option></entry>
41104 <entry>Use: <emphasis>smtp</emphasis></entry>
41105 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
41106 <entry>Default: <emphasis>unset</emphasis></entry>
41112 <indexterm role="concept">
41113 <primary>TLS</primary>
41114 <secondary>client certificate revocation list</secondary>
41116 <indexterm role="concept">
41117 <primary>certificate</primary>
41118 <secondary>revocation list for client</secondary>
41120 This option specifies a certificate revocation list. The expanded value must
41121 be the name of a file that contains a CRL in PEM format.
41124 <indexterm role="option">
41125 <primary>tls_privatekey</primary>
41128 <informaltable frame="all">
41129 <tgroup cols="4" colsep="0" rowsep="0">
41130 <colspec colwidth="8*" align="left"/>
41131 <colspec colwidth="5*" align="center"/>
41132 <colspec colwidth="5*" align="center"/>
41133 <colspec colwidth="6*" align="right"/>
41136 <entry><option>tls_privatekey</option></entry>
41137 <entry>Use: <emphasis>smtp</emphasis></entry>
41138 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
41139 <entry>Default: <emphasis>unset</emphasis></entry>
41145 <indexterm role="concept">
41146 <primary>TLS client private key</primary>
41147 <secondary>location of</secondary>
41149 <indexterm role="concept">
41150 <primary><varname>$host</varname></primary>
41152 <indexterm role="concept">
41153 <primary><varname>$host_address</varname></primary>
41156 <para revisionflag="changed">
41157 The value of this option must be the absolute path to a file which contains the
41158 client’s private key. This is used when sending a message over an encrypted
41159 connection using a client certificate. The values of <varname>$host</varname> and
41160 <varname>$host_address</varname> are set to the name and address of the server during the
41161 expansion. If this option is unset, or the expansion is forced to fail, or the
41162 result is an empty string, the private key is assumed to be in the same file as
41163 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
41166 <indexterm role="option">
41167 <primary>tls_require_ciphers</primary>
41170 <informaltable frame="all">
41171 <tgroup cols="4" colsep="0" rowsep="0">
41172 <colspec colwidth="8*" align="left"/>
41173 <colspec colwidth="5*" align="center"/>
41174 <colspec colwidth="5*" align="center"/>
41175 <colspec colwidth="6*" align="right"/>
41178 <entry><option>tls_require_ciphers</option></entry>
41179 <entry>Use: <emphasis>smtp</emphasis></entry>
41180 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
41181 <entry>Default: <emphasis>unset</emphasis></entry>
41187 <indexterm role="concept">
41188 <primary>TLS</primary>
41189 <secondary>requiring specific ciphers</secondary>
41191 <indexterm role="concept">
41192 <primary>cipher</primary>
41193 <secondary>requiring specific</secondary>
41195 <indexterm role="concept">
41196 <primary><varname>$host</varname></primary>
41198 <indexterm role="concept">
41199 <primary><varname>$host_address</varname></primary>
41201 The value of this option must be a list of permitted cipher suites, for use
41202 when setting up an outgoing encrypted connection. (There is a global option of
41203 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
41204 <varname>$host_address</varname> are set to the name and address of the server during the
41205 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
41206 is used in different ways by OpenSSL and GnuTLS (see sections
41207 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
41208 ciphers is a preference order.
41211 <indexterm role="option">
41212 <primary>tls_tempfail_tryclear</primary>
41215 <informaltable frame="all">
41216 <tgroup cols="4" colsep="0" rowsep="0">
41217 <colspec colwidth="8*" align="left"/>
41218 <colspec colwidth="5*" align="center"/>
41219 <colspec colwidth="5*" align="center"/>
41220 <colspec colwidth="6*" align="right"/>
41223 <entry><option>tls_tempfail_tryclear</option></entry>
41224 <entry>Use: <emphasis>smtp</emphasis></entry>
41225 <entry>Type: <emphasis>boolean</emphasis></entry>
41226 <entry>Default: <emphasis>true</emphasis></entry>
41232 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
41233 setting up a TLS session, this option determines whether or not Exim should try
41234 to deliver the message unencrypted. If it is set false, delivery to the
41235 current host is deferred; if there are other hosts, they are tried. If this
41236 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
41237 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
41238 TLS negotiation fails, Exim closes the current connection (because it is in an
41239 unknown state), opens a new one to the same host, and then tries the delivery
41243 <indexterm role="option">
41244 <primary>tls_verify_certificates</primary>
41247 <informaltable frame="all">
41248 <tgroup cols="4" colsep="0" rowsep="0">
41249 <colspec colwidth="8*" align="left"/>
41250 <colspec colwidth="5*" align="center"/>
41251 <colspec colwidth="5*" align="center"/>
41252 <colspec colwidth="6*" align="right"/>
41255 <entry><option>tls_verify_certificates</option></entry>
41256 <entry>Use: <emphasis>smtp</emphasis></entry>
41257 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
41258 <entry>Default: <emphasis>unset</emphasis></entry>
41264 <indexterm role="concept">
41265 <primary>TLS</primary>
41266 <secondary>server certificate verification</secondary>
41268 <indexterm role="concept">
41269 <primary>certificate</primary>
41270 <secondary>verification of server</secondary>
41272 <indexterm role="concept">
41273 <primary><varname>$host</varname></primary>
41275 <indexterm role="concept">
41276 <primary><varname>$host_address</varname></primary>
41278 The value of this option must be the absolute path to a file containing
41279 permitted server certificates, for use when setting up an encrypted connection.
41280 Alternatively, if you are using OpenSSL, you can set
41281 <option>tls_verify_certificates</option> to the name of a directory containing certificate
41282 files. This does not work with GnuTLS; the option must be set to the name of a
41283 single file if you are using GnuTLS. The values of <varname>$host</varname> and
41284 <varname>$host_address</varname> are set to the name and address of the server during the
41285 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
41288 <section id="SECTvalhosmax">
41289 <title>How the limits for the number of hosts to try are used</title>
41291 <indexterm role="concept">
41292 <primary>host</primary>
41293 <secondary>maximum number to try</secondary>
41295 <indexterm role="concept">
41296 <primary>limit</primary>
41297 <secondary>hosts; maximum number tried</secondary>
41299 There are two options that are concerned with the number of hosts that are
41300 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
41301 <option>hosts_max_try_hardlimit</option>.
41304 The <option>hosts_max_try</option> option limits the number of hosts that are tried
41305 for a single delivery. However, despite the term <quote>host</quote> in its name, the
41306 option actually applies to each IP address independently. In other words, a
41307 multihomed host is treated as several independent hosts, just as it is for
41311 Many of the larger ISPs have multiple MX records which often point to
41312 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
41313 created as a result of routing one of these domains.
41316 Trying every single IP address on such a long list does not seem sensible; if
41317 several at the top of the list fail, it is reasonable to assume there is some
41318 problem that is likely to affect all of them. Roughly speaking, the value of
41319 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
41320 delivery. However, the logic cannot be quite that simple.
41323 Firstly, IP addresses that are skipped because their retry times have not
41324 arrived do not count, and in addition, addresses that are past their retry
41325 limits are also not counted, even when they are tried. This means that when
41326 some IP addresses are past their retry limits, more than the value of
41327 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
41328 that all IP addresses are considered before timing out an email address (but
41329 see below for an exception).
41332 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
41333 list to see if there is a subsequent host with a different (higher valued) MX.
41334 If there is, that host is considered next, and the current IP address is used
41335 but not counted. This behaviour helps in the case of a domain with a retry rule
41336 that hardly ever delays any hosts, as is now explained:
41339 Consider the case of a long list of hosts with one MX value, and a few with a
41340 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
41341 hosts at the top of the list are tried at first. With the default retry rule,
41342 which specifies increasing retry times, the higher MX hosts are eventually
41343 tried when those at the top of the list are skipped because they have not
41344 reached their retry times.
41347 However, it is common practice to put a fixed short retry time on domains for
41348 large ISPs, on the grounds that their servers are rarely down for very long.
41349 Unfortunately, these are exactly the domains that tend to resolve to long lists
41350 of hosts. The short retry time means that the lowest MX hosts are tried every
41351 time. The attempts may be in a different order because of random sorting, but
41352 without the special MX check, the higher MX hosts would never be tried until
41353 all the lower MX hosts had timed out (which might be several days), because
41354 there are always some lower MX hosts that have reached their retry times. With
41355 the special check, Exim considers at least one IP address from each MX value at
41356 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
41360 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
41361 particular, Exim normally eventually tries all the IP addresses before timing
41362 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
41363 reasonable thing to do. Recently, however, some lunatic DNS configurations have
41364 been set up with hundreds of IP addresses for some domains. It can
41365 take a very long time indeed for an address to time out in these cases.
41368 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
41369 Exim never tries more than this number of IP addresses; if it hits this limit
41370 and they are all timed out, the email address is bounced, even though not all
41371 possible IP addresses have been tried.
41372 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
41373 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
41378 <chapter id="CHAPrewrite">
41379 <title>Address rewriting</title>
41381 <indexterm role="concept" id="IIDaddrew" class="startofrange">
41382 <primary>rewriting</primary>
41383 <secondary>addresses</secondary>
41385 There are some circumstances in which Exim automatically rewrites domains in
41386 addresses. The two most common are when an address is given without a domain
41387 (referred to as an <quote>unqualified address</quote>) or when an address contains an
41388 abbreviated domain that is expanded by DNS lookup.
41391 Unqualified envelope addresses are accepted only for locally submitted
41392 messages, or for messages that are received from hosts matching
41393 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
41394 appropriate. Unqualified addresses in header lines are qualified if they are in
41395 locally submitted messages, or messages from hosts that are permitted to send
41396 unqualified envelope addresses. Otherwise, unqualified addresses in header
41397 lines are neither qualified nor rewritten.
41400 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
41401 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
41402 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
41403 do this. The new RFCs do not contain this suggestion.
41406 <title>Explicitly configured address rewriting</title>
41408 This chapter describes the rewriting rules that can be used in the
41409 main rewrite section of the configuration file, and also in the generic
41410 <option>headers_rewrite</option> option that can be set on any transport.
41413 Some people believe that configured address rewriting is a Mortal Sin.
41414 Others believe that life is not possible without it. Exim provides the
41415 facility; you do not have to use it.
41418 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
41419 configuration file are applied to addresses in incoming messages, both envelope
41420 addresses and addresses in header lines. Each rule specifies the types of
41421 address to which it applies.
41424 Rewriting of addresses in header lines applies only to those headers that
41425 were received with the message, and, in the case of transport rewriting, those
41426 that were added by a system filter. That is, it applies only to those headers
41427 that are common to all copies of the message. Header lines that are added by
41428 individual routers or transports (and which are therefore specific to
41429 individual recipient addresses) are not rewritten.
41432 In general, rewriting addresses from your own system or domain has some
41433 legitimacy. Rewriting other addresses should be done only with great care and
41434 in special circumstances. The author of Exim believes that rewriting should be
41435 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
41436 Although it can sometimes be used as a routing tool, this is very strongly
41440 There are two commonly encountered circumstances where rewriting is used, as
41441 illustrated by these examples:
41446 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
41447 exchange mail with each other behind a firewall, but there is only a single
41448 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
41449 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
41454 A host rewrites the local parts of its own users so that, for example,
41455 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
41461 <title>When does rewriting happen?</title>
41463 <indexterm role="concept">
41464 <primary>rewriting</primary>
41465 <secondary>timing of</secondary>
41467 <indexterm role="concept">
41468 <primary>access control lists (ACLs)</primary>
41469 <secondary>rewriting addresses in</secondary>
41471 Configured address rewriting can take place at several different stages of a
41472 message’s processing.
41475 <indexterm role="concept">
41476 <primary><varname>$sender_address</varname></primary>
41478 At the start of an ACL for MAIL, the sender address may have been rewritten
41479 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
41480 ordinary rewrite rules have yet been applied. If, however, the sender address
41481 is verified in the ACL, it is rewritten before verification, and remains
41482 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
41483 rewritten address. This also applies if sender verification happens in a
41484 RCPT ACL. Otherwise, when the sender address is not verified, it is
41485 rewritten as soon as a message’s header lines have been received.
41488 <indexterm role="concept">
41489 <primary><varname>$domain</varname></primary>
41491 <indexterm role="concept">
41492 <primary><varname>$local_part</varname></primary>
41494 Similarly, at the start of an ACL for RCPT, the current recipient’s address
41495 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
41496 rewrite rules have yet been applied to it. However, the behaviour is different
41497 from the sender address when a recipient is verified. The address is rewritten
41498 for the verification, but the rewriting is not remembered at this stage. The
41499 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
41500 as they were before (that is, they contain the unrewritten – except for
41501 SMTP-time rewriting – address).
41503 <para revisionflag="changed">
41504 As soon as a message’s header lines have been received, all the envelope
41505 recipient addresses are permanently rewritten, and rewriting is also applied to
41506 the addresses in the header lines (if configured). This happens before adding
41507 any header lines that were specified in MAIL or RCPT ACLs, and
41508 <indexterm role="concept">
41509 <primary><function>local_scan()</function> function</primary>
41510 <secondary>address rewriting; timing of</secondary>
41512 before the DATA ACL and <function>local_scan()</function> functions are run.
41515 When an address is being routed, either for delivery or for verification,
41516 rewriting is applied immediately to child addresses that are generated by
41517 redirection, unless <option>no_rewrite</option> is set on the router.
41519 <para revisionflag="changed">
41520 <indexterm role="concept">
41521 <primary>envelope sender</primary>
41522 <secondary>rewriting at transport time</secondary>
41524 <indexterm role="concept">
41525 <primary>rewriting</primary>
41526 <secondary>at transport time</secondary>
41528 <indexterm role="concept">
41529 <primary>header lines</primary>
41530 <secondary>rewriting at transport time</secondary>
41532 At transport time, additional rewriting of addresses in header lines can be
41533 specified by setting the generic <option>headers_rewrite</option> option on a transport.
41534 This option contains rules that are identical in form to those in the rewrite
41535 section of the configuration file. They are applied to the original message
41536 header lines and any that were added by ACLs or a system filter. They are not
41537 applied to header lines that are added by routers or the transport.
41539 <para revisionflag="changed">
41540 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
41541 transport option. However, it is not possible to rewrite envelope recipients at
41546 <title>Testing the rewriting rules that apply on input</title>
41548 <indexterm role="concept">
41549 <primary>rewriting</primary>
41550 <secondary>testing</secondary>
41552 <indexterm role="concept">
41553 <primary>testing</primary>
41554 <secondary>rewriting</secondary>
41556 Exim’s input rewriting configuration appears in a part of the run time
41557 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
41558 <option>-brw</option> command line option. This takes an address (which can be a full RFC
41559 2822 address) as its argument. The output is a list of how the address would be
41560 transformed by the rewriting rules for each of the different places it might
41561 appear in an incoming message, that is, for each different header and for the
41562 envelope sender and recipient fields. For example,
41564 <literallayout class="monospaced">
41565 exim -brw ph10@exim.workshop.example
41568 might produce the output
41570 <literallayout class="monospaced">
41571 sender: Philip.Hazel@exim.workshop.example
41572 from: Philip.Hazel@exim.workshop.example
41573 to: ph10@exim.workshop.example
41574 cc: ph10@exim.workshop.example
41575 bcc: ph10@exim.workshop.example
41576 reply-to: Philip.Hazel@exim.workshop.example
41577 env-from: Philip.Hazel@exim.workshop.example
41578 env-to: ph10@exim.workshop.example
41581 which shows that rewriting has been set up for that address when used in any of
41582 the source fields, but not when it appears as a recipient address. At the
41583 present time, there is no equivalent way of testing rewriting rules that are
41584 set for a particular transport.
41588 <title>Rewriting rules</title>
41590 <indexterm role="concept">
41591 <primary>rewriting</primary>
41592 <secondary>rules</secondary>
41594 The rewrite section of the configuration file consists of lines of rewriting
41598 <<emphasis>source pattern</emphasis>> <<emphasis>replacement</emphasis>> <<emphasis>flags</emphasis>>
41601 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
41602 transport option are given as a colon-separated list. Each item in the list
41603 takes the same form as a line in the main rewriting configuration (except that
41604 any colons must be doubled, of course).
41607 The formats of source patterns and replacement strings are described below.
41608 Each is terminated by white space, unless enclosed in double quotes, in which
41609 case normal quoting conventions apply inside the quotes. The flags are single
41610 characters which may appear in any order. Spaces and tabs between them are
41614 For each address that could potentially be rewritten, the rules are scanned in
41615 order, and replacements for the address from earlier rules can themselves be
41616 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
41619 The order in which addresses are rewritten is undefined, may change between
41620 releases, and must not be relied on, with one exception: when a message is
41621 received, the envelope sender is always rewritten first, before any header
41622 lines are rewritten. For example, the replacement string for a rewrite of an
41623 address in <emphasis>To:</emphasis> must not assume that the message’s address in <emphasis>From:</emphasis> has
41624 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
41625 that the envelope sender has already been rewritten.
41628 <indexterm role="concept">
41629 <primary><varname>$domain</varname></primary>
41631 <indexterm role="concept">
41632 <primary><varname>$local_part</varname></primary>
41634 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
41635 string to refer to the address that is being rewritten. Note that lookup-driven
41636 rewriting can be done by a rule of the form
41638 <literallayout class="monospaced">
41642 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
41643 refer to the address that is being rewritten.
41647 <title>Rewriting patterns</title>
41649 <indexterm role="concept">
41650 <primary>rewriting</primary>
41651 <secondary>patterns</secondary>
41653 <indexterm role="concept">
41654 <primary>address list</primary>
41655 <secondary>in a rewriting pattern</secondary>
41657 The source pattern in a rewriting rule is any item which may appear in an
41658 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
41659 single-item address list, which means that it is expanded before being tested
41660 against the address. As always, if you use a regular expression as a pattern,
41661 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
41662 facility to suppress string expansion within the regular expression.
41665 Domains in patterns should be given in lower case. Local parts in patterns are
41666 case-sensitive. If you want to do case-insensitive matching of local parts, you
41667 can use a regular expression that starts with <literal>^(?i)</literal>.
41670 <indexterm role="concept">
41671 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
41672 <secondary>in rewriting rules</secondary>
41674 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
41675 depending on the type of match which occurred. These can be used in the
41676 replacement string to insert portions of the incoming address. <varname>$0</varname> always
41677 refers to the complete incoming address. When a regular expression is used, the
41678 numerical variables are set from its capturing subexpressions. For other types
41679 of pattern they are set as follows:
41684 If a local part or domain starts with an asterisk, the numerical variables
41685 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
41686 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
41689 <literallayout class="monospaced">
41690 *queen@*.fict.example
41693 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
41695 <literallayout class="monospaced">
41696 $0 = hearts-queen@wonderland.fict.example
41701 Note that if the local part does not start with an asterisk, but the domain
41702 does, it is <varname>$1</varname> that contains the wild part of the domain.
41707 If the domain part of the pattern is a partial lookup, the wild and fixed parts
41708 of the domain are placed in the next available numerical variables. Suppose,
41709 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
41710 rewriting rule of the form
41713 <literal>*@partial-dbm;/some/dbm/file</literal> <<emphasis>replacement string</emphasis>>
41716 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
41718 <literallayout class="monospaced">
41724 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
41725 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
41726 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
41727 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
41728 whole domain. For non-partial domain lookups, no numerical variables are set.
41734 <title>Rewriting replacements</title>
41736 <indexterm role="concept">
41737 <primary>rewriting</primary>
41738 <secondary>replacements</secondary>
41740 If the replacement string for a rule is a single asterisk, addresses that
41741 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
41742 rewriting rules are scanned. For example,
41744 <literallayout class="monospaced">
41745 hatta@lookingglass.fict.example * f
41748 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
41749 <emphasis>From:</emphasis> headers.
41752 <indexterm role="concept">
41753 <primary><varname>$domain</varname></primary>
41755 <indexterm role="concept">
41756 <primary><varname>$local_part</varname></primary>
41758 If the replacement string is not a single asterisk, it is expanded, and must
41759 yield a fully qualified address. Within the expansion, the variables
41760 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
41761 Any letters they contain retain their original case – they are not lower
41762 cased. The numerical variables are set up according to the type of pattern that
41763 matched the address, as described above. If the expansion is forced to fail by
41764 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
41765 current rule is abandoned, but subsequent rules may take effect. Any other
41766 expansion failure causes the entire rewriting operation to be abandoned, and an
41767 entry written to the panic log.
41771 <title>Rewriting flags</title>
41773 There are three different kinds of flag that may appear on rewriting rules:
41778 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
41784 A flag that specifies rewriting at SMTP time: S.
41789 Flags that control the rewriting process: Q, q, R, w.
41794 For rules that are part of the <option>headers_rewrite</option> generic transport option,
41795 E, F, T, and S are not permitted.
41799 <title>Flags specifying which headers and envelope addresses to rewrite</title>
41801 <indexterm role="concept">
41802 <primary>rewriting</primary>
41803 <secondary>flags</secondary>
41805 If none of the following flag letters, nor the <quote>S</quote> flag (see section
41806 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
41807 and to both the sender and recipient fields of the envelope, whereas a
41808 transport-time rewriting rule just applies to all headers. Otherwise, the
41809 rewriting rule is skipped unless the relevant addresses are being processed.
41812 <literal>E</literal> rewrite all envelope fields
41813 <literal>F</literal> rewrite the envelope From field
41814 <literal>T</literal> rewrite the envelope To field
41815 <literal>b</literal> rewrite the <emphasis>Bcc:</emphasis> header
41816 <literal>c</literal> rewrite the <emphasis>Cc:</emphasis> header
41817 <literal>f</literal> rewrite the <emphasis>From:</emphasis> header
41818 <literal>h</literal> rewrite all headers
41819 <literal>r</literal> rewrite the <emphasis>Reply-To:</emphasis> header
41820 <literal>s</literal> rewrite the <emphasis>Sender:</emphasis> header
41821 <literal>t</literal> rewrite the <emphasis>To:</emphasis> header
41824 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
41825 restrict this to special known cases in your own domains.
41828 <section id="SECTrewriteS">
41829 <title>The SMTP-time rewriting flag</title>
41831 <indexterm role="concept">
41832 <primary>SMTP</primary>
41833 <secondary>rewriting malformed addresses</secondary>
41835 <indexterm role="concept">
41836 <primary>RCPT</primary>
41837 <secondary>rewriting argument of</secondary>
41839 <indexterm role="concept">
41840 <primary>MAIL</primary>
41841 <secondary>rewriting argument of</secondary>
41843 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
41844 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
41845 before any other processing; even before syntax checking. The pattern is
41846 required to be a regular expression, and it is matched against the whole of the
41847 data for the command, including any surrounding angle brackets.
41850 <indexterm role="concept">
41851 <primary><varname>$domain</varname></primary>
41853 <indexterm role="concept">
41854 <primary><varname>$local_part</varname></primary>
41856 This form of rewrite rule allows for the handling of addresses that are not
41857 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
41858 input). Because the input is not required to be a syntactically valid address,
41859 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
41860 expansion of the replacement string. The result of rewriting replaces the
41861 original address in the MAIL or RCPT command.
41865 <title>Flags controlling the rewriting process</title>
41867 There are four flags which control the way the rewriting process works. These
41868 take effect only when a rule is invoked, that is, when the address is of the
41869 correct type (matches the flags) and matches the pattern:
41874 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
41875 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
41876 absence of <quote>Q</quote> the rewritten address must always include a domain.
41881 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
41882 even if no rewriting actually takes place because of a <quote>fail</quote> in the
41883 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
41884 (does not match the flags) or does not match the pattern.
41889 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
41890 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
41891 rewriting once it fails to match (after at least one successful rewrite).
41896 <indexterm role="concept">
41897 <primary>rewriting</primary>
41898 <secondary>whole addresses</secondary>
41900 When an address in a header is rewritten, the rewriting normally applies only
41901 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
41902 left unchanged. For example, rewriting might change
41904 <literallayout class="monospaced">
41905 From: Ford Prefect <fp42@restaurant.hitch.fict.example>
41910 <literallayout class="monospaced">
41911 From: Ford Prefect <prefectf@hitch.fict.example>
41914 <indexterm role="concept">
41915 <primary>RFC 2047</primary>
41917 Sometimes there is a need to replace the whole address item, and this can be
41918 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
41919 causes an address in a header line to be rewritten, the entire address is
41920 replaced, not just the working part. The replacement must be a complete RFC
41921 2822 address, including the angle brackets if necessary. If text outside angle
41922 brackets contains a character whose value is greater than 126 or less than 32
41923 (except for tab), the text is encoded according to RFC 2047. The character set
41924 is taken from <option>headers_charset</option>, which defaults to ISO-8859-1.
41927 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
41928 rewritten, all but the working part of the replacement address is discarded.
41934 <title>Rewriting examples</title>
41936 Here is an example of the two common rewriting paradigms:
41938 <literallayout class="monospaced">
41939 *@*.hitch.fict.example $1@hitch.fict.example
41940 *@hitch.fict.example ${lookup{$1}dbm{/etc/realnames}\
41941 {$value}fail}@hitch.fict.example bctfrF
41944 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
41945 the string expansion to fail if the lookup does not succeed. In this context it
41946 has the effect of leaving the original address unchanged, but Exim goes on to
41947 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
41948 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
41949 explicitly, which would cause the rewritten address to be the same as before,
41950 at the cost of a small bit of processing. Not supplying either of these is an
41951 error, since the rewritten address would then contain no local part.
41954 The first example above replaces the domain with a superior, more general
41955 domain. This may not be desirable for certain local parts. If the rule
41957 <literallayout class="monospaced">
41958 root@*.hitch.fict.example *
41961 were inserted before the first rule, rewriting would be suppressed for the
41962 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
41965 Rewriting can be made conditional on a number of tests, by making use of
41966 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
41967 messages that originate outside the local host:
41969 <literallayout class="monospaced">
41970 *@*.hitch.fict.example "${if !eq {$sender_host_address}{}\
41971 {$1@hitch.fict.example}fail}"
41974 The replacement string is quoted in this example because it contains white
41978 <indexterm role="concept">
41979 <primary>rewriting</primary>
41980 <secondary>bang paths</secondary>
41982 <indexterm role="concept">
41983 <primary>bang paths</primary>
41984 <secondary>rewriting</secondary>
41986 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
41987 an address it treats it as an unqualified local part which it qualifies with
41988 the local qualification domain (if the source of the message is local or if the
41989 remote host is permitted to send unqualified addresses). Rewriting can
41990 sometimes be used to handle simple bang paths with a fixed number of
41991 components. For example, the rule
41993 <literallayout class="monospaced">
41994 \N^([^!]+)!(.*)@your.domain.example$\N $2@$1
41997 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
41998 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
41999 a global rewriting rule for envelope addresses. It can provide a backdoor
42000 method for using your system as a relay, because the incoming addresses appear
42001 to be local. If the bang path addresses are received via SMTP, it is safer to
42002 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
42003 can be done on the rewritten addresses.
42004 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
42009 <chapter id="CHAPretry">
42010 <title>Retry configuration</title>
42012 <indexterm role="concept" id="IIDretconf1" class="startofrange">
42013 <primary>retry configuration</primary>
42014 <secondary>description of</secondary>
42016 <indexterm role="concept" id="IIDregconf2" class="startofrange">
42017 <primary>configuration file</primary>
42018 <secondary>retry section</secondary>
42020 The <quote>retry</quote> section of the run time configuration file contains a list of
42021 retry rules that control how often Exim tries to deliver messages that cannot
42022 be delivered at the first attempt. If there are no retry rules, temporary
42023 errors are treated as permanent. The <option>-brt</option> command line option can be used
42024 to test which retry rule will be used for a given address, domain and error.
42027 The most common cause of retries is temporary failure to deliver to a remote
42028 host because the host is down, or inaccessible because of a network problem.
42029 Exim’s retry processing in this case is applied on a per-host (strictly, per IP
42030 address) basis, not on a per-message basis. Thus, if one message has recently
42031 been delayed, delivery of a new message to the same host is not immediately
42032 tried, but waits for the host’s retry time to arrive. If the <option>retry_defer</option>
42033 log selector is set, the message
42034 <indexterm role="concept">
42035 <primary>retry</primary>
42036 <secondary>time not reached</secondary>
42038 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
42039 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
42040 the handling of errors during remote deliveries.
42043 Retry processing applies to routing as well as to delivering, except as covered
42044 in the next paragraph. The retry rules do not distinguish between these
42045 actions. It is not possible, for example, to specify different behaviour for
42046 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
42047 the host <emphasis>snark.fict.example</emphasis>. I didn’t think anyone would ever need this
42048 added complication, so did not implement it. However, although they share the
42049 same retry rule, the actual retry times for routing and transporting a given
42050 domain are maintained independently.
42053 When a delivery is not part of a queue run (typically an immediate delivery on
42054 receipt of a message), the routers are always run, and local deliveries are
42055 always attempted, even if retry times are set for them. This makes for better
42056 behaviour if one particular message is causing problems (for example, causing
42057 quota overflow, or provoking an error in a filter file). If such a delivery
42058 suffers a temporary failure, the retry data is updated as normal, and
42059 subsequent delivery attempts from queue runs occur only when the retry time for
42060 the local address is reached.
42063 <title>Retry rules</title>
42065 <indexterm role="concept">
42066 <primary>retry</primary>
42067 <secondary>rules</secondary>
42069 Each retry rule occupies one line and consists of three or four parts,
42070 separated by white space: a pattern, an error name, an optional list of sender
42071 addresses, and a list of retry parameters. The pattern and sender lists must be
42072 enclosed in double quotes if they contain white space. The rules are searched
42073 in order until one is found where the pattern, error name, and sender list (if
42074 present) match the failing host or address, the error that occurred, and the
42075 message’s sender, respectively.
42078 The pattern is any single item that may appear in an address list (see section
42079 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
42080 which means that it is expanded before being tested against the address that
42081 has been delayed. Address list processing treats a plain domain name as if it
42082 were preceded by <quote>*@</quote>, which makes it possible for many retry rules to start
42083 with just a domain. For example,
42085 <literallayout class="monospaced">
42086 lookingglass.fict.example * F,24h,30m;
42089 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
42092 <literallayout class="monospaced">
42093 alice@lookingglass.fict.example * F,24h,30m;
42096 applies only to temporary failures involving the local part <option>alice</option>.
42097 In practice, almost all rules start with a domain name pattern without a local
42101 <indexterm role="concept">
42102 <primary>regular expressions</primary>
42103 <secondary>in retry rules</secondary>
42105 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a routing rule pattern, it
42106 must match a complete address, not just a domain, because that is how regular
42107 expressions work in address lists.
42110 <literal>^\Nxyz\d+\.abc\.example$\N * G,1h,10m,2</literal> <option>Wrong</option>
42111 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N * G,1h,10m,2</literal> <option>Right</option>
42115 <title>Choosing which retry rule to use for address errors</title>
42117 When Exim is looking for a retry rule after a routing attempt has failed (for
42118 example, after a DNS timeout), each line in the retry configuration is tested
42119 against the complete address only if <option>retry_use_local_part</option> is set for the
42120 router. Otherwise, only the domain is used, except when matching against a
42121 regular expression, when the local part of the address is replaced with <quote>*</quote>.
42122 A domain on its own can match a domain pattern, or a pattern that starts with
42123 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
42124 <option>check_local_user</option> is true, and false for other routers.
42127 Similarly, when Exim is looking for a retry rule after a local delivery has
42128 failed (for example, after a mailbox full error), each line in the retry
42129 configuration is tested against the complete address only if
42130 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
42133 <para revisionflag="changed">
42134 However, when Exim is looking for a retry rule after a remote delivery attempt
42135 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
42136 whole address is always used as the key when searching the retry rules. The
42137 rule that is found is used to create a retry time for the failing address.
42141 <title>Choosing which retry rule to use for host and message errors</title>
42143 For a temporary error that is not related to an individual address (for
42144 example, a connection timeout), each line in the retry configuration is checked
42145 twice. First, the name of the remote host is used as a domain name (preceded by
42146 <quote>*@</quote> when matching a regular expression). If this does not match the line,
42147 the domain from the email address is tried in a similar fashion. For example,
42148 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
42150 <literallayout class="monospaced">
42151 a.b.c.example MX 5 x.y.z.example
42156 and the retry rules are
42158 <literallayout class="monospaced">
42159 p.q.r.example * F,24h,30m;
42160 a.b.c.example * F,4d,45m;
42163 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
42164 first rule matches neither the host nor the domain, so Exim looks at the second
42165 rule. This does not match the host, but it does match the domain, so it is used
42166 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
42167 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
42168 first retry rule is used, because it matches the host.
42171 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
42172 first rule to determine retry times, but for all the other hosts for the domain
42173 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
42174 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
42177 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
42178 However, if a message is routed directly to an IP address without the use of a
42179 host name, for example, if a <command>manualroute</command> router contains a setting such as:
42181 <literallayout class="monospaced">
42182 route_list = *.a.example 192.168.34.23
42185 then the <quote>host name</quote> that is used when searching for a retry rule is the
42186 textual form of the IP address.
42190 <title>Retry rules for specific errors</title>
42192 <indexterm role="concept">
42193 <primary>retry</primary>
42194 <secondary>specific errors; specifying</secondary>
42196 The second field in a retry rule is the name of a particular error, or an
42197 asterisk, which matches any error. The errors that can be tested for are:
42201 <term><option>auth_failed</option></term>
42204 Authentication failed when trying to send to a host in the
42205 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
42207 </listitem></varlistentry>
42208 <varlistentry revisionflag="changed">
42209 <term><option>data_4xx</option></term>
42211 <para revisionflag="changed">
42212 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
42213 after the command, or after sending the message’s data.
42215 </listitem></varlistentry>
42216 <varlistentry revisionflag="changed">
42217 <term><option>mail_4xx</option></term>
42219 <para revisionflag="changed">
42220 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
42222 </listitem></varlistentry>
42223 <varlistentry revisionflag="changed">
42224 <term><option>rcpt_4xx</option></term>
42226 <para revisionflag="changed">
42227 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
42229 </listitem></varlistentry>
42231 <para revisionflag="changed">
42232 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x’s can be given
42233 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
42234 recognize 452 errors given to RCPT commands for addresses in a certain domain,
42235 and have retries every ten minutes with a one-hour timeout, you could set up a
42236 retry rule of this form:
42238 <literallayout class="monospaced" revisionflag="changed">
42239 the.domain.name rcpt_452 F,1h,10m
42241 <para revisionflag="changed">
42242 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
42243 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
42246 <varlistentry revisionflag="changed">
42247 <term><option>lost_connection</option></term>
42249 <para revisionflag="changed">
42250 A server unexpectedly closed the SMTP connection. There may, of course,
42251 legitimate reasons for this (host died, network died), but if it repeats a lot
42252 for the same host, it indicates something odd.
42254 </listitem></varlistentry>
42256 <term><option>refused_MX</option></term>
42259 A connection to a host obtained from an MX record was refused.
42261 </listitem></varlistentry>
42263 <term><option>refused_A</option></term>
42266 A connection to a host not obtained from an MX record was refused.
42268 </listitem></varlistentry>
42270 <term><option>refused</option></term>
42273 A connection was refused.
42275 </listitem></varlistentry>
42277 <term><option>timeout_connect_MX</option></term>
42280 A connection attempt to a host obtained from an MX record timed out.
42282 </listitem></varlistentry>
42284 <term><option>timeout_connect_A</option></term>
42287 A connection attempt to a host not obtained from an MX record timed out.
42289 </listitem></varlistentry>
42291 <term><option>timeout_connect</option></term>
42294 A connection attempt timed out.
42296 </listitem></varlistentry>
42298 <term><option>timeout_MX</option></term>
42301 There was a timeout while connecting or during an SMTP session with a host
42302 obtained from an MX record.
42304 </listitem></varlistentry>
42306 <term><option>timeout_A</option></term>
42309 There was a timeout while connecting or during an SMTP session with a host not
42310 obtained from an MX record.
42312 </listitem></varlistentry>
42314 <term><option>timeout</option></term>
42317 There was a timeout while connecting or during an SMTP session.
42319 </listitem></varlistentry>
42320 <varlistentry revisionflag="changed">
42321 <term><option>tls_required</option></term>
42323 <para revisionflag="changed">
42324 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
42325 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
42326 to STARTTLS, or there was a problem setting up the TLS connection.
42328 </listitem></varlistentry>
42330 <term><option>quota</option></term>
42333 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
42336 </listitem></varlistentry>
42338 <term><option>quota_</option><<emphasis>time</emphasis>></term>
42341 <indexterm role="concept">
42342 <primary>quota</primary>
42343 <secondary>error testing in retry rule</secondary>
42345 <indexterm role="concept">
42346 <primary>retry</primary>
42347 <secondary>quota error testing</secondary>
42349 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
42350 transport, and the mailbox has not been accessed for <<emphasis>time</emphasis>>. For example,
42351 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
42354 </listitem></varlistentry>
42357 <indexterm role="concept">
42358 <primary>mailbox</primary>
42359 <secondary>time of last read</secondary>
42361 The idea of <option>quota_</option><<emphasis>time</emphasis>> is to make it possible to have shorter
42362 timeouts when the mailbox is full and is not being read by its owner. Ideally,
42363 it should be based on the last time that the user accessed the mailbox.
42364 However, it is not always possible to determine this. Exim uses the following
42370 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
42371 used. As no new messages are being delivered (because the mailbox is over
42372 quota), Exim does not access the file, so this is the time of last user access.
42377 <indexterm role="concept">
42378 <primary>maildir format</primary>
42379 <secondary>time of last read</secondary>
42381 For a maildir delivery, the time of last modification of the <filename>new</filename>
42382 subdirectory is used. As the mailbox is over quota, no new files are created in
42383 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
42384 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
42385 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
42386 time that is used is therefore the last time that the user read a new message.
42391 For other kinds of multi-file mailbox, the time of last access cannot be
42392 obtained, so a retry rule that uses this type of error field is never matched.
42397 The quota errors apply both to system-enforced quotas and to Exim’s own quota
42398 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
42399 when a local delivery is deferred because a partition is full (the ENOSPC
42404 <title>Retry rules for specified senders</title>
42406 <indexterm role="concept">
42407 <primary>retry</primary>
42408 <secondary>rules; sender-specific</secondary>
42410 You can specify retry rules that apply only when the failing message has a
42411 specific sender. In particular, this can be used to define retry rules that
42412 apply only to bounce messages. The third item in a retry rule can be of this
42416 <literal>senders=</literal><<emphasis>address list</emphasis>>
42419 The retry timings themselves are then the fourth item. For example:
42421 <literallayout class="monospaced">
42422 * rcpt_4xx senders=: F,1h,30m
42424 <para revisionflag="changed">
42425 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
42426 host. If the address list contains white space, it must be enclosed in quotes.
42429 <literallayout class="monospaced" revisionflag="changed">
42430 a.domain rcpt_452 senders="xb.dom : yc.dom" G,8h,10m,1.5
42433 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
42434 (which do not depend on the recipient). The reason is that the sender is used
42435 only to match the retry rule. Once the rule has been found for a host error,
42436 its contents are used to set a retry time for the host, and this will apply to
42437 all messages, not just those with specific senders.
42440 When testing retry rules using <option>-brt</option>, you can supply a sender using the
42441 <option>-f</option> command line option, like this:
42443 <literallayout class="monospaced">
42444 exim -f "" -brt user@dom.ain
42447 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
42448 list is never matched.
42452 <title>Retry parameters</title>
42454 <indexterm role="concept">
42455 <primary>retry</primary>
42456 <secondary>parameters in rules</secondary>
42458 The third (or fourth, if a senders list is present) field in a retry rule is a
42459 sequence of retry parameter sets, separated by semicolons. Each set consists of
42462 <<emphasis>letter</emphasis>>,<<emphasis>cutoff time</emphasis>>,<<emphasis>arguments</emphasis>>
42465 The letter identifies the algorithm for computing a new retry time; the cutoff
42466 time is the time beyond which this algorithm no longer applies, and the
42467 arguments vary the algorithm’s action. The cutoff time is measured from the
42468 time that the first failure for the domain (combined with the local part if
42469 relevant) was detected, not from the time the message was received.
42472 <indexterm role="concept">
42473 <primary>retry</primary>
42474 <secondary>algorithms</secondary>
42476 <indexterm role="concept">
42477 <primary>retry</primary>
42478 <secondary>fixed intervals</secondary>
42480 <indexterm role="concept">
42481 <primary>retry</primary>
42482 <secondary>increasing intervals</secondary>
42484 <indexterm role="concept">
42485 <primary>retry</primary>
42486 <secondary>random intervals</secondary>
42488 The available algorithms are:
42493 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
42499 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
42500 specifies a starting value for the interval, and the second a multiplier, which
42501 is used to increase the size of the interval at each retry.
42506 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
42507 retry, the previous interval is multiplied by the factor in order to get a
42508 maximum for the next interval. The mininum interval is the first argument of
42509 the parameter, and an actual interval is chosen randomly between them. Such a
42510 rule has been found to be helpful in cluster configurations when all the
42511 members of the cluster restart at once, and may therefore synchronize their
42512 queue processing times.
42517 When computing the next retry time, the algorithm definitions are scanned in
42518 order until one whose cutoff time has not yet passed is reached. This is then
42519 used to compute a new retry time that is later than the current time. In the
42520 case of fixed interval retries, this simply means adding the interval to the
42521 current time. For geometrically increasing intervals, retry intervals are
42522 computed from the rule’s parameters until one that is greater than the previous
42523 interval is found. The main configuration variable
42524 <indexterm role="concept">
42525 <primary>limit</primary>
42526 <secondary>retry interval</secondary>
42528 <indexterm role="concept">
42529 <primary>retry interval</primary>
42530 <secondary>maximum</secondary>
42532 <indexterm role="concept">
42533 <primary><option>retry_interval_max</option></primary>
42535 <option>retry_interval_max</option> limits the maximum interval between retries. <phrase revisionflag="changed">It
42536 cannot be set greater than <literal>24h</literal>, which is its default value.</phrase>
42539 A single remote domain may have a number of hosts associated with it, and each
42540 host may have more than one IP address. Retry algorithms are selected on the
42541 basis of the domain name, but are applied to each IP address independently. If,
42542 for example, a host has two IP addresses and one is unusable, Exim will
42543 generate retry times for it and will not try to use it until its next retry
42544 time comes. Thus the good IP address is likely to be tried first most of the
42548 <indexterm role="concept">
42549 <primary>hints database</primary>
42550 <secondary>use for retrying</secondary>
42552 Retry times are hints rather than promises. Exim does not make any attempt to
42553 run deliveries exactly at the computed times. Instead, a queue runner process
42554 starts delivery processes for delayed messages periodically, and these attempt
42555 new deliveries only for those addresses that have passed their next retry time.
42556 If a new message arrives for a deferred address, an immediate delivery attempt
42557 occurs only if the address has passed its retry time. In the absence of new
42558 messages, the minimum time between retries is the interval between queue runner
42559 processes. There is not much point in setting retry times of five minutes if
42560 your queue runners happen only once an hour, unless there are a significant
42561 number of incoming messages (which might be the case on a system that is
42562 sending everything to a smart host, for example).
42565 The data in the retry hints database can be inspected by using the
42566 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
42567 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
42568 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
42569 are for the hosts associated with a particular mail domain, and also for local
42570 deliveries that have been deferred.
42574 <title>Retry rule examples</title>
42576 Here are some example retry rules:
42578 <literallayout class="monospaced">
42579 alice@wonderland.fict.example quota_5d F,7d,3h
42580 wonderland.fict.example quota_5d
42581 wonderland.fict.example * F,1h,15m; G,2d,1h,2;
42582 lookingglass.fict.example * F,24h,30m;
42583 * refused_A F,2h,20m;
42584 * * F,2h,15m; G,16h,1h,1.5; F,5d,8h
42587 The first rule sets up special handling for mail to
42588 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
42589 mailbox has not been read for at least 5 days. Retries continue every three
42590 hours for 7 days. The second rule handles over-quota errors for all other local
42591 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
42592 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
42593 fail are bounced immediately if the mailbox has not been read for at least 5
42597 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
42598 happen every 15 minutes for an hour, then with geometrically increasing
42599 intervals until two days have passed since a delivery first failed. After the
42600 first hour there is a delay of one hour, then two hours, then four hours, and
42601 so on (this is a rather extreme example).
42604 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
42605 They happen every 30 minutes for 24 hours only. The remaining two rules handle
42606 all other domains, with special action for connection refusal from hosts that
42607 were not obtained from an MX record.
42610 The final rule in a retry configuration should always have asterisks in the
42611 first two fields so as to provide a general catch-all for any addresses that do
42612 not have their own special handling. This example tries every 15 minutes for 2
42613 hours, then with intervals starting at one hour and increasing by a factor of
42614 1.5 up to 16 hours, then every 8 hours up to 5 days.
42618 <title>Timeout of retry data</title>
42620 <indexterm role="concept">
42621 <primary>timeout</primary>
42622 <secondary>of retry data</secondary>
42624 <indexterm role="concept">
42625 <primary><option>retry_data_expire</option></primary>
42627 <indexterm role="concept">
42628 <primary>hints database</primary>
42629 <secondary>data expiry</secondary>
42631 <indexterm role="concept">
42632 <primary>retry</primary>
42633 <secondary>timeout of data</secondary>
42635 Exim timestamps the data that it writes to its retry hints database. When it
42636 consults the data during a delivery it ignores any that is older than the value
42637 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn’t
42638 been tried for 7 days, Exim will try to deliver to it immediately a message
42639 arrives, and if that fails, it will calculate a retry time as if it were
42640 failing for the first time.
42643 This improves the behaviour for messages routed to rarely-used hosts such as MX
42644 backups. If such a host was down at one time, and happens to be down again when
42645 Exim tries a month later, using the old retry data would imply that it had been
42646 down all the time, which is not a justified assumption.
42649 If a host really is permanently dead, this behaviour causes a burst of retries
42650 every now and again, but only if messages routed to it are rare. It there is a
42651 message at least once every 7 days the retry data never expires.
42655 <title>Long-term failures</title>
42657 <indexterm role="concept">
42658 <primary>delivery failure</primary>
42659 <secondary>long-term</secondary>
42661 <indexterm role="concept">
42662 <primary>retry</primary>
42663 <secondary>after long-term failure</secondary>
42665 Special processing happens when an email address has been failing for so long
42666 that the cutoff time for the last algorithm is reached. For example, using the
42667 default retry rule:
42669 <literallayout class="monospaced">
42670 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
42673 the cutoff time is four days. Reaching the retry cutoff is independent of how
42674 long any specific message has been failing; it is the length of continuous
42675 failure for the recipient address that counts.
42678 When the cutoff time is reached for a local delivery, or for all the IP
42679 addresses associated with a remote delivery, a subsequent delivery failure
42680 causes Exim to give up on the address, and a bounce message is generated.
42681 In order to cater for new messages that use the failing address, a next retry
42682 time is still computed from the final algorithm, and is used as follows:
42685 For local deliveries, one delivery attempt is always made for any subsequent
42686 messages. If this delivery fails, the address fails immediately. The
42687 post-cutoff retry time is not used.
42690 If the delivery is remote, there are two possibilities, controlled by the
42691 <indexterm role="concept">
42692 <primary><option>delay_after_cutoff</option></primary>
42694 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
42695 default. Until the post-cutoff retry time for one of the IP addresses is
42696 reached, the failing email address is bounced immediately, without a delivery
42697 attempt taking place. After that time, one new delivery attempt is made to
42698 those IP addresses that are past their retry times, and if that still fails,
42699 the address is bounced and new retry times are computed.
42702 In other words, when all the hosts for a given email address have been failing
42703 for a long time, Exim bounces rather then defers until one of the hosts’ retry
42704 times is reached. Then it tries once, and bounces if that attempt fails. This
42705 behaviour ensures that few resources are wasted in repeatedly trying to deliver
42706 to a broken destination, but if the host does recover, Exim will eventually
42710 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
42711 addresses are past their final cutoff time, Exim tries to deliver to those IP
42712 addresses that have not been tried since the message arrived. If there are
42713 no suitable IP addresses, or if they all fail, the address is bounced. In other
42714 words, it does not delay when a new message arrives, but tries the expired
42715 addresses immediately, unless they have been tried since the message arrived.
42716 If there is a continuous stream of messages for the failing domains, setting
42717 <option>delay_after_cutoff</option> false means that there will be many more attempts to
42718 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
42722 <section revisionflag="changed">
42723 <title>Deliveries that work intermittently</title>
42724 <para revisionflag="changed">
42725 <indexterm role="concept">
42726 <primary>retry</primary>
42727 <secondary>intermittently working deliveries</secondary>
42729 Some additional logic is needed to cope with cases where a host is
42730 intermittently available, or when a message has some attribute that prevents
42731 its delivery when others to the same address get through. In this situation,
42732 because some messages are successfully delivered, the <quote>retry clock</quote> for the
42733 host or address keeps getting restarted, and so a message could remain on the
42734 queue for ever because the cutoff time is never reached.
42736 <para revisionflag="changed">
42737 Two exceptional actions are applied to prevent this happening. Firstly, if a
42738 message’s arrival time is earlier than the <quote>first failed</quote> time for a host or
42739 address, the earlier time is used when scanning the retry rules.
42741 <para revisionflag="changed">
42742 Secondly, if a message has been on the queue for longer than the cutoff time of
42743 any applicable retry rule for a given address, a delivery is attempted for that
42744 address, even if it is not yet time, and if this delivery fails, the address is
42745 timed out. A new retry time is not computed in this case, so that other
42746 messages for the same address are considered immediately.
42748 <para revisionflag="changed">
42749 These two actions are probably equivalent; the fact that they both exist is a
42750 a historical accident. The second was implemented first, and was left in place
42751 when the first was added on the grounds that this was harmless, whereas
42752 removing it might have broken something in this rather tricky area.
42753 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
42754 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
42759 <chapter id="CHAPSMTPAUTH">
42760 <title>SMTP authentication</title>
42762 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
42763 <primary>SMTP</primary>
42764 <secondary>authentication configuration</secondary>
42766 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
42767 <primary>authentication</primary>
42769 The <quote>authenticators</quote> section of Exim’s run time configuration is concerned
42770 with SMTP authentication. This facility is an extension to the SMTP protocol,
42771 described in RFC 2554, which allows a client SMTP host to authenticate itself
42772 to a server. This is a common way for a server to recognize clients that are
42773 permitted to use it as a relay. SMTP authentication is not of relevance to the
42774 transfer of mail between servers that have no managerial connection with each
42778 <indexterm role="concept">
42779 <primary>AUTH</primary>
42780 <secondary>description of</secondary>
42782 Very briefly, the way SMTP authentication works is as follows:
42787 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
42788 the client’s EHLO command.
42793 The client issues an AUTH command, naming a specific mechanism. The command
42794 may, optionally, contain some authentication data.
42799 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
42800 appropriate responses. In simple authentication mechanisms, the challenges are
42801 just prompts for user names and passwords. The server does not have to issue
42802 any challenges – in some mechanisms the relevant data may all be transmitted
42803 with the AUTH command.
42808 The server either accepts or denies authentication.
42813 If authentication succeeds, the client may optionally make use of the AUTH
42814 option on the MAIL command to pass an authenticated sender in subsequent
42815 mail transactions. Authentication lasts for the remainder of the SMTP
42821 If authentication fails, the client may give up, or it may try a different
42822 authentication mechanism, or it may try transferring mail over the
42823 unauthenticated connection.
42828 If you are setting up a client, and want to know which authentication
42829 mechanisms the server supports, you can use Telnet to connect to port 25 (the
42830 SMTP port) on the server, and issue an EHLO command. The response to this
42831 includes the list of supported mechanisms. For example:
42834 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
42835 <literal>Trying 192.168.34.25...</literal>
42836 <literal>Connected to server.example.</literal>
42837 <literal>Escape character is '^]'.</literal>
42838 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
42839 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
42840 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
42841 <literal>250-SIZE 52428800</literal>
42842 <literal>250-PIPELINING</literal>
42843 <literal>250-AUTH PLAIN</literal>
42844 <literal>250 HELP</literal>
42847 The second-last line of this example output shows that the server supports
42848 authentication using the PLAIN mechanism. In Exim, the different authentication
42849 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
42850 routers and transports, which authenticators are included in the binary is
42851 controlled by build-time definitions. The following are currently available,
42852 included by setting
42854 <literallayout class="monospaced">
42856 AUTH_CYRUS_SASL=yes
42861 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
42862 authentication mechanism (RFC 2195), and the second provides an interface to
42863 the Cyrus SASL authentication library. The third can be configured to support
42864 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
42865 not formally documented, but used by several MUAs. The fourth authenticator
42866 supports Microsoft’s <emphasis>Secure Password Authentication</emphasis> mechanism.
42869 The authenticators are configured using the same syntax as other drivers (see
42870 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
42871 authentication section need be present in the configuration file. Each
42872 authenticator can in principle have both server and client functions. When Exim
42873 is receiving SMTP mail, it is acting as a server; when it is sending out
42874 messages over SMTP, it is acting as a client. Authenticator configuration
42875 options are provided for use in both these circumstances.
42878 To make it clear which options apply to which situation, the prefixes
42879 <option>server_</option> and <option>client_</option> are used on option names that are specific to
42880 either the server or the client function, respectively. Server and client
42881 functions are disabled if none of their options are set. If an authenticator is
42882 to be used for both server and client functions, a single definition, using
42883 both sets of options, is required. For example:
42885 <literallayout class="monospaced">
42888 public_name = CRAM-MD5
42889 server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
42891 client_secret = secret2
42894 The <option>server_</option> option is used when Exim is acting as a server, and the
42895 <option>client_</option> options when it is acting as a client.
42898 Descriptions of the individual authenticators are given in subsequent chapters.
42899 The remainder of this chapter covers the generic options for the
42900 authenticators, followed by general discussion of the way authentication works
42904 <title>Generic options for authenticators</title>
42906 <indexterm role="concept">
42907 <primary>authentication</primary>
42908 <secondary>generic options</secondary>
42910 <indexterm role="concept">
42911 <primary>options</primary>
42912 <secondary>generic; for authenticators</secondary>
42916 <indexterm role="option">
42917 <primary>driver</primary>
42920 <informaltable frame="all">
42921 <tgroup cols="4" colsep="0" rowsep="0">
42922 <colspec colwidth="8*" align="left"/>
42923 <colspec colwidth="5*" align="center"/>
42924 <colspec colwidth="5*" align="center"/>
42925 <colspec colwidth="6*" align="right"/>
42928 <entry><option>driver</option></entry>
42929 <entry>Use: <emphasis>authenticators</emphasis></entry>
42930 <entry>Type: <emphasis>string</emphasis></entry>
42931 <entry>Default: <emphasis>unset</emphasis></entry>
42937 This option must always be set. It specifies which of the available
42938 authenticators is to be used.
42941 <indexterm role="option">
42942 <primary>public_name</primary>
42945 <informaltable frame="all">
42946 <tgroup cols="4" colsep="0" rowsep="0">
42947 <colspec colwidth="8*" align="left"/>
42948 <colspec colwidth="5*" align="center"/>
42949 <colspec colwidth="5*" align="center"/>
42950 <colspec colwidth="6*" align="right"/>
42953 <entry><option>public_name</option></entry>
42954 <entry>Use: <emphasis>authenticators</emphasis></entry>
42955 <entry>Type: <emphasis>string</emphasis></entry>
42956 <entry>Default: <emphasis>unset</emphasis></entry>
42962 This option specifies the name of the authentication mechanism that the driver
42963 implements, and by which it is known to the outside world. These names should
42964 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
42965 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
42966 defaults to the driver’s instance name.
42969 <indexterm role="option">
42970 <primary>server_advertise_condition</primary>
42973 <informaltable frame="all">
42974 <tgroup cols="4" colsep="0" rowsep="0">
42975 <colspec colwidth="8*" align="left"/>
42976 <colspec colwidth="5*" align="center"/>
42977 <colspec colwidth="5*" align="center"/>
42978 <colspec colwidth="6*" align="right"/>
42981 <entry><option>server_advertise_condition</option></entry>
42982 <entry>Use: <emphasis>authenticators</emphasis></entry>
42983 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
42984 <entry>Default: <emphasis>unset</emphasis></entry>
42990 When a server is about to advertise an authentication mechanism, the condition
42991 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
42992 mechanism is not advertised.
42993 If the expansion fails, the mechanism is not advertised. If the failure was not
42994 forced, and was not caused by a lookup defer, the incident is logged.
42995 See section <xref linkend="SECTauthexiser"/> below for further discussion.
42998 <indexterm role="option">
42999 <primary>server_debug_print</primary>
43002 <informaltable frame="all">
43003 <tgroup cols="4" colsep="0" rowsep="0">
43004 <colspec colwidth="8*" align="left"/>
43005 <colspec colwidth="5*" align="center"/>
43006 <colspec colwidth="5*" align="center"/>
43007 <colspec colwidth="6*" align="right"/>
43010 <entry><option>server_debug_print</option></entry>
43011 <entry>Use: <emphasis>authenticators</emphasis></entry>
43012 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43013 <entry>Default: <emphasis>unset</emphasis></entry>
43019 If this option is set and authentication debugging is enabled (see the <option>-d</option>
43020 command line option), the string is expanded and included in the debugging
43021 output when the authenticator is run as a server. This can help with checking
43022 out the values of variables.
43023 If expansion of the string fails, the error message is written to the debugging
43024 output, and Exim carries on processing.
43027 <indexterm role="option">
43028 <primary>server_set_id</primary>
43031 <informaltable frame="all">
43032 <tgroup cols="4" colsep="0" rowsep="0">
43033 <colspec colwidth="8*" align="left"/>
43034 <colspec colwidth="5*" align="center"/>
43035 <colspec colwidth="5*" align="center"/>
43036 <colspec colwidth="6*" align="right"/>
43039 <entry><option>server_set_id</option></entry>
43040 <entry>Use: <emphasis>authenticators</emphasis></entry>
43041 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43042 <entry>Default: <emphasis>unset</emphasis></entry>
43048 <indexterm role="concept">
43049 <primary><varname>$authenticated_id</varname></primary>
43051 When an Exim server successfully authenticates a client, this string is
43052 expanded using data from the authentication, and preserved for any incoming
43053 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
43054 lines for incoming messages. For example, a user/password authenticator
43055 configuration might preserve the user name that was used to authenticate, and
43056 refer to it subsequently during delivery of the message.
43057 If expansion fails, the option is ignored.
43060 <indexterm role="option">
43061 <primary>server_mail_auth_condition</primary>
43064 <informaltable frame="all">
43065 <tgroup cols="4" colsep="0" rowsep="0">
43066 <colspec colwidth="8*" align="left"/>
43067 <colspec colwidth="5*" align="center"/>
43068 <colspec colwidth="5*" align="center"/>
43069 <colspec colwidth="6*" align="right"/>
43072 <entry><option>server_mail_auth_condition</option></entry>
43073 <entry>Use: <emphasis>authenticators</emphasis></entry>
43074 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43075 <entry>Default: <emphasis>unset</emphasis></entry>
43081 This option allows a server to discard authenticated sender addresses supplied
43082 as part of MAIL commands in SMTP connections that are authenticated by the
43083 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
43084 as part of the authentication process; instead its (unexpanded) value is
43085 remembered for later use.
43086 How it is used is described in the following section.
43089 <section id="SECTauthparamail">
43090 <title>The AUTH parameter on MAIL commands</title>
43092 <indexterm role="concept">
43093 <primary>authentication</primary>
43094 <secondary>sender; authenticated</secondary>
43096 <indexterm role="concept">
43097 <primary>AUTH</primary>
43098 <secondary>on MAIL command</secondary>
43100 When a client supplied an AUTH= item on a MAIL command, Exim applies
43101 the following checks before accepting it as the authenticated sender of the
43107 If the connection is not using extended SMTP (that is, HELO was used rather
43108 than EHLO), the use of AUTH= is a syntax error.
43113 If the value of the AUTH= parameter is <quote><></quote>, it is ignored.
43118 <indexterm role="concept">
43119 <primary><varname>$authenticated_sender</varname></primary>
43121 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
43122 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
43123 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
43124 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
43125 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
43126 given for the MAIL command.
43131 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
43132 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
43138 If the AUTH= value was accepted by either of the two previous rules, and
43139 the client has authenticated, and the authenticator has a setting for the
43140 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
43141 valued that was saved from the authenticator is expanded. If the expansion
43142 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
43143 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
43144 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
43150 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
43151 hosts to which Exim authenticates as a client. Do not confuse this value with
43152 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
43153 process, and which is not usually a complete email address.
43156 <indexterm role="concept">
43157 <primary><varname>$sender_address</varname></primary>
43159 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
43160 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
43161 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
43162 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
43166 <section id="SECTauthexiser">
43167 <title>Authentication on an Exim server</title>
43169 <indexterm role="concept">
43170 <primary>authentication</primary>
43171 <secondary>on an Exim server</secondary>
43173 When Exim receives an EHLO command, it advertises the public names of those
43174 authenticators that are configured as servers, subject to the following
43180 The client host must match <option>auth_advertise_hosts</option> (default *).
43185 It the <option>server_advertise_condition</option> option is set, its expansion must not
43186 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
43191 The order in which the authenticators are defined controls the order in which
43192 the mechanisms are advertised.
43195 Some mail clients (for example, some versions of Netscape) require the user to
43196 provide a name and password for authentication whenever AUTH is advertised,
43197 even though authentication may not in fact be needed (for example, Exim may be
43198 set up to allow unconditional relaying from the client by an IP address check).
43199 You can make such clients more friendly by not advertising AUTH to them.
43200 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
43201 that runs for RCPT) to relay without authentication, you should set
43203 <literallayout class="monospaced">
43204 auth_advertise_hosts = ! 10.9.8.0/24
43207 so that no authentication mechanisms are advertised to them.
43210 The <option>server_advertise_condition</option> controls the advertisement of individual
43211 authentication mechanisms. For example, it can be used to restrict the
43212 advertisement of a patricular mechanism to encrypted connections, by a setting
43215 <literallayout class="monospaced">
43216 server_advertise_condition = ${if eq{$tls_cipher}{}{no}{yes}}
43219 <indexterm role="concept">
43220 <primary><varname>$tls_cipher</varname></primary>
43222 If the session is encrypted, <varname>$tls_cipher</varname> is not empty, and so the expansion
43223 yields <quote>yes</quote>, which allows the advertisement to happen.
43226 When an Exim server receives an AUTH command from a client, it rejects it
43227 immediately if AUTH was not advertised in response to an earlier EHLO
43228 command. This is the case if
43233 The client host does not match <option>auth_advertise_hosts</option>; or
43238 No authenticators are configured with server options; or
43243 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
43244 server authenticators.
43249 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
43250 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
43251 AUTH is accepted from any client host.
43254 If AUTH is not rejected by the ACL, Exim searches its configuration for a
43255 server authentication mechanism that was advertised in response to EHLO and
43256 that matches the one named in the AUTH command. If it finds one, it runs
43257 the appropriate authentication protocol, and authentication either succeeds or
43258 fails. If there is no matching advertised mechanism, the AUTH command is
43259 rejected with a 504 error.
43262 <indexterm role="concept">
43263 <primary><varname>$received_protocol</varname></primary>
43265 <indexterm role="concept">
43266 <primary><varname>$sender_host_authenticated</varname></primary>
43268 When a message is received from an authenticated host, the value of
43269 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
43270 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
43271 public name) of the authenticator driver that successfully authenticated the
43272 client from which the message was received. This variable is empty if there was
43273 no successful authentication.
43277 <title>Testing server authentication</title>
43279 <indexterm role="concept">
43280 <primary>authentication</primary>
43281 <secondary>testing a server</secondary>
43283 <indexterm role="concept">
43284 <primary>AUTH</primary>
43285 <secondary>testing a server</secondary>
43287 <indexterm role="concept">
43288 <primary>base64 encoding</primary>
43289 <secondary>creating authentication test data</secondary>
43291 Exim’s <option>-bh</option> option can be useful for testing server authentication
43292 configurations. The data for the AUTH command has to be sent using base64
43293 encoding. A quick way to produce such data for testing is the following Perl
43296 <literallayout class="monospaced">
43298 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
43301 <indexterm role="concept">
43302 <primary>binary zero</primary>
43303 <secondary>in authentication data</secondary>
43305 This interprets its argument as a Perl string, and then encodes it. The
43306 interpretation as a Perl string allows binary zeros, which are required for
43307 some kinds of authentication, to be included in the data. For example, a
43308 command line to run this script on such data might be
43310 <literallayout class="monospaced">
43311 encode '\0user\0password'
43314 Note the use of single quotes to prevent the shell interpreting the
43315 backslashes, so that they can be interpreted by Perl to specify characters
43316 whose code value is zero.
43319 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
43320 digit, you must use three zeros instead of one after the leading backslash. If
43321 you do not, the octal digit that starts your string will be incorrectly
43322 interpreted as part of the code for the first character.
43325 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
43326 specially, you must use a Perl escape to prevent them being misinterpreted. For
43327 example, a command such as
43329 <literallayout class="monospaced">
43330 encode '\0user@domain.com\0pas$$word'
43333 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
43336 If you have the <option>mimencode</option> command installed, another way to do produce
43337 base64-encoded strings is to run the command
43339 <literallayout class="monospaced">
43340 echo -e -n `\0user\0password' | mimencode
43343 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
43344 in the argument, and the <option>-n</option> option specifies no newline at the end of its
43345 output. However, not all versions of <option>echo</option> recognize these options, so you
43346 should check your version before relying on this suggestion.
43350 <title>Authentication by an Exim client</title>
43352 <indexterm role="concept">
43353 <primary>authentication</primary>
43354 <secondary>on an Exim client</secondary>
43356 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
43357 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
43358 announces support for authentication, and the host matches an entry in either
43359 of these options, Exim (as a client) tries to authenticate as follows:
43364 For each authenticator that is configured as a client, it searches the
43365 authentication mechanisms announced by the server for one whose name
43366 matches the public name of the authenticator.
43371 <indexterm role="concept">
43372 <primary><varname>$host</varname></primary>
43374 <indexterm role="concept">
43375 <primary><varname>$host_address</varname></primary>
43377 When it finds one that matches, it runs the authenticator’s client code.
43378 The variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string
43379 expansions that the client might do. They are set to the server’s name and
43380 IP address. If any expansion is forced to fail, the authentication attempt
43382 and Exim moves on to the next authenticator.
43383 Otherwise an expansion failure causes delivery to be
43389 If the result of the authentication attempt is a temporary error or a timeout,
43390 Exim abandons trying to send the message to the host for the moment. It will
43391 try again later. If there are any backup hosts available, they are tried in the
43397 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
43398 carries on searching the list of authenticators and tries another one if
43399 possible. If all authentication attempts give permanent errors, or if there are
43400 no attempts because no mechanisms match (or option expansions force failure),
43401 what happens depends on whether the host matches <option>hosts_require_auth</option> or
43402 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
43403 delivery is deferred. The error can be detected in the retry rules, and thereby
43404 turned into a permanent error if you wish. In the second case, Exim tries to
43405 deliver the message unauthenticated.
43410 <indexterm role="concept">
43411 <primary>AUTH</primary>
43412 <secondary>on MAIL command</secondary>
43414 When Exim has authenticated itself to a remote server, it adds the AUTH
43415 parameter to the MAIL commands it sends, if it has an authenticated sender for
43416 the message. If the message came from a remote host, the authenticated sender
43417 is the one that was receiving on an incoming MAIL command, provided that the
43418 incoming connection was authenticated and the <option>server_mail_auth</option> condition
43419 allowed the authenticated sender to be retained. If a local process calls Exim
43420 to send a message, the sender address that is built from the login name and
43421 <option>qualify_domain</option> is treated as authenticated. However, if the
43422 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
43423 the authenticated sender that was received with the message.
43424 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
43425 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
43430 <chapter id="CHAPplaintext">
43431 <title>The plaintext authenticator</title>
43433 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
43434 <primary><command>plaintext</command> authenticator</primary>
43436 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
43437 <primary>authenticators</primary>
43438 <secondary><command>plaintext</command></secondary>
43441 <para revisionflag="changed">
43442 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
43443 LOGIN authentication mechanisms, both of which transfer authentication data as
43444 plain (unencrypted) text (though base64 encoded). The use of plain text is a
43445 security risk; you are strongly advised to insist on the use of SMTP encryption
43446 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
43447 use unencrypted plain text, you should not use the same passwords for SMTP
43448 connections as you do for login accounts.
43451 <title>Using plaintext in a server</title>
43453 <indexterm role="concept">
43454 <primary>options</primary>
43455 <secondary><command>plaintext</command> authenticator (server)</secondary>
43457 When running as a server, <command>plaintext</command> performs the authentication test by
43458 expanding a string. It has the following options:
43461 <indexterm role="option">
43462 <primary>server_prompts</primary>
43465 <informaltable frame="all">
43466 <tgroup cols="4" colsep="0" rowsep="0">
43467 <colspec colwidth="8*" align="left"/>
43468 <colspec colwidth="5*" align="center"/>
43469 <colspec colwidth="5*" align="center"/>
43470 <colspec colwidth="6*" align="right"/>
43473 <entry><option>server_prompts</option></entry>
43474 <entry>Use: <emphasis>plaintext</emphasis></entry>
43475 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43476 <entry>Default: <emphasis>unset</emphasis></entry>
43482 The contents of this option, after expansion, must be a colon-separated list of
43483 prompt strings. If expansion fails, a temporary authentication rejection is
43487 <indexterm role="option">
43488 <primary>server_condition</primary>
43491 <informaltable frame="all">
43492 <tgroup cols="4" colsep="0" rowsep="0">
43493 <colspec colwidth="8*" align="left"/>
43494 <colspec colwidth="5*" align="center"/>
43495 <colspec colwidth="5*" align="center"/>
43496 <colspec colwidth="6*" align="right"/>
43499 <entry><option>server_condition</option></entry>
43500 <entry>Use: <emphasis>plaintext</emphasis></entry>
43501 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43502 <entry>Default: <emphasis>unset</emphasis></entry>
43508 This option must be set in order to configure the driver as a server. Its use
43509 is described below.
43512 <indexterm role="concept">
43513 <primary>AUTH</primary>
43514 <secondary>in <command>plaintext</command> authenticator</secondary>
43516 <indexterm role="concept">
43517 <primary>binary zero</primary>
43518 <secondary>in <command>plaintext</command> authenticator</secondary>
43520 <indexterm role="concept">
43521 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
43522 <secondary>in <command>plaintext</command> authenticator</secondary>
43524 <indexterm role="concept">
43525 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
43527 <indexterm role="concept">
43528 <primary>base64 encoding</primary>
43529 <secondary>in <command>plaintext</command> authenticator</secondary>
43532 <para revisionflag="changed">
43533 The data sent by the client with the AUTH command, or in response to
43534 subsequent prompts, is base64 encoded, and so may contain any byte values
43535 when decoded. If any data is supplied with the command, it is treated as a
43536 list of strings, separated by NULs (binary zeros), the first three of which are
43537 placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname> (neither
43538 LOGIN nor PLAIN uses more than three strings).
43540 <para revisionflag="changed">
43541 For compatibility with previous releases of Exim, the values are also placed in
43542 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
43543 variables for this purpose is now deprecated, as it can lead to confusion in
43544 string expansions that also use them for other things.
43547 If there are more strings in <option>server_prompts</option> than the number of strings
43548 supplied with the AUTH command, the remaining prompts are used to obtain more
43549 data. Each response from the client may be a list of NUL-separated strings.
43552 <indexterm role="concept">
43553 <primary><varname>$authenticated_id</varname></primary>
43555 Once a sufficient number of data strings have been received,
43556 <option>server_condition</option> is expanded. If the expansion is forced to fail,
43557 authentication fails. Any other expansion failure causes a temporary error code
43558 to be returned. If the result of a successful expansion is an empty string,
43559 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
43560 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
43561 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
43562 For any other result, a temporary error code is returned, with the expanded
43563 string as the error text.
43566 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user’s
43567 password, be sure to make the authentication fail if the user is unknown.
43568 There are good and bad examples at the end of the next section.
43572 <title>The PLAIN authentication mechanism</title>
43574 <indexterm role="concept">
43575 <primary>PLAIN authentication mechanism</primary>
43577 <indexterm role="concept">
43578 <primary>authentication</primary>
43579 <secondary>PLAIN mechanism</secondary>
43581 <indexterm role="concept">
43582 <primary>binary zero</primary>
43583 <secondary>in <command>plaintext</command> authenticator</secondary>
43585 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
43586 sent as one item of data (that is, one combined string containing two NUL
43587 separators). The data is sent either as part of the AUTH command, or
43588 subsequently in response to an empty prompt from the server.
43591 The second and third strings are a user name and a corresponding password.
43592 Using a single fixed user name and password as an example, this could be
43593 configured as follows:
43595 <literallayout class="monospaced" revisionflag="changed">
43598 public_name = PLAIN
43600 server_condition = \
43601 ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}\
43603 server_set_id = $auth2
43605 <para revisionflag="changed">
43606 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
43607 the end of a string list are ignored). If all the data comes as part of the
43608 AUTH command, as is commonly the case, the prompt is not used. This
43609 authenticator is advertised in the response to EHLO as
43611 <literallayout class="monospaced" revisionflag="changed">
43614 <para revisionflag="changed">
43615 and a client host can authenticate itself by sending the command
43617 <literallayout class="monospaced" revisionflag="changed">
43618 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
43620 <para revisionflag="changed">
43621 As this contains three strings (more than the number of prompts), no further
43622 data is required from the client. Alternatively, the client may just send
43624 <literallayout class="monospaced" revisionflag="changed">
43627 <para revisionflag="changed">
43628 to initiate authentication, in which case the server replies with an empty
43629 prompt. The client must respond with the combined data string.
43631 <para revisionflag="changed">
43632 The data string is base64 encoded, as required by the RFC. This example,
43633 when decoded, is <<emphasis>NUL</emphasis>><literal>username</literal><<emphasis>NUL</emphasis>><literal>mysecret</literal>, where <<emphasis>NUL</emphasis>>
43634 represents a zero byte. This is split up into three strings, the first of which
43635 is empty. The <option>server_condition</option> option in the authenticator checks that the
43636 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
43638 <para revisionflag="changed">
43639 Having just one fixed user name and password, as in this example, is not very
43640 realistic, though for a small organization with only a handful of
43641 authenticating clients it could make sense.
43643 <para revisionflag="changed">
43644 A more sophisticated instance of this authenticator could use the user name in
43645 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
43646 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
43647 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
43648 This is an incorrect example:
43650 <literallayout class="monospaced" revisionflag="changed">
43651 server_condition = \
43652 ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}{yes}{no}}
43654 <para revisionflag="changed">
43655 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
43656 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
43657 incorrect? It works fine for existing users, but consider what happens if a
43658 non-existent user name is given. The lookup fails, but as no success/failure
43659 strings are given for the lookup, it yields an empty string. Thus, to defeat
43660 the authentication, all a client has to do is to supply a non-existent user
43661 name and an empty password. The correct way of writing this test is:
43663 <literallayout class="monospaced" revisionflag="changed">
43664 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
43665 {${if eq{$value}{$auth3}{yes}{no}}}{no}}
43668 In this case, if the lookup succeeds, the result is checked; if the lookup
43669 fails, authentication fails. If <option>crypteq</option> is being used instead of <option>eq</option>,
43670 the first example is in fact safe, because <option>crypteq</option> always fails if its
43671 second argument is empty. However, the second way of writing the test makes the
43676 <title>The LOGIN authentication mechanism</title>
43678 <indexterm role="concept">
43679 <primary>LOGIN authentication mechanism</primary>
43681 <indexterm role="concept">
43682 <primary>authentication</primary>
43683 <secondary>LOGIN mechanism</secondary>
43685 The LOGIN authentication mechanism is not documented in any RFC, but is in use
43686 in a number of programs. No data is sent with the AUTH command. Instead, a
43687 user name and password are supplied separately, in response to prompts. The
43688 plaintext authenticator can be configured to support this as in this example:
43690 <literallayout class="monospaced" revisionflag="changed">
43693 public_name = LOGIN
43694 server_prompts = User Name : Password
43695 server_condition = \
43696 ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}\
43698 server_set_id = $auth1
43701 Because of the way plaintext operates, this authenticator accepts data supplied
43702 with the AUTH command (in contravention of the specification of LOGIN), but
43703 if the client does not supply it (as is the case for LOGIN clients), the prompt
43704 strings are used to obtain two data items.
43707 Some clients are very particular about the precise text of the prompts. For
43708 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
43709 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
43710 strings. It uses the <option>ldapauth</option> expansion condition to check the user
43711 name and password by binding to an LDAP server:
43713 <literallayout class="monospaced" revisionflag="changed">
43716 public_name = LOGIN
43717 server_prompts = Username:: : Password::
43718 server_condition = ${if ldapauth \
43719 {user="cn=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
43720 pass=${quote:$auth2} \
43721 ldap://ldap.example.org/}{yes}{no}}
43722 server_set_id = uid=$auth1,ou=people,o=example.org
43725 Note the use of the <option>quote_ldap_dn</option> operator to correctly quote the DN for
43726 authentication. However, the basic <option>quote</option> operator, rather than any of the
43727 LDAP quoting operators, is the correct one to use for the password, because
43728 quoting is needed only to make the password conform to the Exim syntax. At the
43729 LDAP level, the password is an uninterpreted string.
43733 <title>Support for different kinds of authentication</title>
43735 A number of string expansion features are provided for the purpose of
43736 interfacing to different ways of user authentication. These include checking
43737 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
43738 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
43739 <xref linkend="SECTexpcond"/>.
43743 <title>Using plaintext in a client</title>
43745 <indexterm role="concept">
43746 <primary>options</primary>
43747 <secondary><command>plaintext</command> authenticator (client)</secondary>
43749 The <command>plaintext</command> authenticator has two client options:
43751 <para revisionflag="changed">
43752 <indexterm role="option">
43753 <primary>client_ignore_invalid_base64</primary>
43756 <informaltable frame="all" revisionflag="changed">
43757 <tgroup cols="4" colsep="0" rowsep="0">
43758 <colspec colwidth="8*" align="left"/>
43759 <colspec colwidth="5*" align="center"/>
43760 <colspec colwidth="5*" align="center"/>
43761 <colspec colwidth="6*" align="right"/>
43764 <entry><option>client_ignore_invalid_base64</option></entry>
43765 <entry>Use: <emphasis>plaintext</emphasis></entry>
43766 <entry>Type: <emphasis>boolean</emphasis></entry>
43767 <entry>Default: <emphasis>false</emphasis></entry>
43772 <para revisionflag="changed">
43773 If the client receives a server prompt that is not a valid base64 string,
43774 authentication is abandoned by default. However, if this option is set true,
43775 the error in the challenge is ignored and the client sends the response as
43779 <indexterm role="option">
43780 <primary>client_send</primary>
43783 <informaltable frame="all">
43784 <tgroup cols="4" colsep="0" rowsep="0">
43785 <colspec colwidth="8*" align="left"/>
43786 <colspec colwidth="5*" align="center"/>
43787 <colspec colwidth="5*" align="center"/>
43788 <colspec colwidth="6*" align="right"/>
43791 <entry><option>client_send</option></entry>
43792 <entry>Use: <emphasis>plaintext</emphasis></entry>
43793 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43794 <entry>Default: <emphasis>unset</emphasis></entry>
43799 <para revisionflag="changed">
43800 The string is a colon-separated list of authentication data strings. Each
43801 string is independently expanded before being sent to the server. The first
43802 string is sent with the AUTH command; any more strings are sent in response
43803 to prompts from the server. Before each string is expanded, the value of the
43804 most recent prompt is placed in the next <varname>$auth</varname><<emphasis>n</emphasis>> variable, starting
43805 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
43806 way. Thus, the prompt that is received in response to sending the first string
43807 (with the AUTH command) can be used in the expansion of the second string, and
43808 so on. If an invalid base64 string is received when
43809 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
43810 <varname>$auth</varname><<emphasis>n</emphasis>> variable.
43813 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
43814 splitting takes priority and happens first.
43817 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
43818 the data, further processing is applied to each string before it is sent. If
43819 there are any single circumflex characters in the string, they are converted to
43820 NULs. Should an actual circumflex be required as data, it must be doubled in
43824 This is an example of a client configuration that implements the PLAIN
43825 authentication mechanism with a fixed user name and password:
43827 <literallayout class="monospaced">
43830 public_name = PLAIN
43831 client_send = ^username^mysecret
43834 The lack of colons means that the entire text is sent with the AUTH
43835 command, with the circumflex characters converted to NULs. A similar example
43836 that uses the LOGIN mechanism is:
43838 <literallayout class="monospaced">
43841 public_name = LOGIN
43842 client_send = : username : mysecret
43845 The initial colon means that the first string is empty, so no data is sent with
43846 the AUTH command itself. The remaining strings are sent in response to
43848 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
43849 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
43855 <title>The cram_md5 authenticator</title>
43857 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
43858 <primary><command>cram_md5</command> authenticator</primary>
43860 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
43861 <primary>authenticators</primary>
43862 <secondary><command>cram_md5</command></secondary>
43864 <indexterm role="concept">
43865 <primary>CRAM-MD5 authentication mechanism</primary>
43867 <indexterm role="concept">
43868 <primary>authentication</primary>
43869 <secondary>CRAM-MD5 mechanism</secondary>
43871 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
43872 sends a challenge string to the client, and the response consists of a user
43873 name and the CRAM-MD5 digest of the challenge string combined with a secret
43874 string (password) which is known to both server and client. Thus, the secret
43875 is not sent over the network as plain text, which makes this authenticator more
43876 secure than <command>plaintext</command>. However, the downside is that the secret has to be
43877 available in plain text at either end.
43880 <title>Using cram_md5 as a server</title>
43882 <indexterm role="concept">
43883 <primary>options</primary>
43884 <secondary><command>cram_md5</command> authenticator (server)</secondary>
43886 This authenticator has one server option, which must be set to configure the
43887 authenticator as a server:
43890 <indexterm role="option">
43891 <primary>server_secret</primary>
43894 <informaltable frame="all">
43895 <tgroup cols="4" colsep="0" rowsep="0">
43896 <colspec colwidth="8*" align="left"/>
43897 <colspec colwidth="5*" align="center"/>
43898 <colspec colwidth="5*" align="center"/>
43899 <colspec colwidth="6*" align="right"/>
43902 <entry><option>server_secret</option></entry>
43903 <entry>Use: <emphasis>cram_md5</emphasis></entry>
43904 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43905 <entry>Default: <emphasis>unset</emphasis></entry>
43911 <indexterm role="concept">
43912 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
43913 <secondary>in <command>cram_md5</command> authenticator</secondary>
43915 When the server receives the client’s response, the user name is placed in
43916 the expansion variable <phrase revisionflag="changed"><varname>$auth1</varname></phrase>, and <option>server_secret</option> is expanded to
43917 obtain the password for that user. The server then computes the CRAM-MD5 digest
43918 that the client should have sent, and checks that it received the correct
43919 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
43920 fails. If the expansion fails for some other reason, a temporary error code is
43921 returned to the client.
43923 <para revisionflag="changed">
43924 For compatibility with previous releases of Exim, the user name is also placed
43925 in <varname>$1</varname>. However, the use of this variables for this purpose is now
43926 deprecated, as it can lead to confusion in string expansions that also use
43927 numeric variables for other things.
43930 For example, the following authenticator checks that the user name given by the
43931 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
43932 user name, authentication fails.
43934 <literallayout class="monospaced" revisionflag="changed">
43937 public_name = CRAM-MD5
43938 server_secret = ${if eq{$auth1}{ph10}{secret}fail}
43939 server_set_id = $auth1
43942 <indexterm role="concept">
43943 <primary><varname>$authenticated_id</varname></primary>
43945 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
43946 name in <varname>$authenticated_id</varname>. A more tyical configuration might look up the
43947 secret string in a file, using the user name as the key. For example:
43949 <literallayout class="monospaced" revisionflag="changed">
43952 public_name = CRAM-MD5
43953 server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}{$value}fail}
43954 server_set_id = $auth1
43957 Note that this expansion explicitly forces failure if the lookup fails
43958 because <varname>$1</varname> contains an unknown user name.
43962 <title>Using cram_md5 as a client</title>
43964 <indexterm role="concept">
43965 <primary>options</primary>
43966 <secondary><command>cram_md5</command> authenticator (client)</secondary>
43968 When used as a client, the <command>cram_md5</command> authenticator has two options:
43971 <indexterm role="option">
43972 <primary>client_name</primary>
43975 <informaltable frame="all">
43976 <tgroup cols="4" colsep="0" rowsep="0">
43977 <colspec colwidth="8*" align="left"/>
43978 <colspec colwidth="5*" align="center"/>
43979 <colspec colwidth="5*" align="center"/>
43980 <colspec colwidth="6*" align="right"/>
43983 <entry><option>client_name</option></entry>
43984 <entry>Use: <emphasis>cram_md5</emphasis></entry>
43985 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43986 <entry>Default: <emphasis>the primary host name</emphasis></entry>
43992 This string is expanded, and the result used as the user name data when
43993 computing the response to the server’s challenge.
43996 <indexterm role="option">
43997 <primary>client_secret</primary>
44000 <informaltable frame="all">
44001 <tgroup cols="4" colsep="0" rowsep="0">
44002 <colspec colwidth="8*" align="left"/>
44003 <colspec colwidth="5*" align="center"/>
44004 <colspec colwidth="5*" align="center"/>
44005 <colspec colwidth="6*" align="right"/>
44008 <entry><option>client_secret</option></entry>
44009 <entry>Use: <emphasis>cram_md5</emphasis></entry>
44010 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44011 <entry>Default: <emphasis>unset</emphasis></entry>
44017 This option must be set for the authenticator to work as a client. Its value is
44018 expanded and the result used as the secret string when computing the response.
44021 <indexterm role="concept">
44022 <primary><varname>$host</varname></primary>
44024 <indexterm role="concept">
44025 <primary><varname>$host_address</varname></primary>
44027 Different user names and secrets can be used for different servers by referring
44028 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
44029 expansion string is treated as an indication that this authenticator is not
44030 prepared to handle this case. Exim moves on to the next configured client
44031 authenticator. Any other expansion failure causes Exim to give up trying to
44032 send the message to the current server.
44035 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
44038 <literallayout class="monospaced">
44041 public_name = CRAM-MD5
44043 client_secret = secret
44046 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
44047 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
44053 <title>The cyrus_sasl authenticator</title>
44055 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
44056 <primary><command>cyrus_sasl</command> authenticator</primary>
44058 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
44059 <primary>authenticators</primary>
44060 <secondary><command>cyrus_sasl</command></secondary>
44062 <indexterm role="concept">
44063 <primary>Cyrus</primary>
44064 <secondary>SASL library</secondary>
44066 The code for this authenticator was provided by Matthew Byng-Maddick of A L
44067 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
44070 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
44071 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
44072 Layer</quote>). This library supports a number of authentication mechanisms,
44073 including PLAIN and LOGIN, but also several others that Exim does not support
44074 directly. In particular, there is support for Kerberos authentication.
44077 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
44078 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
44079 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
44080 name of the driver to determine which mechanism to support.
44083 Where access to some kind of secret file is required, for example in GSSAPI
44084 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
44085 user, and that the Cyrus SASL library has no way of escalating privileges
44086 by default. You may also find you need to set environment variables,
44087 depending on the driver you are using.
44090 <title>Using cyrus_sasl as a server</title>
44091 <para revisionflag="changed">
44092 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
44093 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
44094 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
44095 use of this variable for this purpose is now deprecated, as it can lead to
44096 confusion in string expansions that also use numeric variables for other
44100 <indexterm role="option">
44101 <primary>server_hostname</primary>
44104 <informaltable frame="all">
44105 <tgroup cols="4" colsep="0" rowsep="0">
44106 <colspec colwidth="8*" align="left"/>
44107 <colspec colwidth="5*" align="center"/>
44108 <colspec colwidth="5*" align="center"/>
44109 <colspec colwidth="6*" align="right"/>
44112 <entry><option>server_hostname</option></entry>
44113 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
44114 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44115 <entry>Default: <emphasis><literal>$primary_hostname</literal></emphasis></entry>
44121 This option selects the hostname that is used when communicating with
44122 the library. It is up to the underlying SASL plug-in what it does with
44126 <indexterm role="option">
44127 <primary>server_mech</primary>
44130 <informaltable frame="all">
44131 <tgroup cols="4" colsep="0" rowsep="0">
44132 <colspec colwidth="8*" align="left"/>
44133 <colspec colwidth="5*" align="center"/>
44134 <colspec colwidth="5*" align="center"/>
44135 <colspec colwidth="6*" align="right"/>
44138 <entry><option>server_mech</option></entry>
44139 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
44140 <entry>Type: <emphasis>string</emphasis></entry>
44141 <entry>Default: <emphasis><literal>public_name</literal></emphasis></entry>
44147 This option selects the authentication mechanism this driver should
44148 use. It allows you to use a different underlying mechanism from the
44149 advertised name. For example:
44151 <literallayout class="monospaced" revisionflag="changed">
44153 driver = cyrus_sasl
44154 public_name = X-ANYTHING
44155 server_mech = CRAM-MD5
44156 server_set_id = $auth1
44159 <indexterm role="option">
44160 <primary>server_realm</primary>
44163 <informaltable frame="all">
44164 <tgroup cols="4" colsep="0" rowsep="0">
44165 <colspec colwidth="8*" align="left"/>
44166 <colspec colwidth="5*" align="center"/>
44167 <colspec colwidth="5*" align="center"/>
44168 <colspec colwidth="6*" align="right"/>
44171 <entry><option>server_realm</option></entry>
44172 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
44173 <entry>Type: <emphasis>string</emphasis></entry>
44174 <entry>Default: <emphasis>unset</emphasis></entry>
44180 This specifies the SASL realm that the server claims to be in.
44183 <indexterm role="option">
44184 <primary>server_service</primary>
44187 <informaltable frame="all">
44188 <tgroup cols="4" colsep="0" rowsep="0">
44189 <colspec colwidth="8*" align="left"/>
44190 <colspec colwidth="5*" align="center"/>
44191 <colspec colwidth="5*" align="center"/>
44192 <colspec colwidth="6*" align="right"/>
44195 <entry><option>server_service</option></entry>
44196 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
44197 <entry>Type: <emphasis>string</emphasis></entry>
44198 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
44204 This is the SASL service that the server claims to implement.
44207 For straightforward cases, you do not need to set any of the authenticator’s
44208 private options. All you need to do is to specify an appropriate mechanism as
44209 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
44210 PLAIN, you could have two authenticators as follows:
44212 <literallayout class="monospaced" revisionflag="changed">
44214 driver = cyrus_sasl
44215 public_name = CRAM-MD5
44216 server_set_id = $auth1
44219 driver = cyrus_sasl
44220 public_name = PLAIN
44221 server_set_id = $auth1
44224 Cyrus SASL does implement the LOGIN authentication method, even though it is
44225 not a standard method. It is disabled by default in the source distribution,
44226 but it is present in many binary distributions.
44227 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
44228 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
44233 <chapter id="CHAPspa">
44234 <title>The spa authenticator</title>
44236 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
44237 <primary><command>spa</command> authenticator</primary>
44239 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
44240 <primary>authenticators</primary>
44241 <secondary><command>spa</command></secondary>
44243 <indexterm role="concept">
44244 <primary>authentication</primary>
44245 <secondary>Microsoft Secure Password</secondary>
44247 <indexterm role="concept">
44248 <primary>authentication</primary>
44249 <secondary>NTLM</secondary>
44251 <indexterm role="concept">
44252 <primary>Microsoft Secure Password Authentication</primary>
44254 <indexterm role="concept">
44255 <primary>NTLM authentication</primary>
44257 The <command>spa</command> authenticator provides client support for Microsoft’s <emphasis>Secure
44258 Password Authentication</emphasis> mechanism,
44259 which is also sometimes known as NTLM (NT LanMan). The code for client side of
44260 this authenticator was contributed by Marc Prud’hommeaux, and much of it is
44261 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
44262 server side was subsequently contributed by Tom Kistner. The mechanism works as
44268 After the AUTH command has been accepted, the client sends an SPA
44269 authentication request based on the user name and optional domain.
44274 The server sends back a challenge.
44279 The client builds a challenge response which makes use of the user’s password
44280 and sends it to the server, which then accepts or rejects it.
44285 Encryption is used to protect the password in transit.
44288 <title>Using spa as a server</title>
44290 <indexterm role="concept">
44291 <primary>options</primary>
44292 <secondary><command>spa</command> authenticator (server)</secondary>
44294 The <command>spa</command> authenticator has just one server option:
44297 <indexterm role="option">
44298 <primary>server_password</primary>
44301 <informaltable frame="all">
44302 <tgroup cols="4" colsep="0" rowsep="0">
44303 <colspec colwidth="8*" align="left"/>
44304 <colspec colwidth="5*" align="center"/>
44305 <colspec colwidth="5*" align="center"/>
44306 <colspec colwidth="6*" align="right"/>
44309 <entry><option>server_password</option></entry>
44310 <entry>Use: <emphasis>spa</emphasis></entry>
44311 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44312 <entry>Default: <emphasis>unset</emphasis></entry>
44318 <indexterm role="concept">
44319 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
44320 <secondary>in <command>spa</command> authenticator</secondary>
44323 <para revisionflag="changed">
44324 This option is expanded, and the result must be the cleartext password for the
44325 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
44326 compatibility with previous releases of Exim, the user name is also placed in
44327 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
44328 it can lead to confusion in string expansions that also use numeric variables
44329 for other things. For example:
44331 <literallayout class="monospaced" revisionflag="changed">
44335 server_password = \
44336 ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
44339 If the expansion is forced to fail, authentication fails. Any other expansion
44340 failure causes a temporary error code to be returned.
44344 <title>Using spa as a client</title>
44346 <indexterm role="concept">
44347 <primary>options</primary>
44348 <secondary><command>spa</command> authenticator (client)</secondary>
44350 The <command>spa</command> authenticator has the following client options:
44353 <indexterm role="option">
44354 <primary>client_domain</primary>
44357 <informaltable frame="all">
44358 <tgroup cols="4" colsep="0" rowsep="0">
44359 <colspec colwidth="8*" align="left"/>
44360 <colspec colwidth="5*" align="center"/>
44361 <colspec colwidth="5*" align="center"/>
44362 <colspec colwidth="6*" align="right"/>
44365 <entry><option>client_domain</option></entry>
44366 <entry>Use: <emphasis>spa</emphasis></entry>
44367 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44368 <entry>Default: <emphasis>unset</emphasis></entry>
44374 This option specifies an optional domain for the authentication.
44377 <indexterm role="option">
44378 <primary>client_password</primary>
44381 <informaltable frame="all">
44382 <tgroup cols="4" colsep="0" rowsep="0">
44383 <colspec colwidth="8*" align="left"/>
44384 <colspec colwidth="5*" align="center"/>
44385 <colspec colwidth="5*" align="center"/>
44386 <colspec colwidth="6*" align="right"/>
44389 <entry><option>client_password</option></entry>
44390 <entry>Use: <emphasis>spa</emphasis></entry>
44391 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44392 <entry>Default: <emphasis>unset</emphasis></entry>
44398 This option specifies the user’s password, and must be set.
44401 <indexterm role="option">
44402 <primary>client_username</primary>
44405 <informaltable frame="all">
44406 <tgroup cols="4" colsep="0" rowsep="0">
44407 <colspec colwidth="8*" align="left"/>
44408 <colspec colwidth="5*" align="center"/>
44409 <colspec colwidth="5*" align="center"/>
44410 <colspec colwidth="6*" align="right"/>
44413 <entry><option>client_username</option></entry>
44414 <entry>Use: <emphasis>spa</emphasis></entry>
44415 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44416 <entry>Default: <emphasis>unset</emphasis></entry>
44422 This option specifies the user name, and must be set. Here is an example of a
44423 configuration of this authenticator for use with the mail servers at
44424 <emphasis>msn.com</emphasis>:
44426 <literallayout class="monospaced">
44430 client_username = msn/msn_username
44431 client_password = msn_plaintext_password
44432 client_domain = DOMAIN_OR_UNSET
44435 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
44436 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
44441 <chapter id="CHAPTLS">
44442 <title>Encrypted SMTP connections using TLS/SSL</title>
44443 <titleabbrev>Encrypted SMTP connections</titleabbrev>
44445 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
44446 <primary>encryption</primary>
44447 <secondary>on SMTP connection</secondary>
44449 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
44450 <primary>SMTP</primary>
44451 <secondary>encryption</secondary>
44453 <indexterm role="concept">
44454 <primary>TLS</primary>
44455 <secondary>on SMTP connection</secondary>
44457 <indexterm role="concept">
44458 <primary>OpenSSL</primary>
44460 <indexterm role="concept">
44461 <primary>GnuTLS</primary>
44463 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
44464 Sockets Layer), is implemented by making use of the OpenSSL library or the
44465 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
44466 cryptographic code in the Exim distribution itself for implementing TLS. In
44467 order to use this feature you must install OpenSSL or GnuTLS, and then build a
44468 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
44469 You also need to understand the basic concepts of encryption at a managerial
44470 level, and in particular, the way that public keys, private keys, and
44471 certificates are used.
44474 RFC 3207 defines how SMTP connections can make use of encryption. Once a
44475 connection is established, the client issues a STARTTLS command. If the
44476 server accepts this, the client and the server negotiate an encryption
44477 mechanism. If the negotiation succeeds, the data that subsequently passes
44478 between them is encrypted.
44481 Exim’s ACLs can detect whether the current SMTP session is encrypted or not,
44482 and if so, what cipher suite is in use, whether the client supplied a
44483 certificate, and whether or not that certificate was verified. This makes it
44484 possible for an Exim server to deny or accept certain commands based on the
44488 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
44489 disrupt TLS connections. You need to turn off SMTP scanning for these products
44490 in order to get TLS to work.
44493 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
44495 <indexterm role="concept">
44496 <primary>ssmtp protocol</primary>
44498 <indexterm role="concept">
44499 <primary>smtps protocol</primary>
44501 <indexterm role="concept">
44502 <primary>SMTP</primary>
44503 <secondary>ssmtp protocol</secondary>
44505 <indexterm role="concept">
44506 <primary>SMTP</primary>
44507 <secondary>smtps protocol</secondary>
44509 Early implementations of encrypted SMTP used a different TCP port from normal
44510 SMTP, and expected an encryption negotiation to start immediately, instead of
44511 waiting for a STARTTLS command from the client using the standard SMTP
44512 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
44513 allocated for this purpose.
44516 This approach was abandoned when encrypted SMTP was standardised, but there are
44517 still some legacy clients that use it. Exim supports these clients by means of
44518 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
44519 numbers; the most common use is expected to be:
44521 <literallayout class="monospaced">
44522 tls_on_connect_ports = 465
44525 The port numbers specified by this option apply to all SMTP connections, both
44526 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
44527 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
44528 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
44529 an extra port – rather, it specifies different behaviour on a port that is
44533 There is also a <option>-tls-on-connect</option> command line option. This overrides
44534 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
44537 <section id="SECTopenvsgnu">
44538 <title>OpenSSL vs GnuTLS</title>
44540 <indexterm role="concept">
44541 <primary>TLS</primary>
44542 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
44544 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
44545 followed later, when the first versions of GnuTLS were released. To build Exim
44546 to use GnuTLS, you need to set
44548 <literallayout class="monospaced">
44552 in Local/Makefile, in addition to
44554 <literallayout class="monospaced">
44558 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
44559 include files and libraries for GnuTLS can be found.
44562 There are some differences in usage when using GnuTLS instead of OpenSSL:
44567 The <option>tls_verify_certificates</option> option must contain the name of a file, not the
44568 name of a directory (for OpenSSL it can be either).
44573 The <option>tls_dhparam</option> option is ignored, because early versions of GnuTLS had no
44574 facility for varying its Diffie-Hellman parameters. I understand that this has
44575 changed, but Exim has not been updated to provide this facility.
44580 <indexterm role="concept">
44581 <primary><varname>$tls_peerdn</varname></primary>
44583 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
44584 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
44585 affects the value of the <varname>$tls_peerdn</varname> variable.
44590 OpenSSL identifies cipher suites using hyphens as separators, for example:
44591 DES-CBC3-SHA. GnuTLS uses underscores, for example: RSA_ARCFOUR_SHA. What is
44592 more, OpenSSL complains if underscores are present in a cipher list. To make
44593 life simpler, Exim changes underscores to hyhens for OpenSSL and hyphens to
44594 underscores for GnuTLS when processing lists of cipher suites in the
44595 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
44601 The <option>tls_require_ciphers</option> options operate differently, as described in the
44602 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
44608 <title>GnuTLS parameter computation</title>
44610 GnuTLS uses RSA and D-H parameters that take a substantial amount of time to
44611 compute. It is unreasonable to re-compute them for every TLS session.
44612 Therefore, Exim keeps this data in a file in its spool directory, called
44613 <filename>gnutls-params</filename>. The file is owned by the Exim user and is readable only by
44614 its owner. Every Exim process that start up GnuTLS reads the RSA and D-H
44615 parameters from this file. If the file does not exist, the first Exim process
44616 that needs it computes the data and writes it to a temporary file which is
44617 renamed once it is complete. It does not matter if several Exim processes do
44618 this simultaneously (apart from wasting a few resources). Once a file is in
44619 place, new Exim processes immediately start using it.
44622 For maximum security, the parameters that are stored in this file should be
44623 recalculated periodically, the frequency depending on your paranoia level.
44624 Arranging this is easy in principle; just delete the file when you want new
44625 values to be computed. However, there may be a problem. The calculation of new
44626 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
44627 If the system is not very active, <filename>/dev/random</filename> may delay returning data
44628 until enough randomness (entropy) is available. This may cause Exim to hang for
44629 a substantial amount of time, causing timeouts on incoming connections.
44632 The solution is to generate the parameters externally to Exim. They are stored
44633 in <filename>gnutls-params</filename> in PEM format, which means that they can be generated
44634 externally using the <command>certtool</command> command that is part of GnuTLS.
44637 To replace the parameters with new ones, instead of deleting the file
44638 and letting Exim re-create it, you can generate new parameters using
44639 <command>certtool</command> and, when this has been done, replace Exim’s cache file by
44640 renaming. The relevant commands are something like this:
44642 <literallayout class="monospaced">
44645 # chown exim:exim new-params
44646 # chmod 0400 new-params
44647 # certtool --generate-privkey --bits 512 >new-params
44648 # echo "" >>new-params
44649 # certtool --generate-dh-params --bits 1024 >> new-params
44650 # mv new-params gnutls-params
44653 If Exim never has to generate the parameters itself, the possibility of
44654 stalling is removed.
44657 <section id="SECTreqciphssl">
44658 <title>Requiring specific ciphers in OpenSSL</title>
44660 <indexterm role="concept">
44661 <primary>TLS</primary>
44662 <secondary>requiring specific ciphers (OpenSSL)</secondary>
44664 <indexterm role="concept">
44665 <primary><option>tls_require_ciphers</option></primary>
44666 <secondary>OpenSSL</secondary>
44668 There is a function in the OpenSSL library that can be passed a list of cipher
44669 suites before the cipher negotiation takes place. This specifies which ciphers
44670 are acceptable. The list is colon separated and may contain names like
44671 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
44672 directly to this function call. The following quotation from the OpenSSL
44673 documentation specifies what forms of item are allowed in the cipher string:
44678 It can consist of a single cipher suite such as RC4-SHA.
44683 It can represent a list of cipher suites containing a certain algorithm,
44684 or cipher suites of a certain type. For example SHA1 represents all
44685 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
44691 Lists of cipher suites can be combined in a single cipher string using
44692 the + character. This is used as a logical and operation. For example
44693 SHA1+DES represents all cipher suites containing the SHA1 and the DES
44699 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
44700 <literal>-</literal> or <literal>+</literal>.
44705 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
44706 ciphers deleted can never reappear in the list even if they are explicitly
44712 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
44713 of the ciphers can be added again by later options.
44718 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
44719 option does not add any new ciphers; it just moves matching existing ones.
44724 If none of these characters is present, the string is interpreted as
44725 a list of ciphers to be appended to the current preference list. If the list
44726 includes any ciphers already present they will be ignored: that is, they will
44727 not be moved to the end of the list.
44730 <section id="SECTreqciphgnu">
44731 <title>Requiring specific ciphers in GnuTLS</title>
44733 <indexterm role="concept">
44734 <primary>TLS</primary>
44735 <secondary>requiring specific ciphers (GnuTLS)</secondary>
44737 <indexterm role="concept">
44738 <primary><option>tls_require_ciphers</option></primary>
44739 <secondary>GnuTLS</secondary>
44741 The GnuTLS library does not have a combined function like OpenSSL. Instead,
44742 it allows the caller to specify separate lists of key-exchange methods,
44743 main cipher algorithms, and MAC algorithms. Unfortunately, these lists are
44744 numerical, and the library does not have a function for turning names into
44745 numbers. Consequently, the list of recognized names has to be built into
44749 At present, Exim permits only the list of main cipher algorithms to be
44750 changed. The <option>tls_require_ciphers</option> option is in the same format as for
44751 OpenSSL. Exim searches each item for the name of available algorithm. For
44752 example, if the list contains RSA_AES_SHA then AES is recognized.
44755 The cipher algorithms list starts out with a default set of algorithms. If
44756 the first item in <option>tls_require_ciphers</option> does <emphasis>not</emphasis> start with an
44757 exclamation mark, all the default items are deleted. Thus, only those specified
44758 can be used. If the first item in <option>tls_require_ciphers</option> <emphasis>does</emphasis> start with
44759 an exclamation mark, the defaults are left on the list.
44762 Then, any item that starts with an exclamation mark causes the relevant
44763 algorithms to be removed from the list, and any item that does not start
44764 with an exclamation mark causes the relevant algorithms to be added to the
44767 <literallayout class="monospaced">
44768 tls_require_ciphers = !RSA_ARCFOUR_SHA
44771 allows all the defaults except those that use ARCFOUR, whereas
44773 <literallayout class="monospaced">
44774 tls_require_ciphers = AES : 3DES
44777 allows only cipher suites that use AES and 3DES. The currently recognized
44778 algorithms are: AES_256, AES_128, AES (both of the preceding), 3DES, and
44779 ARCFOUR_128. Unrecognized algorithms are ignored. In a server, the order of the
44780 list is unimportant; the server will advertise the availability of all the
44781 relevant cipher suites. However, in a client, the order of the list specifies a
44782 preference order for the algorithms. The first one in the client’s list that is
44783 also advertised by the server is tried first. The default order is as listed
44788 <title>Configuring an Exim server to use TLS</title>
44790 <indexterm role="concept">
44791 <primary>TLS</primary>
44792 <secondary>configuring an Exim server</secondary>
44794 When Exim has been built with TLS support, it advertises the availability of
44795 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
44796 but not to any others. The default value of this option is unset, which means
44797 that STARTTLS is not advertised at all. This default is chosen because you
44798 need to set some other options in order to make TLS avaliable, and also it is
44799 sensible for systems that want to use TLS only as a client.
44802 If a client issues a STARTTLS command and there is some configuration
44803 problem in the server, the command is rejected with a 454 error. If the client
44804 persists in trying to issue SMTP commands, all except QUIT are rejected
44807 <literallayout class="monospaced">
44808 554 Security failure
44811 If a STARTTLS command is issued within an existing TLS session, it is
44812 rejected with a 554 error code.
44815 To enable TLS operations on a server, you must set <option>tls_advertise_hosts</option> to
44816 match some hosts. You can, of course, set it to * to match all hosts.
44817 However, this is not all you need to do. TLS sessions to a server won’t work
44818 without some further configuration at the server end.
44821 It is rumoured that all existing clients that support TLS/SSL use RSA
44822 encryption. To make this work you need to set, in the server,
44824 <literallayout class="monospaced">
44825 tls_certificate = /some/file/name
44826 tls_privatekey = /some/file/name
44828 <para revisionflag="changed">
44829 These options are, in fact, expanded strings, so you can make them depend on
44830 the identity of the client that is connected if you wish. The first file
44831 contains the server’s X509 certificate, and the second contains the private key
44832 that goes with it. These files need to be readable by the Exim user, and must
44833 always be given as full path names. They can be the same file if both the
44834 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
44835 set, or if its expansion is forced to fail or results in an empty string, this
44836 is assumed to be the case. The certificate file may also contain intermediate
44837 certificates that need to be sent to the client to enable it to authenticate
44838 the server’s certificate.
44841 If you do not understand about certificates and keys, please try to find a
44842 source of this background information, which is not Exim-specific. (There are a
44843 few comments below in section <xref linkend="SECTcerandall"/>.)
44845 <para revisionflag="changed">
44846 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client –
44847 they apply only in the case of a server. If you need to use a certificate in an
44848 Exim client, you must set the options of the same names in an <command>smtp</command>
44851 <para revisionflag="changed">
44852 With just these options, an Exim server will be able to use TLS. It does not
44853 require the client to have a certificate (but see below for how to insist on
44854 this). There is one other option that may be needed in other situations. If
44856 <literallayout class="monospaced">
44857 tls_dhparam = /some/file/name
44860 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
44861 with the parameters contained in the file. This increases the set of cipher
44862 suites that the server supports. See the command
44864 <literallayout class="monospaced">
44868 for a way of generating this data. At present, <option>tls_dhparam</option> is used only
44869 when Exim is linked with OpenSSL. It is ignored if GnuTLS is being used.
44872 The strings supplied for these three options are expanded every time a client
44873 host connects. It is therefore possible to use different certificates and keys
44874 for different hosts, if you so wish, by making use of the client’s IP address
44875 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
44876 forced to fail, Exim behaves as if the option is not set.
44879 <indexterm role="concept">
44880 <primary>cipher</primary>
44881 <secondary>logging</secondary>
44883 <indexterm role="concept">
44884 <primary>log</primary>
44885 <secondary>TLS cipher</secondary>
44887 <indexterm role="concept">
44888 <primary><varname>$tls_cipher</varname></primary>
44890 The variable <varname>$tls_cipher</varname> is set to the cipher suite that was negotiated for
44891 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
44892 incoming message (by default – you can, of course, change this), and it is
44893 also included in the log line that records a message’s arrival, keyed by
44894 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
44895 condition can be used to test for specific cipher suites in ACLs.
44898 The ACLs that run for subsequent SMTP commands can check the name of the cipher
44899 suite and vary their actions accordingly. The cipher suite names are those used
44900 by OpenSSL. These may differ from the names used elsewhere. For example,
44901 OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other contexts
44902 is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL
44903 documentation for more details.
44907 <title>Requesting and verifying client certificates</title>
44909 <indexterm role="concept">
44910 <primary>certificate</primary>
44911 <secondary>verification of client</secondary>
44913 <indexterm role="concept">
44914 <primary>TLS</primary>
44915 <secondary>client certificate verification</secondary>
44917 If you want an Exim server to request a certificate when negotiating a TLS
44918 session with a client, you must set either <option>tls_verify_hosts</option> or
44919 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
44920 apply to all TLS connections. For any host that matches one of these options,
44921 Exim requests a certificate as part of the setup of the TLS session. The
44922 contents of the certificate are verified by comparing it with a list of
44923 expected certificates. These must be available in a file or,
44924 for OpenSSL only (not GnuTLS), a directory, identified by
44925 <option>tls_verify_certificates</option>.
44928 A file can contain multiple certificates, concatenated end to end. If a
44931 each certificate must be in a separate file, with a name (or a symbolic link)
44932 of the form <<emphasis>hash</emphasis>>.0, where <<emphasis>hash</emphasis>> is a hash value constructed from the
44933 certificate. You can compute the relevant hash by running the command
44935 <literallayout class="monospaced">
44936 openssl x509 -hash -noout -in /cert/file
44939 where <filename>/cert/file</filename> contains a single certificate.
44942 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
44943 what happens if the client does not supply a certificate, or if the certificate
44944 does not match any of the certificates in the collection named by
44945 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
44946 attempt to set up a TLS session is aborted, and the incoming connection is
44947 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
44948 session continues. ACLs that run for subsequent SMTP commands can detect the
44949 fact that no certificate was verified, and vary their actions accordingly. For
44950 example, you can insist on a certificate before accepting a message for
44951 relaying, but not when the message is destined for local delivery.
44954 <indexterm role="concept">
44955 <primary><varname>$tls_peerdn</varname></primary>
44957 When a client supplies a certificate (whether it verifies or not), the value of
44958 the Distinguished Name of the certificate is made available in the variable
44959 <varname>$tls_peerdn</varname> during subsequent processing of the message.
44962 <indexterm role="concept">
44963 <primary>log</primary>
44964 <secondary>distinguished name</secondary>
44966 Because it is often a long text string, it is not included in the log line or
44967 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
44968 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
44969 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
44970 certificate is supplied, <varname>$tls_peerdn</varname> is empty.
44974 <title>Revoked certificates</title>
44976 <indexterm role="concept">
44977 <primary>TLS</primary>
44978 <secondary>revoked certificates</secondary>
44980 <indexterm role="concept">
44981 <primary>revocation list</primary>
44983 <indexterm role="concept">
44984 <primary>certificate</primary>
44985 <secondary>revocation list</secondary>
44987 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
44988 certificates are revoked. If you have such a list, you can pass it to an Exim
44989 server using the global option called <option>tls_crl</option> and to an Exim client using
44990 an identically named option for the <command>smtp</command> transport. In each case, the value
44991 of the option is expanded and must then be the name of a file that contains a
44996 <title>Configuring an Exim client to use TLS</title>
44998 <indexterm role="concept">
44999 <primary>cipher</primary>
45000 <secondary>logging</secondary>
45002 <indexterm role="concept">
45003 <primary>log</primary>
45004 <secondary>TLS cipher</secondary>
45006 <indexterm role="concept">
45007 <primary>log</primary>
45008 <secondary>distinguished name</secondary>
45010 <indexterm role="concept">
45011 <primary>TLS</primary>
45012 <secondary>configuring an Exim client</secondary>
45014 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
45015 deliveries as well as to incoming, the latter one causing logging of the
45016 server certificate’s DN. The remaining client configuration for TLS is all
45017 within the <command>smtp</command> transport.
45020 It is not necessary to set any options to have TLS work in the <command>smtp</command>
45021 transport. If Exim is built with TLS support, and TLS is advertised by a
45022 server, the <command>smtp</command> transport always tries to start a TLS session. However,
45023 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
45024 transport) to a list of server hosts for which TLS should not be used.
45027 If you do not want Exim to attempt to send messages unencrypted when an attempt
45028 to set up an encrypted connection fails in any way, you can set
45029 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
45030 those hosts, delivery is always deferred if an encrypted connection cannot be
45031 set up. If there are any other hosts for the address, they are tried in the
45035 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
45036 the message unencrypted. It always does this if the response to STARTTLS is
45037 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
45038 session after a success response code, what happens is controlled by the
45039 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
45040 delivery to this host is deferred, and other hosts (if available) are tried. If
45041 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
45042 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
45043 negotiation fails, Exim closes the current connection (because it is in an
45044 unknown state), opens a new one to the same host, and then tries the delivery
45048 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
45049 transport provide the client with a certificate, which is passed to the server
45050 if it requests it. If the server is Exim, it will request a certificate only if
45051 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client. <emphasis role="bold">Note</emphasis>:
45052 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
45053 is operating as a client. Exim does not assume that a server certificate (set
45054 by the global options of the same name) should also be used when operating as a
45058 If <option>tls_verify_certificates</option> is set, it must name a file or,
45059 for OpenSSL only (not GnuTLS), a directory, that contains a collection of
45060 expected server certificates. The client verifies the server’s certificate
45061 against this collection, taking into account any revoked certificates that are
45062 in the list defined by <option>tls_crl</option>.
45066 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
45067 list of permitted cipher suites. If either of these checks fails, delivery to
45068 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
45069 alternative hosts, if any.
45072 <indexterm role="concept">
45073 <primary><varname>$host</varname></primary>
45075 <indexterm role="concept">
45076 <primary><varname>$host_address</varname></primary>
45078 All the TLS options in the <command>smtp</command> transport are expanded before use, with
45079 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
45080 which the client is connected. Forced failure of an expansion causes Exim to
45081 behave as if the relevant option were unset.
45084 <section id="SECTmulmessam">
45085 <title>Multiple messages on the same encrypted TCP/IP connection</title>
45087 <indexterm role="concept">
45088 <primary>multiple SMTP deliveries with TLS</primary>
45090 <indexterm role="concept">
45091 <primary>TLS</primary>
45092 <secondary>multiple message deliveries</secondary>
45094 Exim sends multiple messages down the same TCP/IP connection by starting up
45095 an entirely new delivery process for each message, passing the socket from
45096 one process to the next. This implementation does not fit well with the use
45097 of TLS, because there is quite a lot of state information associated with a TLS
45098 connection, not just a socket identification. Passing all the state information
45099 to a new process is not feasible. Consequently, Exim shuts down an existing TLS
45100 session before passing the socket to a new process. The new process may then
45101 try to start a new TLS session, and if successful, may try to re-authenticate
45102 if AUTH is in use, before sending the next message.
45105 The RFC is not clear as to whether or not an SMTP session continues in clear
45106 after TLS has been shut down, or whether TLS may be restarted again later, as
45107 just described. However, if the server is Exim, this shutdown and
45108 reinitialization works. It is not known which (if any) other servers operate
45109 successfully if the client closes a TLS session and continues with unencrypted
45110 SMTP, but there are certainly some that do not work. For such servers, Exim
45111 should not pass the socket to another process, because the failure of the
45112 subsequent attempt to use it would cause Exim to record a temporary host error,
45113 and delay other deliveries to that host.
45116 To test for this case, Exim sends an EHLO command to the server after
45117 closing down the TLS session. If this fails in any way, the connection is
45118 closed instead of being passed to a new delivery process, but no retry
45119 information is recorded.
45122 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
45123 <command>smtp</command> transport to match those hosts for which Exim should not pass
45124 connections to new processes if TLS has been used.
45127 <section id="SECTcerandall">
45128 <title>Certificates and all that</title>
45130 <indexterm role="concept">
45131 <primary>certificate</primary>
45132 <secondary>references to discussion</secondary>
45134 In order to understand fully how TLS works, you need to know about
45135 certificates, certificate signing, and certificate authorities. This is not the
45136 place to give a tutorial, especially as I do not know very much about it
45137 myself. Some helpful introduction can be found in the FAQ for the SSL addition
45138 to Apache, currently at
45141 <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>
45144 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
45145 links to further files.
45146 Eric Rescorla’s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
45147 0-201-61598-3), contains both introductory and more in-depth descriptions.
45148 Some sample programs taken from the book are available from
45151 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
45155 <title>Certificate chains</title>
45157 The file named by <option>tls_certificate</option> may contain more than one
45158 certificate. This is useful in the case where the certificate that is being
45159 sent is validated by an intermediate certificate which the other end does
45160 not have. Multiple certificates must be in the correct order in the file.
45161 First the host’s certificate itself, then the first intermediate
45162 certificate to validate the issuer of the host certificate, then the next
45163 intermediate certificate to validate the issuer of the first intermediate
45164 certificate, and so on, until finally (optionally) the root certificate.
45165 The root certificate must already be trusted by the recipient for
45166 validation to succeed, of course, but if it’s not preinstalled, sending the
45167 root certificate along with the rest makes it available for the user to
45168 install if the receiving end is a client MUA that can interact with a user.
45172 <title>Self-signed certificates</title>
45174 <indexterm role="concept">
45175 <primary>certificate</primary>
45176 <secondary>self-signed</secondary>
45178 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
45179 with OpenSSL, like this:
45181 <literallayout class="monospaced">
45182 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
45186 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
45187 delimited and so can be identified independently. The <option>-days</option> option
45188 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
45189 important: if you do not set it, the key is encrypted with a passphrase
45190 that you are prompted for, and any use that is made of the key causes more
45191 prompting for the passphrase. This is not helpful if you are going to use
45192 this certificate and key in an MTA, where prompting is not possible.
45195 A self-signed certificate made in this way is sufficient for testing, and
45196 may be adequate for all your requirements if you are mainly interested in
45197 encrypting transfers, and not in secure identification.
45200 However, many clients require that the certificate presented by the server be a
45201 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
45202 certificate. In this situation, the self-signed certificate described above
45203 must be installed on the client host as a trusted root <emphasis>certification
45204 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
45205 signed with that self-signed certificate.
45208 For information on creating self-signed CA certificates and using them to sign
45209 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
45210 Open-source PKI book, available online at
45211 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
45212 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
45213 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
45218 <chapter id="CHAPACL">
45219 <title>Access control lists</title>
45221 <indexterm role="concept" id="IIDacl" class="startofrange">
45222 <primary>access control lists (ACLs)</primary>
45223 <secondary>description</secondary>
45225 <indexterm role="concept">
45226 <primary>control of incoming mail</primary>
45228 <indexterm role="concept">
45229 <primary>message</primary>
45230 <secondary>controlling incoming</secondary>
45232 <indexterm role="concept">
45233 <primary>policy control</primary>
45234 <secondary>access control lists</secondary>
45236 Access Control Lists (ACLs) are defined in a separate section of the run time
45237 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
45238 name, terminated by a colon. Here is a complete ACL section that contains just
45239 one very small ACL:
45241 <literallayout class="monospaced">
45245 accept hosts = one.host.only
45248 You can have as many lists as you like in the ACL section, and the order in
45249 which they appear does not matter. The lists are self-terminating.
45252 The majority of ACLs are used to control Exim’s behaviour when it receives
45253 certain SMTP commands. This applies both to incoming TCP/IP connections, and
45254 when a local process submits a message using SMTP by specifying the <option>-bs</option>
45255 option. The most common use is for controlling which recipients are accepted
45256 in incoming messages. In addition, you can define an ACL that is used to check
45257 local non-SMTP messages. The default configuration file contains an example of
45258 a realistic ACL for checking RCPT commands. This is discussed in chapter
45259 <xref linkend="CHAPdefconfil"/>.
45262 <title>Testing ACLs</title>
45264 The <option>-bh</option> command line option provides a way of testing your ACL
45265 configuration locally by running a fake SMTP session with which you interact.
45266 The host <emphasis>relay-test.mail-abuse.org</emphasis> provides a service for checking your
45267 relaying configuration (see section <xref linkend="SECTcheralcon"/> for more details).
45271 <title>Specifying when ACLs are used</title>
45273 <indexterm role="concept">
45274 <primary>access control lists (ACLs)</primary>
45275 <secondary>options for specifying</secondary>
45277 In order to cause an ACL to be used, you have to name it in one of the relevant
45278 options in the main part of the configuration. These options are:
45279 <indexterm role="concept">
45280 <primary>AUTH</primary>
45281 <secondary>ACL for</secondary>
45283 <indexterm role="concept">
45284 <primary>DATA</primary>
45285 <secondary>ACLs for</secondary>
45287 <indexterm role="concept">
45288 <primary>ETRN</primary>
45289 <secondary>ACL for</secondary>
45291 <indexterm role="concept">
45292 <primary>EXPN</primary>
45293 <secondary>ACL for</secondary>
45295 <indexterm role="concept">
45296 <primary>HELO</primary>
45297 <secondary>ACL for</secondary>
45299 <indexterm role="concept">
45300 <primary>EHLO</primary>
45301 <secondary>ACL for</secondary>
45303 <indexterm role="concept">
45304 <primary>MAIL</primary>
45305 <secondary>ACL for</secondary>
45307 <indexterm role="concept">
45308 <primary>QUIT</primary>
45309 <secondary>ACL for</secondary>
45311 <indexterm role="concept">
45312 <primary>RCPT</primary>
45313 <secondary>ACL for</secondary>
45315 <indexterm role="concept">
45316 <primary>STARTTLS</primary>
45317 <secondary>ACL for</secondary>
45319 <indexterm role="concept">
45320 <primary>VRFY</primary>
45321 <secondary>ACL for</secondary>
45323 <indexterm role="concept">
45324 <primary>SMTP connection</primary>
45325 <secondary>ACL for</secondary>
45327 <indexterm role="concept">
45328 <primary>non-smtp message</primary>
45329 <secondary>ACL for</secondary>
45332 <informaltable frame="none">
45333 <tgroup cols="2" colsep="0" rowsep="0">
45334 <colspec colwidth="140pt" align="left"/>
45335 <colspec colwidth="260pt" align="left"/>
45338 <entry> <option>acl_not_smtp</option></entry>
45339 <entry>ACL for non-SMTP messages</entry>
45342 <entry> <option>acl_smtp_auth</option></entry>
45343 <entry>ACL for AUTH</entry>
45346 <entry> <option>acl_smtp_connect</option></entry>
45347 <entry>ACL for start of SMTP connection</entry>
45350 <entry> <option>acl_smtp_data</option></entry>
45351 <entry>ACL after DATA is complete</entry>
45354 <entry> <option>acl_smtp_etrn</option></entry>
45355 <entry>ACL for ETRN</entry>
45358 <entry> <option>acl_smtp_expn</option></entry>
45359 <entry>ACL for EXPN</entry>
45362 <entry> <option>acl_smtp_helo</option></entry>
45363 <entry>ACL for HELO or EHLO</entry>
45366 <entry> <option>acl_smtp_mail</option></entry>
45367 <entry>ACL for MAIL</entry>
45370 <entry> <option>acl_smtp_mailauth</option></entry>
45371 <entry>ACL for the AUTH parameter of MAIL</entry>
45374 <entry> <option>acl_smtp_mime</option></entry>
45375 <entry>ACL for content-scanning MIME parts</entry>
45378 <entry> <option>acl_smtp_predata</option></entry>
45379 <entry>ACL at start of DATA command</entry>
45382 <entry> <option>acl_smtp_quit</option></entry>
45383 <entry>ACL for QUIT</entry>
45386 <entry> <option>acl_smtp_rcpt</option></entry>
45387 <entry>ACL for RCPT</entry>
45390 <entry> <option>acl_smtp_starttls</option></entry>
45391 <entry>ACL for STARTTLS</entry>
45394 <entry> <option>acl_smtp_vrfy</option></entry>
45395 <entry>ACL for VRFY</entry>
45401 For example, if you set
45403 <literallayout class="monospaced">
45404 acl_smtp_rcpt = small_acl
45407 the little ACL defined above is used whenever Exim receives a RCPT command
45408 in an SMTP dialogue. The majority of policy tests on incoming messages can be
45409 done when RCPT commands arrive. A rejection of RCPT should cause the
45410 sending MTA to give up on the recipient address contained in the RCPT
45411 command, whereas rejection at other times may cause the client MTA to keep on
45412 trying to deliver the message. It is therefore recommended that you do as much
45413 testing as possible at RCPT time.
45417 <title>The non-SMTP ACL</title>
45419 <indexterm role="concept">
45420 <primary>non-smtp message</primary>
45421 <secondary>ACL for</secondary>
45423 The non-SMTP ACL applies to all non-interactive incoming messages, that is, it
45424 applies to batch SMTP as well as to non-SMTP messages. (Batch SMTP is not
45425 really SMTP.) This ACL is run just before the <function>local_scan()</function> function. Any
45426 kind of rejection is treated as permanent, because there is no way of sending a
45427 temporary error for these kinds of message. Many of the ACL conditions (for
45428 example, host tests, and tests on the state of the SMTP connection such as
45429 encryption and authentication) are not relevant and are forbidden in this ACL.
45433 <title>The connect ACL</title>
45435 <indexterm role="concept">
45436 <primary>SMTP connection</primary>
45437 <secondary>ACL for</secondary>
45439 The ACL test specified by <option>acl_smtp_connect</option> happens after the test specified
45440 by <option>host_reject_connection</option> (which is now an anomaly) and any TCP Wrappers
45441 testing (if configured).
45445 <title>The DATA ACLs</title>
45447 <indexterm role="concept">
45448 <primary>DATA</primary>
45449 <secondary>ACLs for</secondary>
45451 Two ACLs are associated with the DATA command, because it is two-stage
45452 command, with two responses being sent to the client.
45453 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
45454 is obeyed. This gives you control after all the RCPT commands, but before
45455 the message itself is received. It offers the opportunity to give a negative
45456 response to the DATA command before the data is transmitted. Header lines
45457 added by MAIL or RCPT ACLs are not visible at this time, but any that
45458 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
45461 You cannot test the contents of the message, for example, to verify addresses
45462 in the headers, at RCPT time or when the DATA command is received. Such
45463 tests have to appear in the ACL that is run after the message itself has been
45464 received, before the final response to the DATA command is sent. This is
45465 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
45466 associated with the DATA command.
45469 For both of these ACLs, it is not possible to reject individual recipients. An
45470 error response rejects the entire message. Unfortunately, it is known that some
45471 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
45472 before or after the data) correctly – they keep the message on their queues
45473 and try again later, but that is their problem, though it does waste some of
45478 <title>The MIME ACL</title>
45480 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
45481 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
45484 <section id="SECTQUITACL">
45485 <title>The QUIT ACL</title>
45487 <indexterm role="concept">
45488 <primary>QUIT</primary>
45489 <secondary>ACL for</secondary>
45491 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
45492 does not affect the response code to QUIT, which is always 221. Thus, the ACL
45493 does not in fact control any access. For this reason, the only verbs that are
45494 permitted are <option>accept</option> and <option>warn</option>.
45497 This ACL can be used for tasks such as custom logging at the end of an SMTP
45498 session. For example, you can use ACL variables in other ACLs to count
45499 messages, recipients, etc., and log the totals at QUIT time using one or
45500 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
45503 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
45504 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
45507 You do not need to have a final <option>accept</option>, but if you do, you can use a
45508 <option>message</option> modifier to specify custom text that is sent as part of the 221
45512 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
45513 failure (for example, failure to open a log file, or when Exim is bombing out
45514 because it has detected an unrecoverable error), all SMTP commands from the
45515 client are given temporary error responses until QUIT is received or the
45516 connection is closed. In these special cases, the QUIT ACL does not run.
45520 <title>Finding an ACL to use</title>
45522 <indexterm role="concept">
45523 <primary>access control lists (ACLs)</primary>
45524 <secondary>finding which to use</secondary>
45526 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so you can
45527 use different ACLs in different circumstances. The resulting string does not
45528 have to be the name of an ACL in the configuration file; there are other
45529 possibilities. Having expanded the string, Exim searches for an ACL as follows:
45534 If the string begins with a slash, Exim uses it as a file name, and reads its
45535 contents as an ACL. The lines are processed in the same way as lines in the
45536 Exim configuration file. In particular, continuation lines are supported, blank
45537 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
45538 If the file does not exist or cannot be read, an error occurs (typically
45539 causing a temporary failure of whatever caused the ACL to be run). For example:
45541 <literallayout class="monospaced">
45542 acl_smtp_data = /etc/acls/\
45543 ${lookup{$sender_host_address}lsearch\
45544 {/etc/acllist}{$value}{default}}
45547 This looks up an ACL file to use on the basis of the host’s IP address, falling
45548 back to a default if the lookup fails. If an ACL is successfully read from a
45549 file, it is retained in memory for the duration of the Exim process, so that it
45550 can be re-used without having to re-read the file.
45555 If the string does not start with a slash, and does not contain any spaces,
45556 Exim searches the ACL section of the configuration for an ACL whose name
45557 matches the string.
45562 If no named ACL is found, or if the string contains spaces, Exim parses
45563 the string as an inline ACL. This can save typing in cases where you just
45564 want to have something like
45566 <literallayout class="monospaced">
45567 acl_smtp_vrfy = accept
45570 in order to allow free use of the VRFY command. Such a string may contain
45571 newlines; it is processed in the same way as an ACL that is read from a file.
45577 <title>ACL return codes</title>
45579 <indexterm role="concept">
45580 <primary>access control lists (ACLs)</primary>
45581 <secondary>return codes</secondary>
45583 Except for the QUIT ACL, which does not affect the SMTP return code (see
45584 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
45585 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
45586 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
45587 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
45588 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
45589 This also causes a 4<emphasis>xx</emphasis> return code.
45592 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
45593 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
45594 submitters of non-SMTP messages.
45597 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
45598 has the effect of <quote>accept</quote>, but causes either the entire message or an
45599 individual recipient address to be discarded. In other words, it is a
45600 blackholing facility. Use it with care.
45603 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
45604 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
45605 RCPT ACL is to discard just the one recipient address. If there are no
45606 recipients left when the message’s data is received, the DATA ACL is not
45607 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
45608 remaining recipients. The <quote>discard</quote> return is not permitted for the
45609 <option>acl_smtp_predata</option> ACL.
45612 <indexterm role="concept">
45613 <primary><function>local_scan()</function> function</primary>
45614 <secondary>when all recipients discarded</secondary>
45616 The <function>local_scan()</function> function is always run, even if there are no remaining
45617 recipients; it may create new recipients.
45621 <title>Unset ACL options</title>
45623 <indexterm role="concept">
45624 <primary>access control lists (ACLs)</primary>
45625 <secondary>unset options</secondary>
45627 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
45628 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
45629 not defined at all. For any defined ACL, the default action when control
45630 reaches the end of the ACL statements is <quote>deny</quote>.
45633 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
45634 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
45635 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, <option>acl_smtp_quit</option>, and
45636 <option>acl_smtp_starttls</option>, the action when the ACL is not defined is <quote>accept</quote>.
45639 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
45640 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
45641 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
45642 messages over an SMTP connection. For an example, see the ACL in the default
45643 configuration file.
45647 <title>Data for message ACLs</title>
45649 <indexterm role="concept">
45650 <primary>access control lists (ACLs)</primary>
45651 <secondary>data for message ACL</secondary>
45653 <indexterm role="concept">
45654 <primary><varname>$domain</varname></primary>
45656 <indexterm role="concept">
45657 <primary><varname>$local_part</varname></primary>
45659 <indexterm role="concept">
45660 <primary><varname>$sender_address</varname></primary>
45662 <indexterm role="concept">
45663 <primary><varname>$sender_host_address</varname></primary>
45665 <indexterm role="concept">
45666 <primary><varname>$smtp_command</varname></primary>
45668 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
45669 that contain information about the host and the message’s sender (for example,
45670 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
45671 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
45672 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
45673 is available in <varname>$smtp_command</varname>.
45676 When an ACL for the AUTH parameter of MAIL is running, the variables that
45677 contain information about the host are set, but <varname>$sender_address</varname> is not yet
45678 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
45682 <indexterm role="concept">
45683 <primary><varname>$message_size</varname></primary>
45685 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
45686 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
45687 that parameter is not given. The value is updated to the true message size by
45688 the time the final DATA ACL is run (after the message data has been
45692 <indexterm role="concept">
45693 <primary><varname>$rcpt_count</varname></primary>
45695 <indexterm role="concept">
45696 <primary><varname>$recipients_count</varname></primary>
45698 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
45699 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
45700 accepted, so while an ACL for RCPT is being processed, it contains the number
45701 of previously accepted recipients. At DATA time (for both the DATA ACLs),
45702 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
45703 <varname>$recipients_count</varname> contains the total number of accepted recipients.
45706 <section id="SECTdatfornon">
45707 <title>Data for non-message ACLs</title>
45709 <indexterm role="concept">
45710 <primary>access control lists (ACLs)</primary>
45711 <secondary>data for non-message ACL</secondary>
45713 <indexterm role="concept">
45714 <primary><varname>$smtp_command_argument</varname></primary>
45716 <indexterm role="concept">
45717 <primary><varname>$smtp_command</varname></primary>
45719 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
45720 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
45721 and the entire SMTP command is available in <varname>$smtp_command</varname>.
45722 These variables can be tested using a <option>condition</option> condition. For example,
45723 here is an ACL for use with AUTH, which insists that either the session is
45724 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
45725 does not permit authentication methods that use cleartext passwords on
45726 unencrypted connections.
45728 <literallayout class="monospaced">
45730 accept encrypted = *
45731 accept condition = ${if eq{${uc:$smtp_command_argument}}\
45733 deny message = TLS encryption or CRAM-MD5 required
45736 (Another way of applying this restriction is to arrange for the authenticators
45737 that use cleartext passwords not to be advertised when the connection is not
45738 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
45739 option to do this.)
45743 <title>Format of an ACL</title>
45745 <indexterm role="concept">
45746 <primary>access control lists (ACLs)</primary>
45747 <secondary>format of</secondary>
45749 <indexterm role="concept">
45750 <primary>access control lists (ACLs)</primary>
45751 <secondary>verbs; definition of</secondary>
45753 An individual ACL consists of a number of statements. Each statement starts
45754 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
45755 Modifiers can change the way the verb operates, define error and log messages,
45756 set variables, insert delays, and vary the processing of accepted messages.
45759 If all the conditions are met, the verb is obeyed. The same condition may be
45760 used (with different arguments) more than once in the same statement. This
45761 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
45764 <literallayout class="monospaced">
45765 deny dnslists = list1.example
45766 dnslists = list2.example
45769 If there are no conditions, the verb is always obeyed. Exim stops evaluating
45770 the conditions and modifiers when it reaches a condition that fails. What
45771 happens then depends on the verb (and in one case, on a special modifier). Not
45772 all the conditions make sense at every testing point. For example, you cannot
45773 test a sender address in the ACL that is run for a VRFY command.
45777 <title>ACL verbs</title>
45779 The ACL verbs are as follows:
45784 <indexterm role="concept">
45785 <primary><option>accept</option></primary>
45786 <secondary>ACL verb</secondary>
45788 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
45789 of the conditions are not met, what happens depends on whether <option>endpass</option>
45790 appears among the conditions (for syntax see below). If the failing condition
45791 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
45792 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
45793 check a RCPT command:
45795 <literallayout class="monospaced">
45796 accept domains = +local_domains
45801 If the recipient domain does not match the <option>domains</option> condition, control
45802 passes to the next statement. If it does match, the recipient is verified, and
45803 the command is accepted if verification succeeds. However, if verification
45804 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
45805 <option>endpass</option>.
45810 <indexterm role="concept">
45811 <primary><option>defer</option></primary>
45812 <secondary>ACL verb</secondary>
45814 <option>defer</option>: If all the conditions are met, the ACL returns <quote>defer</quote> which, in
45815 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
45816 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
45817 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
45818 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
45819 be used in any ACL, and even for a recipient it might be a simpler approach.
45824 <indexterm role="concept">
45825 <primary><option>deny</option></primary>
45826 <secondary>ACL verb</secondary>
45828 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
45829 the conditions are not met, control is passed to the next ACL statement. For
45832 <literallayout class="monospaced">
45833 deny dnslists = blackholes.mail-abuse.org
45836 rejects commands from hosts that are on a DNS black list.
45841 <indexterm role="concept">
45842 <primary><option>discard</option></primary>
45843 <secondary>ACL verb</secondary>
45845 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
45846 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
45847 that are concerned with receiving messages, and it causes recipients to be
45848 discarded. If the <option>log_message</option> modifier is set when <option>discard</option> operates,
45849 its contents are added to the line that is automatically written to the log.
45852 If <option>discard</option> is used in an ACL for RCPT, just the one recipient is
45853 discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
45854 message’s recipients are discarded. Recipients that are discarded before
45855 DATA do not appear in the log line when the <option>log_recipients</option> log selector
45861 <indexterm role="concept">
45862 <primary><option>drop</option></primary>
45863 <secondary>ACL verb</secondary>
45865 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
45866 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
45868 <literallayout class="monospaced">
45869 drop message = I don't take more than 20 RCPTs
45870 condition = ${if > {$rcpt_count}{20}}
45873 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
45874 The connection is always dropped after sending a 550 response.
45879 <indexterm role="concept">
45880 <primary><option>require</option></primary>
45881 <secondary>ACL verb</secondary>
45883 <option>require</option>: If all the conditions are met, control is passed to the next ACL
45884 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
45885 example, when checking a RCPT command,
45887 <literallayout class="monospaced">
45888 require verify = sender
45891 passes control to subsequent statements only if the message’s sender can be
45892 verified. Otherwise, it rejects the command.
45897 <indexterm role="concept">
45898 <primary><option>warn</option></primary>
45899 <secondary>ACL verb</secondary>
45901 <option>warn</option>: If all the conditions are met, a header line is added to an incoming
45902 message and/or a line is written to Exim’s main log. In all cases, control
45903 passes to the next ACL statement. The text of the added header line and the log
45904 line are specified by modifiers; if they are not present, a <option>warn</option> verb just
45905 checks its conditions and obeys any <quote>immediate</quote> modifiers such as <option>set</option> and
45906 <option>logwrite</option>. There is more about adding header lines in section
45907 <xref linkend="SECTaddheadacl"/>.
45910 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
45911 some sort of defer), no header lines are added and the configured log line is
45912 not written. No further conditions or modifiers in the <option>warn</option> statement are
45913 processed. The incident is logged, but the ACL continues to be processed, from
45914 the next statement onwards.
45917 If a <option>message</option> modifier is present on a <option>warn</option> verb in an ACL that is not
45918 testing an incoming message, it is ignored, and the incident is logged.
45921 A <option>warn</option> statement may use the <option>log_message</option> modifier to cause a line to be
45922 written to the main log when the statement’s conditions are true.
45923 If an identical log line is requested several times in the same message, only
45924 one copy is actually written to the log. If you want to force duplicates to be
45925 written, use the <option>logwrite</option> modifier instead.
45928 <indexterm role="concept">
45929 <primary><varname>$acl_verify_message</varname></primary>
45931 When one of the <option>warn</option> conditions is an address verification that fails, the
45932 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
45933 want this logged, you must set it up explicitly. For example:
45935 <literallayout class="monospaced">
45936 warn !verify = sender
45937 log_message = sender verify failed: $acl_verify_message
45942 At the end of each ACL there is an implicit unconditional <option>deny</option>.
45945 As you can see from the examples above, the conditions and modifiers are
45946 written one to a line, with the first one on the same line as the verb, and
45947 subsequent ones on following lines. If you have a very long condition, you can
45948 continue it onto several physical lines by the usual backslash continuation
45949 mechanism. It is conventional to align the conditions vertically.
45952 <section id="SECTaclvariables">
45953 <title>ACL variables</title>
45955 <indexterm role="concept">
45956 <primary>access control lists (ACLs)</primary>
45957 <secondary>variables</secondary>
45959 There are some special variables that can be set during ACL processing. They
45960 can be used to pass information between different ACLs, different invocations
45961 of the same ACL in the same SMTP connection, and between ACLs and the routers,
45962 transports, and filters that are used to deliver a message. There are two sets
45963 of these variables:
45968 The values of <varname>$acl_c0</varname> to <phrase revisionflag="changed"><varname>$acl_c19</varname></phrase> persist throughout an SMTP
45969 connection. They are never reset. Thus, a value that is set while receiving one
45970 message is still available when receiving the next message on the same SMTP
45976 The values of <varname>$acl_m0</varname> to <phrase revisionflag="changed"><varname>$acl_m19</varname></phrase> persist only while a message is
45977 being received. They are reset afterwards. They are also reset by MAIL, RSET,
45978 EHLO, HELO, and after starting up a TLS session.
45983 When a message is accepted, the current values of all the ACL variables are
45984 preserved with the message and are subsequently made available at delivery
45985 time. The ACL variables are set by modifier called <option>set</option>. For example:
45987 <literallayout class="monospaced">
45988 accept hosts = whatever
45989 set acl_m4 = some value
45992 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
45993 be set. If you want to set a variable without taking any action, you can use a
45994 <option>warn</option> verb without any other modifiers or conditions.
45998 <title>Condition and modifier processing</title>
46000 <indexterm role="concept">
46001 <primary>access control lists (ACLs)</primary>
46002 <secondary>conditions; processing</secondary>
46004 <indexterm role="concept">
46005 <primary>access control lists (ACLs)</primary>
46006 <secondary>modifiers; processing</secondary>
46008 An exclamation mark preceding a condition negates its result. For example:
46010 <literallayout class="monospaced">
46011 deny domains = *.dom.example
46012 !verify = recipient
46015 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
46016 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
46017 negation can be used on the right-hand side of a condition. For example, these
46018 two statements are equivalent:
46020 <literallayout class="monospaced">
46021 deny hosts = !192.168.3.4
46022 deny !hosts = 192.168.3.4
46025 However, for many conditions (<option>verify</option> being a good example), only left-hand
46026 side negation of the whole condition is possible.
46029 The arguments of conditions and modifiers are expanded. A forced failure
46030 of an expansion causes a condition to be ignored, that is, it behaves as if the
46031 condition is true. Consider these two statements:
46033 <literallayout class="monospaced">
46034 accept senders = ${lookup{$host_name}lsearch\
46035 {/some/file}{$value}fail}
46036 accept senders = ${lookup{$host_name}lsearch\
46037 {/some/file}{$value}{}}
46040 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
46041 the returned list is searched, but if the lookup fails the behaviour is
46042 different in the two cases. The <option>fail</option> in the first statement causes the
46043 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
46044 therefore succeeds. The second statement, however, generates an empty list when
46045 the lookup fails. No sender can match an empty list, so the condition fails,
46046 and therefore the <option>accept</option> also fails.
46049 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
46050 specify actions that are taken as the conditions for a statement are checked;
46051 others specify text for messages that are used when access is denied or a
46052 warning is generated. The <option>control</option> modifier affects the way an incoming
46053 message is handled.
46056 The positioning of the modifiers in an ACL statement important, because the
46057 processing of a verb ceases as soon as its outcome is known. Only those
46058 modifiers that have already been encountered will take effect. For example,
46059 consider this use of the <option>message</option> modifier:
46061 <literallayout class="monospaced">
46062 require message = Can't verify sender
46064 message = Can't verify recipient
46066 message = This message cannot be used
46069 If sender verification fails, Exim knows that the result of the statement is
46070 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
46071 so its text is used as the error message. If sender verification succeeds, but
46072 recipient verification fails, the second message is used. If recipient
46073 verification succeeds, the third message becomes <quote>current</quote>, but is never used
46074 because there are no more conditions to cause failure.
46077 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
46078 modifier that is used, because all the conditions must be true for rejection to
46079 happen. Specifying more than one <option>message</option> modifier does not make sense, and
46080 the message can even be specified after all the conditions. For example:
46082 <literallayout class="monospaced">
46084 !senders = *@my.domain.example
46085 message = Invalid sender from client host
46088 The <quote>deny</quote> result does not happen until the end of the statement is reached,
46089 by which time Exim has set up the message.
46092 <section id="SECTACLmodi">
46093 <title>ACL modifiers</title>
46095 <indexterm role="concept">
46096 <primary>access control lists (ACLs)</primary>
46097 <secondary>modifiers; list of</secondary>
46099 The ACL modifiers are as follows:
46102 <varlistentry revisionflag="changed">
46103 <term><emphasis role="bold">add_header</emphasis> = <<emphasis>text</emphasis>></term>
46105 <para revisionflag="changed">
46106 This modifier specifies one of more header lines that are to be added to an
46107 incoming message, assuming, of course, that the message is ultimately
46108 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
46110 </listitem></varlistentry>
46112 <term><emphasis role="bold">control</emphasis> = <<emphasis>text</emphasis>></term>
46115 <indexterm role="concept">
46116 <primary><option>control</option></primary>
46117 <secondary>ACL modifier</secondary>
46119 This modifier affects the subsequent processing of the SMTP connection or of an
46120 incoming message that is accepted. The effect of the first type of control
46121 lasts for the duration of the connection, whereas the effect of the second type
46122 lasts only until the current message has been received. The message-specific
46123 controls always apply to the whole message, not to individual recipients,
46124 even if the <option>control</option> modifier appears in a RCPT ACL.
46127 As there are now quite a few controls that can be applied, they are described
46128 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
46129 in several different ways. For example:
46134 It can be at the end of an <option>accept</option> statement:
46136 <literallayout class="monospaced">
46137 accept ...some conditions
46138 control = queue_only
46141 In this case, the control is applied when this statement yields <quote>accept</quote>, in
46142 other words, when the conditions are all true.
46147 It can be in the middle of an <option>accept</option> statement:
46149 <literallayout class="monospaced">
46150 accept ...some conditions...
46151 control = queue_only
46152 ...some more conditions...
46155 If the first set of conditions are true, the control is applied, even if the
46156 statement does not accept because one of the second set of conditions is false.
46157 In this case, some subsequent statement must yield <quote>accept</quote> for the control
46163 It can be used with <option>warn</option> to apply the control, leaving the
46164 decision about accepting or denying to a subsequent verb. For
46167 <literallayout class="monospaced">
46168 warn ...some conditions...
46173 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
46174 <option>logwrite</option>, so it does not add anything to the message and does not write a
46180 If you want to apply a control unconditionally, you can use it with a
46181 <option>require</option> verb. For example:
46183 <literallayout class="monospaced">
46184 require control = no_multiline_response
46188 </listitem></varlistentry>
46190 <term><emphasis role="bold">delay</emphasis> = <<emphasis>time</emphasis>></term>
46193 <indexterm role="concept">
46194 <primary><option>delay</option></primary>
46195 <secondary>ACL modifier</secondary>
46197 <indexterm role="concept">
46198 <primary><option>-bh</option> option</primary>
46200 This modifier causes Exim to wait for the time interval before proceeding. The
46201 time is given in the usual Exim notation. This modifier may appear in any ACL.
46202 The delay happens as soon as the modifier is processed. However, when testing
46203 Exim using the <option>-bh</option> option, the delay is not actually imposed (an
46204 appropriate message is output instead).
46207 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
46210 <literallayout class="monospaced">
46211 deny ...some conditions...
46215 The delay happens if all the conditions are true, before the statement returns
46216 <quote>deny</quote>. Compare this with:
46218 <literallayout class="monospaced">
46220 ...some conditions...
46223 which waits for 30s before processing the conditions. The <option>delay</option> modifier
46224 can also be used with <option>warn</option> and together with <option>control</option>:
46226 <literallayout class="monospaced">
46227 warn ...some conditions...
46232 </listitem></varlistentry>
46234 <term><emphasis role="bold">endpass</emphasis></term>
46237 <indexterm role="concept">
46238 <primary><option>endpass</option></primary>
46239 <secondary>ACL modifier</secondary>
46241 This modifier, which has no argument, is recognized only in <option>accept</option>
46242 statements. It marks the boundary between the conditions whose failure causes
46243 control to pass to the next statement, and the conditions whose failure causes
46244 the ACL to return <quote>deny</quote>. See the description of <option>accept</option> above.
46246 </listitem></varlistentry>
46248 <term><emphasis role="bold">log_message</emphasis> = <<emphasis>text</emphasis>></term>
46251 <indexterm role="concept">
46252 <primary><option>log_message</option></primary>
46253 <secondary>ACL modifier</secondary>
46255 This modifier sets up a message that is used as part of the log message if the
46256 ACL denies access or a <option>warn</option> statement’s conditions are true. For example:
46258 <literallayout class="monospaced">
46259 require log_message = wrong cipher suite $tls_cipher
46260 encrypted = DES-CBC3-SHA
46263 <option>log_message</option> adds to any underlying error message that may exist because of
46264 the condition failure. For example, while verifying a recipient address, a
46265 <emphasis>:fail:</emphasis> redirection might have already set up a message. Although the
46266 message is usually defined before the conditions to which it applies, the
46267 expansion does not happen until Exim decides that access is to be denied. This
46268 means that any variables that are set by the condition are available for
46269 inclusion in the message. For example, the <varname>$dnslist_</varname><<emphasis>xxx</emphasis>> variables are
46270 set after a DNS black list lookup succeeds. If the expansion of <option>log_message</option>
46271 fails, or if the result is an empty string, the modifier is ignored.
46274 <indexterm role="concept">
46275 <primary><varname>$acl_verify_message</varname></primary>
46277 If you want to use a <option>warn</option> statement to log the result of an address
46278 verification, you can use <varname>$acl_verify_message</varname> to include the verification
46282 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
46283 the start of the logged message. If the same warning log message is requested
46284 more than once while receiving a single email message, only one copy is
46285 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
46286 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
46287 is logged for a succesful <option>warn</option> statement.
46290 If <option>log_message</option> is not present and there is no underlying error message (for
46291 example, from the failure of address verification), but <option>message</option> is present,
46292 the <option>message</option> text is used for logging rejections. However, if any text for
46293 logging contains newlines, only the first line is logged. In the absence of
46294 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
46295 logging rejections.
46297 </listitem></varlistentry>
46299 <term><emphasis role="bold">logwrite</emphasis> = <<emphasis>text</emphasis>></term>
46302 <indexterm role="concept">
46303 <primary><option>logwrite</option></primary>
46304 <secondary>ACL modifier</secondary>
46306 <indexterm role="concept">
46307 <primary>logging in ACL</primary>
46308 <secondary>immediate</secondary>
46310 This modifier writes a message to a log file as soon as it is encountered when
46311 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
46312 <option>warn</option>, is used only if the ACL statement denies access.) The <option>logwrite</option>
46313 modifier can be used to log special incidents in ACLs. For example:
46316 <literal>accept </literal><<emphasis>some special conditions</emphasis>>
46317 <literal> control = freeze</literal>
46318 <literal> logwrite = froze message because ...</literal>
46321 By default, the message is written to the main log. However, it may begin
46322 with a colon, followed by a comma-separated list of log names, and then
46323 another colon, to specify exactly which logs are to be written. For
46326 <literallayout class="monospaced">
46327 logwrite = :main,reject: text for main and reject logs
46328 logwrite = :panic: text for panic log only
46330 </listitem></varlistentry>
46332 <term><emphasis role="bold">message</emphasis> = <<emphasis>text</emphasis>></term>
46335 <indexterm role="concept">
46336 <primary><option>message</option></primary>
46337 <secondary>ACL modifier</secondary>
46339 This modifier sets up a text string that is expanded and used as an error
46340 message if the current statement causes the ACL to deny access. The expansion
46341 happens at the time Exim decides that access is to be denied, not at the time
46342 it processes <option>message</option>. If the expansion fails, or generates an empty string,
46343 the modifier is ignored. For ACLs that are triggered by SMTP commands, the
46344 message is returned as part of the SMTP error response.
46347 The text is literal; any quotes are taken as literals, but because the string
46348 is expanded, backslash escapes are processed anyway. If the message contains
46349 newlines, this gives rise to a multi-line SMTP response. Like <option>log_message</option>,
46350 the contents of <option>message</option> are not expanded until after a condition has
46354 <indexterm role="concept">
46355 <primary><varname>$acl_verify_message</varname></primary>
46357 If <option>message</option> is used on a statement that verifies an address, the message
46358 specified overrides any message that is generated by the verification process.
46359 However, the original message is available in the variable
46360 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
46361 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
46362 routers to be passed back as part of the SMTP response, you should either not
46363 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
46365 <para revisionflag="changed">
46366 For compatibility with previous releases of Exim, a <option>message</option> modifier that
46367 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
46368 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
46369 all the conditions are true, wherever it appears in an ACL command, whereas
46370 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
46371 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
46374 </listitem></varlistentry>
46376 <term><emphasis role="bold">set</emphasis> <<emphasis>acl_name</emphasis>> = <<emphasis>value</emphasis>></term>
46379 <indexterm role="concept">
46380 <primary><option>set</option></primary>
46381 <secondary>ACL modifier</secondary>
46383 This modifier puts a value into one of the ACL variables (see section
46384 <xref linkend="SECTaclvariables"/>).
46386 </listitem></varlistentry>
46389 <section id="SECTcontrols">
46390 <title>Use of the control modifier</title>
46392 <indexterm role="concept">
46393 <primary><option>control</option></primary>
46394 <secondary>ACL modifier</secondary>
46396 The <option>control</option> modifier supports the following settings:
46399 <varlistentry revisionflag="changed">
46400 <term><emphasis role="bold">control = allow_auth_unadvertised</emphasis></term>
46402 <para revisionflag="changed">
46403 This modifier allows a client host to use the SMTP AUTH command even when it
46404 has not been advertised in response to EHLO. Furthermore, because there are
46405 apparently some really broken clients that do this, Exim will accept AUTH after
46406 HELO (rather than EHLO) when this control is set. It should be used only if you
46407 really need it, and you should limit its use to those broken clients that do
46408 not work without it. For example:
46410 <literallayout class="monospaced" revisionflag="changed">
46411 warn hosts = 192.168.34.25
46412 control = allow_auth_unadvertised
46414 <para revisionflag="changed">
46415 Normally, when an Exim server receives an AUTH command, it checks the name of
46416 the authentication mechanism that is given in the command to ensure that it
46417 matches an advertised mechanism. When this control is set, the check that a
46418 mechanism has been advertised is bypassed. Any configured mechanism can be used
46419 by the client. This control is permitted only in the connection and HELO ACLs.
46421 </listitem></varlistentry>
46423 <term><emphasis role="bold">control = caseful_local_part</emphasis></term>
46428 </listitem></varlistentry>
46430 <term><emphasis role="bold">control = caselower_local_part</emphasis></term>
46433 <indexterm role="concept">
46434 <primary>access control lists (ACLs)</primary>
46435 <secondary>case of local part in</secondary>
46437 <indexterm role="concept">
46438 <primary>case of local parts</primary>
46440 <indexterm role="concept">
46441 <primary><varname>$local_part</varname></primary>
46443 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
46444 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
46445 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
46446 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
46447 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
46451 These controls affect only the current recipient. Moreover, they apply only to
46452 local part handling that takes place directly in the ACL (for example, as a key
46453 in lookups). If a test to verify the recipient is obeyed, the case-related
46454 handling of the local part during the verification is controlled by the router
46455 configuration (see the <option>caseful_local_part</option> generic router option).
46458 This facility could be used, for example, to add a spam score to local parts
46459 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
46462 <literallayout class="monospaced">
46463 warn control = caseful_local_part
46464 set acl_m4 = ${eval:\
46466 ${if match{$local_part}{[A-Z]}{1}{0}}\
46468 control = caselower_local_part
46471 Notice that we put back the lower cased version afterwards, assuming that
46472 is what is wanted for subsequent tests.
46474 </listitem></varlistentry>
46476 <term><emphasis role="bold">control = enforce_sync</emphasis></term>
46481 </listitem></varlistentry>
46483 <term><emphasis role="bold">control = no_enforce_sync</emphasis></term>
46486 <indexterm role="concept">
46487 <primary>SMTP</primary>
46488 <secondary>synchronization checking</secondary>
46490 <indexterm role="concept">
46491 <primary>synchronization checking in SMTP</primary>
46493 These controls make it possible to be selective about when SMTP synchronization
46494 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
46495 state of the switch (it is true by default). See the description of this option
46496 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
46499 The effect of these two controls lasts for the remainder of the SMTP
46500 connection. They can appear in any ACL except the one for the non-SMTP
46501 messages. The most straightforward place to put them is in the ACL defined by
46502 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
46503 before the first synchronization check. The expected use is to turn off the
46504 synchronization checks for badly-behaved hosts that you nevertheless need to
46507 </listitem></varlistentry>
46509 <term><emphasis role="bold">control = fakedefer/</emphasis><<emphasis>message</emphasis>></term>
46512 <indexterm role="concept">
46513 <primary>fake defer</primary>
46515 <indexterm role="concept">
46516 <primary>defer</primary>
46517 <secondary>fake</secondary>
46519 This control works in exactly the same way as <option>fakereject</option> (described below)
46520 except that it causes an SMTP 450 response after the message data instead of a
46521 550 response. You must take care when using <option>fakedefer</option> because it causes the
46522 messages to be duplicated when the sender retries. Therefore, you should not
46523 use <option>fakedefer</option> if the message is to be delivered normally.
46525 </listitem></varlistentry>
46527 <term><emphasis role="bold">control = fakereject/</emphasis><<emphasis>message</emphasis>></term>
46530 <indexterm role="concept">
46531 <primary>fake rejection</primary>
46533 <indexterm role="concept">
46534 <primary>rejection</primary>
46535 <secondary>fake</secondary>
46537 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
46538 words, only when an SMTP message is being received. If Exim accepts the
46539 message, instead the final 250 response, a 550 rejection message is sent.
46540 However, Exim proceeds to deliver the message as normal. The control applies
46541 only to the current message, not to any subsequent ones that may be received in
46542 the same SMTP connection.
46545 The text for the 550 response is taken from the <option>control</option> modifier. If no
46546 message is supplied, the following is used:
46548 <literallayout class="monospaced">
46549 550-Your message has been rejected but is being
46550 550-kept for evaluation.
46551 550-If it was a legitimate message, it may still be
46552 550 delivered to the target recipient(s).
46555 This facilty should be used with extreme caution.
46557 </listitem></varlistentry>
46559 <term><emphasis role="bold">control = freeze</emphasis></term>
46562 <indexterm role="concept">
46563 <primary>frozen messages</primary>
46564 <secondary>forcing in ACL</secondary>
46566 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
46567 other words, only when a message is being received. If the message is accepted,
46568 it is placed on Exim’s queue and frozen. The control applies only to the
46569 current message, not to any subsequent ones that may be received in the same
46572 <para revisionflag="changed">
46573 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
46574 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
46575 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
46576 are obeyed for the current message have the <literal>/no_tell</literal> option.
46578 </listitem></varlistentry>
46580 <term><emphasis role="bold">control = no_mbox_unspool</emphasis></term>
46583 This control is available when Exim is compiled with the content scanning
46584 extension. Content scanning may require a copy of the current message, or parts
46585 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
46586 or spam scanner. Normally, such copies are deleted when they are no longer
46587 needed. If this control is set, the copies are not deleted. The control applies
46588 only to the current message, not to any subsequent ones that may be received in
46589 the same SMTP connection. It is provided for debugging purposes and is unlikely
46590 to be useful in production.
46592 </listitem></varlistentry>
46594 <term><emphasis role="bold">control = no_multiline_response</emphasis></term>
46597 <indexterm role="concept">
46598 <primary>multiline responses</primary>
46599 <secondary>suppressing</secondary>
46601 This control is permitted for any ACL except the one for non-SMTP messages.
46602 It seems that there are broken clients in use that cannot handle multiline
46603 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
46606 If this control is set, multiline SMTP responses from ACL rejections are
46607 suppressed. One way of doing this would have been to put out these responses as
46608 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
46609 (<quote>use multiline responses for more</quote> it says – ha!), and some of the
46610 responses might get close to that. So this facility, which is after all only a
46611 sop to broken clients, is implemented by doing two very easy things:
46616 Extra information that is normally output as part of a rejection caused by
46617 sender verification failure is omitted. Only the final line (typically <quote>sender
46618 verification failed</quote>) is sent.
46623 If a <option>message</option> modifier supplies a multiline response, only the first
46629 The setting of the switch can, of course, be made conditional on the
46630 calling host. Its effect lasts until the end of the SMTP connection.
46632 </listitem></varlistentry>
46634 <term><emphasis role="bold">control = queue_only</emphasis></term>
46637 <indexterm role="concept">
46638 <primary><option>queue_only</option></primary>
46640 <indexterm role="concept">
46641 <primary>queueing incoming messages</primary>
46643 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
46644 other words, only when a message is being received. If the message is accepted,
46645 it is placed on Exim’s queue and left there for delivery by a subsequent queue
46646 runner. No immediate delivery process is started. In other words, it has the
46647 effect as the <option>queue_only</option> global option. However, the control applies only
46648 to the current message, not to any subsequent ones that may be received in the
46649 same SMTP connection.
46651 </listitem></varlistentry>
46653 <term><emphasis role="bold">control = submission/</emphasis><<emphasis>options</emphasis>></term>
46656 <indexterm role="concept">
46657 <primary>message</primary>
46658 <secondary>submission</secondary>
46660 <indexterm role="concept">
46661 <primary>submission mode</primary>
46663 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
46664 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
46665 the current message is a submission from a local MUA. In this case, Exim
46666 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
46667 necessary. For example, it add a <emphasis>Date:</emphasis> header line if one is not present.
46668 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
46669 late (the message has already been created).
46672 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
46673 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
46674 submission mode; the available options for this control are described there.
46675 The control applies only to the current message, not to any subsequent ones
46676 that may be received in the same SMTP connection.
46678 </listitem></varlistentry>
46680 <term><emphasis role="bold">control = suppress_local_fixups</emphasis></term>
46683 <indexterm role="concept">
46684 <primary>submission fixups</primary>
46685 <secondary>suppressing</secondary>
46687 This control applies to locally submitted (non TCP/IP) messages, and is the
46688 complement of <literal>control</literal> <literal>=</literal> <literal>submission</literal>. It disables the fixups that are
46689 normally applied to locally-submitted messages. Specifically:
46694 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
46695 dynamic version of <option>local_sender_retain</option>).
46700 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
46705 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
46710 This feature may be useful when a remotely-originated message is accepted,
46711 passed to some scanning program, and then re-submitted for delivery.
46713 </listitem></varlistentry>
46716 All four possibilities for message fixups can be specified:
46721 Locally submitted, fixups applied: the default.
46726 Locally submitted, no fixups applied: use <literal>control</literal> <literal>=</literal>
46727 <literal>suppress_local_fixups</literal>.
46732 Remotely submitted, no fixups applied: the default.
46737 Remotely submitted, fixups applied: use <literal>control</literal> <literal>=</literal> <literal>submission</literal>.
46742 <section id="SECTaddheadacl" revisionflag="changed">
46743 <title>Adding header lines in ACLs</title>
46744 <para revisionflag="changed">
46745 <indexterm role="concept">
46746 <primary>header lines</primary>
46747 <secondary>adding in an ACL</secondary>
46749 <indexterm role="concept">
46750 <primary>header lines</primary>
46751 <secondary>position of added lines</secondary>
46753 <indexterm role="concept">
46754 <primary><option>message</option></primary>
46755 <secondary>ACL modifier</secondary>
46757 The <option>add_header</option> modifier can be used to add one or more extra header lines
46758 to an incoming message, as in this example:
46760 <literallayout class="monospaced" revisionflag="changed">
46761 warn dnslists = sbl.spamhaus.org : \
46762 dialup.mail-abuse.org
46763 add_header = X-blacklisted-at: $dnslist_domain
46765 <para revisionflag="changed">
46766 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
46767 MIME, and non-SMTP ACLs (in other words, those that are concerned with
46768 receiving a message). The message must ultimately be accepted for
46769 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
46770 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
46773 <para revisionflag="changed">
46774 If the data for the <option>add_header</option> modifier contains one or more newlines that
46775 are not followed by a space or a tab, it is assumed to contain multiple header
46776 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
46777 front of any line that is not a valid header line.
46779 <para revisionflag="changed">
46780 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
46781 They are added to the message before processing the DATA and MIME ACLs.
46782 However, if an identical header line is requested more than once, only one copy
46783 is actually added to the message. Further header lines may be accumulated
46784 during the DATA and MIME ACLs, after which they are added to the message, again
46785 with duplicates suppressed. Thus, it is possible to add two identical header
46786 lines to an SMTP message, but only if one is added before DATA and one after.
46787 In the case of non-SMTP messages, new headers are accumulated during the
46788 non-SMTP ACL, and added to the message at the end. If a message is rejected
46789 after DATA or by the non-SMTP ACL, all added header lines are included in the
46790 entry that is written to the reject log.
46792 <para revisionflag="changed">
46793 <indexterm role="concept">
46794 <primary>header lines</primary>
46795 <secondary>added; visibility of</secondary>
46797 Header lines are not visible in string expansions until they are added to the
46798 message. It follows that header lines defined in the MAIL, RCPT, and predata
46799 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
46800 header lines that are added by the DATA or MIME ACLs are not visible in those
46801 ACLs. Because of this restriction, you cannot use header lines as a way of
46802 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
46803 this, you can use ACL variables, as described in section
46804 <xref linkend="SECTaclvariables"/>.
46806 <para revisionflag="changed">
46807 The <option>add_header</option> modifier acts immediately it is encountered during the
46808 processing of an ACL. Notice the difference between these two cases:
46810 <literallayout revisionflag="changed">
46811 <literal>accept add_header = ADDED: some text</literal>
46812 <literal> </literal><<emphasis>some condition</emphasis>>
46814 <literal>accept </literal><<emphasis>some condition</emphasis>>
46815 <literal> add_header = ADDED: some text</literal>
46817 <para revisionflag="changed">
46818 In the first case, the header line is always added, whether or not the
46819 condition is true. In the second case, the header line is added only if the
46820 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
46821 ACL statement. All those that are encountered before a condition fails are
46824 <para revisionflag="changed">
46825 <indexterm role="concept">
46826 <primary><option>warn</option></primary>
46827 <secondary>ACL verb</secondary>
46829 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
46830 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
46831 effect only if all the conditions are true, even if it appears before some of
46832 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
46833 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
46834 are present on a <option>warn</option> verb, both are processed according to their
46837 <para revisionflag="changed">
46838 By default, new header lines are added to a message at the end of the existing
46839 header lines. However, you can specify that any particular header line should
46840 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
46841 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
46842 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
46844 <para revisionflag="changed">
46845 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
46846 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
46847 header line, respectively. (Header text cannot start with a colon, as there has
46848 to be a header name first.) For example:
46850 <literallayout class="monospaced" revisionflag="changed">
46851 warn add_header = \
46852 :after_received:X-My-Header: something or other...
46854 <para revisionflag="changed">
46855 If more than one header line is supplied in a single <option>add_header</option> modifier,
46856 each one is treated independently and can therefore be placed differently. If
46857 you add more than one line at the start, or after the Received: block, they end
46858 up in reverse order.
46860 <para revisionflag="changed">
46861 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
46862 added in an ACL. It does NOT work for header lines that are added in a
46863 system filter or in a router or transport.
46866 <section id="SECTaclconditions">
46867 <title>ACL conditions</title>
46869 <indexterm role="concept">
46870 <primary>access control lists (ACLs)</primary>
46871 <secondary>conditions; list of</secondary>
46873 Some of conditions listed in this section are available only when Exim is
46874 compiled with the content-scanning extension. They are included here briefly
46875 for completeness. More detailed descriptions can be found in the discussion on
46876 content scanning in chapter <xref linkend="CHAPexiscan"/>.
46879 Not all conditions are relevant in all circumstances. For example, testing
46880 senders and recipients does not make sense in an ACL that is being run as the
46881 result of the arrival of an ETRN command, and checks on message headers can be
46882 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
46883 can use the same condition (with different parameters) more than once in the
46884 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
46885 The conditions are as follows:
46889 <term><emphasis role="bold">acl = </emphasis><<emphasis>name of acl or ACL string or file name </emphasis>></term>
46892 <indexterm role="concept">
46893 <primary>access control lists (ACLs)</primary>
46894 <secondary>nested</secondary>
46896 <indexterm role="concept">
46897 <primary>access control lists (ACLs)</primary>
46898 <secondary>indirect</secondary>
46900 <indexterm role="concept">
46901 <primary><option>acl</option></primary>
46902 <secondary>ACL condition</secondary>
46904 The possible values of the argument are the same as for the
46905 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
46906 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
46907 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
46908 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
46909 condition false. This means that further processing of the <option>warn</option> verb
46910 ceases, but processing of the ACL continues.
46913 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
46914 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
46915 <option>accept</option> or <option>discard</option>, and the action is taken immediately – no further
46916 conditions are tested.
46919 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
46920 loops. This condition allows you to use different ACLs in different
46921 circumstances. For example, different ACLs can be used to handle RCPT commands
46922 for different local users or different local domains.
46924 </listitem></varlistentry>
46926 <term><emphasis role="bold">authenticated = </emphasis><<emphasis>string list</emphasis>></term>
46929 <indexterm role="concept">
46930 <primary><option>authenticated</option></primary>
46931 <secondary>ACL condition</secondary>
46933 <indexterm role="concept">
46934 <primary>authentication</primary>
46935 <secondary>ACL checking</secondary>
46937 <indexterm role="concept">
46938 <primary>access control lists (ACLs)</primary>
46939 <secondary>testing for authentication</secondary>
46941 If the SMTP connection is not authenticated, the condition is false. Otherwise,
46942 the name of the authenticator is tested against the list. To test for
46943 authentication by any authenticator, you can set
46945 <literallayout class="monospaced">
46948 </listitem></varlistentry>
46950 <term><emphasis role="bold">condition = </emphasis><<emphasis>string</emphasis>></term>
46953 <indexterm role="concept">
46954 <primary><option>condition</option></primary>
46955 <secondary>ACL condition</secondary>
46957 <indexterm role="concept">
46958 <primary>customizing</primary>
46959 <secondary>ACL condition</secondary>
46961 <indexterm role="concept">
46962 <primary>access control lists (ACLs)</primary>
46963 <secondary>customized test</secondary>
46965 <indexterm role="concept">
46966 <primary>access control lists (ACLs)</primary>
46967 <secondary>testing; customized</secondary>
46969 This feature allows you to make up custom conditions. If the result of
46970 expanding the string is an empty string, the number zero, or one of the strings
46971 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
46972 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
46973 any other values, some error is assumed to have occurred, and the ACL returns
46974 <quote>defer</quote>.
46976 </listitem></varlistentry>
46978 <term><emphasis role="bold">decode = </emphasis><<emphasis>location</emphasis>></term>
46981 <indexterm role="concept">
46982 <primary><option>decode</option></primary>
46983 <secondary>ACL condition</secondary>
46985 This condition is available only when Exim is compiled with the
46986 content-scanning extension, and it is allowed only the the ACL defined by
46987 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
46988 For details, see chapter <xref linkend="CHAPexiscan"/>.
46990 </listitem></varlistentry>
46992 <term><emphasis role="bold">demime = </emphasis><<emphasis>extension list</emphasis>></term>
46995 <indexterm role="concept">
46996 <primary><option>demime</option></primary>
46997 <secondary>ACL condition</secondary>
46999 This condition is available only when Exim is compiled with the
47000 content-scanning extension. Its use is described in section
47001 <xref linkend="SECTdemimecond"/>.
47003 </listitem></varlistentry>
47005 <term><emphasis role="bold">dnslists = </emphasis><<emphasis>list of domain names and other data</emphasis>></term>
47008 <indexterm role="concept">
47009 <primary><option>dnslists</option></primary>
47010 <secondary>ACL condition</secondary>
47012 <indexterm role="concept">
47013 <primary>DNS list</primary>
47014 <secondary>in ACL</secondary>
47016 <indexterm role="concept">
47017 <primary>black list (DNS)</primary>
47019 <indexterm role="concept">
47020 <primary>access control lists (ACLs)</primary>
47021 <secondary>testing a DNS list</secondary>
47023 This condition checks for entries in DNS black lists. These are also known as
47024 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
47025 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
47026 different variants of this condition to describe briefly here. See sections
47027 <xref linkend="SECTmorednslists"/>--<xref linkend="SECTmorednslistslast"/> for details.
47029 </listitem></varlistentry>
47031 <term><emphasis role="bold">domains = </emphasis><<emphasis>domain list</emphasis>></term>
47034 <indexterm role="concept">
47035 <primary><option>domains</option></primary>
47036 <secondary>ACL condition</secondary>
47038 <indexterm role="concept">
47039 <primary>domain</primary>
47040 <secondary>ACL checking</secondary>
47042 <indexterm role="concept">
47043 <primary>access control lists (ACLs)</primary>
47044 <secondary>testing a recipient domain</secondary>
47046 <indexterm role="concept">
47047 <primary><varname>$domain_data</varname></primary>
47049 This condition is relevant only after a RCPT command. It checks that the domain
47050 of the recipient address is in the domain list. If percent-hack processing is
47051 enabled, it is done before this test is done. If the check succeeds with a
47052 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
47053 <option>domains</option> test.
47055 </listitem></varlistentry>
47057 <term><emphasis role="bold">encrypted = </emphasis><<emphasis>string list</emphasis>></term>
47060 <indexterm role="concept">
47061 <primary><option>encrypted</option></primary>
47062 <secondary>ACL condition</secondary>
47064 <indexterm role="concept">
47065 <primary>encryption</primary>
47066 <secondary>checking in an ACL</secondary>
47068 <indexterm role="concept">
47069 <primary>access control lists (ACLs)</primary>
47070 <secondary>testing for encryption</secondary>
47072 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
47073 name of the cipher suite in use is tested against the list. To test for
47074 encryption without testing for any specific cipher suite(s), set
47076 <literallayout class="monospaced">
47079 </listitem></varlistentry>
47081 <term><emphasis role="bold">hosts = </emphasis><<emphasis> host list</emphasis>></term>
47084 <indexterm role="concept">
47085 <primary><option>hosts</option></primary>
47086 <secondary>ACL condition</secondary>
47088 <indexterm role="concept">
47089 <primary>host</primary>
47090 <secondary>ACL checking</secondary>
47092 <indexterm role="concept">
47093 <primary>access control lists (ACLs)</primary>
47094 <secondary>testing the client host</secondary>
47096 This condition tests that the calling host matches the host list. If you have
47097 name lookups or wildcarded host names and IP addresses in the same host list,
47098 you should normally put the IP addresses first. For example, you could have:
47100 <literallayout class="monospaced">
47101 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
47104 The reason for this lies in the left-to-right way that Exim processes lists.
47105 It can test IP addresses without doing any DNS lookups, but when it reaches an
47106 item that requires a host name, it fails if it cannot find a host name to
47107 compare with the pattern. If the above list is given in the opposite order, the
47108 <option>accept</option> statement fails for a host whose name cannot be found, even if its
47109 IP address is 10.9.8.7.
47112 If you really do want to do the name check first, and still recognize the IP
47113 address even if the name lookup fails, you can rewrite the ACL like this:
47115 <literallayout class="monospaced">
47116 accept hosts = dbm;/etc/friendly/hosts
47117 accept hosts = 10.9.8.7
47120 The default action on failing to find the host name is to assume that the host
47121 is not in the list, so the first <option>accept</option> statement fails. The second
47122 statement can then check the IP address.
47125 <indexterm role="concept">
47126 <primary><varname>$host_data</varname></primary>
47128 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
47129 of the lookup is made available in the <varname>$host_data</varname> variable. This
47130 allows you, for example, to set up a statement like this:
47132 <literallayout class="monospaced">
47133 deny hosts = net-lsearch;/some/file
47134 message = $host_data
47137 which gives a custom error message for each denied host.
47139 </listitem></varlistentry>
47141 <term><emphasis role="bold">local_parts = </emphasis><<emphasis>local part list</emphasis>></term>
47144 <indexterm role="concept">
47145 <primary><option>local_parts</option></primary>
47146 <secondary>ACL condition</secondary>
47148 <indexterm role="concept">
47149 <primary>local part</primary>
47150 <secondary>ACL checking</secondary>
47152 <indexterm role="concept">
47153 <primary>access control lists (ACLs)</primary>
47154 <secondary>testing a local part</secondary>
47156 <indexterm role="concept">
47157 <primary><varname>$local_part_data</varname></primary>
47159 This condition is relevant only after a RCPT command. It checks that the local
47160 part of the recipient address is in the list. If percent-hack processing is
47161 enabled, it is done before this test. If the check succeeds with a lookup, the
47162 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
47163 the next <option>local_parts</option> test.
47165 </listitem></varlistentry>
47167 <term><emphasis role="bold">malware = </emphasis><<emphasis>option</emphasis>></term>
47170 <indexterm role="concept">
47171 <primary><option>malware</option></primary>
47172 <secondary>ACL condition</secondary>
47174 <indexterm role="concept">
47175 <primary>access control lists (ACLs)</primary>
47176 <secondary>virus scanning</secondary>
47178 <indexterm role="concept">
47179 <primary>access control lists (ACLs)</primary>
47180 <secondary>scanning for viruses</secondary>
47182 This condition is available only when Exim is compiled with the
47183 content-scanning extension. It causes the incoming message to be scanned for
47184 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
47186 </listitem></varlistentry>
47188 <term><emphasis role="bold">mime_regex = </emphasis><<emphasis>list of regular expressions</emphasis>></term>
47191 <indexterm role="concept">
47192 <primary><option>mime_regex</option></primary>
47193 <secondary>ACL condition</secondary>
47195 <indexterm role="concept">
47196 <primary>access control lists (ACLs)</primary>
47197 <secondary>testing by regex matching</secondary>
47199 This condition is available only when Exim is compiled with the
47200 content-scanning extension, and it is allowed only the the ACL defined by
47201 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
47202 with any of the regular expressions. For details, see chapter
47203 <xref linkend="CHAPexiscan"/>.
47205 </listitem></varlistentry>
47207 <term><emphasis role="bold">ratelimit = </emphasis><<emphasis>parameters</emphasis>></term>
47210 <indexterm role="concept">
47211 <primary>rate limiting</primary>
47213 This condition can be used to limit the rate at which a user or host submits
47214 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
47216 </listitem></varlistentry>
47218 <term><emphasis role="bold">recipients = </emphasis><<emphasis>address list</emphasis>></term>
47221 <indexterm role="concept">
47222 <primary><option>recipients</option></primary>
47223 <secondary>ACL condition</secondary>
47225 <indexterm role="concept">
47226 <primary>recipient</primary>
47227 <secondary>ACL checking</secondary>
47229 <indexterm role="concept">
47230 <primary>access control lists (ACLs)</primary>
47231 <secondary>testing a recipient</secondary>
47233 This condition is relevant only after a RCPT command. It checks the entire
47234 recipient address against a list of recipients.
47236 </listitem></varlistentry>
47238 <term><emphasis role="bold">regex = </emphasis><<emphasis>list of regular expressions</emphasis>></term>
47241 <indexterm role="concept">
47242 <primary><option>regex</option></primary>
47243 <secondary>ACL condition</secondary>
47245 <indexterm role="concept">
47246 <primary>access control lists (ACLs)</primary>
47247 <secondary>testing by regex matching</secondary>
47249 This condition is available only when Exim is compiled with the
47250 content-scanning extension, and is available only in the DATA, MIME, and
47251 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
47252 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
47254 </listitem></varlistentry>
47256 <term><emphasis role="bold">sender_domains = </emphasis><<emphasis>domain list</emphasis>></term>
47259 <indexterm role="concept">
47260 <primary><option>sender_domains</option></primary>
47261 <secondary>ACL condition</secondary>
47263 <indexterm role="concept">
47264 <primary>sender</primary>
47265 <secondary>ACL checking</secondary>
47267 <indexterm role="concept">
47268 <primary>access control lists (ACLs)</primary>
47269 <secondary>testing a sender domain</secondary>
47271 <indexterm role="concept">
47272 <primary><varname>$domain</varname></primary>
47274 <indexterm role="concept">
47275 <primary><varname>$sender_address_domain</varname></primary>
47277 This condition tests the domain of the sender of the message against the given
47278 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
47279 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
47280 of this condition. This is an exception to the general rule for testing domain
47281 lists. It is done this way so that, if this condition is used in an ACL for a
47282 RCPT command, the recipient’s domain (which is in <varname>$domain</varname>) can be used to
47283 influence the sender checking.
47286 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
47287 relaying, because sender addresses are easily, and commonly, forged.
47289 </listitem></varlistentry>
47291 <term><emphasis role="bold">senders = </emphasis><<emphasis>address list</emphasis>></term>
47294 <indexterm role="concept">
47295 <primary><option>senders</option></primary>
47296 <secondary>ACL condition</secondary>
47298 <indexterm role="concept">
47299 <primary>sender</primary>
47300 <secondary>ACL checking</secondary>
47302 <indexterm role="concept">
47303 <primary>access control lists (ACLs)</primary>
47304 <secondary>testing a sender</secondary>
47306 This condition tests the sender of the message against the given list. To test
47307 for a bounce message, which has an empty sender, set
47309 <literallayout class="monospaced">
47313 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
47314 relaying, because sender addresses are easily, and commonly, forged.
47316 </listitem></varlistentry>
47318 <term><emphasis role="bold">spam = </emphasis><<emphasis>username</emphasis>></term>
47321 <indexterm role="concept">
47322 <primary><option>spam</option></primary>
47323 <secondary>ACL condition</secondary>
47325 <indexterm role="concept">
47326 <primary>access control lists (ACLs)</primary>
47327 <secondary>scanning for spam</secondary>
47329 This condition is available only when Exim is compiled with the
47330 content-scanning extension. It causes the incoming message to be scanned by
47331 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
47333 </listitem></varlistentry>
47335 <term><emphasis role="bold">verify = certificate</emphasis></term>
47338 <indexterm role="concept">
47339 <primary><option>verify</option></primary>
47340 <secondary>ACL condition</secondary>
47342 <indexterm role="concept">
47343 <primary>TLS</primary>
47344 <secondary>client certificate verification</secondary>
47346 <indexterm role="concept">
47347 <primary>certificate</primary>
47348 <secondary>verification of client</secondary>
47350 <indexterm role="concept">
47351 <primary>access control lists (ACLs)</primary>
47352 <secondary>certificate verification</secondary>
47354 <indexterm role="concept">
47355 <primary>access control lists (ACLs)</primary>
47356 <secondary>testing a TLS certificate</secondary>
47358 This condition is true in an SMTP session if the session is encrypted, and a
47359 certificate was received from the client, and the certificate was verified. The
47360 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
47361 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
47363 </listitem></varlistentry>
47365 <term><emphasis role="bold">verify = csa</emphasis></term>
47368 <indexterm role="concept">
47369 <primary>CSA verification</primary>
47371 This condition checks whether the sending host (the client) is authorized to
47372 send email. Details of how this works are given in section
47373 <xref linkend="SECTverifyCSA"/>.
47375 </listitem></varlistentry>
47377 <term><emphasis role="bold">verify = header_sender/</emphasis><<emphasis>options</emphasis>></term>
47380 <indexterm role="concept">
47381 <primary><option>verify</option></primary>
47382 <secondary>ACL condition</secondary>
47384 <indexterm role="concept">
47385 <primary>access control lists (ACLs)</primary>
47386 <secondary>verifying sender in the header</secondary>
47388 <indexterm role="concept">
47389 <primary>header lines</primary>
47390 <secondary>verifying the sender in</secondary>
47392 <indexterm role="concept">
47393 <primary>sender</primary>
47394 <secondary>verifying in header</secondary>
47396 <indexterm role="concept">
47397 <primary>verifying</primary>
47398 <secondary>sender in header</secondary>
47400 This condition is relevant only in an ACL that is run after a message has been
47401 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
47402 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
47403 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
47404 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
47405 However, an address that appears in one of these headers need not be an address
47406 that accepts bounce messages; only sender addresses in envelopes are required
47407 to accept bounces. Therefore, if you use the callout option on this check, you
47408 might want to arrange for a non-empty address in the MAIL command.
47411 Details of address verification and the options are given later, starting at
47412 section <xref linkend="SECTaddressverification"/> (callouts are described in section
47413 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
47414 condition to restrict it to bounce messages only:
47416 <literallayout class="monospaced">
47418 message = A valid sender header is required for bounces
47419 !verify = header_sender
47421 </listitem></varlistentry>
47423 <term><emphasis role="bold">verify = header_syntax</emphasis></term>
47426 <indexterm role="concept">
47427 <primary><option>verify</option></primary>
47428 <secondary>ACL condition</secondary>
47430 <indexterm role="concept">
47431 <primary>access control lists (ACLs)</primary>
47432 <secondary>verifying header syntax</secondary>
47434 <indexterm role="concept">
47435 <primary>header lines</primary>
47436 <secondary>verifying syntax</secondary>
47438 <indexterm role="concept">
47439 <primary>verifying</primary>
47440 <secondary>header syntax</secondary>
47442 This condition is relevant only in an ACL that is run after a message has been
47443 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
47444 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
47445 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
47446 and <emphasis>Bcc:</emphasis>). Unqualified addresses (local parts without domains) are
47447 permitted only in locally generated messages and from hosts that match
47448 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
47452 Note that this condition is a syntax check only. However, a common spamming
47453 ploy used to be to send syntactically invalid headers such as
47455 <literallayout class="monospaced">
47459 and this condition can be used to reject such messages, though they are not as
47460 common as they used to be.
47462 </listitem></varlistentry>
47464 <term><emphasis role="bold">verify = helo</emphasis></term>
47467 <indexterm role="concept">
47468 <primary><option>verify</option></primary>
47469 <secondary>ACL condition</secondary>
47471 <indexterm role="concept">
47472 <primary>access control lists (ACLs)</primary>
47473 <secondary>verifying HELO/EHLO</secondary>
47475 <indexterm role="concept">
47476 <primary>HELO</primary>
47477 <secondary>verifying</secondary>
47479 <indexterm role="concept">
47480 <primary>EHLO</primary>
47481 <secondary>verifying</secondary>
47483 <indexterm role="concept">
47484 <primary>verifying</primary>
47485 <secondary>EHLO</secondary>
47487 <indexterm role="concept">
47488 <primary>verifying</primary>
47489 <secondary>HELO</secondary>
47491 This condition is true if a HELO or EHLO command has been received from the
47492 client host, and its contents have been verified. It there has been no previous
47493 attempt to verify the the HELO/EHLO contents, it is carried out when this
47494 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
47495 <option>helo_try_verify_hosts</option> options for details of how to request verification
47496 independently of this condition.
47498 </listitem></varlistentry>
47500 <term><emphasis role="bold">verify = not_blind</emphasis></term>
47503 <indexterm role="concept">
47504 <primary>verifying</primary>
47505 <secondary>not blind</secondary>
47507 <indexterm role="concept">
47508 <primary>bcc recipients</primary>
47509 <secondary>verifying none</secondary>
47511 This condition checks that there are no blind (bcc) recipients in the message.
47512 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
47513 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
47514 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
47515 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
47516 used only in a DATA or non-SMTP ACL.
47519 There are, of course, many legitimate messages that make use of blind (bcc)
47520 recipients. This check should not be used on its own for blocking messages.
47522 </listitem></varlistentry>
47524 <term><emphasis role="bold">verify = recipient/</emphasis><<emphasis>options</emphasis>></term>
47527 <indexterm role="concept">
47528 <primary><option>verify</option></primary>
47529 <secondary>ACL condition</secondary>
47531 <indexterm role="concept">
47532 <primary>access control lists (ACLs)</primary>
47533 <secondary>verifying recipient</secondary>
47535 <indexterm role="concept">
47536 <primary>recipient</primary>
47537 <secondary>verifying</secondary>
47539 <indexterm role="concept">
47540 <primary>verifying</primary>
47541 <secondary>recipient</secondary>
47543 <indexterm role="concept">
47544 <primary><varname>$address_data</varname></primary>
47546 This condition is relevant only after a RCPT command. It verifies the current
47547 recipient. Details of address verification are given later, starting at section
47548 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
47549 of <varname>$address_data</varname> is the last value that was set while routing the address.
47550 This applies even if the verification fails. When an address that is being
47551 verified is redirected to a single address, verification continues with the new
47552 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
47553 value for the child address.
47555 </listitem></varlistentry>
47557 <term><emphasis role="bold">verify = reverse_host_lookup</emphasis></term>
47560 <indexterm role="concept">
47561 <primary><option>verify</option></primary>
47562 <secondary>ACL condition</secondary>
47564 <indexterm role="concept">
47565 <primary>access control lists (ACLs)</primary>
47566 <secondary>verifying host reverse lookup</secondary>
47568 <indexterm role="concept">
47569 <primary>host</primary>
47570 <secondary>verifying reverse lookup</secondary>
47572 This condition ensures that a verified host name has been looked up from the IP
47573 address of the client host. (This may have happened already if the host name
47574 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
47575 Verification ensures that the host name obtained from a reverse DNS lookup, or
47576 one of its aliases, does, when it is itself looked up in the DNS, yield the
47577 original IP address.
47580 If this condition is used for a locally generated message (that is, when there
47581 is no client host involved), it always succeeds.
47583 </listitem></varlistentry>
47585 <term><emphasis role="bold">verify = sender/</emphasis><<emphasis>options</emphasis>></term>
47588 <indexterm role="concept">
47589 <primary><option>verify</option></primary>
47590 <secondary>ACL condition</secondary>
47592 <indexterm role="concept">
47593 <primary>access control lists (ACLs)</primary>
47594 <secondary>verifying sender</secondary>
47596 <indexterm role="concept">
47597 <primary>sender</primary>
47598 <secondary>verifying</secondary>
47600 <indexterm role="concept">
47601 <primary>verifying</primary>
47602 <secondary>sender</secondary>
47604 This condition is relevant only after a MAIL or RCPT command, or after a
47605 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
47606 the message’s sender is empty (that is, this is a bounce message), the
47607 condition is true. Otherwise, the sender address is verified.
47610 <indexterm role="concept">
47611 <primary><varname>$address_data</varname></primary>
47613 <indexterm role="concept">
47614 <primary><varname>$sender_address_data</varname></primary>
47616 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
47617 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
47618 value can be used in subsequent conditions and modifiers in the same ACL
47619 statement. It does not persist after the end of the current statement. If you
47620 want to preserve the value for longer, you can save it in an ACL variable.
47623 Details of verification are given later, starting at section
47624 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
47625 to avoid doing it more than once per message.
47627 </listitem></varlistentry>
47629 <term><emphasis role="bold">verify = sender=</emphasis><<emphasis>address</emphasis>><emphasis role="bold">/</emphasis><<emphasis>options</emphasis>></term>
47632 <indexterm role="concept">
47633 <primary><option>verify</option></primary>
47634 <secondary>ACL condition</secondary>
47636 This is a variation of the previous option, in which a modified address is
47637 verified as a sender.
47639 </listitem></varlistentry>
47642 <section id="SECTmorednslists">
47643 <title>Using DNS lists</title>
47645 <indexterm role="concept">
47646 <primary>DNS list</primary>
47647 <secondary>in ACL</secondary>
47649 <indexterm role="concept">
47650 <primary>black list (DNS)</primary>
47652 <indexterm role="concept">
47653 <primary>access control lists (ACLs)</primary>
47654 <secondary>testing a DNS list</secondary>
47656 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
47657 is on at least one of a number of DNS lists by looking up the inverted IP
47658 address in one or more DNS domains. For example, if the calling host’s IP
47659 address is 192.168.62.43, and the ACL statement is
47661 <literallayout class="monospaced">
47662 deny dnslists = blackholes.mail-abuse.org : \
47663 dialups.mail-abuse.org
47666 the following records are looked up:
47668 <literallayout class="monospaced">
47669 43.62.168.192.blackholes.mail-abuse.org
47670 43.62.168.192.dialups.mail-abuse.org
47673 As soon as Exim finds an existing DNS record, processing of the list stops.
47674 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
47675 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
47676 use two separate conditions:
47678 <literallayout class="monospaced">
47679 deny dnslists = blackholes.mail-abuse.org
47680 dnslists = dialups.mail-abuse.org
47683 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
47684 behaves as if the host does not match the list item, that is, as if the DNS
47685 record does not exist. If there are further items in the DNS list, they are
47689 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
47690 (which is the most common usage), because it prevents a DNS failure from
47691 blocking mail. However, you can change this behaviour by putting one of the
47692 following special items in the list:
47695 <literal>+include_unknown </literal> behave as if the item is on the list
47696 <literal>+exclude_unknown </literal> behave as if the item is not on the list (default)
47697 <literal>+defer_unknown </literal> give a temporary error
47700 <indexterm role="concept">
47701 <primary><literal>+include_unknown</literal></primary>
47703 <indexterm role="concept">
47704 <primary><literal>+exclude_unknown</literal></primary>
47706 <indexterm role="concept">
47707 <primary><literal>+defer_unknown</literal></primary>
47709 Each of these applies to any subsequent items on the list. For example:
47711 <literallayout class="monospaced">
47712 deny dnslists = +defer_unknown : foo.bar.example
47715 Testing the list of domains stops as soon as a match is found. If you want to
47716 warn for one list and block for another, you can use two different statements:
47718 <literallayout class="monospaced">
47719 deny dnslists = blackholes.mail-abuse.org
47720 warn message = X-Warn: sending host is on dialups list
47721 dnslists = dialups.mail-abuse.org
47724 DNS list lookups are cached by Exim for the duration of the SMTP session,
47725 so a lookup based on the IP address is done at most once for any incoming
47726 connection. Exim does not share information between multiple incoming
47727 connections (but your local name server cache should be active).
47731 <title>Specifying the IP address for a DNS list lookup</title>
47733 <indexterm role="concept">
47734 <primary>DNS list</primary>
47735 <secondary>keyed by explicit IP address</secondary>
47737 By default, the IP address that is used in a DNS list lookup is the IP address
47738 of the calling host. However, you can specify another IP address by listing it
47739 after the domain name, introduced by a slash. For example:
47741 <literallayout class="monospaced">
47742 deny dnslists = black.list.tld/192.168.1.2
47745 This feature is not very helpful with explicit IP addresses; it is intended for
47746 use with IP addresses that are looked up, for example, the IP addresses of the
47747 MX hosts or nameservers of an email sender address. For an example, see section
47748 <xref linkend="SECTmulkeyfor"/> below.
47752 <title>DNS lists keyed on domain names</title>
47754 <indexterm role="concept">
47755 <primary>DNS list</primary>
47756 <secondary>keyed by domain name</secondary>
47758 There are some lists that are keyed on domain names rather than inverted IP
47759 addresses (see for example the <emphasis>domain based zones</emphasis> link at
47760 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
47761 with these lists. You can change the name that is looked up in a DNS list by
47762 listing it after the domain name, introduced by a slash. For example,
47764 <literallayout class="monospaced">
47765 deny message = Sender's domain is listed at $dnslist_domain
47766 dnslists = dsn.rfc-ignorant.org/$sender_address_domain
47769 This particular example is useful only in ACLs that are obeyed after the
47770 RCPT or DATA commands, when a sender address is available. If (for
47771 example) the message’s sender is <emphasis>user@tld.example</emphasis> the name that is looked
47772 up by this example is
47774 <literallayout class="monospaced">
47775 tld.example.dsn.rfc-ignorant.org
47778 A single <option>dnslists</option> condition can contain entries for both names and IP
47779 addresses. For example:
47781 <literallayout class="monospaced">
47782 deny dnslists = sbl.spamhaus.org : \
47783 dsn.rfc-ignorant.org/$sender_address_domain
47786 The first item checks the sending host’s IP address; the second checks a domain
47787 name. The whole condition is true if either of the DNS lookups succeeds.
47790 <section id="SECTmulkeyfor">
47791 <title>Multiple explicit keys for a DNS list</title>
47793 <indexterm role="concept">
47794 <primary>DNS list</primary>
47795 <secondary>multiple keys for</secondary>
47797 The syntax described above for looking up explicitly-defined values (either
47798 names or IP addresses) in a DNS blacklist is a simplification. After the domain
47799 name for the DNS list, what follows the slash can in fact be a list of items.
47800 As with all lists in Exim, the default separator is a colon. However, because
47801 this is a sublist within the list of DNS blacklist domains, it is necessary
47802 either to double the separators like this:
47804 <literallayout class="monospaced">
47805 dnslists = black.list.tld/name.1::name.2
47808 or to change the separator character, like this:
47810 <literallayout class="monospaced">
47811 dnslists = black.list.tld/<;name.1;name.2
47814 If an item in the list is an IP address, it is inverted before the DNS
47815 blacklist domain is appended. If it is not an IP address, no inversion
47816 occurs. Consider this condition:
47818 <literallayout class="monospaced">
47819 dnslists = black.list.tld/<;192.168.1.2;a.domain
47822 The DNS lookups that occur are:
47824 <literallayout class="monospaced">
47825 2.1.168.192.black.list.tld
47826 a.domain.black.list.tld
47829 Once a DNS record has been found (that matches a specific IP return
47830 address, if specified – see section <xref linkend="SECTaddmatcon"/>), no further lookups
47831 are done. If there is a temporary DNS error, the rest of the sublist of domains
47832 or IP addresses is tried. A temporary error for the whole dnslists item occurs
47833 only if no other DNS lookup in this sublist succeeds. In other words, a
47834 successful lookup for any of the items in the sublist overrides a temporary
47835 error for a previous item.
47838 The ability to supply a list of items after the slash is in some sense just a
47839 syntactic convenience. These two examples have the same effect:
47841 <literallayout class="monospaced">
47842 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
47843 dnslists = black.list.tld/a.domain::b.domain
47846 However, when the data for the list is obtained from a lookup, the second form
47847 is usually much more convenient. Consider this example:
47849 <literallayout class="monospaced">
47850 deny message = The mail servers for the domain \
47851 $sender_address_domain \
47852 are listed at $dnslist_domain ($dnslist_value); \
47854 dnslists = sbl.spamhaus.org/<|${lookup dnsdb {>|a=<|\
47855 ${lookup dnsdb {>|mxh=\
47856 $sender_address_domain} }} }
47859 Note the use of <literal>>|</literal> in the dnsdb lookup to specify the separator for
47860 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
47861 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
47862 of expanding the condition might be something like this:
47864 <literallayout class="monospaced">
47865 dnslists = sbl.spahmaus.org/<|192.168.2.3|192.168.5.6|...
47868 Thus, this example checks whether or not the IP addresses of the sender
47869 domain’s mail servers are on the Spamhaus black list.
47873 <title>Data returned by DNS lists</title>
47875 <indexterm role="concept">
47876 <primary>DNS list</primary>
47877 <secondary>data returned from</secondary>
47879 DNS lists are constructed using address records in the DNS. The original RBL
47880 just used the address 127.0.0.1 on the right hand side of each record, but the
47881 RBL+ list and some other lists use a number of values with different meanings.
47882 The values used on the RBL+ list are:
47887 127.1.0.3 DUL and RBL
47889 127.1.0.5 RSS and RBL
47890 127.1.0.6 RSS and DUL
47891 127.1.0.7 RSS and DUL and RBL
47894 Some DNS lists may return more than one address record.
47898 <title>Variables set from DNS lists</title>
47900 <indexterm role="concept">
47901 <primary>DNS list</primary>
47902 <secondary>variables set from</secondary>
47904 <indexterm role="concept">
47905 <primary><varname>$dnslist_domain</varname></primary>
47907 <indexterm role="concept">
47908 <primary><varname>$dnslist_text</varname></primary>
47910 <indexterm role="concept">
47911 <primary><varname>$dnslist_value</varname></primary>
47913 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname>
47914 contains the name of the domain that matched, <varname>$dnslist_value</varname> contains the
47915 data from the entry, and <varname>$dnslist_text</varname> contains the contents of any
47916 associated TXT record. If more than one address record is returned by the DNS
47917 lookup, all the IP addresses are included in <varname>$dnslist_value</varname>, separated by
47921 You can use these variables in <option>message</option> or <option>log_message</option> modifiers –
47922 although these appear before the condition in the ACL, they are not expanded
47923 until after it has failed. For example:
47925 <literallayout class="monospaced">
47926 deny hosts = !+local_networks
47927 message = $sender_host_address is listed \
47929 dnslists = rbl-plus.mail-abuse.example
47932 <section id="SECTaddmatcon">
47933 <title>Additional matching conditions for DNS lists</title>
47935 <indexterm role="concept">
47936 <primary>DNS list</primary>
47937 <secondary>matching specific returned data</secondary>
47939 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
47940 in order to restrict its action to DNS records with a matching right hand side.
47943 <literallayout class="monospaced">
47944 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
47947 rejects only those hosts that yield 127.0.0.2. Without this additional data,
47948 any address record is considered to be a match. If more than one address record
47949 is found on the list, they are all checked for a matching right-hand side.
47952 More than one IP address may be given for checking, using a comma as a
47953 separator. These are alternatives – if any one of them matches, the
47954 <option>dnslists</option> condition is true. For example:
47956 <literallayout class="monospaced">
47957 deny dnslists = a.b.c=127.0.0.2,127.0.0.3
47960 If you want to specify a constraining address list and also specify names or IP
47961 addresses to be looked up, the constraining address list must be specified
47962 first. For example:
47964 <literallayout class="monospaced">
47965 deny dnslists = dsn.rfc-ignorant.org\
47966 =127.0.0.2/$sender_address_domain
47969 If the character <literal>&</literal> is used instead of <literal>=</literal>, the comparison for each
47970 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
47971 In other words, the listed addresses are used as bit masks. The comparison is
47972 true if all the bits in the mask are present in the address that is being
47973 tested. For example:
47975 <literallayout class="monospaced">
47976 dnslists = a.b.c&0.0.0.3
47979 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
47980 want to test whether one bit or another bit is present (as opposed to both
47981 being present), you must use multiple values. For example:
47983 <literallayout class="monospaced">
47984 dnslists = a.b.c&0.0.0.1,0.0.0.2
47987 matches if the final component of the address is an odd number or two times
47992 <title>Negated DNS matching conditions</title>
47994 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
47997 <literallayout class="monospaced">
47998 deny dnslists = a.b.c=127.0.0.2,127.0.0.3
48001 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
48002 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
48004 <literallayout class="monospaced">
48005 deny dnslists = a.b.c!=127.0.0.2,127.0.0.3
48008 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
48009 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
48010 words, the result of the test is inverted if an exclamation mark appears before
48011 the <literal>=</literal> (or the <literal>&</literal>) sign.
48014 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
48015 host, or address list (which is why the syntax is different).
48018 If you are using just one list, the negation syntax does not gain you much. The
48019 previous example is precisely equivalent to
48021 <literallayout class="monospaced">
48022 deny dnslists = a.b.c
48023 !dnslists = a.b.c=127.0.0.2,127.0.0.3
48026 However, if you are using multiple lists, the negation syntax is clearer.
48027 Consider this example:
48029 <literallayout class="monospaced">
48030 deny dnslists = sbl.spamhaus.org : \
48032 dnsbl.njabl.org!=127.0.0.3 : \
48036 Using only positive lists, this would have to be:
48038 <literallayout class="monospaced">
48039 deny dnslists = sbl.spamhaus.org : \
48041 deny dnslists = dnsbl.njabl.org
48042 !dnslists = dnsbl.njabl.org=127.0.0.3
48043 deny dnslists = relays.ordb.org
48046 which is less clear, and harder to maintain.
48049 <section id="SECTmorednslistslast">
48050 <title>DNS lists and IPv6</title>
48052 <indexterm role="concept">
48053 <primary>IPv6</primary>
48054 <secondary>DNS black lists</secondary>
48056 <indexterm role="concept">
48057 <primary>DNS list</primary>
48058 <secondary>IPv6 usage</secondary>
48060 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
48061 nibble by nibble. For example, if the calling host’s IP address is
48062 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
48064 <literallayout class="monospaced">
48065 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
48066 f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
48069 (split over two lines here to fit on the page). Unfortunately, some of the DNS
48070 lists contain wildcard records, intended for IPv4, that interact badly with
48071 IPv6. For example, the DNS entry
48073 <literallayout class="monospaced">
48074 *.3.some.list.example. A 127.0.0.1
48077 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
48078 Unfortunately, it also matches the entire 3::/4 IPv6 network.
48081 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
48082 <option>condition</option> condition, as in this example:
48084 <literallayout class="monospaced">
48085 deny condition = ${if isip4{$sender_host_address}}
48086 dnslists = some.list.example
48089 <section id="SECTratelimiting">
48090 <title>Rate limiting senders</title>
48092 <indexterm role="concept">
48093 <primary>rate limiting</primary>
48094 <secondary>client sending</secondary>
48096 <indexterm role="concept">
48097 <primary>limiting client sending rates</primary>
48099 <indexterm role="option">
48100 <primary><option>smpt_ratelimit_*</option></primary>
48102 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
48103 which clients can send email. This is more powerful than the
48104 <option>smtp_ratelimit_*</option> options, because those options control the rate of
48105 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
48106 works across all connections (concurrent and sequential) from the same client
48107 host. The syntax of the <option>ratelimit</option> condition is:
48110 <literal>ratelimit =</literal> <<emphasis>m</emphasis>> <literal>/</literal> <<emphasis>p</emphasis>> <literal>/</literal> <<emphasis>options</emphasis>> <literal>/</literal> <<emphasis>key</emphasis>>
48113 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
48114 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
48117 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
48118 <varname>$sender_rate</varname> to the client’s computed rate, <varname>$sender_rate_limit</varname> to the
48119 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
48120 of <emphasis>p</emphasis>.
48123 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
48124 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
48125 means that it takes Exim longer to forget a client’s past behaviour. The
48126 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
48127 send in each time interval. It also specifies the number of messages permitted
48128 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
48129 constant, you can allow a client to send more messages in a burst without
48130 changing its overall sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
48131 both small, messages must be sent at an even rate.
48134 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
48135 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
48136 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
48137 instructions when it is run with no arguments.
48140 The key is used to look up the data for calculating the client’s average
48141 sending rate. This data is stored in a database maintained by Exim in its spool
48142 directory, alongside the retry and other hints databases. The default key is
48143 <varname>$sender_host_address</varname>, which applies the limit to each client host IP address.
48144 By changing the key you can change how Exim identifies clients for the purpose
48145 of ratelimiting. For example, to limit the sending rate of each authenticated
48146 user, independent of the computer they are sending from, set the key to
48147 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
48148 example, <varname>$authenticated_id</varname> is only meaningful if the client has
48149 authenticated, and you can check with with the <option>authenticated</option> ACL condition.
48152 Internally, Exim includes the smoothing constant <emphasis>p</emphasis> and the options in the
48153 lookup key because they alter the meaning of the stored data. This is not true
48154 for the limit <emphasis>m</emphasis>, so you can alter the configured maximum rate and Exim will
48155 still remember clients’ past behaviour, but if you alter the other ratelimit
48156 parameters Exim forgets past behaviour.
48159 Each <option>ratelimit</option> condition can have up to two options. The first option
48160 specifies what Exim measures the rate of, and the second specifies how Exim
48161 handles excessively fast clients. The options are separated by a slash, like
48162 the other parameters.
48165 The <option>per_conn</option> option limits the client’s connection rate.
48168 The <option>per_mail</option> option limits the client’s rate of sending messages. This is
48169 the default if none of the <option>per_*</option> options is specified.
48172 The <option>per_byte</option> option limits the sender’s email bandwidth. Note that it is
48173 best to use this option in the DATA ACL; if it is used in an earlier ACL it
48174 relies on the SIZE parameter on the MAIL command, which may be inaccurate or
48175 completely missing. You can follow the limit <emphasis>m</emphasis> in the configuration with K,
48176 M, or G to specify limits in kilobytes, megabytes, or gigabytes, respectively.
48179 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
48180 condition is processed. This can be used to limit the SMTP command rate. The
48181 alias <option>per_rcpt</option> is provided for use in the RCPT ACL instead of <option>per_cmd</option>
48182 to make it clear that the effect is to limit the rate at which recipients are
48183 accepted. Note that in this case the rate limiting engine will see a message
48184 with many recipients as a large high-speed burst.
48187 If a client’s average rate is greater than the maximum, the rate limiting
48188 engine can react in two possible ways, depending on the presence of the
48189 <option>strict</option> or <option>leaky</option> options. This is independent of the other
48190 counter-measures (such as rejecting the message) that may be specified by the
48191 rest of the ACL. The default mode is leaky, which avoids a sender’s
48192 over-aggressive retry rate preventing it from getting any email through.
48195 The <option>strict</option> option means that the client’s recorded rate is always updated.
48196 The effect of this is that Exim measures the client’s average rate of attempts
48197 to send email, which can be much higher than the maximum. If the client is over
48198 the limit it will be subjected to counter-measures until it slows down below
48199 the maximum rate. The smoothing period determines the time it takes for a high
48200 sending rate to decay exponentially to 37% of its peak value, which means that
48201 you can work out the time (the number of smoothing periods) that a client is
48202 subjected to counter-measures after an over-limit burst with this formula:
48204 <literallayout class="monospaced">
48205 ln(peakrate/maxrate)
48208 The <option>leaky</option> option means that the client’s recorded rate is not updated if it
48209 is above the limit. The effect of this is that Exim measures the client’s
48210 average rate of successfully sent email, which cannot be greater than the
48211 maximum. If the client is over the limit it will suffer some counter-measures,
48212 but it will still be able to send email at the configured maximum rate,
48213 whatever the rate of its attempts. This is generally the better choice if you
48214 have clients that retry automatically.
48217 Exim’s other ACL facilities are used to define what counter-measures are taken
48218 when the rate limit is exceeded. This might be anything from logging a warning
48219 (for example, while measuring existing sending rates in order to define
48220 policy), through time delays to slow down fast senders, up to rejecting the
48221 message. For example:
48223 <literallayout class="monospaced">
48224 # Log all senders' rates
48226 ratelimit = 0 / 1h / strict
48227 log_message = Sender rate $sender_rate / $sender_rate_period
48229 # Slow down fast senders; note the need to truncate $sender_rate
48230 # at the decimal point.
48232 ratelimit = 100 / 1h / per_rcpt / strict
48233 delay = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
48234 $sender_rate_limit }s
48236 # Keep authenticated users under control
48239 ratelimit = 100 / 1d / strict / $authenticated_id
48241 # System-wide rate limit
48243 message = Sorry, too busy. Try again later.
48244 ratelimit = 10 / 1s / $primary_hostname
48246 # Restrict incoming rate from each host, with a default
48247 # set using a macro and special cases looked up in a table.
48249 message = Sender rate exceeds $sender_rate_limit \
48250 messages per $sender_rate_period
48251 ratelimit = ${lookup {$sender_host_address} \
48252 cdb {DB/ratelimits.cdb} \
48253 {$value} {RATELIMIT} }
48256 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
48257 especially with the <option>per_rcpt</option> option, you may suffer from a performance
48258 bottleneck caused by locking on the ratelimit hints database. Apart from
48259 making your ACLs less complicated, you can reduce the problem by using a
48260 RAM disk for Exim’s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
48261 this means that Exim will lose its hints data after a reboot (including retry
48262 hints, the callout cache, and ratelimit data).
48265 <section id="SECTaddressverification">
48266 <title>Address verification</title>
48268 <indexterm role="concept">
48269 <primary>verifying address</primary>
48270 <secondary>options for</secondary>
48272 <indexterm role="concept">
48273 <primary>policy control</primary>
48274 <secondary>address verification</secondary>
48276 Several of the <option>verify</option> conditions described in section
48277 <xref linkend="SECTaclconditions"/> cause addresses to be verified. These conditions can be
48278 followed by options that modify the verification process. The options are
48279 separated from the keyword and from each other by slashes, and some of them
48280 contain parameters. For example:
48282 <literallayout class="monospaced">
48283 verify = sender/callout
48284 verify = recipient/defer_ok/callout=10s,defer_ok
48287 The first stage of address verification, which always happens, is to run the
48288 address through the routers, in <quote>verify mode</quote>. Routers can detect the
48289 difference between verification and routing for delivery, and their actions can
48290 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
48291 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
48292 The available options are as follows:
48297 If the <option>callout</option> option is specified, successful routing to one or more
48298 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
48299 check. Callouts and their sub-options are discussed in the next section.
48304 If there is a defer error while doing verification routing, the ACL
48305 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
48306 options, the condition is forced to be true instead. Note that this is a main
48307 verification option as well as a suboption for callouts.
48312 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
48313 discusses the reporting of sender address verification failures.
48318 The <option>success_on_redirect</option> option causes verification always to succeed
48319 immediately after a successful redirection. By default, if a redirection
48320 generates just one address, that address is also verified. See further
48321 discussion in section <xref linkend="SECTredirwhilveri"/>.
48326 <indexterm role="concept">
48327 <primary>verifying address</primary>
48328 <secondary>differentiating failures</secondary>
48330 <indexterm role="concept">
48331 <primary><varname>$recipient_verify_failure</varname></primary>
48333 <indexterm role="concept">
48334 <primary><varname>$sender_verify_failure</varname></primary>
48336 <indexterm role="concept">
48337 <primary><varname>$acl_verify_message</varname></primary>
48339 After an address verification failure, <varname>$acl_verify_message</varname> contains the
48340 error message that is associated with the failure. It can be preserved by
48343 <literallayout class="monospaced">
48344 warn !verify = sender
48345 set acl_m0 = $acl_verify_message
48348 If you are writing your own custom rejection message or log message when
48349 denying access, you can use this variable to include information about the
48350 verification failure.
48353 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
48354 appropriate) contains one of the following words:
48359 <option>qualify</option>: The address was unqualified (no domain), and the message
48360 was neither local nor came from an exempted host.
48365 <option>route</option>: Routing failed.
48370 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
48371 occurred at or before the MAIL command (that is, on initial
48372 connection, HELO, or MAIL).
48377 <option>recipient</option>: The RCPT command in a callout was rejected.
48382 <option>postmaster</option>: The postmaster check in a callout was rejected.
48387 The main use of these variables is expected to be to distinguish between
48388 rejections of MAIL and rejections of RCPT in callouts.
48391 <section id="SECTcallver">
48392 <title>Callout verification</title>
48394 <indexterm role="concept">
48395 <primary>verifying address</primary>
48396 <secondary>by callout</secondary>
48398 <indexterm role="concept">
48399 <primary>callout</primary>
48400 <secondary>verification</secondary>
48402 <indexterm role="concept">
48403 <primary>SMTP</primary>
48404 <secondary>callout verification</secondary>
48406 For non-local addresses, routing verifies the domain, but is unable to do any
48407 checking of the local part. There are situations where some means of verifying
48408 the local part is desirable. One way this can be done is to make an SMTP
48409 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
48410 a subsequent host for a recipient address, to see if the host accepts the
48411 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
48412 sender address, the callback is not to the client host that is trying to
48413 deliver the message, but to one of the hosts that accepts incoming mail for the
48414 sender’s domain.
48417 Exim does not do callouts by default. If you want them to happen, you must
48418 request them by setting appropriate options on the <option>verify</option> condition, as
48419 described below. This facility should be used with care, because it can add a
48420 lot of resource usage to the cost of verifying an address. However, Exim does
48421 cache the results of callouts, which helps to reduce the cost. Details of
48422 caching are in section <xref linkend="SECTcallvercache"/>.
48425 Recipient callouts are usually used only between hosts that are controlled by
48426 the same administration. For example, a corporate gateway host could use
48427 callouts to check for valid recipients on an internal mailserver. A successful
48428 callout does not guarantee that a real delivery to the address would succeed;
48429 on the other hand, a failing callout does guarantee that a delivery would fail.
48432 If the <option>callout</option> option is present on a condition that verifies an address, a
48433 second stage of verification occurs if the address is successfully routed to
48434 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
48435 <command>manualroute</command> router, where the router specifies the hosts. However, if a
48436 router that does not set up hosts routes to an <command>smtp</command> transport with a
48437 <option>hosts</option> setting, the transport’s hosts are used. If an <command>smtp</command> transport has
48438 <option>hosts_override</option> set, its hosts are always used, whether or not the router
48439 supplies a host list.
48442 The port that is used is taken from the transport, if it is specified and is a
48443 remote transport. (For routers that do verification only, no transport need be
48444 specified.) Otherwise, the default SMTP port is used. If a remote transport
48445 specifies an outgoing interface, this is used; otherwise the interface is not
48449 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
48450 test whether a bounce message could be delivered to the sender address. The
48451 following SMTP commands are sent:
48454 <literal>HELO </literal><<emphasis>smtp active host name</emphasis>>
48455 <literal>MAIL FROM:<></literal>
48456 <literal>RCPT TO:</literal><<emphasis>the address to be tested</emphasis>>
48457 <literal>QUIT</literal>
48460 LHLO is used instead of HELO if the transport’s <option>protocol</option> option is
48461 set to <quote>lmtp</quote>.
48464 A recipient callout check is similar. By default, it also uses an empty address
48465 for the sender. This default is chosen because most hosts do not make use of
48466 the sender address when verifying a recipient. Using the same address means
48467 that a single cache entry can be used for each recipient. Some sites, however,
48468 do make use of the sender address when verifying. These are catered for by the
48469 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
48472 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
48473 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
48474 Exim tries the next host, if any. If there is a problem with all the remote
48475 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
48476 <option>callout</option> option is given, in which case the condition is forced to succeed.
48479 <section id="CALLaddparcall">
48480 <title>Additional parameters for callouts</title>
48482 <indexterm role="concept">
48483 <primary>callout</primary>
48484 <secondary>additional parameters for</secondary>
48486 The <option>callout</option> option can be followed by an equals sign and a number of
48487 optional parameters, separated by commas. For example:
48489 <literallayout class="monospaced">
48490 verify = recipient/callout=10s,defer_ok
48493 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
48494 separate verify options, is retained for backwards compatibility, but is now
48495 deprecated. The additional parameters for <option>callout</option> are as follows:
48499 <term><<emphasis>a time interval</emphasis>></term>
48502 <indexterm role="concept">
48503 <primary>callout timeout</primary>
48504 <secondary>specifying</secondary>
48506 This specifies the timeout that applies for the callout attempt to each host.
48509 <literallayout class="monospaced">
48510 verify = sender/callout=5s
48513 The default is 30 seconds. The timeout is used for each response from the
48514 remote host. It is also used for the intial connection, unless overridden by
48515 the <option>connect</option> parameter.
48517 </listitem></varlistentry>
48519 <term><emphasis role="bold">connect = </emphasis><<emphasis>time interval</emphasis>></term>
48522 <indexterm role="concept">
48523 <primary>callout connection timeout</primary>
48524 <secondary>specifying</secondary>
48526 This parameter makes it possible to set a different (usually smaller) timeout
48527 for making the SMTP connection. For example:
48529 <literallayout class="monospaced">
48530 verify = sender/callout=5s,connect=1s
48533 If not specified, this timeout defaults to the general timeout value.
48535 </listitem></varlistentry>
48537 <term><emphasis role="bold">defer_ok</emphasis></term>
48540 <indexterm role="concept">
48541 <primary>callout defer</primary>
48542 <secondary>action on</secondary>
48544 When this parameter is present, failure to contact any host, or any other kind
48545 of temporary error, is treated as success by the ACL. However, the cache is not
48546 updated in this circumstance.
48548 </listitem></varlistentry>
48550 <term><emphasis role="bold">fullpostmaster</emphasis></term>
48553 <indexterm role="concept">
48554 <primary>callout</primary>
48555 <secondary>full postmaster check</secondary>
48557 This operates like the <option>postmaster</option> option (see below), but if the check for
48558 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
48559 accordance with the specification in RFC 2821. The RFC states that the
48560 unqualified address <emphasis>postmaster</emphasis> should be accepted.
48562 </listitem></varlistentry>
48564 <term><emphasis role="bold">mailfrom = </emphasis><<emphasis>email address</emphasis>></term>
48567 <indexterm role="concept">
48568 <primary>callout</primary>
48569 <secondary>sender when verifying header</secondary>
48571 When verifying addresses in header lines using the <option>header_sender</option>
48572 verification option, Exim behaves by default as if the addresses are envelope
48573 sender addresses from a message. Callout verification therefore tests to see
48574 whether a bounce message could be delivered, by using an empty address in the
48575 MAIL command. However, it is arguable that these addresses might never be used
48576 as envelope senders, and could therefore justifiably reject bounce messages
48577 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
48578 address to use in the MAIL command. For example:
48580 <literallayout class="monospaced">
48581 require verify = header_sender/callout=mailfrom=abcd@x.y.z
48584 This parameter is available only for the <option>header_sender</option> verification option.
48586 </listitem></varlistentry>
48588 <term><emphasis role="bold">maxwait = </emphasis><<emphasis>time interval</emphasis>></term>
48591 <indexterm role="concept">
48592 <primary>callout overall timeout</primary>
48593 <secondary>specifying</secondary>
48595 This parameter sets an overall timeout for performing a callout verification.
48598 <literallayout class="monospaced">
48599 verify = sender/callout=5s,maxwait=30s
48602 This timeout defaults to four times the callout timeout for individual SMTP
48603 commands. The overall timeout applies when there is more than one host that can
48604 be tried. The timeout is checked before trying the next host. This prevents
48605 very long delays if there are a large number of hosts and all are timing out
48606 (for example, when network connections are timing out).
48608 </listitem></varlistentry>
48610 <term><emphasis role="bold">no_cache</emphasis></term>
48613 <indexterm role="concept">
48614 <primary>callout cache</primary>
48615 <secondary>suppressing</secondary>
48617 <indexterm role="concept">
48618 <primary>caching callout</primary>
48619 <secondary>suppressing</secondary>
48621 When this parameter is given, the callout cache is neither read nor updated.
48623 </listitem></varlistentry>
48625 <term><emphasis role="bold">postmaster</emphasis></term>
48628 <indexterm role="concept">
48629 <primary>callout</primary>
48630 <secondary>postmaster; checking</secondary>
48632 When this parameter is set, a sucessful callout check is followed by a similar
48633 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
48634 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
48635 the postmaster check is recorded in a cache record; if it is a failure, this is
48636 used to fail subsequent callouts for the domain without a connection being
48637 made, until the cache record expires.
48639 </listitem></varlistentry>
48641 <term><emphasis role="bold">postmaster_mailfrom = </emphasis><<emphasis>email address</emphasis>></term>
48644 The postmaster check uses an empty sender in the MAIL command by default.
48645 You can use this parameter to do a postmaster check using a different address.
48648 <literallayout class="monospaced">
48649 require verify = sender/callout=postmaster_mailfrom=abc@x.y.z
48652 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
48653 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
48655 <literallayout class="monospaced">
48656 require verify = sender/callout=postmaster_mailfrom=
48659 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
48660 account of the sender address. It is assumed that either the empty address or
48661 a fixed non-empty address will be used. All that Exim remembers is that the
48662 postmaster check for the domain succeeded or failed.
48664 </listitem></varlistentry>
48666 <term><emphasis role="bold">random</emphasis></term>
48669 <indexterm role="concept">
48670 <primary>callout</primary>
48671 <secondary><quote>random</quote> check</secondary>
48673 When this parameter is set, before doing the normal callout check, Exim does a
48674 check for a <quote>random</quote> local part at the same domain. The local part is not
48675 really random – it is defined by the expansion of the option
48676 <option>callout_random_local_part</option>, which defaults to
48678 <literallayout class="monospaced">
48679 $primary_host_name-$tod_epoch-testing
48682 The idea here is to try to determine whether the remote host accepts all local
48683 parts without checking. If it does, there is no point in doing callouts for
48684 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
48685 a cache record, and used to force the current and subsequent callout checks to
48686 succeed without a connection being made, until the cache record expires.
48688 </listitem></varlistentry>
48690 <term><emphasis role="bold">use_postmaster</emphasis></term>
48693 <indexterm role="concept">
48694 <primary>callout</primary>
48695 <secondary>sender for recipient check</secondary>
48697 This parameter applies to recipient callouts only. For example:
48699 <literallayout class="monospaced">
48700 deny !verify = recipient/callout=use_postmaster
48703 <indexterm role="concept">
48704 <primary><varname>$qualify_domain</varname></primary>
48706 It causes a non-empty postmaster address to be used in the MAIL command when
48707 performing the callout for the recipient, and also for a <quote>random</quote> check if
48708 that is configured. The local part of the address is <literal>postmaster</literal> and the
48709 domain is the contents of <varname>$qualify_domain</varname>.
48711 </listitem></varlistentry>
48713 <term><emphasis role="bold">use_sender</emphasis></term>
48716 This option applies to recipient callouts only. For example:
48718 <literallayout class="monospaced">
48719 require verify = recipient/callout=use_sender
48722 It causes the message’s actual sender address to be used in the MAIL
48723 command when performing the callout, instead of an empty address. There is no
48724 need to use this option unless you know that the called hosts make use of the
48725 sender when checking recipients. If used indiscriminately, it reduces the
48726 usefulness of callout caching.
48728 </listitem></varlistentry>
48731 If you use any of the parameters that set a non-empty sender for the MAIL
48732 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
48733 <option>use_sender</option>), you should think about possible loops. Recipient checking is
48734 usually done between two hosts that are under the same management, and the host
48735 that receives the callouts is not normally configured to do callouts itself.
48736 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
48737 these circumstances.
48740 However, if you use a non-empty sender address for a callout to an arbitrary
48741 host, there is the likelihood that the remote host will itself initiate a
48742 callout check back to your host. As it is checking what appears to be a message
48743 sender, it is likely to use an empty address in MAIL, thus avoiding a
48744 callout loop. However, to be on the safe side it would be best to set up your
48745 own ACLs so that they do not do sender verification checks when the recipient
48746 is the address you use for header sender or postmaster callout checking.
48749 Another issue to think about when using non-empty senders for callouts is
48750 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
48751 by the sender/recipient combination; thus, for any given recipient, many more
48752 actual callouts are performed than when an empty sender or postmaster is used.
48755 <section id="SECTcallvercache">
48756 <title>Callout caching</title>
48758 <indexterm role="concept">
48759 <primary>hints database</primary>
48760 <secondary>callout cache</secondary>
48762 <indexterm role="concept">
48763 <primary>callout</primary>
48764 <secondary>caching</secondary>
48766 <indexterm role="concept">
48767 <primary>caching</primary>
48768 <secondary>callout</secondary>
48770 Exim caches the results of callouts in order to reduce the amount of resources
48771 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
48772 option. A hints database called <quote>callout</quote> is used for the cache. Two
48773 different record types are used: one records the result of a callout check for
48774 a specific address, and the other records information that applies to the
48775 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
48778 When an original callout fails, a detailed SMTP error message is given about
48779 the failure. However, for subsequent failures use the cache data, this message
48783 The expiry times for negative and positive address cache records are
48784 independent, and can be set by the global options <option>callout_negative_expire</option>
48785 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
48788 If a host gives a negative response to an SMTP connection, or rejects any
48789 commands up to and including
48791 <literallayout class="monospaced">
48795 (but not including the MAIL command with a non-empty address),
48796 any callout attempt is bound to fail. Exim remembers such failures in a
48797 domain cache record, which it uses to fail callouts for the domain without
48798 making new connections, until the domain record times out. There are two
48799 separate expiry times for domain cache records:
48800 <option>callout_domain_negative_expire</option> (default 3h) and
48801 <option>callout_domain_positive_expire</option> (default 7d).
48804 Domain records expire when the negative expiry time is reached if callouts
48805 cannot be made for the domain, or if the postmaster check failed.
48806 Otherwise, they expire when the positive expiry time is reached. This
48807 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
48808 will eventually be noticed.
48811 The callout caching mechanism is based on the domain of the address that is
48812 being tested. If the domain routes to several hosts, it is assumed that their
48813 behaviour will be the same.
48816 <section id="SECTsenaddver">
48817 <title>Sender address verification reporting</title>
48819 <indexterm role="concept">
48820 <primary>verifying</primary>
48821 <secondary>suppressing error details</secondary>
48823 When sender verification fails in an ACL, the details of the failure are
48824 given as additional output lines before the 550 response to the relevant
48825 SMTP command (RCPT or DATA). For example, if sender callout is in use,
48828 <literallayout class="monospaced">
48829 MAIL FROM:<xyz@abc.example>
48831 RCPT TO:<pqr@def.example>
48832 550-Verification failed for <xyz@abc.example>
48833 550-Called: 192.168.34.43
48834 550-Sent: RCPT TO:<xyz@abc.example>
48835 550-Response: 550 Unknown local part xyz in <xyz@abc.example>
48836 550 Sender verification failed
48839 If more than one RCPT command fails in the same way, the details are given
48840 only for the first of them. However, some administrators do not want to send
48841 out this much information. You can suppress the details by adding
48842 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
48845 <literallayout class="monospaced">
48846 verify = sender/no_details
48849 <section id="SECTredirwhilveri">
48850 <title>Redirection while verifying</title>
48852 <indexterm role="concept">
48853 <primary>verifying</primary>
48854 <secondary>redirection while</secondary>
48856 <indexterm role="concept">
48857 <primary>address redirection</primary>
48858 <secondary>while verifying</secondary>
48860 A dilemma arises when a local address is redirected by aliasing or forwarding
48861 during verification: should the generated addresses themselves be verified,
48862 or should the successful expansion of the original address be enough to verify
48863 it? By default, Exim takes the following pragmatic approach:
48868 When an incoming address is redirected to just one child address, verification
48869 continues with the child address, and if that fails to verify, the original
48870 verification also fails.
48875 When an incoming address is redirected to more than one child address,
48876 verification does not continue. A success result is returned.
48881 This seems the most reasonable behaviour for the common use of aliasing as a
48882 way of redirecting different local parts to the same mailbox. It means, for
48883 example, that a pair of alias entries of the form
48885 <literallayout class="monospaced">
48887 aw123: :fail: Gone away, no forwarding address
48890 work as expected, with both local parts causing verification failure. When a
48891 redirection generates more than one address, the behaviour is more like a
48892 mailing list, where the existence of the alias itself is sufficient for
48893 verification to succeed.
48896 It is possible, however, to change the default behaviour so that all successful
48897 redirections count as successful verifications, however many new addresses are
48898 generated. This is specified by the <option>success_on_redirect</option> verification
48899 option. For example:
48901 <literallayout class="monospaced">
48902 require verify = recipient/success_on_redirect/callout=10s
48905 In this example, verification succeeds if a router generates a new address, and
48906 the callout does not occur, because no address was routed to a remote host.
48909 <section id="SECTverifyCSA">
48910 <title>Client SMTP authorization (CSA)</title>
48912 <indexterm role="concept">
48913 <primary>CSA</primary>
48914 <secondary>verifying</secondary>
48916 Client SMTP Authorization is a system that allows a site to advertise
48917 which machines are and are not permitted to send email. This is done by placing
48918 special SRV records in the DNS; these are looked up using the client’s HELO
48919 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
48920 Authorization checks in Exim are performed by the ACL condition:
48922 <literallayout class="monospaced">
48926 This fails if the client is not authorized. If there is a DNS problem, or if no
48927 valid CSA SRV record is found, or if the client is authorized, the condition
48928 succeeds. These three cases can be distinguished using the expansion variable
48929 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
48930 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
48931 be likely to cause problems for legitimate email.
48934 The error messages produced by the CSA code include slightly more
48935 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
48936 looking up the CSA SRV record, or problems looking up the CSA target
48937 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
48942 The client’s host name is explicitly not authorized.
48947 The client’s IP address does not match any of the CSA target IP addresses.
48952 The client’s host name is authorized but it has no valid target IP addresses
48953 (for example, the target’s addresses are IPv6 and the client is using IPv4).
48958 The client’s host name has no CSA SRV record but a parent domain has asserted
48959 that all subdomains must be explicitly authorized.
48964 The <option>csa</option> verification condition can take an argument which is the domain to
48965 use for the DNS query. The default is:
48967 <literallayout class="monospaced">
48968 verify = csa/$sender_helo_name
48971 This implementation includes an extension to CSA. If the query domain
48972 is an address literal such as [192.0.2.95], or if it is a bare IP
48973 address, Exim searches for CSA SRV records in the reverse DNS as if
48974 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
48977 <literallayout class="monospaced">
48978 verify = csa/$sender_host_address
48981 In fact, this is the check that Exim performs if the client does not say HELO.
48982 This extension can be turned off by setting the main configuration option
48983 <option>dns_csa_use_reverse</option> to be false.
48986 If a CSA SRV record is not found for the domain itself, a search
48987 is performed through its parent domains for a record which might be
48988 making assertions about subdomains. The maximum depth of this search is limited
48989 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
48990 default. Exim does not look for CSA SRV records in a top level domain, so the
48991 default settings handle HELO domains as long as seven
48992 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
48993 of legitimate HELO domains.
48996 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
48997 direct SRV lookups, this is not sufficient because of the extra parent domain
48998 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
48999 addresses into lookups in the reverse DNS space. The result of a successful
49002 <literallayout class="monospaced">
49003 ${lookup dnsdb {csa=$sender_helo_name}}
49006 has two space-separated fields: an authorization code and a target host name.
49007 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
49008 authorization required but absent, or <quote>?</quote> for unknown.
49011 <section id="SECTverifyPRVS">
49012 <title>Bounce address tag validation</title>
49014 <indexterm role="concept">
49015 <primary>BATV</primary>
49016 <secondary>verifying</secondary>
49018 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
49019 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
49020 Genuine incoming bounce messages should therefore always be addressed to
49021 recipients that have a valid tag. This scheme is a way of detecting unwanted
49022 bounce messages caused by sender address forgeries (often called <quote>collateral
49023 spam</quote>), because the recipients of such messages do not include valid tags.
49026 There are two expansion items to help with the implementation of the BATV
49027 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
49028 the original envelope sender address by using a simple shared key to add a hash
49029 of the address and some time-based randomizing information. The <option>prvs</option>
49030 expansion item creates a signed address, and the <option>prvscheck</option> expansion item
49031 checks one. The syntax of these expansion items is described in section
49032 <xref linkend="SECTexpansionitems"/>.
49035 As an example, suppose the secret per-address keys are stored in an MySQL
49036 database. A query to look up the key for an address could be defined as a macro
49039 <literallayout class="monospaced">
49040 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
49041 WHERE sender='${quote_mysql:$prvscheck_address}'\
49045 Suppose also that the senders who make use of BATV are defined by an address
49046 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
49049 <literallayout class="monospaced">
49050 # Bounces: drop unsigned addresses for BATV senders
49051 deny message = This address does not send an unsigned reverse path.
49053 recipients = +batv_senders
49055 # Bounces: In case of prvs-signed address, check signature.
49056 deny message = Invalid reverse path signature.
49058 condition = ${prvscheck {$local_part@$domain}\
49059 {PRVSCHECK_SQL}{1}}
49060 !condition = $prvscheck_result
49063 The first statement rejects recipients for bounce messages that are addressed
49064 to plain BATV sender addresses, because it is known that BATV senders do not
49065 send out messages with plain sender addresses. The second statement rejects
49066 recipients that are prvs-signed, but with invalid signatures (either because
49067 the key is wrong, or the signature has timed out).
49070 A non-prvs-signed address is not rejected by the second statement, because the
49071 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
49072 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
49073 the first argument is a syntactically valid prvs-signed address, the yield is
49074 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
49075 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
49076 of the checks (empty for failure, <quote>1</quote> for success).
49078 <para revisionflag="changed">
49079 There are two more issues you must consider when implementing prvs-signing.
49080 Firstly, you need to ensure that prvs-signed addresses are not blocked by your
49081 ACLs. A prvs-signed address contains a slash character, but the default Exim
49082 configuration contains this statement in the RCPT ACL:
49084 <literallayout class="monospaced" revisionflag="changed">
49085 deny message = Restricted characters in address
49086 domains = +local_domains
49087 local_parts = ^[.] : ^.*[@%!/|]
49089 <para revisionflag="changed">
49090 This is a conservative rule that blocks local parts that contain slashes. You
49091 should remove the slash in the last line.
49094 Secondly, you have to ensure that the routers accept prvs-signed addresses and
49095 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
49096 router to remove the signature with a configuration along these lines:
49098 <literallayout class="monospaced">
49101 data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
49104 This works because, if the third argument of <option>prvscheck</option> is empty, the result
49105 of the expansion of a prvs-signed address is the decoded value of the original
49106 address. This router should probably be the first of your routers that handles
49110 To create BATV-signed addresses in the first place, a transport of this form
49113 <literallayout class="monospaced">
49114 external_smtp_batv:
49116 return_path = ${prvs {$return_path} \
49117 {${lookup mysql{SELECT \
49118 secret FROM batv_prvs WHERE \
49119 sender='${quote_mysql:$sender_address}'} \
49123 If no key can be found for the existing return path, no signing takes place.
49126 <section id="SECTrelaycontrol">
49127 <title>Using an ACL to control relaying</title>
49129 <indexterm role="concept">
49130 <primary>access control lists (ACLs)</primary>
49131 <secondary>relay control</secondary>
49133 <indexterm role="concept">
49134 <primary>relaying</primary>
49135 <secondary>control by ACL</secondary>
49137 <indexterm role="concept">
49138 <primary>policy control</primary>
49139 <secondary>relay control</secondary>
49141 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
49142 delivers it directly to another host as a result of a remote address contained
49143 within it. Redirecting a local address via an alias or forward file and then
49144 passing the message on to another host is not relaying,
49145 <indexterm role="concept">
49146 <primary><quote>percent hack</quote></primary>
49148 but a redirection as a result of the <quote>percent hack</quote> is.
49151 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
49152 A host which is acting as a gateway or an MX backup is concerned with incoming
49153 relaying from arbitrary hosts to a specific set of domains. On the other hand,
49154 a host which is acting as a smart host for a number of clients is concerned
49155 with outgoing relaying from those clients to the Internet at large. Often the
49156 same host is fulfilling both functions,
49157 but in principle these two kinds of relaying are entirely independent. What is
49158 not wanted is the transmission of mail from arbitrary remote hosts through your
49159 system to arbitrary domains.
49162 You can implement relay control by means of suitable statements in the ACL that
49163 runs for each RCPT command. For convenience, it is often easiest to use
49164 Exim’s named list facility to define the domains and hosts involved. For
49165 example, suppose you want to do the following:
49170 Deliver a number of domains to mailboxes on the local host (or process them
49171 locally in some other way). Let’s say these are <emphasis>my.dom1.example</emphasis> and
49172 <emphasis>my.dom2.example</emphasis>.
49177 Relay mail for a number of other domains for which you are the secondary MX.
49178 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
49183 Relay mail from the hosts on your local LAN, to whatever domains are involved.
49184 Suppose your LAN is 192.168.45.0/24.
49189 In the main part of the configuration, you put the following definitions:
49191 <literallayout class="monospaced">
49192 domainlist local_domains = my.dom1.example : my.dom2.example
49193 domainlist relay_domains = friend1.example : friend2.example
49194 hostlist relay_hosts = 192.168.45.0/24
49197 Now you can use these definitions in the ACL that is run for every RCPT
49200 <literallayout class="monospaced">
49202 accept domains = +local_domains : +relay_domains
49203 accept hosts = +relay_hosts
49206 The first statement accepts any RCPT command that contains an address in
49207 the local or relay domains. For any other domain, control passes to the second
49208 statement, which accepts the command only if it comes from one of the relay
49209 hosts. In practice, you will probably want to make your ACL more sophisticated
49210 than this, for example, by including sender and recipient verification. The
49211 default configuration includes a more comprehensive example, which is described
49212 in chapter <xref linkend="CHAPdefconfil"/>.
49215 <section id="SECTcheralcon">
49216 <title>Checking a relay configuration</title>
49218 <indexterm role="concept">
49219 <primary>relaying</primary>
49220 <secondary>checking control of</secondary>
49222 You can check the relay characteristics of your configuration in the same way
49223 that you can test any ACL behaviour for an incoming SMTP connection, by using
49224 the <option>-bh</option> option to run a fake SMTP session with which you interact.
49227 For specifically testing for unwanted relaying, the host
49228 <emphasis>relay-test.mail-abuse.org</emphasis> provides a useful service. If you telnet to this
49229 host from the host on which Exim is running, using the normal telnet port, you
49230 will see a normal telnet connection message and then quite a long delay. Be
49231 patient. The remote host is making an SMTP connection back to your host, and
49232 trying a number of common probes to test for open relay vulnerability. The
49233 results of the tests will eventually appear on your terminal.
49234 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
49239 <chapter id="CHAPexiscan">
49240 <title>Content scanning at ACL time</title>
49242 <indexterm role="concept" id="IIDcosca" class="startofrange">
49243 <primary>content scanning</primary>
49244 <secondary>at ACL time</secondary>
49246 The extension of Exim to include content scanning at ACL time, formerly known
49247 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
49248 was integrated into the main source for Exim release 4.50, and Tom continues to
49249 maintain it. Most of the wording of this chapter is taken from Tom’s
49253 It is also possible to scan the content of messages at other times. The
49254 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
49255 scanning after all the ACLs have run. A transport filter can be used to scan
49256 messages at delivery time (see the <option>transport_filter</option> option, described in
49257 chapter <xref linkend="CHAPtransportgeneric"/>).
49260 If you want to include the ACL-time content-scanning features when you compile
49261 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
49262 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
49267 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
49268 for all MIME parts for SMTP and non-SMTP messages, respectively.
49273 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
49274 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
49275 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
49280 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
49281 of messages, or parts of messages, for debugging purposes.
49286 Additional expansion variables that are set in the new ACL and by the new
49292 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
49297 There is another content-scanning configuration option for <filename>Local/Makefile</filename>,
49298 called WITH_OLD_DEMIME. If this is set, the old, deprecated <option>demime</option> ACL
49299 condition is compiled, in addition to all the other content-scanning features.
49302 Content-scanning is continually evolving, and new features are still being
49303 added. While such features are still unstable and liable to incompatible
49304 changes, they are made available in Exim by setting options whose names begin
49305 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
49306 this manual. You can find out about them by reading the file called
49307 <filename>doc/experimental.txt</filename>.
49310 All the content-scanning facilites work on a MBOX copy of the message that is
49311 temporarily created in a file called:
49314 <<emphasis>spool_directory</emphasis>><literal>/scan/</literal><<emphasis>message_id</emphasis>>/<<emphasis>message_id</emphasis>><literal>.eml</literal>
49317 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
49318 expect an MBOX-like structure inside that file. The file is created when the
49319 first content scanning facility is called. Subsequent calls to content
49320 scanning conditions open the same file again. The directory is recursively
49321 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
49323 <literallayout class="monospaced">
49324 control = no_mbox_unspool
49327 has been encountered. When the MIME ACL decodes files, they are put into the
49328 same directory by default.
49330 <section id="SECTscanvirus">
49331 <title>Scanning for viruses</title>
49333 <indexterm role="concept">
49334 <primary>virus scanning</primary>
49336 <indexterm role="concept">
49337 <primary>content scanning</primary>
49338 <secondary>for viruses</secondary>
49340 <indexterm role="concept">
49341 <primary>content scanning</primary>
49342 <secondary>the <option>malware</option> condition</secondary>
49344 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
49345 It supports a <quote>generic</quote> interface to scanners called via the shell, and
49346 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
49347 in memory and thus are much faster.
49350 <indexterm role="concept">
49351 <primary><option>av_scanner</option></primary>
49353 You can set the <option>av_scanner</option> option in first part of the Exim configuration
49354 file to specify which scanner to use, together with any additional options that
49355 are needed. The basic syntax is as follows:
49358 <literal>av_scanner = <</literal><emphasis>scanner-type</emphasis><literal>>:<</literal><emphasis>option1</emphasis><literal>>:<</literal><emphasis>option2</emphasis><literal>>:[...]</literal>
49361 If you do not set <option>av_scanner</option>, it defaults to
49363 <literallayout class="monospaced">
49364 av_scanner = sophie:/var/run/sophie
49367 If the value of <option>av_scanner</option> starts with dollar character, it is expanded
49368 before use. The following scanner types are supported in this release:
49372 <term><option>aveserver</option></term>
49375 <indexterm role="concept">
49376 <primary>virus scanners</primary>
49377 <secondary>Kaspersky</secondary>
49379 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
49380 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
49381 which is the path to the daemon’s UNIX socket. The default is shown in this
49384 <literallayout class="monospaced">
49385 av_scanner = aveserver:/var/run/aveserver
49387 </listitem></varlistentry>
49389 <term><option>clamd</option></term>
49392 <indexterm role="concept">
49393 <primary>virus scanners</primary>
49394 <secondary>clamd</secondary>
49396 This daemon-type scanner is GPL and free. You can get it at
49397 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
49398 unpack MIME containers, so it used to be recommended to unpack MIME attachments
49399 in the MIME ACL. This no longer believed to be necessary. One option is
49400 required: either the path and name of a UNIX socket file, or a hostname or IP
49401 number, and a port, separated by space, as in the second of these examples:
49403 <literallayout class="monospaced">
49404 av_scanner = clamd:/opt/clamd/socket
49405 av_scanner = clamd:192.168.2.100 1234
49408 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
49409 contributing the code for this scanner.
49411 </listitem></varlistentry>
49413 <term><option>cmdline</option></term>
49416 <indexterm role="concept">
49417 <primary>virus scanners</primary>
49418 <secondary>command line interface</secondary>
49420 This is the keyword for the generic command line scanner interface. It can be
49421 used to attach virus scanners that are invoked from the shell. This scanner
49422 type takes 3 mandatory options:
49424 <orderedlist numeration="arabic">
49427 The full path and name of the scanner binary, with all command line options,
49428 and a placeholder (<literal>%s</literal>) for the directory to scan.
49433 A regular expression to match against the STDOUT and STDERR output of the
49434 virus scanner. If the expression matches, a virus was found. You must make
49435 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
49436 the <quote>trigger</quote> expression.
49441 Another regular expression, containing exactly one pair of parentheses, to
49442 match the name of the virus found in the scanners output. This is called the
49443 <quote>name</quote> expression.
49448 For example, Sophos Sweep reports a virus on a line like this:
49450 <literallayout class="monospaced">
49451 Virus 'W32/Magistr-B' found in file ./those.bat
49454 For the trigger expression, we can just match the word <quote>found</quote>. For the name
49455 expression, we want to extract the W32/Magistr-B string, so we can match for
49456 the single quotes left and right of it. Altogether, this makes the
49457 configuration setting:
49459 <literallayout class="monospaced">
49460 av_scanner = cmdline:\
49461 /path/to/sweep -all -rec -archive %s:\
49464 </listitem></varlistentry>
49466 <term><option>drweb</option></term>
49469 <indexterm role="concept">
49470 <primary>virus scanners</primary>
49471 <secondary>DrWeb</secondary>
49473 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface takes one
49474 argument, either a full path to a UNIX socket, or an IP address and port
49475 separated by white space, as in these examples:
49477 <literallayout class="monospaced">
49478 av_scanner = drweb:/var/run/drwebd.sock
49479 av_scanner = drweb:192.168.2.20 31337
49482 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
49483 is used. Thanks to Alex Miller for contributing the code for this scanner.
49485 </listitem></varlistentry>
49487 <term><option>fsecure</option></term>
49490 <indexterm role="concept">
49491 <primary>virus scanners</primary>
49492 <secondary>F-Secure</secondary>
49494 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
49495 argument which is the path to a UNIX socket. For example:
49497 <literallayout class="monospaced">
49498 av_scanner = fsecure:/path/to/.fsav
49501 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
49502 Thelmen for contributing the code for this scanner.
49504 </listitem></varlistentry>
49506 <term><option>kavdaemon</option></term>
49509 <indexterm role="concept">
49510 <primary>virus scanners</primary>
49511 <secondary>Kaspersky</secondary>
49513 This is the scanner daemon of Kaspersky Version 4. This version of the
49514 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
49515 scanner type takes one option, which is the path to the daemon’s UNIX socket.
49518 <literallayout class="monospaced">
49519 av_scanner = kavdaemon:/opt/AVP/AvpCtl
49522 The default path is <filename>/var/run/AvpCtl</filename>.
49524 </listitem></varlistentry>
49526 <term><option>mksd</option></term>
49529 <indexterm role="concept">
49530 <primary>virus scanners</primary>
49531 <secondary>mksd</secondary>
49533 This is a daemon type scanner that is aimed mainly at Polish users, though some
49534 parts of documentation are now available in English. You can get it at
49535 <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
49536 the maximum number of processes used simultaneously to scan the attachments,
49537 provided that the demime facility is employed and also provided that mksd has
49538 been run with at least the same number of child processes. For example:
49540 <literallayout class="monospaced">
49541 av_scanner = mksd:2
49544 You can safely omit this option (the default value is 1).
49546 </listitem></varlistentry>
49548 <term><option>sophie</option></term>
49551 <indexterm role="concept">
49552 <primary>virus scanners</primary>
49553 <secondary>Sophos and Sophie</secondary>
49555 Sophie is a daemon that uses Sophos’ <option>libsavi</option> library to scan for viruses.
49556 You can get Sophie at <emphasis role="bold"><ulink url="http://www.vanja.com/tools/sophie/">http://www.vanja.com/tools/sophie/</ulink></emphasis>. The only
49557 option for this scanner type is the path to the UNIX socket that Sophie uses
49558 for client communication. For example:
49560 <literallayout class="monospaced">
49561 av_scanner = sophie:/tmp/sophie
49564 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
49567 </listitem></varlistentry>
49570 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
49571 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
49575 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
49576 makes it possible to use different scanners. See further below for an example.
49577 The <option>malware</option> condition caches its results, so when you use it multiple times
49578 for the same message, the actual scanning process is only carried out once.
49579 However, using expandable items in <option>av_scanner</option> disables this caching, in
49580 which case each use of the <option>malware</option> condition causes a new scan of the
49584 The <option>malware</option> condition takes a right-hand argument that is expanded before
49585 use. It can then be one of
49590 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
49591 The condition succeeds if a virus was found, and fail otherwise. This is the
49597 <quote>false</quote> or <quote>0</quote>, in which case no scanning is done and the condition fails
49603 A regular expression, in which case the message is scanned for viruses. The
49604 condition succeeds if a virus is found and its name matches the regular
49605 expression. This allows you to take special actions on certain types of virus.
49610 You can append <literal>/defer_ok</literal> to the <option>malware</option> condition to accept messages
49611 even if there is a problem with the virus scanner.
49614 <indexterm role="concept">
49615 <primary><varname>$malware_name</varname></primary>
49617 When a virus is found, the condition sets up an expansion variable called
49618 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
49619 <option>message</option> modifier that specifies the error returned to the sender, and/or in
49623 If your virus scanner cannot unpack MIME and TNEF containers itself, you should
49624 use the <option>demime</option> condition (see section <xref linkend="SECTdemimecond"/>) before the
49625 <option>malware</option> condition.
49628 Here is a very simple scanning example:
49630 <literallayout class="monospaced">
49631 deny message = This message contains malware ($malware_name)
49636 The next example accepts messages when there is a problem with the scanner:
49638 <literallayout class="monospaced">
49639 deny message = This message contains malware ($malware_name)
49641 malware = */defer_ok
49644 The next example shows how to use an ACL variable to scan with both sophie and
49645 aveserver. It assumes you have set:
49647 <literallayout class="monospaced">
49648 av_scanner = $acl_m0
49651 in the main Exim configuration.
49653 <literallayout class="monospaced">
49654 deny message = This message contains malware ($malware_name)
49655 set acl_m0 = sophie
49658 deny message = This message contains malware ($malware_name)
49659 set acl_m0 = aveserver
49663 <section id="SECTscanspamass">
49664 <title>Scanning with SpamAssassin</title>
49666 <indexterm role="concept">
49667 <primary>content scanning</primary>
49668 <secondary>for spam</secondary>
49670 <indexterm role="concept">
49671 <primary>spam scanning</primary>
49673 <indexterm role="concept">
49674 <primary>SpamAssassin</primary>
49675 <secondary>scanning with</secondary>
49677 The <option>spam</option> ACL condition calls SpamAssassin’s <option>spamd</option> daemon to get a spam
49678 score and a report for the message. You can get SpamAssassin at
49679 <emphasis role="bold"><ulink url="http://www.spamassassin.org">http://www.spamassassin.org</ulink></emphasis>, or, if you have a working Perl
49680 installation, you can use CPAN by running:
49682 <literallayout class="monospaced">
49683 perl -MCPAN -e 'install Mail::SpamAssassin'
49686 SpamAssassin has its own set of configuration files. Please review its
49687 documentation to see how you can tweak it. The default installation should work
49691 <indexterm role="concept">
49692 <primary><option>spamd_address</option></primary>
49694 After having installed and configured SpamAssassin, start the <option>spamd</option> daemon.
49695 By default, it listens on 127.0.0.1, TCP port 783. If you use another host or
49696 port for <option>spamd</option>, you must set the <option>spamd_address</option> option in the global
49697 part of the Exim configuration as follows (example):
49699 <literallayout class="monospaced">
49700 spamd_address = 192.168.99.45 387
49703 You do not need to set this option if you use the default. As of version 2.60,
49704 <option>spamd</option> also supports communication over UNIX sockets. If you want to use
49705 these, supply <option>spamd_address</option> with an absolute file name instead of a
49708 <literallayout class="monospaced">
49709 spamd_address = /var/run/spamd_socket
49712 You can have multiple <option>spamd</option> servers to improve scalability. These can
49713 reside on other hardware reachable over the network. To specify multiple
49714 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
49715 option, separated with colons:
49717 <literallayout class="monospaced">
49718 spamd_address = 192.168.2.10 783 : \
49719 192.168.2.11 783 : \
49723 Up to 32 <option>spamd</option> servers are supported. The servers are queried in a random
49724 fashion. When a server fails to respond to the connection attempt, all other
49725 servers are tried until one succeeds. If no server responds, the <option>spam</option>
49729 <emphasis role="bold">Warning</emphasis>: It is not possible to use the UNIX socket connection method with
49730 multiple <option>spamd</option> servers.
49734 <title>Calling SpamAssassin from an Exim ACL</title>
49736 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
49738 <literallayout class="monospaced">
49739 deny message = This message was classified as SPAM
49743 The right-hand side of the <option>spam</option> condition specifies the username that
49744 SpamAssassin should scan for. If you do not want to scan for a particular user,
49745 but rather use the SpamAssassin system-wide default profile, you can scan for
49746 an unknown user, or simply use <quote>nobody</quote>. However, you must put something on
49747 the right-hand side.
49750 The username allows you to use per-domain or per-user antispam profiles. The
49751 right-hand side is expanded before being used, so you can put lookups or
49752 conditions there. When the right-hand side evaluates to <quote>0</quote> or <quote>false</quote>, no
49753 scanning is done and the condition fails immediately.
49756 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
49757 large ones may cause significant performance degredation. As most spam messages
49758 are quite small, it is recommended that you do not scan the big ones. For
49761 <literallayout class="monospaced">
49762 deny message = This message was classified as SPAM
49763 condition = ${if < {$message_size}{10K}}
49767 The <option>spam</option> condition returns true if the threshold specified in the user’s
49768 SpamAssassin profile has been matched or exceeded. If you want to use the
49769 <option>spam</option> condition for its side effects (see the variables below), you can make
49770 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
49773 <indexterm role="concept">
49774 <primary>spam scanning</primary>
49775 <secondary>returned variables</secondary>
49777 When the <option>spam</option> condition is run, it sets up the following expansion
49782 <term><varname>$spam_score</varname></term>
49785 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
49786 for inclusion in log or reject messages.
49788 </listitem></varlistentry>
49790 <term><varname>$spam_score_int</varname></term>
49793 The spam score of the message, multiplied by ten, as an integer value. For
49794 example <quote>34</quote> or <quote>305</quote>. This is useful for numeric comparisons in
49795 conditions. This variable is special; it is saved with the message, and written
49796 to Exim’s spool file. This means that it can be used during the whole life of
49797 the message on your Exim system, in particular, in routers or transports during
49798 the later delivery phase.
49800 </listitem></varlistentry>
49802 <term><varname>$spam_bar</varname></term>
49805 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
49806 integer part of the spam score value. A spam score of 4.4 would have a
49807 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
49808 headers, since MUAs can match on such strings.
49810 </listitem></varlistentry>
49812 <term><varname>$spam_report</varname></term>
49815 A multiline text table, containing the full SpamAssassin report for the
49816 message. Useful for inclusion in headers or reject messages.
49818 </listitem></varlistentry>
49821 The <option>spam</option> condition caches its results. If you call it again with the same
49822 user name, it does not scan again, but rather returns the same values as
49826 The <option>spam</option> condition returns DEFER if there is any error while running the
49827 message through SpamAssassin. If you want to treat DEFER as FAIL (to pass on to
49828 the next ACL statement block), append <literal>/defer_ok</literal> to the right-hand side of
49829 the spam condition, like this:
49831 <literallayout class="monospaced">
49832 deny message = This message was classified as SPAM
49833 spam = joe/defer_ok
49836 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
49839 Here is a longer, commented example of the use of the <option>spam</option>
49842 <literallayout class="monospaced">
49843 # put headers in all messages (no matter if spam or not)
49844 warn message = X-Spam-Score: $spam_score ($spam_bar)
49846 warn message = X-Spam-Report: $spam_report
49849 # add second subject line with *SPAM* marker when message
49850 # is over threshold
49851 warn message = Subject: *SPAM* $h_Subject:
49854 # reject spam at high scores (> 12)
49855 deny message = This message scored $spam_score spam points.
49857 condition = ${if >{$spam_score_int}{120}{1}{0}}
49860 <section id="SECTscanmimepart">
49861 <title>Scanning MIME parts</title>
49863 <indexterm role="concept">
49864 <primary>content scanning</primary>
49865 <secondary>MIME parts</secondary>
49867 <indexterm role="concept">
49868 <primary>MIME content scanning</primary>
49870 <indexterm role="concept">
49871 <primary><option>acl_smtp_mime</option></primary>
49873 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
49874 each MIME part of an SMTP message, including multipart types, in the sequence
49875 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
49876 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
49877 options may both refer to the same ACL if you want the same processing in both
49881 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
49882 ACL in the case of an SMTP message, or just before a non-SMTP message is
49883 accepted. However, a MIME ACL is called only if the message contains a
49884 <emphasis>MIME-Version:</emphasis> header line. When a call to a MIME ACL does not yield
49885 <quote>accept</quote>, ACL processing is aborted and the appropriate result code is sent
49886 to the client. In the case of an SMTP message, the <option>acl_smtp_data</option> ACL is not
49887 called when this happens.
49890 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
49891 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
49892 condition to match against the raw MIME part. You can also use the
49893 <option>mime_regex</option> condition to match against the decoded MIME part (see section
49894 <xref linkend="SECTscanregex"/>).
49897 At the start of a MIME ACL, a number of variables are set from the header
49898 information for the relevant MIME part. These are described below. The contents
49899 of the MIME part are not by default decoded into a disk file except for MIME
49900 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
49901 part into a disk file, you can use the <option>decode</option> modifier. The general syntax
49905 <literal>decode = [/</literal><<emphasis>path</emphasis>><literal>/]</literal><<emphasis>filename</emphasis>>
49908 The right hand side is expanded before use. After expansion,
49911 <orderedlist numeration="arabic">
49914 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
49919 The string <quote>default</quote>. In that case, the file is put in the temporary
49920 <quote>default</quote> directory <<emphasis>spool_directory</emphasis>><filename>/scan/</filename><<emphasis>message_id</emphasis>><filename>/</filename> with
49921 a sequential file name consisting of the message id and a sequence number. The
49922 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
49927 A full path name starting with a slash. If the full name is an existing
49928 directory, it is used as a replacement for the default directory. The filename
49929 is then sequentially assigned. If the path does not exist, it is used as
49930 the full path and file name.
49935 If the string does not start with a slash, it is used as the
49936 filename, and the default path is then used.
49941 You can easily decode a file with its original, proposed filename using
49943 <literallayout class="monospaced">
49944 decode = $mime_filename
49947 However, you should keep in mind that <varname>$mime_filename</varname> might contain
49948 anything. If you place files outside of the default path, they are not
49949 automatically unlinked.
49952 For RFC822 attachments (these are messages attached to messages, with a
49953 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
49954 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
49955 variable is set (see below). Attached messages are always decoded to disk
49956 before being checked, and the files are unlinked once the check is done.
49959 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
49960 used to match regular expressions against raw and decoded MIME parts,
49961 respectively. They are described in section <xref linkend="SECTscanregex"/>.
49964 <indexterm role="concept">
49965 <primary>MIME content scanning</primary>
49966 <secondary>returned variables</secondary>
49968 The following list describes all expansion variables that are
49969 available in the MIME ACL:
49973 <term><varname>$mime_boundary</varname></term>
49976 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
49977 have a boundary string, which is stored in this variable. If the current part
49978 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
49979 contains the empty string.
49981 </listitem></varlistentry>
49983 <term><varname>$mime_charset</varname></term>
49986 This variable contains the character set identifier, if one was found in the
49987 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
49989 <literallayout class="monospaced">
49995 Please note that this value is not normalized, so you should do matches
49996 case-insensitively.
49998 </listitem></varlistentry>
50000 <term><varname>$mime_content_description</varname></term>
50003 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
50004 header. It can contain a human-readable description of the parts content. Some
50005 implementations repeat the filename for attachments here, but they are usually
50006 only used for display purposes.
50008 </listitem></varlistentry>
50010 <term><varname>$mime_content_disposition</varname></term>
50013 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
50014 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
50016 </listitem></varlistentry>
50018 <term><varname>$mime_content_id</varname></term>
50021 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
50022 This is a unique ID that can be used to reference a part from another part.
50024 </listitem></varlistentry>
50026 <term><varname>$mime_content_size</varname></term>
50029 This variable is set only after the <option>decode</option> modifier (see above) has been
50030 successfully run. It contains the size of the decoded part in kilobytes. The
50031 size is always rounded up to full kilobytes, so only a completely empty part
50032 has a <varname>$mime_content_size</varname> of zero.
50034 </listitem></varlistentry>
50036 <term><varname>$mime_content_transfer_encoding</varname></term>
50039 This variable contains the normalized content of the
50040 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
50041 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
50043 </listitem></varlistentry>
50045 <term><varname>$mime_content_type</varname></term>
50048 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
50049 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
50050 are some examples of popular MIME types, as they may appear in this variable:
50052 <literallayout class="monospaced">
50055 application/octet-stream
50060 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
50063 </listitem></varlistentry>
50065 <term><varname>$mime_decoded_filename</varname></term>
50068 This variable is set only after the <option>decode</option> modifier (see above) has been
50069 successfully run. It contains the full path and file name of the file
50070 containing the decoded data.
50072 </listitem></varlistentry>
50075 <indexterm role="concept">
50076 <primary>RFC 2047</primary>
50081 <term><varname>$mime_filename</varname></term>
50084 This is perhaps the most important of the MIME variables. It contains a
50085 proposed filename for an attachment, if one was found in either the
50086 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
50087 RFC2047 decoded, but no additional sanity checks are done. If no filename was
50088 found, this variable contains the empty string.
50090 </listitem></varlistentry>
50092 <term><varname>$mime_is_coverletter</varname></term>
50095 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
50096 attached data. It can be used to clamp down on flashy or unneccessarily encoded
50097 content in the cover letter, while not restricting attachments at all.
50100 The variable contains 1 (true) for a MIME part believed to be part of the
50101 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
50104 <orderedlist numeration="arabic">
50107 The outermost MIME part of a message is always a cover letter.
50112 If a multipart/alternative or multipart/related MIME part is a cover letter,
50113 so are all MIME subparts within that multipart.
50118 If any other multipart is a cover letter, the first subpart is a cover letter,
50119 and the rest are attachments.
50124 All parts contained within an attachment multipart are attachments.
50129 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
50130 alternative plain text), while allowing HTML files to be attached. HTML
50131 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
50133 <literallayout class="monospaced">
50134 deny message = HTML mail is not accepted here
50135 !condition = $mime_is_rfc822
50136 condition = $mime_is_coverletter
50137 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
50139 </listitem></varlistentry>
50141 <term><varname>$mime_is_multipart</varname></term>
50144 This variable has the value 1 (true) when the current part has the main type
50145 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
50146 Since multipart entities only serve as containers for other parts, you may not
50147 want to carry out specific actions on them.
50149 </listitem></varlistentry>
50151 <term><varname>$mime_is_rfc822</varname></term>
50154 This variable has the value 1 (true) if the current part is not a part of the
50155 checked message itself, but part of an attached message. Attached message
50156 decoding is fully recursive.
50158 </listitem></varlistentry>
50160 <term><varname>$mime_part_count</varname></term>
50163 This variable is a counter that is raised for each processed MIME part. It
50164 starts at zero for the very first part (which is usually a multipart). The
50165 counter is per-message, so it is reset when processing RFC822 attachments (see
50166 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
50167 complete, so you can use it in the DATA ACL to determine the number of MIME
50168 parts of a message. For non-MIME messages, this variable contains the value -1.
50170 </listitem></varlistentry>
50173 <section id="SECTscanregex">
50174 <title>Scanning with regular expressions</title>
50176 <indexterm role="concept">
50177 <primary>content scanning</primary>
50178 <secondary>with regular expressions</secondary>
50180 <indexterm role="concept">
50181 <primary>regular expressions</primary>
50182 <secondary>content scanning with</secondary>
50184 You can specify your own custom regular expression matches on the full body of
50185 the message, or on individual MIME parts.
50188 The <option>regex</option> condition takes one or more regular expressions as arguments and
50189 matches them against the full message (when called in the DATA ACL) or a raw
50190 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
50191 linewise, with a maximum line length of 32K characters. That means you cannot
50192 have multiline matches with the <option>regex</option> condition.
50195 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
50196 to 32K of decoded content (the whole content at once, not linewise). If the
50197 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
50198 is decoded automatically when <option>mime_regex</option> is executed (using default path
50199 and filename values). If the decoded data is larger than 32K, only the first
50200 32K characters are checked.
50203 The regular expressions are passed as a colon-separated list. To include a
50204 literal colon, you must double it. Since the whole right-hand side string is
50205 expanded before being used, you must also escape dollar signs and backslashes
50206 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
50207 Here is a simple example that contains two regular expressions:
50209 <literallayout class="monospaced">
50210 deny message = contains blacklisted regex ($regex_match_string)
50211 regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
50214 The conditions returns true if any one of the regular expressions matches. The
50215 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
50216 matching regular expression.
50219 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
50223 <section id="SECTdemimecond">
50224 <title>The demime condition</title>
50226 <indexterm role="concept">
50227 <primary>content scanning</primary>
50228 <secondary>MIME checking</secondary>
50230 <indexterm role="concept">
50231 <primary>MIME content scanning</primary>
50233 The <option>demime</option> ACL condition provides MIME unpacking, sanity checking and file
50234 extension blocking. It is usable only in the DATA and non-SMTP ACLs. The
50235 <option>demime</option> condition uses a simpler interface to MIME decoding than the MIME
50236 ACL functionality, but provides no additional facilities. Please note that this
50237 condition is deprecated and kept only for backward compatibility. You must set
50238 the WITH_OLD_DEMIME option in <filename>Local/Makefile</filename> at build time to be able to
50239 use the <option>demime</option> condition.
50242 The <option>demime</option> condition unpacks MIME containers in the message. It detects
50243 errors in MIME containers and can match file extensions found in the message
50244 against a list. Using this facility produces files containing the unpacked MIME
50245 parts of the message in the temporary scan directory. If you do antivirus
50246 scanning, it is recommened that you use the <option>demime</option> condition before the
50247 antivirus (<option>malware</option>) condition.
50250 On the right-hand side of the <option>demime</option> condition you can pass a
50251 colon-separated list of file extensions that it should match against. For
50254 <literallayout class="monospaced">
50255 deny message = Found blacklisted file attachment
50256 demime = vbs:com:bat:pif:prf:lnk
50259 If one of the file extensions is found, the condition is true, otherwise it is
50260 false. If there is a temporary error while demimeing (for example, <quote>disk
50261 full</quote>), the condition defers, and the message is temporarily rejected (unless
50262 the condition is on a <option>warn</option> verb).
50265 The right-hand side is expanded before being treated as a list, so you can have
50266 conditions and lookups there. If it expands to an empty string, <quote>false</quote>, or
50267 zero (<quote>0</quote>), no demimeing is done and the condition is false.
50270 The <option>demime</option> condition set the following variables:
50274 <term><varname>$demime_errorlevel</varname></term>
50277 <indexterm role="concept">
50278 <primary><varname>$demime_errorlevel</varname></primary>
50280 When an error is detected in a MIME container, this variable contains the
50281 severity of the error, as an integer number. The higher the value, the more
50282 severe the error (the current maximum value is 3). If this variable is unset or
50283 zero, no error occurred.
50285 </listitem></varlistentry>
50287 <term><varname>$demime_reason</varname></term>
50290 <indexterm role="concept">
50291 <primary><varname>$demime_reason</varname></primary>
50293 When <varname>$demime_errorlevel</varname> is greater than zero, this variable contains a
50294 human-readable text string describing the MIME error that occurred.
50296 </listitem></varlistentry>
50300 <term><varname>$found_extension</varname></term>
50303 <indexterm role="concept">
50304 <primary><varname>$found_extension</varname></primary>
50306 When the <option>demime</option> condition is true, this variable contains the file
50307 extension it found.
50309 </listitem></varlistentry>
50312 Both <varname>$demime_errorlevel</varname> and <varname>$demime_reason</varname> are set by the first call of
50313 the <option>demime</option> condition, and are not changed on subsequent calls.
50316 If you do not want to check for file extensions, but rather use the <option>demime</option>
50317 condition for unpacking or error checking purposes, pass <quote>*</quote> as the
50318 right-hand side value. Here is a more elaborate example of how to use this
50321 <literallayout class="monospaced">
50322 # Reject messages with serious MIME container errors
50323 deny message = Found MIME error ($demime_reason).
50325 condition = ${if >{$demime_errorlevel}{2}{1}{0}}
50327 # Reject known virus spreading file extensions.
50328 # Accepting these is pretty much braindead.
50329 deny message = contains $found_extension file (blacklisted).
50330 demime = com:vbs:bat:pif:scr
50332 # Freeze .exe and .doc files. Postmaster can
50333 # examine them and eventually thaw them.
50334 deny log_message = Another $found_extension file.
50339 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
50344 <chapter id="CHAPlocalscan">
50345 <title>Adding a local scan function to Exim</title>
50346 <titleabbrev>Local scan function</titleabbrev>
50348 <indexterm role="concept" id="IIDlosca" class="startofrange">
50349 <primary><function>local_scan()</function> function</primary>
50350 <secondary>description of</secondary>
50352 <indexterm role="concept">
50353 <primary>customizing</primary>
50354 <secondary>input scan using C function</secondary>
50356 <indexterm role="concept">
50357 <primary>policy control</primary>
50358 <secondary>by local scan function</secondary>
50360 In these days of email worms, viruses, and ever-increasing spam, some sites
50361 want to apply a lot of checking to messages before accepting them.
50364 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
50365 passing messages to external virus and spam scanning software. You can also do
50366 a certain amount in Exim itself through string expansions and the <option>condition</option>
50367 condition in the ACL that runs after the SMTP DATA command or the ACL for
50368 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
50371 To allow for further customization to a site’s own requirements, there is the
50372 possibility of linking Exim with a private message scanning function, written
50373 in C. If you want to run code that is written in something other than C, you
50374 can of course use a little C stub to call it.
50377 The local scan function is run once for every incoming message, at the point
50378 when Exim is just about to accept the message.
50379 It can therefore be used to control non-SMTP messages from local processes as
50380 well as messages arriving via SMTP.
50383 Exim applies a timeout to calls of the local scan function, and there is an
50384 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
50385 Zero means <quote>no timeout</quote>.
50386 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
50387 before calling the local scan function, so that the most common types of crash
50388 are caught. If the timeout is exceeded or one of those signals is caught, the
50389 incoming message is rejected with a temporary error if it is an SMTP message.
50390 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
50391 code. The incident is logged on the main and reject logs.
50394 <title>Building Exim to use a local scan function</title>
50396 <indexterm role="concept">
50397 <primary><function>local_scan()</function> function</primary>
50398 <secondary>building Exim to use</secondary>
50400 To make use of the local scan function feature, you must tell Exim where your
50401 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
50402 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
50403 directory, so you might set
50405 <literallayout class="monospaced">
50406 LOCAL_SCAN_SOURCE=Local/local_scan.c
50409 for example. The function must be called <function>local_scan()</function>. It is called by
50410 Exim after it has received a message, when the success return code is about to
50411 be sent. This is after all the ACLs have been run. The return code from your
50412 function controls whether the message is actually accepted or not. There is a
50413 commented template function (that just accepts the message) in the file
50414 _src/local_scan.c_.
50417 If you want to make use of Exim’s run time configuration file to set options
50418 for your <function>local_scan()</function> function, you must also set
50420 <literallayout class="monospaced">
50421 LOCAL_SCAN_HAS_OPTIONS=yes
50424 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
50427 <section id="SECTapiforloc">
50428 <title>API for local_scan()</title>
50430 <indexterm role="concept">
50431 <primary><function>local_scan()</function> function</primary>
50432 <secondary>API description</secondary>
50434 You must include this line near the start of your code:
50436 <literallayout class="monospaced">
50437 #include "local_scan.h"
50440 This header file defines a number of variables and other values, and the
50441 prototype for the function itself. Exim is coded to use unsigned char values
50442 almost exclusively, and one of the things this header defines is a shorthand
50443 for <literal>unsigned char</literal> called <literal>uschar</literal>.
50444 It also contains the following macro definitions, to simplify casting character
50445 strings and pointers to character strings:
50447 <literallayout class="monospaced">
50448 #define CS (char *)
50449 #define CCS (const char *)
50450 #define CSS (char **)
50451 #define US (unsigned char *)
50452 #define CUS (const unsigned char *)
50453 #define USS (unsigned char **)
50456 The function prototype for <function>local_scan()</function> is:
50458 <literallayout class="monospaced">
50459 extern int local_scan(int fd, uschar **return_text);
50462 The arguments are as follows:
50467 <option>fd</option> is a file descriptor for the file that contains the body of the message
50468 (the -D file). The file is open for reading and writing, but updating it is not
50469 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
50472 The descriptor is positioned at character 19 of the file, which is the first
50473 character of the body itself, because the first 19 characters are the message
50474 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
50475 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
50476 case this changes in some future version.
50481 <option>return_text</option> is an address which you can use to return a pointer to a text
50482 string at the end of the function. The value it points to on entry is NULL.
50487 The function must return an <option>int</option> value which is one of the following macros:
50491 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
50494 <indexterm role="concept">
50495 <primary><varname>$local_scan_data</varname></primary>
50497 The message is accepted. If you pass back a string of text, it is saved with
50498 the message, and made available in the variable <varname>$local_scan_data</varname>. No
50499 newlines are permitted (if there are any, they are turned into spaces) and the
50500 maximum length of text is 1000 characters.
50502 </listitem></varlistentry>
50504 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
50507 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
50508 queued without immediate delivery, and is frozen.
50510 </listitem></varlistentry>
50512 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
50515 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
50516 queued without immediate delivery.
50518 </listitem></varlistentry>
50520 <term><literal>LOCAL_SCAN_REJECT</literal></term>
50523 The message is rejected; the returned text is used as an error message which is
50524 passed back to the sender and which is also logged. Newlines are permitted –
50525 they cause a multiline response for SMTP rejections, but are converted to
50526 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
50529 </listitem></varlistentry>
50531 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
50534 The message is temporarily rejected; the returned text is used as an error
50535 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
50536 problem</quote> is used.
50538 </listitem></varlistentry>
50540 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
50543 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
50544 message is not written to the reject log. It has the effect of unsetting the
50545 <option>rejected_header</option> log selector for just this rejection. If
50546 <option>rejected_header</option> is already unset (see the discussion of the
50547 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
50548 same as LOCAL_SCAN_REJECT.
50550 </listitem></varlistentry>
50552 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
50555 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
50556 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
50558 </listitem></varlistentry>
50561 If the message is not being received by interactive SMTP, rejections are
50562 reported by writing to <option>stderr</option> or by sending an email, as configured by the
50563 <option>-oe</option> command line options.
50566 <section id="SECTconoptloc">
50567 <title>Configuration options for local_scan()</title>
50569 <indexterm role="concept">
50570 <primary><function>local_scan()</function> function</primary>
50571 <secondary>configuration options</secondary>
50573 It is possible to have option settings in the main configuration file
50574 that set values in static variables in the <function>local_scan()</function> module. If you
50575 want to do this, you must have the line
50577 <literallayout class="monospaced">
50578 LOCAL_SCAN_HAS_OPTIONS=yes
50581 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
50582 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
50583 file, you must define static variables to hold the option values, and a table
50587 The table must be a vector called <option>local_scan_options</option>, of type
50588 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
50589 and a pointer to the variable that holds the value. The entries must appear in
50590 alphabetical order. Following <option>local_scan_options</option> you must also define a
50591 variable called <option>local_scan_options_count</option> that contains the number of
50592 entries in the table. Here is a short example, showing two kinds of option:
50594 <literallayout class="monospaced">
50595 static int my_integer_option = 42;
50596 static uschar *my_string_option = US"a default string";
50598 optionlist local_scan_options[] = {
50599 { "my_integer", opt_int, &my_integer_option },
50600 { "my_string", opt_stringptr, &my_string_option }
50603 int local_scan_options_count =
50604 sizeof(local_scan_options)/sizeof(optionlist);
50607 The values of the variables can now be changed from Exim’s runtime
50608 configuration file by including a local scan section as in this example:
50610 <literallayout class="monospaced">
50613 my_string = some string of text...
50616 The available types of option data are as follows:
50620 <term><emphasis role="bold">opt_bool</emphasis></term>
50623 This specifies a boolean (true/false) option. The address should point to a
50624 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
50625 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
50626 whether such a variable has been set at all, you can initialize it to
50627 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
50630 </listitem></varlistentry>
50632 <term><emphasis role="bold">opt_fixed</emphasis></term>
50635 This specifies a fixed point number, such as is used for load averages.
50636 The address should point to a variable of type <literal>int</literal>. The value is stored
50637 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
50639 </listitem></varlistentry>
50641 <term><emphasis role="bold">opt_int</emphasis></term>
50644 This specifies an integer; the address should point to a variable of type
50645 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
50648 </listitem></varlistentry>
50650 <term><emphasis role="bold">opt_mkint</emphasis></term>
50653 This is the same as <option>opt_int</option>, except that when such a value is output in a
50654 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
50655 printed with the suffix K or M.
50657 </listitem></varlistentry>
50659 <term><emphasis role="bold">opt_octint</emphasis></term>
50662 This also specifies an integer, but the value is always interpeted as an
50663 octal integer, whether or not it starts with the digit zero, and it is
50664 always output in octal.
50666 </listitem></varlistentry>
50668 <term><emphasis role="bold">opt_stringptr</emphasis></term>
50671 This specifies a string value; the address must be a pointer to a
50672 variable that points to a string (for example, of type <literal>uschar *</literal>).
50674 </listitem></varlistentry>
50676 <term><emphasis role="bold">opt_time</emphasis></term>
50679 This specifies a time interval value. The address must point to a variable of
50680 type <literal>int</literal>. The value that is placed there is a number of seconds.
50682 </listitem></varlistentry>
50685 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
50686 out the values of all the <function>local_scan()</function> options.
50690 <title>Available Exim variables</title>
50692 <indexterm role="concept">
50693 <primary><function>local_scan()</function> function</primary>
50694 <secondary>available Exim variables</secondary>
50696 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
50697 are the only ones that are guaranteed to be maintained from release to release.
50698 Note, however, that you can obtain the value of any Exim variable by calling
50699 <emphasis>expand_string()</emphasis>. The exported variables are as follows:
50703 <term><emphasis role="bold">unsigned int debug_selector</emphasis></term>
50706 This variable is set to zero when no debugging is taking place. Otherwise, it
50707 is a bitmap of debugging selectors. Two bits are identified for use in
50708 <function>local_scan()</function>; they are defined as macros:
50713 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
50714 testing option that is not privileged – any caller may set it. All the
50715 other selector bits can be set only by admin users.
50720 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
50721 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
50727 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
50728 selected, you should use code like this:
50730 <literallayout class="monospaced">
50731 if ((debug_selector & D_local_scan) != 0)
50732 debug_printf("xxx", ...);
50734 </listitem></varlistentry>
50736 <term><emphasis role="bold">uschar *expand_string_message</emphasis></term>
50739 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
50740 variable <option>expand_string_message</option> contains the error message, zero-terminated.
50742 </listitem></varlistentry>
50744 <term><emphasis role="bold">header_line *header_list</emphasis></term>
50747 A pointer to a chain of header lines. The <option>header_line</option> structure is
50750 </listitem></varlistentry>
50752 <term><emphasis role="bold">header_line *header_last</emphasis></term>
50755 A pointer to the last of the header lines.
50757 </listitem></varlistentry>
50759 <term><emphasis role="bold">uschar *headers_charset</emphasis></term>
50762 The value of the <option>headers_charset</option> configuration option.
50764 </listitem></varlistentry>
50766 <term><emphasis role="bold">BOOL host_checking</emphasis></term>
50769 This variable is TRUE during a host checking session that is initiated by the
50770 <option>-bh</option> command line option.
50772 </listitem></varlistentry>
50774 <term><emphasis role="bold">uschar *interface_address</emphasis></term>
50777 The IP address of the interface that received the message, as a string. This
50778 is NULL for locally submitted messages.
50780 </listitem></varlistentry>
50782 <term><emphasis role="bold">int interface_port</emphasis></term>
50785 The port on which this message was received.
50787 </listitem></varlistentry>
50789 <term><emphasis role="bold">uschar *message_id</emphasis></term>
50792 This variable contains Exim’s message id for the incoming message (the value of
50793 <varname>$message_exim_id</varname>) as a zero-terminated string.
50795 </listitem></varlistentry>
50797 <term><emphasis role="bold">uschar *received_protocol</emphasis></term>
50800 The name of the protocol by which the message was received.
50802 </listitem></varlistentry>
50804 <term><emphasis role="bold">int recipients_count</emphasis></term>
50807 The number of accepted recipients.
50809 </listitem></varlistentry>
50811 <term><emphasis role="bold">recipient_item *recipients_list</emphasis></term>
50814 <indexterm role="concept">
50815 <primary>recipient</primary>
50816 <secondary>adding in local scan</secondary>
50818 <indexterm role="concept">
50819 <primary>recipient</primary>
50820 <secondary>removing in local scan</secondary>
50822 The list of accepted recipients, held in a vector of length
50823 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
50824 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
50825 below). You can delete recipients by removing them from the vector and adusting
50826 the value in <option>recipients_count</option>. In particular, by setting
50827 <option>recipients_count</option> to zero you remove all recipients. If you then return the
50828 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
50829 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
50830 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
50832 </listitem></varlistentry>
50834 <term><emphasis role="bold">uschar *sender_address</emphasis></term>
50837 The envelope sender address. For bounce messages this is the empty string.
50839 </listitem></varlistentry>
50841 <term><emphasis role="bold">uschar *sender_host_address</emphasis></term>
50844 The IP address of the sending host, as a string. This is NULL for
50845 locally-submitted messages.
50847 </listitem></varlistentry>
50849 <term><emphasis role="bold">uschar *sender_host_authenticated</emphasis></term>
50852 The name of the authentication mechanism that was used, or NULL if the message
50853 was not received over an authenticated SMTP connection.
50855 </listitem></varlistentry>
50857 <term><emphasis role="bold">uschar *sender_host_name</emphasis></term>
50860 The name of the sending host, if known.
50862 </listitem></varlistentry>
50864 <term><emphasis role="bold">int sender_host_port</emphasis></term>
50867 The port on the sending host.
50869 </listitem></varlistentry>
50871 <term><emphasis role="bold">BOOL smtp_input</emphasis></term>
50874 This variable is TRUE for all SMTP input, including BSMTP.
50876 </listitem></varlistentry>
50878 <term><emphasis role="bold">BOOL smtp_batched_input</emphasis></term>
50881 This variable is TRUE for BSMTP input.
50883 </listitem></varlistentry>
50885 <term><emphasis role="bold">int store_pool</emphasis></term>
50888 The contents of this variable control which pool of memory is used for new
50889 requests. See section <xref linkend="SECTmemhanloc"/> for details.
50891 </listitem></varlistentry>
50895 <title>Structure of header lines</title>
50897 The <option>header_line</option> structure contains the members listed below.
50898 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
50899 (see below). You can cause header lines to be ignored (deleted) by setting
50904 <term><emphasis role="bold">struct header_line *next</emphasis></term>
50907 A pointer to the next header line, or NULL for the last line.
50909 </listitem></varlistentry>
50911 <term><emphasis role="bold">int type</emphasis></term>
50914 A code identifying certain headers that Exim recognizes. The codes are printing
50915 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
50916 Notice in particular that any header line whose type is * is not transmitted
50917 with the message. This flagging is used for header lines that have been
50918 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
50919 lines.) Effectively, * means <quote>deleted</quote>.
50921 </listitem></varlistentry>
50923 <term><emphasis role="bold">int slen</emphasis></term>
50926 The number of characters in the header line, including the terminating and any
50929 </listitem></varlistentry>
50931 <term><emphasis role="bold">uschar *text</emphasis></term>
50934 A pointer to the text of the header. It always ends with a newline, followed by
50935 a zero byte. Internal newlines are preserved.
50937 </listitem></varlistentry>
50941 <title>Structure of recipient items</title>
50943 The <option>recipient_item</option> structure contains these members:
50947 <term><emphasis role="bold">uschar *address</emphasis></term>
50950 This is a pointer to the recipient address as it was received.
50952 </listitem></varlistentry>
50954 <term><emphasis role="bold">int pno</emphasis></term>
50957 This is used in later Exim processing when top level addresses are created by
50958 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
50959 and must always contain -1 at this stage.
50961 </listitem></varlistentry>
50963 <term><emphasis role="bold">uschar *errors_to</emphasis></term>
50966 If this value is not NULL, bounce messages caused by failing to deliver to the
50967 recipient are sent to the address it contains. In other words, it overrides the
50968 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
50969 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
50970 an unqualified address, Exim qualifies it using the domain from
50971 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
50972 is NULL for all recipients.
50974 </listitem></varlistentry>
50978 <title>Available Exim functions</title>
50980 <indexterm role="concept">
50981 <primary><function>local_scan()</function> function</primary>
50982 <secondary>available Exim functions</secondary>
50984 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
50985 These are the only ones that are guaranteed to be maintained from release to
50990 <term><emphasis role="bold">pid_t child_open(uschar **argv, uschar **envp, int newumask, int *infdptr, int *outfdptr, BOOL make_leader)</emphasis></term>
50993 This function creates a child process that runs the command specified by
50994 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
50995 be NULL if no environment variables are to be passed. A new umask is supplied
50996 for the process in <option>newumask</option>.
50999 Pipes to the standard input and output of the new process are set up
51000 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
51001 standard error is cloned to the standard output. If there are any file
51002 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
51003 argument is TRUE, the new process is made into a process group leader.
51006 The function returns the pid of the new process, or -1 if things go wrong.
51008 </listitem></varlistentry>
51010 <term><emphasis role="bold">int child_close(pid_t pid, int timeout)</emphasis></term>
51013 This function waits for a child process to terminate, or for a timeout (in
51014 seconds) to expire. A timeout value of zero means wait as long as it takes. The
51015 return value is as follows:
51023 The process terminated by a normal exit and the value is the process
51029 < 0 and > –256
51032 The process was terminated by a signal and the value is the negation of the
51041 The process timed out.
51049 The was some other error in wait(); <option>errno</option> is still set.
51053 </listitem></varlistentry>
51055 <term><emphasis role="bold">pid_t child_open_exim(int *fd)</emphasis></term>
51058 This function provide you with a means of submitting a new message to
51059 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
51060 want, but this packages it all up for you.) The function creates a pipe,
51061 forks a subprocess that is running
51063 <literallayout class="monospaced">
51064 exim -t -oem -oi -f <>
51067 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
51068 that is connected to the standard input. The yield of the function is the PID
51069 of the subprocess. You can then write a message to the file descriptor, with
51070 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
51073 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
51074 finish and to collect its ending status. A timeout value of zero is usually
51075 fine in this circumstance. Unless you have made a mistake with the recipient
51076 addresses, you should get a return code of zero.
51078 </listitem></varlistentry>
51079 <varlistentry revisionflag="changed">
51080 <term><emphasis role="bold">pid_t child_open_exim2(int *fd, uschar *sender, uschar *sender_authentication)</emphasis></term>
51082 <para revisionflag="changed">
51083 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
51086 <literallayout revisionflag="changed">
51087 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
51089 <para revisionflag="changed">
51090 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
51092 </listitem></varlistentry>
51094 <term><emphasis role="bold">void debug_printf(char *, ...)</emphasis></term>
51097 This is Exim’s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
51098 output is written to the standard error stream. If no debugging is selected,
51099 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
51100 conditional on the <literal>local_scan</literal> debug selector by coding like this:
51102 <literallayout class="monospaced">
51103 if ((debug_selector & D_local_scan) != 0)
51104 debug_printf("xxx", ...);
51106 </listitem></varlistentry>
51108 <term><emphasis role="bold">uschar *expand_string(uschar *string)</emphasis></term>
51111 This is an interface to Exim’s string expansion code. The return value is the
51112 expanded string, or NULL if there was an expansion failure.
51113 The C variable <option>expand_string_message</option> contains an error message after an
51114 expansion failure. If expansion does not change the string, the return value is
51115 the pointer to the input string. Otherwise, the return value points to a new
51116 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
51117 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
51119 </listitem></varlistentry>
51121 <term><emphasis role="bold">void header_add(int type, char *format, ...)</emphasis></term>
51124 This function allows you to an add additional header line at the end of the
51125 existing ones. The first argument is the type, and should normally be a space
51126 character. The second argument is a format string and any number of
51127 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
51128 if you want, and you must ensure that the string ends with a newline.
51130 </listitem></varlistentry>
51132 <term><emphasis role="bold">void header_add_at_position(BOOL after, uschar *name, BOOL topnot, int type, char *format, ...)</emphasis></term>
51135 This function adds a new header line at a specified point in the header
51136 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
51139 If <option>name</option> is NULL, the new header is added at the end of the chain if
51140 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
51141 NULL, the header lines are searched for the first non-deleted header that
51142 matches the name. If one is found, the new header is added before it if
51143 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
51144 found header and any adjacent subsequent ones with the same name (even if
51145 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
51146 option controls where the header is added. If it is true, addition is at the
51147 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
51148 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
51150 <literallayout class="monospaced">
51151 header_add_at_position(TRUE, US"Received", TRUE,
51152 ' ', "X-xxx: ...");
51155 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
51156 there may not be if <option>received_header_text</option> expands to an empty string.
51158 </listitem></varlistentry>
51160 <term><emphasis role="bold">void header_remove(int occurrence, uschar *name)</emphasis></term>
51163 This function removes header lines. If <option>occurrence</option> is zero or negative, all
51164 occurrences of the header are removed. If occurrence is greater than zero, that
51165 particular instance of the header is removed. If no header(s) can be found that
51166 match the specification, the function does nothing.
51168 </listitem></varlistentry>
51170 <term><emphasis role="bold">BOOL header_testname(header_line *hdr, uschar *name, int length, BOOL notdel)</emphasis></term>
51173 This function tests whether the given header has the given name. It is not just
51174 a string comparison, because white space is permitted between the name and the
51175 colon. If the <option>notdel</option> argument is true, a false return is forced for all
51176 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
51178 <literallayout class="monospaced">
51179 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
51181 </listitem></varlistentry>
51183 <term><emphasis role="bold">uschar *lss_b64encode(uschar *cleartext, int length)</emphasis></term>
51186 <indexterm role="concept">
51187 <primary>base64 encoding</primary>
51188 <secondary>functions for <function>local_scan()</function> use</secondary>
51190 This function base64-encodes a string, which is passed by address and length.
51191 The text may contain bytes of any value, including zero. The result is passed
51192 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
51195 </listitem></varlistentry>
51197 <term><emphasis role="bold">int lss_b64decode(uschar *codetext, uschar **cleartext)</emphasis></term>
51200 This function decodes a base64-encoded string. Its arguments are a
51201 zero-terminated base64-encoded string and the address of a variable that is set
51202 to point to the result, which is in dynamic memory. The length of the decoded
51203 string is the yield of the function. If the input is invalid base64 data, the
51204 yield is -1. A zero byte is added to the end of the output string to make it
51205 easy to interpret as a C string (assuming it contains no zeros of its own). The
51206 added zero byte is not included in the returned count.
51208 </listitem></varlistentry>
51210 <term><emphasis role="bold">int lss_match_domain(uschar *domain, uschar *list)</emphasis></term>
51213 This function checks for a match in a domain list. Domains are always
51214 matched caselessly. The return value is one of the following:
51217 <literal>OK </literal> match succeeded
51218 <literal>FAIL </literal> match failed
51219 <literal>DEFER </literal> match deferred
51222 DEFER is usually caused by some kind of lookup defer, such as the
51223 inability to contact a database.
51225 </listitem></varlistentry>
51227 <term><emphasis role="bold">int lss_match_local_part(uschar *localpart, uschar *list, BOOL caseless)</emphasis></term>
51230 This function checks for a match in a local part list. The third argument
51231 controls case-sensitivity. The return values are as for
51232 <emphasis>lss_match_domain()</emphasis>.
51234 </listitem></varlistentry>
51236 <term><emphasis role="bold">int lss_match_address(uschar *address, uschar *list, BOOL caseless)</emphasis></term>
51239 This function checks for a match in an address list. The third argument
51240 controls the case-sensitivity of the local part match. The domain is always
51241 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
51243 </listitem></varlistentry>
51245 <term><emphasis role="bold">int lss_match_host(uschar *host_name, uschar *host_address, uschar *list)</emphasis></term>
51248 This function checks for a match in a host list. The most common usage is
51251 <literallayout class="monospaced">
51252 lss_match_host(sender_host_name, sender_host_address, ...)
51255 <indexterm role="concept">
51256 <primary><varname>$sender_host_address</varname></primary>
51258 An empty address field matches an empty item in the host list. If the host name
51259 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
51260 looked up if a host name is required to match an item in the list. The return
51261 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
51262 returns ERROR in the case when it had to look up a host name, but the lookup
51265 </listitem></varlistentry>
51267 <term><emphasis role="bold">void log_write(unsigned int selector, int which, char *format, ...)</emphasis></term>
51270 This function writes to Exim’s log files. The first argument should be zero (it
51271 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
51272 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
51273 them. It specifies to which log or logs the message is written. The remaining
51274 arguments are a format and relevant insertion arguments. The string should not
51275 contain any newlines, not even at the end.
51277 </listitem></varlistentry>
51279 <term><emphasis role="bold">void receive_add_recipient(uschar *address, int pno)</emphasis></term>
51282 This function adds an additional recipient to the message. The first argument
51283 is the recipient address. If it is unqualified (has no domain), it is qualified
51284 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
51287 This function does not allow you to specify a private <option>errors_to</option> address (as
51288 described with the structure of <option>recipient_item</option> above), because it pre-dates
51289 the addition of that field to the structure. However, it is easy to add such a
51290 value afterwards. For example:
51292 <literallayout class="monospaced">
51293 receive_add_recipient(US"monitor@mydom.example", -1);
51294 recipients_list[recipients_count-1].errors_to =
51295 US"postmaster@mydom.example";
51297 </listitem></varlistentry>
51299 <term><emphasis role="bold">BOOL receive_remove_recipient(uschar *recipient)</emphasis></term>
51302 This is a convenience function to remove a named recipient from the list of
51303 recipients. It returns true if a recipient was removed, and false if no
51304 matching recipient could be found. The argument must be a complete email
51307 </listitem></varlistentry>
51310 <indexterm role="concept">
51311 <primary>RFC 2047</primary>
51316 <term><emphasis role="bold">uschar rfc2047_decode(uschar *string, BOOL lencheck, uschar *target, int zeroval, int *lenptr, uschar **error)</emphasis></term>
51319 This function decodes strings that are encoded according to RFC 2047. Typically
51320 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
51321 from the Q or B encoding into a byte-string. Then, if provided with the name of
51322 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
51323 made to translate the result to the named character set. If this fails, the
51324 binary string is returned with an error message.
51327 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
51328 maximum MIME word length is enforced. The third argument is the target
51329 encoding, or NULL if no translation is wanted.
51332 <indexterm role="concept">
51333 <primary>binary zero</primary>
51334 <secondary>in RFC 2047 decoding</secondary>
51336 <indexterm role="concept">
51337 <primary>RFC 2047</primary>
51338 <secondary>binary zero in</secondary>
51340 If a binary zero is encountered in the decoded string, it is replaced by the
51341 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
51342 not be 0 because header lines are handled as zero-terminated strings.
51345 The function returns the result of processing the string, zero-terminated; if
51346 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
51347 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
51350 If an error is encountered, the function returns NULL and uses the <option>error</option>
51351 argument to return an error message. The variable pointed to by <option>error</option> is
51352 set to NULL if there is no error; it may be set non-NULL even when the function
51353 returns a non-NULL value if decoding was successful, but there was a problem
51356 </listitem></varlistentry>
51358 <term><emphasis role="bold">int smtp_fflush(void)</emphasis></term>
51361 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
51364 </listitem></varlistentry>
51366 <term><emphasis role="bold">void smtp_printf(char *, ...)</emphasis></term>
51369 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
51370 output stream. You should use this function only when there is an SMTP output
51371 stream, that is, when the incoming message is being received via interactive
51372 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
51373 is FALSE. If you want to test for an incoming message from another host (as
51374 opposed to a local process that used the <option>-bs</option> command line option), you can
51375 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
51379 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
51380 output function, so it can be used for all forms of SMTP connection.
51383 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
51384 must start with an appropriate response code: 550 if you are going to return
51385 LOCAL_SCAN_REJECT, 451 if you are going to return
51386 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
51387 initial lines of a multi-line response, the code must be followed by a hyphen
51388 to indicate that the line is not the final response line. You must also ensure
51389 that the lines you write terminate with CRLF. For example:
51391 <literallayout class="monospaced">
51392 smtp_printf("550-this is some extra info\r\n");
51393 return LOCAL_SCAN_REJECT;
51396 Note that you can also create multi-line responses by including newlines in
51397 the data returned via the <option>return_text</option> argument. The added value of using
51398 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
51399 multiple output lines.
51402 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
51403 does not automatically flush pending output, and therefore does not test
51404 the state of the stream. (In the main code of Exim, flushing and error
51405 detection is done when Exim is ready for the next SMTP input command.) If
51406 you want to flush the output and check for an error (for example, the
51407 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
51408 arguments. It flushes the output stream, and returns a non-zero value if there
51411 </listitem></varlistentry>
51413 <term><emphasis role="bold">void *store_get(int)</emphasis></term>
51416 This function accesses Exim’s internal store (memory) manager. It gets a new
51417 chunk of memory whose size is given by the argument. Exim bombs out if it ever
51418 runs out of memory. See the next section for a discussion of memory handling.
51420 </listitem></varlistentry>
51422 <term><emphasis role="bold">void *store_get_perm(int)</emphasis></term>
51425 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
51426 permanent pool. See the next section for a discussion of memory handling.
51428 </listitem></varlistentry>
51430 <term><emphasis role="bold">uschar *string_copy(uschar *string)</emphasis></term>
51435 </listitem></varlistentry>
51437 <term><emphasis role="bold">uschar *string_copyn(uschar *string, int length)</emphasis></term>
51442 </listitem></varlistentry>
51444 <term><emphasis role="bold">uschar *string_sprintf(char *format, ...)</emphasis></term>
51447 These three functions create strings using Exim’s dynamic memory facilities.
51448 The first makes a copy of an entire string. The second copies up to a maximum
51449 number of characters, indicated by the second argument. The third uses a format
51450 and insertion arguments to create a new string. In each case, the result is a
51451 pointer to a new string in the current memory pool. See the next section for
51454 </listitem></varlistentry>
51457 <section id="SECTmemhanloc">
51458 <title>More about Exim’s memory handling</title>
51460 <indexterm role="concept">
51461 <primary><function>local_scan()</function> function</primary>
51462 <secondary>memory handling</secondary>
51464 No function is provided for freeing memory, because that is never needed.
51465 The dynamic memory that Exim uses when receiving a message is automatically
51466 recycled if another message is received by the same process (this applies only
51467 to incoming SMTP connections – other input methods can supply only one
51468 message at a time). After receiving the last message, a reception process
51472 Because it is recycled, the normal dynamic memory cannot be used for holding
51473 data that must be preserved over a number of incoming messages on the same SMTP
51474 connection. However, Exim in fact uses two pools of dynamic memory; the second
51475 one is not recycled, and can be used for this purpose.
51478 If you want to allocate memory that remains available for subsequent messages
51479 in the same SMTP connection, you should set
51481 <literallayout class="monospaced">
51482 store_pool = POOL_PERM
51485 before calling the function that does the allocation. There is no need to
51486 restore the value if you do not need to; however, if you do want to revert to
51487 the normal pool, you can either restore the previous value of <option>store_pool</option> or
51488 set it explicitly to POOL_MAIN.
51491 The pool setting applies to all functions that get dynamic memory, including
51492 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
51493 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
51494 block of memory from the permanent pool while preserving the value of
51495 <option>store_pool</option>.
51496 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
51501 <chapter id="CHAPsystemfilter">
51502 <title>System-wide message filtering</title>
51504 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
51505 <primary>filter</primary>
51506 <secondary>system filter</secondary>
51508 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
51509 <primary>filtering all mail</primary>
51511 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
51512 <primary>system filter</primary>
51514 The previous chapters (on ACLs and the local scan function) describe checks
51515 that can be applied to messages before they are accepted by a host. There is
51516 also a mechanism for checking messages once they have been received, but before
51517 they are delivered. This is called the <emphasis>system filter</emphasis>.
51520 The system filter operates in a similar manner to users’ filter files, but it
51521 is run just once per message (however many recipients the message has).
51522 It should not normally be used as a substitute for routing, because <option>deliver</option>
51523 commands in a system router provide new envelope recipient addresses.
51524 The system filter must be an Exim filter. It cannot be a Sieve filter.
51527 The system filter is run at the start of a delivery attempt, before any routing
51528 is done. If a message fails to be completely delivered at the first attempt,
51529 the system filter is run again at the start of every retry.
51530 If you want your filter to do something only once per message, you can make use
51531 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
51532 prevent it happening on retries.
51535 <indexterm role="concept">
51536 <primary><varname>$domain</varname></primary>
51538 <indexterm role="concept">
51539 <primary><varname>$local_part</varname></primary>
51541 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
51542 specific to individual recipient addresses, such as <varname>$local_part</varname> and
51543 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
51544 you want to run a centrally-specified filter for each recipient address
51545 independently, you can do so by setting up a suitable <command>redirect</command> router, as
51546 described in section <xref linkend="SECTperaddfil"/> below.
51549 <title>Specifying a system filter</title>
51551 <indexterm role="concept">
51552 <primary>uid (user id)</primary>
51553 <secondary>system filter</secondary>
51555 <indexterm role="concept">
51556 <primary>gid (group id)</primary>
51557 <secondary>system filter</secondary>
51559 The name of the file that contains the system filter must be specified by
51560 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
51561 other than root, you must also set <option>system_filter_user</option> and
51562 <option>system_filter_group</option> as appropriate. For example:
51564 <literallayout class="monospaced">
51565 system_filter = /etc/mail/exim.filter
51566 system_filter_user = exim
51569 If a system filter generates any deliveries directly to files or pipes (via the
51570 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
51571 specified by setting <option>system_filter_file_transport</option> and
51572 <option>system_filter_pipe_transport</option>, respectively. Similarly,
51573 <option>system_filter_reply_transport</option> must be set to handle any messages generated
51574 by the <option>reply</option> command.
51578 <title>Testing a system filter</title>
51580 You can run simple tests of a system filter in the same way as for a user
51581 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
51582 are permitted only in system filters are recognized.
51585 If you want to test the combined effect of a system filter and a user filter,
51586 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
51590 <title>Contents of a system filter</title>
51592 The language used to specify system filters is the same as for users’ filter
51593 files. It is described in the separate end-user document <emphasis>Exim’s interface to
51594 mail filtering</emphasis>. However, there are some additional features that are
51595 available only in system filters; these are described in subsequent sections.
51596 If they are encountered in a user’s filter file or when testing with <option>-bf</option>,
51600 <indexterm role="concept">
51601 <primary>frozen messages</primary>
51602 <secondary>manual thaw; testing in filter</secondary>
51604 There are two special conditions which, though available in users’ filter
51605 files, are designed for use in system filters. The condition <option>first_delivery</option>
51606 is true only for the first attempt at delivering a message, and
51607 <option>manually_thawed</option> is true only if the message has been frozen, and
51608 subsequently thawed by an admin user. An explicit forced delivery counts as a
51609 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
51612 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
51613 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
51614 succeed, it will not be tried again.
51615 If you want Exim to retry an unseen delivery until it succeeds, you should
51616 arrange to set it up every time the filter runs.
51619 When a system filter finishes running, the values of the variables <varname>$n0</varname> –
51620 <varname>$n9</varname> are copied into <varname>$sn0</varname> – <varname>$sn9</varname> and are thereby made available to
51621 users’ filter files. Thus a system filter can, for example, set up <quote>scores</quote>
51622 to which users’ filter files can refer.
51626 <title>Additional variable for system filters</title>
51628 <indexterm role="concept">
51629 <primary><varname>$recipients</varname></primary>
51631 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
51632 of the message (separated by commas and white space), is available in system
51633 filters. It is not available in users’ filters for privacy reasons.
51637 <title>Defer, freeze, and fail commands for system filters</title>
51639 <indexterm role="concept">
51640 <primary>freezing messages</primary>
51642 <indexterm role="concept">
51643 <primary>message</primary>
51644 <secondary>freezing</secondary>
51646 <indexterm role="concept">
51647 <primary>message</primary>
51648 <secondary>forced failure</secondary>
51650 <indexterm role="concept">
51651 <primary><option>fail</option></primary>
51652 <secondary>in system filter</secondary>
51654 <indexterm role="concept">
51655 <primary><option>freeze</option> in system filter</primary>
51657 <indexterm role="concept">
51658 <primary><option>defer</option> in system filter</primary>
51660 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
51661 always available in system filters, but are not normally enabled in users’
51662 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
51663 for the <command>redirect</command> router.) These commands can optionally be followed by the
51664 word <option>text</option> and a string containing an error message, for example:
51666 <literallayout class="monospaced">
51667 fail text "this message looks like spam to me"
51670 The keyword <option>text</option> is optional if the next character is a double quote.
51673 The <option>defer</option> command defers delivery of the original recipients of the
51674 message. The <option>fail</option> command causes all the original recipients to be failed,
51675 and a bounce message to be created. The <option>freeze</option> command suspends all
51676 delivery attempts for the original recipients. In all cases, any new deliveries
51677 that are specified by the filter are attempted as normal after the filter has
51681 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
51682 not manually frozen since. This means that automatic freezing by a system
51683 filter can be used as a way of checking out suspicious messages. If a message
51684 is found to be all right, manually unfreezing it allows it to be delivered.
51687 <indexterm role="concept">
51688 <primary>log</primary>
51689 <secondary><option>fail</option> command log line</secondary>
51691 <indexterm role="concept">
51692 <primary><option>fail</option></primary>
51693 <secondary>log line; reducing</secondary>
51695 The text given with a fail command is used as part of the bounce message as
51696 well as being written to the log. If the message is quite long, this can fill
51697 up a lot of log space when such failures are common. To reduce the size of the
51698 log message, Exim interprets the text in a special way if it starts with the
51699 two characters <literal><<</literal> and contains <literal>>></literal> later. The text between these two
51700 strings is written to the log, and the rest of the text is used in the bounce
51701 message. For example:
51703 <literallayout class="monospaced">
51704 fail "<<filter test 1>>Your message is rejected \
51705 because it contains attachments that we are \
51706 not prepared to receive."
51709 <indexterm role="concept">
51710 <primary>loop</primary>
51711 <secondary>caused by <option>fail</option></secondary>
51713 Take great care with the <option>fail</option> command when basing the decision to fail on
51714 the contents of the message, because the bounce message will of course include
51715 the contents of the original message and will therefore trigger the <option>fail</option>
51716 command again (causing a mail loop) unless steps are taken to prevent this.
51717 Testing the <option>error_message</option> condition is one way to prevent this. You could
51720 <literallayout class="monospaced">
51721 if $message_body contains "this is spam" and not error_message
51722 then fail text "spam is not wanted here" endif
51725 though of course that might let through unwanted bounce messages. The
51726 alternative is clever checking of the body and/or headers to detect bounces
51727 generated by the filter.
51730 The interpretation of a system filter file ceases after a
51731 <option>defer</option>,
51732 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
51733 set up earlier in the filter file are honoured, so you can use a sequence such
51736 <literallayout class="monospaced">
51741 to send a specified message when the system filter is freezing (or deferring or
51742 failing) a message. The normal deliveries for the message do not, of course,
51746 <section id="SECTaddremheasys">
51747 <title>Adding and removing headers in a system filter</title>
51749 <indexterm role="concept">
51750 <primary>header lines</primary>
51751 <secondary>adding; in system filter</secondary>
51753 <indexterm role="concept">
51754 <primary>header lines</primary>
51755 <secondary>removing; in system filter</secondary>
51757 <indexterm role="concept">
51758 <primary>filter</primary>
51759 <secondary>header lines; adding/removing</secondary>
51761 Two filter commands that are available only in system filters are:
51763 <literallayout class="monospaced">
51764 headers add <string>
51765 headers remove <string>
51768 The argument for the <option>headers add</option> is a string that is expanded and then
51769 added to the end of the message’s headers. It is the responsibility of the
51770 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
51771 space is ignored, and if the string is otherwise empty, or if the expansion is
51772 forced to fail, the command has no effect.
51775 You can use <quote>\n</quote> within the string, followed by white space, to specify
51776 continued header lines. More than one header may be added in one command by
51777 including <quote>\n</quote> within the string without any following white space. For
51780 <literallayout class="monospaced">
51781 headers add "X-header-1: ....\n \
51782 continuation of X-header-1 ...\n\
51786 Note that the header line continuation white space after the first newline must
51787 be placed before the backslash that continues the input string, because white
51788 space after input continuations is ignored.
51791 The argument for <option>headers remove</option> is a colon-separated list of header names.
51792 This command applies only to those headers that are stored with the message;
51793 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
51794 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
51795 header with the same name, they are all removed.
51798 The <option>headers</option> command in a system filter makes an immediate change to the set
51799 of header lines that was received with the message (with possible additions
51800 from ACL processing). Subsequent commands in the system filter operate on the
51801 modified set, which also forms the basis for subsequent message delivery.
51802 Unless further modified during routing or transporting, this set of headers is
51803 used for all recipients of the message.
51806 During routing and transporting, the variables that refer to the contents of
51807 header lines refer only to those lines that are in this set. Thus, header lines
51808 that are added by a system filter are visible to users’ filter files and to all
51809 routers and transports. This contrasts with the manipulation of header lines by
51810 routers and transports, which is not immediate, but which instead is saved up
51811 until the message is actually being written (see section
51812 <xref linkend="SECTheadersaddrem"/>).
51815 If the message is not delivered at the first attempt, header lines that were
51816 added by the system filter are stored with the message, and so are still
51817 present at the next delivery attempt. Header lines that were removed are still
51818 present, but marked <quote>deleted</quote> so that they are not transported with the
51819 message. For this reason, it is usual to make the <option>headers</option> command
51820 conditional on <option>first_delivery</option> so that the set of header lines is not
51821 modified more than once.
51824 Because header modification in a system filter acts immediately, you have to
51825 use an indirect approach if you want to modify the contents of a header line.
51828 <literallayout class="monospaced">
51829 headers add "Old-Subject: $h_subject:"
51830 headers remove "Subject"
51831 headers add "Subject: new subject (was: $h_old-subject:)"
51832 headers remove "Old-Subject"
51836 <title>Setting an errors address in a system filter</title>
51838 <indexterm role="concept">
51839 <primary>envelope sender</primary>
51841 In a system filter, if a <option>deliver</option> command is followed by
51843 <literallayout class="monospaced">
51844 errors_to <some address>
51847 in order to change the envelope sender (and hence the error reporting) for that
51848 delivery, any address may be specified. (In a user filter, only the current
51849 user’s address can be set.) For example, if some mail is being monitored, you
51852 <literallayout class="monospaced">
51853 unseen deliver monitor@spying.example errors_to root@local.example
51856 to take a copy which would not be sent back to the normal error reporting
51857 address if its delivery failed.
51860 <section id="SECTperaddfil">
51861 <title>Per-address filtering</title>
51863 <indexterm role="concept">
51864 <primary><varname>$domain</varname></primary>
51866 <indexterm role="concept">
51867 <primary><varname>$local_part</varname></primary>
51869 In contrast to the system filter, which is run just once per message for each
51870 delivery attempt, it is also possible to set up a system-wide filtering
51871 operation that runs once for each recipient address. In this case, variables
51872 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
51873 filter file could be made dependent on them. This is an example of a router
51874 which implements such a filter:
51876 <literallayout class="monospaced">
51880 domains = +local_domains
51881 file = /central/filters/$local_part
51887 The filter is run in a separate process under its own uid. Therefore, either
51888 <option>check_local_user</option> must be set (as above), in which case the filter is run as
51889 the local user, or the <option>user</option> option must be used to specify which user to
51890 use. If both are set, <option>user</option> overrides.
51893 Care should be taken to ensure that none of the commands in the filter file
51894 specify a significant delivery if the message is to go on to be delivered to
51895 its intended recipient. The router will not then claim to have dealt with the
51896 address, so it will be passed on to subsequent routers to be delivered in the
51898 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
51899 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
51900 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
51905 <chapter id="CHAPmsgproc">
51906 <title>Message processing</title>
51908 <indexterm role="concept" id="IIDmesproc" class="startofrange">
51909 <primary>message</primary>
51910 <secondary>general processing</secondary>
51912 Exim performs various transformations on the sender and recipient addresses of
51913 all messages that it handles, and also on the messages’ header lines. Some of
51914 these are optional and configurable, while others always take place. All of
51915 this processing, except rewriting as a result of routing, and the addition or
51916 removal of header lines while delivering, happens when a message is received,
51917 before it is placed on Exim’s queue.
51920 Some of the automatic processing takes place by default only for
51921 <quote>locally-originated</quote> messages. This adjective is used to describe messages
51922 that are not received over TCP/IP, but instead are passed to an Exim process on
51923 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
51924 set up by the <option>-bs</option> command line option.
51927 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
51928 or ::1) are not considered to be locally-originated. Exim does not treat the
51929 loopback interface specially in any way.
51932 If you want the loopback interface to be treated specially, you must ensure
51933 that there are appropriate entries in your ACLs.
51935 <section id="SECTsubmodnon">
51936 <title>Submission mode for non-local messages</title>
51938 <indexterm role="concept">
51939 <primary>message</primary>
51940 <secondary>submission</secondary>
51942 <indexterm role="concept">
51943 <primary>submission mode</primary>
51945 Processing that happens automatically for locally-originated messages (unless
51946 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
51947 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
51948 state. Submisssion mode is set by the modifier
51950 <literallayout class="monospaced">
51951 control = submission
51954 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
51955 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
51956 a local submission, and is normally used when the source of the message is
51957 known to be an MUA running on a client host (as opposed to an MTA). For
51958 example, to set submission mode for messages originating on the IPv4 loopback
51959 interface, you could include the following in the MAIL ACL:
51961 <literallayout class="monospaced">
51962 warn hosts = 127.0.0.1
51963 control = submission
51966 <indexterm role="concept">
51967 <primary><option>sender_retain</option></primary>
51969 There are some options that can be used when setting submission mode. A slash
51970 is used to separate options. For example:
51972 <literallayout class="monospaced">
51973 control = submission/sender_retain
51976 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
51977 true and <option>local_from_check</option> false for the current incoming message. The first
51978 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
51979 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
51980 authenticated sender. With this setting, Exim still fixes up messages by adding
51981 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
51982 attempt to check sender authenticity in header lines.
51985 When <option>sender_retain</option> is not set, a submission mode setting may specify a
51986 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
51989 <literallayout class="monospaced">
51990 control = submission/domain=some.domain
51993 The domain may be empty. How this value is used is described in sections
51994 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
51995 that allows you to specify the user’s full name for inclusion in a created
51996 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
51998 <literallayout class="monospaced">
51999 accept authenticated = *
52000 control = submission/domain=wonderland.example/\
52001 name=${lookup {$authenticated_id} \
52002 lsearch {/etc/exim/namelist}}
52005 Because the name may contain any characters, including slashes, the <option>name</option>
52006 option must be given last. The remainder of the string is used as the name. For
52007 the example above, if <filename>/etc/exim/namelist</filename> contains:
52009 <literallayout class="monospaced">
52010 bigegg: Humpty Dumpty
52013 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
52016 <literallayout class="monospaced">
52017 Sender: Humpty Dumpty <bigegg@wonderland.example>
52020 <indexterm role="concept">
52021 <primary>return path</primary>
52022 <secondary>in submission mode</secondary>
52024 By default, submission mode forces the return path to the same address as is
52025 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
52026 specified, the return path is also left unchanged.
52029 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
52030 ACL. This means that any sender checks performed before the fix-ups use the
52031 untrusted sender address specified by the user, not the trusted sender address
52032 specified by submission mode. Although this might be slightly unexpected, it
52033 does mean that you can configure ACL checks to spot that a user is trying to
52034 spoof another’s address.
52037 <section id="SECTlineendings">
52038 <title>Line endings</title>
52040 <indexterm role="concept">
52041 <primary>line endings</primary>
52043 <indexterm role="concept">
52044 <primary>carriage return</primary>
52046 <indexterm role="concept">
52047 <primary>linefeed</primary>
52049 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
52050 linefeed) is the line ending for messages transmitted over the Internet using
52051 SMTP over TCP/IP. However, within individual operating systems, different
52052 conventions are used. For example, Unix-like systems use just LF, but others
52053 use CRLF or just CR.
52056 Exim was designed for Unix-like systems, and internally, it stores messages
52057 using the system’s convention of a single LF as a line terminator. When
52058 receiving a message, all line endings are translated to this standard format.
52059 Originally, it was thought that programs that passed messages directly to an
52060 MTA within an operating system would use that system’s convention. Experience
52061 has shown that this is not the case; for example, there are Unix applications
52062 that use CRLF in this circumstance. For this reason, and for compatibility with
52063 other MTAs, the way Exim handles line endings for all messages is now as
52069 LF not preceded by CR is treated as a line ending.
52074 CR is treated as a line ending; if it is immediately followed by LF, the LF
52080 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
52081 nor a local message in the state where a line containing only a dot is a
52087 If a bare CR is encountered within a header line, an extra space is added after
52088 the line terminator so as not to end the header line. The reasoning behind this
52089 is that bare CRs in header lines are most likely either to be mistakes, or
52090 people trying to play silly games.
52095 If the first header line received in a message ends with CRLF, a subsequent
52096 bare LF in a header line is treated in the same way as a bare CR in a header
52103 <title>Unqualified addresses</title>
52105 <indexterm role="concept">
52106 <primary>unqualified addresses</primary>
52108 <indexterm role="concept">
52109 <primary>address</primary>
52110 <secondary>qualification</secondary>
52112 By default, Exim expects every envelope address it receives from an external
52113 host to be fully qualified. Unqualified addresses cause negative responses to
52114 SMTP commands. However, because SMTP is used as a means of transporting
52115 messages from MUAs running on personal workstations, there is sometimes a
52116 requirement to accept unqualified addresses from specific hosts or IP networks.
52119 Exim has two options that separately control which hosts may send unqualified
52120 sender or receipient addresses in SMTP commands, namely
52121 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
52122 cases, if an unqualified address is accepted, it is qualified by adding the
52123 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
52126 <indexterm role="concept">
52127 <primary><option>qualify_domain</option></primary>
52129 <indexterm role="concept">
52130 <primary><option>qualify_recipient</option></primary>
52132 Unqualified addresses in header lines are automatically qualified for messages
52133 that are locally originated, unless the <option>-bnq</option> option is given on the command
52134 line. For messages received over SMTP, unqualified addresses in header lines
52135 are qualified only if unqualified addresses are permitted in SMTP commands. In
52136 other words, such qualification is also controlled by
52137 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
52141 <title>The UUCP From line</title>
52143 <indexterm role="concept">
52144 <primary><quote>From</quote> line</primary>
52146 <indexterm role="concept">
52147 <primary>UUCP</primary>
52148 <secondary><quote>From</quote> line</secondary>
52150 <indexterm role="concept">
52151 <primary>sender</primary>
52152 <secondary>address</secondary>
52154 <indexterm role="concept">
52155 <primary><option>uucp_from_pattern</option></primary>
52157 <indexterm role="concept">
52158 <primary><option>uucp_from_sender</option></primary>
52160 <indexterm role="concept">
52161 <primary>envelope sender</primary>
52163 <indexterm role="concept">
52164 <primary>Sendmail compatibility</primary>
52165 <secondary><quote>From</quote> line</secondary>
52167 Messages that have come from UUCP (and some other applications) often begin
52168 with a line containing the envelope sender and a timestamp, following the word
52169 <quote>From</quote>. Examples of two common formats are:
52171 <literallayout class="monospaced">
52172 From a.oakley@berlin.mus Fri Jan 5 12:35 GMT 1996
52173 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
52176 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
52177 Exim recognizes such lines at the start of messages that are submitted to it
52178 via the command line (that is, on the standard input). It does not recognize
52179 such lines in incoming SMTP messages, unless the sending host matches
52180 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
52181 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
52182 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
52183 default value matches the two common cases shown above and puts the address
52184 that follows <quote>From</quote> into <varname>$1</varname>.
52187 <indexterm role="concept">
52188 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
52189 <secondary>in <quote>From </quote> line handling</secondary>
52191 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
52192 a trusted user, the message’s sender address is constructed by expanding the
52193 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
52194 then parsed as an RFC 2822 address. If there is no domain, the local part is
52195 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
52196 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
52199 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
52200 sender address is not changed. This is also the case for incoming SMTP messages
52201 that are permitted to contain <quote>From</quote> lines.
52204 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
52205 treated as a data line that starts the body of the message, as it is not valid
52206 as a header line. This also happens if a <quote>From</quote> line is present in an
52207 incoming SMTP message from a source that is not permitted to send them.
52211 <title>Resent- header lines</title>
52213 <indexterm role="concept">
52214 <primary><option>Resent-</option> header lines</primary>
52216 RFC 2822 makes provision for sets of header lines starting with the string
52217 <literal>Resent-</literal> to be added to a message when it is resent by the original
52218 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
52219 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
52220 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
52224 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
52225 processing of replies or other such automatic actions on messages.</emphasis>
52229 This leaves things a bit vague as far as other processing actions such as
52230 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
52236 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
52237 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
52242 If there’s a rewriting rule for a particular header line, it is also applied to
52243 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
52244 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
52249 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
52255 For a locally-submitted message,
52256 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
52257 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
52258 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
52259 included in log lines in this case.
52264 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
52265 <option>Resent-</option> header lines are present.
52271 <title>The Auto-Submitted: header line</title>
52272 <para revisionflag="changed">
52273 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
52274 includes the header line:
52276 <literallayout class="monospaced">
52277 Auto-Submitted: auto-replied
52281 <title>The Bcc: header line</title>
52283 <indexterm role="concept">
52284 <primary><emphasis>Bcc:</emphasis> header line</primary>
52286 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
52287 message’s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
52288 extracting its addresses). If <option>-t</option> is not present on the command line, any
52289 existing <emphasis>Bcc:</emphasis> is not removed.
52293 <title>The Date: header line</title>
52295 <indexterm role="concept">
52296 <primary><emphasis>Date:</emphasis> header line</primary>
52298 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
52299 Exim adds one, using the current date and time, unless the
52300 <option>suppress_local_fixups</option> control has been specified.
52304 <title>The Delivery-date: header line</title>
52306 <indexterm role="concept">
52307 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
52309 <indexterm role="concept">
52310 <primary><option>delivery_date_remove</option></primary>
52312 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
52313 set. Exim can be configured to add them to the final delivery of messages. (See
52314 the generic <option>delivery_date_add</option> transport option.) They should not be present
52315 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
52316 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
52321 <title>The Envelope-to: header line</title>
52323 <indexterm role="concept">
52324 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
52326 <indexterm role="concept">
52327 <primary><option>envelope_to_remove</option></primary>
52329 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
52330 Exim can be configured to add them to the final delivery of messages. (See the
52331 generic <option>envelope_to_add</option> transport option.) They should not be present in
52332 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
52333 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
52337 <section id="SECTthefrohea">
52338 <title>The From: header line</title>
52340 <indexterm role="concept">
52341 <primary><emphasis>From:</emphasis> header line</primary>
52343 <indexterm role="concept">
52344 <primary>Sendmail compatibility</primary>
52345 <secondary><quote>From</quote> line</secondary>
52347 <indexterm role="concept">
52348 <primary>message</primary>
52349 <secondary>submission</secondary>
52351 <indexterm role="concept">
52352 <primary>submission mode</primary>
52354 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
52355 adds one if either of the following conditions is true:
52360 The envelope sender address is not empty (that is, this is not a bounce
52361 message). The added header line copies the envelope sender address.
52366 <indexterm role="concept">
52367 <primary><varname>$authenticated_id</varname></primary>
52369 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
52371 <orderedlist numeration="arabic">
52374 <indexterm role="concept">
52375 <primary><varname>$qualify_domain</varname></primary>
52377 If no domain is specified by the submission control, the local part is
52378 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
52383 If a non-empty domain is specified by the submission control, the local
52384 part is <varname>$authenticated_id</varname>, and the the domain is the specified domain.
52389 If an empty domain is specified by the submission control,
52390 <varname>$authenticated_id</varname> is assumed to be the complete address.
52397 A non-empty envelope sender takes precedence.
52400 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
52401 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
52402 containing the sender’s address. The calling user’s login name and full name
52403 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
52404 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
52405 <option>unknown_login</option> configuration option). The address is qualified with
52406 <option>qualify_domain</option>.
52409 For compatibility with Sendmail, if an incoming, non-SMTP message has a
52410 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
52411 user, this is replaced by an address containing the user’s login name and full
52412 name as described in section <xref linkend="SECTconstr"/>.
52416 <title>The Message-ID: header line</title>
52418 <indexterm role="concept">
52419 <primary><emphasis>Message-ID:</emphasis> header line</primary>
52421 <indexterm role="concept">
52422 <primary>message</primary>
52423 <secondary>submission</secondary>
52425 <indexterm role="concept">
52426 <primary><option>message_id_header_text</option></primary>
52428 If a locally-generated or submission-mode incoming message does not contain a
52429 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
52430 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
52431 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
52432 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim’s internal
52433 message id, preceded by the letter E to ensure it starts with a letter, and
52434 followed by @ and the primary host name. Additional information can be included
52435 in this header line by setting the <option>message_id_header_text</option> and/or
52436 <option>message_id_header_domain</option> options.
52440 <title>The Received: header line</title>
52442 <indexterm role="concept">
52443 <primary><emphasis>Received:</emphasis> header line</primary>
52445 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
52446 contents are defined by the <option>received_header_text</option> configuration option, and
52447 Exim automatically adds a semicolon and a timestamp to the configured string.
52450 The <emphasis>Received:</emphasis> header is generated as soon as the message’s header lines
52451 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
52452 line is the time that the message started to be received. This is the value
52453 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
52456 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
52457 changed to the time of acceptance, which is (apart from a small delay while the
52458 -H spool file is written) the earliest time at which delivery could start.
52461 <section revisionflag="changed">
52462 <title>The References: header line</title>
52463 <para revisionflag="changed">
52464 <indexterm role="concept">
52465 <primary><emphasis>References:</emphasis> header line</primary>
52467 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
52468 header line. This is constructed according to the rules that are described in
52469 section 3.64 of RFC 2822 (which states that replies should contain such a
52470 header line), and section 3.14 of RFC 3834 (which states that automatic
52471 responses are not different in this respect). However, because some mail
52472 processing software does not cope well with very long header lines, no more
52473 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
52474 incoming message. If there are more than 12, the first one and then the final
52475 11 are copied, before adding the message ID of the incoming message.
52479 <title>The Return-path: header line</title>
52481 <indexterm role="concept">
52482 <primary><emphasis>Return-path:</emphasis> header line</primary>
52484 <indexterm role="concept">
52485 <primary><option>return_path_remove</option></primary>
52487 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
52488 it does the final delivery of messages. (See the generic <option>return_path_add</option>
52489 transport option.) Therefore, they should not be present in messages in
52490 transit. If the <option>return_path_remove</option> configuration option is set (the
52491 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
52494 <section id="SECTthesenhea">
52495 <title>The Sender: header line</title>
52497 <indexterm role="concept">
52498 <primary><emphasis>Sender:</emphasis> header line</primary>
52500 <indexterm role="concept">
52501 <primary>message</primary>
52502 <secondary>submission</secondary>
52504 For a locally-originated message from an untrusted user, Exim may remove an
52505 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
52506 these actions by setting the <option>local_sender_retain</option> option true, the
52507 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
52511 When a local message is received from an untrusted user and
52512 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
52513 control has not been set, a check is made to see if the address given in the
52514 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
52515 that is expected has the login name as the local part and the value of
52516 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
52517 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
52518 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
52519 line is added to the message.
52522 If you set <option>local_from_check</option> false, this checking does not occur. However,
52523 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
52524 <option>local_sender_retain</option> to be true. It is not possible to set both of these
52525 options true at the same time.
52528 <indexterm role="concept">
52529 <primary>submission mode</primary>
52531 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
52532 received over TCP/IP or for messages submitted by trusted users. However, when
52533 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
52534 not specified on the submission control, the following processing takes place:
52537 <indexterm role="concept">
52538 <primary><varname>$authenticated_id</varname></primary>
52540 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
52541 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
52542 created as follows:
52547 <indexterm role="concept">
52548 <primary><varname>$qualify_domain</varname></primary>
52550 If no domain is specified by the submission control, the local part is
52551 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
52556 If a non-empty domain is specified by the submission control, the local part
52557 is <varname>$authenticated_id</varname>, and the the domain is the specified domain.
52562 If an empty domain is specified by the submission control,
52563 <varname>$authenticated_id</varname> is assumed to be the complete address.
52568 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
52569 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
52570 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
52571 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
52574 <indexterm role="concept">
52575 <primary>return path</primary>
52576 <secondary>created from <emphasis>Sender:</emphasis></secondary>
52578 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
52579 the message (the envelope sender address) is changed to be the same address,
52580 except in the case of submission mode when <option>sender_retain</option> is specified.
52583 <section id="SECTheadersaddrem">
52584 <title>Adding and removing header lines in routers and transports</title>
52586 <indexterm role="concept">
52587 <primary>header lines</primary>
52588 <secondary>adding; in router or transport</secondary>
52590 <indexterm role="concept">
52591 <primary>header lines</primary>
52592 <secondary>removing; in router or transport</secondary>
52594 When a message is delivered, the addition and removal of header lines can be
52595 specified in a system filter, or on any of the routers and transports that
52596 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
52597 modifying headers in a system filter. Header lines can also be added in an ACL
52598 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
52601 In contrast to what happens in a system filter, header modifications that are
52602 specified on routers and transports apply only to the particular recipient
52603 addresses that are being processed by those routers and transports. These
52604 changes do not actually take place until a copy of the message is being
52605 transported. Therefore, they do not affect the basic set of header lines, and
52606 they do not affect the values of the variables that refer to header lines.
52609 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
52610 the transport cannot refer to the modified header lines, because such
52611 expansions all occur before the message is actually transported.
52614 For both routers and transports, the result of expanding a <option>headers_add</option>
52615 option must be in the form of one or more RFC 2822 header lines, separated by
52616 newlines (coded as <quote>\n</quote>). For example:
52618 <literallayout class="monospaced">
52619 headers_add = X-added-header: added by $primary_hostname\n\
52620 X-added-second: another added header line
52623 Exim does not check the syntax of these added header lines.
52626 The result of expanding <option>headers_remove</option> must consist of a colon-separated
52627 list of header names. This is confusing, because header names themselves are
52628 often terminated by colons. In this case, the colons are the list separators,
52629 not part of the names. For example:
52631 <literallayout class="monospaced">
52632 headers_remove = return-receipt-to:acknowledge-to
52635 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router, its value
52636 is expanded at routing time, and then associated with all addresses that are
52637 accepted by that router, and also with any new addresses that it generates. If
52638 an address passes through several routers as a result of aliasing or
52639 forwarding, the changes are cumulative.
52642 <indexterm role="concept">
52643 <primary><option>unseen</option> option</primary>
52645 However, this does not apply to multiple routers that result from the use of
52646 the <option>unseen</option> option. Any header modifications that were specified by the
52647 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
52650 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
52651 settings cannot be delivered together in a batch, so a transport is always
52652 dealing with a set of addresses that have the same header-processing
52656 The transport starts by writing the original set of header lines that arrived
52657 with the message, possibly modified by the system filter. As it writes out
52658 these lines, it consults the list of header names that were attached to the
52659 recipient address(es) by <option>headers_remove</option> options in routers, and it also
52660 consults the transport’s own <option>headers_remove</option> option. Header lines whose
52661 names are on either of these lists are not written out. If there are multiple
52662 instances of any listed header, they are all skipped.
52665 After the remaining original header lines have been written, new header
52666 lines that were specified by routers’ <option>headers_add</option> options are written, in
52667 the order in which they were attached to the address. These are followed by any
52668 header lines specified by the transport’s <option>headers_add</option> option.
52671 This way of handling header line modifications in routers and transports has
52672 the following consequences:
52677 The original set of header lines, possibly modified by the system filter,
52678 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
52679 to it, at all times.
52684 Header lines that are added by a router’s
52685 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
52686 expansion syntax in subsequent routers or the transport.
52691 Conversely, header lines that are specified for removal by <option>headers_remove</option>
52692 in a router remain visible to subsequent routers and the transport.
52697 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
52698 a later router or by a transport.
52703 An added header can refer to the contents of an original header that is to be
52704 removed, even it has the same name as the added header. For example:
52706 <literallayout class="monospaced">
52707 headers_remove = subject
52708 headers_add = Subject: new subject (was: $h_subject:)
52713 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
52714 for a <command>redirect</command> router that has the <option>one_time</option> option set.
52717 <section id="SECTconstr">
52718 <title>Constructed addresses</title>
52720 <indexterm role="concept">
52721 <primary>address</primary>
52722 <secondary>constructed</secondary>
52724 <indexterm role="concept">
52725 <primary>constructed address</primary>
52727 When Exim constructs a sender address for a locally-generated message, it uses
52731 <<emphasis>user name</emphasis>> <<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>>
52736 <literallayout class="monospaced">
52737 Zaphod Beeblebrox <zaphod@end.univ.example>
52740 The user name is obtained from the <option>-F</option> command line option if set, or
52741 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
52742 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
52743 ampersand character, this is replaced by the login name with the first letter
52744 upper cased, as is conventional in a number of operating systems. See the
52745 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
52746 The <option>unknown_username</option> option can be used to specify user names in cases when
52747 there is no password file entry.
52750 <indexterm role="concept">
52751 <primary>RFC 2047</primary>
52753 In all cases, the user name is made to conform to RFC 2822 by quoting all or
52754 parts of it if necessary. In addition, if it contains any non-printing
52755 characters, it is encoded as described in RFC 2047, which defines a way of
52756 including non-ASCII characters in header lines. The value of the
52757 <option>headers_charset</option> option specifies the name of the encoding that is used (the
52758 characters are assumed to be in this encoding). The setting of
52759 <option>print_topbitchars</option> controls whether characters with the top bit set (that
52760 is, with codes greater than 127) count as printing characters or not.
52764 <title>Case of local parts</title>
52766 <indexterm role="concept">
52767 <primary>case of local parts</primary>
52769 <indexterm role="concept">
52770 <primary>local part</primary>
52771 <secondary>case of</secondary>
52773 RFC 2822 states that the case of letters in the local parts of addresses cannot
52774 be assumed to be non-significant. Exim preserves the case of local parts of
52775 addresses, but by default it uses a lower-cased form when it is routing,
52776 because on most Unix systems, usernames are in lower case and case-insensitive
52777 routing is required. However, any particular router can be made to use the
52778 original case for local parts by setting the <option>caseful_local_part</option> generic
52782 <indexterm role="concept">
52783 <primary>mixed-case login names</primary>
52785 If you must have mixed-case user names on your system, the best way to proceed,
52786 assuming you want case-independent handling of incoming email, is to set up
52787 your first router to convert incoming local parts in your domains to the
52788 correct case by means of a file lookup. For example:
52790 <literallayout class="monospaced">
52793 domains = +local_domains
52794 data = ${lookup{$local_part}cdb\
52795 {/etc/usercased.cdb}{$value}fail}\
52799 For this router, the local part is forced to lower case by the default action
52800 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
52801 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
52802 on any subsequent routers which process your domains, they will operate on
52803 local parts with the correct case in a case-sensitive manner.
52807 <title>Dots in local parts</title>
52809 <indexterm role="concept">
52810 <primary>dot</primary>
52811 <secondary>in local part</secondary>
52813 <indexterm role="concept">
52814 <primary>local part</primary>
52815 <secondary>dots in</secondary>
52817 RFC 2822 forbids empty components in local parts. That is, an unquoted local
52818 part may not begin or end with a dot, nor have two consecutive dots in the
52819 middle. However, it seems that many MTAs do not enforce this, so Exim permits
52820 empty components for compatibility.
52824 <title>Rewriting addresses</title>
52826 <indexterm role="concept">
52827 <primary>rewriting</primary>
52828 <secondary>addresses</secondary>
52830 Rewriting of sender and recipient addresses, and addresses in headers, can
52831 happen automatically, or as the result of configuration options, as described
52832 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
52833 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
52836 Automatic rewriting includes qualification, as mentioned above. The other case
52837 in which it can happen is when an incomplete non-local domain is given. The
52838 routing process may cause this to be expanded into the full domain name. For
52839 example, a header such as
52841 <literallayout class="monospaced">
52845 might get rewritten as
52847 <literallayout class="monospaced">
52848 To: hare@teaparty.wonderland.fict.example
52851 Rewriting as a result of routing is the one kind of message processing that
52852 does not happen at input time, as it cannot be done until the address has
52856 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
52857 addresses have been routed, in case any of the headers get changed as a
52858 result of routing. However, doing this in practice would hold up many
52859 deliveries for unreasonable amounts of time, just because one address could not
52860 immediately be routed. Exim therefore does not delay other deliveries when
52861 routing of one or more addresses is deferred.
52862 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
52867 <chapter id="CHAPSMTP">
52868 <title>SMTP processing</title>
52870 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
52871 <primary>SMTP</primary>
52872 <secondary>processing details</secondary>
52874 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
52875 <primary>LMTP</primary>
52876 <secondary>processing details</secondary>
52878 Exim supports a number of different ways of using the SMTP protocol, and its
52879 LMTP variant, which is an interactive protocol for transferring messages into a
52880 closed mail store application. This chapter contains details of how SMTP is
52881 processed. For incoming mail, the following are available:
52886 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
52891 SMTP over the standard input and output (the <option>-bs</option> option);
52896 Batched SMTP on the standard input (the <option>-bS</option> option).
52901 For mail delivery, the following are available:
52906 SMTP over TCP/IP (the <command>smtp</command> transport);
52911 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
52912 <quote>lmtp</quote>);
52917 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
52923 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
52924 the <option>use_bsmtp</option> option set).
52929 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
52930 stored in or read from files (or pipes), in a format in which SMTP commands are
52931 used to contain the envelope information.
52933 <section id="SECToutSMTPTCP">
52934 <title>Outgoing SMTP and LMTP over TCP/IP</title>
52936 <indexterm role="concept">
52937 <primary>SMTP</primary>
52938 <secondary>outgoing over TCP/IP</secondary>
52940 <indexterm role="concept">
52941 <primary>outgoing SMTP over TCP/IP</primary>
52943 <indexterm role="concept">
52944 <primary>LMTP</primary>
52945 <secondary>over TCP/IP</secondary>
52947 <indexterm role="concept">
52948 <primary>outgoing LMTP over TCP/IP</primary>
52950 <indexterm role="concept">
52951 <primary>EHLO</primary>
52953 <indexterm role="concept">
52954 <primary>HELO</primary>
52956 <indexterm role="concept">
52957 <primary>SIZE option on MAIL command</primary>
52959 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
52960 The <option>protocol</option> option selects which protocol is to be used, but the actual
52961 processing is the same in both cases.
52964 If, in response to its EHLO command, Exim is told that the SIZE
52965 parameter is supported, it adds SIZE=<<emphasis>n</emphasis>> to each subsequent MAIL
52966 command. The value of <<emphasis>n</emphasis>> is the message size plus the value of the
52967 <option>size_addition</option> option (default 1024) to allow for additions to the message
52968 such as per-transport header lines, or changes made in a
52969 <indexterm role="concept">
52970 <primary>transport</primary>
52971 <secondary>filter</secondary>
52973 <indexterm role="concept">
52974 <primary>filter</primary>
52975 <secondary>transport filter</secondary>
52977 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
52981 If the remote server advertises support for PIPELINING, Exim uses the
52982 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
52983 required for the transaction.
52986 If the remote server advertises support for the STARTTLS command, and Exim
52987 was built to support TLS encryption, it tries to start a TLS session unless the
52988 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
52991 If the remote server advertises support for the AUTH command, Exim scans
52992 the authenticators configuration for any suitable client settings, as described
52993 in chapter <xref linkend="CHAPSMTPAUTH"/>.
52996 <indexterm role="concept">
52997 <primary>carriage return</primary>
52999 <indexterm role="concept">
53000 <primary>linefeed</primary>
53002 Responses from the remote host are supposed to be terminated by CR followed by
53003 LF. However, there are known to be hosts that do not send CR characters, so in
53004 order to be able to interwork with such hosts, Exim treats LF on its own as a
53008 If a message contains a number of different addresses, all those with the same
53009 characteristics (for example, the same envelope sender) that resolve to the
53010 same set of hosts, in the same order, are sent in a single SMTP transaction,
53011 even if they are for different domains, unless there are more than the setting
53012 of the <option>max_rcpts</option> option in the <command>smtp</command> transport allows, in which case
53013 they are split into groups containing no more than <option>max_rcpts</option> addresses
53014 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
53015 in parallel sessions. The order of hosts with identical MX values is not
53016 significant when checking whether addresses can be batched in this way.
53019 When the <command>smtp</command> transport suffers a temporary failure that is not
53020 message-related, Exim updates its transport-specific database, which contains
53021 records indexed by host name that remember which messages are waiting for each
53022 particular host. It also updates the retry database with new retry times.
53025 <indexterm role="concept">
53026 <primary>hints database</primary>
53027 <secondary>retry keys</secondary>
53029 Exim’s retry hints are based on host name plus IP address, so if one address of
53030 a multi-homed host is broken, it will soon be skipped most of the time.
53031 See the next section for more detail about error handling.
53034 <indexterm role="concept">
53035 <primary>SMTP</primary>
53036 <secondary>passed connection</secondary>
53038 <indexterm role="concept">
53039 <primary>SMTP</primary>
53040 <secondary>batching over TCP/IP</secondary>
53042 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
53043 looks in the hints database for the transport to see if there are any queued
53044 messages waiting for the host to which it is connected. If it finds one, it
53045 creates a new Exim process using the <option>-MC</option> option (which can only be used by
53046 a process running as root or the Exim user) and passes the TCP/IP socket to it
53047 so that it can deliver another message using the same socket. The new process
53048 does only those deliveries that are routed to the connected host, and may in
53049 turn pass the socket on to a third process, and so on.
53052 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
53053 limit the number of messages sent down a single TCP/IP connection.
53056 <indexterm role="concept">
53057 <primary>asterisk</primary>
53058 <secondary>after IP address</secondary>
53060 The second and subsequent messages delivered down an existing connection are
53061 identified in the main log by the addition of an asterisk after the closing
53062 square bracket of the IP address.
53065 <section id="SECToutSMTPerr">
53066 <title>Errors in outgoing SMTP</title>
53068 <indexterm role="concept">
53069 <primary>error</primary>
53070 <secondary>in outgoing SMTP</secondary>
53072 <indexterm role="concept">
53073 <primary>SMTP</primary>
53074 <secondary>errors in outgoing</secondary>
53076 <indexterm role="concept">
53077 <primary>host</primary>
53078 <secondary>error</secondary>
53080 Three different kinds of error are recognized for outgoing SMTP: host errors,
53081 message errors, and recipient errors.
53085 <term><emphasis role="bold">Host errors</emphasis></term>
53088 A host error is not associated with a particular message or with a
53089 particular recipient of a message. The host errors are:
53094 Connection refused or timed out,
53099 Any error response code on connection,
53104 Any error response code to EHLO or HELO,
53109 Loss of connection at any time, except after <quote>.</quote>,
53114 I/O errors at any time,
53119 Timeouts during the session, other than in response to MAIL, RCPT or
53120 the <quote>.</quote> at the end of the data.
53125 For a host error, a permanent error response on connection, or in response to
53126 EHLO, causes all addresses routed to the host to be failed. Any other host
53127 error causes all addresses to be deferred, and retry data to be created for the
53128 host. It is not tried again, for any message, until its retry time arrives. If
53129 the current set of addresses are not all delivered in this run (to some
53130 alternative host), the message is added to the list of those waiting for this
53131 host, so if it is still undelivered when a subsequent successful delivery is
53132 made to the host, it will be sent down the same SMTP connection.
53134 </listitem></varlistentry>
53136 <term><emphasis role="bold">Message errors</emphasis></term>
53139 <indexterm role="concept">
53140 <primary>message</primary>
53141 <secondary>error</secondary>
53143 A message error is associated with a particular message when sent to a
53144 particular host, but not with a particular recipient of the message. The
53145 message errors are:
53150 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
53156 Timeout after MAIL,
53161 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
53162 timeout after the DATA command itself is treated as a host error, as is loss of
53163 connection at any other time.
53168 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
53169 to be failed, and a delivery error report to be returned to the sender. A
53170 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
53171 addresses to be deferred. Retry data is not created for the host, but instead,
53172 a retry record for the combination of host plus message id is created. The
53173 message is not added to the list of those waiting for this host. This ensures
53174 that the failing message will not be sent to this host again until the retry
53175 time arrives. However, other messages that are routed to the host are not
53176 affected, so if it is some property of the message that is causing the error,
53177 it will not stop the delivery of other mail.
53180 If the remote host specified support for the SIZE parameter in its response
53181 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
53182 over-large message will cause a message error because the error arrives as a
53185 </listitem></varlistentry>
53187 <term><emphasis role="bold">Recipient errors</emphasis></term>
53190 <indexterm role="concept">
53191 <primary>recipient</primary>
53192 <secondary>error</secondary>
53194 A recipient error is associated with a particular recipient of a message. The
53195 recipient errors are:
53200 Any error response to RCPT,
53205 Timeout after RCPT.
53210 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
53211 recipient address to be failed, and a bounce message to be returned to the
53212 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
53213 address to be deferred, and routing retry data to be created for it. This is
53214 used to delay processing of the address in subsequent queue runs, until its
53215 routing retry time arrives. This applies to all messages, but because it
53216 operates only in queue runs, one attempt will be made to deliver a new message
53217 to the failing address before the delay starts to operate. This ensures that,
53218 if the failure is really related to the message rather than the recipient
53219 (<quote>message too big for this recipient</quote> is a possible example), other messages
53220 have a chance of getting delivered. If a delivery to the address does succeed,
53221 the retry information gets cleared, so all stuck messages get tried again, and
53222 the retry clock is reset.
53225 The message is not added to the list of those waiting for this host. Use of the
53226 host for other messages is unaffected, and except in the case of a timeout,
53227 other recipients are processed independently, and may be successfully delivered
53228 in the current SMTP session. After a timeout it is of course impossible to
53229 proceed with the session, so all addresses get deferred. However, those other
53230 than the one that failed do not suffer any subsequent retry delays. Therefore,
53231 if one recipient is causing trouble, the others have a chance of getting
53232 through when a subsequent delivery attempt occurs before the failing
53233 recipient’s retry time.
53235 </listitem></varlistentry>
53238 In all cases, if there are other hosts (or IP addresses) available for the
53239 current set of addresses (for example, from multiple MX records), they are
53240 tried in this run for any undelivered addresses, subject of course to their
53241 own retry data. In other words, recipient error retry data does not take effect
53242 until the next delivery attempt.
53245 Some hosts have been observed to give temporary error responses to every
53246 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
53247 would be nice if such circumstances could be recognized, and defer data for the
53248 host itself created, but this is not possible within the current Exim design.
53249 What actually happens is that retry data for every (host, message) combination
53253 The reason that timeouts after MAIL and RCPT are treated specially is that
53254 these can sometimes arise as a result of the remote host’s verification
53255 procedures. Exim makes this assumption, and treats them as if a temporary error
53256 response had been received. A timeout after <quote>.</quote> is treated specially because
53257 it is known that some broken implementations fail to recognize the end of the
53258 message if the last character of the last line is a binary zero. Thus, it is
53259 helpful to treat this case as a message error.
53262 Timeouts at other times are treated as host errors, assuming a problem with the
53263 host, or the connection to it. If a timeout after MAIL, RCPT,
53264 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
53265 the timeout is likely to occur at some other point in the dialogue, causing it
53266 then to be treated as a host error.
53269 There is experimental evidence that some MTAs drop the connection after the
53270 terminating <quote>.</quote> if they do not like the contents of the message for some
53271 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
53272 should be given. That is why Exim treats this case as a message rather than a
53273 host error, in order not to delay other messages to the same host.
53277 <title>Incoming SMTP messages over TCP/IP</title>
53279 <indexterm role="concept">
53280 <primary>SMTP</primary>
53281 <secondary>incoming over TCP/IP</secondary>
53283 <indexterm role="concept">
53284 <primary>incoming SMTP over TCP/IP</primary>
53286 <indexterm role="concept">
53287 <primary>inetd</primary>
53289 <indexterm role="concept">
53290 <primary>daemon</primary>
53292 Incoming SMTP messages can be accepted in one of two ways: by running a
53293 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
53294 <filename>/etc/inetd.conf</filename> should be like this:
53296 <literallayout class="monospaced">
53297 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
53300 Exim distinguishes between this case and the case of a locally running user
53301 agent using the <option>-bs</option> option by checking whether or not the standard input is
53302 a socket. When it is, either the port must be privileged (less than 1024), or
53303 the caller must be root or the Exim user. If any other user passes a socket
53304 with an unprivileged port number, Exim prints a message on the standard error
53305 stream and exits with an error code.
53308 By default, Exim does not make a log entry when a remote host connects or
53309 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
53310 unexpected. It can be made to write such log entries by setting the
53311 <option>smtp_connection</option> log selector.
53314 <indexterm role="concept">
53315 <primary>carriage return</primary>
53317 <indexterm role="concept">
53318 <primary>linefeed</primary>
53320 Commands from the remote host are supposed to be terminated by CR followed by
53321 LF. However, there are known to be hosts that do not send CR characters. In
53322 order to be able to interwork with such hosts, Exim treats LF on its own as a
53324 Furthermore, because common code is used for receiving messages from all
53325 sources, a CR on its own is also interpreted as a line terminator. However, the
53326 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
53329 <indexterm role="concept">
53330 <primary>EHLO</primary>
53331 <secondary>invalid data</secondary>
53333 <indexterm role="concept">
53334 <primary>HELO</primary>
53335 <secondary>invalid data</secondary>
53337 One area that sometimes gives rise to problems concerns the EHLO or
53338 HELO commands. Some clients send syntactically invalid versions of these
53339 commands, which Exim rejects by default. (This is nothing to do with verifying
53340 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
53341 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
53342 match the broken hosts that send invalid commands.
53345 <indexterm role="concept">
53346 <primary>SIZE option on MAIL command</primary>
53348 <indexterm role="concept">
53349 <primary>MAIL</primary>
53350 <secondary>SIZE option</secondary>
53352 The amount of disk space available is checked whenever SIZE is received on
53353 a MAIL command, independently of whether <option>message_size_limit</option> or
53354 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
53355 false. A temporary error is given if there is not enough space. If
53356 <option>check_spool_space</option> is set, the check is for that amount of space plus the
53357 value given with SIZE, that is, it checks that the addition of the incoming
53358 message will not reduce the space below the threshold.
53361 When a message is successfully received, Exim includes the local message id in
53362 its response to the final <quote>.</quote> that terminates the data. If the remote host
53363 logs this text it can help with tracing what has happened to a message.
53366 The Exim daemon can limit the number of simultaneous incoming connections it is
53367 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
53368 number of simultaneous incoming connections from a single remote host (see the
53369 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
53370 rejected using the SMTP temporary error code 421.
53373 The Exim daemon does not rely on the SIGCHLD signal to detect when a
53374 subprocess has finished, as this can get lost at busy times. Instead, it looks
53375 for completed subprocesses every time it wakes up. Provided there are other
53376 things happening (new incoming calls, starts of queue runs), completed
53377 processes will be noticed and tidied away. On very quiet systems you may
53378 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
53379 it will be noticed when the daemon next wakes up.
53382 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
53383 and can also be set up to reject SMTP calls from non-reserved hosts at times of
53384 high system load – for details see the <option>smtp_accept_reserve</option>,
53385 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
53386 applies in both the daemon and <emphasis>inetd</emphasis> cases.
53389 Exim normally starts a delivery process for each message received, though this
53390 can be varied by means of the <option>-odq</option> command line option and the
53391 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
53392 number of simultaneously running delivery processes started in this way from
53393 SMTP input can be limited by the <option>smtp_accept_queue</option> and
53394 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
53395 subsequently received messages are just put on the input queue without starting
53396 a delivery process.
53399 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
53400 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
53401 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
53402 handled by an entirely independent Exim process. Control by load average is,
53403 however, available with <emphasis>inetd</emphasis>.
53406 Exim can be configured to verify addresses in incoming SMTP commands as they
53407 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
53408 to rewrite addresses at this time – before any syntax checking is done. See
53409 section <xref linkend="SECTrewriteS"/>.
53412 Exim can also be configured to limit the rate at which a client host submits
53413 MAIL and RCPT commands in a single SMTP session. See the
53414 <option>smtp_ratelimit_hosts</option> option.
53418 <title>Unrecognized SMTP commands</title>
53420 <indexterm role="concept">
53421 <primary>SMTP</primary>
53422 <secondary>unrecognized commands</secondary>
53424 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
53425 commands during a single SMTP connection, it drops the connection after sending
53426 the error response to the last command. The default value for
53427 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
53428 abuse that subvert web servers into making connections to SMTP ports; in these
53429 circumstances, a number of non-SMTP lines are sent first.
53433 <title>Syntax and protocol errors in SMTP commands</title>
53435 <indexterm role="concept">
53436 <primary>SMTP</primary>
53437 <secondary>syntax errors</secondary>
53439 <indexterm role="concept">
53440 <primary>SMTP</primary>
53441 <secondary>protocol errors</secondary>
53443 A syntax error is detected if an SMTP command is recognized, but there is
53444 something syntactically wrong with its data, for example, a malformed email
53445 address in a RCPT command. Protocol errors include invalid command
53446 sequencing such as RCPT before MAIL. If Exim receives more than
53447 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
53448 drops the connection after sending the error response to the last command. The
53449 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
53450 broken clients that loop sending bad commands (yes, it has been seen).
53454 <title>Use of non-mail SMTP commands</title>
53456 <indexterm role="concept">
53457 <primary>SMTP</primary>
53458 <secondary>non-mail commands</secondary>
53460 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
53461 DATA. Exim counts such commands, and drops the connection if there are too
53462 many of them in a single SMTP session. This action catches some
53463 denial-of-service attempts and things like repeated failing AUTHs, or a mad
53464 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
53465 defines what <quote>too many</quote> means. Its default value is 10.
53468 When a new message is expected, one occurrence of RSET is not counted. This
53469 allows a client to send one RSET between messages (this is not necessary,
53470 but some clients do it). Exim also allows one uncounted occurence of HELO
53471 or EHLO, and one occurrence of STARTTLS between messages. After
53472 starting up a TLS session, another EHLO is expected, and so it too is not
53476 The first occurrence of AUTH in a connection, or immediately following
53477 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
53478 RCPT, DATA, and QUIT are counted.
53481 You can control which hosts are subject to the limit set by
53482 <option>smtp_accept_max_nonmail</option> by setting
53483 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
53484 the limit apply to all hosts. This option means that you can exclude any
53485 specific badly-behaved hosts that you have to live with.
53489 <title>The VRFY and EXPN commands</title>
53491 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
53492 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
53493 appropriate) in order to decide whether the command should be accepted or not.
53494 If no ACL is defined, the command is rejected.
53497 <indexterm role="concept">
53498 <primary>VRFY</primary>
53499 <secondary>processing</secondary>
53501 When VRFY is accepted, it runs exactly the same code as when Exim is
53502 called with the <option>-bv</option> option.
53505 <indexterm role="concept">
53506 <primary>EXPN</primary>
53507 <secondary>processing</secondary>
53509 When EXPN is accepted, a single-level expansion of the address is done.
53510 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
53511 than a verification (the <option>-bv</option> option). If an unqualified local part is given
53512 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
53513 of VRFY and EXPN commands are logged on the main and reject logs, and
53514 VRFY verification failures are logged on the main log for consistency with
53518 <section id="SECTETRN">
53519 <title>The ETRN command</title>
53521 <indexterm role="concept">
53522 <primary>ETRN</primary>
53523 <secondary>processing</secondary>
53525 RFC 1985 describes an SMTP command called ETRN that is designed to
53526 overcome the security problems of the TURN command (which has fallen into
53527 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
53528 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
53529 should be accepted or not. If no ACL is defined, the command is rejected.
53532 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
53533 delivery to certain hosts. As Exim does not organize its message queue by host,
53534 the only form of ETRN that is supported by default is the one where the
53535 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
53536 specific to the SMTP server. A valid ETRN command causes a run of Exim with
53537 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
53538 argument. For example,
53540 <literallayout class="monospaced">
53546 <literallayout class="monospaced">
53550 which causes a delivery attempt on all messages with undelivered addresses
53551 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
53552 default), Exim prevents the simultaneous execution of more than one queue run
53553 for the same argument string as a result of an ETRN command. This stops
53554 a misbehaving client from starting more than one queue runner at once.
53557 <indexterm role="concept">
53558 <primary>hints database</primary>
53559 <secondary>ETRN serialization</secondary>
53561 Exim implements the serialization by means of a hints database in which a
53562 record is written whenever a process is started by ETRN, and deleted when
53563 the process completes. However, Exim does not keep the SMTP session waiting for
53564 the ETRN process to complete. Once ETRN is accepted, the client is sent
53565 a <quote>success</quote> return code. Obviously there is scope for hints records to get
53566 left lying around if there is a system or program crash. To guard against this,
53567 Exim ignores any records that are more than six hours old.
53570 <indexterm role="concept">
53571 <primary><option>smtp_etrn_command</option></primary>
53573 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
53574 used. This specifies a command that is run whenever ETRN is received,
53575 whatever the form of its argument. For
53578 <literallayout class="monospaced">
53579 smtp_etrn_command = /etc/etrn_command $domain \
53580 $sender_host_address
53583 <indexterm role="concept">
53584 <primary><varname>$domain</varname></primary>
53586 The string is split up into arguments which are independently expanded. The
53587 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
53588 and no syntax checking is done on the contents of this argument. Exim does not
53589 wait for the command to complete, so its status code is not checked. Exim runs
53590 under its own uid and gid when receiving incoming SMTP, so it is not possible
53591 for it to change them before running the command.
53595 <title>Incoming local SMTP</title>
53597 <indexterm role="concept">
53598 <primary>SMTP</primary>
53599 <secondary>local incoming</secondary>
53601 Some user agents use SMTP to pass messages to their local MTA using the
53602 standard input and output, as opposed to passing the envelope on the command
53603 line and writing the message to the standard input. This is supported by the
53604 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
53605 messages over TCP/IP (including the use of ACLs), except that the envelope
53606 sender given in a MAIL command is ignored unless the caller is trusted. In
53607 an ACL you can detect this form of SMTP input by testing for an empty host
53608 identification. It is common to have this as the first line in the ACL that
53609 runs for RCPT commands:
53611 <literallayout class="monospaced">
53615 This accepts SMTP messages from local processes without doing any other tests.
53618 <section id="SECTbatchSMTP">
53619 <title>Outgoing batched SMTP</title>
53621 <indexterm role="concept">
53622 <primary>SMTP</primary>
53623 <secondary>batched outgoing</secondary>
53625 <indexterm role="concept">
53626 <primary>batched SMTP output</primary>
53628 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
53629 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
53630 be output in BSMTP format. No SMTP responses are possible for this form of
53631 delivery. All it is doing is using SMTP commands as a way of transmitting the
53632 envelope along with the message.
53635 The message is written to the file or pipe preceded by the SMTP commands
53636 MAIL and RCPT, and followed by a line containing a single dot. Lines in
53637 the message that start with a dot have an extra dot added. The SMTP command
53638 HELO is not normally used. If it is required, the <option>message_prefix</option> option
53639 can be used to specify it.
53642 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
53643 one recipient address at a time by default. However, you can arrange for them
53644 to handle several addresses at once by setting the <option>batch_max</option> option. When
53645 this is done for BSMTP, messages may contain multiple RCPT commands. See
53646 chapter <xref linkend="CHAPbatching"/> for more details.
53649 <indexterm role="concept">
53650 <primary><varname>$host</varname></primary>
53652 When one or more addresses are routed to a BSMTP transport by a router that
53653 sets up a host list, the name of the first host on the list is available to the
53654 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
53657 <literallayout class="monospaced">
53660 driver = manualroute
53661 transport = smtp_appendfile
53662 route_list = domain.example batch.host.example
53666 driver = appendfile
53667 directory = /var/bsmtp/$host
53673 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
53674 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
53675 message (unless there are more than 1000 recipients).
53678 <section id="SECTincomingbatchedSMTP">
53679 <title>Incoming batched SMTP</title>
53681 <indexterm role="concept">
53682 <primary>SMTP</primary>
53683 <secondary>batched incoming</secondary>
53685 <indexterm role="concept">
53686 <primary>batched SMTP input</primary>
53688 The <option>-bS</option> command line option causes Exim to accept one or more messages by
53689 reading SMTP on the standard input, but to generate no responses. If the caller
53690 is trusted, the senders in the MAIL commands are believed; otherwise the
53691 sender is always the caller of Exim. Unqualified senders and receivers are not
53692 rejected (there seems little point) but instead just get qualified. HELO
53693 and EHLO act as RSET; VRFY, EXPN, ETRN and HELP, act
53694 as NOOP; QUIT quits.
53697 No policy checking is done for BSMTP input. That is, no ACL is run at anytime.
53698 In this respect it is like non-SMTP local input.
53701 If an error is detected while reading a message, including a missing <quote>.</quote> at
53702 the end, Exim gives up immediately. It writes details of the error to the
53703 standard output in a stylized way that the calling program should be able to
53704 make some use of automatically, for example:
53706 <literallayout class="monospaced">
53707 554 Unexpected end of file
53708 Transaction started in line 10
53709 Error detected in line 14
53712 It writes a more verbose version, for human consumption, to the standard error
53715 <literallayout class="monospaced">
53716 An error was detected while processing a file of BSMTP input.
53717 The error message was:
53719 501 '>' missing at end of address
53721 The SMTP transaction started in line 10.
53722 The error was detected in line 12.
53723 The SMTP command at fault was:
53725 rcpt to:<malformed@in.com.plete
53727 1 previous message was successfully processed.
53728 The rest of the batch was abandoned.
53731 The return code from Exim is zero only if there were no errors. It is 1 if some
53732 messages were accepted before an error was detected, and 2 if no messages were
53734 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
53735 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
53740 <chapter id="CHAPemsgcust">
53741 <title>Customizing bounce and warning messages</title>
53742 <titleabbrev>Customizing messages</titleabbrev>
53744 When a message fails to be delivered, or remains on the queue for more than a
53745 configured amount of time, Exim sends a message to the original sender, or
53746 to an alternative configured address. The text of these messages is built into
53747 the code of Exim, but it is possible to change it, either by adding a single
53748 string, or by replacing each of the paragraphs by text supplied in a file.
53751 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
53752 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
53753 option. Exim also adds the line
53755 <literallayout class="monospaced">
53756 Auto-Submitted: auto-generated
53759 to all warning and bounce messages,
53762 <title>Customizing bounce messages</title>
53764 <indexterm role="concept">
53765 <primary>customizing</primary>
53766 <secondary>bounce message</secondary>
53768 <indexterm role="concept">
53769 <primary>bounce message</primary>
53770 <secondary>customizing</secondary>
53772 If <option>bounce_message_text</option> is set, its contents are included in the default
53773 message immediately after <quote>This message was created automatically by mail
53774 delivery software.</quote> The string is not expanded. It is not used if
53775 <option>bounce_message_file</option> is set.
53778 When <option>bounce_message_file</option> is set, it must point to a template file for
53779 constructing error messages. The file consists of a series of text items,
53780 separated by lines consisting of exactly four asterisks. If the file cannot be
53781 opened, default text is used and a message is written to the main and panic
53782 logs. If any text item in the file is empty, default text is used for that
53786 <indexterm role="concept">
53787 <primary><varname>$bounce_recipient</varname></primary>
53789 <indexterm role="concept">
53790 <primary><varname>$bounce_return_size_limit</varname></primary>
53792 Each item of text that is read from the file is expanded, and there are two
53793 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
53794 the recipient of an error message while it is being created, and
53795 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
53796 option, rounded to a whole number.
53799 The items must appear in the file in the following order:
53804 The first item is included in the headers, and should include at least a
53805 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
53810 The second item forms the start of the error message. After it, Exim lists the
53811 failing addresses with their error messages.
53816 The third item is used to introduce any text from pipe transports that is to be
53817 returned to the sender. It is omitted if there is no such text.
53822 The fourth item is used to introduce the copy of the message that is returned
53823 as part of the error report.
53828 The fifth item is added after the fourth one if the returned message is
53829 truncated because it is bigger than <option>return_size_limit</option>.
53834 The sixth item is added after the copy of the original message.
53839 The default state (<option>bounce_message_file</option> unset) is equivalent to the
53840 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
53841 other lines have been split in order to fit them on the page:
53843 <literallayout class="monospaced">
53844 Subject: Mail delivery failed
53845 ${if eq{$sender_address}{$bounce_recipient}
53846 {: returning message to sender}}
53848 This message was created automatically by mail delivery software.
53850 A message ${if eq{$sender_address}{$bounce_recipient}
53851 {that you sent }{sent by
53853 <$sender_address>
53855 }}could not be delivered to all of its recipients.
53856 The following address(es) failed:
53858 The following text was generated during the delivery attempt(s):
53860 ------ This is a copy of the message, including all the headers.
53863 ------ The body of the message is $message_size characters long;
53865 ------ $bounce_return_size_limit or so are included here.
53869 <section id="SECTcustwarn">
53870 <title>Customizing warning messages</title>
53872 <indexterm role="concept">
53873 <primary>customizing</primary>
53874 <secondary>warning message</secondary>
53876 <indexterm role="concept">
53877 <primary>warning of delay</primary>
53878 <secondary>customizing the message</secondary>
53880 The option <option>warn_message_file</option> can be pointed at a template file for use when
53881 warnings about message delays are created. In this case there are only three
53887 The first item is included in the headers, and should include at least a
53888 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
53893 The second item forms the start of the warning message. After it, Exim lists
53894 the delayed addresses.
53899 The third item then ends the message.
53904 The default state is equivalent to the following file, except that some lines
53905 have been split here, in order to fit them on the page:
53907 <literallayout class="monospaced">
53908 Subject: Warning: message $message_exim_id delayed
53909 $warn_message_delay
53911 This message was created automatically by mail delivery software.
53913 A message ${if eq{$sender_address}{$warn_message_recipients}
53914 {that you sent }{sent by
53916 <$sender_address>
53918 }}has not been delivered to all of its recipients after
53919 more than $warn_message_delay on the queue on $primary_hostname.
53921 The message identifier is: $message_exim_id
53922 The subject of the message is: $h_subject
53923 The date of the message is: $h_date
53925 The following address(es) have not yet been delivered:
53927 No action is required on your part. Delivery attempts will
53928 continue for some time, and this warning may be repeated at
53929 intervals if the message remains undelivered. Eventually the
53930 mail delivery software will give up, and when that happens,
53931 the message will be returned to you.
53934 <indexterm role="concept">
53935 <primary><varname>$warn_message_delay</varname></primary>
53937 <indexterm role="concept">
53938 <primary><varname>$warn_message_recipients</varname></primary>
53940 However, in the default state the subject and date lines are omitted if no
53941 appropriate headers exist. During the expansion of this file,
53942 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote><<emphasis>n</emphasis>>
53943 minutes</quote> or <quote><<emphasis>n</emphasis>> hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
53944 of recipients for the warning message. There may be more than one if there are
53945 multiple addresses with different <option>errors_to</option> settings on the routers that
53951 <chapter id="CHAPcomconreq">
53952 <title>Some common configuration settings</title>
53954 This chapter discusses some configuration settings that seem to be fairly
53955 common. More examples and discussion can be found in the Exim book.
53958 <title>Sending mail to a smart host</title>
53960 <indexterm role="concept">
53961 <primary>smart host</primary>
53962 <secondary>example router</secondary>
53964 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
53965 should replace the default <command>dnslookup</command> router with a router which does the
53966 routing explicitly:
53968 <literallayout class="monospaced">
53969 send_to_smart_host:
53970 driver = manualroute
53971 route_list = !+local_domains smart.host.name
53972 transport = remote_smtp
53975 You can use the smart host’s IP address instead of the name if you wish.
53976 If you are using Exim only to submit messages to a smart host, and not for
53977 receiving incoming messages, you can arrange for it to do the submission
53978 synchronously by setting the <option>mua_wrapper</option> option (see chapter
53979 <xref linkend="CHAPnonqueueing"/>).
53982 <section id="SECTmailinglists">
53983 <title>Using Exim to handle mailing lists</title>
53985 <indexterm role="concept">
53986 <primary>mailing lists</primary>
53988 Exim can be used to run simple mailing lists, but for large and/or complicated
53989 requirements, the use of additional specialized mailing list software such as
53990 Majordomo or Mailman is recommended.
53993 The <command>redirect</command> router can be used to handle mailing lists where each list
53994 is maintained in a separate file, which can therefore be managed by an
53995 independent manager. The <option>domains</option> router option can be used to run these
53996 lists in a separate domain from normal mail. For example:
53998 <literallayout class="monospaced">
54001 domains = lists.example
54002 file = /usr/lists/$local_part
54005 errors_to = $local_part-request@lists.example
54009 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
54010 in that domain, it looks for a file that matches the local part. If there is no
54011 such file, the router declines, but because <option>no_more</option> is set, no subsequent
54012 routers are tried, and so the whole delivery fails.
54015 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
54016 expanded into a file name or a pipe delivery, which is usually inappropriate in
54020 <indexterm role="concept">
54021 <primary><option>errors_to</option></primary>
54023 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
54024 taken from a mailing list are to be sent to the given address rather than the
54025 original sender of the message. However, before acting on this, Exim verifies
54026 the error address, and ignores it if verification fails.
54029 For example, using the configuration above, mail sent to
54030 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
54031 <filename>/usr/lists/dicts</filename>, with error reports directed to
54032 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
54033 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
54034 the address(es) of this particular list’s manager(s), but other approaches,
54035 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
54036 or <option>local_part_suffix</option> options) to handle addresses of the form
54037 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
54041 <title>Syntax errors in mailing lists</title>
54043 <indexterm role="concept">
54044 <primary>mailing lists</primary>
54045 <secondary>syntax errors in</secondary>
54047 If an entry in redirection data contains a syntax error, Exim normally defers
54048 delivery of the original address. That means that a syntax error in a mailing
54049 list holds up all deliveries to the list. This may not be appropriate when a
54050 list is being maintained automatically from data supplied by users, and the
54051 addresses are not rigorously checked.
54054 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
54055 entries that fail to parse, noting the incident in the log. If in addition
54056 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
54057 whenever a broken address is skipped. It is usually appropriate to set
54058 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
54062 <title>Re-expansion of mailing lists</title>
54064 <indexterm role="concept">
54065 <primary>mailing lists</primary>
54066 <secondary>re-expansion of</secondary>
54068 Exim remembers every individual address to which a message has been delivered,
54069 in order to avoid duplication, but it normally stores only the original
54070 recipient addresses with a message. If all the deliveries to a mailing list
54071 cannot be done at the first attempt, the mailing list is re-expanded when the
54072 delivery is next tried. This means that alterations to the list are taken into
54073 account at each delivery attempt, so addresses that have been added to
54074 the list since the message arrived will therefore receive a copy of the
54075 message, even though it pre-dates their subscription.
54078 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
54079 on the <command>redirect</command> router. If this is done, any addresses generated by the
54080 router that fail to deliver at the first attempt are added to the message as
54081 <quote>top level</quote> addresses, and the parent address that generated them is marked
54082 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
54083 subsequent delivery attempts. The disadvantage of this is that if any of the
54084 failing addresses are incorrect, correcting them in the file has no effect on
54085 pre-existing messages.
54088 The original top-level address is remembered with each of the generated
54089 addresses, and is output in any log messages. However, any intermediate parent
54090 addresses are not recorded. This makes a difference to the log only if the
54091 <option>all_parents</option> selector is set, but for mailing lists there is normally only
54092 one level of expansion anyway.
54096 <title>Closed mailing lists</title>
54098 <indexterm role="concept">
54099 <primary>mailing lists</primary>
54100 <secondary>closed</secondary>
54102 The examples so far have assumed open mailing lists, to which anybody may
54103 send mail. It is also possible to set up closed lists, where mail is accepted
54104 from specified senders only. This is done by making use of the generic
54105 <option>senders</option> option to restrict the router that handles the list.
54108 The following example uses the same file as a list of recipients and as a list
54109 of permitted senders. It requires three routers:
54111 <literallayout class="monospaced">
54114 domains = lists.example
54115 local_part_suffix = -request
54116 file = /usr/lists/$local_part$local_part_suffix
54121 domains = lists.example
54122 senders = ${if exists {/usr/lists/$local_part}\
54123 {lsearch;/usr/lists/$local_part}{*}}
54124 file = /usr/lists/$local_part
54127 errors_to = $local_part-request@lists.example
54132 domains = lists.example
54134 data = :fail: $local_part@lists.example is a closed mailing list
54137 All three routers have the same <option>domains</option> setting, so for any other domains,
54138 they are all skipped. The first router runs only if the local part ends in
54139 <option>-request</option>. It handles messages to the list manager(s) by means of an open
54143 The second router runs only if the <option>senders</option> precondition is satisfied. It
54144 checks for the existence of a list that corresponds to the local part, and then
54145 checks that the sender is on the list by means of a linear search. It is
54146 necessary to check for the existence of the file before trying to search it,
54147 because otherwise Exim thinks there is a configuration error. If the file does
54148 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
54149 means that the router runs, but because there is no list, declines, and
54150 <option>no_more</option> ensures that no further routers are run. The address fails with an
54151 <quote>unrouteable address</quote> error.
54154 The third router runs only if the second router is skipped, which happens when
54155 a mailing list exists, but the sender is not on it. This router forcibly fails
54156 the address, giving a suitable error message.
54159 <section id="SECTverp" revisionflag="changed">
54160 <title>Variable Envelope Return Paths (VERP)</title>
54161 <para revisionflag="changed">
54162 <indexterm role="concept">
54163 <primary>VERP</primary>
54165 <indexterm role="concept">
54166 <primary>Variable Envelope Return Paths</primary>
54168 <indexterm role="concept">
54169 <primary>envelope sender</primary>
54171 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> –
54172 are a way of helping mailing list administrators discover which subscription
54173 address is the cause of a particular delivery failure. The idea is to encode
54174 the original recipient address in the outgoing envelope sender address, so that
54175 if the message is forwarded by another host and then subsequently bounces, the
54176 original recipient can be extracted from the recipient address of the bounce.
54178 <para revisionflag="changed">
54179 <indexterm role="option">
54180 <primary><option>errors_to</option></primary>
54182 <indexterm role="option">
54183 <primary><option>return_path</option></primary>
54185 Envelope sender addresses can be modified by Exim using two different
54186 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
54187 list examples), or the <option>return_path</option> option on a transport. The second of
54188 these is effective only if the message is successfully delivered to another
54189 host; it is not used for errors detected on the local host (see the description
54190 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
54191 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
54193 <literallayout class="monospaced" revisionflag="changed">
54198 ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
54199 {$1-request=$local_part%$domain@your.dom.example}fail}
54201 <para revisionflag="changed">
54202 This has the effect of rewriting the return path (envelope sender) on outgoing
54203 SMTP messages, if the local part of the original return path ends in
54204 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
54205 local part and domain of the recipient into the return path. Suppose, for
54206 example, that a message whose return path has been set to
54207 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
54208 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
54211 <literallayout class="monospaced" revisionflag="changed">
54212 somelist-request=subscriber%other.dom.example@your.dom.example
54214 <para revisionflag="changed">
54215 <indexterm role="concept">
54216 <primary><varname>$local_part</varname></primary>
54218 For this to work, you must also arrange for outgoing messages that have
54219 <quote>-request</quote> in their return paths to have just a single recipient. That is
54220 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
54221 might be sent to several different recipients in the same domain, in which case
54222 <varname>$local_part</varname> is not available in the transport, because it is not unique.
54224 <para revisionflag="changed">
54225 Unless your host is doing nothing but mailing list deliveries, you should
54226 probably use a separate transport for the VERP deliveries, so as not to use
54227 extra resources for the others. This can easily be done by expanding the
54228 <option>transport</option> option in the router:
54230 <literallayout class="monospaced" revisionflag="changed">
54233 domains = ! +local_domains
54235 ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
54236 {verp_smtp}{remote_smtp}}
54239 <para revisionflag="changed">
54240 If you want to change the return path using <option>errors_to</option> in a router instead
54241 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
54242 routers that handle mailing list addresses. This will ensure that all delivery
54243 errors, including those detected on the local host, are sent to the VERP
54246 <para revisionflag="changed">
54247 On a host that does no local deliveries and has no manual routing, only the
54248 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
54249 SMTP deliveries. Every mailing list recipient has its own return path value,
54250 and so Exim must hand them to the transport one at a time. Here is an example
54251 of a <command>dnslookup</command> router that implements VERP:
54253 <literallayout class="monospaced" revisionflag="changed">
54256 domains = ! +local_domains
54257 transport = remote_smtp
54259 ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
54260 {$1-request=$local_part%$domain@your.dom.example}fail}
54263 <para revisionflag="changed">
54264 Before you start sending out messages with VERPed return paths, you must also
54265 configure Exim to accept the bounce messages that come back to those paths.
54266 Typically this is done by setting a <option>local_part_suffix</option> option for a
54267 router, and using this to route the messages to wherever you want to handle
54270 <para revisionflag="changed">
54271 The overhead incurred in using VERP depends very much on the size of the
54272 message, the number of recipient addresses that resolve to the same remote
54273 host, and the speed of the connection over which the message is being sent. If
54274 a lot of addresses resolve to the same host and the connection is slow, sending
54275 a separate copy of the message for each address may take substantially longer
54276 than sending a single copy with many recipients (for which VERP cannot be
54280 <section id="SECTvirtualdomains">
54281 <title>Virtual domains</title>
54283 <indexterm role="concept">
54284 <primary>virtual domains</primary>
54286 <indexterm role="concept">
54287 <primary>domain</primary>
54288 <secondary>virtual</secondary>
54290 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
54296 A domain for which there are no real mailboxes; all valid local parts are
54297 aliases for other email addresses. Common examples are organizational
54298 top-level domains and <quote>vanity</quote> domains.
54303 One of a number of independent domains that are all handled by the same host,
54304 with mailboxes on that host, but where the mailbox owners do not necessarily
54305 have login accounts on that host.
54310 The first usage is probably more common, and does seem more <quote>virtual</quote> than
54311 the second. This kind of domain can be handled in Exim with a straightforward
54312 aliasing router. One approach is to create a separate alias file for each
54313 virtual domain. Exim can test for the existence of the alias file to determine
54314 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
54315 to a router of this form:
54317 <literallayout class="monospaced">
54320 domains = dsearch;/etc/mail/virtual
54321 data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
54325 The <option>domains</option> option specifies that the router is to be skipped, unless there
54326 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
54327 domain that is being processed. When the router runs, it looks up the local
54328 part in the file to find a new address (or list of addresses). The <option>no_more</option>
54329 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
54330 string), Exim gives up on the address without trying any subsequent routers.
54333 This one router can handle all the virtual domains because the alias file names
54334 follow a fixed pattern. Permissions can be arranged so that appropriate people
54335 can edit the different alias files. A successful aliasing operation results in
54336 a new envelope recipient address, which is then routed from scratch.
54339 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
54340 way. One approach is to create a file for each domain containing a list of
54341 valid local parts, and use it in a router like this:
54343 <literallayout class="monospaced">
54346 domains = dsearch;/etc/mail/domains
54347 local_parts = lsearch;/etc/mail/domains/$domain
54348 transport = my_mailboxes
54351 The address is accepted if there is a file for the domain, and the local part
54352 can be found in the file. The <option>domains</option> option is used to check for the
54353 file’s existence because <option>domains</option> is tested before the <option>local_parts</option>
54354 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
54355 because that option is tested after <option>local_parts</option>. The transport is as
54358 <literallayout class="monospaced">
54360 driver = appendfile
54361 file = /var/mail/$domain/$local_part
54365 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
54366 required, to specify which uid is to be used for writing to the mailboxes.
54369 The configuration shown here is just one example of how you might support this
54370 requirement. There are many other ways this kind of configuration can be set
54371 up, for example, by using a database instead of separate files to hold all the
54372 information about the domains.
54375 <section id="SECTmulbox">
54376 <title>Multiple user mailboxes</title>
54378 <indexterm role="concept">
54379 <primary>multiple mailboxes</primary>
54381 <indexterm role="concept">
54382 <primary>mailbox</primary>
54383 <secondary>multiple</secondary>
54385 <indexterm role="concept">
54386 <primary>local part</primary>
54387 <secondary>prefix</secondary>
54389 <indexterm role="concept">
54390 <primary>local part</primary>
54391 <secondary>suffix</secondary>
54393 Heavy email users often want to operate with multiple mailboxes, into which
54394 incoming mail is automatically sorted. A popular way of handling this is to
54395 allow users to use multiple sender addresses, so that replies can easily be
54396 identified. Users are permitted to add prefixes or suffixes to their local
54397 parts for this purpose. The wildcard facility of the generic router options
54398 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
54399 example, consider this router:
54401 <literallayout class="monospaced">
54405 file = $home/.forward
54406 local_part_suffix = -*
54407 local_part_suffix_optional
54411 <indexterm role="concept">
54412 <primary><varname>$local_part_suffix</varname></primary>
54414 It runs a user’s <filename>.forward</filename> file for all local parts of the form
54415 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
54416 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
54418 <literallayout class="monospaced">
54419 if $local_part_suffix contains -special then
54420 save /home/$local_part/Mail/special
54424 If the filter file does not exist, or does not deal with such addresses, they
54425 fall through to subsequent routers, and, assuming no subsequent use of the
54426 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
54427 control over which suffixes are valid.
54430 Alternatively, a suffix can be used to trigger the use of a different
54431 <filename>.forward</filename> file – which is the way a similar facility is implemented in
54434 <literallayout class="monospaced">
54438 file = $home/.forward$local_part_suffix
54439 local_part_suffix = -*
54440 local_part_suffix_optional
54444 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
54445 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
54446 does not exist, or does not deal with the address, it is passed on to
54447 subsequent routers, which could, if required, look for an unqualified
54448 <filename>.forward</filename> file to use as a default.
54452 <title>Simplified vacation processing</title>
54454 <indexterm role="concept">
54455 <primary>vacation processing</primary>
54457 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
54458 a pipe command in a <filename>.forward</filename> file
54459 (see section <xref linkend="SECTspecitredli"/> for syntax details).
54460 This is prone to error by inexperienced users. There are two features of Exim
54461 that can be used to make this process simpler for users:
54466 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
54467 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
54468 alternatively can use Exim’s <command>autoreply</command> transport. The contents of a user’s
54469 <filename>.forward</filename> file are then much simpler. For example:
54471 <literallayout class="monospaced">
54472 spqr, vacation-spqr
54477 The <option>require_files</option> generic router option can be used to trigger a
54478 vacation delivery by checking for the existence of a certain file in the
54479 user’s home directory. The <option>unseen</option> generic option should also be used, to
54480 ensure that the original delivery also proceeds. In this case, all the user has
54481 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
54487 Another advantage of both these methods is that they both work even when the
54488 use of arbitrary pipes by users is locked out.
54492 <title>Taking copies of mail</title>
54494 <indexterm role="concept">
54495 <primary>message</primary>
54496 <secondary>copying every</secondary>
54498 Some installations have policies that require archive copies of all messages to
54499 be made. A single copy of each message can easily be taken by an appropriate
54500 command in a system filter, which could, for example, use a different file for
54501 each day’s messages.
54504 There is also a shadow transport mechanism that can be used to take copies of
54505 messages that are successfully delivered by local transports, one copy per
54506 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
54507 notification of delivery by sites that insist on doing such things.
54511 <title>Intermittently connected hosts</title>
54513 <indexterm role="concept">
54514 <primary>intermittently connected hosts</primary>
54516 It has become quite common (because it is cheaper) for hosts to connect to the
54517 Internet periodically rather than remain connected all the time. The normal
54518 arrangement is that mail for such hosts accumulates on a system that is
54519 permanently connected.
54522 Exim was designed for use on permanently connected hosts, and so it is not
54523 particularly well-suited to use in an intermittently connected environment.
54524 Nevertheless there are some features that can be used.
54528 <title>Exim on the upstream server host</title>
54530 It is tempting to arrange for incoming mail for the intermittently connected
54531 host to remain on Exim’s queue until the client connects. However, this
54532 approach does not scale very well. Two different kinds of waiting message are
54533 being mixed up in the same queue – those that cannot be delivered because of
54534 some temporary problem, and those that are waiting for their destination host
54535 to connect. This makes it hard to manage the queue, as well as wasting
54536 resources, because each queue runner scans the entire queue.
54539 A better approach is to separate off those messages that are waiting for an
54540 intermittently connected host. This can be done by delivering these messages
54541 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
54542 format, from where they are transmitted by other software when their
54543 destination connects. This makes it easy to collect all the mail for one host
54544 in a single directory, and to apply local timeout rules on a per-message basis
54548 On a very small scale, leaving the mail on Exim’s queue can be made to work. If
54549 you are doing this, you should configure Exim with a long retry period for the
54550 intermittent host. For example:
54552 <literallayout class="monospaced">
54553 cheshire.wonderland.fict.example * F,5d,24h
54556 This stops a lot of failed delivery attempts from occurring, but Exim remembers
54557 which messages it has queued up for that host. Once the intermittent host comes
54558 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
54559 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
54560 causes all the queued up messages to be delivered, often down a single SMTP
54561 connection. While the host remains connected, any new messages get delivered
54565 If the connecting hosts do not have fixed IP addresses, that is, if a host is
54566 issued with a different IP address each time it connects, Exim’s retry
54567 mechanisms on the holding host get confused, because the IP address is normally
54568 used as part of the key string for holding retry information. This can be
54569 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
54570 Since this has disadvantages for permanently connected hosts, it is best to
54571 arrange a separate transport for the intermittently connected ones.
54575 <title>Exim on the intermittently connected client host</title>
54577 The value of <option>smtp_accept_queue_per_connection</option> should probably be
54578 increased, or even set to zero (that is, disabled) on the intermittently
54579 connected host, so that all incoming messages down a single connection get
54580 delivered immediately.
54583 <indexterm role="concept">
54584 <primary>SMTP</primary>
54585 <secondary>passed connection</secondary>
54587 <indexterm role="concept">
54588 <primary>SMTP</primary>
54589 <secondary>multiple deliveries</secondary>
54591 <indexterm role="concept">
54592 <primary>multiple SMTP deliveries</primary>
54594 Mail waiting to be sent from an intermittently connected host will probably
54595 not have been routed, because without a connection DNS lookups are not
54596 possible. This means that if a normal queue run is done at connection time,
54597 each message is likely to be sent in a separate SMTP session. This can be
54598 avoided by starting the queue run with a command line option beginning with
54599 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
54600 first pass, routing is done but no deliveries take place. The second pass is a
54601 normal queue run; since all the messages have been previously routed, those
54602 destined for the same host are likely to get sent as multiple deliveries in a
54603 single SMTP connection.
54608 <chapter id="CHAPnonqueueing">
54609 <title>Using Exim as a non-queueing client</title>
54610 <titleabbrev>Exim as a non-queueing client</titleabbrev>
54612 <indexterm role="concept">
54613 <primary>client</primary>
54614 <secondary>non-queueing</secondary>
54616 <indexterm role="concept">
54617 <primary>smart host</primary>
54618 <secondary>queueing; suppressing</secondary>
54620 On a personal computer, it is a common requirement for all
54621 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
54622 configured to operate that way, for all the popular operating systems.
54623 However, there are some MUAs for Unix-like systems that cannot be so
54624 configured: they submit messages using the command line interface of
54625 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
54629 If the personal computer runs continuously, there is no problem, because it can
54630 run a conventional MTA that handles delivery to the smart host, and deal with
54631 any delays via its queueing mechanism. However, if the computer does not run
54632 continuously or runs different operating systems at different times, queueing
54633 email is not desirable.
54636 There is therefore a requirement for something that can provide the
54637 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
54638 any queueing or retrying facilities. Furthermore, the delivery to the smart
54639 host should be synchronous, so that if it fails, the sending MUA is immediately
54640 informed. In other words, we want something that extends an MUA that submits
54641 to a local MTA via the command line so that it behaves like one that submits
54642 to a remote smart host using TCP/SMTP.
54645 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
54646 that do this job. However, people have found them to be lacking in various
54647 ways. For instance, you might want to allow aliasing and forwarding to be done
54648 before sending a message to the smart host.
54651 Exim already had the necessary infrastructure for doing this job. Just a few
54652 tweaks were needed to make it behave as required, though it is somewhat of an
54653 overkill to use a fully-featured MTA for this purpose.
54656 <indexterm role="concept">
54657 <primary><option>mua_wrapper</option></primary>
54659 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
54660 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
54661 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
54662 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
54663 compatible router and transport configuration. Typically there will be just one
54664 router and one transport, sending everything to a smart host.
54667 When run in MUA wrapping mode, the behaviour of Exim changes in the
54673 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
54674 In other words, the only way to submit messages is via the command line.
54679 Each message is synchonously delivered as soon as it is received (<option>-odi</option> is
54680 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
54681 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
54682 does not finish until the delivery attempt is complete. If the delivery is
54683 successful, a zero return code is given.
54688 Address redirection is permitted, but the final routing for all addresses must
54689 be to the same remote transport, and to the same list of hosts. Furthermore,
54690 the return address (envelope sender) must be the same for all recipients, as
54691 must any added or deleted header lines. In other words, it must be possible to
54692 deliver the message in a single SMTP transaction, however many recipients there
54698 If these conditions are not met, or if routing any address results in a
54699 failure or defer status, or if Exim is unable to deliver all the recipients
54700 successfully to one of the smart hosts, delivery of the entire message fails.
54705 Because no queueing is allowed, all failures are treated as permanent; there
54706 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
54707 smart host. Furthermore, because only a single yes/no response can be given to
54708 the caller, it is not possible to deliver to some recipients and not others. If
54709 there is an error (temporary or permanent) for any recipient, all are failed.
54714 If more than one smart host is listed, Exim will try another host after a
54715 connection failure or a timeout, in the normal way. However, if this kind of
54716 failure happens for all the hosts, the delivery fails.
54721 When delivery fails, an error message is written to the standard error stream
54722 (as well as to Exim’s log), and Exim exits to the caller with a return code
54723 value 1. The message is expunged from Exim’s spool files. No bounce messages
54724 are ever generated.
54729 No retry data is maintained, and any retry rules are ignored.
54734 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
54735 true, <option>max_rcpt</option> in the smtp transport is forced to <quote>unlimited</quote>,
54736 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
54741 The overall effect is that Exim makes a single synchronous attempt to deliver
54742 the message, failing if there is any kind of problem. Because no local
54743 deliveries are done and no daemon can be run, Exim does not need root
54744 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
54745 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
54746 the advantages and disadvantages of running without root privilege.
54750 <chapter id="CHAPlog">
54751 <title>Log files</title>
54753 <indexterm role="concept" id="IIDloggen" class="startofrange">
54754 <primary>log</primary>
54755 <secondary>general description</secondary>
54757 <indexterm role="concept">
54758 <primary>log</primary>
54759 <secondary>types of</secondary>
54761 Exim writes three different logs, referred to as the main log, the reject log,
54767 <indexterm role="concept">
54768 <primary>main log</primary>
54770 The main log records the arrival of each message and each delivery in a single
54771 line in each case. The format is as compact as possible, in an attempt to keep
54772 down the size of log files. Two-character flag sequences make it easy to pick
54773 out these lines. A number of other events are recorded in the main log. Some of
54774 them are optional, in which case the <option>log_selector</option> option controls whether
54775 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
54776 analysis of main log files, is provided in the Exim distribution (see section
54777 <xref linkend="SECTmailstat"/>).
54782 <indexterm role="concept">
54783 <primary>reject log</primary>
54785 The reject log records information from messages that are rejected as a result
54786 of a configuration option (that is, for policy reasons).
54787 The first line of each rejection is a copy of the line that is also written to
54788 the main log. Then, if the message’s header has been read at the time the log
54789 is written, its contents are written to this log. Only the original header
54790 lines are available; header lines added by ACLs are not logged. You can use the
54791 reject log to check that your policy controls are working correctly; on a busy
54792 host this may be easier than scanning the main log for rejection messages. You
54793 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
54799 <indexterm role="concept">
54800 <primary>panic log</primary>
54802 <indexterm role="concept">
54803 <primary>system log</primary>
54805 When certain serious errors occur, Exim writes entries to its panic log. If the
54806 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
54807 are usually written to the main log as well, but can get lost amid the mass of
54808 other entries. The panic log should be empty under normal circumstances. It is
54809 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
54810 regularly, in order to become aware of any problems. When Exim cannot open its
54811 panic log, it tries as a last resort to write to the system log (syslog). This
54812 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
54813 message itself is written at priority LOG_CRIT.
54818 Every log line starts with a timestamp, in the format shown in the following
54819 example. Note that many of the examples shown in this chapter are line-wrapped.
54820 In the log file, this would be all on one line:
54822 <literallayout class="monospaced">
54823 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
54827 By default, the timestamps are in the local timezone. There are two
54828 ways of changing this:
54833 You can set the <option>timezone</option> option to a different time zone; in particular, if
54836 <literallayout class="monospaced">
54840 the timestamps will be in UTC (aka GMT).
54845 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
54848 <literallayout class="monospaced">
54849 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
54853 <section id="SECTwhelogwri">
54854 <title>Where the logs are written</title>
54856 <indexterm role="concept">
54857 <primary>log</primary>
54858 <secondary>destination</secondary>
54860 <indexterm role="concept">
54861 <primary>log</primary>
54862 <secondary>to file</secondary>
54864 <indexterm role="concept">
54865 <primary>log</primary>
54866 <secondary>to syslog</secondary>
54868 <indexterm role="concept">
54869 <primary>syslog</primary>
54871 The logs may be written to local files, or to syslog, or both. However, it
54872 should be noted that many syslog implementations use UDP as a transport, and
54873 are therefore unreliable in the sense that messages are not guaranteed to
54874 arrive at the loghost, nor is the ordering of messages necessarily maintained.
54875 It has also been reported that on large log files (tens of megabytes) you may
54876 need to tweak syslog to prevent it syncing the file with each write – on
54877 Linux this has been seen to make syslog take 90% plus of CPU time.
54880 The destination for Exim’s logs is configured by setting LOG_FILE_PATH in
54881 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
54882 configuration. This latter string is expanded, so it can contain, for example,
54883 references to the host name:
54885 <literallayout class="monospaced">
54886 log_file_path = /var/log/$primary_hostname/exim_%slog
54889 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
54890 rather than at run time, because then the setting is available right from the
54891 start of Exim’s execution. Otherwise, if there’s something it wants to log
54892 before it has read the configuration file (for example, an error in the
54893 configuration file) it will not use the path you want, and may not be able to
54897 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
54898 list, currently limited to at most two items. This is one option where the
54899 facility for changing a list separator may not be used. The list must always be
54900 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
54901 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
54902 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
54903 implying the use of a default path.
54906 When Exim encounters an empty item in the list, it searches the list defined by
54907 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
54908 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
54909 mean <quote>use the path specified at build time</quote>. It no such item exists, log
54910 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
54911 equivalent to the setting:
54913 <literallayout class="monospaced">
54914 log_file_path = $spool_directory/log/%slog
54917 If you do not specify anything at build time or run time, that is where the
54921 A log file path may also contain <literal>%D</literal> if datestamped log file names are in
54922 use – see section <xref linkend="SECTdatlogfil"/> below.
54925 Here are some examples of possible settings:
54928 <literal>LOG_FILE_PATH=syslog </literal> syslog only
54929 <literal>LOG_FILE_PATH=:syslog </literal> syslog and default path
54930 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
54931 <literal>LOG_FILE_PATH=/usr/log/exim_%s </literal> specified path only
54934 If there are more than two paths in the list, the first is used and a panic
54939 <title>Logging to local files that are periodically <quote>cycled</quote></title>
54941 <indexterm role="concept">
54942 <primary>log</primary>
54943 <secondary>cycling local files</secondary>
54945 <indexterm role="concept">
54946 <primary>cycling logs</primary>
54948 <indexterm role="concept">
54949 <primary><emphasis>exicyclog</emphasis></primary>
54951 <indexterm role="concept">
54952 <primary>log</primary>
54953 <secondary>local files; writing to</secondary>
54955 Some operating systems provide centralized and standardised methods for cycling
54956 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
54957 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
54958 main and reject logs each time it is called. The maximum number of old logs to
54959 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
54962 An Exim delivery process opens the main log when it first needs to write to it,
54963 and it keeps the file open in case subsequent entries are required – for
54964 example, if a number of different deliveries are being done for the same
54965 message. However, remote SMTP deliveries can take a long time, and this means
54966 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
54967 something similar is being used to rename log files on a regular basis. To
54968 ensure that a switch of log files is noticed as soon as possible, Exim calls
54969 <function>stat()</function> on the main log’s name before reusing an open file, and if the file
54970 does not exist, or its inode has changed, the old file is closed and Exim
54971 tries to open the main log from scratch. Thus, an old log file may remain open
54972 for quite some time, but no Exim processes should write to it once it has been
54976 <section id="SECTdatlogfil">
54977 <title>Datestamped log files</title>
54979 <indexterm role="concept">
54980 <primary>log</primary>
54981 <secondary>datestamped files</secondary>
54983 Instead of cycling the main and reject log files by renaming them
54984 periodically, some sites like to use files whose names contain a datestamp,
54985 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename>.
54986 Exim has support for this way of working. It is enabled by setting the
54987 <option>log_file_path</option> option to a path that includes <literal>%D</literal> at the point where the
54988 datestamp is required. For example:
54990 <literallayout class="monospaced">
54991 log_file_path = /var/spool/exim/log/%slog-%D
54992 log_file_path = /var/log/exim-%s-%D.log
54993 log_file_path = /var/spool/exim/log/%D-%slog
54996 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
54997 examples of names generated by the above examples:
54999 <literallayout class="monospaced">
55000 /var/spool/exim/log/mainlog-20021225
55001 /var/log/exim-reject-20021225.log
55002 /var/spool/exim/log/20021225-mainlog
55005 When this form of log file is specified, Exim automatically switches to new
55006 files at midnight. It does not make any attempt to compress old logs; you
55007 will need to write your own script if you require this. You should not
55008 run <emphasis>exicyclog</emphasis> with this form of logging.
55011 The location of the panic log is also determined by <option>log_file_path</option>, but it
55012 is not datestamped, because rotation of the panic log does not make sense.
55013 When generating the name of the panic log, <literal>%D</literal> is removed from the string.
55014 In addition, if it immediately follows a slash, a following non-alphanumeric
55015 character is removed; otherwise a preceding non-alphanumeric character is
55016 removed. Thus, the three examples above would give these panic log names:
55018 <literallayout class="monospaced">
55019 /var/spool/exim/log/paniclog
55020 /var/log/exim-panic.log
55021 /var/spool/exim/log/paniclog
55025 <title>Logging to syslog</title>
55027 <indexterm role="concept">
55028 <primary>log</primary>
55029 <secondary>syslog; writing to</secondary>
55031 The use of syslog does not change what Exim logs or the format of its messages,
55032 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
55033 Exim’s log lines are omitted when these lines are sent to syslog. Apart from
55034 that, the same strings are written to syslog as to log files. The syslog
55035 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
55036 by default, but you can change these by setting the <option>syslog_facility</option> and
55037 <option>syslog_processname</option> options, respectively. If Exim was compiled with
55038 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
55039 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
55040 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
55041 the time and host name to each line.
55042 The three log streams are mapped onto syslog priorities as follows:
55047 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
55052 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
55057 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
55062 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
55063 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
55064 these are routed by syslog to the same place. You can suppress this duplication
55065 by setting <option>syslog_duplication</option> false.
55068 Exim’s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
55069 entries contain multiple lines when headers are included. To cope with both
55070 these cases, entries written to syslog are split into separate <function>syslog()</function>
55071 calls at each internal newline, and also after a maximum of
55072 870 data characters. (This allows for a total syslog line length of 1024, when
55073 additions such as timestamps are added.) If you are running a syslog
55074 replacement that can handle lines longer than the 1024 characters allowed by
55075 RFC 3164, you should set
55077 <literallayout class="monospaced">
55078 SYSLOG_LONG_LINES=yes
55081 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
55082 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
55085 To make it easy to re-assemble split lines later, each component of a split
55086 entry starts with a string of the form [<<emphasis>n</emphasis>>/<<emphasis>m</emphasis>>] or [<<emphasis>n</emphasis>>\<<emphasis>m</emphasis>>]
55087 where <<emphasis>n</emphasis>> is the component number and <<emphasis>m</emphasis>> is the total number of
55088 components in the entry. The / delimiter is used when the line was split
55089 because it was too long; if it was split because of an internal newline, the \
55090 delimiter is used. For example, supposing the length limit to be 50 instead of
55091 870, the following would be the result of a typical rejection message to
55092 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
55093 name, and pid as added by syslog:
55095 <literallayout class="monospaced">
55096 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
55097 [2/5] [127.0.0.1] (ph10): syntax error in 'From' header
55098 [3/5] when scanning for sender: missing or malformed lo
55099 [4/5] cal part in "<>" (envelope sender is <ph10@cam.exa
55103 The same error might cause the following lines to be written to <quote>rejectlog</quote>
55106 <literallayout class="monospaced">
55107 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
55108 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
55109 [3/18] er when scanning for sender: missing or malformed
55110 [4/18] local part in "<>" (envelope sender is <ph10@cam
55111 [5\18] .example>)
55112 [6\18] Recipients: ph10@some.domain.cam.example
55113 [7\18] P Received: from [127.0.0.1] (ident=ph10)
55114 [8\18] by xxxxx.cam.example with smtp (Exim 4.00)
55115 [9\18] id 16RdAL-0006pc-00
55116 [10/18] for ph10@cam.example; Mon, 16 Sep 2002 16:
55117 [11\18] 09:43 +0100
55118 [12\18] F From: <>
55119 [13\18] Subject: this is a test header
55120 [18\18] X-something: this is another header
55121 [15/18] I Message-Id: <E16RdAL-0006pc-00@xxxxx.cam.examp
55124 [18/18] Date: Mon, 16 Sep 2002 16:09:43 +0100
55127 Log lines that are neither too long nor contain newlines are written to syslog
55128 without modification.
55131 If only syslog is being used, the Exim monitor is unable to provide a log tail
55132 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
55133 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
55138 <title>Log line flags</title>
55140 One line is written to the main log for each message received, and for each
55141 successful, unsuccessful, and delayed delivery. These lines can readily be
55142 picked out by the distinctive two-character flags that immediately follow the
55143 timestamp. The flags are:
55146 <literal><=</literal> message arrival
55147 <literal>=></literal> normal message delivery
55148 <literal>-></literal> additional address in same delivery
55149 <literal>*></literal> delivery suppressed by <option>-N</option>
55150 <literal>**</literal> delivery failed; address bounced
55151 <literal>==</literal> delivery deferred; temporary problem
55155 <title>Logging message reception</title>
55157 <indexterm role="concept">
55158 <primary>log</primary>
55159 <secondary>reception line</secondary>
55161 The format of the single-line entry in the main log that is written for every
55162 message received is shown in the basic example below, which is split over
55163 several lines in order to fit it on the page:
55165 <literallayout class="monospaced">
55166 2002-10-31 08:57:53 16ZCW1-0005MB-00 <= kryten@dwarf.fict.example
55167 H=mailer.fict.example [192.168.123.123] U=exim
55168 P=smtp S=5678 id=<incoming message id>
55171 The address immediately following <quote><=</quote> is the envelope sender address. A
55172 bounce message is shown with the sender address <quote><></quote>, and if it is locally
55173 generated, this is followed by an item of the form
55175 <literallayout class="monospaced">
55176 R=<message id>
55179 which is a reference to the message that caused the bounce to be sent.
55182 <indexterm role="concept">
55183 <primary>HELO</primary>
55185 <indexterm role="concept">
55186 <primary>EHLO</primary>
55188 For messages from other hosts, the H and U fields identify the remote host and
55189 record the RFC 1413 identity of the user that sent the message, if one was
55190 received. The number given in square brackets is the IP address of the sending
55191 host. If there is a single, unparenthesized host name in the H field, as
55192 above, it has been verified to correspond to the IP address (see the
55193 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
55194 by the remote host in the SMTP HELO or EHLO command, and has not been
55195 verified. If verification yields a different name to that given for HELO or
55196 EHLO, the verified name appears first, followed by the HELO or EHLO
55197 name in parentheses.
55200 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
55201 without brackets, in the HELO or EHLO command, leading to entries in
55202 the log containing text like these examples:
55204 <literallayout class="monospaced">
55205 H=(10.21.32.43) [192.168.8.34]
55206 H=([10.21.32.43]) [192.168.8.34]
55209 This can be confusing. Only the final address in square brackets can be relied
55213 For locally generated messages (that is, messages not received over TCP/IP),
55214 the H field is omitted, and the U field contains the login name of the caller
55218 <indexterm role="concept">
55219 <primary>authentication</primary>
55220 <secondary>logging</secondary>
55222 <indexterm role="concept">
55223 <primary>AUTH</primary>
55224 <secondary>logging</secondary>
55226 For all messages, the P field specifies the protocol used to receive the
55227 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
55228 of incoming SMTP messages, the value indicates whether or not any SMTP
55229 extensions (ESMTP), encryption, or authentication were used. If the SMTP
55230 session was encrypted, there is an additional X field that records the cipher
55231 suite that was used.
55234 The protocol is set to <quote>esmptsa</quote> or <quote>esmtpa</quote> for messages received from
55235 hosts that have authenticated themselves using the SMTP AUTH command. The first
55236 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
55237 there is an additional item A= followed by the name of the authenticator that
55238 was used. If an authenticated identification was set up by the authenticator’s
55239 <option>server_set_id</option> option, this is logged too, separated by a colon from the
55240 authenticator name.
55243 <indexterm role="concept">
55244 <primary>size</primary>
55245 <secondary>of message</secondary>
55247 The id field records the existing message id, if present. The size of the
55248 received message is given by the S field. When the message is delivered,
55249 headers may be removed or added, so that the size of delivered copies of the
55250 message may not correspond with this value (and indeed may be different to each
55254 The <option>log_selector</option> option can be used to request the logging of additional
55255 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
55259 <title>Logging deliveries</title>
55261 <indexterm role="concept">
55262 <primary>log</primary>
55263 <secondary>delivery line</secondary>
55265 The format of the single-line entry in the main log that is written for every
55266 delivery is shown in one of the examples below, for local and remote
55267 deliveries, respectively. Each example has been split into two lines in order
55268 to fit it on the page:
55270 <literallayout class="monospaced">
55271 2002-10-31 08:59:13 16ZCW1-0005MB-00 => marv
55272 <marv@hitch.fict.example> R=localuser T=local_delivery
55273 2002-10-31 09:00:10 16ZCW1-0005MB-00 =>
55274 monk@holistic.fict.example R=dnslookup T=remote_smtp
55275 H=holistic.fict.example [192.168.234.234]
55278 For ordinary local deliveries, the original address is given in angle brackets
55279 after the final delivery address, which might be a pipe or a file. If
55280 intermediate address(es) exist between the original and the final address, the
55281 last of these is given in parentheses after the final address. The R and T
55282 fields record the router and transport that were used to process the address.
55285 If a shadow transport was run after a successful local delivery, the log line
55286 for the successful delivery has an item added on the end, of the form
55289 <literal>ST=<</literal><emphasis>shadow transport name</emphasis><literal>></literal>
55292 If the shadow transport did not succeed, the error message is put in
55293 parentheses afterwards.
55296 <indexterm role="concept">
55297 <primary>asterisk</primary>
55298 <secondary>after IP address</secondary>
55300 When more than one address is included in a single delivery (for example, two
55301 SMTP RCPT commands in one transaction) the second and subsequent addresses are
55302 flagged with <literal>-></literal> instead of <literal>=></literal>. When two or more messages are delivered
55303 down a single SMTP connection, an asterisk follows the IP address in the log
55304 lines for the second and subsequent messages.
55307 The generation of a reply message by a filter file gets logged as a
55308 <quote>delivery</quote> to the addressee, preceded by <quote>></quote>.
55311 The <option>log_selector</option> option can be used to request the logging of additional
55312 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
55316 <title>Discarded deliveries</title>
55318 <indexterm role="concept">
55319 <primary>discarded messages</primary>
55321 <indexterm role="concept">
55322 <primary>message</primary>
55323 <secondary>discarded</secondary>
55325 <indexterm role="concept">
55326 <primary>delivery</primary>
55327 <secondary>discarded; logging</secondary>
55329 When a message is discarded as a result of the command <quote>seen finish</quote> being
55330 obeyed in a filter file which generates no deliveries, a log entry of the form
55332 <literallayout class="monospaced">
55333 2002-12-10 00:50:49 16auJc-0001UB-00 => discarded
55334 <low.club@bridge.example> R=userforward
55337 is written, to record why no deliveries are logged. When a message is discarded
55338 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
55340 <literallayout class="monospaced">
55341 1999-03-02 09:44:33 10HmaX-0005vi-00 => :blackhole:
55342 <hole@nowhere.example> R=blackhole_router
55346 <title>Deferred deliveries</title>
55348 When a delivery is deferred, a line of the following form is logged:
55350 <literallayout class="monospaced">
55351 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
55352 R=dnslookup T=smtp defer (146): Connection refused
55355 In the case of remote deliveries, the error is the one that was given for the
55356 last IP address that was tried. Details of individual SMTP failures are also
55357 written to the log, so the above line would be preceded by something like
55359 <literallayout class="monospaced">
55360 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
55361 mail1.endrest.example [192.168.239.239]: Connection refused
55364 When a deferred address is skipped because its retry time has not been reached,
55365 a message is written to the log, but this can be suppressed by setting an
55366 appropriate value in <option>log_selector</option>.
55370 <title>Delivery failures</title>
55372 <indexterm role="concept">
55373 <primary>delivery</primary>
55374 <secondary>failure; logging</secondary>
55376 If a delivery fails because an address cannot be routed, a line of the
55377 following form is logged:
55379 <literallayout class="monospaced">
55380 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
55381 <jim@trek99.example>: unknown mail domain
55384 If a delivery fails at transport time, the router and transport are shown, and
55385 the response from the remote host is included, as in this example:
55387 <literallayout class="monospaced">
55388 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
55389 R=dnslookup T=remote_smtp: SMTP error from remote mailer
55390 after pipelined RCPT TO:<ace400@pb.example>: host
55391 pbmail3.py.example [192.168.63.111]: 553 5.3.0
55392 <ace400@pb.example>...Addressee unknown
55395 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
55396 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
55397 disabling PIPELINING. The log lines for all forms of delivery failure are
55398 flagged with <literal>**</literal>.
55402 <title>Fake deliveries</title>
55404 <indexterm role="concept">
55405 <primary>delivery</primary>
55406 <secondary>fake; logging</secondary>
55408 If a delivery does not actually take place because the <option>-N</option> option has been
55409 used to suppress it, a normal delivery line is written to the log, except that
55410 <quote>=></quote> is replaced by <quote>*></quote>.
55414 <title>Completion</title>
55418 <literallayout class="monospaced">
55419 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
55422 is written to the main log when a message is about to be removed from the spool
55423 at the end of its processing.
55427 <title>Summary of Fields in Log Lines</title>
55429 <indexterm role="concept">
55430 <primary>log</primary>
55431 <secondary>summary of fields</secondary>
55433 A summary of the field identifiers that are used in log lines is shown in
55434 the following table:
55437 <literal>A </literal> authenticator name (and optional id)
55438 <literal>C </literal> SMTP confirmation on delivery
55439 <literal>CV </literal> certificate verification status
55440 <literal>DN </literal> distinguished name from peer certificate
55441 <literal>DT </literal> on <literal>=></literal> lines: time taken for a delivery
55442 <literal>F </literal> sender address (on delivery lines)
55443 <literal>H </literal> host name and IP address
55444 <literal>I </literal> local interface used
55445 <literal>id </literal> message id for incoming message
55446 <literal>P </literal> on <literal><=</literal> lines: protocol used
55447 <literal> </literal> on <literal>=></literal> and <literal>**</literal> lines: return path
55448 <literal>QT </literal> on <literal>=></literal> lines: time spent on queue so far
55449 <literal> </literal> on <quote>Completed</quote> lines: time spent on queue
55450 <literal>R </literal> on <literal><=</literal> lines: reference for local bounce
55451 <literal> </literal> on <literal>=></literal> <literal>**</literal> and <literal>==</literal> lines: router name
55452 <literal>S </literal> size of message
55453 <literal>ST </literal> shadow transport name
55454 <literal>T </literal> on <literal><=</literal> lines: message subject (topic)
55455 <literal> </literal> on <literal>=></literal> <literal>**</literal> and <literal>==</literal> lines: transport name
55456 <literal>U </literal> local user or RFC 1413 identity
55457 <literal>X </literal> TLS cipher suite
55461 <title>Other log entries</title>
55463 Various other types of log entry are written from time to time. Most should be
55464 self-explanatory. Among the more common are:
55469 <indexterm role="concept">
55470 <primary>retry</primary>
55471 <secondary>time not reached</secondary>
55473 <emphasis>retry time not reached</emphasis> An address previously suffered a temporary error
55474 during routing or local delivery, and the time to retry has not yet arrived.
55475 This message is not written to an individual message log file unless it happens
55476 during the first delivery attempt.
55481 <emphasis>retry time not reached for any host</emphasis> An address previously suffered
55482 temporary errors during remote delivery, and the retry time has not yet arrived
55483 for any of the hosts to which it is routed.
55488 <indexterm role="concept">
55489 <primary>spool directory</primary>
55490 <secondary>file locked</secondary>
55492 <emphasis>spool file locked</emphasis> An attempt to deliver a message cannot proceed because
55493 some other Exim process is already working on the message. This can be quite
55494 common if queue running processes are started at frequent intervals. The
55495 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
55501 <indexterm role="concept">
55502 <primary>error</primary>
55503 <secondary>ignored</secondary>
55505 <emphasis>error ignored</emphasis> There are several circumstances that give rise to this
55508 <orderedlist numeration="arabic">
55511 Exim failed to deliver a bounce message whose age was greater than
55512 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
55517 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
55518 failed. The delivery was discarded.
55523 A delivery set up by a router configured with
55525 <literallayout class="monospaced">
55526 errors_to = <>
55529 failed. The delivery was discarded.
55536 <section id="SECTlogselector">
55537 <title>Reducing or increasing what is logged</title>
55539 <indexterm role="concept">
55540 <primary>log</primary>
55541 <secondary>selectors</secondary>
55543 By setting the <option>log_selector</option> global option, you can disable some of Exim’s
55544 default logging, or you can request additional logging. The value of
55545 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
55548 <literallayout class="monospaced">
55549 log_selector = +arguments -retry_defer
55552 The list of optional log items is in the following table, with the default
55553 selection marked by asterisks:
55556 <literal>*acl_warn_skipped </literal> skipped <option>warn</option> statement in ACL
55557 <literal> address_rewrite </literal> address rewriting
55558 <literal> all_parents </literal> all parents in => lines
55559 <literal> arguments </literal> command line arguments
55560 <literal>*connection_reject </literal> connection rejections
55561 <literal>*delay_delivery </literal> immediate delivery delayed
55562 <literal> deliver_time </literal> time taken to perform delivery
55563 <literal> delivery_size </literal> add <literal>S=</literal><emphasis>nnn</emphasis> to => lines
55564 <literal>*dnslist_defer </literal> defers of DNS list (aka RBL) lookups
55565 <literal>*etrn </literal> ETRN commands
55566 <literal>*host_lookup_failed </literal> as it says
55567 <literal> ident_timeout </literal> timeout for ident connection
55568 <literal> incoming_interface </literal> incoming interface on <= lines
55569 <literal> incoming_port </literal> incoming port on <= lines
55570 <literal>*lost_incoming_connection </literal> as it says (includes timeouts)
55571 <literal> outgoing_port </literal> add remote port to => lines
55572 <literal>*queue_run </literal> start and end queue runs
55573 <literal> queue_time </literal> time on queue for one recipient
55574 <literal> queue_time_overall </literal> time on queue for whole message
55575 <literal> received_recipients </literal> recipients on <= lines
55576 <literal> received_sender </literal> sender on <= lines
55577 <literal>*rejected_header </literal> header contents on reject log
55578 <literal>*retry_defer </literal> <quote>retry time not reached</quote>
55579 <literal> return_path_on_delivery </literal> put return path on => and *\ lines
55580 <literal> sender_on_delivery </literal> add sender to => lines
55581 <literal>*sender_verify_fail </literal> sender verification failures
55582 <literal>*size_reject </literal> rejection because too big
55583 <literal>*skip_delivery </literal> delivery skipped in a queue run
55584 <literal> smtp_confirmation </literal> SMTP confirmation on => lines
55585 <literal> smtp_connection </literal> SMTP connections
55586 <literal> smtp_incomplete_transaction</literal> incomplete SMTP transactions
55587 <literal> smtp_protocol_error </literal> SMTP protocol errors
55588 <literal> smtp_syntax_error </literal> SMTP syntax errors
55589 <literal> subject </literal> contents of <emphasis>Subject:</emphasis> on <= lines
55590 <literal> tls_certificate_verified </literal> certificate verification status
55591 <literal>*tls_cipher </literal> TLS cipher suite on <= and => lines
55592 <literal> tls_peerdn </literal> TLS peer DN on <= and => lines
55593 <literal> unknown_in_list </literal> DNS lookup failed in list match
55595 <literal> all </literal> all of the above
55598 More details on each of these items follows:
55603 <indexterm role="concept">
55604 <primary><option>warn</option> statement</primary>
55605 <secondary>log when skipping</secondary>
55607 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
55608 its conditions cannot be evaluated, a log line to this effect is written if
55609 this log selector is set.
55614 <indexterm role="concept">
55615 <primary>log</primary>
55616 <secondary>rewriting</secondary>
55618 <indexterm role="concept">
55619 <primary>rewriting</primary>
55620 <secondary>logging</secondary>
55622 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
55623 rewrites, but not to rewrites in filters run as an unprivileged user (because
55624 such users cannot access the log).
55629 <indexterm role="concept">
55630 <primary>log</primary>
55631 <secondary>full parentage</secondary>
55633 <option>all_parents</option>: Normally only the original and final addresses are logged on
55634 delivery lines; with this selector, intermediate parents are given in
55635 parentheses between them.
55640 <indexterm role="concept">
55641 <primary>log</primary>
55642 <secondary>Exim arguments</secondary>
55644 <indexterm role="concept">
55645 <primary>Exim arguments</primary>
55646 <secondary>logging</secondary>
55648 <option>arguments</option>: This causes Exim to write the arguments with which it was called
55649 to the main log, preceded by the current working directory. This is a debugging
55650 feature, added to make it easier to find out how certain MUAs call
55651 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
55652 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
55653 that are empty or that contain white space are quoted. Non-printing characters
55654 are shown as escape sequences. This facility cannot log unrecognized arguments,
55655 because the arguments are checked before the configuration file is read. The
55656 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
55657 between the caller and Exim.
55662 <indexterm role="concept">
55663 <primary>log</primary>
55664 <secondary>connection rejections</secondary>
55666 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
55667 connection is rejected, for whatever reason.
55672 <indexterm role="concept">
55673 <primary>log</primary>
55674 <secondary>delayed delivery</secondary>
55676 <indexterm role="concept">
55677 <primary>delayed delivery</primary>
55678 <secondary>logging</secondary>
55680 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
55681 started for an incoming message because the load is too high or too many
55682 messages were received on one connection. Logging does not occur if no delivery
55683 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
55688 <indexterm role="concept">
55689 <primary>log</primary>
55690 <secondary>delivery duration</secondary>
55692 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
55693 perform the actual delivery is logged as DT=<<emphasis>time</emphasis>>, for example, <literal>DT=1s</literal>.
55698 <indexterm role="concept">
55699 <primary>log</primary>
55700 <secondary>message size on delivery</secondary>
55702 <indexterm role="concept">
55703 <primary>size</primary>
55704 <secondary>of message</secondary>
55706 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
55707 the <quote>=></quote> line, tagged with S=.
55712 <indexterm role="concept">
55713 <primary>log</primary>
55714 <secondary>dnslist defer</secondary>
55716 <indexterm role="concept">
55717 <primary>DNS list</primary>
55718 <secondary>logging defer</secondary>
55720 <indexterm role="concept">
55721 <primary>black list (DNS)</primary>
55723 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
55724 DNS black list suffers a temporary error.
55729 <indexterm role="concept">
55730 <primary>log</primary>
55731 <secondary>ETRN commands</secondary>
55733 <indexterm role="concept">
55734 <primary>ETRN</primary>
55735 <secondary>logging</secondary>
55737 <option>etrn</option>: Every legal ETRN command that is received is logged, before the ACL
55738 is run to determine whether or not it is actually accepted. An invalid ETRN
55739 command, or one received within a message transaction is not logged by this
55740 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
55745 <indexterm role="concept">
55746 <primary>log</primary>
55747 <secondary>host lookup failure</secondary>
55749 <option>host_lookup_failed</option>: When a lookup of a host’s IP addresses fails to find
55750 any addresses, or when a lookup of an IP address fails to find a host name, a
55751 log line is written. This logging does not apply to direct DNS lookups when
55752 routing email addresses, but it does apply to <quote>byname</quote> lookups.
55757 <indexterm role="concept">
55758 <primary>log</primary>
55759 <secondary>ident timeout</secondary>
55761 <indexterm role="concept">
55762 <primary>RFC 1413</primary>
55763 <secondary>logging timeout</secondary>
55765 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
55766 client’s ident port times out.
55771 <indexterm role="concept">
55772 <primary>log</primary>
55773 <secondary>incoming interface</secondary>
55775 <indexterm role="concept">
55776 <primary>interface</primary>
55777 <secondary>logging</secondary>
55779 <option>incoming_interface</option>: The interface on which a message was received is added
55780 to the <quote><=</quote> line as an IP address in square brackets, tagged by I= and
55781 followed by a colon and the port number. The local interface and port are also
55782 added to other SMTP log lines, for example <quote>SMTP connection from</quote>, and to
55788 <indexterm role="concept">
55789 <primary>log</primary>
55790 <secondary>incoming remote port</secondary>
55792 <indexterm role="concept">
55793 <primary>port</primary>
55794 <secondary>logging remote</secondary>
55796 <indexterm role="concept">
55797 <primary>TCP/IP</primary>
55798 <secondary>logging incoming remote port</secondary>
55800 <indexterm role="concept">
55801 <primary><varname>$sender_fullhost</varname></primary>
55803 <indexterm role="concept">
55804 <primary><varname>$sender_rcvhost</varname></primary>
55806 <option>incoming_port</option>: The remote port number from which a message was received is
55807 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
55808 in square brackets, and separated from it by a colon. This is implemented by
55809 changing the value that is put in the <varname>$sender_fullhost</varname> and
55810 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
55811 important with the widening use of NAT (see RFC 2505).
55816 <indexterm role="concept">
55817 <primary>log</primary>
55818 <secondary>dropped connection</secondary>
55820 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
55821 connection is unexpectedly dropped.
55826 <indexterm role="concept">
55827 <primary>log</primary>
55828 <secondary>outgoing remote port</secondary>
55830 <indexterm role="concept">
55831 <primary>port</primary>
55832 <secondary>logging outgoint remote</secondary>
55834 <indexterm role="concept">
55835 <primary>TCP/IP</primary>
55836 <secondary>logging ougtoing remote port</secondary>
55838 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
55839 containing => tags) following the IP address. This option is not included in
55840 the default setting, because for most ordinary configurations, the remote port
55841 number is always 25 (the SMTP port).
55846 <indexterm role="concept">
55847 <primary>log</primary>
55848 <secondary>queue run</secondary>
55850 <indexterm role="concept">
55851 <primary>queue runner</primary>
55852 <secondary>logging</secondary>
55854 <option>queue_run</option>: The start and end of every queue run are logged.
55859 <indexterm role="concept">
55860 <primary>log</primary>
55861 <secondary>queue time</secondary>
55863 <option>queue_time</option>: The amount of time the message has been in the queue on the
55864 local host is logged as QT=<<emphasis>time</emphasis>> on delivery (<literal>=></literal>) lines, for example,
55865 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
55866 includes reception time as well as the delivery time for the current address.
55867 This means that it may be longer than the difference between the arrival and
55868 delivery log line times, because the arrival log line is not written until the
55869 message has been successfully received.
55874 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
55875 the local host is logged as QT=<<emphasis>time</emphasis>> on <quote>Completed</quote> lines, for
55876 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
55877 message, so it includes reception time as well as the total delivery time.
55882 <indexterm role="concept">
55883 <primary>log</primary>
55884 <secondary>recipients</secondary>
55886 <option>received_recipients</option>: The recipients of a message are listed in the main log
55887 as soon as the message is received. The list appears at the end of the log line
55888 that is written when a message is received, preceded by the word <quote>for</quote>. The
55889 addresses are listed after they have been qualified, but before any rewriting
55891 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
55897 <indexterm role="concept">
55898 <primary>log</primary>
55899 <secondary>sender reception</secondary>
55901 <option>received_sender</option>: The unrewritten original sender of a message is added to
55902 the end of the log line that records the message’s arrival, after the word
55903 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
55908 <indexterm role="concept">
55909 <primary>log</primary>
55910 <secondary>header lines for rejection</secondary>
55912 <option>rejected_header</option>: If a message’s header has been received at the time a
55913 rejection is written to the reject log, the complete header is added to the
55914 log. Header logging can be turned off individually for messages that are
55915 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
55920 <indexterm role="concept">
55921 <primary>log</primary>
55922 <secondary>retry defer</secondary>
55924 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
55925 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
55926 message is always omitted from individual message logs after the first delivery
55932 <indexterm role="concept">
55933 <primary>log</primary>
55934 <secondary>return path</secondary>
55936 <option>return_path_on_delivery</option>: The return path that is being transmitted with
55937 the message is included in delivery and bounce lines, using the tag P=.
55938 This is omitted if no delivery actually happens, for example, if routing fails,
55939 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
55944 <indexterm role="concept">
55945 <primary>log</primary>
55946 <secondary>sender on delivery</secondary>
55948 <option>sender_on_delivery</option>: The message’s sender address is added to every delivery
55949 and bounce line, tagged by F= (for <quote>from</quote>).
55950 This is the original sender that was received with the message; it is not
55951 necessarily the same as the outgoing return path.
55955 <para revisionflag="changed">
55956 <indexterm role="concept">
55957 <primary>log</primary>
55958 <secondary>sender verify failure</secondary>
55960 <option>sender_verify_failure</option>: If this selector is unset, the separate log line
55961 that gives details of a sender verification failure is not written. Log lines
55962 for the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so
55963 some detail is lost.
55968 <indexterm role="concept">
55969 <primary>log</primary>
55970 <secondary>size rejection</secondary>
55972 <option>size_reject</option>: A log line is written whenever a message is rejected because
55978 <indexterm role="concept">
55979 <primary>log</primary>
55980 <secondary>frozen messages; skipped</secondary>
55982 <indexterm role="concept">
55983 <primary>frozen messages</primary>
55984 <secondary>logging skipping</secondary>
55986 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
55987 queue run because it is frozen or because another process is already delivering
55989 <indexterm role="concept">
55990 <primary><quote>spool file is locked</quote></primary>
55992 The message that is written is <quote>spool file is locked</quote>.
55997 <indexterm role="concept">
55998 <primary>log</primary>
55999 <secondary>smtp confirmation</secondary>
56001 <indexterm role="concept">
56002 <primary>SMTP</primary>
56003 <secondary>logging confirmation</secondary>
56005 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP dialogue for
56006 outgoing messages is added to delivery log lines in the form <literal>C=</literal><<emphasis>text</emphasis>>.
56007 A number of MTAs (including Exim) return an identifying string in this
56013 <indexterm role="concept">
56014 <primary>log</primary>
56015 <secondary>SMTP connections</secondary>
56017 <indexterm role="concept">
56018 <primary>SMTP</primary>
56019 <secondary>logging connections</secondary>
56021 <option>smtp_connection</option>: A log line is written whenever an SMTP connection is
56022 established or closed, unless the connection is from a host that matches
56023 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
56024 only when the closure is unexpected.) This applies to connections from local
56025 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
56026 dropped in the middle of a message, a log line is always written, whether or
56027 not this selector is set, but otherwise nothing is written at the start and end
56028 of connections unless this selector is enabled.
56031 For TCP/IP connections to an Exim daemon, the current number of connections is
56032 included in the log message for each new connection, but note that the count is
56033 reset if the daemon is restarted.
56034 Also, because connections are closed (and the closure is logged) in
56035 subprocesses, the count may not include connections that have been closed but
56036 whose termination the daemon has not yet noticed. Thus, while it is possible to
56037 match up the opening and closing of connections in the log, the value of the
56038 logged counts may not be entirely accurate.
56043 <indexterm role="concept">
56044 <primary>log</primary>
56045 <secondary>SMTP transaction; incomplete</secondary>
56047 <indexterm role="concept">
56048 <primary>SMTP</primary>
56049 <secondary>logging incomplete transactions</secondary>
56051 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
56052 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
56053 and the message sender plus any accepted recipients are included in the log
56054 line. This can provide evidence of dictionary attacks.
56059 <indexterm role="concept">
56060 <primary>log</primary>
56061 <secondary>SMTP protocol error</secondary>
56063 <indexterm role="concept">
56064 <primary>SMTP</primary>
56065 <secondary>logging protocol error</secondary>
56067 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
56068 encountered. Exim does not have perfect detection of all protocol errors
56069 because of transmission delays and the use of pipelining. If PIPELINING has
56070 been advertised to a client, an Exim server assumes that the client will use
56071 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
56072 received after rejecting MAIL) as protocol errors.
56077 <indexterm role="concept">
56078 <primary>SMTP</primary>
56079 <secondary>logging syntax errors</secondary>
56081 <indexterm role="concept">
56082 <primary>SMTP</primary>
56083 <secondary>syntax errors; logging</secondary>
56085 <indexterm role="concept">
56086 <primary>SMTP</primary>
56087 <secondary>unknown command; logging</secondary>
56089 <indexterm role="concept">
56090 <primary>log</primary>
56091 <secondary>unknown SMTP command</secondary>
56093 <indexterm role="concept">
56094 <primary>log</primary>
56095 <secondary>SMTP syntax error</secondary>
56097 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
56098 encountered. An unrecognized command is treated as a syntax error. For an
56099 external connection, the host identity is given; for an internal connection
56100 using <option>-bs</option> the sender identification (normally the calling user) is given.
56105 <indexterm role="concept">
56106 <primary>log</primary>
56107 <secondary>subject</secondary>
56109 <indexterm role="concept">
56110 <primary>subject</primary>
56111 <secondary>logging</secondary>
56113 <option>subject</option>: The subject of the message is added to the arrival log line,
56114 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
56115 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
56116 specifies whether characters with values greater than 127 should be logged
56117 unchanged, or whether they should be rendered as escape sequences.
56122 <indexterm role="concept">
56123 <primary>log</primary>
56124 <secondary>certificate verification</secondary>
56126 <option>tls_certificate_verified</option>: An extra item is added to <= and => log lines
56127 when TLS is in use. The item is <literal>CV=yes</literal> if the peer’s certificate was
56128 verified, and <literal>CV=no</literal> if not.
56133 <indexterm role="concept">
56134 <primary>log</primary>
56135 <secondary>TLS cipher</secondary>
56137 <indexterm role="concept">
56138 <primary>TLS</primary>
56139 <secondary>logging cipher</secondary>
56141 <option>tls_cipher</option>: When a message is sent or received over an encrypted
56142 connection, the cipher suite used is added to the log line, preceded by X=.
56147 <indexterm role="concept">
56148 <primary>log</primary>
56149 <secondary>TLS peer DN</secondary>
56151 <indexterm role="concept">
56152 <primary>TLS</primary>
56153 <secondary>logging peer DN</secondary>
56155 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
56156 connection, and a certificate is supplied by the remote host, the peer DN is
56157 added to the log line, preceded by DN=.
56162 <indexterm role="concept">
56163 <primary>log</primary>
56164 <secondary>DNS failure in list</secondary>
56166 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
56167 result of a list match is failure because a DNS lookup failed.
56173 <title>Message log</title>
56175 <indexterm role="concept">
56176 <primary>message</primary>
56177 <secondary>log file for</secondary>
56179 <indexterm role="concept">
56180 <primary>log</primary>
56181 <secondary>message log; description of</secondary>
56183 <indexterm role="concept">
56184 <primary><filename>msglog</filename> directory</primary>
56186 <indexterm role="concept">
56187 <primary><option>preserve_message_logs</option></primary>
56189 In addition to the general log files, Exim writes a log file for each message
56190 that it handles. The names of these per-message logs are the message ids, and
56191 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
56192 message log contains copies of the log lines that apply to the message. This
56193 makes it easier to inspect the status of an individual message without having
56194 to search the main log. A message log is deleted when processing of the message
56195 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
56196 only with great care because they can fill up your disk very quickly.
56199 On a heavily loaded system, it may be desirable to disable the use of
56200 per-message logs, in order to reduce disk I/O. This can be done by setting the
56201 <option>message_logs</option> option false.
56202 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
56207 <chapter id="CHAPutils">
56208 <title>Exim utilities</title>
56210 <indexterm role="concept" id="IIDutils" class="startofrange">
56211 <primary>utilities</primary>
56213 A number of utility scripts and programs are supplied with Exim and are
56214 described in this chapter. There is also the Exim Monitor, which is covered in
56215 the next chapter. The utilities described here are:
56217 <informaltable frame="none">
56218 <tgroup cols="4" colsep="0" rowsep="0">
56219 <colspec colwidth="2*" align="left"/>
56220 <colspec colwidth="8*" align="left"/>
56221 <colspec colwidth="30*" align="left"/>
56222 <colspec colwidth="40*" align="left"/>
56226 <entry><xref linkend="SECTfinoutwha"/></entry>
56227 <entry><emphasis>exiwhat</emphasis></entry>
56228 <entry>list what Exim processes are doing</entry>
56232 <entry><xref linkend="SECTgreptheque"/></entry>
56233 <entry><emphasis>exiqgrep</emphasis></entry>
56234 <entry>grep the queue</entry>
56238 <entry><xref linkend="SECTsumtheque"/></entry>
56239 <entry><emphasis>exiqsumm</emphasis></entry>
56240 <entry>summarize the queue</entry>
56244 <entry><xref linkend="SECTextspeinf"/></entry>
56245 <entry><emphasis>exigrep</emphasis></entry>
56246 <entry>search the main log</entry>
56250 <entry><xref linkend="SECTexipick"/></entry>
56251 <entry><emphasis>exipick</emphasis></entry>
56252 <entry>select messages on various criteria</entry>
56256 <entry><xref linkend="SECTcyclogfil"/></entry>
56257 <entry><emphasis>exicyclog</emphasis></entry>
56258 <entry>cycle (rotate) log files</entry>
56262 <entry><xref linkend="SECTmailstat"/></entry>
56263 <entry><emphasis>eximstats</emphasis></entry>
56264 <entry>extract statistics from the log</entry>
56268 <entry><xref linkend="SECTcheckaccess"/></entry>
56269 <entry><emphasis>exim_checkaccess</emphasis></entry>
56270 <entry>check address acceptance from given IP</entry>
56274 <entry><xref linkend="SECTdbmbuild"/></entry>
56275 <entry><emphasis>exim_dbmbuild</emphasis></entry>
56276 <entry>build a DBM file</entry>
56280 <entry><xref linkend="SECTfinindret"/></entry>
56281 <entry><emphasis>exinext</emphasis></entry>
56282 <entry>extract retry information</entry>
56286 <entry><xref linkend="SECThindatmai"/></entry>
56287 <entry><emphasis>exim_dumpdb</emphasis></entry>
56288 <entry>dump a hints database</entry>
56292 <entry><xref linkend="SECThindatmai"/></entry>
56293 <entry><emphasis>exim_tidydb</emphasis></entry>
56294 <entry>clean up a hints database</entry>
56298 <entry><xref linkend="SECThindatmai"/></entry>
56299 <entry><emphasis>exim_fixdb</emphasis></entry>
56300 <entry>patch a hints database</entry>
56304 <entry><xref linkend="SECTmailboxmaint"/></entry>
56305 <entry><emphasis>exim_lock</emphasis></entry>
56306 <entry>lock a mailbox file</entry>
56312 Another utility that might be of use to sites with many MTAs is Tom Kistner’s
56313 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
56314 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
56316 <section id="SECTfinoutwha">
56317 <title>Finding out what Exim processes are doing (exiwhat)</title>
56319 <indexterm role="concept">
56320 <primary><emphasis>exiwhat</emphasis></primary>
56322 <indexterm role="concept">
56323 <primary>process</primary>
56324 <secondary>querying</secondary>
56326 <indexterm role="concept">
56327 <primary>SIGUSR1</primary>
56329 On operating systems that can restart a system call after receiving a signal
56330 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
56331 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
56332 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
56333 processes it can find, having first emptied the file. It then waits for one
56334 second to allow the Exim processes to react before displaying the results. In
56335 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
56336 send the signal to the Exim processes, so it is normally run as root.
56339 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
56340 use by system administrators. It is not sensible, for example, to set up a
56341 script that sends SIGUSR1 signals to Exim processes at short intervals.
56344 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
56345 varies in different operating systems. Not only are different options used,
56346 but the format of the output is different. For this reason, there are some
56347 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
56348 it doesn’t seem to be working for you, check the following compile-time
56352 <literal>EXIWHAT_PS_CMD </literal> the command for running <emphasis>ps</emphasis>
56353 <literal>EXIWHAT_PS_ARG </literal> the argument for <emphasis>ps</emphasis>
56354 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
56355 <literal>EXIWHAT_KILL_ARG </literal> the argument for the <emphasis>kill</emphasis> command
56358 An example of typical output from <emphasis>exiwhat</emphasis> is
56360 <literallayout class="monospaced">
56361 164 daemon: -q1h, listening on port 25
56362 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
56363 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
56364 [10.19.42.42] (editor@ref.example)
56365 10592 handling incoming call from [192.168.243.242]
56366 10628 accepting a local non-SMTP message
56369 The first number in the output line is the process number. The third line has
56370 been split here, in order to fit it on the page.
56373 <section id="SECTgreptheque">
56374 <title>Selective queue listing (exiqgrep)</title>
56376 <indexterm role="concept">
56377 <primary><emphasis>exiqgrep</emphasis></primary>
56379 <indexterm role="concept">
56380 <primary>queue</primary>
56381 <secondary>grepping</secondary>
56383 This utility is a Perl script contributed by Matt Hubbard. It runs
56385 <literallayout class="monospaced">
56389 to obtain a queue listing with undelivered recipients only, and then greps the
56390 output to select messages that match given criteria. The following selection
56391 options are available:
56395 <term><emphasis role="bold">-f</emphasis> <<emphasis>regex</emphasis>></term>
56398 Match the sender address. The field that is tested is enclosed in angle
56399 brackets, so you can test for bounce messages with
56401 <literallayout class="monospaced">
56402 exiqgrep -f '^<>$'
56404 </listitem></varlistentry>
56406 <term><emphasis role="bold">-r</emphasis> <<emphasis>regex</emphasis>></term>
56409 Match a recipient address. The field that is tested is not enclosed in angle
56412 </listitem></varlistentry>
56414 <term><emphasis role="bold">-s</emphasis> <<emphasis>regex</emphasis>></term>
56417 Match against the size field.
56419 </listitem></varlistentry>
56421 <term><emphasis role="bold">-y</emphasis> <<emphasis>seconds</emphasis>></term>
56424 Match messages that are younger than the given time.
56426 </listitem></varlistentry>
56428 <term><emphasis role="bold">-o</emphasis> <<emphasis>seconds</emphasis>></term>
56431 Match messages that are older than the given time.
56433 </listitem></varlistentry>
56435 <term><emphasis role="bold">-z</emphasis></term>
56438 Match only frozen messages.
56440 </listitem></varlistentry>
56442 <term><emphasis role="bold">-x</emphasis></term>
56445 Match only non-frozen messages.
56447 </listitem></varlistentry>
56450 The following options control the format of the output:
56454 <term><emphasis role="bold">-c</emphasis></term>
56457 Display only the count of matching messages.
56459 </listitem></varlistentry>
56461 <term><emphasis role="bold">-l</emphasis></term>
56464 Long format – display the full message information as output by Exim. This is
56467 </listitem></varlistentry>
56469 <term><emphasis role="bold">-i</emphasis></term>
56472 Display message ids only.
56474 </listitem></varlistentry>
56476 <term><emphasis role="bold">-b</emphasis></term>
56479 Brief format – one line per message.
56481 </listitem></varlistentry>
56483 <term><emphasis role="bold">-R</emphasis></term>
56486 Display messages in reverse order.
56488 </listitem></varlistentry>
56491 There is one more option, <option>-h</option>, which outputs a list of options.
56494 <section id="SECTsumtheque">
56495 <title>Summarising the queue (exiqsumm)</title>
56497 <indexterm role="concept">
56498 <primary><emphasis>exiqsumm</emphasis></primary>
56500 <indexterm role="concept">
56501 <primary>queue</primary>
56502 <secondary>summary</secondary>
56504 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
56505 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
56506 running a command such as
56508 <literallayout class="monospaced">
56509 exim -bp | exiqsumm
56512 The output consists of one line for each domain that has messages waiting for
56513 it, as in the following example:
56515 <literallayout class="monospaced">
56516 3 2322 74m 66m msn.com.example
56519 Each line lists the number of
56520 pending deliveries for a domain, their total volume, and the length of time
56521 that the oldest and the newest messages have been waiting. Note that the number
56522 of pending deliveries is greater than the number of messages when messages
56523 have more than one recipient.
56526 A summary line is output at the end. By default the output is sorted on the
56527 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
56528 the output to be sorted by oldest message and by count of messages,
56532 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
56533 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
56534 generated by aliasing or forwarding are included (unless the <option>one_time</option>
56535 option of the <command>redirect</command> router has been used to convert them into <quote>top
56536 level</quote> addresses).
56539 <section id="SECTextspeinf">
56540 <title>Extracting specific information from the log (exigrep)</title>
56542 <indexterm role="concept">
56543 <primary><emphasis>exigrep</emphasis></primary>
56545 <indexterm role="concept">
56546 <primary>log</primary>
56547 <secondary>extracts; grepping for</secondary>
56549 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
56550 files for entries that match a given pattern. When it finds a match, it
56551 extracts all the log entries for the relevant message, not just those that
56552 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
56553 given message, or all mail for a given user, or for a given host, for example.
56554 The input files can be in Exim log format or syslog format.
56557 If a matching log line is not associated with a specific message, it is always
56558 included in <emphasis>exigrep</emphasis>’s output. The usage is:
56561 <literal>exigrep [-l] [-t<</literal><emphasis>n</emphasis><literal>>] <</literal><emphasis>pattern</emphasis><literal>> [<</literal><emphasis>log file</emphasis><literal>>] ...</literal>
56564 The <option>-t</option> argument specifies a number of seconds. It adds an additional
56565 condition for message selection. Messages that are complete are shown only if
56566 they spent more than <<emphasis>n</emphasis>> seconds on the queue.
56569 The <option>-l</option> flag means <quote>literal</quote>, that is, treat all characters in the
56570 pattern as standing for themselves. Otherwise the pattern must be a Perl
56571 regular expression. The pattern match is case-insensitive. If no file names are
56572 given on the command line, the standard input is read.
56575 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
56576 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
56577 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
56580 <section id="SECTexipick">
56581 <title>Selecting messages by various criteria (exipick)</title>
56583 <indexterm role="concept">
56584 <primary><emphasis>exipick</emphasis></primary>
56586 John Jetmore’s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
56587 lists messages from the queue according to a variety of criteria. For details,
56590 <literallayout class="monospaced">
56594 <section id="SECTcyclogfil">
56595 <title>Cycling log files (exicyclog)</title>
56596 <para revisionflag="changed">
56597 <indexterm role="concept">
56598 <primary>log</primary>
56599 <secondary>cycling local files</secondary>
56601 <indexterm role="concept">
56602 <primary>cycling logs</primary>
56604 <indexterm role="concept">
56605 <primary><emphasis>exicyclog</emphasis></primary>
56607 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
56608 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
56609 you are using log files with datestamps in their names (see section
56610 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
56611 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
56612 There are two command line options for <emphasis>exicyclog</emphasis>:
56614 <itemizedlist revisionflag="changed">
56616 <para revisionflag="changed">
56617 <option>-k</option> <<emphasis>count</emphasis>> specifies the number of log files to keep, overriding the
56618 default that is set when Exim is built. The default default is 10.
56622 <para revisionflag="changed">
56623 <option>-l</option> <<emphasis>path</emphasis>> specifies the log file path, in the same format as Exim’s
56624 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
56625 overriding the script’s default, which is to find the setting from Exim’s
56630 <para revisionflag="changed">
56631 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
56632 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
56633 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
56634 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
56635 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
56636 logs are handled similarly.
56639 If the limit is greater than 99, the script uses 3-digit numbers such as
56640 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
56641 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
56642 any existing log files.
56645 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
56646 the end are deleted. All files with numbers greater than 01 are compressed,
56647 using a compression command which is configured by the COMPRESS_COMMAND
56648 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
56649 root <option>crontab</option> entry of the form
56651 <literallayout class="monospaced">
56652 1 0 * * * su exim -c /usr/exim/bin/exicyclog
56655 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
56656 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
56659 <section id="SECTmailstat">
56660 <title>Mail statistics (eximstats)</title>
56662 <indexterm role="concept">
56663 <primary>statistics</primary>
56665 <indexterm role="concept">
56666 <primary><emphasis>eximstats</emphasis></primary>
56668 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
56669 information from log files. The output is either plain text, or HTML.
56670 Exim log files are also suported by the <emphasis>Lire</emphasis> system produced by the
56671 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
56674 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
56675 latest version is the result of some extensive revision by Steve Campbell. A
56676 lot of information is given by default, but there are options for suppressing
56677 various parts of it. Following any options, the arguments to the script are a
56678 list of files, which should be main log files. For example:
56680 <literallayout class="monospaced">
56681 eximstats -nr /var/spool/exim/log/mainlog.01
56684 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
56685 messages received from or delivered to various hosts. The information is sorted
56686 both by message count and by volume, and the top fifty hosts in each category
56687 are listed on the standard output. Similar information, based on email
56688 addresses or domains instead of hosts can be requested by means of various
56689 options. For messages delivered and received locally, similar statistics are
56690 also produced per user.
56693 The output also includes total counts and statistics about delivery errors, and
56694 histograms showing the number of messages received and deliveries made in each
56695 hour of the day. A delivery with more than one address in its envelope (for
56696 example, an SMTP transaction with more than one RCPT command) is counted
56697 as a single delivery by <emphasis>eximstats</emphasis>.
56700 Though normally more deliveries than receipts are reported (as messages may
56701 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
56702 messages received than delivered, even though the queue is empty at the start
56703 and end of the period in question. If an incoming message contains no valid
56704 recipients, no deliveries are recorded for it. A bounce message is handled as
56705 an entirely separate message.
56708 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
56709 of messages received and deliveries made, and the number of hosts involved in
56710 each case. It also outputs the number of messages that were delayed (that is,
56711 not completely delivered at the first attempt), and the number that had at
56712 least one address that failed.
56715 The remainder of the output is in sections that can be independently disabled
56716 or modified by various options. It consists of a summary of deliveries by
56717 transport, histograms of messages received and delivered per time interval
56718 (default per hour), information about the time messages spent on the queue,
56719 a list of relayed messages, lists of the top fifty sending hosts, local
56720 senders, destination hosts, and destination local users by count and by volume,
56721 and a list of delivery errors that occurred.
56724 The relay information lists messages that were actually relayed, that is, they
56725 came from a remote host and were directly delivered to some other remote host,
56726 without being processed (for example, for aliasing or forwarding) locally.
56729 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
56730 outputs. These are documented in the Perl script itself, and can be extracted
56731 by running the command <command>perldoc</command> on the script. For example:
56733 <literallayout class="monospaced">
56734 perldoc /usr/exim/bin/eximstats
56737 <section id="SECTcheckaccess">
56738 <title>Checking access policy (exim_checkaccess)</title>
56740 <indexterm role="concept">
56741 <primary><emphasis>exim_checkaccess</emphasis></primary>
56743 <indexterm role="concept">
56744 <primary>policy control</primary>
56745 <secondary>checking access</secondary>
56747 <indexterm role="concept">
56748 <primary>checking access</primary>
56750 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
56751 debugging output, in order to check what Exim is doing when it is applying
56752 policy controls to incoming SMTP mail. However, not everybody is sufficiently
56753 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
56754 sometimes you just want to answer the question <quote>Does this address have
56755 access?</quote> without bothering with any further details.
56758 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
56759 two arguments, an IP address and an email address:
56761 <literallayout class="monospaced">
56762 exim_checkaccess 10.9.8.7 A.User@a.domain.example
56765 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
56766 given email address would be accepted in a RCPT command in a TCP/IP
56767 connection from the host with the given IP address. The output of the utility
56768 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
56770 <literallayout class="monospaced">
56772 550 Relay not permitted
56775 When running this test, the utility uses <literal><></literal> as the envelope sender address
56776 for the MAIL command, but you can change this by providing additional
56777 options. These are passed directly to the Exim command. For example, to specify
56778 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
56781 <literallayout class="monospaced">
56782 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
56783 -f himself@there.example
56786 Note that these additional Exim command line items must be given after the two
56787 mandatory arguments.
56790 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
56791 while running its checks. You can run checks that include callouts by using
56792 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
56795 <section id="SECTdbmbuild">
56796 <title>Making DBM files (exim_dbmbuild)</title>
56798 <indexterm role="concept">
56799 <primary>DBM</primary>
56800 <secondary>building dbm files</secondary>
56802 <indexterm role="concept">
56803 <primary>building DBM files</primary>
56805 <indexterm role="concept">
56806 <primary><emphasis>exim_dbmbuild</emphasis></primary>
56808 <indexterm role="concept">
56809 <primary>lower casing</primary>
56811 <indexterm role="concept">
56812 <primary>binary zero</primary>
56813 <secondary>in lookup key</secondary>
56815 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
56816 the format used by the <command>lsearch</command> lookup (see section
56817 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
56818 names as keys and the remainder of the information as data. The lower-casing
56819 can be prevented by calling the program with the <option>-nolc</option> option.
56822 A terminating zero is included as part of the key string. This is expected by
56823 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
56824 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
56825 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
56829 The program requires two arguments: the name of the input file (which can be a
56830 single hyphen to indicate the standard input), and the name of the output file.
56831 It creates the output under a temporary name, and then renames it if all went
56835 <indexterm role="concept">
56836 <primary>USE_DB</primary>
56838 If the native DB interface is in use (USE_DB is set in a compile-time
56839 configuration file – this is common in free versions of Unix) the two file
56840 names must be different, because in this mode the Berkeley DB functions create
56841 a single output file using exactly the name given. For example,
56843 <literallayout class="monospaced">
56844 exim_dbmbuild /etc/aliases /etc/aliases.db
56847 reads the system alias file and creates a DBM version of it in
56848 <filename>/etc/aliases.db</filename>.
56851 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
56852 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
56853 environment, the suffixes are added to the second argument of
56854 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
56855 when the Berkeley functions are used in compatibility mode (though this is not
56856 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
56859 If a duplicate key is encountered, the program outputs a warning, and when it
56860 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
56861 option is used. By default, only the first of a set of duplicates is used –
56862 this makes it compatible with <command>lsearch</command> lookups. There is an option
56863 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
56864 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
56865 <option>stderr</option>. For other errors, where it doesn’t actually make a new file, the
56869 <section id="SECTfinindret">
56870 <title>Finding individual retry times (exinext)</title>
56872 <indexterm role="concept">
56873 <primary>retry</primary>
56874 <secondary>times</secondary>
56876 <indexterm role="concept">
56877 <primary><emphasis>exinext</emphasis></primary>
56879 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
56880 fish specific information out of the retry database. Given a mail domain (or a
56881 complete address), it looks up the hosts for that domain, and outputs any retry
56882 information for the hosts or for the domain. At present, the retry information
56883 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
56884 output. For example:
56886 <literallayout class="monospaced">
56887 $ exinext piglet@milne.fict.example
56888 kanga.milne.example:192.168.8.1 error 146: Connection refused
56889 first failed: 21-Feb-1996 14:57:34
56890 last tried: 21-Feb-1996 14:57:34
56891 next try at: 21-Feb-1996 15:02:34
56892 roo.milne.example:192.168.8.3 error 146: Connection refused
56893 first failed: 20-Jan-1996 13:12:08
56894 last tried: 21-Feb-1996 11:42:03
56895 next try at: 21-Feb-1996 19:42:03
56896 past final cutoff time
56899 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
56900 will give any retry information for that local part in your default domain.
56901 A message id can be used to obtain retry information pertaining to a specific
56902 message. This exists only when an attempt to deliver a message to a remote host
56903 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
56904 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
56908 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
56909 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
56910 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
56911 configuration file, and the second sets macros for use within the configuration
56912 file. These features are mainly to help in testing, but might also be useful in
56913 environments where more than one configuration file is in use.
56916 <section id="SECThindatmai">
56917 <title>Hints database maintenance</title>
56919 <indexterm role="concept">
56920 <primary>hints database</primary>
56921 <secondary>maintenance</secondary>
56923 <indexterm role="concept">
56924 <primary>maintaining Exim’s hints database</primary>
56926 Three utility programs are provided for maintaining the DBM files that Exim
56927 uses to contain its delivery hint information. Each program requires two
56928 arguments. The first specifies the name of Exim’s spool directory, and the
56929 second is the name of the database it is to operate on. These are as follows:
56934 <emphasis>retry</emphasis>: the database of retry information
56939 <emphasis>wait-</emphasis><<emphasis>transport name</emphasis>>: databases of information about messages waiting
56945 <emphasis>callout</emphasis>: the callout cache
56950 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
56955 <emphasis>misc</emphasis>: other hints data
56960 The <emphasis>misc</emphasis> database is used for
56965 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
56970 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
56971 <command>smtp</command> transport)
56977 <title>exim_dumpdb</title>
56979 <indexterm role="concept">
56980 <primary><emphasis>exim_dumpdb</emphasis></primary>
56982 The entire contents of a database are written to the standard output by the
56983 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
56984 spool and database names. For example, to dump the retry database:
56986 <literallayout class="monospaced">
56987 exim_dumpdb /var/spool/exim retry
56990 Two lines of output are produced for each entry:
56992 <literallayout class="monospaced">
56993 T:mail.ref.example:192.168.242.242 146 77 Connection refused
56994 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
56997 The first item on the first line is the key of the record. It starts with one
56998 of the letters R, or T, depending on whether it refers to a routing or
56999 transport retry. For a local delivery, the next part is the local address; for
57000 a remote delivery it is the name of the remote host, followed by its failing IP
57001 address (unless <option>no_retry_include_ip_address</option> is set on the <command>smtp</command>
57002 transport). If the remote port is not the standard one (port 25), it is added
57003 to the IP address. Then there follows an error code, an additional error code,
57004 and a textual description of the error.
57007 The three times on the second line are the time of first failure, the time of
57008 the last delivery attempt, and the computed time for the next attempt. The line
57009 ends with an asterisk if the cutoff time for the last retry rule has been
57013 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
57014 consists of a host name followed by a list of ids for messages that are or were
57015 waiting to be delivered to that host. If there are a very large number for any
57016 one host, continuation records, with a sequence number added to the host name,
57017 may be seen. The data in these records is often out of date, because a message
57018 may be routed to several alternative hosts, and Exim makes no effort to keep
57023 <title>exim_tidydb</title>
57025 <indexterm role="concept">
57026 <primary><emphasis>exim_tidydb</emphasis></primary>
57028 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
57029 database. If run with no options, it removes all records that are more than 30
57030 days old. The age is calculated from the date and time that the record was last
57031 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
57032 since the first delivery failure. Information about a host that has been down
57033 for more than 30 days will remain in the database, provided that the record is
57034 updated sufficiently often.
57037 The cutoff date can be altered by means of the <option>-t</option> option, which must be
57038 followed by a time. For example, to remove all records older than a week from
57039 the retry database:
57041 <literallayout class="monospaced">
57042 exim_tidydb -t 7d /var/spool/exim retry
57045 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
57046 message ids. In the former these appear as data in records keyed by host –
57047 they were messages that were waiting for that host – and in the latter they
57048 are the keys for retry information for messages that have suffered certain
57049 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
57050 message ids in database records are those of messages that are still on the
57051 queue. Message ids for messages that no longer exist are removed from
57052 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
57053 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
57054 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
57055 whenever it removes information from the database.
57058 Certain records are automatically removed by Exim when they are no longer
57059 needed, but others are not. For example, if all the MX hosts for a domain are
57060 down, a retry record is created for each one. If the primary MX host comes back
57061 first, its record is removed when Exim successfully delivers to it, but the
57062 records for the others remain because Exim has not tried to use those hosts.
57065 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
57066 hints databases. You should do this at a quiet time of day, because it requires
57067 a database to be locked (and therefore inaccessible to Exim) while it does its
57068 work. Removing records from a DBM file does not normally make the file smaller,
57069 but all the common DBM libraries are able to re-use the space that is released.
57070 After an initial phase of increasing in size, the databases normally reach a
57071 point at which they no longer get any bigger, as long as they are regularly
57075 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
57076 databases is likely to keep on increasing.
57080 <title>exim_fixdb</title>
57082 <indexterm role="concept">
57083 <primary><emphasis>exim_fixdb</emphasis></primary>
57085 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
57086 Its main use is for testing Exim, but it might also be occasionally useful for
57087 getting round problems in a live system. It has no options, and its interface
57088 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
57089 key of a database record can then be entered, and the data for that record is
57093 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
57094 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
57095 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
57096 data for individual fields can be changed by typing the field number followed
57097 by new data, for example:
57099 <literallayout class="monospaced">
57103 resets the time of the next delivery attempt. Time values are given as a
57104 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
57105 used as optional separators.
57108 <section id="SECTmailboxmaint">
57109 <title>Mailbox maintenance (exim_lock)</title>
57111 <indexterm role="concept">
57112 <primary>mailbox</primary>
57113 <secondary>maintenance</secondary>
57115 <indexterm role="concept">
57116 <primary><emphasis>exim_lock</emphasis></primary>
57118 <indexterm role="concept">
57119 <primary>locking mailboxes</primary>
57121 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
57122 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
57123 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
57124 a user agent while investigating a problem. The utility requires the name of
57125 the file as its first argument. If the locking is successful, the second
57126 argument is run as a command (using C’s <function>system()</function> function); if there is no
57127 second argument, the value of the SHELL environment variable is used; if this
57128 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
57129 is unlocked and the utility ends. The following options are available:
57133 <term><option>-fcntl</option></term>
57136 Use <function>fcntl()</function> locking on the open mailbox.
57138 </listitem></varlistentry>
57140 <term><option>-flock</option></term>
57143 Use <function>flock()</function> locking on the open mailbox, provided the operating system
57146 </listitem></varlistentry>
57148 <term><option>-interval</option></term>
57151 This must be followed by a number, which is a number of seconds; it sets the
57152 interval to sleep between retries (default 3).
57154 </listitem></varlistentry>
57156 <term><option>-lockfile</option></term>
57159 Create a lock file before opening the mailbox.
57161 </listitem></varlistentry>
57163 <term><option>-mbx</option></term>
57166 Lock the mailbox using MBX rules.
57168 </listitem></varlistentry>
57170 <term><option>-q</option></term>
57173 Suppress verification output.
57175 </listitem></varlistentry>
57177 <term><option>-retries</option></term>
57180 This must be followed by a number; it sets the number of times to try to get
57181 the lock (default 10).
57183 </listitem></varlistentry>
57185 <term><option>-restore_time</option></term>
57188 This option causes <option>exim_lock</option> to restore the modified and read times to the
57189 locked file before exiting. This allows you to access a locked mailbox (for
57190 example, to take a backup copy) without disturbing the times that the user
57193 </listitem></varlistentry>
57195 <term><option>-timeout</option></term>
57198 This must be followed by a number, which is a number of seconds; it sets a
57199 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
57200 default), a non-blocking call is used.
57202 </listitem></varlistentry>
57204 <term><option>-v</option></term>
57207 Generate verbose output.
57209 </listitem></varlistentry>
57212 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
57213 default is to create a lock file and also to use <function>fcntl()</function> locking on the
57214 mailbox, which is the same as Exim’s default. The use of <option>-flock</option> or
57215 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
57216 requires that the directory containing the file be writeable. Locking by lock
57217 file does not last for ever; Exim assumes that a lock file is expired if it is
57218 more than 30 minutes old.
57221 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
57222 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
57223 to be taken out on the open mailbox, and an exclusive lock on the file
57224 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
57225 number of the mailbox file. When the locking is released, if an exclusive lock
57226 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
57229 The default output contains verification of the locking that takes place. The
57230 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
57231 suppresses all output except error messages.
57236 <literallayout class="monospaced">
57237 exim_lock /var/spool/mail/spqr
57240 runs an interactive shell while the file is locked, whereas
57243 <literal>exim_lock -q /var/spool/mail/spqr <<End</literal>
57244 <<emphasis>some commands</emphasis>>
57245 <literal>End</literal>
57248 runs a specific non-interactive sequence of commands while the file is locked,
57249 suppressing all verification output. A single command can be run by a command
57252 <literallayout class="monospaced">
57253 exim_lock -q /var/spool/mail/spqr \
57254 "cp /var/spool/mail/spqr /some/where"
57257 Note that if a command is supplied, it must be entirely contained within the
57258 second argument – hence the quotes.
57259 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
57264 <chapter id="CHAPeximon">
57265 <title>The Exim monitor</title>
57267 <indexterm role="concept" id="IIDeximon" class="startofrange">
57268 <primary>Exim monitor</primary>
57269 <secondary>description</secondary>
57271 <indexterm role="concept">
57272 <primary>X-windows</primary>
57274 <indexterm role="concept">
57275 <primary><emphasis>eximon</emphasis></primary>
57277 <indexterm role="concept">
57278 <primary>Local/eximon.conf</primary>
57280 <indexterm role="concept">
57281 <primary>_exim_monitor/EDITME_</primary>
57283 The Exim monitor is an application which displays in an X window information
57284 about the state of Exim’s queue and what Exim is doing. An admin user can
57285 perform certain operations on messages from this GUI interface; however all
57286 such facilities are also available from the command line, and indeed, the
57287 monitor itself makes use of the command line to perform any actions requested.
57290 <title>Running the monitor</title>
57292 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
57293 script that sets up a number of environment variables, and then runs the
57294 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
57295 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
57296 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
57297 parameters are for.
57300 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
57301 a particular invocation by setting up environment variables of the same names,
57302 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
57304 <literallayout class="monospaced">
57305 EXIMON_LOG_DEPTH=400 eximon
57308 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
57309 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
57310 overrides the Exim log file configuration. This makes it possible to have
57311 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
57312 syslog messages are routed to a file on the local host.
57315 X resources can be used to change the appearance of the window in the normal
57316 way. For example, a resource setting of the form
57318 <literallayout class="monospaced">
57319 Eximon*background: gray94
57322 changes the colour of the background to light grey rather than white. The
57323 stripcharts are drawn with both the data lines and the reference lines in
57324 black. This means that the reference lines are not visible when on top of the
57325 data. However, their colour can be changed by setting a resource called
57326 <quote>highlight</quote> (an odd name, but that’s what the Athena stripchart widget uses).
57327 For example, if your X server is running Unix, you could set up lighter
57328 reference lines in the stripcharts by obeying
57330 <literallayout class="monospaced">
57331 xrdb -merge <<End
57332 Eximon*highlight: gray
57336 <indexterm role="concept">
57337 <primary>admin user</primary>
57339 In order to see the contents of messages on the queue, and to operate on them,
57340 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
57343 The monitor’s window is divided into three parts. The first contains one or
57344 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
57345 main log file, and the third is a display of the queue of messages awaiting
57346 delivery, with two more action buttons. The following sections describe these
57347 different parts of the display.
57351 <title>The stripcharts</title>
57353 <indexterm role="concept">
57354 <primary>stripchart</primary>
57356 The first stripchart is always a count of messages on the queue. Its name can
57357 be configured by setting QUEUE_STRIPCHART_NAME in the
57358 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
57359 configuration script by regular expression matches on log file entries, making
57360 it possible to display, for example, counts of messages delivered to certain
57361 hosts or using certain transports. The supplied defaults display counts of
57362 received and delivered messages, and of local and SMTP deliveries. The default
57363 period between stripchart updates is one minute; this can be adjusted by a
57364 parameter in the <filename>Local/eximon.conf</filename> file.
57367 The stripchart displays rescale themselves automatically as the value they are
57368 displaying changes. There are always 10 horizontal lines in each chart; the
57369 title string indicates the value of each division when it is greater than one.
57370 For example, <quote>x2</quote> means that each division represents a value of 2.
57373 It is also possible to have a stripchart which shows the percentage fullness of
57374 a particular disk partition, which is useful when local deliveries are confined
57375 to a single partition.
57378 <indexterm role="concept">
57379 <primary><option>statvfs</option> function</primary>
57381 This relies on the availability of the <function>statvfs()</function> function or equivalent in
57382 the operating system. Most, but not all versions of Unix that support Exim have
57383 this. For this particular stripchart, the top of the chart always represents
57384 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
57385 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
57386 <filename>Local/eximon.conf</filename> file.
57390 <title>Main action buttons</title>
57392 <indexterm role="concept">
57393 <primary>size</primary>
57394 <secondary>of monitor window</secondary>
57396 <indexterm role="concept">
57397 <primary>Exim monitor</primary>
57398 <secondary>window size</secondary>
57400 <indexterm role="concept">
57401 <primary>window size</primary>
57403 Below the stripcharts there is an action button for quitting the monitor. Next
57404 to this is another button marked <quote>Size</quote>. They are placed here so that
57405 shrinking the window to its default minimum size leaves just the queue count
57406 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
57407 the window to expand to its maximum size, unless it is already at the maximum,
57408 in which case it is reduced to its minimum.
57411 When expanding to the maximum, if the window cannot be fully seen where it
57412 currently is, it is moved back to where it was the last time it was at full
57413 size. When it is expanding from its minimum size, the old position is
57414 remembered, and next time it is reduced to the minimum it is moved back there.
57417 The idea is that you can keep a reduced window just showing one or two
57418 stripcharts at a convenient place on your screen, easily expand it to show
57419 the full window when required, and just as easily put it back to what it was.
57420 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
57421 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
57422 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
57425 Normally, the monitor starts up with the window at its full size, but it can be
57426 built so that it starts up with the window at its smallest size, by setting
57427 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
57431 <title>The log display</title>
57433 <indexterm role="concept">
57434 <primary>log</primary>
57435 <secondary>tail of; in monitor</secondary>
57437 The second section of the window is an area in which a display of the tail of
57438 the main log is maintained.
57439 To save space on the screen, the timestamp on each log line is shortened by
57440 removing the date and, if <option>log_timezone</option> is set, the timezone.
57441 The log tail is not available when the only destination for logging data is
57442 syslog, unless the syslog lines are routed to a local file whose name is passed
57443 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
57446 The log sub-window has a scroll bar at its lefthand side which can be used to
57447 move back to look at earlier text, and the up and down arrow keys also have a
57448 scrolling effect. The amount of log that is kept depends on the setting of
57449 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
57450 to use. When this is full, the earlier 50% of data is discarded – this is
57451 much more efficient than throwing it away line by line. The sub-window also has
57452 a horizontal scroll bar for accessing the ends of long log lines. This is the
57453 only means of horizontal scrolling; the right and left arrow keys are not
57454 available. Text can be cut from this part of the window using the mouse in the
57455 normal way. The size of this subwindow is controlled by parameters in the
57456 configuration file <filename>Local/eximon.conf</filename>.
57459 Searches of the text in the log window can be carried out by means of the ^R
57460 and ^S keystrokes, which default to a reverse and a forward search,
57461 respectively. The search covers only the text that is displayed in the window.
57462 It cannot go further back up the log.
57465 The point from which the search starts is indicated by a caret marker. This is
57466 normally at the end of the text in the window, but can be positioned explicitly
57467 by pointing and clicking with the left mouse button, and is moved automatically
57468 by a successful search. If new text arrives in the window when it is scrolled
57469 back, the caret remains where it is, but if the window is not scrolled back,
57470 the caret is moved to the end of the new text.
57473 Pressing ^R or ^S pops up a window into which the search text can be typed.
57474 There are buttons for selecting forward or reverse searching, for carrying out
57475 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
57476 happens and the window remains so that further searches can be done. If the
57477 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
57478 ^C is typed the search is cancelled.
57481 The searching facility is implemented using the facilities of the Athena text
57482 widget. By default this pops up a window containing both <quote>search</quote> and
57483 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
57484 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
57485 However, the linkers in BSDI and HP-UX seem unable to handle an externally
57486 provided version of <option>TextPop</option> when the remaining parts of the text widget
57487 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
57488 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
57489 on these systems, at the expense of having unwanted items in the search popup
57494 <title>The queue display</title>
57496 <indexterm role="concept">
57497 <primary>queue</primary>
57498 <secondary>display in monitor</secondary>
57500 The bottom section of the monitor window contains a list of all messages that
57501 are on the queue, which includes those currently being received or delivered,
57502 as well as those awaiting delivery. The size of this subwindow is controlled by
57503 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
57504 at which it is updated is controlled by another parameter in the same file –
57505 the default is 5 minutes, since queue scans can be quite expensive. However,
57506 there is an <quote>Update</quote> action button just above the display which can be used
57507 to force an update of the queue display at any time.
57510 When a host is down for some time, a lot of pending mail can build up for it,
57511 and this can make it hard to deal with other messages on the queue. To help
57512 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
57513 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
57514 type anything in here and press <quote>Return</quote>, the text is added to a chain of
57515 such texts, and if every undelivered address in a message matches at least one
57516 of the texts, the message is not displayed.
57519 If there is an address that does not match any of the texts, all the addresses
57520 are displayed as normal. The matching happens on the ends of addresses so, for
57521 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
57522 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
57523 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
57524 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
57525 a hide request is automatically cancelled after one hour.
57528 While the dialogue box is displayed, you can’t press any buttons or do anything
57529 else to the monitor window. For this reason, if you want to cut text from the
57530 queue display to use in the dialogue box, you have to do the cutting before
57531 pressing the <quote>Hide</quote> button.
57534 The queue display contains, for each unhidden queued message, the length of
57535 time it has been on the queue, the size of the message, the message id, the
57536 message sender, and the first undelivered recipient, all on one line. If it is
57537 a bounce message, the sender is shown as <quote><></quote>. If there is more than one
57538 recipient to which the message has not yet been delivered, subsequent ones are
57539 listed on additional lines, up to a maximum configured number, following which
57540 an ellipsis is displayed. Recipients that have already received the message are
57544 <indexterm role="concept">
57545 <primary>frozen messages</primary>
57546 <secondary>display</secondary>
57548 If a message is frozen, an asterisk is displayed at the left-hand side.
57551 The queue display has a vertical scroll bar, and can also be scrolled by means
57552 of the arrow keys. Text can be cut from it using the mouse in the normal way.
57553 The text searching facilities, as described above for the log window, are also
57554 available, but the caret is always moved to the end of the text when the queue
57555 display is updated.
57559 <title>The queue menu</title>
57561 <indexterm role="concept">
57562 <primary>queue</primary>
57563 <secondary>menu in monitor</secondary>
57565 If the <option>shift</option> key is held down and the left button is clicked when the mouse
57566 pointer is over the text for any message, an action menu pops up, and the first
57567 line of the queue display for the message is highlighted. This does not affect
57571 If you want to use some other event for popping up the menu, you can set the
57572 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
57573 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
57574 value set in this parameter is a standard X event description. For example, to
57575 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
57577 <literallayout class="monospaced">
57578 EXIMON_MENU_EVENT='Ctrl<Btn1Down>' eximon
57581 The title of the menu is the message id, and it contains entries which act as
57587 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
57588 in a new text window.
57593 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
57594 information and headers is displayed in a new text window. See chapter
57595 <xref linkend="CHAPspool"/> for a description of the format of spool files.
57600 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
57601 displayed in a new text window. There is a default limit of 20,000 bytes to the
57602 amount of data displayed. This can be changed by setting the BODY_MAX
57603 option at compile time, or the EXIMON_BODY_MAX option at run time.
57608 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
57609 delivery of the message. This causes an automatic thaw if the message is
57610 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
57611 a new text window. The delivery is run in a separate process, to avoid holding
57612 up the monitor while the delivery proceeds.
57617 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
57618 that the message be frozen.
57623 <indexterm role="concept">
57624 <primary>thawing messages</primary>
57626 <indexterm role="concept">
57627 <primary>unfreezing messages</primary>
57629 <indexterm role="concept">
57630 <primary>frozen messages</primary>
57631 <secondary>thawing</secondary>
57633 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
57634 that the message be thawed.
57639 <indexterm role="concept">
57640 <primary>delivery</primary>
57641 <secondary>forcing failure</secondary>
57643 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
57644 that Exim gives up trying to deliver the message. A bounce message is generated
57645 for any remaining undelivered addresses.
57650 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
57651 that the message be deleted from the system without generating a bounce
57657 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
57658 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
57659 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
57660 Otherwise it must be entered as a fully qualified address. Pressing RETURN
57661 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
57662 additional recipient be added to the message, unless the entry box is empty, in
57663 which case no action is taken.
57668 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
57669 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
57670 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
57671 Otherwise it must be entered as a fully qualified address. Pressing RETURN
57672 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
57673 recipient address as already delivered, unless the entry box is empty, in which
57674 case no action is taken.
57679 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
57680 mark all recipient addresses as already delivered.
57685 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
57686 sender’s address. Pressing RETURN causes a call to Exim to be made using the
57687 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
57688 in which case no action is taken. If you want to set an empty sender (as in
57689 bounce messages), you must specify it as <quote><></quote>. Otherwise, if the address is
57690 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
57691 the address is qualified with that domain.
57696 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
57697 other cases when a call to Exim is made, if there is any output from Exim (in
57698 particular, if the command fails) a window containing the command and the
57699 output is displayed. Otherwise, the results of the action are normally apparent
57700 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
57701 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
57702 if no output is generated.
57705 The queue display is automatically updated for actions such as freezing and
57706 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
57707 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
57708 force an update of the display after one of these actions.
57711 In any text window that is displayed as result of a menu action, the normal
57712 cut-and-paste facility is available, and searching can be carried out using ^R
57713 and ^S, as described above for the log tail window.
57714 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
57719 <chapter id="CHAPsecurity">
57720 <title>Security considerations</title>
57722 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
57723 <primary>security</primary>
57724 <secondary>discussion of</secondary>
57726 This chapter discusses a number of issues concerned with security, some of
57727 which are also covered in other parts of this manual.
57730 For reasons that this author does not understand, some people have promoted
57731 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
57732 existence of this chapter in the documentation. However, the intent of the
57733 chapter is simply to describe the way Exim works in relation to certain
57734 security concerns, not to make any specific claims about the effectiveness of
57735 its security as compared with other MTAs.
57738 What follows is a description of the way Exim is supposed to be. Best efforts
57739 have been made to try to ensure that the code agrees with the theory, but an
57740 absence of bugs can never be guaranteed. Any that are reported will get fixed
57741 as soon as possible.
57744 <title>Building a more <quote>hardened</quote> Exim</title>
57746 <indexterm role="concept">
57747 <primary>security</primary>
57748 <secondary>build-time features</secondary>
57750 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
57751 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
57752 Exim administrator who does not have the root password, or by someone who has
57753 penetrated the Exim (but not the root) account. These options are as follows:
57758 ALT_CONFIG_PREFIX can be set to a string that is required to match the
57759 start of any file names used with the <option>-C</option> option. When it is set, these file
57760 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
57761 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
57762 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
57763 default setting for <option>ALT_CONFIG_PREFIX</option>.
57766 If the permitted configuration files are confined to a directory to
57767 which only root has access, this guards against someone who has broken
57768 into the Exim account from running a privileged Exim with an arbitrary
57769 configuration file, and using it to break into other accounts.
57774 If ALT_CONFIG_ROOT_ONLY is defined, root privilege is retained for <option>-C</option>
57775 and <option>-D</option> only if the caller of Exim is root. Without it, the Exim user may
57776 also use <option>-C</option> and <option>-D</option> and retain privilege. Setting this option locks out
57777 the possibility of testing a configuration using <option>-C</option> right through message
57778 reception and delivery, even if the caller is root. The reception works, but by
57779 that time, Exim is running as the Exim user, so when it re-execs to regain
57780 privilege for the delivery, the use of <option>-C</option> causes privilege to be lost.
57781 However, root can test reception and delivery using two separate commands.
57782 ALT_CONFIG_ROOT_ONLY is not set by default.
57787 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
57793 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
57794 never to be used for any deliveries. This is like the <option>never_users</option> runtime
57795 option, but it cannot be overridden; the runtime option adds additional users
57796 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
57797 is permitted to modify the runtime file from using Exim as a way to get root.
57803 <title>Root privilege</title>
57805 <indexterm role="concept">
57806 <primary>setuid</primary>
57808 <indexterm role="concept">
57809 <primary>root privilege</primary>
57811 The Exim binary is normally setuid to root, which means that it gains root
57812 privilege (runs as root) when it starts execution. In some special cases (for
57813 example, when the daemon is not in use and there are no local deliveries), it
57814 may be possible to run Exim setuid to some user other than root. This is
57815 discussed in the next section. However, in most installations, root privilege
57816 is required for two things:
57821 To set up a socket connected to the standard SMTP port (25) when initialising
57822 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
57828 To be able to change uid and gid in order to read users’ <filename>.forward</filename> files and
57829 perform local deliveries as the receiving user or as specified in the
57835 It is not necessary to be root to do any of the other things Exim does, such as
57836 receiving messages and delivering them externally over SMTP, and it is
57837 obviously more secure if Exim does not run as root except when necessary.
57838 For this reason, a user and group for Exim to use must be defined in
57839 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
57840 group</quote>. Their values can be changed by the run time configuration, though this
57841 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
57842 <emphasis>mail</emphasis> or another user name altogether.
57845 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
57846 abdication; the process cannot regain root afterwards. Prior to release 4.00,
57847 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
57850 After a new Exim process has interpreted its command line options, it changes
57851 uid and gid in the following cases:
57856 <indexterm role="concept">
57857 <primary><option>-C</option> option</primary>
57859 <indexterm role="concept">
57860 <primary><option>-D</option> option</primary>
57862 If the <option>-C</option> option is used to specify an alternate configuration file, or if
57863 the <option>-D</option> option is used to define macro values for the configuration, and the
57864 calling process is not running as root or the Exim user, the uid and gid are
57865 changed to those of the calling process.
57866 However, if ALT_CONFIG_ROOT_ONLY is defined in <filename>Local/Makefile</filename>, only
57867 root callers may use <option>-C</option> and <option>-D</option> without losing privilege, and if
57868 DISABLE_D_OPTION is set, the <option>-D</option> option may not be used at all.
57873 <indexterm role="concept">
57874 <primary><option>-be</option> option</primary>
57876 <indexterm role="concept">
57877 <primary><option>-bf</option> option</primary>
57879 <indexterm role="concept">
57880 <primary><option>-bF</option> option</primary>
57882 If the expansion test option (<option>-be</option>) or one of the filter testing options
57883 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
57889 If the process is not a daemon process or a queue runner process or a delivery
57890 process or a process for testing address routing (started with <option>-bt</option>), the
57891 uid and gid are changed to the Exim user and group. This means that Exim always
57892 runs under its own uid and gid when receiving messages. This also applies when
57893 testing address verification
57894 <indexterm role="concept">
57895 <primary><option>-bv</option> option</primary>
57897 <indexterm role="concept">
57898 <primary><option>-bh</option> option</primary>
57900 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
57906 For a daemon, queue runner, delivery, or address testing process, the uid
57907 remains as root at this stage, but the gid is changed to the Exim group.
57912 The processes that initially retain root privilege behave as follows:
57917 A daemon process changes the gid to the Exim group and the uid to the Exim
57918 user after setting up one or more listening sockets. The <function>initgroups()</function>
57919 function is called, so that if the Exim user is in any additional groups, they
57920 will be used during message reception.
57925 A queue runner process retains root privilege throughout its execution. Its
57926 job is to fork a controlled sequence of delivery processes.
57931 A delivery process retains root privilege throughout most of its execution,
57932 but any actual deliveries (that is, the transports themselves) are run in
57933 subprocesses which always change to a non-root uid and gid. For local
57934 deliveries this is typically the uid and gid of the owner of the mailbox; for
57935 remote deliveries, the Exim uid and gid are used. Once all the delivery
57936 subprocesses have been run, a delivery process changes to the Exim uid and gid
57937 while doing post-delivery tidying up such as updating the retry database and
57938 generating bounce and warning messages.
57941 While the recipient addresses in a message are being routed, the delivery
57942 process runs as root. However, if a user’s filter file has to be processed,
57943 this is done in a subprocess that runs under the individual user’s uid and
57944 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
57949 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
57950 the routing is done in the same environment as a message delivery.
57955 <section id="SECTrunexiwitpri">
57956 <title>Running Exim without privilege</title>
57958 <indexterm role="concept">
57959 <primary>privilege</primary>
57960 <secondary>running without</secondary>
57962 <indexterm role="concept">
57963 <primary>unprivileged running</primary>
57965 <indexterm role="concept">
57966 <primary>root privilege</primary>
57967 <secondary>running without</secondary>
57969 Some installations like to run Exim in an unprivileged state for more of its
57970 operation, for added security. Support for this mode of operation is provided
57971 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
57972 gid are changed to the Exim user and group at the start of a delivery process
57973 (and also queue runner and address testing processes). This means that address
57974 routing is no longer run as root, and the deliveries themselves cannot change
57978 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
57979 that the daemon can still be started in the usual way, and it can respond
57980 correctly to SIGHUP because the re-invocation regains root privilege.
57983 An alternative approach is to make Exim setuid to the Exim user and also setgid
57985 If you do this, the daemon must be started from a root process. (Calling
57986 Exim from a root process makes it behave in the way it does when it is setuid
57987 root.) However, the daemon cannot restart itself after a SIGHUP signal because
57988 it cannot regain privilege.
57991 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
57992 stops Exim from trying to re-invoke itself to do a delivery after a message has
57993 been received. Such a re-invocation is a waste of resources because it has no
57997 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
57998 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
57999 to the Exim user seems a clean approach, but there is one complication:
58002 In this style of operation, Exim is running with the real uid and gid set to
58003 those of the calling process, and the effective uid/gid set to Exim’s values.
58004 Ideally, any association with the calling process’ uid/gid should be dropped,
58005 that is, the real uid/gid should be reset to the effective values so as to
58006 discard any privileges that the caller may have. While some operating systems
58007 have a function that permits this action for a non-root effective uid, quite a
58008 number of them do not. Because of this lack of standardization, Exim does not
58009 address this problem at this time.
58012 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
58013 is to keep the Exim binary setuid to root, and to set
58014 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
58015 be used in the most straightforward way.
58018 If you configure Exim not to run delivery processes as root, there are a
58019 number of restrictions on what you can do:
58024 You can deliver only as the Exim user/group. You should explicitly use the
58025 <option>user</option> and <option>group</option> options to override routers or local transports that
58026 normally deliver as the recipient. This makes sure that configurations that
58027 work in this mode function the same way in normal mode. Any implicit or
58028 explicit specification of another user causes an error.
58033 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
58034 not worthwhile to include them in the configuration.
58039 Users who wish to use <filename>.forward</filename> would have to make their home directory and
58040 the file itself accessible to the Exim user. Pipe and append-to-file entries,
58041 and their equivalents in Exim filters, cannot be used. While they could be
58042 enabled in the Exim user’s name, that would be insecure and not very useful.
58047 Unless the local user mailboxes are all owned by the Exim user (possible in
58048 some POP3 or IMAP-only environments):
58050 <orderedlist numeration="arabic">
58053 They must be owned by the Exim group and be writable by that group. This
58054 implies you must set <option>mode</option> in the appendfile configuration, as well as the
58055 mode of the mailbox files themselves.
58060 You must set <option>no_check_owner</option>, since most or all of the files will not be
58061 owned by the Exim user.
58066 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
58067 on a newly created mailbox when unprivileged. This also implies that new
58068 mailboxes need to be created manually.
58075 These restrictions severely restrict what can be done in local deliveries.
58076 However, there are no restrictions on remote deliveries. If you are running a
58077 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
58078 gives more security at essentially no cost.
58081 If you are using the <option>mua_wrapper</option> facility (see chapter
58082 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
58086 <title>Delivering to local files</title>
58088 Full details of the checks applied by <command>appendfile</command> before it writes to a file
58089 are given in chapter <xref linkend="CHAPappendfile"/>.
58093 <title>IPv4 source routing</title>
58095 <indexterm role="concept">
58096 <primary>source routing</primary>
58097 <secondary>in IP packets</secondary>
58099 <indexterm role="concept">
58100 <primary>IP source routing</primary>
58102 Many operating systems suppress IP source-routed packets in the kernel, but
58103 some cannot be made to do this, so Exim does its own check. It logs incoming
58104 IPv4 source-routed TCP calls, and then drops them. Things are all different in
58105 IPv6. No special checking is currently done.
58109 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
58111 Support for these SMTP commands is disabled by default. If required, they can
58112 be enabled by defining suitable ACLs.
58116 <title>Privileged users</title>
58118 <indexterm role="concept">
58119 <primary>trusted user</primary>
58121 <indexterm role="concept">
58122 <primary>admin user</primary>
58124 <indexterm role="concept">
58125 <primary>privileged user</primary>
58127 <indexterm role="concept">
58128 <primary>user</primary>
58129 <secondary>trusted</secondary>
58131 <indexterm role="concept">
58132 <primary>user</primary>
58133 <secondary>admin</secondary>
58135 Exim recognises two sets of users with special privileges. Trusted users are
58136 able to submit new messages to Exim locally, but supply their own sender
58137 addresses and information about a sending host. For other users submitting
58138 local messages, Exim sets up the sender address from the uid, and doesn’t
58139 permit a remote host to be specified.
58142 <indexterm role="concept">
58143 <primary><option>-f</option> option</primary>
58145 However, an untrusted user is permitted to use the <option>-f</option> command line option
58146 in the special form <option>-f <></option> to indicate that a delivery failure for the
58147 message should not cause an error report. This affects the message’s envelope,
58148 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
58149 permitted to use specific forms of address with the <option>-f</option> option by setting
58150 the <option>untrusted_set_sender</option> option.
58153 Trusted users are used to run processes that receive mail messages from some
58154 other mail domain and pass them on to Exim for delivery either locally, or over
58155 the Internet. Exim trusts a caller that is running as root, as the Exim user,
58156 as any user listed in the <option>trusted_users</option> configuration option, or under any
58157 group listed in the <option>trusted_groups</option> option.
58160 Admin users are permitted to do things to the messages on Exim’s queue. They
58161 can freeze or thaw messages, cause them to be returned to their senders, remove
58162 them entirely, or modify them in various ways. In addition, admin users can run
58163 the Exim monitor and see all the information it is capable of providing, which
58164 includes the contents of files on the spool.
58167 <indexterm role="concept">
58168 <primary><option>-M</option> option</primary>
58170 <indexterm role="concept">
58171 <primary><option>-q</option> option</primary>
58173 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
58174 delivery of messages on its queue is restricted to admin users. This
58175 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
58176 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
58177 queue is also restricted to admin users. This restriction can be relaxed by
58178 setting <option>no_queue_list_requires_admin</option>.
58181 Exim recognises an admin user if the calling process is running as root or as
58182 the Exim user or if any of the groups associated with the calling process is
58183 the Exim group. It is not necessary actually to be running under the Exim
58184 group. However, if admin users who are not root or the Exim user are to access
58185 the contents of files on the spool via the Exim monitor (which runs
58186 unprivileged), Exim must be built to allow group read access to its spool
58191 <title>Spool files</title>
58193 <indexterm role="concept">
58194 <primary>spool directory</primary>
58195 <secondary>files</secondary>
58197 Exim’s spool directory and everything it contains is owned by the Exim user and
58198 set to the Exim group. The mode for spool files is defined in the
58199 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
58200 any user who is a member of the Exim group can access these files.
58204 <title>Use of argv[0]</title>
58206 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
58207 of specific strings, Exim assumes certain options. For example, calling Exim
58208 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
58209 to calling it with the option <option>-bS</option>. There are no security implications in
58214 <title>Use of %f formatting</title>
58216 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
58217 are actually stored in integer variables as 1000 times the load average.
58218 Consequently, their range is limited and so therefore is the length of the
58223 <title>Embedded Exim path</title>
58225 Exim uses its own path name, which is embedded in the code, only when it needs
58226 to re-exec in order to regain root privilege. Therefore, it is not root when it
58227 does so. If some bug allowed the path to get overwritten, it would lead to an
58228 arbitrary program’s being run as exim, not as root.
58232 <title>Use of sprintf()</title>
58234 <indexterm role="concept">
58235 <primary><function>sprintf()</function></primary>
58237 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
58238 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc’d store.
58239 The intermediate formatting is done into a large fixed buffer by a function
58240 that runs through the format string itself, and checks the length of each
58241 conversion before performing it, thus preventing buffer overruns.
58244 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
58245 the output buffer is known to be sufficiently long to contain the converted
58250 <title>Use of debug_printf() and log_write()</title>
58252 Arbitrary strings are passed to both these functions, but they do their
58253 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
58254 the format string itself, and checks the length of each conversion.
58258 <title>Use of strcat() and strcpy()</title>
58260 These are used only in cases where the output buffer is known to be large
58261 enough to hold the result.
58262 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
58267 <chapter id="CHAPspool">
58268 <title>Format of spool files</title>
58270 <indexterm role="concept" id="IIDforspo1" class="startofrange">
58271 <primary>format</primary>
58272 <secondary>spool files</secondary>
58274 <indexterm role="concept" id="IIDforspo2" class="startofrange">
58275 <primary>spool directory</primary>
58276 <secondary>format of files</secondary>
58278 <indexterm role="concept" id="IIDforspo3" class="startofrange">
58279 <primary>spool files</primary>
58280 <secondary>format of</secondary>
58282 <indexterm role="concept">
58283 <primary>spool files</primary>
58284 <secondary>editing</secondary>
58286 A message on Exim’s queue consists of two files, whose names are the message id
58287 followed by -D and -H, respectively. The data portion of the message is kept in
58288 the -D file on its own. The message’s envelope, status, and headers are all
58289 kept in the -H file, whose format is described in this chapter. Each of these
58290 two files contains the final component of its own name as its first line. This
58291 is insurance against disk crashes where the directory is lost but the files
58292 themselves are recoverable.
58295 Some people are tempted into editing -D files in order to modify messages. You
58296 need to be extremely careful if you do this; it is not recommended and you are
58297 on your own if you do it. Here are some of the pitfalls:
58302 You must ensure that Exim does not try to deliver the message while you are
58303 fiddling with it. The safest way is to take out a write lock on the -D file,
58304 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
58305 place, the lock will be retained. If you write a new file and rename it, the
58306 lock will be lost at the instant of rename.
58311 <indexterm role="concept">
58312 <primary><varname>$body_linecount</varname></primary>
58314 If you change the number of lines in the file, the value of
58315 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect. At
58316 present, this value is not used by Exim, but there is no guarantee that this
58317 will always be the case.
58322 If the message is in MIME format, you must take care not to break it.
58327 If the message is cryptographically signed, any change will invalidate the
58333 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
58334 its subdirectories when <option>split_spool_directory</option> is set). These are journal
58335 files, used to record addresses to which the message has been delivered during
58336 the course of a delivery run. At the end of the run, the -H file is updated,
58337 and the -J file is deleted.
58340 <title>Format of the -H file</title>
58342 <indexterm role="concept">
58343 <primary>uid (user id)</primary>
58344 <secondary>in spool file</secondary>
58346 <indexterm role="concept">
58347 <primary>gid (group id)</primary>
58348 <secondary>in spool file</secondary>
58350 The second line of the -H file contains the login name for the uid of the
58351 process that called Exim to read the message, followed by the numerical uid and
58352 gid. For a locally generated message, this is normally the user who sent the
58353 message. For a message received over TCP/IP, it is normally the Exim user.
58356 The third line of the file contains the address of the message’s sender as
58357 transmitted in the envelope, contained in angle brackets. The sender address is
58358 empty for bounce messages. For incoming SMTP mail, the sender address is given
58359 in the MAIL command. For locally generated mail, the sender address is
58360 created by Exim from the login name of the current user and the configured
58361 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
58362 leading <quote>From </quote> line if the caller is trusted, or if the supplied address is
58363 <quote><></quote> or an address that matches <option>untrusted_set_senders</option>.
58366 The fourth line contains two numbers. The first is the time that the message
58367 was received, in the conventional Unix form – the number of seconds since the
58368 start of the epoch. The second number is a count of the number of messages
58369 warning of delayed delivery that have been sent to the sender.
58372 There follow a number of lines starting with a hyphen. These can appear in any
58373 order, and are omitted when not relevant:
58377 <term><option>-acl</option> <<emphasis>number</emphasis>> <<emphasis>length</emphasis>></term>
58379 <para revisionflag="changed">
58380 This item is obsolete, and is not generated from Exim release 4.61 onwards;
58381 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
58382 recognized, to provide backward compatibility. In the old format, a line of
58383 this form is present for every ACL variable that is not empty. The number
58384 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0–9 and
58385 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10–19. The length is the length of
58386 the data string for the variable. The string itself starts at the beginning of
58387 the next line, and is followed by a newline character. It may contain internal
58390 </listitem></varlistentry>
58391 <varlistentry revisionflag="changed">
58392 <term><option>-aclc</option> <<emphasis>number</emphasis>> <<emphasis>length</emphasis>></term>
58394 <para revisionflag="changed">
58395 A line of this form is present for every ACL connection variable that is not
58396 empty. The number identifies the variable. The length is the length of the data
58397 string for the variable. The string itself starts at the beginning of the next
58398 line, and is followed by a newline character. It may contain internal newlines.
58400 </listitem></varlistentry>
58401 <varlistentry revisionflag="changed">
58402 <term><option>-aclm</option> <<emphasis>number</emphasis>> <<emphasis>length</emphasis>></term>
58404 <para revisionflag="changed">
58405 A line of this form is present for every ACL message variable that is not
58406 empty. The number identifies the variable. The length is the length of the data
58407 string for the variable. The string itself starts at the beginning of the next
58408 line, and is followed by a newline character. It may contain internal newlines.
58410 </listitem></varlistentry>
58412 <term><option>-active_hostname</option> <<emphasis>hostname</emphasis>></term>
58415 This is present if, when the message was received over SMTP, the value of
58416 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
58418 </listitem></varlistentry>
58420 <term><option>-allow_unqualified_recipient</option></term>
58423 This is present if unqualified recipient addresses are permitted in header
58424 lines (to stop such addresses from being qualified if rewriting occurs at
58425 transport time). Local messages that were input using <option>-bnq</option> and remote
58426 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
58428 </listitem></varlistentry>
58430 <term><option>-allow_unqualified_sender</option></term>
58433 This is present if unqualified sender addresses are permitted in header lines
58434 (to stop such addresses from being qualified if rewriting occurs at transport
58435 time). Local messages that were input using <option>-bnq</option> and remote messages from
58436 hosts that match <option>sender_unqualified_hosts</option> set this flag.
58438 </listitem></varlistentry>
58440 <term><option>-auth_id</option> <<emphasis>text</emphasis>></term>
58443 The id information for a message received on an authenticated SMTP connection
58444 – the value of the <varname>$authenticated_id</varname> variable.
58446 </listitem></varlistentry>
58448 <term><option>-auth_sender</option> <<emphasis>address</emphasis>></term>
58451 The address of an authenticated sender – the value of the
58452 <varname>$authenticated_sender</varname> variable.
58454 </listitem></varlistentry>
58456 <term><option>-body_linecount</option> <<emphasis>number</emphasis>></term>
58459 This records the number of lines in the body of the message, and is always
58462 </listitem></varlistentry>
58464 <term><option>-body_zerocount</option> <<emphasis>number</emphasis>></term>
58467 This records the number of binary zero bytes in the body of the message, and is
58468 present if the number is greater than zero.
58470 </listitem></varlistentry>
58472 <term><option>-deliver_firsttime</option></term>
58475 This is written when a new message is first added to the spool. When the spool
58476 file is updated after a deferral, it is omitted.
58478 </listitem></varlistentry>
58480 <term><option>-frozen</option> <<emphasis>time</emphasis>></term>
58483 <indexterm role="concept">
58484 <primary>frozen messages</primary>
58485 <secondary>spool data</secondary>
58487 The message is frozen, and the freezing happened at <<emphasis>time</emphasis>>.
58489 </listitem></varlistentry>
58491 <term><option>-helo_name</option> <<emphasis>text</emphasis>></term>
58494 This records the host name as specified by a remote host in a HELO or EHLO
58497 </listitem></varlistentry>
58499 <term><option>-host_address</option> <<emphasis>address</emphasis>>.<<emphasis>port</emphasis>></term>
58502 This records the IP address of the host from which the message was received and
58503 the remote port number that was used. It is omitted for locally generated
58506 </listitem></varlistentry>
58508 <term><option>-host_auth</option> <<emphasis>text</emphasis>></term>
58511 If the message was received on an authenticated SMTP connection, this records
58512 the name of the authenticator – the value of the
58513 <varname>$sender_host_authenticated</varname> variable.
58515 </listitem></varlistentry>
58517 <term><option>-host_lookup_failed</option></term>
58520 This is present if an attempt to look up the sending host’s name from its IP
58521 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
58523 </listitem></varlistentry>
58525 <term><option>-host_name</option> <<emphasis>text</emphasis>></term>
58528 <indexterm role="concept">
58529 <primary>reverse DNS lookup</primary>
58531 <indexterm role="concept">
58532 <primary>DNS</primary>
58533 <secondary>reverse lookup</secondary>
58535 This records the name of the remote host from which the message was received,
58536 if the host name was looked up from the IP address when the message was being
58537 received. It is not present if no reverse lookup was done.
58539 </listitem></varlistentry>
58541 <term><option>-ident</option> <<emphasis>text</emphasis>></term>
58544 For locally submitted messages, this records the login of the originating user,
58545 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
58546 ident value. For messages received over TCP/IP, this records the ident string
58547 supplied by the remote host, if any.
58549 </listitem></varlistentry>
58551 <term><option>-interface_address</option> <<emphasis>address</emphasis>>.<<emphasis>port</emphasis>></term>
58554 This records the IP address of the local interface and the port number through
58555 which a message was received from a remote host. It is omitted for locally
58556 generated messages.
58558 </listitem></varlistentry>
58560 <term><option>-local</option></term>
58563 The message is from a local sender.
58565 </listitem></varlistentry>
58567 <term><option>-localerror</option></term>
58570 The message is a locally-generated bounce message.
58572 </listitem></varlistentry>
58574 <term><option>-local_scan</option> <<emphasis>string</emphasis>></term>
58577 This records the data string that was returned by the <function>local_scan()</function> function
58578 when the message was received – the value of the <varname>$local_scan_data</varname>
58579 variable. It is omitted if no data was returned.
58581 </listitem></varlistentry>
58583 <term><option>-manual_thaw</option></term>
58586 The message was frozen but has been thawed manually, that is, by an explicit
58587 Exim command rather than via the auto-thaw process.
58589 </listitem></varlistentry>
58591 <term><option>-N</option></term>
58594 A testing delivery process was started using the <option>-N</option> option to suppress any
58595 actual deliveries, but delivery was deferred. At any further delivery attempts,
58596 <option>-N</option> is assumed.
58598 </listitem></varlistentry>
58600 <term><option>-received_protocol</option></term>
58603 This records the value of the <varname>$received_protocol</varname> variable, which contains
58604 the name of the protocol by which the message was received.
58606 </listitem></varlistentry>
58608 <term><option>-sender_set_untrusted</option></term>
58611 The envelope sender of this message was set by an untrusted local caller (used
58612 to ensure that the caller is displayed in queue listings).
58614 </listitem></varlistentry>
58616 <term><option>-spam_score_int</option> <<emphasis>number</emphasis>></term>
58619 If a message was scanned by SpamAssassin, this is present. It records the value
58620 of <varname>$spam_score_int</varname>.
58622 </listitem></varlistentry>
58624 <term><option>-tls_certificate_verified</option></term>
58627 A TLS certificate was received from the client that sent this message, and the
58628 certificate was verified by the server.
58630 </listitem></varlistentry>
58632 <term><option>-tls_cipher</option> <<emphasis>cipher name</emphasis>></term>
58635 When the message was received over an encrypted connection, this records the
58636 name of the cipher suite that was used.
58638 </listitem></varlistentry>
58640 <term><option>-tls_peerdn</option> <<emphasis>peer DN</emphasis>></term>
58643 When the message was received over an encrypted connection, and a certificate
58644 was received from the client, this records the Distinguished Name from that
58647 </listitem></varlistentry>
58650 Following the options there is a list of those addresses to which the message
58651 is not to be delivered. This set of addresses is initialized from the command
58652 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
58653 is set; otherwise it starts out empty. Whenever a successful delivery is made,
58654 the address is added to this set. The addresses are kept internally as a
58655 balanced binary tree, and it is a representation of that tree which is written
58656 to the spool file. If an address is expanded via an alias or forward file, the
58657 original address is added to the tree when deliveries to all its child
58658 addresses are complete.
58661 If the tree is empty, there is a single line in the spool file containing just
58662 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
58663 Y or N, followed by an address. The address is the value for the node of the
58664 tree, and the letters indicate whether the node has a left branch and/or a
58665 right branch attached to it, respectively. If branches exist, they immediately
58666 follow. Here is an example of a three-node tree:
58668 <literallayout class="monospaced">
58669 YY darcy@austen.fict.example
58670 NN alice@wonderland.fict.example
58671 NN editor@thesaurus.ref.example
58674 After the non-recipients tree, there is a list of the message’s recipients.
58675 This is a simple list, preceded by a count. It includes all the original
58676 recipients of the message, including those to whom the message has already been
58677 delivered. In the simplest case, the list contains one address per line. For
58680 <literallayout class="monospaced">
58682 editor@thesaurus.ref.example
58683 darcy@austen.fict.example
58685 alice@wonderland.fict.example
58688 However, when a child address has been added to the top-level addresses as a
58689 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
58690 line is of the following form:
58693 <<emphasis>top-level address</emphasis>> <<emphasis>errors_to address</emphasis>> <<emphasis>length</emphasis>>,<<emphasis>parent number</emphasis>>#<<emphasis>flag bits</emphasis>>
58696 The 01 flag bit indicates the presence of the three other fields that follow
58697 the top-level address. Other bits may be used in future to support additional
58698 fields. The <<emphasis>parent number</emphasis>> is the offset in the recipients list of the
58699 original parent of the <quote>one time</quote> address. The first two fields are the
58700 envelope sender that is associated with this address and its length. If the
58701 length is zero, there is no special envelope sender (there are then two space
58702 characters in the line). A non-empty field can arise from a <command>redirect</command> router
58703 that has an <option>errors_to</option> setting.
58706 A blank line separates the envelope and status information from the headers
58707 which follow. A header may occupy several lines of the file, and to save effort
58708 when reading it in, each header is preceded by a number and an identifying
58709 character. The number is the number of characters in the header, including any
58710 embedded newlines and the terminating newline. The character is one of the
58713 <informaltable frame="none">
58714 <tgroup cols="2" colsep="0" rowsep="0">
58715 <colspec colwidth="50pt" align="left"/>
58716 <colspec colwidth="260pt" align="left"/>
58719 <entry><<emphasis>blank</emphasis>></entry>
58720 <entry>header in which Exim has no special interest</entry>
58723 <entry><literal>B</literal></entry>
58724 <entry><emphasis>Bcc:</emphasis> header</entry>
58727 <entry><literal>C</literal></entry>
58728 <entry><emphasis>Cc:</emphasis> header</entry>
58731 <entry><literal>F</literal></entry>
58732 <entry><emphasis>From:</emphasis> header</entry>
58735 <entry><literal>I</literal></entry>
58736 <entry><emphasis>Message-id:</emphasis> header</entry>
58739 <entry><literal>P</literal></entry>
58740 <entry><emphasis>Received:</emphasis> header – P for <quote>postmark</quote></entry>
58743 <entry><literal>R</literal></entry>
58744 <entry><emphasis>Reply-To:</emphasis> header</entry>
58747 <entry><literal>S</literal></entry>
58748 <entry><emphasis>Sender:</emphasis> header</entry>
58751 <entry><literal>T</literal></entry>
58752 <entry><emphasis>To:</emphasis> header</entry>
58755 <entry><literal>*</literal></entry>
58756 <entry>replaced or deleted header</entry>
58762 Deleted or replaced (rewritten) headers remain in the spool file for debugging
58763 purposes. They are not transmitted when the message is delivered. Here is a
58764 typical set of headers:
58766 <literallayout class="monospaced">
58767 111P Received: by hobbit.fict.example with local (Exim 4.00)
58768 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
58769 049 Message-Id: <E14y9EI-00026G-00@hobbit.fict.example>
58770 038* X-rewrote-sender: bb@hobbit.fict.example
58771 042* From: Bilbo Baggins <bb@hobbit.fict.example>
58772 049F From: Bilbo Baggins <B.Baggins@hobbit.fict.example>
58773 099* To: alice@wonderland.fict.example, rdo@foundation,
58774 darcy@austen.fict.example, editor@thesaurus.ref.example
58775 104T To: alice@wonderland.fict.example, rdo@foundation.example,
58776 darcy@austen.fict.example, editor@thesaurus.ref.example
58777 038 Date: Fri, 11 May 2001 10:28:59 +0100
58780 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
58781 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
58782 unqualified domain <emphasis>foundation</emphasis>.
58783 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
58784 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
58785 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
58791 <title>Adding new drivers or lookup types</title>
58792 <titleabbrev>Adding drivers or lookups</titleabbrev>
58794 <indexterm role="concept">
58795 <primary>adding drivers</primary>
58797 <indexterm role="concept">
58798 <primary>new drivers</primary>
58799 <secondary>adding</secondary>
58801 <indexterm role="concept">
58802 <primary>drivers</primary>
58803 <secondary>adding new</secondary>
58805 The following actions have to be taken in order to add a new router, transport,
58806 authenticator, or lookup type to Exim:
58808 <orderedlist numeration="arabic">
58811 Choose a name for the driver or lookup type that does not conflict with any
58812 existing name; I will use <quote>newdriver</quote> in what follows.
58817 Add to <filename>src/EDITME</filename> the line:
58820 <<emphasis>type</emphasis>><literal>_NEWDRIVER=yes</literal>
58823 where <<emphasis>type</emphasis>> is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
58824 code is not to be included in the binary by default, comment this line out. You
58825 should also add any relevant comments about the driver or lookup type.
58830 Add to <filename>src/config.h.defaults</filename> the line:
58832 <literallayout class="monospaced">
58833 #define <type>_NEWDRIVER
58838 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
58839 and create a table entry as is done for all the other drivers and lookup types.
58844 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
58845 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
58846 driver or lookup type and add it to the definition of OBJ.
58851 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
58852 <filename>src</filename>.
58857 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
58858 as for other drivers and lookups.
58863 Then all you need to do is write the code! A good way to start is to make a
58864 proforma by copying an existing module of the same type, globally changing all
58865 occurrences of the name, and cutting out most of the code. Note that any
58866 options you create must be listed in alphabetical order, because the tables are
58867 searched using a binary chop procedure.
58870 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
58871 the interface that is expected.
58875 <index role="option">
58876 <title>Option index</title>
58879 <index role="concept">
58880 <title>Concept index</title>