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 toc_chapter_blanks="yes,yes"
6 table_warn_soft_overflow="no"
9 <title>Specification of the Exim Mail Transfer Agent</title>
10 <titleabbrev>The Exim MTA</titleabbrev>
11 <date>11 December 2006</date>
12 <author><firstname>Philip</firstname><surname>Hazel</surname></author>
13 <authorinitials>PH</authorinitials>
14 <affiliation><orgname>University of Cambridge Computing Service</orgname></affiliation>
15 <address>New Museums Site, Pembroke Street, Cambridge CB2 3QH, England</address>
16 <revhistory><revision>
17 <revnumber>4.66</revnumber>
18 <date>11 December 2006</date>
19 <authorinitials>PH</authorinitials>
20 </revision></revhistory>
21 <copyright><year>2006</year><holder>University of Cambridge</holder></copyright>
24 <title>Introduction</title>
26 <indexterm role="concept">
27 <primary>$1, $2, etc.</primary>
28 <see><emphasis>numerical variables</emphasis></see>
30 <indexterm role="concept">
31 <primary>address</primary>
32 <secondary>rewriting</secondary>
33 <see><emphasis>rewriting</emphasis></see>
35 <indexterm role="concept">
36 <primary>Bounce Address Tag Validation</primary>
37 <see><emphasis>BATV</emphasis></see>
39 <indexterm role="concept">
40 <primary>Client SMTP Authorization</primary>
41 <see><emphasis>CSA</emphasis></see>
43 <indexterm role="concept">
44 <primary>CR character</primary>
45 <see><emphasis>carriage return</emphasis></see>
47 <indexterm role="concept">
48 <primary>CRL</primary>
49 <see><emphasis>certificate revocation list</emphasis></see>
51 <indexterm role="concept">
52 <primary>delivery</primary>
53 <secondary>failure report</secondary>
54 <see><emphasis>bounce message</emphasis></see>
56 <indexterm role="concept">
57 <primary>dialup</primary>
58 <see><emphasis>intermittently connected hosts</emphasis></see>
60 <indexterm role="concept">
61 <primary>exiscan</primary>
62 <see><emphasis>content scanning</emphasis></see>
64 <indexterm role="concept">
65 <primary>failover</primary>
66 <see><emphasis>fallback</emphasis></see>
68 <indexterm role="concept">
69 <primary>fallover</primary>
70 <see><emphasis>fallback</emphasis></see>
72 <indexterm role="concept">
73 <primary>filter</primary>
74 <secondary>Sieve</secondary>
75 <see><emphasis>Sieve filter</emphasis></see>
77 <indexterm role="concept">
78 <primary>ident</primary>
79 <see><emphasis>RFC 1413</emphasis></see>
81 <indexterm role="concept">
82 <primary>LF character</primary>
83 <see><emphasis>linefeed</emphasis></see>
85 <indexterm role="concept">
86 <primary>maximum</primary>
87 <see><emphasis>limit</emphasis></see>
89 <indexterm role="concept">
90 <primary>monitor</primary>
91 <see><emphasis>Exim monitor</emphasis></see>
93 <indexterm role="concept">
94 <primary>no_<emphasis>xxx</emphasis></primary>
95 <see>entry for xxx</see>
97 <indexterm role="concept">
98 <primary>NUL</primary>
99 <see><emphasis>binary zero</emphasis></see>
101 <indexterm role="concept">
102 <primary>passwd file</primary>
103 <see><emphasis>/etc/passwd</emphasis></see>
105 <indexterm role="concept">
106 <primary>process id</primary>
107 <see><emphasis>pid</emphasis></see>
109 <indexterm role="concept">
110 <primary>RBL</primary>
111 <see><emphasis>DNS list</emphasis></see>
113 <indexterm role="concept">
114 <primary>redirection</primary>
115 <see><emphasis>address redirection</emphasis></see>
117 <indexterm role="concept">
118 <primary>return path</primary>
119 <seealso><emphasis>envelope sender</emphasis></seealso>
121 <indexterm role="concept">
122 <primary>scanning</primary>
123 <see><emphasis>content scanning</emphasis></see>
125 <indexterm role="concept">
126 <primary>SSL</primary>
127 <see><emphasis>TLS</emphasis></see>
129 <indexterm role="concept">
130 <primary>string</primary>
131 <secondary>expansion</secondary>
132 <see><emphasis>expansion</emphasis></see>
134 <indexterm role="concept">
135 <primary>top bit</primary>
136 <see><emphasis>8-bit characters</emphasis></see>
138 <indexterm role="concept">
139 <primary>variables</primary>
140 <see><emphasis>expansion, variables</emphasis></see>
142 <indexterm role="concept">
143 <primary>zero, binary</primary>
144 <see><emphasis>binary zero</emphasis></see>
148 Exim is a mail transfer agent (MTA) for hosts that are running Unix or
149 Unix-like operating systems. It was designed on the assumption that it would be
150 run on hosts that are permanently connected to the Internet. However, it can be
151 used on intermittently connected hosts with suitable configuration adjustments.
154 Configuration files currently exist for the following operating systems: AIX,
155 BSD/OS (aka BSDI), Darwin (Mac OS X), DGUX, Dragonfly, FreeBSD, GNU/Hurd,
156 GNU/Linux, HI-OSF (Hitachi), HI-UX, HP-UX, IRIX, MIPS RISCOS, NetBSD, OpenBSD,
157 OpenUNIX, QNX, SCO, SCO SVR4.2 (aka UNIX-SV), Solaris (aka SunOS5), SunOS4,
158 Tru64-Unix (formerly Digital UNIX, formerly DEC-OSF1), Ultrix, and Unixware.
159 Some of these operating systems are no longer current and cannot easily be
160 tested, so the configuration files may no longer work in practice.
163 There are also configuration files for compiling Exim in the Cygwin environment
164 that can be installed on systems running Windows. However, this document does
165 not contain any information about running Exim in the Cygwin environment.
168 The terms and conditions for the use and distribution of Exim are contained in
169 the file <filename>NOTICE</filename>. Exim is distributed under the terms of the GNU General
170 Public Licence, a copy of which may be found in the file <filename>LICENCE</filename>.
173 The use, supply or promotion of Exim for the purpose of sending bulk,
174 unsolicited electronic mail is incompatible with the basic aims of the program,
175 which revolve around the free provision of a service that enhances the quality
176 of personal communications. The author of Exim regards indiscriminate
177 mass-mailing as an antisocial, irresponsible abuse of the Internet.
180 Exim owes a great deal to Smail 3 and its author, Ron Karr. Without the
181 experience of running and working on the Smail 3 code, I could never have
182 contemplated starting to write a new MTA. Many of the ideas and user interfaces
183 were originally taken from Smail 3, though the actual code of Exim is entirely
184 new, and has developed far beyond the initial concept.
187 Many people, both in Cambridge and around the world, have contributed to the
188 development and the testing of Exim, and to porting it to various operating
189 systems. I am grateful to them all. The distribution now contains a file called
190 <filename>ACKNOWLEDGMENTS</filename>, in which I have started recording the names of
194 <title>Exim documentation</title>
195 <para revisionflag="changed">
196 <indexterm role="concept">
197 <primary>documentation</primary>
199 This edition of the Exim specification applies to version 4.64 of Exim.
200 Substantive changes from the 4.63 edition are marked in some
201 renditions of the document; this paragraph is so marked if the rendition is
202 capable of showing a change indicator.
205 This document is very much a reference manual; it is not a tutorial. The reader
206 is expected to have some familiarity with the SMTP mail transfer protocol and
207 with general Unix system administration. Although there are some discussions
208 and examples in places, the information is mostly organized in a way that makes
209 it easy to look up, rather than in a natural order for sequential reading.
210 Furthermore, the manual aims to cover every aspect of Exim in detail, including
211 a number of rarely-used, special-purpose features that are unlikely to be of
215 <indexterm role="concept">
216 <primary>books about Exim</primary>
218 An <quote>easier</quote> discussion of Exim which provides more in-depth explanatory,
219 introductory, and tutorial material can be found in a book entitled <emphasis>The Exim
220 SMTP Mail Server</emphasis>, published by UIT Cambridge
221 (<emphasis role="bold"><ulink url="http://www.uit.co.uk/exim-book/">http://www.uit.co.uk/exim-book/</ulink></emphasis>).
224 This book also contains a chapter that gives a general introduction to SMTP and
225 Internet mail. Inevitably, however, the book is unlikely to be fully up-to-date
226 with the latest release of Exim. (Note that the earlier book about Exim,
227 published by O’Reilly, covers Exim 3, and many things have changed in Exim 4.)
230 <indexterm role="concept">
231 <primary>Debian</primary>
232 <secondary>information sources</secondary>
234 If you are using a Debian distribution of Exim, you will find information about
235 Debian-specific features in the file
238 <filename>/usr/share/doc/exim4-base/README.Debian</filename>
241 The command <command>man update-exim.conf</command> is another source of Debian-specific
245 <indexterm role="concept">
246 <primary><filename>doc/NewStuff</filename></primary>
248 <indexterm role="concept">
249 <primary><filename>doc/ChangeLog</filename></primary>
251 <indexterm role="concept">
252 <primary>change log</primary>
254 As the program develops, there may be features in newer versions that have not
255 yet made it into this document, which is updated only when the most significant
256 digit of the fractional part of the version number changes. Specifications of
257 new features that are not yet in this manual are placed in the file
258 <filename>doc/NewStuff</filename> in the Exim distribution.
261 Some features may be classified as <quote>experimental</quote>. These may change
262 incompatibly while they are developing, or even be withdrawn. For this reason,
263 they are not documented in this manual. Information about experimental features
264 can be found in the file <filename>doc/experimental.txt</filename>.
267 All changes to the program (whether new features, bug fixes, or other kinds of
268 change) are noted briefly in the file called <filename>doc/ChangeLog</filename>.
271 <indexterm role="concept">
272 <primary><filename>doc/spec.txt</filename></primary>
274 This specification itself is available as an ASCII file in <filename>doc/spec.txt</filename> so
275 that it can easily be searched with a text editor. Other files in the <filename>doc</filename>
278 <informaltable frame="none">
279 <tgroup cols="2" colsep="0" rowsep="0">
280 <colspec colwidth="100pt" align="left"/>
281 <colspec colwidth="254pt" align="left"/>
284 <entry><filename>OptionLists.txt</filename></entry>
285 <entry>list of all options in alphabetical order</entry>
288 <entry><filename>dbm.discuss.txt</filename></entry>
289 <entry>discussion about DBM libraries</entry>
292 <entry><filename>exim.8</filename></entry>
293 <entry>a man page of Exim’s command line options</entry>
296 <entry><filename>experimental.txt</filename></entry>
297 <entry>documentation of experimental features</entry>
300 <entry><filename>filter.txt</filename></entry>
301 <entry>specification of the filter language</entry>
304 <entry><filename>pcrepattern.txt</filename></entry>
305 <entry>specification of PCRE regular expressions</entry>
308 <entry><filename>pcretest.txt</filename></entry>
309 <entry>specification of the PCRE testing program</entry>
312 <entry><filename>Exim3.upgrade</filename></entry>
313 <entry>upgrade notes from release 2 to release 3</entry>
316 <entry><filename>Exim4.upgrade</filename></entry>
317 <entry>upgrade notes from release 3 to release 4</entry>
323 The main specification and the specification of the filtering language are also
324 available in other formats (HTML, PostScript, PDF, and Texinfo). Section
325 <xref linkend="SECTavail"/> below tells you how to get hold of these.
329 <title>FTP and web sites</title>
331 <indexterm role="concept">
332 <primary>web site</primary>
334 <indexterm role="concept">
335 <primary>FTP site</primary>
337 The primary site for Exim source distributions is currently the University of
338 Cambridge’s FTP site, whose contents are described in <emphasis>Where to find the Exim
339 distribution</emphasis> below. In addition, there is a web site and an FTP site at
340 <option>exim.org</option>. These are now also hosted at the University of Cambridge. The
341 <option>exim.org</option> site was previously hosted for a number of years by Energis
342 Squared, formerly Planet Online Ltd, whose support I gratefully acknowledge.
345 <indexterm role="concept">
346 <primary>wiki</primary>
348 <indexterm role="concept">
349 <primary>FAQ</primary>
351 As well as Exim distribution tar files, the Exim web site contains a number of
352 differently formatted versions of the documentation, including the FAQ in both
353 text and HTML formats. The HTML version comes with a keyword-in-context index.
354 A recent addition to the online information is the Exim wiki
355 (<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
356 for Exim users to contribute examples, tips, and know-how for the benefit of
361 <title>Mailing lists</title>
363 <indexterm role="concept">
364 <primary>mailing lists</primary>
365 <secondary>for Exim users</secondary>
367 The following are the three main Exim mailing lists:
369 <informaltable frame="none">
370 <tgroup cols="2" colsep="0" rowsep="0">
371 <colspec colwidth="140pt" align="left"/>
372 <colspec colwidth="254pt" align="left"/>
375 <entry><emphasis>exim-users@exim.org</emphasis></entry>
376 <entry>general discussion list</entry>
379 <entry><emphasis>exim-dev@exim.org</emphasis></entry>
380 <entry>discussion of bugs, enhancements, etc.</entry>
383 <entry><emphasis>exim-announce@exim.org</emphasis></entry>
384 <entry>moderated, low volume announcements list</entry>
390 You can subscribe to these lists, change your existing subscriptions, and view
391 or search the archives via the mailing lists link on the Exim home page.
392 <indexterm role="concept">
393 <primary>Debian</primary>
394 <secondary>mailing list for</secondary>
396 If you are using a Debian distribution of Exim, you may wish to subscribe to
397 the Debian-specific mailing list <emphasis>pkg-exim4-users@lists.alioth.debian.org</emphasis>
401 <emphasis role="bold"><ulink url="http://lists.alioth.debian.org/mailman/listinfo/pkg-exim4-users">http://lists.alioth.debian.org/mailman/listinfo/pkg-exim4-users</ulink></emphasis>
404 Please ask Debian-specific questions on this list and not on the general Exim
409 <title>Exim training</title>
411 <indexterm role="concept">
412 <primary>training courses</primary>
414 From time to time (approximately annually at the time of writing), training
415 courses are run by the author of Exim in Cambridge, UK. Details of any
416 forthcoming courses can be found on the web site
417 <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>.
421 <title>Bug reports</title>
423 <indexterm role="concept">
424 <primary>bug reports</primary>
426 <indexterm role="concept">
427 <primary>reporting bugs</primary>
429 Reports of obvious bugs should be emailed to <emphasis>bugs@exim.org</emphasis>. However, if you
430 are unsure whether some behaviour is a bug or not, the best thing to do is to
431 post a message to the <emphasis>exim-dev</emphasis> mailing list and have it discussed.
434 <section id="SECTavail">
435 <title>Where to find the Exim distribution</title>
437 <indexterm role="concept">
438 <primary>FTP site</primary>
440 <indexterm role="concept">
441 <primary>distribution</primary>
442 <secondary>ftp site</secondary>
444 The master ftp site for the Exim distribution is
447 <emphasis role="bold">ftp://ftp.csx.cam.ac.uk/pub/software/email/exim</emphasis>
453 <emphasis role="bold">ftp://ftp.exim.org/pub/exim</emphasis>
456 The file references that follow are relative to the <filename>exim</filename> directories at
457 these sites. There are now quite a number of independent mirror sites around
458 the world. Those that I know about are listed in the file called <filename>Mirrors</filename>.
461 Within the <filename>exim</filename> directory there are subdirectories called <filename>exim3</filename> (for
462 previous Exim 3 distributions), <filename>exim4</filename> (for the latest Exim 4
463 distributions), and <filename>Testing</filename> for testing versions. In the <filename>exim4</filename>
464 subdirectory, the current release can always be found in files called
467 <filename>exim-n.nn.tar.gz</filename>
468 <filename>exim-n.nn.tar.bz2</filename>
471 where <emphasis>n.nn</emphasis> is the highest such version number in the directory. The two
472 files contain identical data; the only difference is the type of compression.
473 The <filename>.bz2</filename> file is usually a lot smaller than the <filename>.gz</filename> file.
476 <indexterm role="concept">
477 <primary>distribution</primary>
478 <secondary>signing details</secondary>
480 <indexterm role="concept">
481 <primary>distribution</primary>
482 <secondary>public key</secondary>
484 <indexterm role="concept">
485 <primary>public key for signed distribution</primary>
487 The distributions are currently signed with Philip Hazel’s GPG key. The
488 corresponding public key is available from a number of keyservers, and there is
489 also a copy in the file <filename>Public-Key</filename>. The signatures for the tar bundles are
493 <filename>exim-n.nn.tar.gz.sig</filename>
494 <filename>exim-n.nn.tar.bz2.sig</filename>
497 For each released version, the log of changes is made separately available in a
498 separate file in the directory <filename>ChangeLogs</filename> so that it is possible to
499 find out what has changed without having to download the entire distribution.
502 <indexterm role="concept">
503 <primary>documentation</primary>
504 <secondary>available formats</secondary>
506 The main distribution contains ASCII versions of this specification and other
507 documentation; other formats of the documents are available in separate files
508 inside the <filename>exim4</filename> directory of the FTP site:
511 <filename>exim-html-n.nn.tar.gz</filename>
512 <filename>exim-pdf-n.nn.tar.gz</filename>
513 <filename>exim-postscript-n.nn.tar.gz</filename>
514 <filename>exim-texinfo-n.nn.tar.gz</filename>
517 These tar files contain only the <filename>doc</filename> directory, not the complete
518 distribution, and are also available in <filename>.bz2</filename> as well as <filename>.gz</filename> forms.
519 <indexterm role="concept">
520 <primary>FAQ</primary>
522 The FAQ is available for downloading in two different formats in these files:
525 <filename>exim4/FAQ.txt.gz</filename>
526 <filename>exim4/FAQ.html.tar.gz</filename>
529 The first of these is a single ASCII file that can be searched with a text
530 editor. The second is a directory of HTML files, normally accessed by starting
531 at <filename>index.html</filename>. The HTML version of the FAQ (which is also included in the
532 HTML documentation tarbundle) includes a keyword-in-context index, which is
533 often the most convenient way of finding your way around.
537 <title>Wish list</title>
539 <indexterm role="concept">
540 <primary>wish list</primary>
542 A wish list is maintained, containing ideas for new features that have been
543 submitted. This used to be a single file that from time to time was exported to
544 the ftp site into the file <filename>exim4/WishList</filename>. However, it has now been
545 imported into Exim’s Bugzilla data.
549 <title>Contributed material</title>
551 <indexterm role="concept">
552 <primary>contributed material</primary>
554 At the ftp site, there is a directory called <filename>Contrib</filename> that contains
555 miscellaneous files contributed to the Exim community by Exim users. There is
556 also a collection of contributed configuration examples in
557 <filename>exim4/config.samples.tar.gz</filename>. These samples are referenced from the FAQ.
561 <title>Limitations</title>
565 <indexterm role="concept">
566 <primary>limitations of Exim</primary>
568 <indexterm role="concept">
569 <primary>bang paths</primary>
570 <secondary>not handled by Exim</secondary>
572 Exim is designed for use as an Internet MTA, and therefore handles addresses in
573 RFC 2822 domain format only. It cannot handle UUCP <quote>bang paths</quote>, though
574 simple two-component bang paths can be converted by a straightforward rewriting
575 configuration. This restriction does not prevent Exim from being interfaced to
576 UUCP as a transport mechanism, provided that domain addresses are used.
581 <indexterm role="concept">
582 <primary>domainless addresses</primary>
584 <indexterm role="concept">
585 <primary>address</primary>
586 <secondary>without domain</secondary>
588 Exim insists that every address it handles has a domain attached. For incoming
589 local messages, domainless addresses are automatically qualified with a
590 configured domain value. Configuration options specify from which remote
591 systems unqualified addresses are acceptable. These are then qualified on
597 <indexterm role="concept">
598 <primary>transport</primary>
599 <secondary>external</secondary>
601 <indexterm role="concept">
602 <primary>external transports</primary>
604 The only external transport mechanisms that are currently implemented are SMTP
605 and LMTP over a TCP/IP network (including support for IPv6). However, a pipe
606 transport is available, and there are facilities for writing messages to files
607 and pipes, optionally in <emphasis>batched SMTP</emphasis> format; these facilities can be used
608 to send messages to other transport mechanisms such as UUCP, provided they can
609 handle domain-style addresses. Batched SMTP input is also catered for.
614 Exim is not designed for storing mail for dial-in hosts. When the volumes of
615 such mail are large, it is better to get the messages <quote>delivered</quote> into files
616 (that is, off Exim’s queue) and subsequently passed on to the dial-in hosts by
622 Although Exim does have basic facilities for scanning incoming messages, these
623 are not comprehensive enough to do full virus or spam scanning. Such operations
624 are best carried out using additional specialized software packages. If you
625 compile Exim with the content-scanning extension, straightforward interfaces to
626 a number of common scanners are provided.
632 <title>Run time configuration</title>
634 Exim’s run time configuration is held in a single text file that is divided
635 into a number of sections. The entries in this file consist of keywords and
636 values, in the style of Smail 3 configuration files. A default configuration
637 file which is suitable for simple online installations is provided in the
638 distribution, and is described in chapter <xref linkend="CHAPdefconfil"/> below.
642 <title>Calling interface</title>
644 <indexterm role="concept">
645 <primary>Sendmail compatibility</primary>
646 <secondary>command line interface</secondary>
648 Like many MTAs, Exim has adopted the Sendmail command line interface so that it
649 can be a straight replacement for <filename>/usr/lib/sendmail</filename> or
650 <filename>/usr/sbin/sendmail</filename> when sending mail, but you do not need to know anything
651 about Sendmail in order to run Exim. For actions other than sending messages,
652 Sendmail-compatible options also exist, but those that produce output (for
653 example, <option>-bp</option>, which lists the messages on the queue) do so in Exim’s own
654 format. There are also some additional options that are compatible with Smail
655 3, and some further options that are new to Exim. Chapter <xref linkend="CHAPcommandline"/>
656 documents all Exim’s command line options. This information is automatically
657 made into the man page that forms part of the Exim distribution.
660 Control of messages on the queue can be done via certain privileged command
661 line options. There is also an optional monitor program called <emphasis>eximon</emphasis>,
662 which displays current information in an X window, and which contains a menu
663 interface to Exim’s command line administration options.
667 <title>Terminology</title>
669 <indexterm role="concept">
670 <primary>terminology definitions</primary>
672 <indexterm role="concept">
673 <primary>body of message</primary>
674 <secondary>definition of</secondary>
676 The <emphasis>body</emphasis> of a message is the actual data that the sender wants to transmit.
677 It is the last part of a message, and is separated from the <emphasis>header</emphasis> (see
678 below) by a blank line.
681 <indexterm role="concept">
682 <primary>bounce message</primary>
683 <secondary>definition of</secondary>
685 When a message cannot be delivered, it is normally returned to the sender in a
686 delivery failure message or a <quote>non-delivery report</quote> (NDR). The term
687 <emphasis>bounce</emphasis> is commonly used for this action, and the error reports are often
688 called <emphasis>bounce messages</emphasis>. This is a convenient shorthand for <quote>delivery
689 failure error report</quote>. Such messages have an empty sender address in the
690 message’s <emphasis>envelope</emphasis> (see below) to ensure that they cannot themselves give
691 rise to further bounce messages.
694 The term <emphasis>default</emphasis> appears frequently in this manual. It is used to qualify a
695 value which is used in the absence of any setting in the configuration. It may
696 also qualify an action which is taken unless a configuration setting specifies
700 The term <emphasis>defer</emphasis> is used when the delivery of a message to a specific
701 destination cannot immediately take place for some reason (a remote host may be
702 down, or a user’s local mailbox may be full). Such deliveries are <emphasis>deferred</emphasis>
706 The word <emphasis>domain</emphasis> is sometimes used to mean all but the first component of a
707 host’s name. It is <emphasis>not</emphasis> used in that sense here, where it normally refers to
708 the part of an email address following the @ sign.
711 <indexterm role="concept">
712 <primary>envelope</primary>
713 <secondary>definition of</secondary>
715 <indexterm role="concept">
716 <primary>sender</primary>
717 <secondary>definition of</secondary>
719 A message in transit has an associated <emphasis>envelope</emphasis>, as well as a header and a
720 body. The envelope contains a sender address (to which bounce messages should
721 be delivered), and any number of recipient addresses. References to the
722 sender or the recipients of a message usually mean the addresses in the
723 envelope. An MTA uses these addresses for delivery, and for returning bounce
724 messages, not the addresses that appear in the header lines.
727 <indexterm role="concept">
728 <primary>message header</primary>
729 <secondary>definition of</secondary>
731 <indexterm role="concept">
732 <primary>header section</primary>
733 <secondary>definition of</secondary>
735 The <emphasis>header</emphasis> of a message is the first part of a message’s text, consisting
736 of a number of lines, each of which has a name such as <emphasis>From:</emphasis>, <emphasis>To:</emphasis>,
737 <emphasis>Subject:</emphasis>, etc. Long header lines can be split over several text lines by
738 indenting the continuations. The header is separated from the body by a blank
742 <indexterm role="concept">
743 <primary>local part</primary>
744 <secondary>definition of</secondary>
746 <indexterm role="concept">
747 <primary>domain</primary>
748 <secondary>definition of</secondary>
750 The term <emphasis>local part</emphasis>, which is taken from RFC 2822, is used to refer to that
751 part of an email address that precedes the @ sign. The part that follows the
752 @ sign is called the <emphasis>domain</emphasis> or <emphasis>mail domain</emphasis>.
755 <indexterm role="concept">
756 <primary>local delivery</primary>
757 <secondary>definition of</secondary>
759 <indexterm role="concept">
760 <primary>remote delivery</primary>
761 <secondary>definition of</secondary>
763 The terms <emphasis>local delivery</emphasis> and <emphasis>remote delivery</emphasis> are used to distinguish
764 delivery to a file or a pipe on the local host from delivery by SMTP over
765 TCP/IP to another host. As far as Exim is concerned, all hosts other than the
766 host it is running on are <emphasis>remote</emphasis>.
769 <indexterm role="concept">
770 <primary>return path</primary>
771 <secondary>definition of</secondary>
773 <emphasis>Return path</emphasis> is another name that is used for the sender address in a
774 message’s envelope.
777 <indexterm role="concept">
778 <primary>queue</primary>
779 <secondary>definition of</secondary>
781 The term <emphasis>queue</emphasis> is used to refer to the set of messages awaiting delivery,
782 because this term is in widespread use in the context of MTAs. However, in
783 Exim’s case the reality is more like a pool than a queue, because there is
784 normally no ordering of waiting messages.
787 <indexterm role="concept">
788 <primary>queue runner</primary>
789 <secondary>definition of</secondary>
791 The term <emphasis>queue runner</emphasis> is used to describe a process that scans the queue
792 and attempts to deliver those messages whose retry times have come. This term
793 is used by other MTAs, and also relates to the command <option>runq</option>, but in Exim
794 the waiting messages are normally processed in an unpredictable order.
797 <indexterm role="concept">
798 <primary>spool directory</primary>
799 <secondary>definition of</secondary>
801 The term <emphasis>spool directory</emphasis> is used for a directory in which Exim keeps the
802 messages on its queue – that is, those that it is in the process of
803 delivering. This should not be confused with the directory in which local
804 mailboxes are stored, which is called a <quote>spool directory</quote> by some people. In
805 the Exim documentation, <quote>spool</quote> is always used in the first sense.
811 <title>Incorporated code</title>
813 <indexterm role="concept">
814 <primary>incorporated code</primary>
816 <indexterm role="concept">
817 <primary>regular expressions</primary>
818 <secondary>library</secondary>
820 <indexterm role="concept">
821 <primary>PCRE</primary>
823 A number of pieces of external code are included in the Exim distribution.
828 Regular expressions are supported in the main Exim program and in the Exim
829 monitor using the freely-distributable PCRE library, copyright ©
830 University of Cambridge. The source is distributed in the directory
831 <filename>src/pcre</filename>. However, this is a cut-down version of PCRE. If you want to use
832 the PCRE library in other programs, you should obtain and install the full
833 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>.
838 <indexterm role="concept">
839 <primary>cdb</primary>
840 <secondary>acknowledgement</secondary>
842 Support for the cdb (Constant DataBase) lookup method is provided by code
843 contributed by Nigel Metheringham of (at the time he contributed it) Planet
844 Online Ltd. The implementation is completely contained within the code of Exim.
845 It does not link against an external cdb library. The code contains the
846 following statements:
850 Copyright © 1998 Nigel Metheringham, Planet Online Ltd
853 This program is free software; you can redistribute it and/or modify it under
854 the terms of the GNU General Public License as published by the Free Software
855 Foundation; either version 2 of the License, or (at your option) any later
859 This code implements Dan Bernstein’s Constant DataBase (cdb) spec. Information,
860 the spec and sample code for cdb can be obtained from
861 <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
862 code from Dan Bernstein’s implementation (which has no license restrictions
869 <indexterm role="concept">
870 <primary>SPA authentication</primary>
872 <indexterm role="concept">
873 <primary>Samba project</primary>
875 <indexterm role="concept">
876 <primary>Microsoft Secure Password Authentication</primary>
878 Client support for Microsoft’s <emphasis>Secure Password Authentication</emphasis> is provided
879 by code contributed by Marc Prud’hommeaux. Server support was contributed by
880 Tom Kistner. This includes code taken from the Samba project, which is released
886 <indexterm role="concept">
887 <primary>Cyrus</primary>
889 <indexterm role="concept">
890 <primary><emphasis>pwcheck</emphasis> daemon</primary>
892 <indexterm role="concept">
893 <primary><emphasis>pwauthd</emphasis> daemon</primary>
895 Support for calling the Cyrus <emphasis>pwcheck</emphasis> and <emphasis>saslauthd</emphasis> daemons is provided
896 by code taken from the Cyrus-SASL library and adapted by Alexander S.
897 Sabourenkov. The permission notice appears below, in accordance with the
898 conditions expressed therein.
902 Copyright © 2001 Carnegie Mellon University. All rights reserved.
905 Redistribution and use in source and binary forms, with or without
906 modification, are permitted provided that the following conditions
909 <orderedlist numeration="arabic">
912 Redistributions of source code must retain the above copyright
913 notice, this list of conditions and the following disclaimer.
918 Redistributions in binary form must reproduce the above copyright
919 notice, this list of conditions and the following disclaimer in
920 the documentation and/or other materials provided with the
926 The name <quote>Carnegie Mellon University</quote> must not be used to
927 endorse or promote products derived from this software without
928 prior written permission. For permission or any other legal
929 details, please contact
932 Office of Technology Transfer
933 Carnegie Mellon University
935 Pittsburgh, PA 15213-3890
936 (412) 268-4387, fax: (412) 268-7395
937 tech-transfer@andrew.cmu.edu
942 Redistributions of any form whatsoever must retain the following
946 <quote>This product includes software developed by Computing Services
947 at Carnegie Mellon University (<emphasis role="bold"><ulink url="http://www.cmu.edu/computing/">http://www.cmu.edu/computing/</ulink></emphasis>.</quote>
950 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
951 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
952 AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
953 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
954 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
955 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
956 OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
964 <indexterm role="concept">
965 <primary>Exim monitor</primary>
966 <secondary>acknowledgement</secondary>
968 <indexterm role="concept">
969 <primary>X-windows</primary>
971 <indexterm role="concept">
972 <primary>Athena</primary>
974 The Exim Monitor program, which is an X-Window application, includes
975 modified versions of the Athena StripChart and TextPop widgets.
976 This code is copyright by DEC and MIT, and their permission notice appears
977 below, in accordance with the conditions expressed therein.
981 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
982 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
988 Permission to use, copy, modify, and distribute this software and its
989 documentation for any purpose and without fee is hereby granted,
990 provided that the above copyright notice appear in all copies and that
991 both that copyright notice and this permission notice appear in
992 supporting documentation, and that the names of Digital or MIT not be
993 used in advertising or publicity pertaining to distribution of the
994 software without specific, written prior permission.
997 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
998 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
999 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
1000 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
1001 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
1002 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
1009 Many people have contributed code fragments, some large, some small, that were
1010 not covered by any specific licence requirements. It is assumed that the
1011 contributors are happy to see their code incoporated into Exim under the GPL.
1018 <title>How Exim receives and delivers mail</title>
1019 <titleabbrev>Receiving and delivering mail</titleabbrev>
1021 <title>Overall philosophy</title>
1023 <indexterm role="concept">
1024 <primary>design philosophy</primary>
1026 Exim is designed to work efficiently on systems that are permanently connected
1027 to the Internet and are handling a general mix of mail. In such circumstances,
1028 most messages can be delivered immediately. Consequently, Exim does not
1029 maintain independent queues of messages for specific domains or hosts, though
1030 it does try to send several messages in a single SMTP connection after a host
1031 has been down, and it also maintains per-host retry information.
1035 <title>Policy control</title>
1037 <indexterm role="concept">
1038 <primary>policy control</primary>
1039 <secondary>overview</secondary>
1041 Policy controls are now an important feature of MTAs that are connected to the
1042 Internet. Perhaps their most important job is to stop MTAs being abused as
1043 <quote>open relays</quote> by misguided individuals who send out vast amounts of
1044 unsolicited junk, and want to disguise its source. Exim provides flexible
1045 facilities for specifying policy controls on incoming mail:
1050 <indexterm role="concept">
1051 <primary>access control lists (ACLs)</primary>
1052 <secondary>introduction</secondary>
1054 Exim 4 (unlike previous versions of Exim) implements policy controls on
1055 incoming mail by means of <emphasis>Access Control Lists</emphasis> (ACLs). Each list is a
1056 series of statements that may either grant or deny access. ACLs can be used at
1057 several places in the SMTP dialogue while receiving a message from a remote
1058 host. However, the most common places are after each RCPT command, and at the
1059 very end of the message. The sysadmin can specify conditions for accepting or
1060 rejecting individual recipients or the entire message, respectively, at these
1061 two points (see chapter <xref linkend="CHAPACL"/>). Denial of access results in an SMTP
1067 An ACL is also available for locally generated, non-SMTP messages. In this
1068 case, the only available actions are to accept or deny the entire message.
1073 When Exim is compiled with the content-scanning extension, facilities are
1074 provided in the ACL mechanism for passing the message to external virus and/or
1075 spam scanning software. The result of such a scan is passed back to the ACL,
1076 which can then use it to decide what to do with the message.
1081 When a message has been received, either from a remote host or from the local
1082 host, but before the final acknowledgement has been sent, a locally supplied C
1083 function called <function>local_scan()</function> can be run to inspect the message and decide
1084 whether to accept it or not (see chapter <xref linkend="CHAPlocalscan"/>). If the message
1085 is accepted, the list of recipients can be modified by the function.
1090 Using the <function>local_scan()</function> mechanism is another way of calling external scanner
1091 software. The <option>SA-Exim</option> add-on package works this way. It does not require
1092 Exim to be compiled with the content-scanning extension.
1097 After a message has been accepted, a further checking mechanism is available in
1098 the form of the <emphasis>system filter</emphasis> (see chapter <xref linkend="CHAPsystemfilter"/>). This
1099 runs at the start of every delivery process.
1105 <title>User filters</title>
1107 <indexterm role="concept">
1108 <primary>filter</primary>
1109 <secondary>introduction</secondary>
1111 <indexterm role="concept">
1112 <primary>Sieve filter</primary>
1114 In a conventional Exim configuration, users are able to run private filters by
1115 setting up appropriate <filename>.forward</filename> files in their home directories. See
1116 chapter <xref linkend="CHAPredirect"/> (about the <command>redirect</command> router) for the
1117 configuration needed to support this, and the separate document entitled
1118 <emphasis>Exim’s interfaces to mail filtering</emphasis> for user details. Two different kinds
1119 of filtering are available:
1124 Sieve filters are written in the standard filtering language that is defined
1130 Exim filters are written in a syntax that is unique to Exim, but which is more
1131 powerful than Sieve, which it pre-dates.
1136 User filters are run as part of the routing process, described below.
1139 <section id="SECTmessiden">
1140 <title>Message identification</title>
1142 <indexterm role="concept">
1143 <primary>message ids</primary>
1144 <secondary>details of format</secondary>
1146 <indexterm role="concept">
1147 <primary>format</primary>
1148 <secondary>of message id</secondary>
1150 <indexterm role="concept">
1151 <primary>id of message</primary>
1153 <indexterm role="concept">
1154 <primary>base62</primary>
1156 <indexterm role="concept">
1157 <primary>base36</primary>
1159 <indexterm role="concept">
1160 <primary>Darwin</primary>
1162 <indexterm role="concept">
1163 <primary>Cygwin</primary>
1165 Every message handled by Exim is given a <emphasis>message id</emphasis> which is sixteen
1166 characters long. It is divided into three parts, separated by hyphens, for
1167 example <literal>16VDhn-0001bo-D3</literal>. Each part is a sequence of letters and digits,
1168 normally encoding numbers in base 62. However, in the Darwin operating
1169 system (Mac OS X) and when Exim is compiled to run under Cygwin, base 36
1170 (avoiding the use of lower case letters) is used instead, because the message
1171 id is used to construct file names, and the names of files in those systems are
1172 not always case-sensitive.
1175 <indexterm role="concept">
1176 <primary>pid (process id)</primary>
1177 <secondary>re-use of</secondary>
1179 The detail of the contents of the message id have changed as Exim has evolved.
1180 Earlier versions relied on the operating system not re-using a process id (pid)
1181 within one second. On modern operating systems, this assumption can no longer
1182 be made, so the algorithm had to be changed. To retain backward compatibility,
1183 the format of the message id was retained, which is why the following rules are
1189 The first six characters of the message id are the time at which the message
1190 started to be received, to a granularity of one second. That is, this field
1191 contains the number of seconds since the start of the epoch (the normal Unix
1192 way of representing the date and time of day).
1197 After the first hyphen, the next six characters are the id of the process that
1198 received the message.
1203 There are two different possibilities for the final two characters:
1205 <orderedlist numeration="arabic">
1208 <indexterm role="concept">
1209 <primary><option>localhost_number</option></primary>
1211 If <option>localhost_number</option> is not set, this value is the fractional part of the
1212 time of reception, normally in units of 1/2000 of a second, but for systems
1213 that must use base 36 instead of base 62 (because of case-insensitive file
1214 systems), the units are 1/1000 of a second.
1219 If <option>localhost_number</option> is set, it is multiplied by 200 (100) and added to
1220 the fractional part of the time, which in this case is in units of 1/200
1221 (1/100) of a second.
1228 After a message has been received, Exim waits for the clock to tick at the
1229 appropriate resolution before proceeding, so that if another message is
1230 received by the same process, or by another process with the same (re-used)
1231 pid, it is guaranteed that the time will be different. In most cases, the clock
1232 will already have ticked while the message was being received.
1236 <title>Receiving mail</title>
1238 <indexterm role="concept">
1239 <primary>receiving mail</primary>
1241 <indexterm role="concept">
1242 <primary>message</primary>
1243 <secondary>reception</secondary>
1245 The only way Exim can receive mail from another host is using SMTP over
1246 TCP/IP, in which case the sender and recipient addresses are transferred using
1247 SMTP commands. However, from a locally running process (such as a user’s MUA),
1248 there are several possibilities:
1253 If the process runs Exim with the <option>-bm</option> option, the message is read
1254 non-interactively (usually via a pipe), with the recipients taken from the
1255 command line, or from the body of the message if <option>-t</option> is also used.
1260 If the process runs Exim with the <option>-bS</option> option, the message is also read
1261 non-interactively, but in this case the recipients are listed at the start of
1262 the message in a series of SMTP RCPT commands, terminated by a DATA
1263 command. This is so-called <quote>batch SMTP</quote> format,
1264 but it isn’t really SMTP. The SMTP commands are just another way of passing
1265 envelope addresses in a non-interactive submission.
1270 If the process runs Exim with the <option>-bs</option> option, the message is read
1271 interactively, using the SMTP protocol. A two-way pipe is normally used for
1272 passing data between the local process and the Exim process.
1273 This is <quote>real</quote> SMTP and is handled in the same way as SMTP over TCP/IP. For
1274 example, the ACLs for SMTP commands are used for this form of submission.
1279 A local process may also make a TCP/IP call to the host’s loopback address
1280 (127.0.0.1) or any other of its IP addresses. When receiving messages, Exim
1281 does not treat the loopback address specially. It treats all such connections
1282 in the same way as connections from other hosts.
1287 <indexterm role="concept">
1288 <primary>message sender</primary>
1289 <secondary>constructed by Exim</secondary>
1291 <indexterm role="concept">
1292 <primary>sender</primary>
1293 <secondary>constructed by Exim</secondary>
1295 In the three cases that do not involve TCP/IP, the sender address is
1296 constructed from the login name of the user that called Exim and a default
1297 qualification domain (which can be set by the <option>qualify_domain</option> configuration
1298 option). For local or batch SMTP, a sender address that is passed using the
1299 SMTP MAIL command is ignored. However, the system administrator may allow
1300 certain users (<quote>trusted users</quote>) to specify a different sender address
1301 unconditionally, or all users to specify certain forms of different sender
1302 address. The <option>-f</option> option or the SMTP MAIL command is used to specify these
1303 different addresses. See section <xref linkend="SECTtrustedadmin"/> for details of trusted
1304 users, and the <option>untrusted_set_sender</option> option for a way of allowing untrusted
1305 users to change sender addresses.
1308 Messages received by either of the non-interactive mechanisms are subject to
1309 checking by the non-SMTP ACL, if one is defined. Messages received using SMTP
1310 (either over TCP/IP, or interacting with a local process) can be checked by a
1311 number of ACLs that operate at different times during the SMTP session. Either
1312 individual recipients, or the entire message, can be rejected if local policy
1313 requirements are not met. The <function>local_scan()</function> function (see chapter
1314 <xref linkend="CHAPlocalscan"/>) is run for all incoming messages.
1317 Exim can be configured not to start a delivery process when a message is
1318 received; this can be unconditional, or depend on the number of incoming SMTP
1319 connections or the system load. In these situations, new messages wait on the
1320 queue until a queue runner process picks them up. However, in standard
1321 configurations under normal conditions, delivery is started as soon as a
1322 message is received.
1326 <title>Handling an incoming message</title>
1328 <indexterm role="concept">
1329 <primary>spool directory</primary>
1330 <secondary>files that hold a message</secondary>
1332 <indexterm role="concept">
1333 <primary>file</primary>
1334 <secondary>how a message is held</secondary>
1336 When Exim accepts a message, it writes two files in its spool directory. The
1337 first contains the envelope information, the current status of the message, and
1338 the header lines, and the second contains the body of the message. The names of
1339 the two spool files consist of the message id, followed by <literal>-H</literal> for the
1340 file containing the envelope and header, and <literal>-D</literal> for the data file.
1343 <indexterm role="concept">
1344 <primary>spool directory</primary>
1345 <secondary><filename>input</filename> sub-directory</secondary>
1347 By default all these message files are held in a single directory called
1348 <filename>input</filename> inside the general Exim spool directory. Some operating systems do
1349 not perform very well if the number of files in a directory gets large; to
1350 improve performance in such cases, the <option>split_spool_directory</option> option can be
1351 used. This causes Exim to split up the input files into 62 sub-directories
1352 whose names are single letters or digits. When this is done, the queue is
1353 processed one sub-directory at a time instead of all at once, which can improve
1354 overall performance even when there are not enough files in each directory to
1355 affect file system performance.
1358 The envelope information consists of the address of the message’s sender and
1359 the addresses of the recipients. This information is entirely separate from
1360 any addresses contained in the header lines. The status of the message includes
1361 a list of recipients who have already received the message. The format of the
1362 first spool file is described in chapter <xref linkend="CHAPspool"/>.
1365 <indexterm role="concept">
1366 <primary>rewriting</primary>
1367 <secondary>addresses</secondary>
1369 Address rewriting that is specified in the rewrite section of the configuration
1370 (see chapter <xref linkend="CHAPrewrite"/>) is done once and for all on incoming addresses,
1371 both in the header lines and the envelope, at the time the message is accepted.
1372 If during the course of delivery additional addresses are generated (for
1373 example, via aliasing), these new addresses are rewritten as soon as they are
1374 generated. At the time a message is actually delivered (transported) further
1375 rewriting can take place; because this is a transport option, it can be
1376 different for different forms of delivery. It is also possible to specify the
1377 addition or removal of certain header lines at the time the message is
1378 delivered (see chapters <xref linkend="CHAProutergeneric"/> and
1379 <xref linkend="CHAPtransportgeneric"/>).
1383 <title>Life of a message</title>
1385 <indexterm role="concept">
1386 <primary>message</primary>
1387 <secondary>life of</secondary>
1389 <indexterm role="concept">
1390 <primary>message</primary>
1391 <secondary>frozen</secondary>
1393 A message remains in the spool directory until it is completely delivered to
1394 its recipients or to an error address, or until it is deleted by an
1395 administrator or by the user who originally created it. In cases when delivery
1396 cannot proceed – for example, when a message can neither be delivered to its
1397 recipients nor returned to its sender, the message is marked <quote>frozen</quote> on the
1398 spool, and no more deliveries are attempted.
1401 <indexterm role="concept">
1402 <primary>frozen messages</primary>
1403 <secondary>thawing</secondary>
1405 <indexterm role="concept">
1406 <primary>message</primary>
1407 <secondary>thawing frozen</secondary>
1409 An administrator can <quote>thaw</quote> such messages when the problem has been
1410 corrected, and can also freeze individual messages by hand if necessary. In
1411 addition, an administrator can force a delivery error, causing a bounce message
1415 <indexterm role="concept">
1416 <primary><option>timeout_frozen_after</option></primary>
1418 <indexterm role="concept">
1419 <primary><option>ignore_bounce_errors_after</option></primary>
1421 There are options called <option>ignore_bounce_errors_after</option> and
1422 <option>timeout_frozen_after</option>, which discard frozen messages after a certain time.
1423 The first applies only to frozen bounces, the second to any frozen messages.
1426 <indexterm role="concept">
1427 <primary>message</primary>
1428 <secondary>log file for</secondary>
1430 <indexterm role="concept">
1431 <primary>log</primary>
1432 <secondary>file for each message</secondary>
1434 While Exim is working on a message, it writes information about each delivery
1435 attempt to its main log file. This includes successful, unsuccessful, and
1436 delayed deliveries for each recipient (see chapter <xref linkend="CHAPlog"/>). The log
1437 lines are also written to a separate <emphasis>message log</emphasis> file for each message.
1438 These logs are solely for the benefit of the administrator, and are normally
1439 deleted along with the spool files when processing of a message is complete.
1440 The use of individual message logs can be disabled by setting
1441 <option>no_message_logs</option>; this might give an improvement in performance on very busy
1445 <indexterm role="concept">
1446 <primary>journal file</primary>
1448 <indexterm role="concept">
1449 <primary>file</primary>
1450 <secondary>journal</secondary>
1452 All the information Exim itself needs to set up a delivery is kept in the first
1453 spool file, along with the header lines. When a successful delivery occurs, the
1454 address is immediately written at the end of a journal file, whose name is the
1455 message id followed by <literal>-J</literal>. At the end of a delivery run, if there are some
1456 addresses left to be tried again later, the first spool file (the <literal>-H</literal> file)
1457 is updated to indicate which these are, and the journal file is then deleted.
1458 Updating the spool file is done by writing a new file and renaming it, to
1459 minimize the possibility of data loss.
1462 Should the system or the program crash after a successful delivery but before
1463 the spool file has been updated, the journal is left lying around. The next
1464 time Exim attempts to deliver the message, it reads the journal file and
1465 updates the spool file before proceeding. This minimizes the chances of double
1466 deliveries caused by crashes.
1469 <section id="SECTprocaddress">
1470 <title>Processing an address for delivery</title>
1472 <indexterm role="concept">
1473 <primary>drivers</primary>
1474 <secondary>definition of</secondary>
1476 <indexterm role="concept">
1477 <primary>router</primary>
1478 <secondary>definition of</secondary>
1480 <indexterm role="concept">
1481 <primary>transport</primary>
1482 <secondary>definition of</secondary>
1484 The main delivery processing elements of Exim are called <emphasis>routers</emphasis> and
1485 <emphasis>transports</emphasis>, and collectively these are known as <emphasis>drivers</emphasis>. Code for a
1486 number of them is provided in the source distribution, and compile-time options
1487 specify which ones are included in the binary. Run time options specify which
1488 ones are actually used for delivering messages.
1491 <indexterm role="concept">
1492 <primary>drivers</primary>
1493 <secondary>instance definition</secondary>
1495 Each driver that is specified in the run time configuration is an <emphasis>instance</emphasis>
1496 of that particular driver type. Multiple instances are allowed; for example,
1497 you can set up several different <command>smtp</command> transports, each with different
1498 option values that might specify different ports or different timeouts. Each
1499 instance has its own identifying name. In what follows we will normally use the
1500 instance name when discussing one particular instance (that is, one specific
1501 configuration of the driver), and the generic driver name when discussing
1502 the driver’s features in general.
1505 A <emphasis>router</emphasis> is a driver that operates on an address, either determining how
1506 its delivery should happen, by assigning it to a specific transport, or
1507 converting the address into one or more new addresses (for example, via an
1508 alias file). A router may also explicitly choose to fail an address, causing it
1512 A <emphasis>transport</emphasis> is a driver that transmits a copy of the message from Exim’s
1513 spool to some destination. There are two kinds of transport: for a <emphasis>local</emphasis>
1514 transport, the destination is a file or a pipe on the local host, whereas for a
1515 <emphasis>remote</emphasis> transport the destination is some other host. A message is passed
1516 to a specific transport as a result of successful routing. If a message has
1517 several recipients, it may be passed to a number of different transports.
1520 <indexterm role="concept">
1521 <primary>preconditions</primary>
1522 <secondary>definition of</secondary>
1524 An address is processed by passing it to each configured router instance in
1525 turn, subject to certain preconditions, until a router accepts the address or
1526 specifies that it should be bounced. We will describe this process in more
1527 detail shortly. First, as a simple example, we consider how each recipient
1528 address in a message is processed in a small configuration of three routers.
1531 To make this a more concrete example, it is described in terms of some actual
1532 routers, but remember, this is only an example. You can configure Exim’s
1533 routers in many different ways, and there may be any number of routers in a
1537 The first router that is specified in a configuration is often one that handles
1538 addresses in domains that are not recognized specially by the local host. These
1539 are typically addresses for arbitrary domains on the Internet. A precondition
1540 is set up which looks for the special domains known to the host (for example,
1541 its own domain name), and the router is run for addresses that do <emphasis>not</emphasis>
1542 match. Typically, this is a router that looks up domains in the DNS in order to
1543 find the hosts to which this address routes. If it succeeds, the address is
1544 assigned to a suitable SMTP transport; if it does not succeed, the router is
1545 configured to fail the address.
1548 The second router is reached only when the domain is recognized as one that
1549 <quote>belongs</quote> to the local host. This router does redirection – also known as
1550 aliasing and forwarding. When it generates one or more new addresses from the
1551 original, each of them is routed independently from the start. Otherwise, the
1552 router may cause an address to fail, or it may simply decline to handle the
1553 address, in which case the address is passed to the next router.
1556 The final router in many configurations is one that checks to see if the
1557 address belongs to a local mailbox. The precondition may involve a check to
1558 see if the local part is the name of a login account, or it may look up the
1559 local part in a file or a database. If its preconditions are not met, or if
1560 the router declines, we have reached the end of the routers. When this happens,
1561 the address is bounced.
1565 <title>Processing an address for verification</title>
1567 <indexterm role="concept">
1568 <primary>router</primary>
1569 <secondary>for verification</secondary>
1571 <indexterm role="concept">
1572 <primary>verifying address</primary>
1573 <secondary>overview</secondary>
1575 As well as being used to decide how to deliver to an address, Exim’s routers
1576 are also used for <emphasis>address verification</emphasis>. Verification can be requested as
1577 one of the checks to be performed in an ACL for incoming messages, on both
1578 sender and recipient addresses, and it can be tested using the <option>-bv</option> and
1579 <option>-bvs</option> command line options.
1582 When an address is being verified, the routers are run in <quote>verify mode</quote>. This
1583 does not affect the way the routers work, but it is a state that can be
1584 detected. By this means, a router can be skipped or made to behave differently
1585 when verifying. A common example is a configuration in which the first router
1586 sends all messages to a message-scanning program, unless they have been
1587 previously scanned. Thus, the first router accepts all addresses without any
1588 checking, making it useless for verifying. Normally, the <option>no_verify</option> option
1589 would be set for such a router, causing it to be skipped in verify mode.
1592 <section id="SECTrunindrou">
1593 <title>Running an individual router</title>
1595 <indexterm role="concept">
1596 <primary>router</primary>
1597 <secondary>running details</secondary>
1599 <indexterm role="concept">
1600 <primary>preconditions</primary>
1601 <secondary>checking</secondary>
1603 <indexterm role="concept">
1604 <primary>router</primary>
1605 <secondary>result of running</secondary>
1607 As explained in the example above, a number of preconditions are checked before
1608 running a router. If any are not met, the router is skipped, and the address is
1609 passed to the next router. When all the preconditions on a router <emphasis>are</emphasis> met,
1610 the router is run. What happens next depends on the outcome, which is one of
1616 <emphasis>accept</emphasis>: The router accepts the address, and either assigns it to a
1617 transport, or generates one or more <quote>child</quote> addresses. Processing the
1618 original address ceases,
1619 <indexterm role="concept">
1620 <primary><option>unseen</option> option</primary>
1622 unless the <option>unseen</option> option is set on the router. This option
1623 can be used to set up multiple deliveries with different routing (for example,
1624 for keeping archive copies of messages). When <option>unseen</option> is set, the address is
1625 passed to the next router. Normally, however, an <emphasis>accept</emphasis> return marks the
1629 Any child addresses generated by the router are processed independently,
1630 starting with the first router by default. It is possible to change this by
1631 setting the <option>redirect_router</option> option to specify which router to start at for
1632 child addresses. Unlike <option>pass_router</option> (see below) the router specified by
1633 <option>redirect_router</option> may be anywhere in the router configuration.
1638 <emphasis>pass</emphasis>: The router recognizes the address, but cannot handle it itself. It
1639 requests that the address be passed to another router. By default the address
1640 is passed to the next router, but this can be changed by setting the
1641 <option>pass_router</option> option. However, (unlike <option>redirect_router</option>) the named router
1642 must be below the current router (to avoid loops).
1647 <emphasis>decline</emphasis>: The router declines to accept the address because it does not
1648 recognize it at all. By default, the address is passed to the next router, but
1649 this can be prevented by setting the <option>no_more</option> option. When <option>no_more</option> is
1650 set, all the remaining routers are skipped. In effect, <option>no_more</option> converts
1651 <emphasis>decline</emphasis> into <emphasis>fail</emphasis>.
1656 <emphasis>fail</emphasis>: The router determines that the address should fail, and queues it for
1657 the generation of a bounce message. There is no further processing of the
1658 original address unless <option>unseen</option> is set on the router.
1663 <emphasis>defer</emphasis>: The router cannot handle the address at the present time. (A
1664 database may be offline, or a DNS lookup may have timed out.) No further
1665 processing of the address happens in this delivery attempt. It is tried again
1666 next time the message is considered for delivery.
1671 <emphasis>error</emphasis>: There is some error in the router (for example, a syntax error in
1672 its configuration). The action is as for defer.
1677 If an address reaches the end of the routers without having been accepted by
1678 any of them, it is bounced as unrouteable. The default error message in this
1679 situation is <quote>unrouteable address</quote>, but you can set your own message by
1680 making use of the <option>cannot_route_message</option> option. This can be set for any
1681 router; the value from the last router that <quote>saw</quote> the address is used.
1684 Sometimes while routing you want to fail a delivery when some conditions are
1685 met but others are not, instead of passing the address on for further routing.
1686 You can do this by having a second router that explicitly fails the delivery
1687 when the relevant conditions are met. The <command>redirect</command> router has a <quote>fail</quote>
1688 facility for this purpose.
1692 <title>Duplicate addresses</title>
1694 <indexterm role="concept">
1695 <primary>case of local parts</primary>
1697 <indexterm role="concept">
1698 <primary>address duplicate</primary>
1699 <secondary>discarding</secondary>
1701 <indexterm role="concept">
1702 <primary>duplicate addresses</primary>
1704 Once routing is complete, Exim scans the addresses that are assigned to local
1705 and remote transports, and discards any duplicates that it finds. During this
1706 check, local parts are treated as case-sensitive. This happens only when
1707 actually delivering a message; when testing routers with <option>-bt</option>, all the
1708 routed addresses are shown.
1711 <section id="SECTrouprecon">
1712 <title>Router preconditions</title>
1714 <indexterm role="concept">
1715 <primary>router preconditions</primary>
1716 <secondary>order of processing</secondary>
1718 <indexterm role="concept">
1719 <primary>preconditions</primary>
1720 <secondary>order of processing</secondary>
1722 The preconditions that are tested for each router are listed below, in the
1723 order in which they are tested. The individual configuration options are
1724 described in more detail in chapter <xref linkend="CHAProutergeneric"/>.
1729 The <option>local_part_prefix</option> and <option>local_part_suffix</option> options can specify that
1730 the local parts handled by the router may or must have certain prefixes and/or
1731 suffixes. If a mandatory affix (prefix or suffix) is not present, the router is
1732 skipped. These conditions are tested first. When an affix is present, it is
1733 removed from the local part before further processing, including the evaluation
1734 of any other conditions.
1739 Routers can be designated for use only when not verifying an address, that is,
1740 only when routing it for delivery (or testing its delivery routing). If the
1741 <option>verify</option> option is set false, the router is skipped when Exim is verifying an
1743 Setting the <option>verify</option> option actually sets two options, <option>verify_sender</option> and
1744 <option>verify_recipient</option>, which independently control the use of the router for
1745 sender and recipient verification. You can set these options directly if
1746 you want a router to be used for only one type of verification.
1751 If the <option>address_test</option> option is set false, the router is skipped when Exim is
1752 run with the <option>-bt</option> option to test an address routing. This can be helpful
1753 when the first router sends all new messages to a scanner of some sort; it
1754 makes it possible to use <option>-bt</option> to test subsequent delivery routing without
1755 having to simulate the effect of the scanner.
1760 Routers can be designated for use only when verifying an address, as
1761 opposed to routing it for delivery. The <option>verify_only</option> option controls this.
1766 Individual routers can be explicitly skipped when running the routers to
1767 check an address given in the SMTP EXPN command (see the <option>expn</option> option).
1772 If the <option>domains</option> option is set, the domain of the address must be in the set
1773 of domains that it defines.
1778 <indexterm role="concept">
1779 <primary><varname>$local_part_prefix</varname></primary>
1781 <indexterm role="concept">
1782 <primary><varname>$local_part</varname></primary>
1784 <indexterm role="concept">
1785 <primary><varname>$local_part_suffix</varname></primary>
1787 If the <option>local_parts</option> option is set, the local part of the address must be in
1788 the set of local parts that it defines. If <option>local_part_prefix</option> or
1789 <option>local_part_suffix</option> is in use, the prefix or suffix is removed from the local
1790 part before this check. If you want to do precondition tests on local parts
1791 that include affixes, you can do so by using a <option>condition</option> option (see below)
1792 that uses the variables <varname>$local_part</varname>, <varname>$local_part_prefix</varname>, and
1793 <varname>$local_part_suffix</varname> as necessary.
1798 <indexterm role="concept">
1799 <primary><varname>$local_user_uid</varname></primary>
1801 <indexterm role="concept">
1802 <primary><varname>$local_user_gid</varname></primary>
1804 <indexterm role="concept">
1805 <primary><varname>$home</varname></primary>
1807 If the <option>check_local_user</option> option is set, the local part must be the name of
1808 an account on the local host. If this check succeeds, the uid and gid of the
1809 local user are placed in <varname>$local_user_uid</varname> and <varname>$local_user_gid</varname> and the
1810 user’s home directory is placed in <varname>$home</varname>; these values can be used in the
1811 remaining preconditions.
1816 If the <option>router_home_directory</option> option is set, it is expanded at this point,
1817 because it overrides the value of <varname>$home</varname>. If this expansion were left till
1818 later, the value of <varname>$home</varname> as set by <option>check_local_user</option> would be used in
1819 subsequent tests. Having two different values of <varname>$home</varname> in the same router
1820 could lead to confusion.
1825 If the <option>senders</option> option is set, the envelope sender address must be in the
1826 set of addresses that it defines.
1831 If the <option>require_files</option> option is set, the existence or non-existence of
1832 specified files is tested.
1837 <indexterm role="concept">
1838 <primary>customizing</primary>
1839 <secondary>precondition</secondary>
1841 If the <option>condition</option> option is set, it is evaluated and tested. This option
1842 uses an expanded string to allow you to set up your own custom preconditions.
1843 Expanded strings are described in chapter <xref linkend="CHAPexpand"/>.
1848 Note that <option>require_files</option> comes near the end of the list, so you cannot use
1849 it to check for the existence of a file in which to lookup up a domain, local
1850 part, or sender. However, as these options are all expanded, you can use the
1851 <option>exists</option> expansion condition to make such tests within each condition. The
1852 <option>require_files</option> option is intended for checking files that the router may be
1853 going to use internally, or which are needed by a specific transport (for
1854 example, <filename>.procmailrc</filename>).
1858 <title>Delivery in detail</title>
1860 <indexterm role="concept">
1861 <primary>delivery</primary>
1862 <secondary>in detail</secondary>
1864 When a message is to be delivered, the sequence of events is as follows:
1869 If a system-wide filter file is specified, the message is passed to it. The
1870 filter may add recipients to the message, replace the recipients, discard the
1871 message, cause a new message to be generated, or cause the message delivery to
1872 fail. The format of the system filter file is the same as for Exim user filter
1873 files, described in the separate document entitled <emphasis>Exim’s interfaces to mail
1874 filtering</emphasis>.
1875 <indexterm role="concept">
1876 <primary>Sieve filter</primary>
1877 <secondary>not available for system filter</secondary>
1879 (<emphasis role="bold">Note</emphasis>: Sieve cannot be used for system filter files.)
1882 Some additional features are available in system filters – see chapter
1883 <xref linkend="CHAPsystemfilter"/> for details. Note that a message is passed to the system
1884 filter only once per delivery attempt, however many recipients it has. However,
1885 if there are several delivery attempts because one or more addresses could not
1886 be immediately delivered, the system filter is run each time. The filter
1887 condition <option>first_delivery</option> can be used to detect the first run of the system
1893 Each recipient address is offered to each configured router in turn, subject to
1894 its preconditions, until one is able to handle it. If no router can handle the
1895 address, that is, if they all decline, the address is failed. Because routers
1896 can be targeted at particular domains, several locally handled domains can be
1897 processed entirely independently of each other.
1902 <indexterm role="concept">
1903 <primary>routing</primary>
1904 <secondary>loops in</secondary>
1906 <indexterm role="concept">
1907 <primary>loop</primary>
1908 <secondary>while routing</secondary>
1910 A router that accepts an address may assign it to a local or a remote
1911 transport. However, the transport is not run at this time. Instead, the address
1912 is placed on a list for the particular transport, which will be run later.
1913 Alternatively, the router may generate one or more new addresses (typically
1914 from alias, forward, or filter files). New addresses are fed back into this
1915 process from the top, but in order to avoid loops, a router ignores any address
1916 which has an identically-named ancestor that was processed by itself.
1921 When all the routing has been done, addresses that have been successfully
1922 handled are passed to their assigned transports. When local transports are
1923 doing real local deliveries, they handle only one address at a time, but if a
1924 local transport is being used as a pseudo-remote transport (for example, to
1925 collect batched SMTP messages for transmission by some other means) multiple
1926 addresses can be handled. Remote transports can always handle more than one
1927 address at a time, but can be configured not to do so, or to restrict multiple
1928 addresses to the same domain.
1933 Each local delivery to a file or a pipe runs in a separate process under a
1934 non-privileged uid, and these deliveries are run one at a time. Remote
1935 deliveries also run in separate processes, normally under a uid that is private
1936 to Exim (<quote>the Exim user</quote>), but in this case, several remote deliveries can be
1937 run in parallel. The maximum number of simultaneous remote deliveries for any
1938 one message is set by the <option>remote_max_parallel</option> option.
1939 The order in which deliveries are done is not defined, except that all local
1940 deliveries happen before any remote deliveries.
1945 <indexterm role="concept">
1946 <primary>queue runner</primary>
1948 When it encounters a local delivery during a queue run, Exim checks its retry
1949 database to see if there has been a previous temporary delivery failure for the
1950 address before running the local transport. If there was a previous failure,
1951 Exim does not attempt a new delivery until the retry time for the address is
1952 reached. However, this happens only for delivery attempts that are part of a
1953 queue run. Local deliveries are always attempted when delivery immediately
1954 follows message reception, even if retry times are set for them. This makes for
1955 better behaviour if one particular message is causing problems (for example,
1956 causing quota overflow, or provoking an error in a filter file).
1961 <indexterm role="concept">
1962 <primary>delivery</primary>
1963 <secondary>retry in remote transports</secondary>
1965 Remote transports do their own retry handling, since an address may be
1966 deliverable to one of a number of hosts, each of which may have a different
1967 retry time. If there have been previous temporary failures and no host has
1968 reached its retry time, no delivery is attempted, whether in a queue run or
1969 not. See chapter <xref linkend="CHAPretry"/> for details of retry strategies.
1974 If there were any permanent errors, a bounce message is returned to an
1975 appropriate address (the sender in the common case), with details of the error
1976 for each failing address. Exim can be configured to send copies of bounce
1977 messages to other addresses.
1982 <indexterm role="concept">
1983 <primary>delivery</primary>
1984 <secondary>deferral</secondary>
1986 If one or more addresses suffered a temporary failure, the message is left on
1987 the queue, to be tried again later. Delivery of these addresses is said to be
1988 <emphasis>deferred</emphasis>.
1993 When all the recipient addresses have either been delivered or bounced,
1994 handling of the message is complete. The spool files and message log are
1995 deleted, though the message log can optionally be preserved if required.
2001 <title>Retry mechanism</title>
2003 <indexterm role="concept">
2004 <primary>delivery</primary>
2005 <secondary>retry mechanism</secondary>
2007 <indexterm role="concept">
2008 <primary>retry</primary>
2009 <secondary>description of mechanism</secondary>
2011 <indexterm role="concept">
2012 <primary>queue runner</primary>
2014 Exim’s mechanism for retrying messages that fail to get delivered at the first
2015 attempt is the queue runner process. You must either run an Exim daemon that
2016 uses the <option>-q</option> option with a time interval to start queue runners at regular
2017 intervals, or use some other means (such as <emphasis>cron</emphasis>) to start them. If you do
2018 not arrange for queue runners to be run, messages that fail temporarily at the
2019 first attempt will remain on your queue for ever. A queue runner process works
2020 its way through the queue, one message at a time, trying each delivery that has
2021 passed its retry time.
2022 You can run several queue runners at once.
2025 Exim uses a set of configured rules to determine when next to retry the failing
2026 address (see chapter <xref linkend="CHAPretry"/>). These rules also specify when Exim
2027 should give up trying to deliver to the address, at which point it generates a
2028 bounce message. If no retry rules are set for a particular host, address, and
2029 error combination, no retries are attempted, and temporary errors are treated
2034 <title>Temporary delivery failure</title>
2036 <indexterm role="concept">
2037 <primary>delivery</primary>
2038 <secondary>temporary failure</secondary>
2040 There are many reasons why a message may not be immediately deliverable to a
2041 particular address. Failure to connect to a remote machine (because it, or the
2042 connection to it, is down) is one of the most common. Temporary failures may be
2043 detected during routing as well as during the transport stage of delivery.
2044 Local deliveries may be delayed if NFS files are unavailable, or if a mailbox
2045 is on a file system where the user is over quota. Exim can be configured to
2046 impose its own quotas on local mailboxes; where system quotas are set they will
2050 If a host is unreachable for a period of time, a number of messages may be
2051 waiting for it by the time it recovers, and sending them in a single SMTP
2052 connection is clearly beneficial. Whenever a delivery to a remote host is
2056 <indexterm role="concept">
2057 <primary>hints database</primary>
2059 Exim makes a note in its hints database, and whenever a successful
2060 SMTP delivery has happened, it looks to see if any other messages are waiting
2061 for the same host. If any are found, they are sent over the same SMTP
2062 connection, subject to a configuration limit as to the maximum number in any
2067 <title>Permanent delivery failure</title>
2069 <indexterm role="concept">
2070 <primary>delivery</primary>
2071 <secondary>permanent failure</secondary>
2073 <indexterm role="concept">
2074 <primary>bounce message</primary>
2075 <secondary>when generated</secondary>
2077 When a message cannot be delivered to some or all of its intended recipients, a
2078 bounce message is generated. Temporary delivery failures turn into permanent
2079 errors when their timeout expires. All the addresses that fail in a given
2080 delivery attempt are listed in a single message. If the original message has
2081 many recipients, it is possible for some addresses to fail in one delivery
2082 attempt and others to fail subsequently, giving rise to more than one bounce
2083 message. The wording of bounce messages can be customized by the administrator.
2084 See chapter <xref linkend="CHAPemsgcust"/> for details.
2087 <indexterm role="concept">
2088 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2090 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2091 failed addresses, for the benefit of programs that try to analyse such messages
2095 <indexterm role="concept">
2096 <primary>bounce message</primary>
2097 <secondary>recipient of</secondary>
2099 A bounce message is normally sent to the sender of the original message, as
2100 obtained from the message’s envelope. For incoming SMTP messages, this is the
2101 address given in the MAIL command. However, when an address is expanded via a
2102 forward or alias file, an alternative address can be specified for delivery
2103 failures of the generated addresses. For a mailing list expansion (see section
2104 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2109 <title>Failures to deliver bounce messages</title>
2111 <indexterm role="concept">
2112 <primary>bounce message</primary>
2113 <secondary>failure to deliver</secondary>
2115 If a bounce message (either locally generated or received from a remote host)
2116 itself suffers a permanent delivery failure, the message is left on the queue,
2117 but it is frozen, awaiting the attention of an administrator. There are options
2118 that can be used to make Exim discard such failed messages, or to keep them
2119 for only a short time (see <option>timeout_frozen_after</option> and
2120 <option>ignore_bounce_errors_after</option>).
2126 <title>Building and installing Exim</title>
2128 <indexterm role="concept" id="IIDbuex" class="startofrange">
2129 <primary>building Exim</primary>
2133 <title>Unpacking</title>
2135 Exim is distributed as a gzipped or bzipped tar file which, when upacked,
2136 creates a directory with the name of the current release (for example,
2137 <filename>exim-4.64</filename>) into which the following files are placed:
2139 <informaltable frame="none">
2140 <tgroup cols="2" colsep="0" rowsep="0">
2141 <colspec colwidth="140pt" align="left"/>
2142 <colspec colwidth="254pt" align="left"/>
2145 <entry><filename>ACKNOWLEDGMENTS</filename></entry>
2146 <entry>contains some acknowledgments</entry>
2149 <entry><filename>CHANGES</filename></entry>
2150 <entry>contains a reference to where changes are documented</entry>
2153 <entry><filename>LICENCE</filename></entry>
2154 <entry>the GNU General Public Licence</entry>
2157 <entry><filename>Makefile</filename></entry>
2158 <entry>top-level make file</entry>
2161 <entry><filename>NOTICE</filename></entry>
2162 <entry>conditions for the use of Exim</entry>
2165 <entry><filename>README</filename></entry>
2166 <entry>list of files, directories and simple build instructions</entry>
2172 Other files whose names begin with <filename>README</filename> may also be present. The
2173 following subdirectories are created:
2175 <informaltable frame="none">
2176 <tgroup cols="2" colsep="0" rowsep="0">
2177 <colspec colwidth="140pt" align="left"/>
2178 <colspec colwidth="254pt" align="left"/>
2181 <entry><filename>Local</filename></entry>
2182 <entry>an empty directory for local configuration files</entry>
2185 <entry><filename>OS</filename></entry>
2186 <entry>OS-specific files</entry>
2189 <entry><filename>doc</filename></entry>
2190 <entry>documentation files</entry>
2193 <entry><filename>exim_monitor</filename></entry>
2194 <entry>source files for the Exim monitor</entry>
2197 <entry><filename>scripts</filename></entry>
2198 <entry>scripts used in the build process</entry>
2201 <entry><filename>src</filename></entry>
2202 <entry>remaining source files</entry>
2205 <entry><filename>util</filename></entry>
2206 <entry>independent utilities</entry>
2212 The main utility programs are contained in the <filename>src</filename> directory, and are built
2213 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2214 that may be useful to some sites.
2218 <title>Multiple machine architectures and operating systems</title>
2220 <indexterm role="concept">
2221 <primary>building Exim</primary>
2222 <secondary>multiple OS/architectures</secondary>
2224 The building process for Exim is arranged to make it easy to build binaries for
2225 a number of different architectures and operating systems from the same set of
2226 source files. Compilation does not take place in the <filename>src</filename> directory.
2227 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2229 <indexterm role="concept">
2230 <primary>symbolic link</primary>
2231 <secondary>to build directory</secondary>
2233 Symbolic links to the sources are installed in this directory, which is where
2234 the actual building takes place. In most cases, Exim can discover the machine
2235 architecture and operating system for itself, but the defaults can be
2236 overridden if necessary.
2239 <section id="SECTdb">
2240 <title>DBM libraries</title>
2242 <indexterm role="concept">
2243 <primary>DBM libraries</primary>
2244 <secondary>discussion of</secondary>
2246 <indexterm role="concept">
2247 <primary>hints database</primary>
2248 <secondary>DBM files used for</secondary>
2250 Even if you do not use any DBM files in your configuration, Exim still needs a
2251 DBM library in order to operate, because it uses indexed files for its hints
2252 databases. Unfortunately, there are a number of DBM libraries in existence, and
2253 different operating systems often have different ones installed.
2256 <indexterm role="concept">
2257 <primary>Solaris</primary>
2258 <secondary>DBM library for</secondary>
2260 <indexterm role="concept">
2261 <primary>IRIX</primary>
2262 <secondary>DBM library for</secondary>
2264 <indexterm role="concept">
2265 <primary>BSD</primary>
2266 <secondary>DBM library for</secondary>
2268 <indexterm role="concept">
2269 <primary>Linux</primary>
2270 <secondary>DBM library for</secondary>
2272 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2273 Linux distribution, the DBM configuration should happen automatically, and you
2274 may be able to ignore this section. Otherwise, you may have to learn more than
2275 you would like about DBM libraries from what follows.
2278 <indexterm role="concept">
2279 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2281 Licensed versions of Unix normally contain a library of DBM functions operating
2282 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2283 versions of Unix seem to vary in what they contain as standard. In particular,
2284 some early versions of Linux have no default DBM library, and different
2285 distributors have chosen to bundle different libraries with their packaged
2286 versions. However, the more recent releases seem to have standardised on the
2287 Berkeley DB library.
2290 Different DBM libraries have different conventions for naming the files they
2291 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2294 <orderedlist numeration="arabic">
2297 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2298 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2303 <indexterm role="concept">
2304 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2306 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2307 compatibility interface it makes two different hard links to it with names
2308 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2309 file name is used unmodified.
2314 <indexterm role="concept">
2315 <primary>Berkeley DB library</primary>
2317 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2318 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2319 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2324 If the Berkeley package is used in its native mode, it operates on a single
2325 file called <filename>dbmfile</filename>; the programmer’s interface is somewhat different to
2326 the traditional <emphasis>ndbm</emphasis> interface.
2331 To complicate things further, there are several very different versions of the
2332 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2333 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while, but the latest versions are now
2334 numbered 4.<emphasis>x</emphasis>. Maintenance of some of the earlier releases has ceased. All
2335 versions of Berkeley DB can be obtained from
2336 <emphasis role="bold"><ulink url="http://www.sleepycat.com/">http://www.sleepycat.com/</ulink></emphasis>.
2341 <indexterm role="concept">
2342 <primary><emphasis>tdb</emphasis> DBM library</primary>
2344 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2345 <emphasis role="bold"><ulink url="http://download.sourceforge.net/tdb">http://download.sourceforge.net/tdb</ulink></emphasis>. It has its own interface, and also
2346 operates on a single file.
2351 <indexterm role="concept">
2352 <primary>USE_DB</primary>
2354 <indexterm role="concept">
2355 <primary>DBM libraries</primary>
2356 <secondary>configuration for building</secondary>
2358 Exim and its utilities can be compiled to use any of these interfaces. In order
2359 to use any version of the Berkeley DB package in native mode, you must set
2360 USE_DB in an appropriate configuration file (typically
2361 <filename>Local/Makefile</filename>). For example:
2363 <literallayout class="monospaced">
2367 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2368 error is diagnosed if you set more than one of these.
2371 At the lowest level, the build-time configuration sets none of these options,
2372 thereby assuming an interface of type (1). However, some operating system
2373 configuration files (for example, those for the BSD operating systems and
2374 Linux) assume type (4) by setting USE_DB as their default, and the
2375 configuration files for Cygwin set USE_GDBM. Anything you set in
2376 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2379 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2380 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2381 in one of these lines:
2383 <literallayout class="monospaced">
2388 Settings like that will work if the DBM library is installed in the standard
2389 place. Sometimes it is not, and the library’s header file may also not be in
2390 the default path. You may need to set INCLUDE to specify where the header
2391 file is, and to specify the path to the library more fully in DBMLIB, as in
2394 <literallayout class="monospaced">
2395 INCLUDE=-I/usr/local/include/db-4.1
2396 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2399 There is further detailed discussion about the various DBM libraries in the
2400 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2404 <title>Pre-building configuration</title>
2406 <indexterm role="concept">
2407 <primary>building Exim</primary>
2408 <secondary>pre-building configuration</secondary>
2410 <indexterm role="concept">
2411 <primary>configuration for building Exim</primary>
2413 <indexterm role="concept">
2414 <primary><filename>Local/Makefile</filename></primary>
2416 <indexterm role="concept">
2417 <primary><filename>src/EDITME</filename></primary>
2419 Before building Exim, a local configuration file that specifies options
2420 independent of any operating system has to be created with the name
2421 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2422 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2423 therein. These descriptions are therefore not repeated here. If you are
2424 building Exim for the first time, the simplest thing to do is to copy
2425 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2428 There are three settings that you must supply, because Exim will not build
2429 without them. They are the location of the run time configuration file
2430 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2431 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2432 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2433 a colon-separated list of file names; Exim uses the first of them that exists.
2436 There are a few other parameters that can be specified either at build time or
2437 at run time, to enable the same binary to be used on a number of different
2438 machines. However, if the locations of Exim’s spool directory and log file
2439 directory (if not within the spool directory) are fixed, it is recommended that
2440 you specify them in <filename>Local/Makefile</filename> instead of at run time, so that errors
2441 detected early in Exim’s execution (such as a malformed configuration file) can
2445 <indexterm role="concept">
2446 <primary>content scanning</primary>
2447 <secondary>specifying at build time</secondary>
2449 Exim’s interfaces for calling virus and spam scanning software directly from
2450 access control lists are not compiled by default. If you want to include these
2451 facilities, you need to set
2453 <literallayout class="monospaced">
2454 WITH_CONTENT_SCAN=yes
2457 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2458 chapter <xref linkend="CHAPexiscan"/>.
2461 <indexterm role="concept">
2462 <primary><filename>Local/eximon.conf</filename></primary>
2464 <indexterm role="concept">
2465 <primary><filename>exim_monitor/EDITME</filename></primary>
2467 If you are going to build the Exim monitor, a similar configuration process is
2468 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2469 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2470 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2471 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2474 This is all the configuration that is needed in straightforward cases for known
2475 operating systems. However, the building process is set up so that it is easy
2476 to override options that are set by default or by operating-system-specific
2477 configuration files, for example to change the name of the C compiler, which
2478 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2483 <title>Support for iconv()</title>
2485 <indexterm role="concept">
2486 <primary><function>iconv()</function> support</primary>
2488 <indexterm role="concept">
2489 <primary>RFC 2047</primary>
2491 The contents of header lines in messages may be encoded according to the rules
2492 described RFC 2047. This makes it possible to transmit characters that are not
2493 in the ASCII character set, and to label them as being in a particular
2494 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2495 mechanism, it decodes them, and translates them into a specified character set
2496 (default ISO-8859-1). The translation is possible only if the operating system
2497 supports the <function>iconv()</function> function.
2500 However, some of the operating systems that supply <function>iconv()</function> do not support
2501 very many conversions. The GNU <option>libiconv</option> library (available from
2502 <emphasis role="bold"><ulink url="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2503 systems to remedy this deficiency, as well as on systems that do not supply
2504 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2506 <literallayout class="monospaced">
2510 to your <filename>Local/Makefile</filename> and rebuild Exim.
2513 <section id="SECTinctlsssl">
2514 <title>Including TLS/SSL encryption support</title>
2516 <indexterm role="concept">
2517 <primary>TLS</primary>
2518 <secondary>including support for TLS</secondary>
2520 <indexterm role="concept">
2521 <primary>encryption</primary>
2522 <secondary>including support for</secondary>
2524 <indexterm role="concept">
2525 <primary>SUPPORT_TLS</primary>
2527 <indexterm role="concept">
2528 <primary>OpenSSL</primary>
2529 <secondary>building Exim with</secondary>
2531 <indexterm role="concept">
2532 <primary>GnuTLS</primary>
2533 <secondary>building Exim with</secondary>
2535 Exim can be built to support encrypted SMTP connections, using the STARTTLS
2536 command as per RFC 2487. It can also support legacy clients that expect to
2537 start a TLS session immediately on connection to a non-standard port (see the
2538 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2542 If you want to build Exim with TLS support, you must first install either the
2543 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2547 If OpenSSL is installed, you should set
2549 <literallayout class="monospaced">
2551 TLS_LIBS=-lssl -lcrypto
2554 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2555 OpenSSL library and include files. For example:
2557 <literallayout class="monospaced">
2559 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2560 TLS_INCLUDE=-I/usr/local/openssl/include/
2563 <indexterm role="concept">
2564 <primary>USE_GNUTLS</primary>
2566 If GnuTLS is installed, you should set
2568 <literallayout class="monospaced">
2571 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2574 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2575 library and include files. For example:
2577 <literallayout class="monospaced">
2580 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2581 TLS_INCLUDE=-I/usr/gnu/include
2584 You do not need to set TLS_INCLUDE if the relevant directory is already
2585 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2586 given in chapter <xref linkend="CHAPTLS"/>.
2590 <title>Use of tcpwrappers</title>
2592 <indexterm role="concept">
2593 <primary>tcpwrappers</primary>
2594 <secondary>building Exim to support</secondary>
2596 <indexterm role="concept">
2597 <primary>USE_TCP_WRAPPERS</primary>
2599 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2600 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2601 alternative to Exim’s own checking facilities for installations that are
2602 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2603 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2604 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2605 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2606 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2609 <literallayout class="monospaced">
2610 USE_TCP_WRAPPERS=yes
2611 CFLAGS=-O -I/usr/local/include
2612 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2615 in <filename>Local/Makefile</filename>. The name to use in the <emphasis>tcpwrappers</emphasis> control files is
2616 <quote>exim</quote>. For example, the line
2618 <literallayout class="monospaced">
2619 exim : LOCAL 192.168.1. .friendly.domain.example
2622 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2623 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2624 All other connections are denied. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2629 <title>Including support for IPv6</title>
2631 <indexterm role="concept">
2632 <primary>IPv6</primary>
2633 <secondary>including support for</secondary>
2635 Exim contains code for use on systems that have IPv6 support. Setting
2636 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2637 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2638 where the IPv6 support is not fully integrated into the normal include and
2642 Two different types of DNS record for handling IPv6 addresses have been
2643 defined. AAAA records (analagous to A records for IPv4) are in use, and are
2644 currently seen as the mainstream. Another record type called A6 was proposed
2645 as better than AAAA because it had more flexibility. However, it was felt to be
2646 over-complex, and its status was reduced to <quote>experimental</quote>. It is not known
2647 if anyone is actually using A6 records. Exim has support for A6 records, but
2648 this is included only if you set <literal>SUPPORT_A6=YES</literal> in <filename>Local/Makefile</filename>. The
2649 support has not been tested for some time.
2653 <title>The building process</title>
2655 <indexterm role="concept">
2656 <primary>build directory</primary>
2658 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2659 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2660 operating system types, and creates a build directory if one does not exist.
2661 For example, on a Sun system running Solaris 8, the directory
2662 <filename>build-SunOS5-5.8-sparc</filename> is created.
2663 <indexterm role="concept">
2664 <primary>symbolic link</primary>
2665 <secondary>to source files</secondary>
2667 Symbolic links to relevant source files are installed in the build directory.
2670 <emphasis role="bold">Warning</emphasis>: The <option>-j</option> (parallel) flag must not be used with <emphasis>make</emphasis>; the
2671 building process fails if it is set.
2674 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2675 a make file inside the build directory, using the configuration files from the
2676 <filename>Local</filename> directory. The new make file is then passed to another instance of
2677 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2678 then compiling and linking the binaries for the Exim monitor (if configured), a
2679 number of utility programs, and finally Exim itself. The command <literal>make
2680 makefile</literal> can be used to force a rebuild of the make file in the build
2681 directory, should this ever be necessary.
2684 If you have problems building Exim, check for any comments there may be in the
2685 <filename>README</filename> file concerning your operating system, and also take a look at the
2686 FAQ, where some common problems are covered.
2690 <title>Output from <quote>make</quote></title>
2692 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2693 unreadable, because these lines can be very long. For this reason, the normal
2694 output is suppressed by default, and instead output similar to that which
2695 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2696 each module that is being compiled or linked. However, it is still possible to
2697 get the full output, by calling <emphasis>make</emphasis> like this:
2699 <literallayout class="monospaced">
2703 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2704 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2705 given in addition to the short output.
2708 <section id="SECToverride">
2709 <title>Overriding build-time options for Exim</title>
2711 <indexterm role="concept">
2712 <primary>build-time options</primary>
2713 <secondary>overriding</secondary>
2715 The main make file that is created at the beginning of the building process
2716 consists of the concatenation of a number of files which set configuration
2717 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2718 more than once, the last setting overrides any previous ones. This provides a
2719 convenient way of overriding defaults. The files that are concatenated are, in
2723 <filename>OS/Makefile-Default</filename>
2724 <filename>OS/Makefile-</filename><<emphasis>ostype</emphasis>>
2725 <filename>Local/Makefile</filename>
2726 <filename>Local/Makefile-</filename><<emphasis>ostype</emphasis>>
2727 <filename>Local/Makefile-</filename><<emphasis>archtype</emphasis>>
2728 <filename>Local/Makefile-</filename><<emphasis>ostype</emphasis>>-<<emphasis>archtype</emphasis>>
2729 <filename>OS/Makefile-Base</filename>
2732 <indexterm role="concept">
2733 <primary><filename>Local/Makefile</filename></primary>
2735 <indexterm role="concept">
2736 <primary>building Exim</primary>
2737 <secondary>operating system type</secondary>
2739 <indexterm role="concept">
2740 <primary>building Exim</primary>
2741 <secondary>architecture type</secondary>
2743 where <<emphasis>ostype</emphasis>> is the operating system type and <<emphasis>archtype</emphasis>> is the
2744 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2745 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2746 and are often not needed.
2749 The values used for <<emphasis>ostype</emphasis>> and <<emphasis>archtype</emphasis>> are obtained from scripts
2750 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2751 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2752 values are used, thereby providing a means of forcing particular settings.
2753 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2754 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2755 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2756 that Exim expects. You can run these scripts directly from the shell in order
2757 to find out what values are being used on your system.
2760 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2761 therein. Some (but not all) are mentioned below. If there is something that
2762 needs changing, review the contents of this file and the contents of the make
2763 file for your operating system (<filename>OS/Makefile-<ostype></filename>) to see what the
2767 <indexterm role="concept">
2768 <primary>building Exim</primary>
2769 <secondary>overriding default settings</secondary>
2771 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2772 or in <filename>OS/Makefile-<ostype></filename>, or to add any new definitions, you do not
2773 need to change the original files. Instead, you should make the changes by
2774 putting the new values in an appropriate <filename>Local</filename> file. For example,
2775 <indexterm role="concept">
2776 <primary>Tru64-Unix build-time settings</primary>
2778 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2779 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2780 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2781 called with the option <option>-std1</option>, to make it recognize some of the features of
2782 Standard C that Exim uses. (Most other compilers recognize Standard C by
2783 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2784 containing the lines
2786 <literallayout class="monospaced">
2791 If you are compiling for just one operating system, it may be easier to put
2792 these lines directly into <filename>Local/Makefile</filename>.
2795 Keeping all your local configuration settings separate from the distributed
2796 files makes it easy to transfer them to new versions of Exim simply by copying
2797 the contents of the <filename>Local</filename> directory.
2800 <indexterm role="concept">
2801 <primary>NIS lookup type</primary>
2802 <secondary>including support for</secondary>
2804 <indexterm role="concept">
2805 <primary>NIS+ lookup type</primary>
2806 <secondary>including support for</secondary>
2808 <indexterm role="concept">
2809 <primary>LDAP</primary>
2810 <secondary>including support for</secondary>
2812 <indexterm role="concept">
2813 <primary>lookup</primary>
2814 <secondary>inclusion in binary</secondary>
2816 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2817 lookup, but not all systems have these components installed, so the default is
2818 not to include the relevant code in the binary. All the different kinds of file
2819 and database lookup that Exim supports are implemented as separate code modules
2820 which are included only if the relevant compile-time options are set. In the
2821 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2823 <literallayout class="monospaced">
2829 and similar settings apply to the other lookup types. They are all listed in
2830 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2831 libraries need to be installed before compiling Exim.
2832 <indexterm role="concept">
2833 <primary>cdb</primary>
2834 <secondary>including support for</secondary>
2836 However, there are some optional lookup types (such as cdb) for which
2837 the code is entirely contained within Exim, and no external include
2838 files or libraries are required. When a lookup type is not included in the
2839 binary, attempts to configure Exim to use it cause run time configuration
2843 <indexterm role="concept">
2844 <primary>Perl</primary>
2845 <secondary>including support for</secondary>
2847 Exim can be linked with an embedded Perl interpreter, allowing Perl
2848 subroutines to be called during string expansion. To enable this facility,
2850 <literallayout class="monospaced">
2854 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2855 chapter <xref linkend="CHAPperl"/>.
2858 <indexterm role="concept">
2859 <primary>X11 libraries</primary>
2860 <secondary>location of</secondary>
2862 The location of the X11 libraries is something that varies a lot between
2863 operating systems, and there may be different versions of X11 to cope
2864 with. Exim itself makes no use of X11, but if you are compiling the Exim
2865 monitor, the X11 libraries must be available.
2866 The following three variables are set in <filename>OS/Makefile-Default</filename>:
2868 <literallayout class="monospaced">
2870 XINCLUDE=-I$(X11)/include
2871 XLFLAGS=-L$(X11)/lib
2874 These are overridden in some of the operating-system configuration files. For
2875 example, in <filename>OS/Makefile-SunOS5</filename> there is
2877 <literallayout class="monospaced">
2879 XINCLUDE=-I$(X11)/include
2880 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
2883 If you need to override the default setting for your operating system, place a
2884 definition of all three of these variables into your
2885 <filename>Local/Makefile-<ostype></filename> file.
2888 <indexterm role="concept">
2889 <primary>EXTRALIBS</primary>
2891 If you need to add any extra libraries to the link steps, these can be put in a
2892 variable called EXTRALIBS, which appears in all the link commands, but by
2893 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
2894 command for linking the main Exim binary, and not for any associated utilities.
2897 <indexterm role="concept">
2898 <primary>DBM libraries</primary>
2899 <secondary>configuration for building</secondary>
2901 There is also DBMLIB, which appears in the link commands for binaries that
2902 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
2903 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
2904 binary, and which can be used, for example, to include additional X11
2908 <indexterm role="concept">
2909 <primary>configuration file</primary>
2910 <secondary>editing</secondary>
2912 The make file copes with rebuilding Exim correctly if any of the configuration
2913 files are edited. However, if an optional configuration file is deleted, it is
2914 necessary to touch the associated non-optional file (that is,
2915 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
2919 <title>OS-specific header files</title>
2921 <indexterm role="concept">
2922 <primary><filename>os.h</filename></primary>
2924 <indexterm role="concept">
2925 <primary>building Exim</primary>
2926 <secondary>OS-specific C header files</secondary>
2928 The <filename>OS</filename> directory contains a number of files with names of the form
2929 <filename>os.h-<ostype></filename>. These are system-specific C header files that should not
2930 normally need to be changed. There is a list of macro settings that are
2931 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
2932 are porting Exim to a new operating system.
2936 <title>Overriding build-time options for the monitor</title>
2938 <indexterm role="concept">
2939 <primary>building Eximon</primary>
2940 <secondary>overriding default options</secondary>
2942 A similar process is used for overriding things when building the Exim monitor,
2943 where the files that are involved are
2946 <filename>OS/eximon.conf-Default</filename>
2947 <filename>OS/eximon.conf-</filename><<emphasis>ostype</emphasis>>
2948 <filename>Local/eximon.conf</filename>
2949 <filename>Local/eximon.conf-</filename><<emphasis>ostype</emphasis>>
2950 <filename>Local/eximon.conf-</filename><<emphasis>archtype</emphasis>>
2951 <filename>Local/eximon.conf-</filename><<emphasis>ostype</emphasis>>-<<emphasis>archtype</emphasis>>
2954 <indexterm role="concept">
2955 <primary><filename>Local/eximon.conf</filename></primary>
2957 As with Exim itself, the final three files need not exist, and in this case the
2958 <filename>OS/eximon.conf-<ostype></filename> file is also optional. The default values in
2959 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
2960 variables of the same name, preceded by EXIMON_. For example, setting
2961 EXIMON_LOG_DEPTH in the environment overrides the value of
2962 LOG_DEPTH at run time.
2963 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
2967 <title>Installing Exim binaries and scripts</title>
2969 <indexterm role="concept">
2970 <primary>installing Exim</primary>
2972 <indexterm role="concept">
2973 <primary>BIN_DIRECTORY</primary>
2975 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
2976 arguments. The script copies binaries and utility scripts into the directory
2977 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
2978 <indexterm role="concept">
2979 <primary>setuid</primary>
2980 <secondary>installing Exim with</secondary>
2982 The install script copies files only if they are newer than the files they are
2983 going to replace. The Exim binary is required to be owned by root and have the
2984 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
2985 install</literal> as root so that it can set up the Exim binary in this way. However, in
2986 some special situations (for example, if a host is doing no local deliveries)
2987 it may be possible to run Exim without making the binary setuid root (see
2988 chapter <xref linkend="CHAPsecurity"/> for details).
2991 <indexterm role="concept">
2992 <primary>CONFIGURE_FILE</primary>
2994 Exim’s run time configuration file is named by the CONFIGURE_FILE setting
2995 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
2996 exist, the default configuration file <filename>src/configure.default</filename> is copied there
2997 by the installation script. If a run time configuration file already exists, it
2998 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
2999 alternative files, no default is installed.
3002 <indexterm role="concept">
3003 <primary>system aliases file</primary>
3005 <indexterm role="concept">
3006 <primary><filename>/etc/aliases</filename></primary>
3008 One change is made to the default configuration file when it is installed: the
3009 default configuration contains a router that references a system aliases file.
3010 The path to this file is set to the value specified by
3011 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
3012 If the system aliases file does not exist, the installation script creates it,
3013 and outputs a comment to the user.
3016 The created file contains no aliases, but it does contain comments about the
3017 aliases a site should normally have. Mail aliases have traditionally been
3018 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
3019 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
3020 Exim’s configuration if necessary.
3023 The default configuration uses the local host’s name as the only local domain,
3024 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
3025 running as the local user. System aliases and <filename>.forward</filename> files in users’ home
3026 directories are supported, but no NIS or NIS+ support is configured. Domains
3027 other than the name of the local host are routed using the DNS, with delivery
3031 It is possible to install Exim for special purposes (such as building a binary
3032 distribution) in a private part of the file system. You can do this by a
3035 <literallayout class="monospaced">
3036 make DESTDIR=/some/directory/ install
3039 This has the effect of pre-pending the specified directory to all the file
3040 paths, except the name of the system aliases file that appears in the default
3041 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3042 For backwards compatibility, ROOT is used if DESTDIR is not set,
3043 but this usage is deprecated.
3046 <indexterm role="concept">
3047 <primary>installing Exim</primary>
3048 <secondary>what is not installed</secondary>
3050 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3051 <emphasis>convert4r4</emphasis>, or the <emphasis>pcretest</emphasis> test program. You will probably run the
3052 first of these only once (if you are upgrading from Exim 3), and the second
3053 isn’t really part of Exim. None of the documentation files in the <filename>doc</filename>
3054 directory are copied, except for the info files when you have set
3055 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3058 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3059 to their names. The Exim binary itself, however, is handled differently. It is
3060 installed under a name that includes the version number and the compile number,
3061 for example <filename>exim-4.64-1</filename>. The script then arranges for a symbolic link
3062 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3063 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3064 from the directory (as seen by other processes).
3067 <indexterm role="concept">
3068 <primary>installing Exim</primary>
3069 <secondary>testing the script</secondary>
3071 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3072 real, you can pass the <option>-n</option> option to the installation script by this
3075 <literallayout class="monospaced">
3076 make INSTALL_ARG=-n install
3079 The contents of the variable INSTALL_ARG are passed to the installation
3080 script. You do not need to be root to run this test. Alternatively, you can run
3081 the installation script directly, but this must be from within the build
3082 directory. For example, from the top-level Exim directory you could use this
3085 <literallayout class="monospaced">
3086 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3089 <indexterm role="concept">
3090 <primary>installing Exim</primary>
3091 <secondary>install script options</secondary>
3093 There are two other options that can be supplied to the installation script.
3098 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3099 to root, and the call to make it a setuid binary.
3104 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3110 INSTALL_ARG can be used to pass these options to the script. For example:
3112 <literallayout class="monospaced">
3113 make INSTALL_ARG=-no_symlink install
3116 The installation script can also be given arguments specifying which files are
3117 to be copied. For example, to install just the Exim binary, and nothing else,
3118 without creating the symbolic link, you could use:
3120 <literallayout class="monospaced">
3121 make INSTALL_ARG='-no_symlink exim' install
3124 <section id="SECTinsinfdoc">
3125 <title>Installing info documentation</title>
3127 <indexterm role="concept">
3128 <primary>installing Exim</primary>
3129 <secondary><emphasis>info</emphasis> documentation</secondary>
3131 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3132 reason, the Texinfo source of Exim’s documentation is not included in the main
3133 distribution. Instead it is available separately from the ftp site (see section
3134 <xref linkend="SECTavail"/>).
3137 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3138 source of the documentation is found in the source tree, running <literal>make
3139 install</literal> automatically builds the info files and installs them.
3143 <title>Setting up the spool directory</title>
3145 <indexterm role="concept">
3146 <primary>spool directory</primary>
3147 <secondary>creating</secondary>
3149 When it starts up, Exim tries to create its spool directory if it does not
3150 exist. The Exim uid and gid are used for the owner and group of the spool
3151 directory. Sub-directories are automatically created in the spool directory as
3156 <title>Testing</title>
3158 <indexterm role="concept">
3159 <primary>testing</primary>
3160 <secondary>installation</secondary>
3162 Having installed Exim, you can check that the run time configuration file is
3163 syntactically valid by running the following command, which assumes that the
3164 Exim binary directory is within your PATH environment variable:
3166 <literallayout class="monospaced">
3170 If there are any errors in the configuration file, Exim outputs error messages.
3171 Otherwise it outputs the version number and build date,
3172 the DBM library that is being used, and information about which drivers and
3173 other optional code modules are included in the binary.
3174 Some simple routing tests can be done by using the address testing option. For
3178 <literal>exim -bt</literal> <<emphasis>local username</emphasis>>
3181 should verify that it recognizes a local mailbox, and
3184 <literal>exim -bt</literal> <<emphasis>remote address</emphasis>>
3187 a remote one. Then try getting it to deliver mail, both locally and remotely.
3188 This can be done by passing messages directly to Exim, without going through a
3189 user agent. For example:
3191 <literallayout class="monospaced">
3192 exim -v postmaster@your.domain.example
3193 From: user@your.domain.example
3194 To: postmaster@your.domain.example
3195 Subject: Testing Exim
3197 This is a test message.
3201 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3202 In this case you should see copies of three log lines, one for the message’s
3203 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3206 <indexterm role="concept">
3207 <primary>delivery</primary>
3208 <secondary>problems with</secondary>
3210 If you encounter problems, look at Exim’s log files (<emphasis>mainlog</emphasis> and
3211 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3212 of information is running Exim with debugging turned on, by specifying the
3213 <option>-d</option> option. If a message is stuck on Exim’s spool, you can force a delivery
3214 with debugging turned on by a command of the form
3217 <literal>exim -d -M</literal> <<emphasis>exim-message-id</emphasis>>
3220 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3221 produces rather a lot of output, but you can cut this down to specific areas.
3222 For example, if you use <option>-d-all+route</option> only the debugging information
3223 relevant to routing is included. (See the <option>-d</option> option in chapter
3224 <xref linkend="CHAPcommandline"/> for more details.)
3227 <indexterm role="concept">
3228 <primary><quote>sticky</quote> bit</primary>
3230 <indexterm role="concept">
3231 <primary>lock files</primary>
3233 One specific problem that has shown up on some sites is the inability to do
3234 local deliveries into a shared mailbox directory, because it does not have the
3235 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3236 writing to a mailbox file, and if it cannot create the lock file, the delivery
3237 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3238 directory, or by setting a specific group for local deliveries and allowing
3239 that group to create files in the directory (see the comments above the
3240 <command>local_delivery</command> transport in the default configuration file). Another
3241 approach is to configure Exim not to use lock files, but just to rely on
3242 <function>fcntl()</function> locking instead. However, you should do this only if all user
3243 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3244 see chapter <xref linkend="CHAPappendfile"/>.
3247 One thing that cannot be tested on a system that is already running an MTA is
3248 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3249 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3250 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3251 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3255 Testing a new version on a system that is already running Exim can most easily
3256 be done by building a binary with a different CONFIGURE_FILE setting. From
3257 within the run time configuration, all other file and directory names
3258 that Exim uses can be altered, in order to keep it entirely clear of the
3263 <title>Replacing another MTA with Exim</title>
3265 <indexterm role="concept">
3266 <primary>replacing another MTA</primary>
3268 Building and installing Exim for the first time does not of itself put it in
3269 general use. The name by which the system’s MTA is called by mail user agents
3270 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3271 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3272 binary in order to get the user agents to pass messages to Exim. This is
3273 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3274 or <filename>/usr/lib/sendmail</filename>
3275 <indexterm role="concept">
3276 <primary>symbolic link</primary>
3277 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3279 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3280 privilege and executable status from the old MTA. It is then necessary to stop
3281 and restart the mailer daemon, if one is running.
3284 <indexterm role="concept">
3285 <primary>FreeBSD</primary>
3286 <secondary>MTA indirection</secondary>
3288 <indexterm role="concept">
3289 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3291 Some operating systems have introduced alternative ways of switching MTAs. For
3292 example, if you are running FreeBSD, you need to edit the file
3293 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3294 described. A typical example of the contents of this file for running Exim is
3297 <literallayout class="monospaced">
3298 sendmail /usr/exim/bin/exim
3299 send-mail /usr/exim/bin/exim
3300 mailq /usr/exim/bin/exim -bp
3301 newaliases /usr/bin/true
3304 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3305 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3306 favourite user agent.
3309 You should consider what to tell your users about the change of MTA. Exim may
3310 have different capabilities to what was previously running, and there are
3311 various operational differences such as the text of messages produced by
3312 command line options and in bounce messages. If you allow your users to make
3313 use of Exim’s filtering capabilities, you should make the document entitled
3314 <emphasis>Exim’s interface to mail filtering</emphasis> available to them.
3318 <title>Upgrading Exim</title>
3320 <indexterm role="concept">
3321 <primary>upgrading Exim</primary>
3323 If you are already running Exim on your host, building and installing a new
3324 version automatically makes it available to MUAs, or any other programs that
3325 call the MTA directly. However, if you are running an Exim daemon, you do need
3326 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3327 new binary. You do not need to stop processing mail in order to install a new
3328 version of Exim. The install script does not modify an existing runtime
3333 <title>Stopping the Exim daemon on Solaris</title>
3335 <indexterm role="concept">
3336 <primary>Solaris</primary>
3337 <secondary>stopping Exim on</secondary>
3339 The standard command for stopping the mailer daemon on Solaris is
3341 <literallayout class="monospaced">
3342 /etc/init.d/sendmail stop
3345 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3346 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3347 for the text <quote>sendmail</quote>; this is not present because the actual program name
3348 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3349 solution is to replace the line that finds the process id with something like
3351 <literallayout class="monospaced">
3352 pid=`cat /var/spool/exim/exim-daemon.pid`
3355 to obtain the daemon’s pid directly from the file that Exim saves it in.
3358 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3359 still be received from local processes, and if automatic delivery is configured
3360 (the normal case), deliveries will still occur.
3365 <chapter id="CHAPcommandline">
3366 <title>The Exim command line</title>
3368 <indexterm role="concept" id="IIDclo1" class="startofrange">
3369 <primary>command line</primary>
3370 <secondary>options</secondary>
3372 <indexterm role="concept" id="IIDclo2" class="startofrange">
3373 <primary>options</primary>
3374 <secondary>command line</secondary>
3376 Exim’s command line takes the standard Unix form of a sequence of options,
3377 each starting with a hyphen character, followed by a number of arguments. The
3378 options are compatible with the main options of Sendmail, and there are also
3379 some additional options, some of which are compatible with Smail 3. Certain
3380 combinations of options do not make sense, and provoke an error if used.
3381 The form of the arguments depends on which options are set.
3384 <title>Setting options by program name</title>
3386 <indexterm role="concept">
3387 <primary><emphasis>mailq</emphasis></primary>
3389 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3390 were present before any other options.
3391 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3393 This feature is for compatibility with some systems that contain a command of
3394 that name in one of the standard libraries, symbolically linked to
3395 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3398 <indexterm role="concept">
3399 <primary><emphasis>rsmtp</emphasis></primary>
3401 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3402 were present before any other options, for compatibility with Smail. The
3403 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3407 <indexterm role="concept">
3408 <primary><emphasis>rmail</emphasis></primary>
3410 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3411 <option>-oee</option> options were present before any other options, for compatibility with
3412 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3415 <indexterm role="concept">
3416 <primary><emphasis>runq</emphasis></primary>
3418 <indexterm role="concept">
3419 <primary>queue runner</primary>
3421 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3422 were present before any other options, for compatibility with Smail. The <option>-q</option>
3423 option causes a single queue runner process to be started.
3426 <indexterm role="concept">
3427 <primary><emphasis>newaliases</emphasis></primary>
3429 <indexterm role="concept">
3430 <primary>alias file</primary>
3431 <secondary>building</secondary>
3433 <indexterm role="concept">
3434 <primary>Sendmail compatibility</primary>
3435 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3437 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3438 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3439 This option is used for rebuilding Sendmail’s alias file. Exim does not have
3440 the concept of a single alias file, but can be configured to run a given
3441 command if called with the <option>-bi</option> option.
3444 <section id="SECTtrustedadmin">
3445 <title>Trusted and admin users</title>
3447 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3448 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3449 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3450 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3451 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3456 <indexterm role="concept">
3457 <primary>trusted user</primary>
3458 <secondary>definition of</secondary>
3460 <indexterm role="concept">
3461 <primary>user</primary>
3462 <secondary>trusted definition of</secondary>
3464 The trusted users are root, the Exim user, any user listed in the
3465 <option>trusted_users</option> configuration option, and any user whose current group or any
3466 supplementary group is one of those listed in the <option>trusted_groups</option>
3467 configuration option. Note that the Exim group is not automatically trusted.
3470 <indexterm role="concept">
3471 <primary><quote>From</quote> line</primary>
3473 <indexterm role="concept">
3474 <primary>envelope sender</primary>
3476 Trusted users are always permitted to use the <option>-f</option> option or a leading
3477 <quote>From </quote> line to specify the envelope sender of a message that is passed to
3478 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3479 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3480 users to set envelope senders.
3483 <indexterm role="concept">
3484 <primary><emphasis>From:</emphasis> header line</primary>
3486 <indexterm role="concept">
3487 <primary><emphasis>Sender:</emphasis> header line</primary>
3489 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3490 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3491 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3494 Trusted users may also specify a host name, host address, interface address,
3495 protocol name, ident value, and authentication data when submitting a message
3496 locally. Thus, they are able to insert messages into Exim’s queue locally that
3497 have the characteristics of messages received from a remote host. Untrusted
3498 users may in some circumstances use <option>-f</option>, but can never set the other values
3499 that are available to trusted users.
3504 <indexterm role="concept">
3505 <primary>user</primary>
3506 <secondary>admin definition of</secondary>
3508 <indexterm role="concept">
3509 <primary>admin user</primary>
3510 <secondary>definition of</secondary>
3512 The admin users are root, the Exim user, and any user that is a member of the
3513 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3514 The current group does not have to be one of these groups.
3517 Admin users are permitted to list the queue, and to carry out certain
3518 operations on messages, for example, to force delivery failures. It is also
3519 necessary to be an admin user in order to see the full information provided by
3520 the Exim monitor, and full debugging output.
3523 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3524 Exim to attempt delivery of messages on its queue is restricted to admin users.
3525 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3526 option false (that is, specifying <option>no_prod_requires_admin</option>).
3529 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3530 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3536 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3537 edit Exim’s configuration file, you are giving those users an easy way of
3538 getting root. There is further discussion of this issue at the start of chapter
3539 <xref linkend="CHAPconf"/>.
3543 <title>Command line options</title>
3545 Exim’s command line options are described in alphabetical order below. If none
3546 of the options that specifies a specific action (such as starting the daemon or
3547 a queue runner, or testing an address, or receiving a message in a specific
3548 format, or listing the queue) are present, and there is at least one argument
3549 on the command line, <option>-bm</option> (accept a local message on the standard input,
3550 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3551 outputs a brief message about itself and exits.
3553 <!-- === Start of command line options === -->
3556 <term><option>--</option></term>
3559 <indexterm role="option">
3560 <primary>--</primary>
3562 <indexterm role="concept">
3563 <primary>options</primary>
3564 <secondary>command line; terminating</secondary>
3566 This is a pseudo-option whose only purpose is to terminate the options and
3567 therefore to cause subsequent command line items to be treated as arguments
3568 rather than options, even if they begin with hyphens.
3570 </listitem></varlistentry>
3572 <term><option>--help</option></term>
3575 <indexterm role="option">
3576 <primary><option>--help</option></primary>
3578 This option causes Exim to output a few sentences stating what it is.
3579 The same output is generated if the Exim binary is called with no options and
3582 </listitem></varlistentry>
3584 <term><option>-B</option><<emphasis>type</emphasis>></term>
3587 <indexterm role="option">
3588 <primary><option>-B</option></primary>
3590 <indexterm role="concept">
3591 <primary>8-bit characters</primary>
3593 <indexterm role="concept">
3594 <primary>Sendmail compatibility</primary>
3595 <secondary>8-bit characters</secondary>
3597 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3598 clean; it ignores this option.
3600 </listitem></varlistentry>
3602 <term><option>-bd</option></term>
3605 <indexterm role="option">
3606 <primary><option>-bd</option></primary>
3608 <indexterm role="concept">
3609 <primary>daemon</primary>
3611 <indexterm role="concept">
3612 <primary>SMTP listener</primary>
3614 <indexterm role="concept">
3615 <primary>queue runner</primary>
3617 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3618 the <option>-bd</option> option is combined with the <option>-q</option><<emphasis>time</emphasis>> option, to specify
3619 that the daemon should also initiate periodic queue runs.
3622 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3623 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3624 disconnect from the controlling terminal. When running this way, it can be
3625 stopped by pressing ctrl-C.
3628 By default, Exim listens for incoming connections to the standard SMTP port on
3629 all the host’s running interfaces. However, it is possible to listen on other
3630 ports, on multiple ports, and only on specific interfaces. Chapter
3631 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3634 When a listening daemon
3635 <indexterm role="concept">
3636 <primary>daemon</primary>
3637 <secondary>process id (pid)</secondary>
3639 <indexterm role="concept">
3640 <primary>pid (process id)</primary>
3641 <secondary>of daemon</secondary>
3643 is started without the use of <option>-oX</option> (that is, without overriding the normal
3644 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3645 in Exim’s spool directory. This location can be overridden by setting
3646 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3650 When <option>-oX</option> is used on the command line to start a listening daemon, the
3651 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3652 used to specify a path on the command line if a pid file is required.
3656 <indexterm role="concept">
3657 <primary>SIGHUP</primary>
3659 <indexterm role="concept">
3660 <primary>daemon</primary>
3661 <secondary>restarting</secondary>
3663 can be used to cause the daemon to re-execute itself. This should be done
3664 whenever Exim’s configuration file, or any file that is incorporated into it by
3665 means of the <option>.include</option> facility, is changed, and also whenever a new version
3666 of Exim is installed. It is not necessary to do this when other files that are
3667 referenced from the configuration (for example, alias files) are changed,
3668 because these are reread each time they are used.
3670 </listitem></varlistentry>
3672 <term><option>-bdf</option></term>
3675 <indexterm role="option">
3676 <primary><option>-bdf</option></primary>
3678 This option has the same effect as <option>-bd</option> except that it never disconnects
3679 from the controlling terminal, even when no debugging is specified.
3681 </listitem></varlistentry>
3683 <term><option>-be</option></term>
3686 <indexterm role="option">
3687 <primary><option>-be</option></primary>
3689 <indexterm role="concept">
3690 <primary>testing</primary>
3691 <secondary>string expansion</secondary>
3693 <indexterm role="concept">
3694 <primary>expansion</primary>
3695 <secondary>testing</secondary>
3697 Run Exim in expansion testing mode. Exim discards its root privilege, to
3698 prevent ordinary users from using this mode to read otherwise inaccessible
3699 files. If no arguments are given, Exim runs interactively, prompting for lines
3700 of data. Otherwise, it processes each argument in turn.
3703 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3704 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3705 used without command line arguments. If successful, it uses the <function>readline()</function>
3706 function, which provides extensive line-editing facilities, for reading the
3707 test data. A line history is supported.
3710 Long expansion expressions can be split over several lines by using backslash
3711 continuations. As in Exim’s run time configuration, white space at the start of
3712 continuation lines is ignored. Each argument or data line is passed through the
3713 string expansion mechanism, and the result is output. Variable values from the
3714 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3715 message-specific values (such as <varname>$sender_domain</varname>) are set, because no message
3716 is being processed <phrase revisionflag="changed">(but see <option>-bem</option> and <option>-Mset</option>)</phrase>.
3719 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3720 files or databases you are using, you must exit and restart Exim before trying
3721 the same lookup again. Otherwise, because each Exim process caches the results
3722 of lookups, you will just get the same result as before.
3724 </listitem></varlistentry>
3725 <varlistentry revisionflag="changed">
3726 <term><option>-bem</option> <<emphasis>filename</emphasis>></term>
3728 <para revisionflag="changed">
3729 <indexterm role="option">
3730 <primary><option>-bem</option></primary>
3732 <indexterm role="concept">
3733 <primary>testing</primary>
3734 <secondary>string expansion</secondary>
3736 <indexterm role="concept">
3737 <primary>expansion</primary>
3738 <secondary>testing</secondary>
3740 This option operates like <option>-be</option> except that it must be followed by the name
3741 of a file. For example:
3743 <literallayout class="monospaced" revisionflag="changed">
3744 exim -bem /tmp/testmessage
3746 <para revisionflag="changed">
3747 The file is read as a message (as if receiving a locally-submitted non-SMTP
3748 message) before any of the test expansions are done. Thus, message-specific
3749 variables such as <varname>$message_size</varname> and <varname>$header_from:</varname> are available. However,
3750 no <emphasis>Received:</emphasis> header is added to the message. If the <option>-t</option> option is set,
3751 recipients are read from the headers in the normal way, and are shown in the
3752 <varname>$recipients</varname> variable. Note that recipients cannot be given on the command
3753 line, because further arguments are taken as strings to expand (just like
3754 <option>-be</option>).
3756 </listitem></varlistentry>
3758 <term><option>-bF</option> <<emphasis>filename</emphasis>></term>
3761 <indexterm role="option">
3762 <primary><option>-bF</option></primary>
3764 <indexterm role="concept">
3765 <primary>system filter</primary>
3766 <secondary>testing</secondary>
3768 <indexterm role="concept">
3769 <primary>testing</primary>
3770 <secondary>system filter</secondary>
3772 This option is the same as <option>-bf</option> except that it assumes that the filter being
3773 tested is a system filter. The additional commands that are available only in
3774 system filters are recognized.
3776 </listitem></varlistentry>
3778 <term><option>-bf</option> <<emphasis>filename</emphasis>></term>
3781 <indexterm role="option">
3782 <primary><option>-bf</option></primary>
3784 <indexterm role="concept">
3785 <primary>filter</primary>
3786 <secondary>testing</secondary>
3788 <indexterm role="concept">
3789 <primary>testing</primary>
3790 <secondary>filter file</secondary>
3792 <indexterm role="concept">
3793 <primary>forward file</primary>
3794 <secondary>testing</secondary>
3796 <indexterm role="concept">
3797 <primary>testing</primary>
3798 <secondary>forward file</secondary>
3800 <indexterm role="concept">
3801 <primary>Sieve filter</primary>
3802 <secondary>testing</secondary>
3804 This option runs Exim in user filter testing mode; the file is the filter file
3805 to be tested, and a test message must be supplied on the standard input. If
3806 there are no message-dependent tests in the filter, an empty file can be
3810 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
3811 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
3812 filter and a user filter in the same run. For example:
3814 <literallayout class="monospaced">
3815 exim -bF /system/filter -bf /user/filter </test/message
3818 This is helpful when the system filter adds header lines or sets filter
3819 variables that are used by the user filter.
3822 If the test filter file does not begin with one of the special lines
3824 <literallayout class="monospaced">
3829 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
3830 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
3831 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
3835 The result of an Exim command that uses <option>-bf</option>, provided no errors are
3836 detected, is a list of the actions that Exim would try to take if presented
3837 with the message for real. More details of filter testing are given in the
3838 separate document entitled <emphasis>Exim’s interfaces to mail filtering</emphasis>.
3841 When testing a filter file,
3842 <indexterm role="concept">
3843 <primary><quote>From</quote> line</primary>
3845 <indexterm role="concept">
3846 <primary>envelope sender</primary>
3848 <indexterm role="concept">
3849 <primary><option>-f</option> option</primary>
3850 <secondary>for filter testing</secondary>
3852 the envelope sender can be set by the <option>-f</option> option,
3853 or by a <quote>From </quote> line at the start of the test message. Various parameters
3854 that would normally be taken from the envelope recipient address of the message
3855 can be set by means of additional command line options (see the next four
3858 </listitem></varlistentry>
3860 <term><option>-bfd</option> <<emphasis>domain</emphasis>></term>
3863 <indexterm role="option">
3864 <primary><option>-bfd</option></primary>
3866 <indexterm role="concept">
3867 <primary><varname>$qualify_domain</varname></primary>
3869 This sets the domain of the recipient address when a filter file is being
3870 tested by means of the <option>-bf</option> option. The default is the value of
3871 <varname>$qualify_domain</varname>.
3873 </listitem></varlistentry>
3875 <term><option>-bfl</option> <<emphasis>local part</emphasis>></term>
3878 <indexterm role="option">
3879 <primary><option>-bfl</option></primary>
3881 This sets the local part of the recipient address when a filter file is being
3882 tested by means of the <option>-bf</option> option. The default is the username of the
3883 process that calls Exim. A local part should be specified with any prefix or
3884 suffix stripped, because that is how it appears to the filter when a message is
3885 actually being delivered.
3887 </listitem></varlistentry>
3889 <term><option>-bfp</option> <<emphasis>prefix</emphasis>></term>
3892 <indexterm role="option">
3893 <primary><option>-bfp</option></primary>
3895 This sets the prefix of the local part of the recipient address when a filter
3896 file is being tested by means of the <option>-bf</option> option. The default is an empty
3899 </listitem></varlistentry>
3901 <term><option>-bfs</option> <<emphasis>suffix</emphasis>></term>
3904 <indexterm role="option">
3905 <primary><option>-bfs</option></primary>
3907 This sets the suffix of the local part of the recipient address when a filter
3908 file is being tested by means of the <option>-bf</option> option. The default is an empty
3911 </listitem></varlistentry>
3913 <term><option>-bh</option> <<emphasis>IP address</emphasis>></term>
3916 <indexterm role="option">
3917 <primary><option>-bh</option></primary>
3919 <indexterm role="concept">
3920 <primary>testing</primary>
3921 <secondary>incoming SMTP</secondary>
3923 <indexterm role="concept">
3924 <primary>SMTP</primary>
3925 <secondary>testing incoming</secondary>
3927 <indexterm role="concept">
3928 <primary>testing</primary>
3929 <secondary>relay control</secondary>
3931 <indexterm role="concept">
3932 <primary>relaying</primary>
3933 <secondary>testing configuration</secondary>
3935 <indexterm role="concept">
3936 <primary>policy control</primary>
3937 <secondary>testing</secondary>
3939 <indexterm role="concept">
3940 <primary>debugging</primary>
3941 <secondary><option>-bh</option> option</secondary>
3943 This option runs a fake SMTP session as if from the given IP address, using the
3944 standard input and output. The IP address may include a port number at the end,
3945 after a full stop. For example:
3947 <literallayout class="monospaced">
3948 exim -bh 10.9.8.7.1234
3949 exim -bh fe80::a00:20ff:fe86:a061.5678
3952 When an IPv6 address is given, it is converted into canonical form. In the case
3953 of the second example above, the value of <varname>$sender_host_address</varname> after
3954 conversion to the canonical form is
3955 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
3958 Comments as to what is going on are written to the standard error file. These
3959 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
3960 This facility is provided for testing configuration options for incoming
3961 messages, to make sure they implement the required policy. For example, you can
3962 test your relay controls using <option>-bh</option>.
3965 <emphasis role="bold">Warning 1</emphasis>:
3966 <indexterm role="concept">
3967 <primary>RFC 1413</primary>
3969 You can test features of the configuration that rely on ident (RFC 1413)
3970 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
3971 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
3975 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
3976 are also skipped when testing using <option>-bh</option>. If you want these callouts to
3977 occur, use <option>-bhc</option> instead.
3980 Messages supplied during the testing session are discarded, and nothing is
3981 written to any of the real log files. There may be pauses when DNS (and other)
3982 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
3983 can be used to specify a specific IP interface and port if this is important,
3984 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
3985 session were authenticated.
3988 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
3989 output just states whether a given recipient address from a given host is
3990 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
3992 <para revisionflag="changed">
3993 Features such as authentication and encryption, where the client input is not
3994 plain text, are most easily tested using specialized SMTP test programs such as
3995 <emphasis role="bold"><ulink url="http://jetmore.org/john/code/#swaks">swaks</ulink></emphasis>.
3997 </listitem></varlistentry>
3999 <term><option>-bhc</option> <<emphasis>IP address</emphasis>></term>
4002 <indexterm role="option">
4003 <primary><option>-bhc</option></primary>
4005 This option operates in the same way as <option>-bh</option>, except that address
4006 verification callouts are performed if required. This includes consulting and
4007 updating the callout cache database.
4009 </listitem></varlistentry>
4011 <term><option>-bi</option></term>
4014 <indexterm role="option">
4015 <primary><option>-bi</option></primary>
4017 <indexterm role="concept">
4018 <primary>alias file</primary>
4019 <secondary>building</secondary>
4021 <indexterm role="concept">
4022 <primary>building alias file</primary>
4024 <indexterm role="concept">
4025 <primary>Sendmail compatibility</primary>
4026 <secondary><option>-bi</option> option</secondary>
4028 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
4029 Exim does not have the concept of a single alias file, and so it cannot mimic
4030 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
4031 tend to appear in various scripts such as NIS make files, so the option must be
4035 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
4036 configuration option is run, under the uid and gid of the caller of Exim. If
4037 the <option>-oA</option> option is used, its value is passed to the command as an argument.
4038 The command set by <option>bi_command</option> may not contain arguments. The command can
4039 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
4040 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4041 <option>-bi</option> is a no-op.
4043 </listitem></varlistentry>
4045 <term><option>-bm</option></term>
4048 <indexterm role="option">
4049 <primary><option>-bm</option></primary>
4051 <indexterm role="concept">
4052 <primary>local message reception</primary>
4054 This option runs an Exim receiving process that accepts an incoming,
4055 locally-generated message on the current input. The recipients are given as the
4056 command arguments (except when <option>-t</option> is also present – see below). Each
4057 argument can be a comma-separated list of RFC 2822 addresses. This is the
4058 default option for selecting the overall action of an Exim call; it is assumed
4059 if no other conflicting option is present.
4062 If any addresses in the message are unqualified (have no domain), they are
4063 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4064 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4065 suppressing this for special cases.
4068 Policy checks on the contents of local messages can be enforced by means of
4069 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4072 <indexterm role="concept">
4073 <primary>return code</primary>
4074 <secondary>for <option>-bm</option></secondary>
4076 The return code is zero if the message is successfully accepted. Otherwise, the
4077 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting – see below.
4081 <indexterm role="concept">
4082 <primary>message</primary>
4083 <secondary>format</secondary>
4085 <indexterm role="concept">
4086 <primary>format</primary>
4087 <secondary>message</secondary>
4089 <indexterm role="concept">
4090 <primary><quote>From</quote> line</primary>
4092 <indexterm role="concept">
4093 <primary>UUCP</primary>
4094 <secondary><quote>From</quote> line</secondary>
4096 <indexterm role="concept">
4097 <primary>Sendmail compatibility</primary>
4098 <secondary><quote>From</quote> line</secondary>
4100 of the message must be as defined in RFC 2822, except that, for
4101 compatibility with Sendmail and Smail, a line in one of the forms
4103 <literallayout class="monospaced">
4104 From sender Fri Jan 5 12:55 GMT 1997
4105 From sender Fri, 5 Jan 97 12:55:01
4108 (with the weekday optional, and possibly with additional text after the date)
4109 is permitted to appear at the start of the message. There appears to be no
4110 authoritative specification of the format of this line. Exim recognizes it by
4111 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4112 option, which can be changed if necessary.
4116 <indexterm role="concept">
4117 <primary><option>-f</option> option</primary>
4118 <secondary>overriding <quote>From</quote> line</secondary>
4120 specified sender is treated as if it were given as the argument to the
4121 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4122 preference to the address taken from the message. The caller of Exim must be a
4123 trusted user for the sender of a message to be set in this way.
4125 </listitem></varlistentry>
4127 <term><option>-bnq</option></term>
4130 <indexterm role="option">
4131 <primary><option>-bnq</option></primary>
4133 <indexterm role="concept">
4134 <primary>address qualification</primary>
4135 <secondary>suppressing</secondary>
4137 By default, Exim automatically qualifies unqualified addresses (those
4138 without domains) that appear in messages that are submitted locally (that
4139 is, not over TCP/IP). This qualification applies both to addresses in
4140 envelopes, and addresses in header lines. Sender addresses are qualified using
4141 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4142 defaults to the value of <option>qualify_domain</option>).
4145 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4146 being used to re-submit messages that originally came from remote hosts after
4147 content scanning, you probably do not want to qualify unqualified addresses in
4148 header lines. (Such lines will be present only if you have not enabled a header
4149 syntax check in the appropriate ACL.)
4152 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4153 messages that originate on the local host. When this is used, unqualified
4154 addresses in the envelope provoke errors (causing message rejection) and
4155 unqualified addresses in header lines are left alone.
4157 </listitem></varlistentry>
4159 <term><option>-bP</option></term>
4162 <indexterm role="option">
4163 <primary><option>-bP</option></primary>
4165 <indexterm role="concept">
4166 <primary>configuration options</primary>
4167 <secondary>extracting</secondary>
4169 <indexterm role="concept">
4170 <primary>options</primary>
4171 <secondary>configuration – extracting</secondary>
4173 If this option is given with no arguments, it causes the values of all Exim’s
4174 main configuration options to be written to the standard output. The values
4175 of one or more specific options can be requested by giving their names as
4176 arguments, for example:
4178 <literallayout class="monospaced">
4179 exim -bP qualify_domain hold_domains
4182 However, any option setting that is preceded by the word <quote>hide</quote> in the
4183 configuration file is not shown in full, except to an admin user. For other
4184 users, the output is as in this example:
4186 <literallayout class="monospaced">
4187 mysql_servers = <value not displayable>
4190 If <option>configure_file</option> is given as an argument, the name of the run time
4191 configuration file is output.
4192 If a list of configuration files was supplied, the value that is output here
4193 is the name of the file that was actually used.
4196 <indexterm role="concept">
4197 <primary>daemon</primary>
4198 <secondary>process id (pid)</secondary>
4200 <indexterm role="concept">
4201 <primary>pid (process id)</primary>
4202 <secondary>of daemon</secondary>
4204 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4205 directories where log files and daemon pid files are written are output,
4206 respectively. If these values are unset, log files are written in a
4207 sub-directory of the spool directory called <option>log</option>, and the pid file is
4208 written directly into the spool directory.
4211 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4213 <literallayout class="monospaced">
4214 exim -bP +local_domains
4217 it searches for a matching named list of any type (domain, host, address, or
4218 local part) and outputs what it finds.
4221 <indexterm role="concept">
4222 <primary>options</primary>
4223 <secondary>router – extracting</secondary>
4225 <indexterm role="concept">
4226 <primary>options</primary>
4227 <secondary>transport – extracting</secondary>
4229 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4230 followed by the name of an appropriate driver instance, the option settings for
4231 that driver are output. For example:
4233 <literallayout class="monospaced">
4234 exim -bP transport local_delivery
4237 The generic driver options are output first, followed by the driver’s private
4238 options. A list of the names of drivers of a particular type can be obtained by
4239 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4240 <option>authenticator_list</option>, and a complete list of all drivers with their option
4241 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4242 <option>authenticators</option>.
4244 </listitem></varlistentry>
4246 <term><option>-bp</option></term>
4249 <indexterm role="option">
4250 <primary><option>-bp</option></primary>
4252 <indexterm role="concept">
4253 <primary>queue</primary>
4254 <secondary>listing messages on</secondary>
4256 <indexterm role="concept">
4257 <primary>listing</primary>
4258 <secondary>messages on the queue</secondary>
4260 This option requests a listing of the contents of the mail queue on the
4261 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4262 just those messages are listed. By default, this option can be used only by an
4263 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4264 to allow any user to see the queue.
4267 Each message on the queue is displayed as in the following example:
4269 <literallayout class="monospaced">
4270 25m 2.9K 0t5C6f-0000c8-00 <alice@wonderland.fict.example>
4271 red.king@looking-glass.fict.example
4272 <other addresses>
4275 <indexterm role="concept">
4276 <primary>message</primary>
4277 <secondary>size in queue listing</secondary>
4279 <indexterm role="concept">
4280 <primary>size</primary>
4281 <secondary>of message</secondary>
4283 The first line contains the length of time the message has been on the queue
4284 (in this case 25 minutes), the size of the message (2.9K), the unique local
4285 identifier for the message, and the message sender, as contained in the
4286 envelope. For bounce messages, the sender address is empty, and appears as
4287 <quote><></quote>. If the message was submitted locally by an untrusted user who overrode
4288 the default sender address, the user’s login name is shown in parentheses
4289 before the sender address.
4292 <indexterm role="concept">
4293 <primary>frozen messages</primary>
4294 <secondary>in queue listing</secondary>
4296 If the message is frozen (attempts to deliver it are suspended) then the text
4297 <quote>*** frozen ***</quote> is displayed at the end of this line.
4300 The recipients of the message (taken from the envelope, not the headers) are
4301 displayed on subsequent lines. Those addresses to which the message has already
4302 been delivered are marked with the letter D. If an original address gets
4303 expanded into several addresses via an alias or forward file, the original is
4304 displayed with a D only when deliveries for all of its child addresses are
4307 </listitem></varlistentry>
4309 <term><option>-bpa</option></term>
4312 <indexterm role="option">
4313 <primary><option>-bpa</option></primary>
4315 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4316 that were generated from the original top level address(es) in each message by
4317 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4318 of just <quote>D</quote>.
4320 </listitem></varlistentry>
4322 <term><option>-bpc</option></term>
4325 <indexterm role="option">
4326 <primary><option>-bpc</option></primary>
4328 <indexterm role="concept">
4329 <primary>queue</primary>
4330 <secondary>count of messages on</secondary>
4332 This option counts the number of messages on the queue, and writes the total
4333 to the standard output. It is restricted to admin users, unless
4334 <option>queue_list_requires_admin</option> is set false.
4336 </listitem></varlistentry>
4338 <term><option>-bpr</option></term>
4341 <indexterm role="option">
4342 <primary><option>-bpr</option></primary>
4344 This option operates like <option>-bp</option>, but the output is not sorted into
4345 chronological order of message arrival. This can speed it up when there are
4346 lots of messages on the queue, and is particularly useful if the output is
4347 going to be post-processed in a way that doesn’t need the sorting.
4349 </listitem></varlistentry>
4351 <term><option>-bpra</option></term>
4354 <indexterm role="option">
4355 <primary><option>-bpra</option></primary>
4357 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4359 </listitem></varlistentry>
4361 <term><option>-bpru</option></term>
4364 <indexterm role="option">
4365 <primary><option>-bpru</option></primary>
4367 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4369 </listitem></varlistentry>
4371 <term><option>-bpu</option></term>
4374 <indexterm role="option">
4375 <primary><option>-bpu</option></primary>
4377 This option operates like <option>-bp</option> but shows only undelivered top-level
4378 addresses for each message displayed. Addresses generated by aliasing or
4379 forwarding are not shown, unless the message was deferred after processing by a
4380 router with the <option>one_time</option> option set.
4382 </listitem></varlistentry>
4384 <term><option>-brt</option></term>
4387 <indexterm role="option">
4388 <primary><option>-brt</option></primary>
4390 <indexterm role="concept">
4391 <primary>testing</primary>
4392 <secondary>retry configuration</secondary>
4394 <indexterm role="concept">
4395 <primary>retry</primary>
4396 <secondary>configuration testing</secondary>
4398 This option is for testing retry rules, and it must be followed by up to three
4399 arguments. It causes Exim to look for a retry rule that matches the values
4400 and to write it to the standard output. For example:
4402 <literallayout class="monospaced">
4403 exim -brt bach.comp.mus.example
4404 Retry rule: *.comp.mus.example F,2h,15m; F,4d,30m;
4407 See chapter <xref linkend="CHAPretry"/> for a description of Exim’s retry rules. The first
4408 argument, which is required, can be a complete address in the form
4409 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4410 contains a dot, it is interpreted as an optional second domain name; if no
4411 retry rule is found for the first argument, the second is tried. This ties in
4412 with Exim’s behaviour when looking for retry rules for remote hosts – if no
4413 rule is found that matches the host, one that matches the mail domain is
4414 sought. Finally, an argument that is the name of a specific delivery error, as
4415 used in setting up retry rules, can be given. For example:
4417 <literallayout class="monospaced">
4418 exim -brt haydn.comp.mus.example quota_3d
4419 Retry rule: *@haydn.comp.mus.example quota_3d F,1h,15m
4421 </listitem></varlistentry>
4423 <term><option>-brw</option></term>
4426 <indexterm role="option">
4427 <primary><option>-brw</option></primary>
4429 <indexterm role="concept">
4430 <primary>testing</primary>
4431 <secondary>rewriting</secondary>
4433 <indexterm role="concept">
4434 <primary>rewriting</primary>
4435 <secondary>testing</secondary>
4437 This option is for testing address rewriting rules, and it must be followed by
4438 a single argument, consisting of either a local part without a domain, or a
4439 complete address with a fully qualified domain. Exim outputs how this address
4440 would be rewritten for each possible place it might appear. See chapter
4441 <xref linkend="CHAPrewrite"/> for further details.
4443 </listitem></varlistentry>
4445 <term><option>-bS</option></term>
4448 <indexterm role="option">
4449 <primary><option>-bS</option></primary>
4451 <indexterm role="concept">
4452 <primary>SMTP</primary>
4453 <secondary>batched incoming</secondary>
4455 <indexterm role="concept">
4456 <primary>batched SMTP input</primary>
4458 This option is used for batched SMTP input, which is an alternative interface
4459 for non-interactive local message submission. A number of messages can be
4460 submitted in a single run. However, despite its name, this is not really SMTP
4461 input. Exim reads each message’s envelope from SMTP commands on the standard
4462 input, but generates no responses. If the caller is trusted, or
4463 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4464 believed; otherwise the sender is always the caller of Exim.
4467 The message itself is read from the standard input, in SMTP format (leading
4468 dots doubled), terminated by a line containing just a single dot. An error is
4469 provoked if the terminating dot is missing. A further message may then follow.
4472 As for other local message submissions, the contents of incoming batch SMTP
4473 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4474 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4475 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4478 Some other SMTP commands are recognized in the input. HELO and EHLO act
4479 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4480 QUIT quits, ignoring the rest of the standard input.
4483 <indexterm role="concept">
4484 <primary>return code</primary>
4485 <secondary>for <option>-bS</option></secondary>
4487 If any error is encountered, reports are written to the standard output and
4488 error streams, and Exim gives up immediately. The return code is 0 if no error
4489 was detected; it is 1 if one or more messages were accepted before the error
4490 was detected; otherwise it is 2.
4493 More details of input using batched SMTP are given in section
4494 <xref linkend="SECTincomingbatchedSMTP"/>.
4496 </listitem></varlistentry>
4498 <term><option>-bs</option></term>
4501 <indexterm role="option">
4502 <primary><option>-bs</option></primary>
4504 <indexterm role="concept">
4505 <primary>SMTP</primary>
4506 <secondary>local input</secondary>
4508 <indexterm role="concept">
4509 <primary>local SMTP input</primary>
4511 This option causes Exim to accept one or more messages by reading SMTP commands
4512 on the standard input, and producing SMTP replies on the standard output. SMTP
4513 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4514 Some user agents use this interface as a way of passing locally-generated
4515 messages to the MTA.
4519 <indexterm role="concept">
4520 <primary>sender</primary>
4521 <secondary>source of</secondary>
4523 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4524 set, the senders of messages are taken from the SMTP MAIL commands.
4525 Otherwise the content of these commands is ignored and the sender is set up as
4526 the calling user. Unqualified addresses are automatically qualified using
4527 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4528 <option>-bnq</option> option is used.
4531 <indexterm role="concept">
4532 <primary>inetd</primary>
4535 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4536 using a listening daemon. Exim can distinguish the two cases by checking
4537 whether the standard input is a TCP/IP socket. When Exim is called from
4538 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4539 above concerning senders and qualification do not apply. In this situation,
4540 Exim behaves in exactly the same way as it does when receiving a message via
4541 the listening daemon.
4543 </listitem></varlistentry>
4545 <term><option>-bt</option></term>
4548 <indexterm role="option">
4549 <primary><option>-bt</option></primary>
4551 <indexterm role="concept">
4552 <primary>testing</primary>
4553 <secondary>addresses</secondary>
4555 <indexterm role="concept">
4556 <primary>address</primary>
4557 <secondary>testing</secondary>
4559 This option runs Exim in address testing mode, in which each argument is taken
4560 as an address to be tested for deliverability. The results are written to the
4561 standard output. If a test fails, and the caller is not an admin user, no
4562 details of the failure are output, because these might contain sensitive
4563 information such as usernames and passwords for database lookups.
4566 If no arguments are given, Exim runs in an interactive manner, prompting with a
4567 right angle bracket for addresses to be tested.
4570 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4571 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4575 Each address is handled as if it were the recipient address of a message
4576 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4577 written to the standard output. However, any router that has
4578 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4579 genuine routing tests if your first router passes everything to a scanner
4584 <indexterm role="concept">
4585 <primary>return code</primary>
4586 <secondary>for <option>-bt</option></secondary>
4588 return code is 2 if any address failed outright; it is 1 if no address
4589 failed outright but at least one could not be resolved for some reason. Return
4590 code 0 is given only when all addresses succeed.
4593 <indexterm role="concept">
4594 <primary>duplicate addresses</primary>
4596 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
4597 addresses after routing is complete, so that only one delivery takes place.
4598 This does not happen when testing with <option>-bt</option>; the full results of routing are
4602 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4603 routers in the configuration makes any tests on the sender address of a
4605 <indexterm role="concept">
4606 <primary><option>-f</option> option</primary>
4607 <secondary>for address testing</secondary>
4609 you can use the <option>-f</option> option to set an appropriate sender when running
4610 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4611 default qualifying domain. However, if you have set up (for example) routers
4612 whose behaviour depends on the contents of an incoming message, you cannot test
4613 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4616 </listitem></varlistentry>
4618 <term><option>-bV</option></term>
4621 <indexterm role="option">
4622 <primary><option>-bV</option></primary>
4624 <indexterm role="concept">
4625 <primary>version number of Exim</primary>
4626 <secondary>verifying</secondary>
4628 This option causes Exim to write the current version number, compilation
4629 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4630 It also lists the DBM library this is being used, the optional modules (such as
4631 specific lookup types), the drivers that are included in the binary, and the
4632 name of the run time configuration file that is in use.
4635 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4636 configuration file. However, this is a static check only. It cannot check
4637 values that are to be expanded. For example, although a misspelt ACL verb is
4638 detected, an error in the verb’s arguments is not. You cannot rely on <option>-bV</option>
4639 alone to discover (for example) all the typos in the configuration; some
4640 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4641 dynamic testing facilities.
4643 </listitem></varlistentry>
4645 <term><option>-bv</option></term>
4648 <indexterm role="option">
4649 <primary><option>-bv</option></primary>
4651 <indexterm role="concept">
4652 <primary>verifying address</primary>
4653 <secondary>using <option>-bv</option></secondary>
4655 <indexterm role="concept">
4656 <primary>address</primary>
4657 <secondary>verification</secondary>
4659 This option runs Exim in address verification mode, in which each argument is
4660 taken as an address to be verified by the routers. (This does not involve any
4661 verification callouts). During normal operation, verification happens mostly as
4662 a consequence processing a <option>verify</option> condition in an ACL (see chapter
4663 <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly including callouts,
4664 see the <option>-bh</option> and <option>-bhc</option> options.
4667 If verification fails, and the caller is not an admin user, no details of the
4668 failure are output, because these might contain sensitive information such as
4669 usernames and passwords for database lookups.
4672 If no arguments are given, Exim runs in an interactive manner, prompting with a
4673 right angle bracket for addresses to be verified.
4676 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4677 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
4681 Verification differs from address testing (the <option>-bt</option> option) in that routers
4682 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
4683 router that has <option>fail_verify</option> set, verification fails. The address is
4684 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
4685 address, <option>-bvs</option> should be used.
4687 <para revisionflag="changed">
4688 If the <option>-v</option> option is not set, the output consists of a single line for each
4689 address, stating whether it was verified or not, and giving a reason in the
4690 latter case. Without <option>-v</option>, generating more than one address by redirection
4691 causes verification to end successfully, without considering the generated
4692 addresses. However, if just one address is generated, processing continues,
4693 and the generated address must verify successfully for the overall verification
4696 <para revisionflag="changed">
4697 When <option>-v</option> is set, more details are given of how the address has been handled,
4698 and in the case of address redirection, all the generated addresses are also
4699 considered. Verification may succeed for some and fail for others.
4703 <indexterm role="concept">
4704 <primary>return code</primary>
4705 <secondary>for <option>-bv</option></secondary>
4707 return code is 2 if any address failed outright; it is 1 if no address
4708 failed outright but at least one could not be resolved for some reason. Return
4709 code 0 is given only when all addresses succeed.
4712 If any of the routers in the configuration makes any tests on the sender
4713 address of a message, you should use the <option>-f</option> option to set an appropriate
4714 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
4715 calling user at the default qualifying domain.
4717 </listitem></varlistentry>
4719 <term><option>-bvs</option></term>
4722 <indexterm role="option">
4723 <primary><option>-bvs</option></primary>
4725 This option acts like <option>-bv</option>, but verifies the address as a sender rather
4726 than a recipient address. This affects any rewriting and qualification that
4729 </listitem></varlistentry>
4731 <term><option>-C</option> <<emphasis>filelist</emphasis>></term>
4734 <indexterm role="option">
4735 <primary><option>-C</option></primary>
4737 <indexterm role="concept">
4738 <primary>configuration file</primary>
4739 <secondary>alternate</secondary>
4741 <indexterm role="concept">
4742 <primary>CONFIGURE_FILE</primary>
4744 <indexterm role="concept">
4745 <primary>alternate configuration file</primary>
4747 This option causes Exim to find the run time configuration file from the given
4748 list instead of from the list specified by the CONFIGURE_FILE
4749 compile-time setting. Usually, the list will consist of just a single file
4750 name, but it can be a colon-separated list of names. In this case, the first
4751 file that exists is used. Failure to open an existing file stops Exim from
4752 proceeding any further along the list, and an error is generated.
4755 When this option is used by a caller other than root or the Exim user, and the
4756 list is different from the compiled-in list, Exim gives up its root privilege
4757 immediately, and runs with the real and effective uid and gid set to those of
4758 the caller. However, if ALT_CONFIG_ROOT_ONLY is defined in
4759 <filename>Local/Makefile</filename>, root privilege is retained for <option>-C</option> only if the caller of
4763 That is, the Exim user is no longer privileged in this regard. This build-time
4764 option is not set by default in the Exim source distribution tarbundle.
4765 However, if you are using a <quote>packaged</quote> version of Exim (source or binary),
4766 the packagers might have enabled it.
4769 Setting ALT_CONFIG_ROOT_ONLY locks out the possibility of testing a
4770 configuration using <option>-C</option> right through message reception and delivery, even
4771 if the caller is root. The reception works, but by that time, Exim is running
4772 as the Exim user, so when it re-executes to regain privilege for the delivery,
4773 the use of <option>-C</option> causes privilege to be lost. However, root can test reception
4774 and delivery using two separate commands (one to put a message on the queue,
4775 using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
4778 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
4779 prefix string with which any file named in a <option>-C</option> command line option
4780 must start. In addition, the file name must not contain the sequence <literal>/../</literal>.
4781 However, if the value of the <option>-C</option> option is identical to the value of
4782 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
4783 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
4784 unset, any file name can be used with <option>-C</option>.
4787 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
4788 to a directory to which only root has access. This prevents someone who has
4789 broken into the Exim account from running a privileged Exim with an arbitrary
4793 The <option>-C</option> facility is useful for ensuring that configuration files are
4794 syntactically correct, but cannot be used for test deliveries, unless the
4795 caller is privileged, or unless it is an exotic configuration that does not
4796 require privilege. No check is made on the owner or group of the files
4797 specified by this option.
4799 </listitem></varlistentry>
4801 <term><option>-D</option><<emphasis>macro</emphasis>>=<<emphasis>value</emphasis>></term>
4804 <indexterm role="option">
4805 <primary><option>-D</option></primary>
4807 <indexterm role="concept">
4808 <primary>macro</primary>
4809 <secondary>setting on command line</secondary>
4811 This option can be used to override macro definitions in the configuration file
4812 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
4813 unprivileged caller, it causes Exim to give up its root privilege.
4814 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
4815 completely disabled, and its use causes an immediate error exit.
4818 The entire option (including equals sign if present) must all be within one
4819 command line item. <option>-D</option> can be used to set the value of a macro to the empty
4820 string, in which case the equals sign is optional. These two commands are
4823 <literallayout class="monospaced">
4828 To include spaces in a macro definition item, quotes must be used. If you use
4829 quotes, spaces are permitted around the macro name and the equals sign. For
4832 <literallayout class="monospaced">
4833 exim '-D ABC = something' ...
4836 <option>-D</option> may be repeated up to 10 times on a command line.
4838 </listitem></varlistentry>
4840 <term><option>-d</option><<emphasis>debug options</emphasis>></term>
4843 <indexterm role="option">
4844 <primary><option>-d</option></primary>
4846 <indexterm role="concept">
4847 <primary>debugging</primary>
4848 <secondary>list of selectors</secondary>
4850 <indexterm role="concept">
4851 <primary>debugging</primary>
4852 <secondary><option>-d</option> option</secondary>
4854 This option causes debugging information to be written to the standard
4855 error stream. It is restricted to admin users because debugging output may show
4856 database queries that contain password information. Also, the details of users’
4857 filter files should be protected. <phrase revisionflag="changed">If a non-admin user uses <option>-d</option>, Exim
4858 writes an error message to the standard error stream and exits with a non-zero
4859 return code.</phrase>
4862 When <option>-d</option> is used, <option>-v</option> is assumed. If <option>-d</option> is given on its own, a lot of
4863 standard debugging data is output. This can be reduced, or increased to include
4864 some more rarely needed information, by directly following <option>-d</option> with a string
4865 made up of names preceded by plus or minus characters. These add or remove sets
4866 of debugging data, respectively. For example, <option>-d+filter</option> adds filter
4867 debugging, whereas <option>-d-all+filter</option> selects only filter debugging. Note that
4868 no spaces are allowed in the debug setting. The available debugging categories
4872 <literal>acl </literal> ACL interpretation
4873 <literal>auth </literal> authenticators
4874 <literal>deliver </literal> general delivery logic
4875 <literal>dns </literal> DNS lookups (see also resolver)
4876 <literal>dnsbl </literal> DNS black list (aka RBL) code
4877 <literal>exec </literal> arguments for <function>execv()</function> calls
4878 <literal>expand </literal> detailed debugging for string expansions
4879 <literal>filter </literal> filter handling
4880 <literal>hints_lookup </literal> hints data lookups
4881 <literal>host_lookup </literal> all types of name-to-IP address handling
4882 <literal>ident </literal> ident lookup
4883 <literal>interface </literal> lists of local interfaces
4884 <literal>lists </literal> matching things in lists
4885 <literal>load </literal> system load checks
4886 <literal>local_scan </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
4887 <literal>lookup </literal> general lookup code and all lookups
4888 <literal>memory </literal> memory handling
4889 <literal>pid </literal> add pid to debug output lines
4890 <literal>process_info </literal> setting info for the process log
4891 <literal>queue_run </literal> queue runs
4892 <literal>receive </literal> general message reception logic
4893 <literal>resolver </literal> turn on the DNS resolver’s debugging output
4894 <literal>retry </literal> retry handling
4895 <literal>rewrite </literal> address rewriting
4896 <literal>route </literal> address routing
4897 <literal>timestamp </literal> add timestamp to debug output lines
4898 <literal>tls </literal> TLS logic
4899 <literal>transport </literal> transports
4900 <literal>uid </literal> changes of uid/gid and looking up uid/gid
4901 <literal>verify </literal> address verification logic
4902 <literal>all </literal> almost all of the above (see below), and also <option>-v</option>
4905 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
4906 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
4907 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
4908 is included, an awful lot of output that is very rarely of interest is
4909 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
4910 turn everything off.
4913 <indexterm role="concept">
4914 <primary>resolver</primary>
4915 <secondary>debugging output</secondary>
4917 <indexterm role="concept">
4918 <primary>DNS resolver</primary>
4919 <secondary>debugging output</secondary>
4921 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
4922 with DEBUG enabled. This is not the case in some operating systems. Also,
4923 unfortunately, debugging output from the DNS resolver is written to stdout
4927 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
4928 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
4929 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
4930 daemon, which then passes it on to any re-executed Exims. Exim also
4931 automatically adds the pid to debug lines when several remote deliveries are
4935 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
4936 of all debug output lines. This can be useful when trying to track down delays
4940 If the <option>debug_print</option> option is set in any driver, it produces output whenever
4941 any debugging is selected, or if <option>-v</option> is used.
4943 </listitem></varlistentry>
4945 <term><option>-dd</option><<emphasis>debug options</emphasis>></term>
4948 <indexterm role="option">
4949 <primary><option>-dd</option></primary>
4951 This option behaves exactly like <option>-d</option> except when used on a command that
4952 starts a daemon process. In that case, debugging is turned off for the
4953 subprocesses that the daemon creates. Thus, it is useful for monitoring the
4954 behaviour of the daemon without creating as much output as full debugging does.
4956 </listitem></varlistentry>
4958 <term><option>-dropcr</option></term>
4961 <indexterm role="option">
4962 <primary><option>-dropcr</option></primary>
4964 This is an obsolete option that is now a no-op. It used to affect the way Exim
4965 handled CR and LF characters in incoming messages. What happens now is
4966 described in section <xref linkend="SECTlineendings"/>.
4968 </listitem></varlistentry>
4970 <term><option>-E</option></term>
4973 <indexterm role="option">
4974 <primary><option>-E</option></primary>
4976 <indexterm role="concept">
4977 <primary>bounce message</primary>
4978 <secondary>generating</secondary>
4980 This option specifies that an incoming message is a locally-generated delivery
4981 failure report. It is used internally by Exim when handling delivery failures
4982 and is not intended for external use. Its only effect is to stop Exim
4983 generating certain messages to the postmaster, as otherwise message cascades
4984 could occur in some situations. As part of the same option, a message id may
4985 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
4986 new message contains the id, following <quote>R=</quote>, as a cross-reference.
4988 </listitem></varlistentry>
4990 <term><option>-e</option><emphasis>x</emphasis></term>
4993 <indexterm role="option">
4994 <primary><option>-e</option><emphasis>x</emphasis></primary>
4996 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
4997 called by various programs without the leading <option>o</option> in the option. For
4998 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
4999 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
5001 </listitem></varlistentry>
5003 <term><option>-F</option> <<emphasis>string</emphasis>></term>
5006 <indexterm role="option">
5007 <primary><option>-F</option></primary>
5009 <indexterm role="concept">
5010 <primary>sender</primary>
5011 <secondary>name</secondary>
5013 <indexterm role="concept">
5014 <primary>name</primary>
5015 <secondary>of sender</secondary>
5017 This option sets the sender’s full name for use when a locally-generated
5018 message is being accepted. In the absence of this option, the user’s <emphasis>gecos</emphasis>
5019 entry from the password data is used. As users are generally permitted to alter
5020 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
5021 between <option>-F</option> and the <<emphasis>string</emphasis>> is optional.
5023 </listitem></varlistentry>
5025 <term><option>-f</option> <<emphasis>address</emphasis>></term>
5028 <indexterm role="option">
5029 <primary><option>-f</option></primary>
5031 <indexterm role="concept">
5032 <primary>sender</primary>
5033 <secondary>address</secondary>
5035 <indexterm role="concept">
5036 <primary>address</primary>
5037 <secondary>sender</secondary>
5039 <indexterm role="concept">
5040 <primary>trusted user</primary>
5042 <indexterm role="concept">
5043 <primary>envelope sender</primary>
5045 <indexterm role="concept">
5046 <primary>user</primary>
5047 <secondary>trusted</secondary>
5049 This option sets the address of the envelope sender of a locally-generated
5050 message (also known as the return path). The option can normally be used only
5051 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5055 Processes running as root or the Exim user are always trusted. Other
5056 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5057 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5058 of a local message is set to the caller’s login name at the default qualify
5062 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5063 can be specified by any user, trusted or not, to create a message that can
5064 never provoke a bounce. An empty sender can be specified either as an empty
5065 string, or as a pair of angle brackets with nothing between them, as in these
5066 examples of shell commands:
5068 <literallayout class="monospaced">
5069 exim -f '<>' user@domain
5070 exim -f "" user@domain
5073 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5074 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5075 <option>-bv</option> options.
5078 Allowing untrusted users to change the sender address does not of itself make
5079 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5080 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5081 though this can be overridden by setting <option>no_local_from_check</option>.
5085 <indexterm role="concept">
5086 <primary><quote>From</quote> line</primary>
5088 space between <option>-f</option> and the <<emphasis>address</emphasis>> is optional (that is, they can be
5089 given as two arguments or one combined argument). The sender of a
5090 locally-generated message can also be set (when permitted) by an initial
5091 <quote>From </quote> line in the message – see the description of <option>-bm</option> above – but
5092 if <option>-f</option> is also present, it overrides <quote>From </quote>.
5094 </listitem></varlistentry>
5096 <term><option>-G</option></term>
5099 <indexterm role="option">
5100 <primary><option>-G</option></primary>
5102 <indexterm role="concept">
5103 <primary>Sendmail compatibility</primary>
5104 <secondary><option>-G</option> option ignored</secondary>
5106 This is a Sendmail option which is ignored by Exim.
5108 </listitem></varlistentry>
5110 <term><option>-h</option> <<emphasis>number</emphasis>></term>
5113 <indexterm role="option">
5114 <primary><option>-h</option></primary>
5116 <indexterm role="concept">
5117 <primary>Sendmail compatibility</primary>
5118 <secondary><option>-h</option> option ignored</secondary>
5120 This option is accepted for compatibility with Sendmail, but has no effect. (In
5121 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5124 </listitem></varlistentry>
5126 <term><option>-i</option></term>
5129 <indexterm role="option">
5130 <primary><option>-i</option></primary>
5132 <indexterm role="concept">
5133 <primary>Solaris</primary>
5134 <secondary><emphasis>mail</emphasis> command</secondary>
5136 <indexterm role="concept">
5137 <primary>dot in incoming</primary>
5138 <secondary>non-SMTP message</secondary>
5140 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5141 line by itself should not terminate an incoming, non-SMTP message. I can find
5142 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5143 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5145 </listitem></varlistentry>
5147 <term><option>-M</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5150 <indexterm role="option">
5151 <primary><option>-M</option></primary>
5153 <indexterm role="concept">
5154 <primary>forcing delivery</primary>
5156 <indexterm role="concept">
5157 <primary>delivery</primary>
5158 <secondary>forcing attempt</secondary>
5160 <indexterm role="concept">
5161 <primary>frozen messages</primary>
5162 <secondary>forcing delivery</secondary>
5164 This option requests Exim to run a delivery attempt on each message in turn. If
5165 any of the messages are frozen, they are automatically thawed before the
5166 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5167 and <option>hold_domains</option> are ignored.
5171 <indexterm role="concept">
5172 <primary>hints database</primary>
5173 <secondary>overriding retry hints</secondary>
5175 hints for any of the addresses are overridden – Exim tries to deliver even if
5176 the normal retry time has not yet been reached. This option requires the caller
5177 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5178 which can be set false to relax this restriction (and also the same requirement
5179 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5182 The deliveries happen synchronously, that is, the original Exim process does
5183 not terminate until all the delivery attempts have finished. No output is
5184 produced unless there is a serious error. If you want to see what is happening,
5185 use the <option>-v</option> option as well, or inspect Exim’s main log.
5187 </listitem></varlistentry>
5189 <term><option>-Mar</option> <<emphasis>message id</emphasis>> <<emphasis>address</emphasis>> <<emphasis>address</emphasis>> ...</term>
5192 <indexterm role="option">
5193 <primary><option>-Mar</option></primary>
5195 <indexterm role="concept">
5196 <primary>message</primary>
5197 <secondary>adding recipients</secondary>
5199 <indexterm role="concept">
5200 <primary>recipient</primary>
5201 <secondary>adding</secondary>
5203 This option requests Exim to add the addresses to the list of recipients of the
5204 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5205 id, and the remaining ones must be email addresses. However, if the message is
5206 active (in the middle of a delivery attempt), it is not altered. This option
5207 can be used only by an admin user.
5209 </listitem></varlistentry>
5211 <term><option>-MC</option> <<emphasis>transport</emphasis>> <<emphasis>hostname</emphasis>> <<emphasis>sequence number</emphasis>> <<emphasis>message id</emphasis>></term>
5214 <indexterm role="option">
5215 <primary><option>-MC</option></primary>
5217 <indexterm role="concept">
5218 <primary>SMTP</primary>
5219 <secondary>passed connection</secondary>
5221 <indexterm role="concept">
5222 <primary>SMTP</primary>
5223 <secondary>multiple deliveries</secondary>
5225 <indexterm role="concept">
5226 <primary>multiple SMTP deliveries</primary>
5228 This option is not intended for use by external callers. It is used internally
5229 by Exim to invoke another instance of itself to deliver a waiting message using
5230 an existing SMTP connection, which is passed as the standard input. Details are
5231 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5232 must be root or the Exim user in order to use it.
5234 </listitem></varlistentry>
5236 <term><option>-MCA</option></term>
5239 <indexterm role="option">
5240 <primary><option>-MCA</option></primary>
5242 This option is not intended for use by external callers. It is used internally
5243 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5244 connection to the remote host has been authenticated.
5246 </listitem></varlistentry>
5248 <term><option>-MCP</option></term>
5251 <indexterm role="option">
5252 <primary><option>-MCP</option></primary>
5254 This option is not intended for use by external callers. It is used internally
5255 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5256 which Exim is connected supports pipelining.
5258 </listitem></varlistentry>
5260 <term><option>-MCQ</option> <<emphasis>process id</emphasis>> <<emphasis>pipe fd</emphasis>></term>
5263 <indexterm role="option">
5264 <primary><option>-MCQ</option></primary>
5266 This option is not intended for use by external callers. It is used internally
5267 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5268 started by a queue runner. It passes on the process id of the queue runner,
5269 together with the file descriptor number of an open pipe. Closure of the pipe
5270 signals the final completion of the sequence of processes that are passing
5271 messages through the same SMTP connection.
5273 </listitem></varlistentry>
5275 <term><option>-MCS</option></term>
5278 <indexterm role="option">
5279 <primary><option>-MCS</option></primary>
5281 This option is not intended for use by external callers. It is used internally
5282 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5283 SMTP SIZE option should be used on messages delivered down the existing
5286 </listitem></varlistentry>
5288 <term><option>-MCT</option></term>
5291 <indexterm role="option">
5292 <primary><option>-MCT</option></primary>
5294 This option is not intended for use by external callers. It is used internally
5295 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5296 host to which Exim is connected supports TLS encryption.
5298 </listitem></varlistentry>
5300 <term><option>-Mc</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5303 <indexterm role="option">
5304 <primary><option>-Mc</option></primary>
5306 <indexterm role="concept">
5307 <primary>hints database</primary>
5308 <secondary>not overridden by <option>-Mc</option></secondary>
5310 <indexterm role="concept">
5311 <primary>delivery</primary>
5312 <secondary>manually started – not forced</secondary>
5314 This option requests Exim to run a delivery attempt on each message in turn,
5315 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5316 that are found. This option is not very useful to external callers. It is
5317 provided mainly for internal use by Exim when it needs to re-invoke itself in
5318 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5319 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5320 respects retry times and other options such as <option>hold_domains</option> that are
5321 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5322 If you want to run a specific delivery as if in a queue run, you should use
5323 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5324 and other deliveries is made in one or two places.
5326 </listitem></varlistentry>
5328 <term><option>-Mes</option> <<emphasis>message id</emphasis>> <<emphasis>address</emphasis>></term>
5331 <indexterm role="option">
5332 <primary><option>-Mes</option></primary>
5334 <indexterm role="concept">
5335 <primary>message</primary>
5336 <secondary>changing sender</secondary>
5338 <indexterm role="concept">
5339 <primary>sender</primary>
5340 <secondary>changing</secondary>
5342 This option requests Exim to change the sender address in the message to the
5343 given address, which must be a fully qualified address or <quote><></quote> (<quote>es</quote> for
5344 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5345 be a message id, and the second one an email address. However, if the message
5346 is active (in the middle of a delivery attempt), its status is not altered.
5347 This option can be used only by an admin user.
5349 </listitem></varlistentry>
5351 <term><option>-Mf</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5354 <indexterm role="option">
5355 <primary><option>-Mf</option></primary>
5357 <indexterm role="concept">
5358 <primary>freezing messages</primary>
5360 <indexterm role="concept">
5361 <primary>message</primary>
5362 <secondary>manually freezing</secondary>
5364 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5365 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5366 either manually or as a result of the <option>auto_thaw</option> configuration option.
5367 However, if any of the messages are active (in the middle of a delivery
5368 attempt), their status is not altered. This option can be used only by an admin
5371 </listitem></varlistentry>
5373 <term><option>-Mg</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5376 <indexterm role="option">
5377 <primary><option>-Mg</option></primary>
5379 <indexterm role="concept">
5380 <primary>giving up on messages</primary>
5382 <indexterm role="concept">
5383 <primary>message</primary>
5384 <secondary>abandoning delivery attempts</secondary>
5386 <indexterm role="concept">
5387 <primary>delivery</primary>
5388 <secondary>abandoning further attempts</secondary>
5390 This option requests Exim to give up trying to deliver the listed messages,
5391 including any that are frozen. However, if any of the messages are active,
5392 their status is not altered. For non-bounce messages, a delivery error message
5393 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5394 Bounce messages are just discarded. This option can be used only by an admin
5397 </listitem></varlistentry>
5399 <term><option>-Mmad</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5402 <indexterm role="option">
5403 <primary><option>-Mmad</option></primary>
5405 <indexterm role="concept">
5406 <primary>delivery</primary>
5407 <secondary>cancelling all</secondary>
5409 This option requests Exim to mark all the recipient addresses in the messages
5410 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5411 message is active (in the middle of a delivery attempt), its status is not
5412 altered. This option can be used only by an admin user.
5414 </listitem></varlistentry>
5416 <term><option>-Mmd</option> <<emphasis>message id</emphasis>> <<emphasis>address</emphasis>> <<emphasis>address</emphasis>> ...</term>
5419 <indexterm role="option">
5420 <primary><option>-Mmd</option></primary>
5422 <indexterm role="concept">
5423 <primary>delivery</primary>
5424 <secondary>cancelling by address</secondary>
5426 <indexterm role="concept">
5427 <primary>recipient</primary>
5428 <secondary>removing</secondary>
5430 <indexterm role="concept">
5431 <primary>removing recipients</primary>
5433 This option requests Exim to mark the given addresses as already delivered
5434 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5435 the remaining ones must be email addresses. These are matched to recipient
5436 addresses in the message in a case-sensitive manner. If the message is active
5437 (in the middle of a delivery attempt), its status is not altered. This option
5438 can be used only by an admin user.
5440 </listitem></varlistentry>
5442 <term><option>-Mrm</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5445 <indexterm role="option">
5446 <primary><option>-Mrm</option></primary>
5448 <indexterm role="concept">
5449 <primary>removing messages</primary>
5451 <indexterm role="concept">
5452 <primary>abandoning mail</primary>
5454 <indexterm role="concept">
5455 <primary>message</primary>
5456 <secondary>manually discarding</secondary>
5458 This option requests Exim to remove the given messages from the queue. No
5459 bounce messages are sent; each message is simply forgotten. However, if any of
5460 the messages are active, their status is not altered. This option can be used
5461 only by an admin user or by the user who originally caused the message to be
5462 placed on the queue.
5464 </listitem></varlistentry>
5465 <varlistentry revisionflag="changed">
5466 <term><option>-Mset</option> <<emphasis>message id</emphasis>></term>
5468 <para revisionflag="changed">
5469 <indexterm role="option">
5470 <primary><option>-Mset</option></primary>
5472 <indexterm role="concept">
5473 <primary>testing</primary>
5474 <secondary>string expansion</secondary>
5476 <indexterm role="concept">
5477 <primary>expansion</primary>
5478 <secondary>testing</secondary>
5480 This option is useful only in conjunction with <option>-be</option> (that is, when testing
5481 string expansions). Exim loads the given message from its spool before doing
5482 the test expansions, thus setting message-specific variables such as
5483 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
5484 available. This feature is provided to make it easier to test expansions that
5485 make use of these variables. However, this option can be used only by an admin
5486 user. See also <option>-bem</option>.
5488 </listitem></varlistentry>
5490 <term><option>-Mt</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5493 <indexterm role="option">
5494 <primary><option>-Mt</option></primary>
5496 <indexterm role="concept">
5497 <primary>thawing messages</primary>
5499 <indexterm role="concept">
5500 <primary>unfreezing messages</primary>
5502 <indexterm role="concept">
5503 <primary>frozen messages</primary>
5504 <secondary>thawing</secondary>
5506 <indexterm role="concept">
5507 <primary>message</primary>
5508 <secondary>thawing frozen</secondary>
5510 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5511 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5512 messages are active, their status is not altered. This option can be used only
5515 </listitem></varlistentry>
5517 <term><option>-Mvb</option> <<emphasis>message id</emphasis>></term>
5520 <indexterm role="option">
5521 <primary><option>-Mvb</option></primary>
5523 <indexterm role="concept">
5524 <primary>listing</primary>
5525 <secondary>message body</secondary>
5527 <indexterm role="concept">
5528 <primary>message</primary>
5529 <secondary>listing body of</secondary>
5531 This option causes the contents of the message body (-D) spool file to be
5532 written to the standard output. This option can be used only by an admin user.
5534 </listitem></varlistentry>
5536 <term><option>-Mvh</option> <<emphasis>message id</emphasis>></term>
5539 <indexterm role="option">
5540 <primary><option>-Mvh</option></primary>
5542 <indexterm role="concept">
5543 <primary>listing</primary>
5544 <secondary>message headers</secondary>
5546 <indexterm role="concept">
5547 <primary>header lines</primary>
5548 <secondary>listing</secondary>
5550 <indexterm role="concept">
5551 <primary>message</primary>
5552 <secondary>listing header lines</secondary>
5554 This option causes the contents of the message headers (-H) spool file to be
5555 written to the standard output. This option can be used only by an admin user.
5557 </listitem></varlistentry>
5559 <term><option>-Mvl</option> <<emphasis>message id</emphasis>></term>
5562 <indexterm role="option">
5563 <primary><option>-Mvl</option></primary>
5565 <indexterm role="concept">
5566 <primary>listing</primary>
5567 <secondary>message log</secondary>
5569 <indexterm role="concept">
5570 <primary>message</primary>
5571 <secondary>listing message log</secondary>
5573 This option causes the contents of the message log spool file to be written to
5574 the standard output. This option can be used only by an admin user.
5576 </listitem></varlistentry>
5578 <term><option>-m</option></term>
5581 <indexterm role="option">
5582 <primary><option>-m</option></primary>
5584 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
5585 treats it that way too.
5587 </listitem></varlistentry>
5589 <term><option>-N</option></term>
5592 <indexterm role="option">
5593 <primary><option>-N</option></primary>
5595 <indexterm role="concept">
5596 <primary>debugging</primary>
5597 <secondary><option>-N</option> option</secondary>
5599 <indexterm role="concept">
5600 <primary>debugging</primary>
5601 <secondary>suppressing delivery</secondary>
5603 This is a debugging option that inhibits delivery of a message at the transport
5604 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery –
5605 it just doesn’t actually transport the message, but instead behaves as if it
5606 had successfully done so. However, it does not make any updates to the retry
5607 database, and the log entries for deliveries are flagged with <quote>*></quote> rather
5608 than <quote>=></quote>.
5611 Because <option>-N</option> discards any message to which it applies, only root or the Exim
5612 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
5613 words, an ordinary user can use it only when supplying an incoming message to
5614 which it will apply. Although transportation never fails when <option>-N</option> is set, an
5615 address may be deferred because of a configuration problem on a transport, or a
5616 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
5617 the message, and applies to any subsequent delivery attempts that may happen
5620 </listitem></varlistentry>
5622 <term><option>-n</option></term>
5625 <indexterm role="option">
5626 <primary><option>-n</option></primary>
5628 <indexterm role="concept">
5629 <primary>Sendmail compatibility</primary>
5630 <secondary><option>-n</option> option ignored</secondary>
5632 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>. It is ignored
5635 </listitem></varlistentry>
5637 <term><option>-O</option> <<emphasis>data</emphasis>></term>
5640 <indexterm role="option">
5641 <primary><option>-O</option></primary>
5643 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
5646 </listitem></varlistentry>
5648 <term><option>-oA</option> <<emphasis>file name</emphasis>></term>
5651 <indexterm role="option">
5652 <primary><option>-oA</option></primary>
5654 <indexterm role="concept">
5655 <primary>Sendmail compatibility</primary>
5656 <secondary><option>-oA</option> option</secondary>
5658 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
5659 alternative alias file name. Exim handles <option>-bi</option> differently; see the
5662 </listitem></varlistentry>
5664 <term><option>-oB</option> <<emphasis>n</emphasis>></term>
5667 <indexterm role="option">
5668 <primary><option>-oB</option></primary>
5670 <indexterm role="concept">
5671 <primary>SMTP</primary>
5672 <secondary>passed connection</secondary>
5674 <indexterm role="concept">
5675 <primary>SMTP</primary>
5676 <secondary>multiple deliveries</secondary>
5678 <indexterm role="concept">
5679 <primary>multiple SMTP deliveries</primary>
5681 This is a debugging option which limits the maximum number of messages that can
5682 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
5683 transport. If <<emphasis>n</emphasis>> is omitted, the limit is set to 1.
5685 </listitem></varlistentry>
5687 <term><option>-odb</option></term>
5690 <indexterm role="option">
5691 <primary><option>-odb</option></primary>
5693 <indexterm role="concept">
5694 <primary>background delivery</primary>
5696 <indexterm role="concept">
5697 <primary>delivery</primary>
5698 <secondary>in the background</secondary>
5700 This option applies to all modes in which Exim accepts incoming messages,
5701 including the listening daemon. It requests <quote>background</quote> delivery of such
5702 messages, which means that the accepting process automatically starts a
5703 delivery process for each message received, but does not wait for the delivery
5704 processes to finish.
5707 When all the messages have been received, the reception process exits,
5708 leaving the delivery processes to finish in their own time. The standard output
5709 and error streams are closed at the start of each delivery process.
5710 This is the default action if none of the <option>-od</option> options are present.
5713 If one of the queueing options in the configuration file
5714 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
5715 overrides it if <option>queue_only_override</option> is set true, which is the default
5716 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
5718 </listitem></varlistentry>
5720 <term><option>-odf</option></term>
5723 <indexterm role="option">
5724 <primary><option>-odf</option></primary>
5726 <indexterm role="concept">
5727 <primary>foreground delivery</primary>
5729 <indexterm role="concept">
5730 <primary>delivery</primary>
5731 <secondary>in the foreground</secondary>
5733 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
5734 accepted a locally-generated message. (For the daemon it is exactly the same as
5735 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
5736 and Exim waits for it to complete before proceeding.
5739 The original Exim reception process does not finish until the delivery
5740 process for the final message has ended. The standard error stream is left open
5744 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
5745 false and one of the queueing options in the configuration file is in effect.
5748 If there is a temporary delivery error during foreground delivery, the
5749 message is left on the queue for later delivery, and the original reception
5750 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
5751 restricted configuration that never queues messages.
5753 </listitem></varlistentry>
5755 <term><option>-odi</option></term>
5758 <indexterm role="option">
5759 <primary><option>-odi</option></primary>
5761 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
5764 </listitem></varlistentry>
5766 <term><option>-odq</option></term>
5769 <indexterm role="option">
5770 <primary><option>-odq</option></primary>
5772 <indexterm role="concept">
5773 <primary>non-immediate delivery</primary>
5775 <indexterm role="concept">
5776 <primary>delivery</primary>
5777 <secondary>suppressing immediate</secondary>
5779 <indexterm role="concept">
5780 <primary>queueing incoming messages</primary>
5782 This option applies to all modes in which Exim accepts incoming messages,
5783 including the listening daemon. It specifies that the accepting process should
5784 not automatically start a delivery process for each message received. Messages
5785 are placed on the queue, and remain there until a subsequent queue runner
5786 process encounters them. There are several configuration options (such as
5787 <option>queue_only</option>) that can be used to queue incoming messages under certain
5788 conditions. This option overrides all of them and also <option>-odqs</option>. It always
5791 </listitem></varlistentry>
5793 <term><option>-odqs</option></term>
5796 <indexterm role="option">
5797 <primary><option>-odqs</option></primary>
5799 <indexterm role="concept">
5800 <primary>SMTP</primary>
5801 <secondary>delaying delivery</secondary>
5803 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
5804 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
5805 <option>queue_only_override</option> is false and one of the queueing options in the
5806 configuration file is in effect.
5809 When <option>-odqs</option> does operate, a delivery process is started for each incoming
5810 message, in the background by default, but in the foreground if <option>-odi</option> is
5811 also present. The recipient addresses are routed, and local deliveries are done
5812 in the normal way. However, if any SMTP deliveries are required, they are not
5813 done at this time, so the message remains on the queue until a subsequent queue
5814 runner process encounters it. Because routing was done, Exim knows which
5815 messages are waiting for which hosts, and so a number of messages for the same
5816 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
5817 configuration option has the same effect for specific domains. See also the
5818 <option>-qq</option> option.
5820 </listitem></varlistentry>
5822 <term><option>-oee</option></term>
5825 <indexterm role="option">
5826 <primary><option>-oee</option></primary>
5828 <indexterm role="concept">
5829 <primary>error</primary>
5830 <secondary>reporting</secondary>
5832 If an error is detected while a non-SMTP message is being received (for
5833 example, a malformed address), the error is reported to the sender in a mail
5837 <indexterm role="concept">
5838 <primary>return code</primary>
5839 <secondary>for <option>-oee</option></secondary>
5842 this error message is successfully sent, the Exim receiving process
5843 exits with a return code of zero. If not, the return code is 2 if the problem
5844 is that the original message has no recipients, or 1 any other error. This is
5845 the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
5847 </listitem></varlistentry>
5849 <term><option>-oem</option></term>
5852 <indexterm role="option">
5853 <primary><option>-oem</option></primary>
5855 <indexterm role="concept">
5856 <primary>error</primary>
5857 <secondary>reporting</secondary>
5859 <indexterm role="concept">
5860 <primary>return code</primary>
5861 <secondary>for <option>-oem</option></secondary>
5863 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
5864 return code, whether or not the error message was successfully sent.
5865 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
5867 </listitem></varlistentry>
5869 <term><option>-oep</option></term>
5872 <indexterm role="option">
5873 <primary><option>-oep</option></primary>
5875 <indexterm role="concept">
5876 <primary>error</primary>
5877 <secondary>reporting</secondary>
5879 If an error is detected while a non-SMTP message is being received, the
5880 error is reported by writing a message to the standard error file (stderr).
5881 <indexterm role="concept">
5882 <primary>return code</primary>
5883 <secondary>for <option>-oep</option></secondary>
5885 The return code is 1 for all errors.
5887 </listitem></varlistentry>
5889 <term><option>-oeq</option></term>
5892 <indexterm role="option">
5893 <primary><option>-oeq</option></primary>
5895 <indexterm role="concept">
5896 <primary>error</primary>
5897 <secondary>reporting</secondary>
5899 This option is supported for compatibility with Sendmail, but has the same
5900 effect as <option>-oep</option>.
5902 </listitem></varlistentry>
5904 <term><option>-oew</option></term>
5907 <indexterm role="option">
5908 <primary><option>-oew</option></primary>
5910 <indexterm role="concept">
5911 <primary>error</primary>
5912 <secondary>reporting</secondary>
5914 This option is supported for compatibility with Sendmail, but has the same
5915 effect as <option>-oem</option>.
5917 </listitem></varlistentry>
5919 <term><option>-oi</option></term>
5922 <indexterm role="option">
5923 <primary><option>-oi</option></primary>
5925 <indexterm role="concept">
5926 <primary>dot in incoming</primary>
5927 <secondary>non-SMTP message</secondary>
5929 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
5930 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
5931 single dot does terminate, though Exim does no special processing for other
5932 lines that start with a dot. This option is set by default if Exim is called as
5933 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
5935 </listitem></varlistentry>
5937 <term><option>-oitrue</option></term>
5940 <indexterm role="option">
5941 <primary><option>-oitrue</option></primary>
5943 This option is treated as synonymous with <option>-oi</option>.
5945 </listitem></varlistentry>
5947 <term><option>-oMa</option> <<emphasis>host address</emphasis>></term>
5950 <indexterm role="option">
5951 <primary><option>-oMa</option></primary>
5953 <indexterm role="concept">
5954 <primary>sender host address</primary>
5955 <secondary>specifying for local message</secondary>
5957 A number of options starting with <option>-oM</option> can be used to set values associated
5958 with remote hosts on locally-submitted messages (that is, messages not received
5959 over TCP/IP). These options can be used by any caller in conjunction with the
5960 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
5961 other circumstances, they are ignored unless the caller is trusted.
5964 The <option>-oMa</option> option sets the sender host address. This may include a port
5965 number at the end, after a full stop (period). For example:
5967 <literallayout class="monospaced">
5968 exim -bs -oMa 10.9.8.7.1234
5971 An alternative syntax is to enclose the IP address in square brackets,
5972 followed by a colon and the port number:
5974 <literallayout class="monospaced">
5975 exim -bs -oMa [10.9.8.7]:1234
5978 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
5979 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
5980 are present on the command line, the sender host IP address is taken from
5981 whichever one is last.
5983 </listitem></varlistentry>
5985 <term><option>-oMaa</option> <<emphasis>name</emphasis>></term>
5988 <indexterm role="option">
5989 <primary><option>-oMaa</option></primary>
5991 <indexterm role="concept">
5992 <primary>authentication name</primary>
5993 <secondary>specifying for local message</secondary>
5995 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
5996 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
5997 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
5998 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
5999 authenticated SMTP session without actually using the SMTP AUTH command.
6001 </listitem></varlistentry>
6003 <term><option>-oMai</option> <<emphasis>string</emphasis>></term>
6006 <indexterm role="option">
6007 <primary><option>-oMai</option></primary>
6009 <indexterm role="concept">
6010 <primary>authentication id</primary>
6011 <secondary>specifying for local message</secondary>
6013 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6014 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6015 This overrides the default value (the caller’s login id, except with <option>-bh</option>,
6016 where there is no default) for messages from local sources. See chapter
6017 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6019 </listitem></varlistentry>
6021 <term><option>-oMas</option> <<emphasis>address</emphasis>></term>
6024 <indexterm role="option">
6025 <primary><option>-oMas</option></primary>
6027 <indexterm role="concept">
6028 <primary>authentication sender</primary>
6029 <secondary>specifying for local message</secondary>
6031 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6032 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6033 overrides the sender address that is created from the caller’s login id for
6034 messages from local sources, except when <option>-bh</option> is used, when there is no
6035 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6036 specified on a MAIL command overrides this value. See chapter
6037 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6039 </listitem></varlistentry>
6041 <term><option>-oMi</option> <<emphasis>interface address</emphasis>></term>
6044 <indexterm role="option">
6045 <primary><option>-oMi</option></primary>
6047 <indexterm role="concept">
6048 <primary>interface address</primary>
6049 <secondary>specifying for local message</secondary>
6052 <para revisionflag="changed">
6053 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6054 option sets the IP interface address value. A port number may be included,
6055 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6056 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6058 </listitem></varlistentry>
6060 <term><option>-oMr</option> <<emphasis>protocol name</emphasis>></term>
6063 <indexterm role="option">
6064 <primary><option>-oMr</option></primary>
6066 <indexterm role="concept">
6067 <primary>protocol</primary>
6068 <secondary>incoming – specifying for local message</secondary>
6070 <indexterm role="concept">
6071 <primary><varname>$received_protocol</varname></primary>
6073 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6074 option sets the received protocol value that is stored in
6075 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6076 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6077 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6078 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6079 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6080 be set by <option>-oMr</option>.
6082 </listitem></varlistentry>
6084 <term><option>-oMs</option> <<emphasis>host name</emphasis>></term>
6087 <indexterm role="option">
6088 <primary><option>-oMs</option></primary>
6090 <indexterm role="concept">
6091 <primary>sender host name</primary>
6092 <secondary>specifying for local message</secondary>
6094 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6095 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6096 present, Exim does not attempt to look up a host name from an IP address; it
6097 uses the name it is given.
6099 </listitem></varlistentry>
6101 <term><option>-oMt</option> <<emphasis>ident string</emphasis>></term>
6104 <indexterm role="option">
6105 <primary><option>-oMt</option></primary>
6107 <indexterm role="concept">
6108 <primary>sender ident string</primary>
6109 <secondary>specifying for local message</secondary>
6111 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6112 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6113 local callers is the login id of the calling process, except when <option>-bh</option> is
6114 used, when there is no default.
6116 </listitem></varlistentry>
6118 <term><option>-om</option></term>
6121 <indexterm role="option">
6122 <primary><option>-om</option></primary>
6124 <indexterm role="concept">
6125 <primary>Sendmail compatibility</primary>
6126 <secondary><option>-om</option> option ignored</secondary>
6128 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6129 message should receive a copy of the message if the sender appears in an alias
6130 expansion. Exim always does this, so the option does nothing.
6132 </listitem></varlistentry>
6134 <term><option>-oo</option></term>
6137 <indexterm role="option">
6138 <primary><option>-oo</option></primary>
6140 <indexterm role="concept">
6141 <primary>Sendmail compatibility</primary>
6142 <secondary><option>-oo</option> option ignored</secondary>
6144 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6145 whatever that means.
6147 </listitem></varlistentry>
6149 <term><option>-oP</option> <<emphasis>path</emphasis>></term>
6152 <indexterm role="option">
6153 <primary><option>-oP</option></primary>
6155 <indexterm role="concept">
6156 <primary>pid (process id)</primary>
6157 <secondary>of daemon</secondary>
6159 <indexterm role="concept">
6160 <primary>daemon</primary>
6161 <secondary>process id (pid)</secondary>
6163 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6164 value. The option specifies the file to which the process id of the daemon is
6165 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6166 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6167 because in those cases, the normal pid file is not used.
6169 </listitem></varlistentry>
6171 <term><option>-or</option> <<emphasis>time</emphasis>></term>
6174 <indexterm role="option">
6175 <primary><option>-or</option></primary>
6177 <indexterm role="concept">
6178 <primary>timeout</primary>
6179 <secondary>for non-SMTP input</secondary>
6181 This option sets a timeout value for incoming non-SMTP messages. If it is not
6182 set, Exim will wait forever for the standard input. The value can also be set
6183 by the <option>receive_timeout</option> option. The format used for specifying times is
6184 described in section <xref linkend="SECTtimeformat"/>.
6186 </listitem></varlistentry>
6188 <term><option>-os</option> <<emphasis>time</emphasis>></term>
6191 <indexterm role="option">
6192 <primary><option>-os</option></primary>
6194 <indexterm role="concept">
6195 <primary>timeout</primary>
6196 <secondary>for SMTP input</secondary>
6198 <indexterm role="concept">
6199 <primary>SMTP timeout</primary>
6200 <secondary>input</secondary>
6202 This option sets a timeout value for incoming SMTP messages. The timeout
6203 applies to each SMTP command and block of data. The value can also be set by
6204 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6205 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6207 </listitem></varlistentry>
6209 <term><option>-ov</option></term>
6212 <indexterm role="option">
6213 <primary><option>-ov</option></primary>
6215 This option has exactly the same effect as <option>-v</option>.
6217 </listitem></varlistentry>
6219 <term><option>-oX</option> <<emphasis>number or string</emphasis>></term>
6222 <indexterm role="option">
6223 <primary><option>-oX</option></primary>
6225 <indexterm role="concept">
6226 <primary>TCP/IP</primary>
6227 <secondary>setting listening ports</secondary>
6229 <indexterm role="concept">
6230 <primary>TCP/IP</primary>
6231 <secondary>setting listening interfaces</secondary>
6233 <indexterm role="concept">
6234 <primary>port</primary>
6235 <secondary>receiving TCP/IP</secondary>
6237 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6238 is also given. It controls which ports and interfaces the daemon uses. Details
6239 of the syntax, and how it interacts with configuration file options, are given
6240 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6241 file is written unless <option>-oP</option> is also present to specify a pid file name.
6243 </listitem></varlistentry>
6245 <term><option>-pd</option></term>
6248 <indexterm role="option">
6249 <primary><option>-pd</option></primary>
6251 <indexterm role="concept">
6252 <primary>Perl</primary>
6253 <secondary>starting the interpreter</secondary>
6255 This option applies when an embedded Perl interpreter is linked with Exim (see
6256 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6257 option, forcing the starting of the interpreter to be delayed until it is
6260 </listitem></varlistentry>
6262 <term><option>-ps</option></term>
6265 <indexterm role="option">
6266 <primary><option>-ps</option></primary>
6268 <indexterm role="concept">
6269 <primary>Perl</primary>
6270 <secondary>starting the interpreter</secondary>
6272 This option applies when an embedded Perl interpreter is linked with Exim (see
6273 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6274 option, forcing the starting of the interpreter to occur as soon as Exim is
6277 </listitem></varlistentry>
6279 <term><option>-p</option><<emphasis>rval</emphasis>>:<<emphasis>sval</emphasis>></term>
6282 <indexterm role="option">
6283 <primary><option>-p</option></primary>
6285 For compatibility with Sendmail, this option is equivalent to
6288 <literal>-oMr</literal> <<emphasis>rval</emphasis>> <literal>-oMs</literal> <<emphasis>sval</emphasis>>
6291 It sets the incoming protocol and host name (for trusted callers). The
6292 host name and its colon can be omitted when only the protocol is to be set.
6293 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6294 to embedded Perl. It is therefore impossible to set a protocol value of <literal>p</literal>
6295 or <literal>s</literal> using this option (but that does not seem a real limitation).
6297 </listitem></varlistentry>
6299 <term><option>-q</option></term>
6302 <indexterm role="option">
6303 <primary><option>-q</option></primary>
6305 <indexterm role="concept">
6306 <primary>queue runner</primary>
6307 <secondary>starting manually</secondary>
6309 This option is normally restricted to admin users. However, there is a
6310 configuration option called <option>prod_requires_admin</option> which can be set false to
6311 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6312 and <option>-S</option> options).
6315 <indexterm role="concept">
6316 <primary>queue runner</primary>
6317 <secondary>description of operation</secondary>
6319 The <option>-q</option> option starts one queue runner process. This scans the queue of
6320 waiting messages, and runs a delivery process for each one in turn. It waits
6321 for each delivery process to finish before starting the next one. A delivery
6322 process may not actually do any deliveries if the retry times for the addresses
6323 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6327 <indexterm role="concept">
6328 <primary>SMTP</primary>
6329 <secondary>passed connection</secondary>
6331 <indexterm role="concept">
6332 <primary>SMTP</primary>
6333 <secondary>multiple deliveries</secondary>
6335 <indexterm role="concept">
6336 <primary>multiple SMTP deliveries</primary>
6338 the delivery process spawns other processes to deliver other messages down
6339 passed SMTP connections, the queue runner waits for these to finish before
6343 When all the queued messages have been considered, the original queue runner
6344 process terminates. In other words, a single pass is made over the waiting
6345 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6346 this to be repeated periodically.
6349 Exim processes the waiting messages in an unpredictable order. It isn’t very
6350 random, but it is likely to be different each time, which is all that matters.
6351 If one particular message screws up a remote MTA, other messages to the same
6352 MTA have a chance of getting through if they get tried first.
6355 It is possible to cause the messages to be processed in lexical message id
6356 order, which is essentially the order in which they arrived, by setting the
6357 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6359 </listitem></varlistentry>
6361 <term><option>-q</option><<emphasis>qflags</emphasis>></term>
6364 The <option>-q</option> option may be followed by one or more flag letters that change its
6365 behaviour. They are all optional, but if more than one is present, they must
6366 appear in the correct order. Each flag is described in a separate item below.
6368 </listitem></varlistentry>
6370 <term><option>-qq...</option></term>
6373 <indexterm role="option">
6374 <primary><option>-qq</option></primary>
6376 <indexterm role="concept">
6377 <primary>queue</primary>
6378 <secondary>double scanning</secondary>
6380 <indexterm role="concept">
6381 <primary>queue</primary>
6382 <secondary>routing</secondary>
6384 <indexterm role="concept">
6385 <primary>routing</primary>
6386 <secondary>whole queue before delivery</secondary>
6388 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6389 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6390 every domain. Addresses are routed, local deliveries happen, but no remote
6394 <indexterm role="concept">
6395 <primary>hints database</primary>
6396 <secondary>remembering routing</secondary>
6398 The hints database that remembers which messages are waiting for specific hosts
6399 is updated, as if delivery to those hosts had been deferred. After this is
6400 complete, a second, normal queue scan happens, with routing and delivery taking
6401 place as normal. Messages that are routed to the same host should mostly be
6402 delivered down a single SMTP
6403 <indexterm role="concept">
6404 <primary>SMTP</primary>
6405 <secondary>passed connection</secondary>
6407 <indexterm role="concept">
6408 <primary>SMTP</primary>
6409 <secondary>multiple deliveries</secondary>
6411 <indexterm role="concept">
6412 <primary>multiple SMTP deliveries</primary>
6414 connection because of the hints that were set up during the first queue scan.
6415 This option may be useful for hosts that are connected to the Internet
6418 </listitem></varlistentry>
6420 <term><option>-q[q]i...</option></term>
6423 <indexterm role="option">
6424 <primary><option>-qi</option></primary>
6426 <indexterm role="concept">
6427 <primary>queue</primary>
6428 <secondary>initial delivery</secondary>
6430 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6431 those messages that haven’t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6432 delivery</quote>.) This can be helpful if you are putting messages on the queue using
6433 <option>-odq</option> and want a queue runner just to process the new messages.
6435 </listitem></varlistentry>
6437 <term><option>-q[q][i]f...</option></term>
6440 <indexterm role="option">
6441 <primary><option>-qf</option></primary>
6443 <indexterm role="concept">
6444 <primary>queue</primary>
6445 <secondary>forcing delivery</secondary>
6447 <indexterm role="concept">
6448 <primary>delivery</primary>
6449 <secondary>forcing in queue run</secondary>
6451 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6452 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6453 their retry times are tried.
6455 </listitem></varlistentry>
6457 <term><option>-q[q][i]ff...</option></term>
6460 <indexterm role="option">
6461 <primary><option>-qff</option></primary>
6463 <indexterm role="concept">
6464 <primary>frozen messages</primary>
6465 <secondary>forcing delivery</secondary>
6467 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6470 </listitem></varlistentry>
6472 <term><option>-q[q][i][f[f]]l</option></term>
6475 <indexterm role="option">
6476 <primary><option>-ql</option></primary>
6478 <indexterm role="concept">
6479 <primary>queue</primary>
6480 <secondary>local deliveries only</secondary>
6482 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6483 be done. If a message requires any remote deliveries, it remains on the queue
6486 </listitem></varlistentry>
6488 <term><option>-q</option><<emphasis>qflags</emphasis>> <<emphasis>start id</emphasis>> <<emphasis>end id</emphasis>></term>
6491 <indexterm role="concept">
6492 <primary>queue</primary>
6493 <secondary>delivering specific messages</secondary>
6495 When scanning the queue, Exim can be made to skip over messages whose ids are
6496 lexically less than a given value by following the <option>-q</option> option with a
6497 starting message id. For example:
6499 <literallayout class="monospaced">
6500 exim -q 0t5C6f-0000c8-00
6503 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
6504 second message id is given, messages whose ids are lexically greater than it
6505 are also skipped. If the same id is given twice, for example,
6507 <literallayout class="monospaced">
6508 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
6511 just one delivery process is started, for that message. This differs from
6512 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
6513 that it counts as a delivery from a queue run. Note that the selection
6514 mechanism does not affect the order in which the messages are scanned. There
6515 are also other ways of selecting specific sets of messages for delivery in a
6516 queue run – see <option>-R</option> and <option>-S</option>.
6518 </listitem></varlistentry>
6520 <term><option>-q</option><<emphasis>qflags</emphasis>><<emphasis>time</emphasis>></term>
6523 <indexterm role="concept">
6524 <primary>queue runner</primary>
6525 <secondary>starting periodically</secondary>
6527 <indexterm role="concept">
6528 <primary>periodic queue running</primary>
6530 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
6531 starting a queue runner process at intervals specified by the given time value
6532 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
6533 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
6534 single daemon process handles both functions. A common way of starting up a
6535 combined daemon at system boot time is to use a command such as
6537 <literallayout class="monospaced">
6538 /usr/exim/bin/exim -bd -q30m
6541 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
6542 process every 30 minutes.
6545 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
6546 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
6548 </listitem></varlistentry>
6550 <term><option>-qR</option><<emphasis>rsflags</emphasis>> <<emphasis>string</emphasis>></term>
6553 <indexterm role="option">
6554 <primary><option>-qR</option></primary>
6556 This option is synonymous with <option>-R</option>. It is provided for Sendmail
6559 </listitem></varlistentry>
6561 <term><option>-qS</option><<emphasis>rsflags</emphasis>> <<emphasis>string</emphasis>></term>
6564 <indexterm role="option">
6565 <primary><option>-qS</option></primary>
6567 This option is synonymous with <option>-S</option>.
6569 </listitem></varlistentry>
6571 <term><option>-R</option><<emphasis>rsflags</emphasis>> <<emphasis>string</emphasis>></term>
6574 <indexterm role="option">
6575 <primary><option>-R</option></primary>
6577 <indexterm role="concept">
6578 <primary>queue runner</primary>
6579 <secondary>for specific recipients</secondary>
6581 <indexterm role="concept">
6582 <primary>delivery</primary>
6583 <secondary>to given domain</secondary>
6585 <indexterm role="concept">
6586 <primary>domain</primary>
6587 <secondary>delivery to</secondary>
6589 The <<emphasis>rsflags</emphasis>> may be empty, in which case the white space before the string
6590 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
6591 which are the possible values for <<emphasis>rsflags</emphasis>>. White space is required if
6592 <<emphasis>rsflags</emphasis>> is not empty.
6595 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
6596 perform a single queue run, except that, when scanning the messages on the
6597 queue, Exim processes only those that have at least one undelivered recipient
6598 address containing the given string, which is checked in a case-independent
6599 way. If the <<emphasis>rsflags</emphasis>> start with <emphasis>r</emphasis>, <<emphasis>string</emphasis>> is interpreted as a
6600 regular expression; otherwise it is a literal string.
6602 <para revisionflag="changed">
6603 If you want to do periodic queue runs for messages with specific recipients,
6604 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
6606 <literallayout class="monospaced" revisionflag="changed">
6607 exim -q25m -R @special.domain.example
6609 <para revisionflag="changed">
6610 This example does a queue run for messages with recipients in the given domain
6611 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
6612 applied to each queue run.
6615 Once a message is selected for delivery by this mechanism, all its addresses
6616 are processed. For the first selected message, Exim overrides any retry
6617 information and forces a delivery attempt for each undelivered address. This
6618 means that if delivery of any address in the first message is successful, any
6619 existing retry information is deleted, and so delivery attempts for that
6620 address in subsequently selected messages (which are processed without forcing)
6621 will run. However, if delivery of any address does not succeed, the retry
6622 information is updated, and in subsequently selected messages, the failing
6623 address will be skipped.
6626 <indexterm role="concept">
6627 <primary>frozen messages</primary>
6628 <secondary>forcing delivery</secondary>
6630 If the <<emphasis>rsflags</emphasis>> contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
6631 all selected messages, not just the first; frozen messages are included when
6632 <emphasis>ff</emphasis> is present.
6635 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
6636 to a given domain after a host has been down for some time. When the SMTP
6637 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
6638 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
6639 an arbitrary command instead.
6641 </listitem></varlistentry>
6643 <term><option>-r</option></term>
6646 <indexterm role="option">
6647 <primary><option>-r</option></primary>
6649 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
6651 </listitem></varlistentry>
6653 <term><option>-S</option><<emphasis>rsflags</emphasis>> <<emphasis>string</emphasis>></term>
6656 <indexterm role="option">
6657 <primary><option>-S</option></primary>
6659 <indexterm role="concept">
6660 <primary>delivery</primary>
6661 <secondary>from given sender</secondary>
6663 <indexterm role="concept">
6664 <primary>queue runner</primary>
6665 <secondary>for specific senders</secondary>
6667 This option acts like <option>-R</option> except that it checks the string against each
6668 message’s sender instead of against the recipients. If <option>-R</option> is also set, both
6669 conditions must be met for a message to be selected. If either of the options
6670 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
6672 </listitem></varlistentry>
6674 <term><option>-Tqt</option> <<emphasis>times</emphasis>></term>
6677 <indexterm role="option">
6678 <primary><option>-Tqt</option></primary>
6680 This an option that is exclusively for use by the Exim testing suite. It is not
6681 recognized when Exim is run normally. It allows for the setting up of explicit
6682 <quote>queue times</quote> so that various warning/retry features can be tested.
6684 </listitem></varlistentry>
6686 <term><option>-t</option></term>
6689 <indexterm role="option">
6690 <primary><option>-t</option></primary>
6692 <indexterm role="concept">
6693 <primary>recipient</primary>
6694 <secondary>extracting from header lines</secondary>
6696 <indexterm role="concept">
6697 <primary><emphasis>Bcc:</emphasis> header line</primary>
6699 <indexterm role="concept">
6700 <primary><emphasis>Cc:</emphasis> header line</primary>
6702 <indexterm role="concept">
6703 <primary><emphasis>To:</emphasis> header line</primary>
6705 When Exim is receiving a locally-generated, non-SMTP message on its standard
6706 input, the <option>-t</option> option causes the recipients of the message to be obtained
6707 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
6708 from the command arguments. The addresses are extracted before any rewriting
6709 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
6712 <indexterm role="concept">
6713 <primary>Sendmail compatibility</primary>
6714 <secondary><option>-t</option> option</secondary>
6716 If the command has any arguments, they specify addresses to which the message
6717 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
6718 the recipients list obtained from the headers. This is compatible with Smail 3
6719 and in accordance with the documented behaviour of several versions of
6720 Sendmail, as described in man pages on a number of operating systems (e.g.
6721 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
6722 argument addresses to those obtained from the headers, and the O’Reilly
6723 Sendmail book documents it that way. Exim can be made to add argument addresses
6724 instead of subtracting them by setting the option
6725 <option>extract_addresses_remove_arguments</option> false.
6728 <indexterm role="concept">
6729 <primary><option>Resent-</option> header lines</primary>
6730 <secondary>with <option>-t</option></secondary>
6732 If there are any <option>Resent-</option> header lines in the message, Exim extracts
6733 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
6734 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
6735 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
6736 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
6739 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
6740 message is resent several times). The RFC also specifies that they should be
6741 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
6742 not at all clear how <option>-t</option> should operate in the present of multiple sets,
6743 nor indeed exactly what constitutes a <quote>set</quote>.
6744 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
6745 are often added at the end of the header, and if a message is resent more than
6746 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
6747 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
6749 </listitem></varlistentry>
6751 <term><option>-ti</option></term>
6754 <indexterm role="option">
6755 <primary><option>-ti</option></primary>
6757 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
6758 compatibility with Sendmail.
6760 </listitem></varlistentry>
6762 <term><option>-tls-on-connect</option></term>
6765 <indexterm role="option">
6766 <primary><option>-tls-on-connect</option></primary>
6768 <indexterm role="concept">
6769 <primary>TLS</primary>
6770 <secondary>use without STARTTLS</secondary>
6772 <indexterm role="concept">
6773 <primary>TLS</primary>
6774 <secondary>automatic start</secondary>
6776 This option is available when Exim is compiled with TLS support. It forces all
6777 incoming SMTP connections to behave as if the incoming port is listed in the
6778 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
6779 <xref linkend="CHAPTLS"/> for further details.
6781 </listitem></varlistentry>
6783 <term><option>-U</option></term>
6786 <indexterm role="option">
6787 <primary><option>-U</option></primary>
6789 <indexterm role="concept">
6790 <primary>Sendmail compatibility</primary>
6791 <secondary><option>-U</option> option ignored</secondary>
6793 Sendmail uses this option for <quote>initial message submission</quote>, and its
6794 documentation states that in future releases, it may complain about
6795 syntactically invalid messages rather than fixing them when this flag is not
6796 set. Exim ignores this option.
6798 </listitem></varlistentry>
6800 <term><option>-v</option></term>
6803 <indexterm role="option">
6804 <primary><option>-v</option></primary>
6806 This option causes Exim to write information to the standard error stream,
6807 describing what it is doing. In particular, it shows the log lines for
6808 receiving and delivering a message, and if an SMTP connection is made, the SMTP
6809 dialogue is shown. Some of the log lines shown may not actually be written to
6810 the log if the setting of <option>log_selector</option> discards them. Any relevant
6811 selectors are shown with each log line. If none are shown, the logging is
6814 </listitem></varlistentry>
6816 <term><option>-x</option></term>
6819 <indexterm role="option">
6820 <primary><option>-x</option></primary>
6822 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
6823 National Language Support extended characters in the body of the mail item</quote>).
6824 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
6827 </listitem></varlistentry>
6830 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
6831 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
6833 <!-- === End of command line options === -->
6837 <chapter id="CHAPconf">
6838 <title>The Exim run time configuration file</title>
6839 <titleabbrev>The runtime configuration file</titleabbrev>
6841 <indexterm role="concept">
6842 <primary>run time configuration</primary>
6844 <indexterm role="concept">
6845 <primary>configuration file</primary>
6846 <secondary>general description</secondary>
6848 <indexterm role="concept">
6849 <primary>CONFIGURE_FILE</primary>
6851 <indexterm role="concept">
6852 <primary>configuration file</primary>
6853 <secondary>errors in</secondary>
6855 <indexterm role="concept">
6856 <primary>error</primary>
6857 <secondary>in configuration file</secondary>
6859 <indexterm role="concept">
6860 <primary>return code</primary>
6861 <secondary>for bad configuration</secondary>
6863 Exim uses a single run time configuration file that is read whenever an Exim
6864 binary is executed. Note that in normal operation, this happens frequently,
6865 because Exim is designed to operate in a distributed manner, without central
6869 If a syntax error is detected while reading the configuration file, Exim
6870 writes a message on the standard error, and exits with a non-zero return code.
6871 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
6872 errors can be detected at this time. The values of any expanded options are
6873 not checked until the expansion happens, even when the expansion does not
6874 actually alter the string.
6877 The name of the configuration file is compiled into the binary for security
6878 reasons, and is specified by the CONFIGURE_FILE compilation option. In
6879 most configurations, this specifies a single file. However, it is permitted to
6880 give a colon-separated list of file names, in which case Exim uses the first
6881 existing file in the list.
6884 <indexterm role="concept">
6885 <primary>EXIM_USER</primary>
6887 <indexterm role="concept">
6888 <primary>EXIM_GROUP</primary>
6890 <indexterm role="concept">
6891 <primary>CONFIGURE_OWNER</primary>
6893 <indexterm role="concept">
6894 <primary>CONFIGURE_GROUP</primary>
6896 <indexterm role="concept">
6897 <primary>configuration file</primary>
6898 <secondary>ownership</secondary>
6900 <indexterm role="concept">
6901 <primary>ownership</primary>
6902 <secondary>configuration file</secondary>
6904 The run time configuration file must be owned by root or by the user that is
6905 specified at compile time by the EXIM_USER option, or by the user that is
6906 specified at compile time by the CONFIGURE_OWNER option (if set). The
6907 configuration file must not be world-writeable or group-writeable, unless its
6908 group is the one specified at compile time by the EXIM_GROUP option or by the
6909 CONFIGURE_GROUP option.
6912 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
6913 to root, anybody who is able to edit the run time configuration file has an
6914 easy way to run commands as root. If you make your mail administrators members
6915 of the Exim group, but do not trust them with root, make sure that the run time
6916 configuration is not group writeable.
6919 A default configuration file, which will work correctly in simple situations,
6920 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
6921 defines just one file name, the installation process copies the default
6922 configuration to a new file of that name if it did not previously exist. If
6923 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
6924 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
6928 <title>Using a different configuration file</title>
6930 <indexterm role="concept">
6931 <primary>configuration file</primary>
6932 <secondary>alternate</secondary>
6934 A one-off alternate configuration can be specified by the <option>-C</option> command line
6935 option, which may specify a single file or a list of files. However, when
6936 <option>-C</option> is used, Exim gives up its root privilege, unless called by root or the
6937 Exim user (or unless the argument for <option>-C</option> is identical to the built-in value
6938 from CONFIGURE_FILE). <option>-C</option> is useful mainly for checking the syntax of
6939 configuration files before installing them. No owner or group checks are done
6940 on a configuration file specified by <option>-C</option>.
6943 The privileged use of <option>-C</option> by the Exim user can be locked out by setting
6944 ALT_CONFIG_ROOT_ONLY in <filename>Local/Makefile</filename> when building Exim. However,
6945 if you do this, you also lock out the possibility of testing a
6946 configuration using <option>-C</option> right through message reception and delivery, even
6947 if the caller is root. The reception works, but by that time, Exim is running
6948 as the Exim user, so when it re-execs to regain privilege for the delivery, the
6949 use of <option>-C</option> causes privilege to be lost. However, root can test reception and
6950 delivery using two separate commands (one to put a message on the queue, using
6951 <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
6954 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
6955 prefix string with which any file named in a <option>-C</option> command line option must
6956 start. In addition, the file name must not contain the sequence <quote><literal>/../</literal></quote>.
6957 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any file
6958 name can be used with <option>-C</option>.
6961 One-off changes to a configuration can be specified by the <option>-D</option> command line
6962 option, which defines and overrides values for macros used inside the
6963 configuration file. However, like <option>-C</option>, the use of this option by a
6964 non-privileged user causes Exim to discard its root privilege.
6965 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
6966 completely disabled, and its use causes an immediate error exit.
6969 Some sites may wish to use the same Exim binary on different machines that
6970 share a file system, but to use different configuration files on each machine.
6971 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
6972 looks for a file whose name is the configuration file name followed by a dot
6973 and the machine’s node name, as obtained from the <function>uname()</function> function. If this
6974 file does not exist, the standard name is tried. This processing occurs for
6975 each file name in the list given by CONFIGURE_FILE or <option>-C</option>.
6978 In some esoteric situations different versions of Exim may be run under
6979 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
6980 help with this. See the comments in <filename>src/EDITME</filename> for details.
6983 <section id="SECTconffilfor">
6984 <title>Configuration file format</title>
6986 <indexterm role="concept">
6987 <primary>configuration file</primary>
6988 <secondary>format of</secondary>
6990 <indexterm role="concept">
6991 <primary>format</primary>
6992 <secondary>configuration file</secondary>
6994 Exim’s configuration file is divided into a number of different parts. General
6995 option settings must always appear at the start of the file. The other parts
6996 are all optional, and may appear in any order. Each part other than the first
6997 is introduced by the word <quote>begin</quote> followed by the name of the part. The
7003 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail.
7008 <indexterm role="concept">
7009 <primary>AUTH</primary>
7010 <secondary>configuration</secondary>
7012 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
7013 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
7018 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
7019 addresses and determine how the message is to be delivered.
7024 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
7025 define mechanisms for copying messages to destinations.
7030 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be immediately delivered.
7035 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
7036 when new addresses are generated during delivery.
7041 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
7042 want to use this feature, you must set
7044 <literallayout class="monospaced">
7045 LOCAL_SCAN_HAS_OPTIONS=yes
7048 in <filename>Local/Makefile</filename> before building Exim. Full details of the
7049 <function>local_scan()</function> facility are given in chapter <xref linkend="CHAPlocalscan"/>.
7054 <indexterm role="concept">
7055 <primary>configuration file</primary>
7056 <secondary>leading white space in</secondary>
7058 <indexterm role="concept">
7059 <primary>configuration file</primary>
7060 <secondary>trailing white space in</secondary>
7062 <indexterm role="concept">
7063 <primary>white space</primary>
7064 <secondary>in configuration file</secondary>
7066 Leading and trailing white space in configuration lines is always ignored.
7069 Blank lines in the file, and lines starting with a # character (ignoring
7070 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
7071 # character other than at the beginning of a line is not treated specially,
7072 and does not introduce a comment.
7075 Any non-comment line can be continued by ending it with a backslash. Note that
7076 the general rule for white space means that trailing white space after the
7077 backslash and leading white space at the start of continuation
7078 lines is ignored. Comment lines beginning with # (but not empty lines) may
7079 appear in the middle of a sequence of continuation lines.
7082 A convenient way to create a configuration file is to start from the
7083 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7084 change settings as required.
7087 The ACLs, retry rules, and rewriting rules have their own syntax which is
7088 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7089 respectively. The other parts of the configuration file have some syntactic
7090 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7091 onwards. Before that, the inclusion, macro, and conditional facilities are
7096 <title>File inclusions in the configuration file</title>
7098 <indexterm role="concept">
7099 <primary>inclusions in configuration file</primary>
7101 <indexterm role="concept">
7102 <primary>configuration file</primary>
7103 <secondary>including other files</secondary>
7105 <indexterm role="concept">
7106 <primary>.include in configuration file</primary>
7108 <indexterm role="concept">
7109 <primary>.include_if_exists in configuration file</primary>
7111 You can include other files inside Exim’s run time configuration file by
7115 <literal>.include</literal> <<emphasis>file name</emphasis>>
7116 <literal>.include_if_exists</literal> <<emphasis>file name</emphasis>>
7119 on a line by itself. Double quotes round the file name are optional. If you use
7120 the first form, a configuration error occurs if the file does not exist; the
7121 second form does nothing for non-existent files. In all cases, an absolute file
7125 Includes may be nested to any depth, but remember that Exim reads its
7126 configuration file often, so it is a good idea to keep them to a minimum.
7127 If you change the contents of an included file, you must HUP the daemon,
7128 because an included file is read only when the configuration itself is read.
7131 The processing of inclusions happens early, at a physical line level, so, like
7132 comment lines, an inclusion can be used in the middle of an option setting,
7135 <literallayout class="monospaced">
7136 hosts_lookup = a.b.c \
7140 Include processing happens after macro processing (see below). Its effect is to
7141 process the lines of the included file as if they occurred inline where the
7145 <section id="SECTmacrodefs">
7146 <title>Macros in the configuration file</title>
7148 <indexterm role="concept">
7149 <primary>macro</primary>
7150 <secondary>description of</secondary>
7152 <indexterm role="concept">
7153 <primary>configuration file</primary>
7154 <secondary>macros</secondary>
7156 If a line in the main part of the configuration (that is, before the first
7157 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7158 definition, and must be of the form
7161 <<emphasis>name</emphasis>> = <<emphasis>rest of line</emphasis>>
7164 The name must consist of letters, digits, and underscores, and need not all be
7165 in upper case, though that is recommended. The rest of the line, including any
7166 continuations, is the replacement text, and has leading and trailing white
7167 space removed. Quotes are not removed. The replacement text can never end with
7168 a backslash character, but this doesn’t seem to be a serious limitation.
7171 Macros may also be defined between router, transport, authenticator, or ACL
7172 definitions. They may not, however, be defined within an individual driver or
7173 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7177 <title>Macro substitution</title>
7179 Once a macro is defined, all subsequent lines in the file (and any included
7180 files) are scanned for the macro name; if there are several macros, the line is
7181 scanned for each in turn, in the order in which the macros are defined. The
7182 replacement text is not re-scanned for the current macro, though it is scanned
7183 for subsequently defined macros. For this reason, a macro name may not contain
7184 the name of a previously defined macro as a substring. You could, for example,
7188 <literal>ABCD_XYZ = </literal><<emphasis>something</emphasis>>
7189 <literal>ABCD = </literal><<emphasis>something else</emphasis>>
7192 but putting the definitions in the opposite order would provoke a configuration
7193 error. Macro expansion is applied to individual physical lines from the file,
7194 before checking for line continuation or file inclusion (see above). If a line
7195 consists solely of a macro name, and the expansion of the macro is empty, the
7196 line is ignored. A macro at the start of a line may turn the line into a
7197 comment line or a <literal>.include</literal> line.
7201 <title>Redefining macros</title>
7203 Once defined, the value of a macro can be redefined later in the configuration
7204 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7205 <emphasis>=</emphasis>. For example:
7207 <literallayout class="monospaced">
7210 MAC == updated value
7213 Redefinition does not alter the order in which the macros are applied to the
7214 subsequent lines of the configuration file. It is still the same order in which
7215 the macros were originally defined. All that changes is the macro’s value.
7216 Redefinition makes it possible to accumulate values. For example:
7218 <literallayout class="monospaced">
7221 MAC == MAC and something added
7224 This can be helpful in situations where the configuration file is built
7225 from a number of other files.
7229 <title>Overriding macro values</title>
7231 The values set for macros in the configuration file can be overridden by the
7232 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7233 used, unless called by root or the Exim user. A definition on the command line
7234 using the <option>-D</option> option causes all definitions and redefinitions within the
7239 <title>Example of macro usage</title>
7241 As an example of macro usage, consider a configuration where aliases are looked
7242 up in a MySQL database. It helps to keep the file less cluttered if long
7243 strings such as SQL statements are defined separately as macros, for example:
7245 <literallayout class="monospaced">
7246 ALIAS_QUERY = select mailbox from user where \
7247 login=${quote_mysql:$local_part};
7250 This can then be used in a <command>redirect</command> router setting like this:
7252 <literallayout class="monospaced">
7253 data = ${lookup mysql{ALIAS_QUERY}}
7256 In earlier versions of Exim macros were sometimes used for domain, host, or
7257 address lists. In Exim 4 these are handled better by named lists – see
7258 section <xref linkend="SECTnamedlists"/>.
7262 <title>Conditional skips in the configuration file</title>
7264 <indexterm role="concept">
7265 <primary>configuration file</primary>
7266 <secondary>conditional skips</secondary>
7268 <indexterm role="concept">
7269 <primary>.ifdef</primary>
7271 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7272 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7273 portions of the configuration file. The processing happens whenever the file is
7274 read (that is, when an Exim binary starts to run).
7277 The implementation is very simple. Instances of the first four directives must
7278 be followed by text that includes the names of one or macros. The condition
7279 that is tested is whether or not any macro substitution has taken place in the
7282 <literallayout class="monospaced">
7284 message_size_limit = 50M
7286 message_size_limit = 100M
7290 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined, and 100M
7291 otherwise. If there is more than one macro named on the line, the condition
7292 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7293 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7296 Although you can use a macro expansion to generate one of these directives,
7297 it is not very useful, because the condition <quote>there was a macro substitution
7298 in this line</quote> will always be true.
7301 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7302 to clarify complicated nestings.
7305 <section id="SECTcos">
7306 <title>Common option syntax</title>
7308 <indexterm role="concept">
7309 <primary>common option syntax</primary>
7311 <indexterm role="concept">
7312 <primary>syntax of common options</primary>
7314 <indexterm role="concept">
7315 <primary>configuration file</primary>
7316 <secondary>common option syntax</secondary>
7318 For the main set of options, driver options, and <function>local_scan()</function> options,
7319 each setting is on a line by itself, and starts with a name consisting of
7320 lower-case letters and underscores. Many options require a data value, and in
7321 these cases the name must be followed by an equals sign (with optional white
7322 space) and then the value. For example:
7324 <literallayout class="monospaced">
7325 qualify_domain = mydomain.example.com
7328 Some option settings may contain sensitive data, for example, passwords for
7329 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7330 line option to read these values, you can precede the option settings with the
7331 word <quote>hide</quote>. For example:
7333 <literallayout class="monospaced">
7334 hide mysql_servers = localhost/users/admin/secret-password
7337 For non-admin users, such options are displayed like this:
7339 <literallayout class="monospaced">
7340 mysql_servers = <value not displayable>
7343 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7344 all instances of the same driver.
7347 The following sections describe the syntax used for the different data types
7348 that are found in option settings.
7352 <title>Boolean options</title>
7354 <indexterm role="concept">
7355 <primary>format</primary>
7356 <secondary>boolean</secondary>
7358 <indexterm role="concept">
7359 <primary>boolean configuration values</primary>
7361 <indexterm role="option">
7362 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7364 <indexterm role="option">
7365 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7367 Options whose type is given as boolean are on/off switches. There are two
7368 different ways of specifying such options: with and without a data value. If
7369 the option name is specified on its own without data, the switch is turned on;
7370 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7371 boolean options may be followed by an equals sign and one of the words
7372 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7373 the following two settings have exactly the same effect:
7375 <literallayout class="monospaced">
7380 The following two lines also have the same (opposite) effect:
7382 <literallayout class="monospaced">
7387 You can use whichever syntax you prefer.
7391 <title>Integer values</title>
7393 <indexterm role="concept">
7394 <primary>integer configuration values</primary>
7396 <indexterm role="concept">
7397 <primary>format</primary>
7398 <secondary>integer</secondary>
7400 If an integer data item starts with the characters <quote>0x</quote>, the remainder of it
7401 is interpreted as a hexadecimal number. Otherwise, it is treated as octal if it
7402 starts with the digit 0, and decimal if not. If an integer value is followed by
7403 the letter K, it is multiplied by 1024; if it is followed by the letter M, it
7404 is multiplied by 1024x1024.
7407 When the values of integer option settings are output, values which are an
7408 exact multiple of 1024 or 1024x1024 are
7409 sometimes, but not always,
7410 printed using the letters K and M. The printing style is independent of the
7411 actual input format that was used.
7415 <title>Octal integer values</title>
7417 <indexterm role="concept">
7418 <primary>integer format</primary>
7420 <indexterm role="concept">
7421 <primary>format</primary>
7422 <secondary>octal integer</secondary>
7424 The value of an option specified as an octal integer is always interpreted in
7425 octal, whether or not it starts with the digit zero. Such options are always
7430 <title>Fixed point number values</title>
7432 <indexterm role="concept">
7433 <primary>fixed point configuration values</primary>
7435 <indexterm role="concept">
7436 <primary>format</primary>
7437 <secondary>fixed point</secondary>
7439 A fixed point number consists of a decimal integer, optionally followed by a
7440 decimal point and up to three further digits.
7443 <section id="SECTtimeformat">
7444 <title>Time interval values</title>
7446 <indexterm role="concept">
7447 <primary>time interval</primary>
7448 <secondary>specifying in configuration</secondary>
7450 <indexterm role="concept">
7451 <primary>format</primary>
7452 <secondary>time interval</secondary>
7454 A time interval is specified as a sequence of numbers, each followed by one of
7455 the following letters, with no intervening white space:
7457 <informaltable frame="none">
7458 <tgroup cols="2" colsep="0" rowsep="0">
7459 <colspec colwidth="50pt" align="left"/>
7460 <colspec colwidth="254pt" align="left"/>
7463 <entry> <option>s</option></entry>
7464 <entry>seconds</entry>
7467 <entry> <option>m</option></entry>
7468 <entry>minutes</entry>
7471 <entry> <option>h</option></entry>
7472 <entry>hours</entry>
7475 <entry> <option>d</option></entry>
7479 <entry> <option>w</option></entry>
7480 <entry>weeks</entry>
7486 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
7487 intervals are output in the same format. Exim does not restrict the values; it
7488 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
7491 <section id="SECTstrings">
7492 <title>String values</title>
7494 <indexterm role="concept">
7495 <primary>string</primary>
7496 <secondary>format of configuration values</secondary>
7498 <indexterm role="concept">
7499 <primary>format</primary>
7500 <secondary>string</secondary>
7502 If a string data item does not start with a double-quote character, it is taken
7503 as consisting of the remainder of the line plus any continuation lines,
7504 starting at the first character after any leading white space, with trailing
7505 white space removed, and with no interpretation of the characters in the
7506 string. Because Exim removes comment lines (those beginning with #) at an early
7507 stage, they can appear in the middle of a multi-line string. The following
7508 settings are therefore equivalent:
7510 <literallayout class="monospaced">
7511 trusted_users = uucp:mail
7513 trusted_users = uucp:\
7514 # This comment line is ignored
7518 <indexterm role="concept">
7519 <primary>string</primary>
7520 <secondary>quoted</secondary>
7522 <indexterm role="concept">
7523 <primary>escape characters in quoted strings</primary>
7525 If a string does start with a double-quote, it must end with a closing
7526 double-quote, and any backslash characters other than those used for line
7527 continuation are interpreted as escape characters, as follows:
7529 <informaltable frame="none">
7530 <tgroup cols="2" colsep="0" rowsep="0">
7531 <colspec colwidth="100pt" align="left"/>
7532 <colspec colwidth="254pt" align="left"/>
7535 <entry> <literal>\\</literal></entry>
7536 <entry>single backslash</entry>
7539 <entry> <literal>\n</literal></entry>
7540 <entry>newline</entry>
7543 <entry> <literal>\r</literal></entry>
7544 <entry>carriage return</entry>
7547 <entry> <literal>\t</literal></entry>
7551 <entry> <literal>\</literal><<emphasis>octal digits</emphasis>></entry>
7552 <entry>up to 3 octal digits specify one character</entry>
7555 <entry> <literal>\x</literal><<emphasis>hex digits</emphasis>></entry>
7556 <entry>up to 2 hexadecimal digits specify one character</entry>
7562 If a backslash is followed by some other character, including a double-quote
7563 character, that character replaces the pair.
7566 Quoting is necessary only if you want to make use of the backslash escapes to
7567 insert special characters, or if you need to specify a value with leading or
7568 trailing spaces. These cases are rare, so quoting is almost never needed in
7569 current versions of Exim. In versions of Exim before 3.14, quoting was required
7570 in order to continue lines, so you may come across older configuration files
7571 and examples that apparently quote unnecessarily.
7575 <title>Expanded strings</title>
7577 <indexterm role="concept">
7578 <primary>string expansion</primary>
7579 <secondary>definition of</secondary>
7581 <indexterm role="concept">
7582 <primary>expansion</primary>
7583 <secondary>definition of</secondary>
7585 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
7586 by which means various parts of the string may be changed according to the
7587 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
7588 is as just described; in particular, the handling of backslashes in quoted
7589 strings is done as part of the input process, before expansion takes place.
7590 However, backslash is also an escape character for the expander, so any
7591 backslashes that are required for that reason must be doubled if they are
7592 within a quoted configuration string.
7596 <title>User and group names</title>
7598 <indexterm role="concept">
7599 <primary>user name</primary>
7600 <secondary>format of</secondary>
7602 <indexterm role="concept">
7603 <primary>format</primary>
7604 <secondary>user name</secondary>
7606 <indexterm role="concept">
7607 <primary>group</primary>
7608 <secondary>name format</secondary>
7610 <indexterm role="concept">
7611 <primary>format</primary>
7612 <secondary>group name</secondary>
7614 User and group names are specified as strings, using the syntax described
7615 above, but the strings are interpreted specially. A user or group name must
7616 either consist entirely of digits, or be a name that can be looked up using the
7617 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
7620 <section id="SECTlistconstruct">
7621 <title>List construction</title>
7623 <indexterm role="concept">
7624 <primary>list</primary>
7625 <secondary>syntax of in configuration</secondary>
7627 <indexterm role="concept">
7628 <primary>format</primary>
7629 <secondary>list item in configuration</secondary>
7631 <indexterm role="concept">
7632 <primary>string list</primary>
7633 <secondary>definition</secondary>
7635 The data for some configuration options is a list of items, with colon as the
7636 default separator. Many of these options are shown with type <quote>string list</quote> in
7637 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
7638 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
7639 are all the same; however, those other than <quote>string list</quote> are subject to
7640 particular kinds of interpretation, as described in chapter
7641 <xref linkend="CHAPdomhosaddlists"/>.
7644 In all these cases, the entire list is treated as a single string as far as the
7645 input syntax is concerned. The <option>trusted_users</option> setting in section
7646 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
7647 in a list, it must be entered as two colons. Leading and trailing white space
7648 on each item in a list is ignored. This makes it possible to include items that
7649 start with a colon, and in particular, certain forms of IPv6 address. For
7652 <literallayout class="monospaced">
7653 local_interfaces = 127.0.0.1 : ::::1
7656 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
7659 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
7660 list items, it is not ignored when parsing the list. The space after the first
7661 colon in the example above is necessary. If it were not there, the list would
7662 be interpreted as the two items 127.0.0.1:: and 1.
7665 <indexterm role="concept">
7666 <primary>list separator</primary>
7667 <secondary>changing</secondary>
7669 <indexterm role="concept">
7670 <primary>IPv6</primary>
7671 <secondary>addresses in lists</secondary>
7673 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
7674 introduced to allow the separator character to be changed. If a list begins
7675 with a left angle bracket, followed by any punctuation character, that
7676 character is used instead of colon as the list separator. For example, the list
7677 above can be rewritten to use a semicolon separator like this:
7679 <literallayout class="monospaced">
7680 local_interfaces = <; 127.0.0.1 ; ::1
7683 This facility applies to all lists, with the exception of the list in
7684 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
7685 confined to circumstances where they really are needed.
7688 <section id="SECTempitelis">
7689 <title>Empty items in lists</title>
7691 <indexterm role="concept">
7692 <primary>list</primary>
7693 <secondary>empty item in</secondary>
7695 An empty item at the end of a list is always ignored. In other words, trailing
7696 separator characters are ignored. Thus, the list in
7698 <literallayout class="monospaced">
7699 senders = user@domain :
7702 contains only a single item. If you want to include an empty string as one item
7703 in a list, it must not be the last item. For example, this list contains three
7704 items, the second of which is empty:
7706 <literallayout class="monospaced">
7707 senders = user1@domain : : user2@domain
7710 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
7711 are interpreted as representing a single colon data character (and the list
7712 would then contain just one item). If you want to specify a list that contains
7713 just one, empty item, you can do it as in this example:
7715 <literallayout class="monospaced">
7719 In this case, the first item is empty, and the second is discarded because it
7720 is at the end of the list.
7723 <section id="SECTfordricon">
7724 <title>Format of driver configurations</title>
7726 <indexterm role="concept">
7727 <primary>drivers</primary>
7728 <secondary>configuration format</secondary>
7730 There are separate parts in the configuration for defining routers, transports,
7731 and authenticators. In each part, you are defining a number of driver
7732 instances, each with its own set of options. Each driver instance is defined by
7733 a sequence of lines like this:
7736 <<emphasis>instance name</emphasis>>:
7737 <<emphasis>option</emphasis>>
7739 <<emphasis>option</emphasis>>
7742 In the following example, the instance name is <command>localuser</command>, and it is
7743 followed by three options settings:
7745 <literallayout class="monospaced">
7749 transport = local_delivery
7752 For each driver instance, you specify which Exim code module it uses – by the
7753 setting of the <option>driver</option> option – and (optionally) some configuration
7754 settings. For example, in the case of transports, if you want a transport to
7755 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
7756 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
7757 described in detail in its own separate chapter later in this manual.
7760 You can have several routers, transports, or authenticators that are based on
7761 the same underlying driver (each must have a different instance name).
7764 The order in which routers are defined is important, because addresses are
7765 passed to individual routers one by one, in order. The order in which
7766 transports are defined does not matter at all. The order in which
7767 authenticators are defined is used only when Exim, as a client, is searching
7768 them to find one that matches an authentication mechanism offered by the
7772 <indexterm role="concept">
7773 <primary>generic options</primary>
7775 <indexterm role="concept">
7776 <primary>options</primary>
7777 <secondary>generic – definition of</secondary>
7779 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
7780 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
7781 same type (that is, all routers, all transports or all authenticators). The
7782 <option>driver</option> option is a generic option that must appear in every definition.
7783 <indexterm role="concept">
7784 <primary>private options</primary>
7786 The private options are special for each driver, and none need appear, because
7787 they all have default values.
7790 The options may appear in any order, except that the <option>driver</option> option must
7791 precede any private options, since these depend on the particular driver. For
7792 this reason, it is recommended that <option>driver</option> always be the first option.
7795 Driver instance names, which are used for reference in log entries and
7796 elsewhere, can be any sequence of letters, digits, and underscores (starting
7797 with a letter) and must be unique among drivers of the same type. A router and
7798 a transport (for example) can each have the same name, but no two router
7799 instances can have the same name. The name of a driver instance should not be
7800 confused with the name of the underlying driver module. For example, the
7801 configuration lines:
7803 <literallayout class="monospaced">
7808 create an instance of the <command>smtp</command> transport driver whose name is
7809 <command>remote_smtp</command>. The same driver code can be used more than once, with
7810 different instance names and different option settings each time. A second
7811 instance of the <command>smtp</command> transport, with different options, might be defined
7814 <literallayout class="monospaced">
7818 command_timeout = 10s
7821 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
7822 these transport instances from routers, and these names would appear in log
7826 Comment lines may be present in the middle of driver specifications. The full
7827 list of option settings for any particular driver instance, including all the
7828 defaulted values, can be extracted by making use of the <option>-bP</option> command line
7834 <chapter id="CHAPdefconfil">
7835 <title>The default configuration file</title>
7837 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
7838 <primary>configuration file</primary>
7839 <secondary>default <quote>walk through</quote></secondary>
7841 <indexterm role="concept">
7842 <primary>default</primary>
7843 <secondary>configuration file <quote>walk through</quote></secondary>
7845 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
7846 is sufficient for a host with simple mail requirements. As an introduction to
7847 the way Exim is configured, this chapter <quote>walks through</quote> the default
7848 configuration, giving brief explanations of the settings. Detailed descriptions
7849 of the options are given in subsequent chapters. The default configuration file
7850 itself contains extensive comments about ways you might want to modify the
7851 initial settings. However, note that there are many options that are not
7852 mentioned at all in the default configuration.
7854 <section id="SECTdefconfmain">
7855 <title>Main configuration settings</title>
7857 The main (global) configuration option settings must always come first in the
7858 file. The first thing you’ll see in the file, after some initial comments, is
7861 <literallayout class="monospaced">
7862 # primary_hostname =
7865 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
7866 to know the official, fully qualified name of your host, and this is where you
7867 can specify it. However, in most cases you do not need to set this option. When
7868 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
7871 The first three non-comment configuration lines are as follows:
7873 <literallayout class="monospaced">
7874 domainlist local_domains = @
7875 domainlist relay_to_domains =
7876 hostlist relay_from_hosts = 127.0.0.1
7879 These are not, in fact, option settings. They are definitions of two named
7880 domain lists and one named host list. Exim allows you to give names to lists of
7881 domains, hosts, and email addresses, in order to make it easier to manage the
7882 configuration file (see section <xref linkend="SECTnamedlists"/>).
7885 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
7886 later in the configuration to identify domains that are to be delivered
7890 <indexterm role="concept">
7891 <primary>@ in a domain list</primary>
7893 There is just one item in this list, the string <quote>@</quote>. This is a special form
7894 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
7895 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
7896 be delivered locally. Because the local host’s name is referenced indirectly,
7897 the same configuration file can be used on different hosts.
7900 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
7901 list itself is empty. Later in the configuration we will come to the part that
7902 controls mail relaying through the local host; it allows relaying to any
7903 domains in this list. By default, therefore, no relaying on the basis of a mail
7904 domain is permitted.
7907 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
7908 used later in the configuration to permit relaying from any host or IP address
7909 that matches the list. The default contains just the IP address of the IPv4
7910 loopback interface, which means that processes on the local host are able to
7911 submit mail for relaying by sending it over TCP/IP to that interface. No other
7912 hosts are permitted to submit messages for relaying.
7915 Just to be sure there’s no misunderstanding: at this point in the configuration
7916 we aren’t actually setting up any controls. We are just defining some domains
7917 and hosts that will be used in the controls that are specified later.
7920 The next two configuration lines are genuine option settings:
7922 <literallayout class="monospaced">
7923 acl_smtp_rcpt = acl_check_rcpt
7924 acl_smtp_data = acl_check_data
7927 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
7928 during an incoming SMTP session for every recipient of a message (every RCPT
7929 command), and after the contents of the message have been received,
7930 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
7931 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
7932 section of the configuration. The RCPT ACL controls which recipients are
7933 accepted for an incoming message – if a configuration does not provide an ACL
7934 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
7935 contents of a message to be checked.
7938 Two commented-out option settings are next:
7940 <literallayout class="monospaced">
7941 # av_scanner = clamd:/tmp/clamd
7942 # spamd_address = 127.0.0.1 783
7945 These are example settings that can be used when Exim is compiled with the
7946 content-scanning extension. The first specifies the interface to the virus
7947 scanner, and the second specifies the interface to SpamAssassin. Further
7948 details are given in chapter <xref linkend="CHAPexiscan"/>.
7951 Three more commented-out option settings follow:
7953 <literallayout class="monospaced">
7954 # tls_advertise_hosts = *
7955 # tls_certificate = /etc/ssl/exim.crt
7956 # tls_privatekey = /etc/ssl/exim.pem
7959 These are example settings that can be used when Exim is compiled with
7960 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
7961 first one specifies the list of clients that are allowed to use TLS when
7962 connecting to this server; in this case the wildcard means all clients. The
7963 other options specify where Exim should find its TLS certificate and private
7964 key, which together prove the server’s identity to any clients that connect.
7965 More details are given in chapter <xref linkend="CHAPTLS"/>.
7968 Another two commented-out option settings follow:
7970 <literallayout class="monospaced">
7971 # daemon_smtp_ports = 25 : 465 : 587
7972 # tls_on_connect_ports = 465
7975 <indexterm role="concept">
7976 <primary>port</primary>
7977 <secondary>465 and 587</secondary>
7979 <indexterm role="concept">
7980 <primary>port</primary>
7981 <secondary>for message submission</secondary>
7983 <indexterm role="concept">
7984 <primary>message</primary>
7985 <secondary>submission, ports for</secondary>
7987 <indexterm role="concept">
7988 <primary>ssmtp protocol</primary>
7990 <indexterm role="concept">
7991 <primary>smtps protocol</primary>
7993 <indexterm role="concept">
7994 <primary>SMTP</primary>
7995 <secondary>ssmtp protocol</secondary>
7997 <indexterm role="concept">
7998 <primary>SMTP</primary>
7999 <secondary>smtps protocol</secondary>
8001 These options provide better support for roaming users who wish to use this
8002 server for message submission. They are not much use unless you have turned on
8003 TLS (as described in the previous paragraph) and authentication (about which
8004 more in section <xref linkend="SECTdefconfauth"/>). The usual SMTP port 25 is often blocked
8005 on end-user networks, so RFC 4409 specifies that message submission should use
8006 port 587 instead. However some software (notably Microsoft Outlook) cannot be
8007 configured to use port 587 correctly, so these settings also enable the
8008 non-standard <quote>smtps</quote> (aka <quote>ssmtp</quote>) port 465 (see section
8009 <xref linkend="SECTsupobssmt"/>).
8012 Two more commented-out options settings follow:
8014 <literallayout class="monospaced">
8016 # qualify_recipient =
8019 The first of these specifies a domain that Exim uses when it constructs a
8020 complete email address from a local login name. This is often needed when Exim
8021 receives a message from a local process. If you do not set <option>qualify_domain</option>,
8022 the value of <option>primary_hostname</option> is used. If you set both of these options,
8023 you can have different qualification domains for sender and recipient
8024 addresses. If you set only the first one, its value is used in both cases.
8027 <indexterm role="concept">
8028 <primary>domain literal</primary>
8029 <secondary>recognizing format</secondary>
8031 The following line must be uncommented if you want Exim to recognize
8032 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
8033 (an IP address within square brackets) instead of a named domain.
8035 <literallayout class="monospaced">
8036 # allow_domain_literals
8039 The RFCs still require this form, but many people think that in the modern
8040 Internet it makes little sense to permit mail to be sent to specific hosts by
8041 quoting their IP addresses. This ancient format has been used by people who
8042 try to abuse hosts by using them for unwanted relaying. However, some
8043 people believe there are circumstances (for example, messages addressed to
8044 <emphasis>postmaster</emphasis>) where domain literals are still useful.
8047 The next configuration line is a kind of trigger guard:
8049 <literallayout class="monospaced">
8053 It specifies that no delivery must ever be run as the root user. The normal
8054 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
8055 setting is a guard against slips in the configuration.
8056 The list of users specified by <option>never_users</option> is not, however, the complete
8057 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
8058 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
8059 contents of <option>never_users</option> are added to this list. By default
8060 FIXED_NEVER_USERS also specifies root.
8063 When a remote host connects to Exim in order to send mail, the only information
8064 Exim has about the host’s identity is its IP address. The next configuration
8067 <literallayout class="monospaced">
8071 specifies that Exim should do a reverse DNS lookup on all incoming connections,
8072 in order to get a host name. This improves the quality of the logging
8073 information, but if you feel it is too expensive, you can remove it entirely,
8074 or restrict the lookup to hosts on <quote>nearby</quote> networks.
8075 Note that it is not always possible to find a host name from an IP address,
8076 because not all DNS reverse zones are maintained, and sometimes DNS servers are
8080 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8081 1413 (hence their names):
8083 <literallayout class="monospaced">
8085 rfc1413_query_timeout = 5s
8088 These settings cause Exim to make ident callbacks for all incoming SMTP calls.
8089 You can limit the hosts to which these calls are made, or change the timeout
8090 that is used. If you set the timeout to zero, all ident calls are disabled.
8091 Although they are cheap and can provide useful information for tracing problem
8092 messages, some hosts and firewalls have problems with ident calls. This can
8093 result in a timeout instead of an immediate refused connection, leading to
8094 delays on starting up an incoming SMTP session.
8097 When Exim receives messages over SMTP connections, it expects all addresses to
8098 be fully qualified with a domain, as required by the SMTP definition. However,
8099 if you are running a server to which simple clients submit messages, you may
8100 find that they send unqualified addresses. The two commented-out options:
8102 <literallayout class="monospaced">
8103 # sender_unqualified_hosts =
8104 # recipient_unqualified_hosts =
8107 show how you can specify hosts that are permitted to send unqualified sender
8108 and recipient addresses, respectively.
8111 The <option>percent_hack_domains</option> option is also commented out:
8113 <literallayout class="monospaced">
8114 # percent_hack_domains =
8117 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8118 This is an almost obsolete form of explicit email routing. If you do not know
8119 anything about it, you can safely ignore this topic.
8122 The last two settings in the main part of the default configuration are
8123 concerned with messages that have been <quote>frozen</quote> on Exim’s queue. When a
8124 message is frozen, Exim no longer continues to try to deliver it. Freezing
8125 occurs when a bounce message encounters a permanent failure because the sender
8126 address of the original message that caused the bounce is invalid, so the
8127 bounce cannot be delivered. This is probably the most common case, but there
8128 are also other conditions that cause freezing, and frozen messages are not
8129 always bounce messages.
8131 <literallayout class="monospaced">
8132 ignore_bounce_errors_after = 2d
8133 timeout_frozen_after = 7d
8136 The first of these options specifies that failing bounce messages are to be
8137 discarded after 2 days on the queue. The second specifies that any frozen
8138 message (whether a bounce message or not) is to be timed out (and discarded)
8139 after a week. In this configuration, the first setting ensures that no failing
8140 bounce message ever lasts a week.
8144 <title>ACL configuration</title>
8146 <indexterm role="concept">
8147 <primary>default</primary>
8148 <secondary>ACLs</secondary>
8150 <indexterm role="concept">
8151 <primary>access control lists (ACLs)</primary>
8152 <secondary>default configuration</secondary>
8154 In the default configuration, the ACL section follows the main configuration.
8155 It starts with the line
8157 <literallayout class="monospaced">
8161 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
8162 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
8163 and <option>acl_smtp_data</option> above.
8166 <indexterm role="concept">
8167 <primary>RCPT</primary>
8168 <secondary>ACL for</secondary>
8170 The first ACL is used for every RCPT command in an incoming SMTP message. Each
8171 RCPT command specifies one of the message’s recipients. The ACL statements
8172 are considered in order, until the recipient address is either accepted or
8173 rejected. The RCPT command is then accepted or rejected, according to the
8174 result of the ACL processing.
8176 <literallayout class="monospaced">
8180 This line, consisting of a name terminated by a colon, marks the start of the
8183 <literallayout class="monospaced">
8187 This ACL statement accepts the recipient if the sending host matches the list.
8188 But what does that strange list mean? It doesn’t actually contain any host
8189 names or IP addresses. The presence of the colon puts an empty item in the
8190 list; Exim matches this only if the incoming message did not come from a remote
8191 host, because in that case, the remote hostname is empty. The colon is
8192 important. Without it, the list itself is empty, and can never match anything.
8195 What this statement is doing is to accept unconditionally all recipients in
8196 messages that are submitted by SMTP from local processes using the standard
8197 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8200 <literallayout class="monospaced">
8201 deny message = Restricted characters in address
8202 domains = +local_domains
8203 local_parts = ^[.] : ^.*[@%!/|]
8205 deny message = Restricted characters in address
8206 domains = !+local_domains
8207 local_parts = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8210 These statements are concerned with local parts that contain any of the
8211 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8212 Although these characters are entirely legal in local parts (in the case of
8213 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8214 in Internet mail addresses.
8217 The first three have in the past been associated with explicitly routed
8218 addresses (percent is still sometimes used – see the <option>percent_hack_domains</option>
8219 option). Addresses containing these characters are regularly tried by spammers
8220 in an attempt to bypass relaying restrictions, and also by open relay testing
8221 programs. Unless you really need them it is safest to reject these characters
8222 at this early stage. This configuration is heavy-handed in rejecting these
8223 characters for all messages it accepts from remote hosts. This is a deliberate
8224 policy of being as safe as possible.
8227 The first rule above is stricter, and is applied to messages that are addressed
8228 to one of the local domains handled by this host. This is implemented by the
8229 first condition, which restricts it to domains that are listed in the
8230 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8231 reference to a named list. In this configuration, there is just one domain in
8232 <emphasis>local_domains</emphasis>, but in general there may be many.
8235 The second condition on the first statement uses two regular expressions to
8236 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8237 or <quote>|</quote>. If you have local accounts that include these characters, you will
8238 have to modify this rule.
8241 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8242 allows them because they have been encountered in practice. (Consider the
8243 common convention of local parts constructed as
8244 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8245 the author of Exim, who has no second initial.) However, a local part starting
8246 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8247 file name (for example, for a mailing list). This is also true for local parts
8248 that contain slashes. A pipe symbol can also be troublesome if the local part
8249 is incorporated unthinkingly into a shell command line.
8252 The second rule above applies to all other domains, and is less strict. This
8253 allows your own users to send outgoing messages to sites that use slashes
8254 and vertical bars in their local parts. It blocks local parts that begin
8255 with a dot, slash, or vertical bar, but allows these characters within the
8256 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8257 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8258 (or your users’ viruses) from mounting certain kinds of attack on remote sites.
8260 <literallayout class="monospaced">
8261 accept local_parts = postmaster
8262 domains = +local_domains
8265 This statement, which has two conditions, accepts an incoming address if the
8266 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
8267 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8268 reference to a named list. In this configuration, there is just one domain in
8269 <emphasis>local_domains</emphasis>, but in general there may be many.
8272 The presence of this statement means that mail to postmaster is never blocked
8273 by any of the subsequent tests. This can be helpful while sorting out problems
8274 in cases where the subsequent tests are incorrectly denying access.
8276 <literallayout class="monospaced">
8277 require verify = sender
8280 This statement requires the sender address to be verified before any subsequent
8281 ACL statement can be used. If verification fails, the incoming recipient
8282 address is refused. Verification consists of trying to route the address, to
8283 see if a bounce message could be delivered to it. In the case of remote
8284 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
8285 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
8286 discusses the details of address verification.
8288 <literallayout class="monospaced">
8289 accept hosts = +relay_from_hosts
8290 control = submission
8293 This statement accepts the address if the message is coming from one of the
8294 hosts that are defined as being allowed to relay through this host. Recipient
8295 verification is omitted here, because in many cases the clients are dumb MUAs
8296 that do not cope well with SMTP error responses. For the same reason, the
8297 second line specifies <quote>submission mode</quote> for messages that are accepted. This
8298 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
8299 messages that are deficient in some way, for example, because they lack a
8300 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
8301 probably add recipient verification here, and disable submission mode.
8303 <literallayout class="monospaced">
8304 accept authenticated = *
8305 control = submission
8308 This statement accepts the address if the client host has authenticated itself.
8309 Submission mode is again specified, on the grounds that such messages are most
8310 likely to come from MUAs. The default configuration does not define any
8311 authenticators, though it does include some nearly complete commented-out
8312 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
8313 fact authenticate until you complete the authenticator definitions.
8315 <literallayout class="monospaced">
8316 require message = relay not permitted
8317 domains = +local_domains : +relay_domains
8320 This statement rejects the address if its domain is neither a local domain nor
8321 one of the domains for which this host is a relay.
8323 <literallayout class="monospaced">
8324 require verify = recipient
8327 This statement requires the recipient address to be verified; if verification
8328 fails, the address is rejected.
8330 <literallayout class="monospaced">
8331 # deny message = rejected because $sender_host_address \
8332 # is in a black list at $dnslist_domain\n\
8334 # dnslists = black.list.example
8336 # warn dnslists = black.list.example
8337 # add_header = X-Warning: $sender_host_address is in \
8338 # a black list at $dnslist_domain
8339 # log_message = found in $dnslist_domain
8342 These commented-out lines are examples of how you could configure Exim to check
8343 sending hosts against a DNS black list. The first statement rejects messages
8344 from blacklisted hosts, whereas the second just inserts a warning header
8347 <literallayout class="monospaced">
8348 # require verify = csa
8351 This commented-out line is an example of how you could turn on client SMTP
8352 authorization (CSA) checking. Such checks do DNS lookups for special SRV
8355 <literallayout class="monospaced">
8359 The final statement in the first ACL unconditionally accepts any recipient
8360 address that has successfully passed all the previous tests.
8362 <literallayout class="monospaced">
8366 This line marks the start of the second ACL, and names it. Most of the contents
8367 of this ACL are commented out:
8369 <literallayout class="monospaced">
8371 # message = This message contains a virus \
8375 These lines are examples of how to arrange for messages to be scanned for
8376 viruses when Exim has been compiled with the content-scanning extension, and a
8377 suitable virus scanner is installed. If the message is found to contain a
8378 virus, it is rejected with the given custom error message.
8380 <literallayout class="monospaced">
8381 # warn spam = nobody
8382 # message = X-Spam_score: $spam_score\n\
8383 # X-Spam_score_int: $spam_score_int\n\
8384 # X-Spam_bar: $spam_bar\n\
8385 # X-Spam_report: $spam_report
8388 These lines are an example of how to arrange for messages to be scanned by
8389 SpamAssassin when Exim has been compiled with the content-scanning extension,
8390 and SpamAssassin has been installed. The SpamAssassin check is run with
8391 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
8392 series of extra header line. In this case, the message is not rejected,
8393 whatever the spam score.
8395 <literallayout class="monospaced">
8399 This final line in the DATA ACL accepts the message unconditionally.
8403 <title>Router configuration</title>
8405 <indexterm role="concept">
8406 <primary>default</primary>
8407 <secondary>routers</secondary>
8409 <indexterm role="concept">
8410 <primary>routers</primary>
8411 <secondary>default</secondary>
8413 The router configuration comes next in the default configuration, introduced
8416 <literallayout class="monospaced">
8420 Routers are the modules in Exim that make decisions about where to send
8421 messages. An address is passed to each router in turn, until it is either
8422 accepted, or failed. This means that the order in which you define the routers
8423 matters. Each router is fully described in its own chapter later in this
8424 manual. Here we give only brief overviews.
8426 <literallayout class="monospaced">
8428 # driver = ipliteral
8429 # domains = !+local_domains
8430 # transport = remote_smtp
8433 <indexterm role="concept">
8434 <primary>domain literal</primary>
8435 <secondary>default router</secondary>
8437 This router is commented out because the majority of sites do not want to
8438 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
8439 you uncomment this router, you also need to uncomment the setting of
8440 <option>allow_domain_literals</option> in the main part of the configuration.
8442 <literallayout class="monospaced">
8445 domains = ! +local_domains
8446 transport = remote_smtp
8447 ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
8451 The first uncommented router handles addresses that do not involve any local
8452 domains. This is specified by the line
8454 <literallayout class="monospaced">
8455 domains = ! +local_domains
8458 The <option>domains</option> option lists the domains to which this router applies, but the
8459 exclamation mark is a negation sign, so the router is used only for domains
8460 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
8461 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
8462 indicates that it is referring to a named list. Addresses in other domains are
8463 passed on to the following routers.
8466 The name of the router driver is <command>dnslookup</command>,
8467 and is specified by the <option>driver</option> option. Do not be confused by the fact that
8468 the name of this router instance is the same as the name of the driver. The
8469 instance name is arbitrary, but the name set in the <option>driver</option> option must be
8470 one of the driver modules that is in the Exim binary.
8473 The <command>dnslookup</command> router routes addresses by looking up their domains in the
8474 DNS in order to obtain a list of hosts to which the address is routed. If the
8475 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
8476 specified by the <option>transport</option> option. If the router does not find the domain
8477 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
8478 the address fails and is bounced.
8481 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
8482 be entirely ignored. This option is present because a number of cases have been
8483 encountered where MX records in the DNS point to host names
8484 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
8485 Completely ignoring these IP addresses causes Exim to fail to route the
8486 email address, so it bounces. Otherwise, Exim would log a routing problem, and
8487 continue to try to deliver the message periodically until the address timed
8490 <literallayout class="monospaced">
8495 data = ${lookup{$local_part}lsearch{/etc/aliases}}
8497 file_transport = address_file
8498 pipe_transport = address_pipe
8501 Control reaches this and subsequent routers only for addresses in the local
8502 domains. This router checks to see whether the local part is defined as an
8503 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
8504 data that it looks up from that file. If no data is found for the local part,
8505 the value of the <option>data</option> option is empty, causing the address to be passed to
8509 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
8510 often used. That is why it is referenced by from the default configuration
8511 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
8512 <filename>Local/Makefile</filename> before building Exim.
8514 <literallayout class="monospaced">
8518 # local_part_suffix = +* : -*
8519 # local_part_suffix_optional
8520 file = $home/.forward
8525 file_transport = address_file
8526 pipe_transport = address_pipe
8527 reply_transport = address_reply
8530 This is the most complicated router in the default configuration. It is another
8531 redirection router, but this time it is looking for forwarding data set up by
8532 individual users. The <option>check_local_user</option> setting specifies a check that the
8533 local part of the address is the login name of a local user. If it is not, the
8534 router is skipped. The two commented options that follow <option>check_local_user</option>,
8537 <literallayout class="monospaced">
8538 # local_part_suffix = +* : -*
8539 # local_part_suffix_optional
8542 <indexterm role="concept">
8543 <primary><varname>$local_part_suffix</varname></primary>
8545 show how you can specify the recognition of local part suffixes. If the first
8546 is uncommented, a suffix beginning with either a plus or a minus sign, followed
8547 by any sequence of characters, is removed from the local part and placed in the
8548 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
8549 presence of a suffix in the local part is optional. When a suffix is present,
8550 the check for a local login uses the local part with the suffix removed.
8553 When a local user account is found, the file called <filename>.forward</filename> in the user’s
8554 home directory is consulted. If it does not exist, or is empty, the router
8555 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
8556 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
8559 <indexterm role="concept">
8560 <primary>Sieve filter</primary>
8561 <secondary>enabling in default router</secondary>
8563 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
8564 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
8565 is commented out by default), the contents of the file are interpreted as a set
8566 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
8567 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
8568 separate document entitled <emphasis>Exim’s interfaces to mail filtering</emphasis>.
8571 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
8572 verifying addresses, or when running as a consequence of an SMTP EXPN command.
8573 There are two reasons for doing this:
8575 <orderedlist numeration="arabic">
8578 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
8579 checking an address for validity; it makes sense not to waste resources doing
8585 More importantly, when Exim is verifying addresses or handling an EXPN
8586 command during an SMTP session, it is running as the Exim user, not as root.
8587 The group is the Exim group, and no additional groups are set up.
8588 It may therefore not be possible for Exim to read users’ <filename>.forward</filename> files at
8594 The setting of <option>check_ancestor</option> prevents the router from generating a new
8595 address that is the same as any previous address that was redirected. (This
8596 works round a problem concerning a bad interaction between aliasing and
8597 forwarding – see section <xref linkend="SECTredlocmai"/>).
8600 The final three option settings specify the transports that are to be used when
8601 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
8602 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
8604 <literallayout class="monospaced">
8605 a.nother@elsewhere.example, /home/spqr/archive
8608 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
8611 <literallayout class="monospaced">
8615 # local_part_suffix = +* : -*
8616 # local_part_suffix_optional
8617 transport = local_delivery
8620 The final router sets up delivery into local mailboxes, provided that the local
8621 part is the name of a local login, by accepting the address and assigning it to
8622 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
8623 routers, so the address is bounced. The commented suffix settings fulfil the
8624 same purpose as they do for the <command>userforward</command> router.
8628 <title>Transport configuration</title>
8630 <indexterm role="concept">
8631 <primary>default</primary>
8632 <secondary>transports</secondary>
8634 <indexterm role="concept">
8635 <primary>transports</primary>
8636 <secondary>default</secondary>
8638 Transports define mechanisms for actually delivering messages. They operate
8639 only when referenced from routers, so the order in which they are defined does
8640 not matter. The transports section of the configuration starts with
8642 <literallayout class="monospaced">
8646 One remote transport and four local transports are defined.
8648 <literallayout class="monospaced">
8653 This transport is used for delivering messages over SMTP connections. All its
8654 options are defaulted. The list of remote hosts comes from the router.
8656 <literallayout class="monospaced">
8659 file = /var/mail/$local_part
8667 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
8668 traditional BSD mailbox format. By default it runs under the uid and gid of the
8669 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
8670 directory. Some systems use the alternative approach of running mail deliveries
8671 under a particular group instead of using the sticky bit. The commented options
8672 show how this can be done.
8675 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
8676 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
8677 similarly-named options above.
8679 <literallayout class="monospaced">
8685 This transport is used for handling deliveries to pipes that are generated by
8686 redirection (aliasing or users’ <filename>.forward</filename> files). The <option>return_output</option>
8687 option specifies that any output generated by the pipe is to be returned to the
8690 <literallayout class="monospaced">
8698 This transport is used for handling deliveries to files that are generated by
8699 redirection. The name of the file is not specified in this instance of
8700 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
8702 <literallayout class="monospaced">
8707 This transport is used for handling automatic replies generated by users’
8712 <title>Default retry rule</title>
8714 <indexterm role="concept">
8715 <primary>retry</primary>
8716 <secondary>default rule</secondary>
8718 <indexterm role="concept">
8719 <primary>default</primary>
8720 <secondary>retry rule</secondary>
8722 The retry section of the configuration file contains rules which affect the way
8723 Exim retries deliveries that cannot be completed at the first attempt. It is
8724 introduced by the line
8726 <literallayout class="monospaced">
8730 In the default configuration, there is just one rule, which applies to all
8733 <literallayout class="monospaced">
8734 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
8737 This causes any temporarily failing address to be retried every 15 minutes for
8738 2 hours, then at intervals starting at one hour and increasing by a factor of
8739 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
8740 is not delivered after 4 days of temporary failure, it is bounced.
8744 <title>Rewriting configuration</title>
8746 The rewriting section of the configuration, introduced by
8748 <literallayout class="monospaced">
8752 contains rules for rewriting addresses in messages as they arrive. There are no
8753 rewriting rules in the default configuration file.
8756 <section id="SECTdefconfauth">
8757 <title>Authenticators configuration</title>
8759 <indexterm role="concept">
8760 <primary>AUTH</primary>
8761 <secondary>configuration</secondary>
8763 The authenticators section of the configuration, introduced by
8765 <literallayout class="monospaced">
8766 begin authenticators
8769 defines mechanisms for the use of the SMTP AUTH command. The default
8770 configuration file contains two commented-out example authenticators
8771 which support plaintext username/password authentication using the
8772 standard PLAIN mechanism and the traditional but non-standard LOGIN
8773 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
8774 to support most MUA software.
8777 The example PLAIN authenticator looks like this:
8779 <literallayout class="monospaced">
8781 # driver = plaintext
8782 # server_set_id = $auth2
8783 # server_prompts = :
8784 # server_condition = Authentication is not yet configured
8785 # server_advertise_condition = ${if def:tls_cipher }
8788 And the example LOGIN authenticator looks like this:
8790 <literallayout class="monospaced">
8792 # driver = plaintext
8793 # server_set_id = $auth1
8794 # server_prompts = <| Username: | Password:
8795 # server_condition = Authentication is not yet configured
8796 # server_advertise_condition = ${if def:tls_cipher }
8799 The <option>server_set_id</option> option makes Exim remember the authenticated username
8800 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
8801 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
8802 that it implements the details of the specific authentication mechanism,
8803 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
8804 when Exim offers authentication to clients; in the examples, this is only
8805 when TLS or SSL has been started, so to enable the authenticators you also
8806 need to add support for TLS as described in <xref linkend="SECTdefconfmain"/>.
8809 The <option>server_condition</option> setting defines how to verify that the username and
8810 password are correct. In the examples it just produces an error message.
8811 To make the authenticators work, you can use a string expansion
8812 expression like one of the examples in <xref linkend="CHAPplaintext"/>.
8815 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
8820 <chapter id="CHAPregexp">
8821 <title>Regular expressions</title>
8823 <indexterm role="concept">
8824 <primary>regular expressions</primary>
8825 <secondary>library</secondary>
8827 <indexterm role="concept">
8828 <primary>PCRE</primary>
8830 Exim supports the use of regular expressions in many of its options. It
8831 uses the PCRE regular expression library; this provides regular expression
8832 matching that is compatible with Perl 5. The syntax and semantics of
8833 regular expressions is discussed in many Perl reference books, and also in
8834 Jeffrey Friedl’s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
8835 O’Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
8838 The documentation for the syntax and semantics of the regular expressions that
8839 are supported by PCRE is included in plain text in the file
8840 <filename>doc/pcrepattern.txt</filename> in the Exim distribution, and also in the HTML
8841 tarbundle of Exim documentation. It describes in detail the features of the
8842 regular expressions that PCRE supports, so no further description is included
8843 here. The PCRE functions are called from Exim using the default option settings
8844 (that is, with no PCRE options set), except that the PCRE_CASELESS option is
8845 set when the matching is required to be case-insensitive.
8848 In most cases, when a regular expression is required in an Exim configuration,
8849 it has to start with a circumflex, in order to distinguish it from plain text
8850 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
8851 second item in the colon-separated list is a regular expression.
8853 <literallayout class="monospaced">
8854 domains = a.b.c : ^\\d{3} : *.y.z : ...
8857 The doubling of the backslash is required because of string expansion that
8858 precedes interpretation – see section <xref linkend="SECTlittext"/> for more discussion
8859 of this issue, and a way of avoiding the need for doubling backslashes. The
8860 regular expression that is eventually used in this example contains just one
8861 backslash. The circumflex is included in the regular expression, and has the
8862 normal effect of <quote>anchoring</quote> it to the start of the string that is being
8866 There are, however, two cases where a circumflex is not required for the
8867 recognition of a regular expression: these are the <option>match</option> condition in a
8868 string expansion, and the <option>matches</option> condition in an Exim filter file. In
8869 these cases, the relevant string is always treated as a regular expression; if
8870 it does not start with a circumflex, the expression is not anchored, and can
8871 match anywhere in the subject string.
8874 In all cases, if you want a regular expression to match at the end of a string,
8875 you must code the $ metacharacter to indicate this. For example:
8877 <literallayout class="monospaced">
8878 domains = ^\\d{3}\\.example
8881 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
8884 <literallayout class="monospaced">
8885 domains = ^\\d{3}\\.example\$
8888 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
8889 $ is needed because string expansion also interprets dollar characters.
8892 <title>Testing regular expressions</title>
8894 <indexterm role="concept">
8895 <primary>testing</primary>
8896 <secondary>regular expressions</secondary>
8898 <indexterm role="concept">
8899 <primary>regular expressions</primary>
8900 <secondary>testing</secondary>
8902 <indexterm role="concept">
8903 <primary><emphasis>pcretest</emphasis></primary>
8905 A program called <emphasis>pcretest</emphasis> forms part of the PCRE distribution and is built
8906 with PCRE during the process of building Exim. It is primarily intended for
8907 testing PCRE itself, but it can also be used for experimenting with regular
8908 expressions. After building Exim, the binary can be found in the build
8909 directory (it is not installed anywhere automatically). There is documentation
8910 of various options in <filename>doc/pcretest.txt</filename>, but for simple testing, none are
8911 needed. This is the output of a sample run of <emphasis>pcretest</emphasis>:
8914 <literal> re> </literal><emphasis role="bold"><literal>/^([@]+)@.+\.(ac|edu)\.(?!kr)[a-z]{2}$/</literal></emphasis>
8915 <literal>data> </literal><emphasis role="bold"><literal>x@y.ac.uk</literal></emphasis>
8916 <literal> 0: x@y.ac.uk</literal>
8917 <literal> 1: x</literal>
8918 <literal> 2: ac</literal>
8919 <literal>data> </literal><emphasis role="bold"><literal>x@y.ac.kr</literal></emphasis>
8920 <literal>No match</literal>
8921 <literal>data> </literal><emphasis role="bold"><literal>x@y.edu.com</literal></emphasis>
8922 <literal>No match</literal>
8923 <literal>data> </literal><emphasis role="bold"><literal>x@y.edu.co</literal></emphasis>
8924 <literal> 0: x@y.edu.co</literal>
8925 <literal> 1: x</literal>
8926 <literal> 2: edu</literal>
8929 Input typed by the user is shown in bold face. After the <quote>re></quote> prompt, a
8930 regular expression enclosed in delimiters is expected. If this compiles without
8931 error, <quote>data></quote> prompts are given for strings against which the expression is
8932 matched. An empty data line causes a new regular expression to be read. If the
8933 match is successful, the captured substring values (that is, what would be in
8934 the variables <varname>$0</varname>, <varname>$1</varname>, <varname>$2</varname>, etc.) are shown. The above example tests for
8935 an email address whose domain ends with either <quote>ac</quote> or <quote>edu</quote> followed by a
8936 two-character top-level domain that is not <quote>kr</quote>. The local part is captured
8937 in <varname>$1</varname> and the <quote>ac</quote> or <quote>edu</quote> in <varname>$2</varname>.
8942 <chapter id="CHAPfdlookup">
8943 <title>File and database lookups</title>
8945 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
8946 <primary>file</primary>
8947 <secondary>lookups</secondary>
8949 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
8950 <primary>database lookups</primary>
8952 <indexterm role="concept">
8953 <primary>lookup</primary>
8954 <secondary>description of</secondary>
8956 Exim can be configured to look up data in files or databases as it processes
8957 messages. Two different kinds of syntax are used:
8959 <orderedlist numeration="arabic">
8962 A string that is to be expanded may contain explicit lookup requests. These
8963 cause parts of the string to be replaced by data that is obtained from the
8964 lookup. Lookups of this type are conditional expansion items. Different results
8965 can be defined for the cases of lookup success and failure. See chapter
8966 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
8971 Lists of domains, hosts, and email addresses can contain lookup requests as a
8972 way of avoiding excessively long linear lists. In this case, the data that is
8973 returned by the lookup is often (but not always) discarded; whether the lookup
8974 succeeds or fails is what really counts. These kinds of list are described in
8975 chapter <xref linkend="CHAPdomhosaddlists"/>.
8980 String expansions, lists, and lookups interact with each other in such a way
8981 that there is no order in which to describe any one of them that does not
8982 involve references to the others. Each of these three chapters makes more sense
8983 if you have read the other two first. If you are reading this for the first
8984 time, be aware that some of it will make a lot more sense after you have read
8985 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
8988 <title>Examples of different lookup syntax</title>
8990 It is easy to confuse the two different kinds of lookup, especially as the
8991 lists that may contain the second kind are always expanded before being
8992 processed as lists. Therefore, they may also contain lookups of the first kind.
8993 Be careful to distinguish between the following two examples:
8995 <literallayout class="monospaced">
8996 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
8997 domains = lsearch;/some/file
9000 The first uses a string expansion, the result of which must be a domain list.
9001 No strings have been specified for a successful or a failing lookup; the
9002 defaults in this case are the looked-up data and an empty string, respectively.
9003 The expansion takes place before the string is processed as a list, and the
9004 file that is searched could contain lines like this:
9006 <literallayout class="monospaced">
9007 192.168.3.4: domain1:domain2:...
9008 192.168.1.9: domain3:domain4:...
9011 When the lookup succeeds, the result of the expansion is a list of domains (and
9012 possibly other types of item that are allowed in domain lists).
9015 In the second example, the lookup is a single item in a domain list. It causes
9016 Exim to use a lookup to see if the domain that is being processed can be found
9017 in the file. The file could contains lines like this:
9019 <literallayout class="monospaced">
9024 Any data that follows the keys is not relevant when checking that the domain
9025 matches the list item.
9028 It is possible, though no doubt confusing, to use both kinds of lookup at once.
9029 Consider a file containing lines like this:
9031 <literallayout class="monospaced">
9032 192.168.5.6: lsearch;/another/file
9035 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
9036 first <option>domains</option> setting above generates the second setting, which therefore
9037 causes a second lookup to occur.
9040 The rest of this chapter describes the different lookup types that are
9041 available. Any of them can be used in any part of the configuration where a
9042 lookup is permitted.
9046 <title>Lookup types</title>
9048 <indexterm role="concept">
9049 <primary>lookup</primary>
9050 <secondary>types of</secondary>
9052 <indexterm role="concept">
9053 <primary>single-key lookup</primary>
9054 <secondary>definition of</secondary>
9056 Two different types of data lookup are implemented:
9061 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
9062 and a single key to search for. The key must be a non-empty string for the
9063 lookup to succeed. The lookup type determines how the file is searched.
9068 <indexterm role="concept">
9069 <primary>query-style lookup</primary>
9070 <secondary>definition of</secondary>
9072 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
9073 key value is assumed by Exim for query-style lookups. You can use whichever
9074 Exim variables you need to construct the database query.
9079 The code for each lookup type is in a separate source file that is included in
9080 the binary of Exim only if the corresponding compile-time option is set. The
9081 default settings in <filename>src/EDITME</filename> are:
9083 <literallayout class="monospaced">
9088 which means that only linear searching and DBM lookups are included by default.
9089 For some types of lookup (e.g. SQL databases), you need to install appropriate
9090 libraries and header files before building Exim.
9093 <section id="SECTsinglekeylookups">
9094 <title>Single-key lookup types</title>
9096 <indexterm role="concept">
9097 <primary>lookup</primary>
9098 <secondary>single-key types</secondary>
9100 <indexterm role="concept">
9101 <primary>single-key lookup</primary>
9102 <secondary>list of types</secondary>
9104 The following single-key lookup types are implemented:
9109 <indexterm role="concept">
9110 <primary>cdb</primary>
9111 <secondary>description of</secondary>
9113 <indexterm role="concept">
9114 <primary>lookup</primary>
9115 <secondary>cdb</secondary>
9117 <indexterm role="concept">
9118 <primary>binary zero</primary>
9119 <secondary>in lookup key</secondary>
9121 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
9122 string without a terminating binary zero. The cdb format is designed for
9123 indexed files that are read frequently and never updated, except by total
9124 re-creation. As such, it is particulary suitable for large files containing
9125 aliases or other indexed data referenced by an MTA. Information about cdb can
9126 be found in several places:
9129 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>
9130 <emphasis role="bold"><ulink url="ftp://ftp.corpit.ru/pub/tinycdb/">ftp://ftp.corpit.ru/pub/tinycdb/</ulink></emphasis>
9131 <emphasis role="bold"><ulink url="http://packages.debian.org/stable/utils/freecdb.html">http://packages.debian.org/stable/utils/freecdb.html</ulink></emphasis>
9134 A cdb distribution is not needed in order to build Exim with cdb support,
9135 because the code for reading cdb files is included directly in Exim itself.
9136 However, no means of building or testing cdb files is provided with Exim, so
9137 you need to obtain a cdb distribution in order to do this.
9142 <indexterm role="concept">
9143 <primary>DBM</primary>
9144 <secondary>lookup type</secondary>
9146 <indexterm role="concept">
9147 <primary>lookup</primary>
9148 <secondary>dbm</secondary>
9150 <indexterm role="concept">
9151 <primary>binary zero</primary>
9152 <secondary>in lookup key</secondary>
9154 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
9155 DBM file by looking up the record with the given key. A terminating binary
9156 zero is included in the key that is passed to the DBM library. See section
9157 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
9160 <indexterm role="concept">
9161 <primary>Berkeley DB library</primary>
9162 <secondary>file format</secondary>
9164 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
9165 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
9166 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
9167 the DB_UNKNOWN option. This enables it to handle any of the types of database
9168 that the library supports, and can be useful for accessing DBM files created by
9169 other applications. (For earlier DB versions, DB_HASH is always used.)
9174 <indexterm role="concept">
9175 <primary>lookup</primary>
9176 <secondary>dbmnz</secondary>
9178 <indexterm role="concept">
9179 <primary>lookup</primary>
9180 <secondary>dbm – terminating zero</secondary>
9182 <indexterm role="concept">
9183 <primary>binary zero</primary>
9184 <secondary>in lookup key</secondary>
9186 <indexterm role="concept">
9187 <primary>Courier</primary>
9189 <indexterm role="concept">
9190 <primary><filename>/etc/userdbshadow.dat</filename></primary>
9192 <indexterm role="concept">
9193 <primary>dmbnz lookup type</primary>
9195 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
9196 is not included in the key that is passed to the DBM library. You may need this
9197 if you want to look up data in files that are created by or shared with some
9198 other application that does not use terminating zeros. For example, you need to
9199 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
9200 calls using the passwords from Courier’s <filename>/etc/userdbshadow.dat</filename> file. Exim’s
9201 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
9202 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
9207 <indexterm role="concept">
9208 <primary>lookup</primary>
9209 <secondary>dsearch</secondary>
9211 <indexterm role="concept">
9212 <primary>dsearch lookup type</primary>
9214 <command>dsearch</command>: The given file must be a directory; this is searched for a file
9215 whose name is the key. The key may not contain any forward slash characters.
9216 The result of a successful lookup is the name of the file. An example of how
9217 this lookup can be used to support virtual domains is given in section
9218 <xref linkend="SECTvirtualdomains"/>.
9223 <indexterm role="concept">
9224 <primary>lookup</primary>
9225 <secondary>iplsearch</secondary>
9227 <indexterm role="concept">
9228 <primary>iplsearch lookup type</primary>
9230 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
9231 terminated by a colon or white space or the end of the line. The keys in the
9232 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
9233 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
9234 being interpreted as a key terminator. For example:
9236 <literallayout class="monospaced">
9237 1.2.3.4: data for 1.2.3.4
9238 192.168.0.0/16 data for 192.168.0.0/16
9239 "abcd::cdab": data for abcd::cdab
9240 "abcd:abcd::/32" data for abcd:abcd::/32
9243 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
9244 file is searched linearly, using the CIDR masks where present, until a matching
9245 key is found. The first key that matches is used; there is no attempt to find a
9246 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
9247 <command>iplsearch</command> is the same as for <command>lsearch</command>.
9250 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
9251 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9252 lookup types support only literal keys.
9255 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
9256 the implicit key is the host’s IP address rather than its name (see section
9257 <xref linkend="SECThoslispatsikey"/>).
9262 <indexterm role="concept">
9263 <primary>linear search</primary>
9265 <indexterm role="concept">
9266 <primary>lookup</primary>
9267 <secondary>lsearch</secondary>
9269 <indexterm role="concept">
9270 <primary>lsearch lookup type</primary>
9272 <indexterm role="concept">
9273 <primary>case sensitivity</primary>
9274 <secondary>in lsearch lookup</secondary>
9276 <command>lsearch</command>: The given file is a text file that is searched linearly for a
9277 line beginning with the search key, terminated by a colon or white space or the
9278 end of the line. The search is case-insensitive; that is, upper and lower case
9279 letters are treated as the same. The first occurrence of the key that is found
9280 in the file is used.
9283 White space between the key and the colon is permitted. The remainder of the
9284 line, with leading and trailing white space removed, is the data. This can be
9285 continued onto subsequent lines by starting them with any amount of white
9286 space, but only a single space character is included in the data at such a
9287 junction. If the data begins with a colon, the key must be terminated by a
9290 <literallayout class="monospaced">
9294 Empty lines and lines beginning with # are ignored, even if they occur in the
9295 middle of an item. This is the traditional textual format of alias files. Note
9296 that the keys in an <command>lsearch</command> file are literal strings. There is no
9297 wildcarding of any kind.
9300 <indexterm role="concept">
9301 <primary>lookup</primary>
9302 <secondary>lsearch – colons in keys</secondary>
9304 <indexterm role="concept">
9305 <primary>white space</primary>
9306 <secondary>in lsearch key</secondary>
9308 In most <command>lsearch</command> files, keys are not required to contain colons or #
9309 characters, or white space. However, if you need this feature, it is available.
9310 If a key begins with a doublequote character, it is terminated only by a
9311 matching quote (or end of line), and the normal escaping rules apply to its
9312 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
9313 quoted keys (exactly as for unquoted keys). There is no special handling of
9314 quotes for the data part of an <command>lsearch</command> line.
9319 <indexterm role="concept">
9320 <primary>NIS lookup type</primary>
9322 <indexterm role="concept">
9323 <primary>lookup</primary>
9324 <secondary>NIS</secondary>
9326 <indexterm role="concept">
9327 <primary>binary zero</primary>
9328 <secondary>in lookup key</secondary>
9330 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
9331 the given key, without a terminating binary zero. There is a variant called
9332 <command>nis0</command> which does include the terminating binary zero in the key. This is
9333 reportedly needed for Sun-style alias files. Exim does not recognize NIS
9334 aliases; the full map names must be used.
9339 <indexterm role="concept">
9340 <primary>wildlsearch lookup type</primary>
9342 <indexterm role="concept">
9343 <primary>lookup</primary>
9344 <secondary>wildlsearch</secondary>
9346 <indexterm role="concept">
9347 <primary>nwildlsearch lookup type</primary>
9349 <indexterm role="concept">
9350 <primary>lookup</primary>
9351 <secondary>nwildlsearch</secondary>
9353 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
9354 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
9355 the file may be wildcarded. The difference between these two lookup types is
9356 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
9357 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
9360 <indexterm role="concept">
9361 <primary>case sensitivity</primary>
9362 <secondary>in (n)wildlsearch lookup</secondary>
9364 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
9365 file that are regular expressions can be made case-sensitive by the use of
9366 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
9368 <orderedlist numeration="arabic">
9371 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
9373 <literallayout class="monospaced">
9374 *.a.b.c data for anything.a.b.c
9375 *fish data for anythingfish
9380 The string may begin with a circumflex to indicate a regular expression. For
9381 example, for <command>wildlsearch</command>:
9383 <literallayout class="monospaced">
9384 ^\N\d+\.a\.b\N data for <digits>.a.b
9387 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
9388 expression. If you are using <command>nwildlsearch</command>, where the keys are not
9389 string-expanded, the equivalent entry is:
9391 <literallayout class="monospaced">
9392 ^\d+\.a\.b data for <digits>.a.b
9395 The case-insensitive flag is set at the start of compiling the regular
9396 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
9397 For example, to make the entire pattern case-sensitive:
9399 <literallayout class="monospaced">
9400 ^(?-i)\d+\.a\.b data for <digits>.a.b
9403 If the regular expression contains white space or colon characters, you must
9404 either quote it (see <command>lsearch</command> above), or represent these characters in other
9405 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
9406 colon. This may be easier than quoting, because if you quote, you have to
9407 escape all the backslashes inside the quotes.
9410 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
9411 match for later use, because the results of all lookups are cached. If a lookup
9412 is repeated, the result is taken from the cache, and no actual pattern matching
9413 takes place. The values of all the numeric variables are unset after a
9414 <command>(n)wildlsearch</command> match.
9419 Although I cannot see it being of much use, the general matching function that
9420 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
9421 lookup name terminated by a semicolon, and followed by lookup data. For
9424 <literallayout class="monospaced">
9425 cdb;/some/file data for keys that match the file
9428 The data that is obtained from the nested lookup is discarded.
9433 Keys that do not match any of these patterns are interpreted literally. The
9434 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
9435 be followed by optional colons.
9438 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
9439 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9440 lookup types support only literal keys.
9446 <title>Query-style lookup types</title>
9448 <indexterm role="concept">
9449 <primary>lookup</primary>
9450 <secondary>query-style types</secondary>
9452 <indexterm role="concept">
9453 <primary>query-style lookup</primary>
9454 <secondary>list of types</secondary>
9456 The supported query-style lookup types are listed below. Further details about
9457 many of them are given in later sections.
9462 <indexterm role="concept">
9463 <primary>DNS</primary>
9464 <secondary>as a lookup type</secondary>
9466 <indexterm role="concept">
9467 <primary>lookup</primary>
9468 <secondary>DNS</secondary>
9470 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
9471 are given in the supplied query. The resulting data is the contents of the
9472 records. See section <xref linkend="SECTdnsdb"/>.
9477 <indexterm role="concept">
9478 <primary>InterBase lookup type</primary>
9480 <indexterm role="concept">
9481 <primary>lookup</primary>
9482 <secondary>InterBase</secondary>
9484 <command>ibase</command>: This does a lookup in an InterBase database.
9489 <indexterm role="concept">
9490 <primary>LDAP</primary>
9491 <secondary>lookup type</secondary>
9493 <indexterm role="concept">
9494 <primary>lookup</primary>
9495 <secondary>LDAP</secondary>
9497 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
9498 returns attributes from a single entry. There is a variant called <command>ldapm</command>
9499 that permits values from multiple entries to be returned. A third variant
9500 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
9501 any attribute values. See section <xref linkend="SECTldap"/>.
9506 <indexterm role="concept">
9507 <primary>MySQL</primary>
9508 <secondary>lookup type</secondary>
9510 <indexterm role="concept">
9511 <primary>lookup</primary>
9512 <secondary>MySQL</secondary>
9514 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
9515 MySQL database. See section <xref linkend="SECTsql"/>.
9520 <indexterm role="concept">
9521 <primary>NIS+ lookup type</primary>
9523 <indexterm role="concept">
9524 <primary>lookup</primary>
9525 <secondary>NIS+</secondary>
9527 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
9528 the field to be returned. See section <xref linkend="SECTnisplus"/>.
9533 <indexterm role="concept">
9534 <primary>Oracle</primary>
9535 <secondary>lookup type</secondary>
9537 <indexterm role="concept">
9538 <primary>lookup</primary>
9539 <secondary>Oracle</secondary>
9541 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
9542 Oracle database. See section <xref linkend="SECTsql"/>.
9547 <indexterm role="concept">
9548 <primary>lookup</primary>
9549 <secondary>passwd</secondary>
9551 <indexterm role="concept">
9552 <primary>passwd lookup type</primary>
9554 <indexterm role="concept">
9555 <primary><filename>/etc/passwd</filename></primary>
9557 <command>passwd</command> is a query-style lookup with queries that are just user names. The
9558 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
9559 success, the result string is the same as you would get from an <command>lsearch</command>
9560 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
9561 password value. For example:
9563 <literallayout class="monospaced">
9564 *:42:42:King Rat:/home/kr:/bin/bash
9569 <indexterm role="concept">
9570 <primary>PostgreSQL lookup type</primary>
9572 <indexterm role="concept">
9573 <primary>lookup</primary>
9574 <secondary>PostgreSQL</secondary>
9576 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
9577 PostgreSQL database. See section <xref linkend="SECTsql"/>.
9582 <indexterm role="concept">
9583 <primary>sqlite lookup type</primary>
9585 <indexterm role="concept">
9586 <primary>lookup</primary>
9587 <secondary>sqlite</secondary>
9589 <command>sqlite</command>: The format of the query is a file name followed by an SQL statement
9590 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
9595 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
9596 not likely to be useful in normal operation.
9601 <indexterm role="concept">
9602 <primary>whoson lookup type</primary>
9604 <indexterm role="concept">
9605 <primary>lookup</primary>
9606 <secondary>whoson</secondary>
9608 <command>whoson</command>: <emphasis>Whoson</emphasis> (<emphasis role="bold"><ulink url="http://whoson.sourceforge.net">http://whoson.sourceforge.net</ulink></emphasis>) is a proposed
9609 Internet protocol that allows Internet server programs to check whether a
9610 particular (dynamically allocated) IP address is currently allocated to a known
9611 (trusted) user and, optionally, to obtain the identity of the said user. In
9612 Exim, this can be used to implement <quote>POP before SMTP</quote> checking using ACL
9615 <literallayout class="monospaced">
9616 require condition = \
9617 ${lookup whoson {$sender_host_address}{yes}{no}}
9620 The query consists of a single IP address. The value returned is the name of
9621 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
9622 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
9623 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
9629 <title>Temporary errors in lookups</title>
9631 <indexterm role="concept">
9632 <primary>lookup</primary>
9633 <secondary>temporary error in</secondary>
9635 Lookup functions can return temporary error codes if the lookup cannot be
9636 completed. For example, an SQL or LDAP database might be unavailable. For this
9637 reason, it is not advisable to use a lookup that might do this for critical
9638 options such as a list of local domains.
9641 When a lookup cannot be completed in a router or transport, delivery
9642 of the message (to the relevant address) is deferred, as for any other
9643 temporary error. In other circumstances Exim may assume the lookup has failed,
9644 or may give up altogether.
9647 <section id="SECTdefaultvaluelookups">
9648 <title>Default values in single-key lookups</title>
9650 <indexterm role="concept">
9651 <primary>wildcard lookups</primary>
9653 <indexterm role="concept">
9654 <primary>lookup</primary>
9655 <secondary>default values</secondary>
9657 <indexterm role="concept">
9658 <primary>lookup</primary>
9659 <secondary>wildcard</secondary>
9661 <indexterm role="concept">
9662 <primary>lookup</primary>
9663 <secondary>* added to type</secondary>
9665 <indexterm role="concept">
9666 <primary>default</primary>
9667 <secondary>in single-key lookups</secondary>
9669 In this context, a <quote>default value</quote> is a value specified by the administrator
9670 that is to be used if a lookup fails.
9672 <para revisionflag="changed">
9673 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
9674 lookups, the facilities of the query language must be used. An attempt to
9675 specify a default for a query-style lookup provokes an error.
9678 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
9679 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
9680 provide a default value. See also the section on partial matching below.
9683 <indexterm role="concept">
9684 <primary>*@ with single-key lookup</primary>
9686 <indexterm role="concept">
9687 <primary>lookup</primary>
9688 <secondary>*@ added to type</secondary>
9690 <indexterm role="concept">
9691 <primary>alias file</primary>
9692 <secondary>per-domain default</secondary>
9694 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
9695 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
9696 character, a second lookup is done with everything before the last @ replaced
9697 by *. This makes it possible to provide per-domain defaults in alias files
9698 that include the domains in the keys. If the second lookup fails (or doesn’t
9699 take place because there is no @ in the key), <quote>*</quote> is looked up.
9700 For example, a <command>redirect</command> router might contain:
9702 <literallayout class="monospaced">
9703 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
9706 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
9707 looks up these keys, in this order:
9709 <literallayout class="monospaced">
9715 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
9716 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
9717 complete scan is done for each key, and only if it is not found at all does
9718 Exim move on to try the next key.
9721 <section id="SECTpartiallookup">
9722 <title>Partial matching in single-key lookups</title>
9724 <indexterm role="concept">
9725 <primary>partial matching</primary>
9727 <indexterm role="concept">
9728 <primary>wildcard lookups</primary>
9730 <indexterm role="concept">
9731 <primary>lookup</primary>
9732 <secondary>partial matching</secondary>
9734 <indexterm role="concept">
9735 <primary>lookup</primary>
9736 <secondary>wildcard</secondary>
9738 <indexterm role="concept">
9739 <primary>asterisk</primary>
9740 <secondary>in search type</secondary>
9742 The normal operation of a single-key lookup is to search the file for an exact
9743 match with the given key. However, in a number of situations where domains are
9744 being looked up, it is useful to be able to do partial matching. In this case,
9745 information in the file that has a key starting with <quote>*.</quote> is matched by any
9746 domain that ends with the components that follow the full stop. For example, if
9747 a key in a DBM file is
9749 <literallayout class="monospaced">
9750 *.dates.fict.example
9753 then when partial matching is enabled this is matched by (amongst others)
9754 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
9755 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
9759 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
9760 also not available for any lookup items in address lists (see section
9761 <xref linkend="SECTaddresslist"/>).
9764 Partial matching is implemented by doing a series of separate lookups using
9765 keys constructed by modifying the original subject key. This means that it can
9766 be used with any of the single-key lookup types, provided that
9767 partial matching keys
9768 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
9769 Keys in the file that do not begin with the prefix are matched only by
9770 unmodified subject keys when partial matching is in use.
9773 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
9774 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
9775 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
9776 is added at the start of the subject key, and it is looked up again. If that
9777 fails, further lookups are tried with dot-separated components removed from the
9778 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
9782 A minimum number of two non-* components are required. This can be adjusted
9783 by including a number before the hyphen in the search type. For example,
9784 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
9785 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
9786 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
9787 up when the minimum number of non-* components is two:
9789 <literallayout class="monospaced">
9790 2250.dates.fict.example
9791 *.2250.dates.fict.example
9792 *.dates.fict.example
9796 As soon as one key in the sequence is successfully looked up, the lookup
9800 <indexterm role="concept">
9801 <primary>lookup</primary>
9802 <secondary>partial matching – changing prefix</secondary>
9804 <indexterm role="concept">
9805 <primary>prefix</primary>
9806 <secondary>for partial matching</secondary>
9808 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
9809 changed. The motivation for this feature is to allow Exim to operate with file
9810 formats that are used by other MTAs. A different prefix can be supplied in
9811 parentheses instead of the hyphen after <quote>partial</quote>. For example:
9813 <literallayout class="monospaced">
9814 domains = partial(.)lsearch;/some/file
9817 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9818 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
9819 components is unchanged). The prefix may consist of any punctuation characters
9820 other than a closing parenthesis. It may be empty, for example:
9822 <literallayout class="monospaced">
9823 domains = partial1()cdb;/some/file
9826 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9827 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
9830 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
9831 just one non-wild component has failed, and the original key is shortened right
9832 down to the null string) depends on the prefix:
9837 If the prefix has zero length, the whole lookup fails.
9842 If the prefix has length 1, a lookup for just the prefix is done. For
9843 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
9848 Otherwise, if the prefix ends in a dot, the dot is removed, and the
9849 remainder is looked up. With the default prefix, therefore, the final lookup is
9850 for <quote>*</quote> on its own.
9855 Otherwise, the whole prefix is looked up.
9860 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
9861 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
9862 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
9863 specified, adding <quote>*</quote> to the search type has no effect with the default
9864 prefix, because the <quote>*</quote> key is already included in the sequence of partial
9865 lookups. However, there might be a use for lookup types such as
9866 <quote>partial0(.)lsearch*</quote>.
9869 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
9870 in domain lists and the like. Partial matching works only in terms of
9871 dot-separated components; a key such as <literal>*fict.example</literal>
9872 in a database file is useless, because the asterisk in a partial matching
9873 subject key is always followed by a dot.
9877 <title>Lookup caching</title>
9879 <indexterm role="concept">
9880 <primary>lookup</primary>
9881 <secondary>caching</secondary>
9883 <indexterm role="concept">
9884 <primary>caching</primary>
9885 <secondary>lookup data</secondary>
9887 Exim caches all lookup results in order to avoid needless repetition of
9888 lookups. However, because (apart from the daemon) Exim operates as a collection
9889 of independent, short-lived processes, this caching applies only within a
9890 single Exim process. There is no inter-process lookup caching facility.
9893 For single-key lookups, Exim keeps the relevant files open in case there is
9894 another lookup that needs them. In some types of configuration this can lead to
9895 many files being kept open for messages with many recipients. To avoid hitting
9896 the operating system limit on the number of simultaneously open files, Exim
9897 closes the least recently used file when it needs to open more files than its
9898 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
9901 The single-key lookup files are closed and the lookup caches are flushed at
9902 strategic points during delivery – for example, after all routing is
9907 <title>Quoting lookup data</title>
9909 <indexterm role="concept">
9910 <primary>lookup</primary>
9911 <secondary>quoting</secondary>
9913 <indexterm role="concept">
9914 <primary>quoting</primary>
9915 <secondary>in lookups</secondary>
9917 When data from an incoming message is included in a query-style lookup, there
9918 is the possibility of special characters in the data messing up the syntax of
9919 the query. For example, a NIS+ query that contains
9921 <literallayout class="monospaced">
9925 will be broken if the local part happens to contain a closing square bracket.
9926 For NIS+, data can be enclosed in double quotes like this:
9928 <literallayout class="monospaced">
9929 [name="$local_part"]
9932 but this still leaves the problem of a double quote in the data. The rule for
9933 NIS+ is that double quotes must be doubled. Other lookup types have different
9934 rules, and to cope with the differing requirements, an expansion operator
9935 of the following form is provided:
9937 <literallayout class="monospaced">
9938 ${quote_<lookup-type>:<string>}
9941 For example, the safest way to write the NIS+ query is
9943 <literallayout class="monospaced">
9944 [name="${quote_nisplus:$local_part}"]
9947 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
9948 operator can be used for all lookup types, but has no effect for single-key
9949 lookups, since no quoting is ever needed in their key strings.
9952 <section id="SECTdnsdb">
9953 <title>More about dnsdb</title>
9955 <indexterm role="concept">
9956 <primary>dnsdb lookup</primary>
9958 <indexterm role="concept">
9959 <primary>lookup</primary>
9960 <secondary>dnsdb</secondary>
9962 <indexterm role="concept">
9963 <primary>DNS</primary>
9964 <secondary>as a lookup type</secondary>
9966 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
9967 of a record type and a domain name, separated by an equals sign. For example,
9968 an expansion string could contain:
9970 <literallayout class="monospaced">
9971 ${lookup dnsdb{mx=a.b.example}{$value}fail}
9974 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
9975 is used on its own as the result. If the lookup does not succeed, the
9976 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> – see section
9977 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
9980 The supported DNS record types are A, CNAME, MX, NS, PTR, SRV, and TXT, and,
9981 when Exim is compiled with IPv6 support, AAAA (and A6 if that is also
9982 configured). If no type is given, TXT is assumed. When the type is PTR,
9983 the data can be an IP address, written as normal; inversion and the addition of
9984 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
9986 <literallayout class="monospaced">
9987 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
9990 If the data for a PTR record is not a syntactically valid IP address, it is not
9991 altered and nothing is added.
9994 <indexterm role="concept">
9995 <primary>MX record</primary>
9996 <secondary>in <command>dnsdb</command> lookup</secondary>
9998 <indexterm role="concept">
9999 <primary>SRV record</primary>
10000 <secondary>in <command>dnsdb</command> lookup</secondary>
10002 For an MX lookup, both the preference value and the host name are returned for
10003 each record, separated by a space. For an SRV lookup, the priority, weight,
10004 port, and host name are returned for each record, separated by spaces.
10007 For any record type, if multiple records are found (or, for A6 lookups, if a
10008 single record leads to multiple addresses), the data is returned as a
10009 concatenation, with newline as the default separator. The order, of course,
10010 depends on the DNS resolver. You can specify a different separator character
10011 between multiple records by putting a right angle-bracket followed immediately
10012 by the new separator at the start of the query. For example:
10014 <literallayout class="monospaced">
10015 ${lookup dnsdb{>: a=host1.example}}
10018 It is permitted to specify a space as the separator character. Further
10019 white space is ignored.
10023 <title>Pseudo dnsdb record types</title>
10025 <indexterm role="concept">
10026 <primary>MX record</primary>
10027 <secondary>in <command>dnsdb</command> lookup</secondary>
10029 By default, both the preference value and the host name are returned for
10030 each MX record, separated by a space. If you want only host names, you can use
10031 the pseudo-type MXH:
10033 <literallayout class="monospaced">
10034 ${lookup dnsdb{mxh=a.b.example}}
10037 In this case, the preference values are omitted, and just the host names are
10041 <indexterm role="concept">
10042 <primary>name server</primary>
10043 <secondary>for enclosing domain</secondary>
10045 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
10046 records on the given domain, but if none are found, it removes the first
10047 component of the domain name, and tries again. This process continues until NS
10048 records are found or there are no more components left (or there is a DNS
10049 error). In other words, it may return the name servers for a top-level domain,
10050 but it never returns the root name servers. If there are no NS records for the
10051 top-level domain, the lookup fails. Consider these examples:
10053 <literallayout class="monospaced">
10054 ${lookup dnsdb{zns=xxx.quercite.com}}
10055 ${lookup dnsdb{zns=xxx.edu}}
10058 Assuming that in each case there are no NS records for the full domain name,
10059 the first returns the name servers for <option>quercite.com</option>, and the second returns
10060 the name servers for <option>edu</option>.
10063 You should be careful about how you use this lookup because, unless the
10064 top-level domain does not exist, the lookup always returns some host names. The
10065 sort of use to which this might be put is for seeing if the name servers for a
10066 given domain are on a blacklist. You can probably assume that the name servers
10067 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
10071 <indexterm role="concept">
10072 <primary>CSA</primary>
10073 <secondary>in <command>dnsdb</command> lookup</secondary>
10075 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
10076 records according to the CSA rules, which are described in section
10077 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
10078 not sufficient because of the extra parent domain search behaviour of CSA. The
10079 result of a successful lookup such as:
10081 <literallayout class="monospaced">
10082 ${lookup dnsdb {csa=$sender_helo_name}}
10085 has two space-separated fields: an authorization code and a target host name.
10086 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
10087 authorization required but absent, or <quote>?</quote> for unknown.
10091 <title>Multiple dnsdb lookups</title>
10093 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
10094 However, you can specify a list of domains or IP addresses in a single
10095 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
10096 the default separator, but with the ability to change this. For example:
10098 <literallayout class="monospaced">
10099 ${lookup dnsdb{one.domain.com:two.domain.com}}
10100 ${lookup dnsdb{a=one.host.com:two.host.com}}
10101 ${lookup dnsdb{ptr = <; 1.2.3.4 ; 4.5.6.8}}
10104 In order to retain backwards compatibility, there is one special case: if
10105 the lookup type is PTR and no change of separator is specified, Exim looks
10106 to see if the rest of the string is precisely one IPv6 address. In this
10107 case, it does not treat it as a list.
10110 The data from each lookup is concatenated, with newline separators by default,
10111 in the same way that multiple DNS records for a single item are handled. A
10112 different separator can be specified, as described above.
10115 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10116 temporary DNS error for any of them, the behaviour is controlled by
10117 an optional keyword followed by a comma that may appear before the record
10118 type. The possible keywords are <quote>defer_strict</quote>, <quote>defer_never</quote>, and
10119 <quote>defer_lax</quote>. With <quote>strict</quote> behaviour, any temporary DNS error causes the
10120 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10121 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10122 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10123 error causes the whole lookup to defer only if none of the other lookups
10124 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10126 <literallayout class="monospaced">
10127 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10128 ${lookup dnsdb{a=one.host.com:two.host.com}}
10131 Thus, in the default case, as long as at least one of the DNS lookups
10132 yields some data, the lookup succeeds.
10135 <section id="SECTldap">
10136 <title>More about LDAP</title>
10138 <indexterm role="concept">
10139 <primary>LDAP lookup</primary>
10141 <indexterm role="concept">
10142 <primary>lookup</primary>
10143 <secondary>LDAP</secondary>
10145 <indexterm role="concept">
10146 <primary>Solaris</primary>
10147 <secondary>LDAP</secondary>
10149 The original LDAP implementation came from the University of Michigan; this has
10150 become <quote>Open LDAP</quote>, and there are now two different releases. Another
10151 implementation comes from Netscape, and Solaris 7 and subsequent releases
10152 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
10153 the lookup function level, their error handling is different. For this reason
10154 it is necessary to set a compile-time variable when building Exim with LDAP, to
10155 indicate which LDAP library is in use. One of the following should appear in
10156 your <filename>Local/Makefile</filename>:
10158 <literallayout class="monospaced">
10159 LDAP_LIB_TYPE=UMICHIGAN
10160 LDAP_LIB_TYPE=OPENLDAP1
10161 LDAP_LIB_TYPE=OPENLDAP2
10162 LDAP_LIB_TYPE=NETSCAPE
10163 LDAP_LIB_TYPE=SOLARIS
10166 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
10167 same interface as the University of Michigan version.
10170 There are three LDAP lookup types in Exim. These behave slightly differently in
10171 the way they handle the results of a query:
10176 <command>ldap</command> requires the result to contain just one entry; if there are more, it
10182 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
10183 Distinguished Name that is returned rather than any attribute values.
10188 <command>ldapm</command> permits the result to contain more than one entry; the attributes
10189 from all of them are returned.
10194 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
10195 Exim behaves as if the entry did not exist, and the lookup fails. The format of
10196 the data returned by a successful lookup is described in the next section.
10197 First we explain how LDAP queries are coded.
10200 <section id="SECTforldaque">
10201 <title>Format of LDAP queries</title>
10203 <indexterm role="concept">
10204 <primary>LDAP</primary>
10205 <secondary>query format</secondary>
10207 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
10208 the configuration of a <command>redirect</command> router one might have this setting:
10210 <literallayout class="monospaced">
10211 data = ${lookup ldap \
10212 {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
10213 c=UK?mailbox?base?}}
10216 <indexterm role="concept">
10217 <primary>LDAP</primary>
10218 <secondary>with TLS</secondary>
10220 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
10221 secure (encrypted) LDAP connections. The second of these ensures that an
10222 encrypted TLS connection is used.
10226 <title>LDAP quoting</title>
10228 <indexterm role="concept">
10229 <primary>LDAP</primary>
10230 <secondary>quoting</secondary>
10232 Two levels of quoting are required in LDAP queries, the first for LDAP itself
10233 and the second because the LDAP query is represented as a URL. Furthermore,
10234 within an LDAP query, two different kinds of quoting are required. For this
10235 reason, there are two different LDAP-specific quoting operators.
10238 The <option>quote_ldap</option> operator is designed for use on strings that are part of
10239 filter specifications. Conceptually, it first does the following conversions on
10242 <literallayout class="monospaced">
10249 in accordance with RFC 2254. The resulting string is then quoted according
10250 to the rules for URLs, that is, all non-alphanumeric characters except
10252 <literallayout class="monospaced">
10253 ! $ ' - . _ ( ) * +
10256 are converted to their hex values, preceded by a percent sign. For example:
10258 <literallayout class="monospaced">
10259 ${quote_ldap: a(bc)*, a<yz>; }
10264 <literallayout class="monospaced">
10265 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
10268 Removing the URL quoting, this is (with a leading and a trailing space):
10270 <literallayout class="monospaced">
10271 a\28bc\29\2A, a<yz>;
10274 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
10275 base DN specifications in queries. Conceptually, it first converts the string
10276 by inserting a backslash in front of any of the following characters:
10278 <literallayout class="monospaced">
10279 , + " \ < > ;
10282 It also inserts a backslash before any leading spaces or # characters, and
10283 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
10284 is then quoted according to the rules for URLs. For example:
10286 <literallayout class="monospaced">
10287 ${quote_ldap_dn: a(bc)*, a<yz>; }
10292 <literallayout class="monospaced">
10293 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
10296 Removing the URL quoting, this is (with a trailing space):
10298 <literallayout class="monospaced">
10299 \ a(bc)*\, a\<yz\>\;\
10302 There are some further comments about quoting in the section on LDAP
10303 authentication below.
10307 <title>LDAP connections</title>
10309 <indexterm role="concept">
10310 <primary>LDAP</primary>
10311 <secondary>connections</secondary>
10313 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
10314 is in use, via a Unix domain socket. The example given above does not specify
10315 an LDAP server. A server that is reached by TCP/IP can be specified in a query
10316 by starting it with
10318 <literallayout class="monospaced">
10319 ldap://<hostname>:<port>/...
10322 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
10323 used. When no server is specified in a query, a list of default servers is
10324 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
10325 colon-separated list of servers which are tried in turn until one successfully
10326 handles a query, or there is a serious error. Successful handling either
10327 returns the requested data, or indicates that it does not exist. Serious errors
10328 are syntactical, or multiple values when only a single value is expected.
10329 Errors which cause the next server to be tried are connection failures, bind
10330 failures, and timeouts.
10333 For each server name in the list, a port number can be given. The standard way
10334 of specifing a host and port is to use a colon separator (RFC 1738). Because
10335 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
10336 doubled. For example
10338 <literallayout class="monospaced">
10339 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
10342 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
10343 to the LDAP library with no server name, and the library’s default (normally
10344 the local host) is used.
10347 If you are using the OpenLDAP library, you can connect to an LDAP server using
10348 a Unix domain socket instead of a TCP/IP connection. This is specified by using
10349 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
10350 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
10354 For this type of connection, instead of a host name for the server, a pathname
10355 for the socket is required, and the port number is not relevant. The pathname
10356 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
10357 the query. In the former case, you can have settings such as
10359 <literallayout class="monospaced">
10360 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
10363 When the pathname is given in the query, you have to escape the slashes as
10364 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
10366 <literallayout class="monospaced">
10367 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
10370 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
10371 a pathname, it uses the Unix domain socket code, even if the query actually
10372 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
10373 socket connection. This behaviour means that you can use a setting of
10374 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
10375 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
10376 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
10380 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
10381 specified, an error is diagnosed. However, if there are more items in
10382 <option>ldap_default_servers</option>, they are tried. In other words:
10387 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
10393 Using <literal>ldapi</literal> with a host name causes an error.
10398 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
10399 <option>ldap_default_servers</option>, does whatever the library does by default.
10403 <title>LDAP authentication and control information</title>
10405 <indexterm role="concept">
10406 <primary>LDAP</primary>
10407 <secondary>authentication</secondary>
10409 The LDAP URL syntax provides no way of passing authentication and other control
10410 information to the server. To make this possible, the URL in an LDAP query may
10411 be preceded by any number of <<emphasis>name</emphasis>>=<<emphasis>value</emphasis>> settings, separated by
10412 spaces. If a value contains spaces it must be enclosed in double quotes, and
10413 when double quotes are used, backslash is interpreted in the usual way inside
10414 them. The following names are recognized:
10417 <literal>DEREFERENCE</literal> set the dereferencing parameter
10418 <literal>NETTIME </literal> set a timeout for a network operation
10419 <literal>USER </literal> set the DN, for authenticating the LDAP bind
10420 <literal>PASS </literal> set the password, likewise
10421 <literal>REFERRALS </literal> set the referrals parameter
10422 <literal>SIZE </literal> set the limit for the number of entries returned
10423 <literal>TIME </literal> set the maximum waiting time for a query
10426 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
10427 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
10428 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
10429 library from trying to follow referrals issued by the LDAP server.
10432 The name CONNECT is an obsolete name for NETTIME, retained for
10433 backwards compatibility. This timeout (specified as a number of seconds) is
10434 enforced from the client end for operations that can be carried out over a
10435 network. Specifically, it applies to network connections and calls to the
10436 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
10437 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
10438 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
10439 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
10440 Netscape SDK; for OpenLDAP no action is taken.
10443 The TIME parameter (also a number of seconds) is passed to the server to
10444 set a server-side limit on the time taken to complete a search.
10447 Here is an example of an LDAP query in an Exim lookup that uses some of these
10448 values. This is a single line, folded to fit on the page:
10450 <literallayout class="monospaced">
10452 {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
10453 ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
10457 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
10458 any of the auxiliary data. Exim configuration settings that include lookups
10459 which contain password information should be preceded by <quote>hide</quote> to prevent
10460 non-admin users from using the <option>-bP</option> option to see their values.
10463 The auxiliary data items may be given in any order. The default is no
10464 connection timeout (the system timeout is used), no user or password, no limit
10465 on the number of entries returned, and no time limit on queries.
10468 When a DN is quoted in the USER= setting for LDAP authentication, Exim
10469 removes any URL quoting that it may contain before passing it LDAP. Apparently
10470 some libraries do this for themselves, but some do not. Removing the URL
10471 quoting has two advantages:
10476 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
10477 DNs as with DNs inside actual queries.
10482 It permits spaces inside USER= DNs.
10487 For example, a setting such as
10489 <literallayout class="monospaced">
10490 USER=cn=${quote_ldap_dn:$1}
10493 should work even if <varname>$1</varname> contains spaces.
10496 Expanded data for the PASS= value should be quoted using the <option>quote</option>
10497 expansion operator, rather than the LDAP quote operators. The only reason this
10498 field needs quoting is to ensure that it conforms to the Exim syntax, which
10499 does not allow unquoted spaces. For example:
10501 <literallayout class="monospaced">
10505 The LDAP authentication mechanism can be used to check passwords as part of
10506 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
10507 <xref linkend="CHAPexpand"/>.
10511 <title>Format of data returned by LDAP</title>
10513 <indexterm role="concept">
10514 <primary>LDAP</primary>
10515 <secondary>returned data formats</secondary>
10517 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
10518 as a sequence of values, for example
10520 <literallayout class="monospaced">
10521 cn=manager, o=University of Cambridge, c=UK
10524 The <command>ldap</command> lookup type generates an error if more than one entry matches the
10525 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
10526 the result between the data from different entries. It is possible for multiple
10527 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
10528 you know that whatever values are returned all came from a single entry in the
10532 In the common case where you specify a single attribute in your LDAP query, the
10533 result is not quoted, and does not contain the attribute name. If the attribute
10534 has multiple values, they are separated by commas.
10537 If you specify multiple attributes, the result contains space-separated, quoted
10538 strings, each preceded by the attribute name and an equals sign. Within the
10539 quotes, the quote character, backslash, and newline are escaped with
10540 backslashes, and commas are used to separate multiple values for the attribute.
10541 Apart from the escaping, the string within quotes takes the same form as the
10542 output when a single attribute is requested. Specifying no attributes is the
10543 same as specifying all of an entry’s attributes.
10546 Here are some examples of the output format. The first line of each pair is an
10547 LDAP query, and the second is the data that is returned. The attribute called
10548 <option>attr1</option> has two values, whereas <option>attr2</option> has only one value:
10550 <literallayout class="monospaced">
10551 ldap:///o=base?attr1?sub?(uid=fred)
10554 ldap:///o=base?attr2?sub?(uid=fred)
10557 ldap:///o=base?attr1,attr2?sub?(uid=fred)
10558 attr1="value1.1, value1.2" attr2="value two"
10560 ldap:///o=base??sub?(uid=fred)
10561 objectClass="top" attr1="value1.1, value1.2" attr2="value two"
10564 The <option>extract</option> operator in string expansions can be used to pick out
10565 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs. You can
10566 make use of Exim’s <option>-be</option> option to run expansion tests and thereby check the
10567 results of LDAP lookups.
10570 <section id="SECTnisplus">
10571 <title>More about NIS+</title>
10573 <indexterm role="concept">
10574 <primary>NIS+ lookup type</primary>
10576 <indexterm role="concept">
10577 <primary>lookup</primary>
10578 <secondary>NIS+</secondary>
10580 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
10581 and field name. If this is given, the result of a successful query is the
10582 contents of the named field; otherwise the result consists of a concatenation
10583 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
10584 values containing spaces are quoted. For example, the query
10586 <literallayout class="monospaced">
10587 [name=mg1456],passwd.org_dir
10590 might return the string
10592 <literallayout class="monospaced">
10593 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
10594 home=/home/mg1456 shell=/bin/bash shadow=""
10597 (split over two lines here to fit on the page), whereas
10599 <literallayout class="monospaced">
10600 [name=mg1456],passwd.org_dir:gcos
10605 <literallayout class="monospaced">
10609 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
10610 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
10611 operator is to double any quote characters within the text.
10614 <section id="SECTsql">
10615 <title>SQL lookups</title>
10617 <indexterm role="concept">
10618 <primary>SQL lookup types</primary>
10620 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, and SQLite
10621 databases. Queries for these databases contain SQL statements, so an example
10624 <literallayout class="monospaced">
10625 ${lookup mysql{select mailbox from users where id='userx'}\
10629 If the result of the query contains more than one field, the data for each
10630 field in the row is returned, preceded by its name, so the result of
10632 <literallayout class="monospaced">
10633 ${lookup pgsql{select home,name from users where id='userx'}\
10639 <literallayout class="monospaced">
10640 home=/home/userx name="Mister X"
10643 Empty values and values containing spaces are double quoted, with embedded
10644 quotes escaped by a backslash. If the result of the query contains just one
10645 field, the value is passed back verbatim, without a field name, for example:
10647 <literallayout class="monospaced">
10651 If the result of the query yields more than one row, it is all concatenated,
10652 with a newline between the data for each row.
10656 <title>More about MySQL, PostgreSQL, Oracle, and InterBase</title>
10658 <indexterm role="concept">
10659 <primary>MySQL</primary>
10660 <secondary>lookup type</secondary>
10662 <indexterm role="concept">
10663 <primary>PostgreSQL lookup type</primary>
10665 <indexterm role="concept">
10666 <primary>lookup</primary>
10667 <secondary>MySQL</secondary>
10669 <indexterm role="concept">
10670 <primary>lookup</primary>
10671 <secondary>PostgreSQL</secondary>
10673 <indexterm role="concept">
10674 <primary>Oracle</primary>
10675 <secondary>lookup type</secondary>
10677 <indexterm role="concept">
10678 <primary>lookup</primary>
10679 <secondary>Oracle</secondary>
10681 <indexterm role="concept">
10682 <primary>InterBase lookup type</primary>
10684 <indexterm role="concept">
10685 <primary>lookup</primary>
10686 <secondary>InterBase</secondary>
10688 If any MySQL, PostgreSQL, Oracle, or InterBase lookups are used, the
10689 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, or <option>ibase_servers</option>
10690 option (as appropriate) must be set to a colon-separated list of server
10691 information. Each item in the list is a slash-separated list of four items:
10692 host name, database name, user name, and password. In the case of Oracle, the
10693 host name field is used for the <quote>service name</quote>, and the database name field
10694 is not used and should be empty. For example:
10696 <literallayout class="monospaced">
10697 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
10700 Because password data is sensitive, you should always precede the setting with
10701 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
10702 option. Here is an example where two MySQL servers are listed:
10704 <literallayout class="monospaced">
10705 hide mysql_servers = localhost/users/root/secret:\
10706 otherhost/users/root/othersecret
10709 For MySQL and PostgreSQL, a host may be specified as <<emphasis>name</emphasis>>:<<emphasis>port</emphasis>> but
10710 because this is a colon-separated list, the colon has to be doubled. For each
10711 query, these parameter groups are tried in order until a connection and a query
10715 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
10716 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
10717 respectively, and the characters single-quote, double-quote, and backslash
10718 itself are escaped with backslashes. The <option>quote_pgsql</option> expansion operator, in
10719 addition, escapes the percent and underscore characters. This cannot be done
10720 for MySQL because these escapes are not recognized in contexts where these
10721 characters are not special.
10725 <title>Special MySQL features</title>
10727 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
10728 causes a connection to the server on the local host by means of a Unix domain
10729 socket. An alternate socket can be specified in parentheses. The full syntax of
10730 each item in <option>mysql_servers</option> is:
10733 <<emphasis>hostname</emphasis>>::<<emphasis>port</emphasis>>(<<emphasis>socket name</emphasis>>)/<<emphasis>database</emphasis>>/<<emphasis>user</emphasis>>/<<emphasis>password</emphasis>>
10736 Any of the three sub-parts of the first field can be omitted. For normal use on
10737 the local host it can be left blank or set to just <quote>localhost</quote>.
10740 No database need be supplied – but if it is absent here, it must be given in
10744 If a MySQL query is issued that does not request any data (an insert, update,
10745 or delete command), the result of the lookup is the number of rows affected.
10748 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
10749 anything (for example, setting a field to the value it already has), the result
10750 is zero because no rows are affected.
10754 <title>Special PostgreSQL features</title>
10756 PostgreSQL lookups can also use Unix domain socket connections to the database.
10757 This is usually faster and costs less CPU time than a TCP/IP connection.
10758 However it can be used only if the mail server runs on the same machine as the
10759 database server. A configuration line for PostgreSQL via Unix domain sockets
10762 <literallayout class="monospaced">
10763 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
10766 In other words, instead of supplying a host name, a path to the socket is
10767 given. The path name is enclosed in parentheses so that its slashes aren’t
10768 visually confused with the delimiters for the other server parameters.
10771 If a PostgreSQL query is issued that does not request any data (an insert,
10772 update, or delete command), the result of the lookup is the number of rows
10776 <section id="SECTsqlite">
10777 <title>More about SQLite</title>
10779 <indexterm role="concept">
10780 <primary>lookup</primary>
10781 <secondary>SQLite</secondary>
10783 <indexterm role="concept">
10784 <primary>SQLite lookup type</primary>
10786 SQLite is different to the other SQL lookups because a file name is required in
10787 addition to the SQL query. An SQLite database is a single file, and there is no
10788 daemon as in the other SQL databases. The interface to Exim requires the name
10789 of the file, as an absolute path, to be given at the start of the query. It is
10790 separated from the query by white space. This means that the path name cannot
10791 contain white space. Here is a lookup expansion example:
10793 <literallayout class="monospaced">
10794 ${lookup sqlite {/some/thing/sqlitedb \
10795 select name from aliases where id='userx';}}
10798 In a list, the syntax is similar. For example:
10800 <literallayout class="monospaced">
10801 domainlist relay_domains = sqlite;/some/thing/sqlitedb \
10802 select * from relays where ip='$sender_host_address';
10805 The only character affected by the <option>quote_sqlite</option> operator is a single
10806 quote, which it doubles.
10809 The SQLite library handles multiple simultaneous accesses to the database
10810 internally. Multiple readers are permitted, but only one process can
10811 update at once. Attempts to access the database while it is being updated
10812 are rejected after a timeout period, during which the SQLite library
10813 waits for the lock to be released. In Exim, the default timeout is set
10814 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
10816 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
10817 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
10822 <chapter id="CHAPdomhosaddlists">
10823 <title>Domain, host, address, and local part lists</title>
10824 <titleabbrev>Domain, host, and address lists</titleabbrev>
10826 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
10827 <primary>lists of domains; hosts; etc.</primary>
10829 A number of Exim configuration options contain lists of domains, hosts,
10830 email addresses, or local parts. For example, the <option>hold_domains</option> option
10831 contains a list of domains whose delivery is currently suspended. These lists
10832 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
10833 arguments to expansion conditions such as <option>match_domain</option>.
10836 Each item in one of these lists is a pattern to be matched against a domain,
10837 host, email address, or local part, respectively. In the sections below, the
10838 different types of pattern for each case are described, but first we cover some
10839 general facilities that apply to all four kinds of list.
10842 <title>Expansion of lists</title>
10844 <indexterm role="concept">
10845 <primary>expansion</primary>
10846 <secondary>of lists</secondary>
10848 Each list is expanded as a single string before it is used. The result of
10849 expansion must be a list, possibly containing empty items, which is split up
10850 into separate items for matching. By default, colon is the separator character,
10851 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
10852 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
10853 discusses the way to specify empty list items.
10856 If the string expansion is forced to fail, Exim behaves as if the item it is
10857 testing (domain, host, address, or local part) is not in the list. Other
10858 expansion failures cause temporary errors.
10861 If an item in a list is a regular expression, backslashes, dollars and possibly
10862 other special characters in the expression must be protected against
10863 misinterpretation by the string expander. The easiest way to do this is to use
10864 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
10865 expression should not be expanded. For example, in an ACL you might have:
10867 <literallayout class="monospaced">
10868 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
10869 ${lookup{$domain}lsearch{/badsenders/bydomain}}
10872 The first item is a regular expression that is protected from expansion by
10873 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
10874 senders based on the receiving domain.
10878 <title>Negated items in lists</title>
10880 <indexterm role="concept">
10881 <primary>list</primary>
10882 <secondary>negation</secondary>
10884 <indexterm role="concept">
10885 <primary>negation</primary>
10886 <secondary>in lists</secondary>
10888 Items in a list may be positive or negative. Negative items are indicated by a
10889 leading exclamation mark, which may be followed by optional white space. A list
10890 defines a set of items (domains, etc). When Exim processes one of these lists,
10891 it is trying to find out whether a domain, host, address, or local part
10892 (respectively) is in the set that is defined by the list. It works like this:
10895 The list is scanned from left to right. If a positive item is matched, the
10896 subject that is being checked is in the set; if a negative item is matched, the
10897 subject is not in the set. If the end of the list is reached without the
10898 subject having matched any of the patterns, it is in the set if the last item
10899 was a negative one, but not if it was a positive one. For example, the list in
10901 <literallayout class="monospaced">
10902 domainlist relay_domains = !a.b.c : *.b.c
10905 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
10906 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
10907 list is positive. However, if the setting were
10909 <literallayout class="monospaced">
10910 domainlist relay_domains = !a.b.c
10913 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
10914 list is negative. In other words, a list that ends with a negative item behaves
10915 as if it had an extra item <literal>:*</literal> on the end.
10918 Another way of thinking about positive and negative items in lists is to read
10919 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
10923 <section id="SECTfilnamlis">
10924 <title>File names in lists</title>
10926 <indexterm role="concept">
10927 <primary>list</primary>
10928 <secondary>file name in</secondary>
10930 If an item in a domain, host, address, or local part list is an absolute file
10931 name (beginning with a slash character), each line of the file is read and
10932 processed as if it were an independent item in the list, except that further
10933 file names are not allowed,
10934 and no expansion of the data from the file takes place.
10935 Empty lines in the file are ignored, and the file may also contain comment
10941 For domain and host lists, if a # character appears anywhere in a line of the
10942 file, it and all following characters are ignored.
10947 Because local parts may legitimately contain # characters, a comment in an
10948 address list or local part list file is recognized only if # is preceded by
10949 white space or the start of the line. For example:
10951 <literallayout class="monospaced">
10952 not#comment@x.y.z # but this is a comment
10957 Putting a file name in a list has the same effect as inserting each line of the
10958 file as an item in the list (blank lines and comments excepted). However, there
10959 is one important difference: the file is read each time the list is processed,
10960 so if its contents vary over time, Exim’s behaviour changes.
10963 If a file name is preceded by an exclamation mark, the sense of any match
10964 within the file is inverted. For example, if
10966 <literallayout class="monospaced">
10967 hold_domains = !/etc/nohold-domains
10970 and the file contains the lines
10972 <literallayout class="monospaced">
10977 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
10978 any domain matching <literal>*.b.c</literal> is not.
10982 <title>An lsearch file is not an out-of-line list</title>
10984 As will be described in the sections that follow, lookups can be used in lists
10985 to provide indexed methods of checking list membership. There has been some
10986 confusion about the way <command>lsearch</command> lookups work in lists. Because
10987 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
10988 sometimes thought that it is allowed to contain wild cards and other kinds of
10989 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
10990 always fixed strings, just as for any other single-key lookup type.
10993 If you want to use a file to contain wild-card patterns that form part of a
10994 list, just give the file name on its own, without a search type, as described
10995 in the previous section. You could also use the <command>wildlsearch</command> or
10996 <command>nwildlsearch</command>, but there is no advantage in doing this.
10999 <section id="SECTnamedlists">
11000 <title>Named lists</title>
11002 <indexterm role="concept">
11003 <primary>named lists</primary>
11005 <indexterm role="concept">
11006 <primary>list</primary>
11007 <secondary>named</secondary>
11009 A list of domains, hosts, email addresses, or local parts can be given a name
11010 which is then used to refer to the list elsewhere in the configuration. This is
11011 particularly convenient if the same list is required in several different
11012 places. It also allows lists to be given meaningful names, which can improve
11013 the readability of the configuration. For example, it is conventional to define
11014 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
11015 locally on a host, using a configuration line such as
11017 <literallayout class="monospaced">
11018 domainlist local_domains = localhost:my.dom.example
11021 Named lists are referenced by giving their name preceded by a plus sign, so,
11022 for example, a router that is intended to handle local domains would be
11023 configured with the line
11025 <literallayout class="monospaced">
11026 domains = +local_domains
11029 The first router in a configuration is often one that handles all domains
11030 except the local ones, using a configuration with a negated item like this:
11032 <literallayout class="monospaced">
11035 domains = ! +local_domains
11036 transport = remote_smtp
11040 The four kinds of named list are created by configuration lines starting with
11041 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
11042 respectively. Then there follows the name that you are defining, followed by an
11043 equals sign and the list itself. For example:
11045 <literallayout class="monospaced">
11046 hostlist relay_hosts = 192.168.23.0/24 : my.friend.example
11047 addresslist bad_senders = cdb;/etc/badsenders
11050 A named list may refer to other named lists:
11052 <literallayout class="monospaced">
11053 domainlist dom1 = first.example : second.example
11054 domainlist dom2 = +dom1 : third.example
11055 domainlist dom3 = fourth.example : +dom2 : fifth.example
11058 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
11059 effect may not be what you intended, because the negation does not propagate
11060 out to the higher level. For example, consider:
11062 <literallayout class="monospaced">
11063 domainlist dom1 = !a.b
11064 domainlist dom2 = +dom1 : *.b
11067 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
11068 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
11069 means it matches the second list as well. The effect is not the same as
11071 <literallayout class="monospaced">
11072 domainlist dom2 = !a.b : *.b
11075 where <emphasis>x.y</emphasis> does not match. It’s best to avoid negation altogether in
11076 referenced lists if you can.
11079 Named lists may have a performance advantage. When Exim is routing an
11080 address or checking an incoming message, it caches the result of tests on named
11081 lists. So, if you have a setting such as
11083 <literallayout class="monospaced">
11084 domains = +local_domains
11087 on several of your routers
11088 or in several ACL statements,
11089 the actual test is done only for the first one. However, the caching works only
11090 if there are no expansions within the list itself or any sublists that it
11091 references. In other words, caching happens only for lists that are known to be
11092 the same each time they are referenced.
11095 By default, there may be up to 16 named lists of each type. This limit can be
11096 extended by changing a compile-time variable. The use of domain and host lists
11097 is recommended for concepts such as local domains, relay domains, and relay
11098 hosts. The default configuration is set up like this.
11102 <title>Named lists compared with macros</title>
11104 <indexterm role="concept">
11105 <primary>list</primary>
11106 <secondary>named compared with macro</secondary>
11108 <indexterm role="concept">
11109 <primary>macro</primary>
11110 <secondary>compared with named list</secondary>
11112 At first sight, named lists might seem to be no different from macros in the
11113 configuration file. However, macros are just textual substitutions. If you
11116 <literallayout class="monospaced">
11117 ALIST = host1 : host2
11118 auth_advertise_hosts = !ALIST
11121 it probably won’t do what you want, because that is exactly the same as
11123 <literallayout class="monospaced">
11124 auth_advertise_hosts = !host1 : host2
11127 Notice that the second host name is not negated. However, if you use a host
11130 <literallayout class="monospaced">
11131 hostlist alist = host1 : host2
11132 auth_advertise_hosts = ! +alist
11135 the negation applies to the whole list, and so that is equivalent to
11137 <literallayout class="monospaced">
11138 auth_advertise_hosts = !host1 : !host2
11142 <title>Named list caching</title>
11144 <indexterm role="concept">
11145 <primary>list</primary>
11146 <secondary>caching of named</secondary>
11148 <indexterm role="concept">
11149 <primary>caching</primary>
11150 <secondary>named lists</secondary>
11152 While processing a message, Exim caches the result of checking a named list if
11153 it is sure that the list is the same each time. In practice, this means that
11154 the cache operates only if the list contains no $ characters, which guarantees
11155 that it will not change when it is expanded. Sometimes, however, you may have
11156 an expanded list that you know will be the same each time within a given
11157 message. For example:
11159 <literallayout class="monospaced">
11160 domainlist special_domains = \
11161 ${lookup{$sender_host_address}cdb{/some/file}}
11164 This provides a list of domains that depends only on the sending host’s IP
11165 address. If this domain list is referenced a number of times (for example,
11166 in several ACL lines, or in several routers) the result of the check is not
11167 cached by default, because Exim does not know that it is going to be the
11168 same list each time.
11171 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
11172 cache the result anyway. For example:
11174 <literallayout class="monospaced">
11175 domainlist_cache special_domains = ${lookup{...
11178 If you do this, you should be absolutely sure that caching is going to do
11179 the right thing in all cases. When in doubt, leave it out.
11182 <section id="SECTdomainlist">
11183 <title>Domain lists</title>
11185 <indexterm role="concept">
11186 <primary>domain list</primary>
11187 <secondary>patterns for</secondary>
11189 <indexterm role="concept">
11190 <primary>list</primary>
11191 <secondary>domain list</secondary>
11193 Domain lists contain patterns that are to be matched against a mail domain.
11194 The following types of item may appear in domain lists:
11199 <indexterm role="concept">
11200 <primary>primary host name</primary>
11202 <indexterm role="concept">
11203 <primary>host name</primary>
11204 <secondary>matched in domain list</secondary>
11206 <indexterm role="concept">
11207 <primary><option>primary_hostname</option></primary>
11209 <indexterm role="concept">
11210 <primary>domain list</primary>
11211 <secondary>matching primary host name</secondary>
11213 <indexterm role="concept">
11214 <primary>@ in a domain list</primary>
11216 If a pattern consists of a single @ character, it matches the local host name,
11217 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
11218 possible to use the same configuration file on several different hosts that
11219 differ only in their names.
11224 <indexterm role="concept">
11225 <primary>@[] in a domain list</primary>
11227 <indexterm role="concept">
11228 <primary>domain list</primary>
11229 <secondary>matching local IP interfaces</secondary>
11231 <indexterm role="concept">
11232 <primary>domain literal</primary>
11234 If a pattern consists of the string <literal>@[]</literal> it matches any local IP interface
11235 address, enclosed in square brackets, as in an email address that contains a
11237 In today’s Internet, the use of domain literals is controversial.
11242 <indexterm role="concept">
11243 <primary>@mx_any</primary>
11245 <indexterm role="concept">
11246 <primary>@mx_primary</primary>
11248 <indexterm role="concept">
11249 <primary>@mx_secondary</primary>
11251 <indexterm role="concept">
11252 <primary>domain list</primary>
11253 <secondary>matching MX pointers to local host</secondary>
11255 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
11256 has an MX record pointing to the local host or to any host that is listed in
11257 <indexterm role="concept">
11258 <primary><option>hosts_treat_as_local</option></primary>
11260 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
11261 are similar, except that the first matches only when a primary MX target is the
11262 local host, and the second only when no primary MX target is the local host,
11263 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
11264 preference value – there may of course be more than one of them.
11267 The MX lookup that takes place when matching a pattern of this type is
11268 performed with the resolver options for widening names turned off. Thus, for
11269 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
11270 resolver’s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
11271 options of the <command>dnslookup</command> router for a discussion of domain widening.
11274 Sometimes you may want to ignore certain IP addresses when using one of these
11275 patterns. You can specify this by following the pattern with <literal>/ignore=</literal><<emphasis>ip
11276 list</emphasis>>, where <<emphasis>ip list</emphasis>> is a list of IP addresses. These addresses are
11277 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
11278 on a router). For example:
11280 <literallayout class="monospaced">
11281 domains = @mx_any/ignore=127.0.0.1
11284 This example matches any domain that has an MX record pointing to one of
11285 the local host’s IP addresses other than 127.0.0.1.
11288 The list of IP addresses is in fact processed by the same code that processes
11289 host lists, so it may contain CIDR-coded network specifications and it may also
11290 contain negative items.
11293 Because the list of IP addresses is a sublist within a domain list, you have to
11294 be careful about delimiters if there is more than one address. Like any other
11295 list, the default delimiter can be changed. Thus, you might have:
11297 <literallayout class="monospaced">
11298 domains = @mx_any/ignore=<;127.0.0.1;0.0.0.0 : \
11299 an.other.domain : ...
11302 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
11303 involved, it is easiest to change the delimiter for the main list as well:
11305 <literallayout class="monospaced">
11306 domains = <? @mx_any/ignore=<;127.0.0.1;::1 ? \
11307 an.other.domain ? ...
11312 <indexterm role="concept">
11313 <primary>asterisk</primary>
11314 <secondary>in domain list</secondary>
11316 <indexterm role="concept">
11317 <primary>domain list</primary>
11318 <secondary>asterisk in</secondary>
11320 <indexterm role="concept">
11321 <primary>domain list</primary>
11322 <secondary>matching <quote>ends with</quote></secondary>
11324 If a pattern starts with an asterisk, the remaining characters of the pattern
11325 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
11326 domain lists differs from its use in partial matching lookups. In a domain
11327 list, the character following the asterisk need not be a dot, whereas partial
11328 matching works only in terms of dot-separated components. For example, a domain
11329 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
11330 <emphasis>cipher.key.ex</emphasis>.
11335 <indexterm role="concept">
11336 <primary>regular expressions</primary>
11337 <secondary>in domain list</secondary>
11339 <indexterm role="concept">
11340 <primary>domain list</primary>
11341 <secondary>matching regular expression</secondary>
11343 If a pattern starts with a circumflex character, it is treated as a regular
11344 expression, and matched against the domain using a regular expression matching
11345 function. The circumflex is treated as part of the regular expression.
11346 References to descriptions of the syntax of regular expressions are given in
11347 chapter <xref linkend="CHAPregexp"/>.
11350 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
11351 must escape any backslash and dollar characters in the regular expression, or
11352 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
11353 it is not to be expanded (unless you really do want to build a regular
11354 expression by expansion, of course).
11359 <indexterm role="concept">
11360 <primary>lookup</primary>
11361 <secondary>in domain list</secondary>
11363 <indexterm role="concept">
11364 <primary>domain list</primary>
11365 <secondary>matching by lookup</secondary>
11367 If a pattern starts with the name of a single-key lookup type followed by a
11368 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
11369 must be a file name in a suitable format for the lookup type. For example, for
11370 <quote>cdb;</quote> it must be an absolute path:
11372 <literallayout class="monospaced">
11373 domains = cdb;/etc/mail/local_domains.cdb
11376 The appropriate type of lookup is done on the file using the domain name as the
11377 key. In most cases, the data that is looked up is not used; Exim is interested
11378 only in whether or not the key is present in the file. However, when a lookup
11379 is used for the <option>domains</option> option on a router
11380 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
11381 <varname>$domain_data</varname> variable and can be referred to in other router options or
11382 other statements in the same ACL.
11387 Any of the single-key lookup type names may be preceded by
11388 <literal>partial</literal><<emphasis>n</emphasis>><literal>-</literal>, where the <<emphasis>n</emphasis>> is optional, for example,
11390 <literallayout class="monospaced">
11391 domains = partial-dbm;/partial/domains
11394 This causes partial matching logic to be invoked; a description of how this
11395 works is given in section <xref linkend="SECTpartiallookup"/>.
11400 <indexterm role="concept">
11401 <primary>asterisk</primary>
11402 <secondary>in lookup type</secondary>
11404 Any of the single-key lookup types may be followed by an asterisk. This causes
11405 a default lookup for a key consisting of a single asterisk to be done if the
11406 original lookup fails. This is not a useful feature when using a domain list to
11407 select particular domains (because any domain would match), but it might have
11408 value if the result of the lookup is being used via the <varname>$domain_data</varname>
11409 expansion variable.
11414 If the pattern starts with the name of a query-style lookup type followed by a
11415 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
11416 pattern must be an appropriate query for the lookup type, as described in
11417 chapter <xref linkend="CHAPfdlookup"/>. For example:
11419 <literallayout class="monospaced">
11420 hold_domains = mysql;select domain from holdlist \
11421 where domain = '$domain';
11424 In most cases, the data that is looked up is not used (so for an SQL query, for
11425 example, it doesn’t matter what field you select). Exim is interested only in
11426 whether or not the query succeeds. However, when a lookup is used for the
11427 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
11428 variable and can be referred to in other options.
11433 <indexterm role="concept">
11434 <primary>domain list</primary>
11435 <secondary>matching literal domain name</secondary>
11437 If none of the above cases apply, a caseless textual comparison is made
11438 between the pattern and the domain.
11443 Here is an example that uses several different kinds of pattern:
11445 <literallayout class="monospaced">
11446 domainlist funny_domains = \
11449 *.foundation.fict.example : \
11450 \N^[1-2]\d{3}\.fict\.example$\N : \
11451 partial-dbm;/opt/data/penguin/book : \
11452 nis;domains.byname : \
11453 nisplus;[name=$domain,status=local],domains.org_dir
11456 There are obvious processing trade-offs among the various matching modes. Using
11457 an asterisk is faster than a regular expression, and listing a few names
11458 explicitly probably is too. The use of a file or database lookup is expensive,
11459 but may be the only option if hundreds of names are required. Because the
11460 patterns are tested in order, it makes sense to put the most commonly matched
11464 <section id="SECThostlist">
11465 <title>Host lists</title>
11467 <indexterm role="concept">
11468 <primary>host list</primary>
11469 <secondary>patterns in</secondary>
11471 <indexterm role="concept">
11472 <primary>list</primary>
11473 <secondary>host list</secondary>
11475 Host lists are used to control what remote hosts are allowed to do. For
11476 example, some hosts may be allowed to use the local host as a relay, and some
11477 may be permitted to use the SMTP ETRN command. Hosts can be identified in
11478 two different ways, by name or by IP address. In a host list, some types of
11479 pattern are matched to a host name, and some are matched to an IP address.
11480 You need to be particularly careful with this when single-key lookups are
11481 involved, to ensure that the right value is being used as the key.
11485 <title>Special host list patterns</title>
11487 <indexterm role="concept">
11488 <primary>empty item in hosts list</primary>
11490 <indexterm role="concept">
11491 <primary>host list</primary>
11492 <secondary>empty string in</secondary>
11494 If a host list item is the empty string, it matches only when no remote host is
11495 involved. This is the case when a message is being received from a local
11496 process using SMTP on the standard input, that is, when a TCP/IP connection is
11500 <indexterm role="concept">
11501 <primary>asterisk</primary>
11502 <secondary>in host list</secondary>
11504 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
11505 the IP address nor the name is actually inspected.
11508 <section id="SECThoslispatip">
11509 <title>Host list patterns that match by IP address</title>
11511 <indexterm role="concept">
11512 <primary>host list</primary>
11513 <secondary>matching IP addresses</secondary>
11515 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
11516 the incoming address actually appears in the IPv6 host as
11517 <literal>::ffff:</literal><<emphasis>v4address</emphasis>>. When such an address is tested against a host
11518 list, it is converted into a traditional IPv4 address first. (Not all operating
11519 systems accept IPv4 calls on IPv6 sockets, as there have been some security
11523 The following types of pattern in a host list check the remote host by
11524 inspecting its IP address:
11529 If the pattern is a plain domain name (not a regular expression, not starting
11530 with *, not a lookup of any kind), Exim calls the operating system function
11531 to find the associated IP address(es). Exim uses the newer
11532 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
11533 This typically causes a forward DNS lookup of the name. The result is compared
11534 with the IP address of the subject host.
11537 If there is a temporary problem (such as a DNS timeout) with the host name
11538 lookup, a temporary error occurs. For example, if the list is being used in an
11539 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
11540 temporary SMTP error code. If no IP address can be found for the host name,
11541 what happens is described in section <xref linkend="SECTbehipnot"/> below.
11546 <indexterm role="concept">
11547 <primary>@ in a host list</primary>
11549 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
11550 domain name, as just described.
11555 If the pattern is an IP address, it is matched against the IP address of the
11556 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
11557 IPv6 addresses can be given in colon-separated format, but the colons have to
11558 be doubled so as not to be taken as item separators when the default list
11559 separator is used. IPv6 addresses are recognized even when Exim is compiled
11560 without IPv6 support. This means that if they appear in a host list on an
11561 IPv4-only host, Exim will not treat them as host names. They are just addresses
11562 that can never match a client host.
11567 <indexterm role="concept">
11568 <primary>@[] in a host list</primary>
11570 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
11571 the local host. For example, if the local host is an IPv4 host with one
11572 interface address 10.45.23.56, these two ACL statements have the same effect:
11574 <literallayout class="monospaced">
11575 accept hosts = 127.0.0.1 : 10.45.23.56
11581 <indexterm role="concept">
11582 <primary>CIDR notation</primary>
11584 If the pattern is an IP address followed by a slash and a mask length (for
11585 example 10.11.42.0/24), it is matched against the IP address of the subject
11586 host under the given mask. This allows, an entire network of hosts to be
11587 included (or excluded) by a single item. The mask uses CIDR notation; it
11588 specifies the number of address bits that must match, starting from the most
11589 significant end of the address.
11592 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
11593 of a range of addresses. It is the number of bits in the network portion of the
11594 address. The above example specifies a 24-bit netmask, so it matches all 256
11595 addresses in the 10.11.42.0 network. An item such as
11597 <literallayout class="monospaced">
11601 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
11602 32 for an IPv4 address is the same as no mask at all; just a single address
11606 Here is another example which shows an IPv4 and an IPv6 network:
11608 <literallayout class="monospaced">
11609 recipient_unqualified_hosts = 192.168.0.0/16: \
11610 3ffe::ffff::836f::::/48
11613 The doubling of list separator characters applies only when these items
11614 appear inline in a host list. It is not required when indirecting via a file.
11617 <literallayout class="monospaced">
11618 recipient_unqualified_hosts = /opt/exim/unqualnets
11621 could make use of a file containing
11623 <literallayout class="monospaced">
11625 3ffe:ffff:836f::/48
11628 to have exactly the same effect as the previous example. When listing IPv6
11629 addresses inline, it is usually more convenient to use the facility for
11630 changing separator characters. This list contains the same two networks:
11632 <literallayout class="monospaced">
11633 recipient_unqualified_hosts = <; 172.16.0.0/12; \
11634 3ffe:ffff:836f::/48
11637 The separator is changed to semicolon by the leading <quote><;</quote> at the start of the
11643 <section id="SECThoslispatsikey">
11644 <title>Host list patterns for single-key lookups by host address</title>
11646 <indexterm role="concept">
11647 <primary>host list</primary>
11648 <secondary>lookup of IP address</secondary>
11650 When a host is to be identified by a single-key lookup of its complete IP
11651 address, the pattern takes this form:
11654 <literal>net-<</literal><emphasis>single-key-search-type</emphasis><literal>>;<</literal><emphasis>search-data</emphasis><literal>></literal>
11659 <literallayout class="monospaced">
11660 hosts_lookup = net-cdb;/hosts-by-ip.db
11663 The text form of the IP address of the subject host is used as the lookup key.
11664 IPv6 addresses are converted to an unabbreviated form, using lower case
11665 letters, with dots as separators because colon is the key terminator in
11666 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
11667 quoting the keys, but this is a facility that was added later.] The data
11668 returned by the lookup is not used.
11671 <indexterm role="concept">
11672 <primary>IP address</primary>
11673 <secondary>masking</secondary>
11675 <indexterm role="concept">
11676 <primary>host list</primary>
11677 <secondary>masked IP address</secondary>
11679 Single-key lookups can also be performed using masked IP addresses, using
11680 patterns of this form:
11683 <literal>net<</literal><emphasis>number</emphasis><literal>>-<</literal><emphasis>single-key-search-type</emphasis><literal>>;<</literal><emphasis>search-data</emphasis><literal>></literal>
11688 <literallayout class="monospaced">
11689 net24-dbm;/networks.db
11692 The IP address of the subject host is masked using <<emphasis>number</emphasis>> as the mask
11693 length. A textual string is constructed from the masked value, followed by the
11694 mask, and this is used as the lookup key. For example, if the host’s IP address
11695 is 192.168.34.6, the key that is looked up for the above example is
11696 <quote>192.168.34.0/24</quote>. IPv6 addresses are converted to a text value using lower
11697 case letters and dots as separators instead of the more usual colon, because
11698 colon is the key terminator in <command>lsearch</command> files. Full, unabbreviated IPv6
11699 addresses are always used.
11702 <emphasis role="bold">Warning</emphasis>: Specifing <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
11703 IPv6 address) is not the same as specifing just <option>net-</option> without a number. In
11704 the former case the key strings include the mask value, whereas in the latter
11705 case the IP address is used on its own.
11708 <section id="SECThoslispatnam">
11709 <title>Host list patterns that match by host name</title>
11711 <indexterm role="concept">
11712 <primary>host</primary>
11713 <secondary>lookup failures</secondary>
11715 <indexterm role="concept">
11716 <primary>unknown host name</primary>
11718 <indexterm role="concept">
11719 <primary>host list</primary>
11720 <secondary>matching host name</secondary>
11722 There are several types of pattern that require Exim to know the name of the
11723 remote host. These are either wildcard patterns or lookups by name. (If a
11724 complete hostname is given without any wildcarding, it is used to find an IP
11725 address to match against, as described in the section <xref linkend="SECThoslispatip"/>
11729 If the remote host name is not already known when Exim encounters one of these
11730 patterns, it has to be found from the IP address.
11731 Although many sites on the Internet are conscientious about maintaining reverse
11732 DNS data for their hosts, there are also many that do not do this.
11733 Consequently, a name cannot always be found, and this may lead to unwanted
11734 effects. Take care when configuring host lists with wildcarded name patterns.
11735 Consider what will happen if a name cannot be found.
11738 Because of the problems of determining host names from IP addresses, matching
11739 against host names is not as common as matching against IP addresses.
11742 By default, in order to find a host name, Exim first does a reverse DNS lookup;
11743 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
11744 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
11745 are done can be changed by setting the <option>host_lookup_order</option> option.
11748 There are some options that control what happens if a host name cannot be
11749 found. These are described in section <xref linkend="SECTbehipnot"/> below.
11752 <indexterm role="concept">
11753 <primary>host</primary>
11754 <secondary>alias for</secondary>
11756 <indexterm role="concept">
11757 <primary>alias for host</primary>
11759 As a result of aliasing, hosts may have more than one name. When processing any
11760 of the following types of pattern, all the host’s names are checked:
11765 <indexterm role="concept">
11766 <primary>asterisk</primary>
11767 <secondary>in host list</secondary>
11769 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
11770 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
11771 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
11772 requirement. Other kinds of wildcarding require the use of a regular
11778 <indexterm role="concept">
11779 <primary>regular expressions</primary>
11780 <secondary>in host list</secondary>
11782 <indexterm role="concept">
11783 <primary>host list</primary>
11784 <secondary>regular expression in</secondary>
11786 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
11787 matched against the host name. For example,
11789 <literallayout class="monospaced">
11793 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
11794 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
11795 that backslash and dollar characters are not misinterpreted as part of the
11796 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
11797 part of the string as non-expandable. For example:
11799 <literallayout class="monospaced">
11800 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
11803 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
11804 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
11805 example. Without it, a match at the start of the host name is all that is
11811 <section id="SECTbehipnot">
11812 <title>Behaviour when an IP address or name cannot be found</title>
11814 <indexterm role="concept">
11815 <primary>host</primary>
11816 <secondary>lookup failures</secondary>
11818 While processing a host list, Exim may need to look up an IP address from a
11819 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
11820 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
11821 behaviour when it fails to find the information it is seeking is the same.
11824 <indexterm role="concept">
11825 <primary><literal>+include_unknown</literal></primary>
11827 <indexterm role="concept">
11828 <primary><literal>+ignore_unknown</literal></primary>
11830 By default, Exim behaves as if the host does not match the list. This may not
11831 always be what you want to happen. To change Exim’s behaviour, the special
11832 items <literal>+include_unknown</literal> or <literal>+ignore_unknown</literal> may appear in the list (at
11833 top level – they are not recognized in an indirected file).
11838 If any item that follows <literal>+include_unknown</literal> requires information that
11839 cannot found, Exim behaves as if the host does match the list. For example,
11841 <literallayout class="monospaced">
11842 host_reject_connection = +include_unknown:*.enemy.ex
11845 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
11846 any hosts whose name it cannot find.
11851 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
11852 be found, Exim ignores that item and proceeds to the rest of the list. For
11855 <literallayout class="monospaced">
11856 accept hosts = +ignore_unknown : friend.example : \
11860 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
11861 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
11862 name can be found for 192.168.4.5, it is rejected.
11867 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
11868 list. The effect of each one lasts until the next, or until the end of the
11872 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
11873 apply to temporary DNS errors. They always cause a defer action (except when
11874 <option>dns_again_means_nonexist</option> converts them into permanent errors).
11877 <section id="SECThoslispatnamsk">
11878 <title>Host list patterns for single-key lookups by host name</title>
11880 <indexterm role="concept">
11881 <primary>host</primary>
11882 <secondary>lookup failures</secondary>
11884 <indexterm role="concept">
11885 <primary>unknown host name</primary>
11887 <indexterm role="concept">
11888 <primary>host list</primary>
11889 <secondary>matching host name</secondary>
11891 If a pattern is of the form
11894 <<emphasis>single-key-search-type</emphasis>>;<<emphasis>search-data</emphasis>>
11899 <literallayout class="monospaced">
11900 dbm;/host/accept/list
11903 a single-key lookup is performend, using the host name as its key. If the
11904 lookup succeeds, the host matches the item. The actual data that is looked up
11908 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
11909 keys in the file, not IP addresses. If you want to do lookups based on IP
11910 addresses, you must precede the search type with <quote>net-</quote> (see section
11911 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
11912 two items in the same list, one doing an address lookup and one doing a name
11913 lookup, both using the same file.
11917 <title>Host list patterns for query-style lookups</title>
11919 If a pattern is of the form
11922 <<emphasis>query-style-search-type</emphasis>>;<<emphasis>query</emphasis>>
11925 the query is obeyed, and if it succeeds, the host matches the item. The actual
11926 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
11927 <varname>$sender_host_name</varname> can be used in the query. For example:
11929 <literallayout class="monospaced">
11930 hosts_lookup = pgsql;\
11931 select ip from hostlist where ip='$sender_host_address'
11934 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
11935 can use the <option>sg</option> expansion item to change this if you need to. If you want to
11936 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
11940 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
11941 looks up the host name if has not already done so. (See section
11942 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
11945 Historical note: prior to release 4.30, Exim would always attempt to find a
11946 host name before running the query, unless the search type was preceded by
11947 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
11948 still recognized for query-style lookups, but its presence or absence has no
11949 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
11950 See section <xref linkend="SECThoslispatsikey"/>.)
11953 <section id="SECTmixwilhos">
11954 <title>Mixing wildcarded host names and addresses in host lists</title>
11956 <indexterm role="concept">
11957 <primary>host list</primary>
11958 <secondary>mixing names and addresses in</secondary>
11960 If you have name lookups or wildcarded host names and IP addresses in the same
11961 host list, you should normally put the IP addresses first. For example, in an
11962 ACL you could have:
11964 <literallayout class="monospaced">
11965 accept hosts = 10.9.8.7 : *.friend.example
11968 The reason for this lies in the left-to-right way that Exim processes lists.
11969 It can test IP addresses without doing any DNS lookups, but when it reaches an
11970 item that requires a host name, it fails if it cannot find a host name to
11971 compare with the pattern. If the above list is given in the opposite order, the
11972 <option>accept</option> statement fails for a host whose name cannot be found, even if its
11973 IP address is 10.9.8.7.
11976 If you really do want to do the name check first, and still recognize the IP
11977 address, you can rewrite the ACL like this:
11979 <literallayout class="monospaced">
11980 accept hosts = *.friend.example
11981 accept hosts = 10.9.8.7
11984 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
11985 <xref linkend="CHAPACL"/> for details of ACLs.
11988 <section id="SECTaddresslist">
11989 <title>Address lists</title>
11991 <indexterm role="concept">
11992 <primary>list</primary>
11993 <secondary>address list</secondary>
11995 <indexterm role="concept">
11996 <primary>address list</primary>
11997 <secondary>empty item</secondary>
11999 <indexterm role="concept">
12000 <primary>address list</primary>
12001 <secondary>patterns</secondary>
12003 Address lists contain patterns that are matched against mail addresses. There
12004 is one special case to be considered: the sender address of a bounce message is
12005 always empty. You can test for this by providing an empty item in an address
12006 list. For example, you can set up a router to process bounce messages by
12007 using this option setting:
12009 <literallayout class="monospaced">
12013 The presence of the colon creates an empty item. If you do not provide any
12014 data, the list is empty and matches nothing. The empty sender can also be
12015 detected by a regular expression that matches an empty string,
12016 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
12019 Non-empty items in an address list can be straightforward email addresses. For
12022 <literallayout class="monospaced">
12023 senders = jbc@askone.example : hs@anacreon.example
12026 A certain amount of wildcarding is permitted. If a pattern contains an @
12027 character, but is not a regular expression and does not begin with a
12028 semicolon-terminated lookup type (described below), the local part of the
12029 subject address is compared with the local part of the pattern, which may start
12030 with an asterisk. If the local parts match, the domain is checked in exactly
12031 the same way as for a pattern in a domain list. For example, the domain can be
12032 wildcarded, refer to a named list, or be a lookup:
12034 <literallayout class="monospaced">
12035 deny senders = *@*.spamming.site:\
12036 *@+hostile_domains:\
12037 bozo@partial-lsearch;/list/of/dodgy/sites:\
12038 *@dbm;/bad/domains.db
12041 <indexterm role="concept">
12042 <primary>local part</primary>
12043 <secondary>starting with !</secondary>
12045 <indexterm role="concept">
12046 <primary>address list</primary>
12047 <secondary>local part starting with !</secondary>
12049 If a local part that begins with an exclamation mark is required, it has to be
12050 specified using a regular expression, because otherwise the exclamation mark is
12051 treated as a sign of negation, as is standard in lists.
12054 If a non-empty pattern that is not a regular expression or a lookup does not
12055 contain an @ character, it is matched against the domain part of the subject
12056 address. The only two formats that are recognized this way are a literal
12057 domain, or a domain pattern that starts with *. In both these cases, the effect
12058 is the same as if <literal>*@</literal> preceded the pattern. For example:
12060 <literallayout class="monospaced">
12061 deny senders = enemy.domain : *.enemy.domain
12064 The following kinds of more complicated address list pattern can match any
12065 address, including the empty address that is characteristic of bounce message
12071 <indexterm role="concept">
12072 <primary>regular expressions</primary>
12073 <secondary>in address list</secondary>
12075 <indexterm role="concept">
12076 <primary>address list</primary>
12077 <secondary>regular expression in</secondary>
12079 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
12080 done against the complete address, with the pattern as the regular expression.
12081 You must take care that backslash and dollar characters are not misinterpreted
12082 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
12083 to mark that part of the string as non-expandable. For example:
12085 <literallayout class="monospaced">
12086 deny senders = \N^.*this.*@example\.com$\N : \
12087 \N^\d{8}.+@spamhaus.example$\N : ...
12090 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
12091 start with <quote>^</quote> by the time they are being interpreted as address patterns.
12096 <indexterm role="concept">
12097 <primary>address list</primary>
12098 <secondary>lookup for complete address</secondary>
12100 Complete addresses can be looked up by using a pattern that starts with a
12101 lookup type terminated by a semicolon, followed by the data for the lookup. For
12104 <literallayout class="monospaced">
12105 deny senders = cdb;/etc/blocked.senders : \
12106 mysql;select address from blocked where \
12107 address='${quote_mysql:$sender_address}'
12110 Both query-style and single-key lookup types can be used. For a single-key
12111 lookup type, Exim uses the complete address as the key. However, empty keys are
12112 not supported for single-key lookups, so a match against the empty address
12113 always fails. This restriction does not apply to query-style lookups.
12116 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
12117 cannot be used, and is ignored if specified, with an entry being written to the
12119 <indexterm role="concept">
12120 <primary>*@ with single-key lookup</primary>
12122 However, you can configure lookup defaults, as described in section
12123 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
12124 default. For example, with this lookup:
12126 <literallayout class="monospaced">
12127 accept senders = lsearch*@;/some/file
12130 the file could contains lines like this:
12132 <literallayout class="monospaced">
12133 user1@domain1.example
12137 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
12140 <literallayout class="monospaced">
12141 nimrod@jaeger.example
12146 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
12147 would mean that every address matches, thus rendering the test useless.
12150 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
12152 <literallayout class="monospaced">
12153 deny recipients = dbm*@;/some/file
12154 deny recipients = *@dbm;/some/file
12157 The first does a whole address lookup, with defaulting, as just described,
12158 because it starts with a lookup type. The second matches the local part and
12159 domain independently, as described in a bullet point below.
12164 The following kinds of address list pattern can match only non-empty addresses.
12165 If the subject address is empty, a match against any of these pattern types
12171 <indexterm role="concept">
12172 <primary>@@ with single-key lookup</primary>
12174 <indexterm role="concept">
12175 <primary>address list</primary>
12176 <secondary>@@ lookup type</secondary>
12178 <indexterm role="concept">
12179 <primary>address list</primary>
12180 <secondary>split local part and domain</secondary>
12182 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
12183 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
12184 split into a local part and a domain. The domain is looked up in the file. If
12185 it is not found, there is no match. If it is found, the data that is looked up
12186 from the file is treated as a colon-separated list of local part patterns, each
12187 of which is matched against the subject local part in turn.
12190 <indexterm role="concept">
12191 <primary>asterisk</primary>
12192 <secondary>in address list</secondary>
12194 The lookup may be a partial one, and/or one involving a search for a default
12195 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
12196 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
12197 even be further lookups. They may also be independently negated. For example,
12200 <literallayout class="monospaced">
12201 deny senders = @@dbm;/etc/reject-by-domain
12204 the data from which the DBM file is built could contain lines like
12206 <literallayout class="monospaced">
12207 baddomain.com: !postmaster : *
12210 to reject all senders except <option>postmaster</option> from that domain.
12213 <indexterm role="concept">
12214 <primary>local part</primary>
12215 <secondary>starting with !</secondary>
12217 If a local part that actually begins with an exclamation mark is required, it
12218 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
12219 may be split over several lines by indenting the second and subsequent lines,
12220 but the separating colon must still be included at line breaks. White space
12221 surrounding the colons is ignored. For example:
12223 <literallayout class="monospaced">
12224 aol.com: spammer1 : spammer2 : ^[0-9]+$ :
12225 spammer3 : spammer4
12228 As in all colon-separated lists in Exim, a colon can be included in an item by
12232 If the last item in the list starts with a right angle-bracket, the remainder
12233 of the item is taken as a new key to look up in order to obtain a continuation
12234 list of local parts. The new key can be any sequence of characters. Thus one
12235 might have entries like
12237 <literallayout class="monospaced">
12238 aol.com: spammer1 : spammer 2 : >*
12239 xyz.com: spammer3 : >*
12243 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
12244 local parts for all domains, in addition to the specific local parts listed for
12245 each domain. Of course, using this feature costs another lookup each time a
12246 chain is followed, but the effort needed to maintain the data is reduced.
12249 <indexterm role="concept">
12250 <primary>loop</primary>
12251 <secondary>in lookups</secondary>
12253 It is possible to construct loops using this facility, and in order to catch
12254 them, the chains may be no more than fifty items long.
12259 The @@<<emphasis>lookup</emphasis>> style of item can also be used with a query-style
12260 lookup, but in this case, the chaining facility is not available. The lookup
12261 can only return a single list of local parts.
12266 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
12267 in these two examples:
12269 <literallayout class="monospaced">
12271 senders = *@+my_list
12274 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
12275 example it is a named domain list.
12278 <section id="SECTcasletadd">
12279 <title>Case of letters in address lists</title>
12281 <indexterm role="concept">
12282 <primary>case of local parts</primary>
12284 <indexterm role="concept">
12285 <primary>address list</primary>
12286 <secondary>case forcing</secondary>
12288 <indexterm role="concept">
12289 <primary>case forcing in address lists</primary>
12291 Domains in email addresses are always handled caselessly, but for local parts
12292 case may be significant on some systems (see <option>caseful_local_part</option> for how
12293 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
12294 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
12295 blocking lists should be done in a case-independent manner. Since most address
12296 lists in Exim are used for this kind of control, Exim attempts to do this by
12300 The domain portion of an address is always lowercased before matching it to an
12301 address list. The local part is lowercased by default, and any string
12302 comparisons that take place are done caselessly. This means that the data in
12303 the address list itself, in files included as plain file names, and in any file
12304 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
12305 keys in files that are looked up by a search type other than <command>lsearch</command> (which
12306 works caselessly) must be in lower case, because these lookups are not
12310 <indexterm role="concept">
12311 <primary><literal>+caseful</literal></primary>
12313 To allow for the possibility of caseful address list matching, if an item in
12314 an address list is the string <quote>+caseful</quote>, the original case of the local
12315 part is restored for any comparisons that follow, and string comparisons are no
12316 longer case-independent. This does not affect the domain, which remains in
12317 lower case. However, although independent matches on the domain alone are still
12318 performed caselessly, regular expressions that match against an entire address
12319 become case-sensitive after <quote>+caseful</quote> has been seen.
12322 <section id="SECTlocparlis">
12323 <title>Local part lists</title>
12325 <indexterm role="concept">
12326 <primary>list</primary>
12327 <secondary>local part list</secondary>
12329 <indexterm role="concept">
12330 <primary>local part</primary>
12331 <secondary>list</secondary>
12333 Case-sensitivity in local part lists is handled in the same way as for address
12334 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
12335 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
12336 set false, the subject is lowercased and the matching is initially
12337 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
12338 matching in the local part list, but not elsewhere in the router. If
12339 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
12340 option is case-sensitive from the start.
12343 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
12344 comments are handled in the same way as address lists – they are recognized
12345 only if the # is preceded by white space or the start of the line.
12346 Otherwise, local part lists are matched in the same way as domain lists, except
12347 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
12348 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
12349 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
12351 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
12356 <chapter id="CHAPexpand">
12357 <title>String expansions</title>
12359 <indexterm role="concept" id="IIDstrexp" class="startofrange">
12360 <primary>expansion</primary>
12361 <secondary>of strings</secondary>
12363 Many strings in Exim’s run time configuration are expanded before use. Some of
12364 them are expanded every time they are used; others are expanded only once.
12367 When a string is being expanded it is copied verbatim from left to right except
12368 when a dollar or backslash character is encountered. A dollar specifies the
12369 start of a portion of the string that is interpreted and replaced as described
12370 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
12371 escape character, as described in the following section.
12373 <section id="SECTlittext">
12374 <title>Literal text in expanded strings</title>
12376 <indexterm role="concept">
12377 <primary>expansion</primary>
12378 <secondary>including literal text</secondary>
12380 An uninterpreted dollar can be included in an expanded string by putting a
12381 backslash in front of it. A backslash can be used to prevent any special
12382 character being treated specially in an expansion, including backslash itself.
12383 If the string appears in quotes in the configuration file, two backslashes are
12384 required because the quotes themselves cause interpretation of backslashes when
12385 the string is read in (see section <xref linkend="SECTstrings"/>).
12388 <indexterm role="concept">
12389 <primary>expansion</primary>
12390 <secondary>non-expandable substrings</secondary>
12392 A portion of the string can specified as non-expandable by placing it between
12393 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
12394 expressions, which often contain backslashes and dollar signs. For example:
12396 <literallayout class="monospaced">
12397 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
12400 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
12401 without interpretation until it reaches the next <literal>\N</literal> or the end of the
12406 <title>Character escape sequences in expanded strings</title>
12408 <indexterm role="concept">
12409 <primary>expansion</primary>
12410 <secondary>escape sequences</secondary>
12412 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
12413 expanded string is recognized as an escape sequence for the character newline,
12414 carriage return, or tab, respectively. A backslash followed by up to three
12415 octal digits is recognized as an octal encoding for a single character, and a
12416 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
12420 These escape sequences are also recognized in quoted strings when they are read
12421 in. Their interpretation in expansions as well is useful for unquoted strings,
12422 and for other cases such as looked-up strings that are then expanded.
12426 <title>Testing string expansions</title>
12428 <indexterm role="concept">
12429 <primary>expansion</primary>
12430 <secondary>testing</secondary>
12432 <indexterm role="concept">
12433 <primary>testing</primary>
12434 <secondary>string expansion</secondary>
12436 <indexterm role="concept">
12437 <primary><option>-be</option> option</primary>
12439 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
12440 takes the command arguments, or lines from the standard input if there are no
12441 arguments, runs them through the string expansion code, and writes the results
12442 to the standard output. Variables based on configuration values are set up, but
12443 since no message is being processed, variables such as <varname>$local_part</varname> have no
12444 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
12445 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
12446 and <option>nhash</option>.
12449 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
12450 instead runs under the uid and gid it was called with, to prevent users from
12451 using <option>-be</option> for reading files to which they do not have access.
12453 <para revisionflag="changed">
12454 <indexterm role="concept">
12455 <primary><option>-bem</option> option</primary>
12457 If you want to test expansions that include variables whose values are taken
12458 from a message, there are two other options that can be used. The <option>-bem</option>
12459 option is like <option>-be</option> except that it is followed by a file name. The file is
12460 read as a message before doing the test expansions. For example:
12462 <literallayout class="monospaced" revisionflag="changed">
12463 exim -bem /tmp/test.message '$h_subject:'
12465 <para revisionflag="changed">
12466 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
12467 Exim message identifier. For example:
12469 <literallayout class="monospaced" revisionflag="changed">
12470 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
12472 <para revisionflag="changed">
12473 This loads the message from Exim’s spool before doing the test expansions, and
12474 is therefore restricted to admin users.
12477 <section id="SECTforexpfai">
12478 <title>Forced expansion failure</title>
12480 <indexterm role="concept">
12481 <primary>expansion</primary>
12482 <secondary>forced failure</secondary>
12484 A number of expansions that are described in the following section have
12485 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
12486 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
12487 used depends on some condition that is evaluated as part of the expansion. If,
12488 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
12489 the entire string expansion fails in a way that can be detected by the code
12490 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
12491 its consequences depend on the circumstances. In some cases it is no different
12492 from any other expansion failure, but in others a different action may be
12493 taken. Such variations are mentioned in the documentation of the option that is
12497 <section id="SECTexpansionitems">
12498 <title>Expansion items</title>
12500 The following items are recognized in expanded strings. White space may be used
12501 between sub-items that are keywords or substrings enclosed in braces inside an
12502 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
12503 white space is significant.
12507 <term><emphasis role="bold">$</emphasis><<emphasis>variable name</emphasis>> or <emphasis role="bold">${</emphasis><<emphasis>variable name</emphasis>><emphasis role="bold">}</emphasis></term>
12510 <indexterm role="concept">
12511 <primary>expansion</primary>
12512 <secondary>variables</secondary>
12514 Substitute the contents of the named variable, for example:
12516 <literallayout class="monospaced">
12521 The second form can be used to separate the name from subsequent alphanumeric
12522 characters. This form (using braces) is available only for variables; it does
12523 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
12524 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
12525 given, the expansion fails.
12527 </listitem></varlistentry>
12529 <term><emphasis role="bold">${</emphasis><<emphasis>op</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
12532 <indexterm role="concept">
12533 <primary>expansion</primary>
12534 <secondary>operators</secondary>
12536 The string is first itself expanded, and then the operation specified by
12537 <<emphasis>op</emphasis>> is applied to it. For example:
12539 <literallayout class="monospaced">
12543 The string starts with the first character after the colon, which may be
12544 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
12545 below. The operator notation is used for simple expansion items that have just
12546 one argument, because it reduces the number of braces and therefore makes the
12547 string easier to understand.
12549 </listitem></varlistentry>
12551 <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>
12554 <indexterm role="concept">
12555 <primary><option>dlfunc</option></primary>
12557 This expansion dynamically loads and then calls a locally-written C function.
12558 This functionality is available only if Exim is compiled with
12560 <literallayout class="monospaced">
12564 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
12565 object so that it doesn’t reload the same object file in the same Exim process
12566 (but of course Exim does start new processes frequently).
12569 There may be from zero to eight arguments to the function. When compiling
12570 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
12571 included. The Exim variables and functions that are defined by that API
12572 are also available for dynamically loaded functions. The function itself
12573 must have the following type:
12575 <literallayout class="monospaced">
12576 int dlfunction(uschar **yield, int argc, uschar *argv[])
12579 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
12580 function should return one of the following values:
12583 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
12584 into the expanded string that is being built.
12587 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
12588 from <emphasis>yield</emphasis>, if it is set.
12591 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
12592 taken from <emphasis>yield</emphasis> if it is set.
12595 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
12598 When compiling a function that is to be used in this way with gcc,
12599 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
12600 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
12602 </listitem></varlistentry>
12604 <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>
12607 <indexterm role="concept">
12608 <primary>expansion</primary>
12609 <secondary>extracting substrings by key</secondary>
12611 <indexterm role="concept">
12612 <primary><option>extract</option></primary>
12613 <secondary>substrings by key</secondary>
12615 The key and <<emphasis>string1</emphasis>> are first expanded separately. Leading and trailing
12616 white space is removed from the key (but not from any of the strings). The key
12617 must not consist entirely of digits. The expanded <<emphasis>string1</emphasis>> must be of the
12621 <<emphasis>key1</emphasis>> = <<emphasis>value1</emphasis>> <<emphasis>key2</emphasis>> = <<emphasis>value2</emphasis>> ...
12624 <indexterm role="concept">
12625 <primary><varname>$value</varname></primary>
12627 where the equals signs and spaces (but not both) are optional. If any of the
12628 values contain white space, they must be enclosed in double quotes, and any
12629 values that are enclosed in double quotes are subject to escape processing as
12630 described in section <xref linkend="SECTstrings"/>. The expanded <<emphasis>string1</emphasis>> is searched
12631 for the value that corresponds to the key. The search is case-insensitive. If
12632 the key is found, <<emphasis>string2</emphasis>> is expanded, and replaces the whole item;
12633 otherwise <<emphasis>string3</emphasis>> is used. During the expansion of <<emphasis>string2</emphasis>> the
12634 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
12635 is restored to any previous value it might have had.
12638 If {<<emphasis>string3</emphasis>>} is omitted, the item is replaced by an empty string if the
12639 key is not found. If {<<emphasis>string2</emphasis>>} is also omitted, the value that was
12640 extracted is used. Thus, for example, these two expansions are identical, and
12641 yield <quote>2001</quote>:
12643 <literallayout class="monospaced">
12644 ${extract{gid}{uid=1984 gid=2001}}
12645 ${extract{gid}{uid=1984 gid=2001}{$value}}
12648 Instead of {<<emphasis>string3</emphasis>>} the word <quote>fail</quote> (not in curly brackets) can
12649 appear, for example:
12651 <literallayout class="monospaced">
12652 ${extract{Z}{A=... B=...}{$value} fail }
12655 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
12656 {<<emphasis>string2</emphasis>>} must be present for <quote>fail</quote> to be recognized.
12658 </listitem></varlistentry>
12660 <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>
12663 <indexterm role="concept">
12664 <primary>expansion</primary>
12665 <secondary>extracting substrings by number</secondary>
12667 <indexterm role="concept">
12668 <primary><option>extract</option></primary>
12669 <secondary>substrings by number</secondary>
12671 The <<emphasis>number</emphasis>> argument must consist entirely of decimal digits,
12672 apart from leading and trailing white space, which is ignored.
12673 This is what distinguishes this form of <option>extract</option> from the previous kind. It
12674 behaves in the same way, except that, instead of extracting a named field, it
12675 extracts from <<emphasis>string1</emphasis>> the field whose number is given as the first
12676 argument. You can use <varname>$value</varname> in <<emphasis>string2</emphasis>> or <literal>fail</literal> instead of
12677 <<emphasis>string3</emphasis>> as before.
12680 The fields in the string are separated by any one of the characters in the
12681 separator string. These may include space or tab characters.
12682 The first field is numbered one. If the number is negative, the fields are
12683 counted from the end of the string, with the rightmost one numbered -1. If the
12684 number given is zero, the entire string is returned. If the modulus of the
12685 number is greater than the number of fields in the string, the result is the
12686 expansion of <<emphasis>string3</emphasis>>, or the empty string if <<emphasis>string3</emphasis>> is not
12687 provided. For example:
12689 <literallayout class="monospaced">
12690 ${extract{2}{:}{x:42:99:& Mailer::/bin/bash}}
12693 yields <quote>42</quote>, and
12695 <literallayout class="monospaced">
12696 ${extract{-4}{:}{x:42:99:& Mailer::/bin/bash}}
12699 yields <quote>99</quote>. Two successive separators mean that the field between them is
12700 empty (for example, the fifth field above).
12702 </listitem></varlistentry>
12704 <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>
12707 <indexterm role="concept">
12708 <primary>hash function</primary>
12709 <secondary>textual</secondary>
12711 <indexterm role="concept">
12712 <primary>expansion</primary>
12713 <secondary>textual hash</secondary>
12715 This is a textual hashing function, and was the first to be implemented in
12716 early versions of Exim. In current releases, there are other hashing functions
12717 (numeric, MD5, and SHA-1), which are described below.
12720 The first two strings, after expansion, must be numbers. Call them <<emphasis>m</emphasis>> and
12721 <<emphasis>n</emphasis>>. If you are using fixed values for these numbers, that is, if
12722 <<emphasis>string1</emphasis>> and <<emphasis>string2</emphasis>> do not change when they are expanded, you can
12723 use the simpler operator notation that avoids some of the braces:
12725 <literallayout class="monospaced">
12726 ${hash_<n>_<m>:<string>}
12729 The second number is optional (in both notations). If <<emphasis>n</emphasis>> is greater than
12730 or equal to the length of the string, the expansion item returns the string.
12731 Otherwise it computes a new string of length <<emphasis>n</emphasis>> by applying a hashing
12732 function to the string. The new string consists of characters taken from the
12733 first <<emphasis>m</emphasis>> characters of the string
12735 <literallayout class="monospaced">
12736 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
12739 If <<emphasis>m</emphasis>> is not present the value 26 is used, so that only lower case
12740 letters appear. For example:
12743 <literal>$hash{3}{monty}} </literal> yields <literal>jmg</literal>
12744 <literal>$hash{5}{monty}} </literal> yields <literal>monty</literal>
12745 <literal>$hash{4}{62}{monty python}}</literal> yields <literal>fbWx</literal>
12747 </listitem></varlistentry>
12749 <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>
12752 See <emphasis role="bold">$rheader</emphasis> below.
12754 </listitem></varlistentry>
12756 <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>
12759 See <emphasis role="bold">$rheader</emphasis> below.
12761 </listitem></varlistentry>
12763 <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>
12766 <indexterm role="concept">
12767 <primary>expansion</primary>
12768 <secondary>header insertion</secondary>
12770 <indexterm role="concept">
12771 <primary><varname>$header_</varname></primary>
12773 <indexterm role="concept">
12774 <primary><varname>$bheader_</varname></primary>
12776 <indexterm role="concept">
12777 <primary><varname>$rheader_</varname></primary>
12779 <indexterm role="concept">
12780 <primary>header lines</primary>
12781 <secondary>in expansion strings</secondary>
12783 <indexterm role="concept">
12784 <primary>header lines</primary>
12785 <secondary>character sets</secondary>
12787 <indexterm role="concept">
12788 <primary>header lines</primary>
12789 <secondary>decoding</secondary>
12791 Substitute the contents of the named message header line, for example
12793 <literallayout class="monospaced">
12797 The newline that terminates a header line is not included in the expansion, but
12798 internal newlines (caused by splitting the header line over several physical
12799 lines) may be present.
12802 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
12803 the data in the header line is interpreted.
12808 <indexterm role="concept">
12809 <primary>white space</primary>
12810 <secondary>in header lines</secondary>
12812 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
12813 processing at all, and without the removal of leading and trailing white space.
12818 <indexterm role="concept">
12819 <primary>base64 encoding</primary>
12820 <secondary>in header lines</secondary>
12822 <option>bheader</option> removes leading and trailing white space, and then decodes base64
12823 or quoted-printable MIME <quote>words</quote> within the header text, but does no
12824 character set translation. If decoding of what looks superficially like a MIME
12825 <quote>word</quote> fails, the raw string is returned. If decoding
12826 <indexterm role="concept">
12827 <primary>binary zero</primary>
12828 <secondary>in header line</secondary>
12830 produces a binary zero character, it is replaced by a question mark – this is
12831 what Exim does for binary zeros that are actually received in header lines.
12836 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
12837 standard character set. This is an attempt to produce the same string as would
12838 be displayed on a user’s MUA. If translation fails, the <option>bheader</option> string is
12839 returned. Translation is attempted only on operating systems that support the
12840 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
12841 a system Makefile or in <filename>Local/Makefile</filename>.
12846 In a filter file, the target character set for <option>header</option> can be specified by a
12847 command of the following form:
12849 <literallayout class="monospaced">
12850 headers charset "UTF-8"
12853 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
12854 subsequently obeyed filter commands. In the absence of this command, the target
12855 character set in a filter is taken from the setting of the <option>headers_charset</option>
12856 option in the runtime configuration. The value of this option defaults to the
12857 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
12861 Header names follow the syntax of RFC 2822, which states that they may contain
12862 any printing characters except space and colon. Consequently, curly brackets
12863 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
12864 if they were variables. Attempting to do so causes a syntax error.
12866 <para revisionflag="changed">
12867 Only header lines that are common to all copies of a message are visible to
12868 this mechanism. These are the original header lines that are received with the
12869 message, and any that are added by an ACL statement or by a system
12870 filter. Header lines that are added to a particular copy of a message by a
12871 router or transport are not accessible.
12873 <para revisionflag="changed">
12874 For incoming SMTP messages, no header lines are visible in ACLs that are obeyed
12875 before the DATA ACL, because the header structure is not set up until the
12876 message is received. Header lines that are added in a RCPT ACL (for example)
12877 are saved until the message’s incoming header lines are available, at which
12878 point they are added. When a DATA ACL is running, however, header lines added
12879 by earlier ACLs are visible.
12882 Upper case and lower case letters are synonymous in header names. If the
12883 following character is white space, the terminating colon may be omitted, but
12884 this is not recommended, because you may then forget it when it is needed. When
12885 white space terminates the header name, it is included in the expanded string.
12886 If the message does not contain the given header, the expansion item is
12887 replaced by an empty string. (See the <option>def</option> condition in section
12888 <xref linkend="SECTexpcond"/> for a means of testing for the existence of a header.)
12890 <para revisionflag="changed">
12891 If there is more than one header with the same name, they are all concatenated
12892 to form the substitution string, up to a maximum length of 64K. Unless
12893 <option>rheader</option> is being used, leading and trailing white space is removed from
12894 each header before concatenation, and a completely empty header is ignored. A
12895 newline character is then inserted between non-empty headers, but there is no
12896 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
12897 those headers that contain lists of addresses, a comma is also inserted at the
12898 junctions between headers. This does not happen for the <option>rheader</option> expansion.
12900 </listitem></varlistentry>
12902 <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>
12905 <indexterm role="concept">
12906 <primary>expansion</primary>
12907 <secondary>hmac hashing</secondary>
12909 <indexterm role="concept">
12910 <primary><option>hmac</option></primary>
12912 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
12913 shared secret and some text into a message authentication code, as specified in
12914 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
12915 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
12916 cryptographic hash, allowing for authentication that is not possible with MD5
12917 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
12918 present. For example:
12920 <literallayout class="monospaced">
12921 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
12924 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
12927 <literallayout class="monospaced">
12928 dd97e3ba5d1a61b5006108f8c8252953
12931 As an example of how this might be used, you might put in the main part of
12932 an Exim configuration:
12934 <literallayout class="monospaced">
12935 SPAMSCAN_SECRET=cohgheeLei2thahw
12938 In a router or a transport you could then have:
12940 <literallayout class="monospaced">
12942 X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
12943 ${hmac{md5}{SPAMSCAN_SECRET}\
12944 {${primary_hostname},${message_exim_id},$h_message-id:}}
12947 Then given a message, you can check where it was scanned by looking at the
12948 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
12949 this header line is authentic by recomputing the authentication code from the
12950 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
12951 using Exim’s <option>-be</option> option, or by other means, for example by using the
12952 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
12954 </listitem></varlistentry>
12956 <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>
12959 <indexterm role="concept">
12960 <primary>expansion</primary>
12961 <secondary>conditional</secondary>
12963 <indexterm role="concept">
12964 <primary><option>if</option>, expansion item</primary>
12966 If <<emphasis>condition</emphasis>> is true, <<emphasis>string1</emphasis>> is expanded and replaces the whole
12967 item; otherwise <<emphasis>string2</emphasis>> is used. The available conditions are described
12968 in section <xref linkend="SECTexpcond"/> below. For example:
12970 <literallayout class="monospaced">
12971 ${if eq {$local_part}{postmaster} {yes}{no} }
12974 The second string need not be present; if it is not and the condition is not
12975 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
12976 be present instead of the second string (without any curly brackets). In this
12977 case, the expansion is forced to fail if the condition is not true (see section
12978 <xref linkend="SECTforexpfai"/>).
12981 If both strings are omitted, the result is the string <literal>true</literal> if the condition
12982 is true, and the empty string if the condition is false. This makes it less
12983 cumbersome to write custom ACL and router conditions. For example, instead of
12985 <literallayout class="monospaced">
12986 condition = ${if >{$acl_m4}{3}{true}{false}}
12991 <literallayout class="monospaced">
12992 condition = ${if >{$acl_m4}{3}}
12994 </listitem></varlistentry>
12996 <term><emphasis role="bold">${length{</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}}</emphasis></term>
12999 <indexterm role="concept">
13000 <primary>expansion</primary>
13001 <secondary>string truncation</secondary>
13003 <indexterm role="concept">
13004 <primary><option>length</option></primary>
13005 <secondary>expansion item</secondary>
13007 The <option>length</option> item is used to extract the initial portion of a string. Both
13008 strings are expanded, and the first one must yield a number, <<emphasis>n</emphasis>>, say. If
13009 you are using a fixed value for the number, that is, if <<emphasis>string1</emphasis>> does not
13010 change when expanded, you can use the simpler operator notation that avoids
13011 some of the braces:
13013 <literallayout class="monospaced">
13014 ${length_<n>:<string>}
13017 The result of this item is either the first <<emphasis>n</emphasis>> characters or the whole
13018 of <<emphasis>string2</emphasis>>, whichever is the shorter. Do not confuse <option>length</option> with
13019 <option>strlen</option>, which gives the length of a string.
13021 </listitem></varlistentry>
13023 <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>
13026 This is the first of one of two different types of lookup item, which are both
13027 described in the next item.
13029 </listitem></varlistentry>
13031 <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>
13034 <indexterm role="concept">
13035 <primary>expansion</primary>
13036 <secondary>lookup in</secondary>
13038 <indexterm role="concept">
13039 <primary>file</primary>
13040 <secondary>lookups</secondary>
13042 <indexterm role="concept">
13043 <primary>lookup</primary>
13044 <secondary>in expanded string</secondary>
13046 The two forms of lookup item specify data lookups in files and databases, as
13047 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
13048 lookups, and the second is used for query-style lookups. The <<emphasis>key</emphasis>>,
13049 <<emphasis>file</emphasis>>, and <<emphasis>query</emphasis>> strings are expanded before use.
13052 If there is any white space in a lookup item which is part of a filter command,
13053 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
13054 other place where white space is significant, the lookup item must be enclosed
13055 in double quotes. The use of data lookups in users’ filter files may be locked
13056 out by the system administrator.
13059 <indexterm role="concept">
13060 <primary><varname>$value</varname></primary>
13062 If the lookup succeeds, <<emphasis>string1</emphasis>> is expanded and replaces the entire item.
13063 During its expansion, the variable <varname>$value</varname> contains the data returned by the
13064 lookup. Afterwards it reverts to the value it had previously (at the outer
13065 level it is empty). If the lookup fails, <<emphasis>string2</emphasis>> is expanded and replaces
13066 the entire item. If {<<emphasis>string2</emphasis>>} is omitted, the replacement is the empty
13067 string on failure. If <<emphasis>string2</emphasis>> is provided, it can itself be a nested
13068 lookup, thus providing a mechanism for looking up a default value when the
13069 original lookup fails.
13072 If a nested lookup is used as part of <<emphasis>string1</emphasis>>, <varname>$value</varname> contains the
13073 data for the outer lookup while the parameters of the second lookup are
13074 expanded, and also while <<emphasis>string2</emphasis>> of the second lookup is expanded, should
13075 the second lookup fail. Instead of {<<emphasis>string2</emphasis>>} the word <quote>fail</quote> can
13076 appear, and in this case, if the lookup fails, the entire expansion is forced
13077 to fail (see section <xref linkend="SECTforexpfai"/>). If both {<<emphasis>string1</emphasis>>} and
13078 {<<emphasis>string2</emphasis>>} are omitted, the result is the looked up value in the case of a
13079 successful lookup, and nothing in the case of failure.
13082 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
13083 search type in order to do partial matching, and * or *@ may follow a search
13084 type to request default lookups if the key does not match (see sections
13085 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
13088 <indexterm role="concept">
13089 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
13090 <secondary>in lookup expansion</secondary>
13092 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
13093 and non-wild parts of the key during the expansion of the replacement text.
13094 They return to their previous values at the end of the lookup item.
13097 This example looks up the postmaster alias in the conventional alias file:
13099 <literallayout class="monospaced">
13100 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
13103 This example uses NIS+ to look up the full name of the user corresponding to
13104 the local part of an address, forcing the expansion to fail if it is not found:
13106 <literallayout class="monospaced">
13107 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
13110 </listitem></varlistentry>
13112 <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>
13115 <indexterm role="concept">
13116 <primary>expansion</primary>
13117 <secondary>numeric hash</secondary>
13119 <indexterm role="concept">
13120 <primary>hash function</primary>
13121 <secondary>numeric</secondary>
13123 The three strings are expanded; the first two must yield numbers. Call them
13124 <<emphasis>n</emphasis>> and <<emphasis>m</emphasis>>. If you are using fixed values for these numbers, that is,
13125 if <<emphasis>string1</emphasis>> and <<emphasis>string2</emphasis>> do not change when they are expanded, you
13126 can use the simpler operator notation that avoids some of the braces:
13128 <literallayout class="monospaced">
13129 ${nhash_<n>_<m>:<string>}
13132 The second number is optional (in both notations). If there is only one number,
13133 the result is a number in the range 0–<<emphasis>n</emphasis>>-1. Otherwise, the string is
13134 processed by a div/mod hash function that returns two numbers, separated by a
13135 slash, in the ranges 0 to <<emphasis>n</emphasis>>-1 and 0 to <<emphasis>m</emphasis>>-1, respectively. For
13138 <literallayout class="monospaced">
13139 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
13142 returns the string <quote>6/33</quote>.
13144 </listitem></varlistentry>
13146 <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>
13149 <indexterm role="concept">
13150 <primary>Perl</primary>
13151 <secondary>use in expanded string</secondary>
13153 <indexterm role="concept">
13154 <primary>expansion</primary>
13155 <secondary>calling Perl from</secondary>
13157 This item is available only if Exim has been built to include an embedded Perl
13158 interpreter. The subroutine name and the arguments are first separately
13159 expanded, and then the Perl subroutine is called with those arguments. No
13160 additional arguments need be given; the maximum number permitted, including the
13161 name of the subroutine, is nine.
13164 The return value of the subroutine is inserted into the expanded string, unless
13165 the return value is <option>undef</option>. In that case, the expansion fails in the same
13166 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
13167 Whatever you return is evaluated in a scalar context. For example, if you
13168 return the name of a Perl vector, the return value is the size of the vector,
13172 If the subroutine exits by calling Perl’s <option>die</option> function, the expansion fails
13173 with the error message that was passed to <option>die</option>. More details of the embedded
13174 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
13177 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
13178 out the use of this expansion item in filter files.
13180 </listitem></varlistentry>
13182 <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>
13185 <indexterm role="concept">
13186 <primary>prvs</primary>
13187 <secondary>expansion item</secondary>
13189 The first argument is a complete email address and the second is secret
13190 keystring. The third argument, specifying a key number, is optional. If absent,
13191 it defaults to 0. The result of the expansion is a prvs-signed email address,
13192 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
13193 as part of a bounce address tag validation (BATV) scheme. For more discussion
13194 and an example, see section <xref linkend="SECTverifyPRVS"/>.
13196 </listitem></varlistentry>
13198 <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>
13201 <indexterm role="concept">
13202 <primary>prvscheck</primary>
13203 <secondary>expansion item</secondary>
13205 This expansion item is the complement of the <option>prvs</option> item. It is used for
13206 checking prvs-signed addresses. If the expansion of the first argument does not
13207 yield a syntactically valid prvs-signed address, the whole item expands to the
13208 empty string. When the first argument does expand to a syntactically valid
13209 prvs-signed address, the second argument is expanded, with the prvs-decoded
13210 version of the address and the key number extracted from the address in the
13211 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
13214 These two variables can be used in the expansion of the second argument to
13215 retrieve the secret. The validity of the prvs-signed address is then checked
13216 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
13217 which is empty for failure or <quote>1</quote> for success.
13220 The third argument is optional; if it is missing, it defaults to an empty
13221 string. This argument is now expanded. If the result is an empty string, the
13222 result of the expansion is the decoded version of the address. This is the case
13223 whether or not the signature was valid. Otherwise, the result of the expansion
13224 is the expansion of the third argument.
13227 All three variables can be used in the expansion of the third argument.
13228 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
13229 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
13231 </listitem></varlistentry>
13233 <term><emphasis role="bold">${readfile{</emphasis><<emphasis>file name</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>eol string</emphasis>><emphasis role="bold">}}</emphasis></term>
13236 <indexterm role="concept">
13237 <primary>expansion</primary>
13238 <secondary>inserting an entire file</secondary>
13240 <indexterm role="concept">
13241 <primary>file</primary>
13242 <secondary>inserting into expansion</secondary>
13244 <indexterm role="concept">
13245 <primary><option>readfile</option> expansion item</primary>
13247 The file name and end-of-line string are first expanded separately. The file is
13248 then read, and its contents replace the entire item. All newline characters in
13249 the file are replaced by the end-of-line string if it is present. Otherwise,
13250 newlines are left in the string.
13251 String expansion is not applied to the contents of the file. If you want this,
13252 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
13253 the string expansion fails.
13256 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
13257 locks out the use of this expansion item in filter files.
13259 </listitem></varlistentry>
13261 <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>
13264 <indexterm role="concept">
13265 <primary>expansion</primary>
13266 <secondary>inserting from a socket</secondary>
13268 <indexterm role="concept">
13269 <primary>socket</primary>
13270 <secondary>use of in expansion</secondary>
13272 <indexterm role="concept">
13273 <primary><option>readsocket</option> expansion item</primary>
13275 This item inserts data from a Unix domain or Internet socket into the expanded
13276 string. The minimal way of using it uses just two arguments, as in these
13279 <literallayout class="monospaced">
13280 ${readsocket{/socket/name}{request string}}
13281 ${readsocket{inet:some.host:1234}{request string}}
13284 For a Unix domain socket, the first substring must be the path to the socket.
13285 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
13286 a host name or IP address, followed by a colon and a port, which can be a
13287 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
13288 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
13291 <literallayout class="monospaced">
13292 ${readsocket{inet:[::1]:1234}{request string}}
13295 Only a single host name may be given, but if looking it up yields more than
13296 one IP address, they are each tried in turn until a connection is made. For
13297 both kinds of socket, Exim makes a connection, writes the request string
13298 (unless it is an empty string) and reads from the socket until an end-of-file
13299 is read. A timeout of 5 seconds is applied. Additional, optional arguments
13300 extend what can be done. Firstly, you can vary the timeout. For example:
13302 <literallayout class="monospaced">
13303 ${readsocket{/socket/name}{request string}{3s}}
13306 A fourth argument allows you to change any newlines that are in the data
13307 that is read, in the same way as for <option>readfile</option> (see above). This example
13308 turns them into spaces:
13310 <literallayout class="monospaced">
13311 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
13314 As with all expansions, the substrings are expanded before the processing
13315 happens. Errors in these sub-expansions cause the expansion to fail. In
13316 addition, the following errors can occur:
13321 Failure to create a socket file descriptor;
13326 Failure to connect the socket;
13331 Failure to write the request string;
13336 Timeout on reading from the socket.
13341 By default, any of these errors causes the expansion to fail. However, if
13342 you supply a fifth substring, it is expanded and used when any of the above
13343 errors occurs. For example:
13345 <literallayout class="monospaced">
13346 ${readsocket{/socket/name}{request string}{3s}{\n}\
13350 You can test for the existence of a Unix domain socket by wrapping this
13351 expansion in <literal>${if exists</literal>, but there is a race condition between that test
13352 and the actual opening of the socket, so it is safer to use the fifth argument
13353 if you want to be absolutely sure of avoiding an expansion error for a
13354 non-existent Unix domain socket, or a failure to connect to an Internet socket.
13357 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
13358 locks out the use of this expansion item in filter files.
13360 </listitem></varlistentry>
13362 <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>
13365 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
13366 expansion item above.
13368 </listitem></varlistentry>
13370 <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>
13373 <indexterm role="concept">
13374 <primary>expansion</primary>
13375 <secondary>running a command</secondary>
13377 <indexterm role="concept">
13378 <primary><option>run</option> expansion item</primary>
13380 The command and its arguments are first expanded separately, and then the
13381 command is run in a separate process, but under the same uid and gid. As in
13382 other command executions from Exim, a shell is not used by default. If you want
13383 a shell, you must explicitly code it.
13385 <para revisionflag="changed">
13386 The standard input for the command exists, but is empty. The standard output
13387 and standard error are set to the same file descriptor.
13388 <indexterm role="concept">
13389 <primary>return code</primary>
13390 <secondary>from <option>run</option> expansion</secondary>
13392 <indexterm role="concept">
13393 <primary><varname>$value</varname></primary>
13395 If the command succeeds (gives a zero return code) <<emphasis>string1</emphasis>> is expanded
13396 and replaces the entire item; during this expansion, the standard output/error
13397 from the command is in the variable <varname>$value</varname>. If the command fails,
13398 <<emphasis>string2</emphasis>>, if present, is expanded and used. Once again, during the
13399 expansion, the standard output/error from the command is in the variable
13400 <varname>$value</varname>.
13402 <para revisionflag="changed">
13403 If <<emphasis>string2</emphasis>> is absent, the result is empty. Alternatively, <<emphasis>string2</emphasis>>
13404 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
13405 command does not succeed. If both strings are omitted, the result is contents
13406 of the standard output/error on success, and nothing on failure.
13409 <indexterm role="concept">
13410 <primary><varname>$runrc</varname></primary>
13412 The return code from the command is put in the variable <varname>$runrc</varname>, and this
13413 remains set afterwards, so in a filter file you can do things like this:
13415 <literallayout class="monospaced">
13416 if "${run{x y z}{}}$runrc" is 1 then ...
13417 elif $runrc is 2 then ...
13422 If execution of the command fails (for example, the command does not exist),
13423 the return code is 127 – the same code that shells use for non-existent
13427 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
13428 option values are expanded, except for those preconditions whose order of
13429 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
13430 by the expansion of one option, and use it in another.
13433 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
13434 out the use of this expansion item in filter files.
13436 </listitem></varlistentry>
13438 <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>
13441 <indexterm role="concept">
13442 <primary>expansion</primary>
13443 <secondary>string substitution</secondary>
13445 <indexterm role="concept">
13446 <primary><option>sg</option> expansion item</primary>
13448 This item works like Perl’s substitution operator (s) with the global (/g)
13449 option; hence its name. However, unlike the Perl equivalent, Exim does not
13450 modify the subject string; instead it returns the modified string for insertion
13451 into the overall expansion. The item takes three arguments: the subject string,
13452 a regular expression, and a substitution string. For example:
13454 <literallayout class="monospaced">
13455 ${sg{abcdefabcdef}{abc}{xyz}}
13458 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
13459 if any $ or \ characters are required in the regular expression or in the
13460 substitution string, they have to be escaped. For example:
13462 <literallayout class="monospaced">
13463 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
13466 yields <quote>defabc</quote>, and
13468 <literallayout class="monospaced">
13469 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
13472 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
13473 the regular expression from string expansion.
13475 </listitem></varlistentry>
13477 <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>
13480 <indexterm role="concept">
13481 <primary><option>substr</option></primary>
13483 <indexterm role="concept">
13484 <primary>substring extraction</primary>
13486 <indexterm role="concept">
13487 <primary>expansion</primary>
13488 <secondary>substring extraction</secondary>
13490 The three strings are expanded; the first two must yield numbers. Call them
13491 <<emphasis>n</emphasis>> and <<emphasis>m</emphasis>>. If you are using fixed values for these numbers, that is,
13492 if <<emphasis>string1</emphasis>> and <<emphasis>string2</emphasis>> do not change when they are expanded, you
13493 can use the simpler operator notation that avoids some of the braces:
13495 <literallayout class="monospaced">
13496 ${substr_<n>_<m>:<string>}
13499 The second number is optional (in both notations).
13500 If it is absent in the simpler format, the preceding underscore must also be
13504 The <option>substr</option> item can be used to extract more general substrings than
13505 <option>length</option>. The first number, <<emphasis>n</emphasis>>, is a starting offset, and <<emphasis>m</emphasis>> is the
13506 length required. For example
13508 <literallayout class="monospaced">
13509 ${substr{3}{2}{$local_part}}
13512 If the starting offset is greater than the string length the result is the
13513 null string; if the length plus starting offset is greater than the string
13514 length, the result is the right-hand part of the string, starting from the
13515 given offset. The first character in the string has offset zero.
13518 The <option>substr</option> expansion item can take negative offset values to count
13519 from the right-hand end of its operand. The last character is offset -1, the
13520 second-last is offset -2, and so on. Thus, for example,
13522 <literallayout class="monospaced">
13523 ${substr{-5}{2}{1234567}}
13526 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
13527 length of the string, the substring starts at the beginning of the string, and
13528 the length is reduced by the amount of overshoot. Thus, for example,
13530 <literallayout class="monospaced">
13531 ${substr{-5}{2}{12}}
13534 yields an empty string, but
13536 <literallayout class="monospaced">
13537 ${substr{-3}{2}{12}}
13540 yields <quote>1</quote>.
13543 When the second number is omitted from <option>substr</option>, the remainder of the string
13544 is taken if the offset is positive. If it is negative, all characters in the
13545 string preceding the offset point are taken. For example, an offset of -1 and
13546 no length, as in these semantically identical examples:
13548 <literallayout class="monospaced">
13550 ${substr{-1}{abcde}}
13553 yields all but the last character of the string, that is, <quote>abcd</quote>.
13555 </listitem></varlistentry>
13557 <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>
13560 <indexterm role="concept">
13561 <primary>expansion</primary>
13562 <secondary>character translation</secondary>
13564 <indexterm role="concept">
13565 <primary><option>tr</option> expansion item</primary>
13567 This item does single-character translation on its subject string. The second
13568 argument is a list of characters to be translated in the subject string. Each
13569 matching character is replaced by the corresponding character from the
13570 replacement list. For example
13572 <literallayout class="monospaced">
13573 ${tr{abcdea}{ac}{13}}
13576 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
13577 last occurrence is used. If the third string is shorter than the second, its
13578 last character is replicated. However, if it is empty, no translation takes
13581 </listitem></varlistentry>
13584 <section id="SECTexpop">
13585 <title>Expansion operators</title>
13587 <indexterm role="concept">
13588 <primary>expansion</primary>
13589 <secondary>operators</secondary>
13591 For expansion items that perform transformations on a single argument string,
13592 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
13593 The substring is first expanded before the operation is applied to it. The
13594 following operations can be performed:
13598 <term><emphasis role="bold">${address:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13601 <indexterm role="concept">
13602 <primary>expansion</primary>
13603 <secondary>RFC 2822 address handling</secondary>
13605 <indexterm role="concept">
13606 <primary><option>address</option></primary>
13607 <secondary>expansion item</secondary>
13609 The string is interpreted as an RFC 2822 address, as it might appear in a
13610 header line, and the effective address is extracted from it. If the string does
13611 not parse successfully, the result is empty.
13613 </listitem></varlistentry>
13615 <term><emphasis role="bold">${base62:</emphasis><<emphasis>digits</emphasis>><emphasis role="bold">}</emphasis></term>
13618 <indexterm role="concept">
13619 <primary><option>base62</option></primary>
13621 <indexterm role="concept">
13622 <primary>expansion</primary>
13623 <secondary>conversion to base 62</secondary>
13625 The string must consist entirely of decimal digits. The number is converted to
13626 base 62 and output as a string of six characters, including leading zeros. In
13627 the few operating environments where Exim uses base 36 instead of base 62 for
13628 its message identifiers (because those systems do not have case-sensitive file
13629 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
13630 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
13632 </listitem></varlistentry>
13634 <term><emphasis role="bold">${base62d:</emphasis><<emphasis>base-62 digits</emphasis>><emphasis role="bold">}</emphasis></term>
13637 <indexterm role="concept">
13638 <primary><option>base62d</option></primary>
13640 <indexterm role="concept">
13641 <primary>expansion</primary>
13642 <secondary>conversion to base 62</secondary>
13644 The string must consist entirely of base-62 digits, or, in operating
13645 environments where Exim uses base 36 instead of base 62 for its message
13646 identifiers, base-36 digits. The number is converted to decimal and output as a
13649 </listitem></varlistentry>
13651 <term><emphasis role="bold">${domain:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13654 <indexterm role="concept">
13655 <primary>domain</primary>
13656 <secondary>extraction</secondary>
13658 <indexterm role="concept">
13659 <primary>expansion</primary>
13660 <secondary>domain extraction</secondary>
13662 The string is interpreted as an RFC 2822 address and the domain is extracted
13663 from it. If the string does not parse successfully, the result is empty.
13665 </listitem></varlistentry>
13667 <term><emphasis role="bold">${escape:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13670 <indexterm role="concept">
13671 <primary>expansion</primary>
13672 <secondary>escaping non-printing characters</secondary>
13674 <indexterm role="concept">
13675 <primary><option>escape</option>, expansion item</primary>
13677 If the string contains any non-printing characters, they are converted to
13678 escape sequences starting with a backslash. Whether characters with the most
13679 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
13680 is controlled by the <option>print_topbitchars</option> option.
13682 </listitem></varlistentry>
13684 <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>
13687 <indexterm role="concept">
13688 <primary>expansion</primary>
13689 <secondary>expression evaluation</secondary>
13691 <indexterm role="concept">
13692 <primary>expansion</primary>
13693 <secondary>arithmetic expression</secondary>
13695 <indexterm role="concept">
13696 <primary><option>eval</option> expansion item</primary>
13699 <para revisionflag="changed">
13700 These items supports simple arithmetic and bitwise logical operations in
13701 expansion strings. The string (after expansion) must be a conventional
13702 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
13703 logical operators, and parentheses. All operations are carried out using
13704 integer arithmetic. The operator priorities are as follows (the same as in the
13705 C programming language):
13707 <informaltable frame="none" revisionflag="changed">
13708 <tgroup cols="2" colsep="0" rowsep="0">
13709 <colspec colwidth="90pt" align="left"/>
13710 <colspec colwidth="300pt" align="left"/>
13713 <entry> <emphasis>highest:</emphasis></entry>
13714 <entry>not (~), negate (-)</entry>
13718 <entry>multiply (*), divide (/), remainder (%)</entry>
13722 <entry>plus (+), minus (-)</entry>
13726 <entry>shift-left (<<), shift-right (>>)</entry>
13730 <entry>and (&)</entry>
13734 <entry>xor (^)</entry>
13737 <entry> <emphasis>lowest:</emphasis></entry>
13738 <entry>or (|)</entry>
13743 <para revisionflag="changed">
13744 Binary operators with the same priority are evaluated from left to right. White
13745 space is permitted before or after operators.
13747 <para revisionflag="changed">
13748 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
13749 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
13750 decimal, even if they start with a leading zero; hexadecimal numbers are not
13751 permitted. This can be useful when processing numbers extracted from dates or
13752 times, which often do have leading zeros.
13754 <para revisionflag="changed">
13755 A number may be followed by <quote>K</quote> or <quote>M</quote> to multiply it by 1024 or 1024*1024,
13756 respectively. Negative numbers are supported. The result of the computation is
13757 a decimal representation of the answer (without <quote>K</quote> or <quote>M</quote>). For example:
13759 <literallayout revisionflag="changed">
13760 <literal>${eval:1+1} </literal> yields 2
13761 <literal>${eval:1+2*3} </literal> yields 7
13762 <literal>${eval:(1+2)*3} </literal> yields 9
13763 <literal>${eval:2+42%5} </literal> yields 4
13764 <literal>${eval:0xc&5} </literal> yields 4
13765 <literal>${eval:0xc|5} </literal> yields 13
13766 <literal>${eval:0xc^5} </literal> yields 9
13767 <literal>${eval:0xc>>1} </literal> yields 6
13768 <literal>${eval:0xc<<1} </literal> yields 24
13769 <literal>${eval:~255&0x1234} </literal> yields 4608
13770 <literal>${eval:-(~255&0x1234)} </literal> yields -4608
13773 As a more realistic example, in an ACL you might have
13775 <literallayout class="monospaced">
13776 deny message = Too many bad recipients
13779 {>{$rcpt_count}{10}} \
13782 {$recipients_count} \
13783 {${eval:$rcpt_count/2}} \
13788 The condition is true if there have been more than 10 RCPT commands and
13789 fewer than half of them have resulted in a valid recipient.
13791 </listitem></varlistentry>
13793 <term><emphasis role="bold">${expand:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13796 <indexterm role="concept">
13797 <primary>expansion</primary>
13798 <secondary>re-expansion of substring</secondary>
13800 The <option>expand</option> operator causes a string to be expanded for a second time. For
13803 <literallayout class="monospaced">
13804 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
13807 first looks up a string in a file while expanding the operand for <option>expand</option>,
13808 and then re-expands what it has found.
13810 </listitem></varlistentry>
13812 <term><emphasis role="bold">${from_utf8:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13815 <indexterm role="concept">
13816 <primary>Unicode</primary>
13818 <indexterm role="concept">
13819 <primary>UTF-8</primary>
13820 <secondary>conversion from</secondary>
13822 <indexterm role="concept">
13823 <primary>expansion</primary>
13824 <secondary>UTF-8 conversion</secondary>
13826 <indexterm role="concept">
13827 <primary><option>from_utf8</option></primary>
13829 The world is slowly moving towards Unicode, although there are no standards for
13830 email yet. However, other applications (including some databases) are starting
13831 to store data in Unicode, using UTF-8 encoding. This operator converts from a
13832 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
13833 converted to underscores. The input must be a valid UTF-8 string. If it is not,
13834 the result is an undefined sequence of bytes.
13837 Unicode code points with values less than 256 are compatible with ASCII and
13838 ISO-8859-1 (also known as Latin-1).
13839 For example, character 169 is the copyright symbol in both cases, though the
13840 way it is encoded is different. In UTF-8, more than one byte is needed for
13841 characters with code values greater than 127, whereas ISO-8859-1 is a
13842 single-byte encoding (but thereby limited to 256 characters). This makes
13843 translation from UTF-8 to ISO-8859-1 straightforward.
13845 </listitem></varlistentry>
13847 <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>
13850 <indexterm role="concept">
13851 <primary>hash function</primary>
13852 <secondary>textual</secondary>
13854 <indexterm role="concept">
13855 <primary>expansion</primary>
13856 <secondary>textual hash</secondary>
13858 The <option>hash</option> operator is a simpler interface to the hashing function that can
13859 be used when the two parameters are fixed numbers (as opposed to strings that
13860 change when expanded). The effect is the same as
13862 <literallayout class="monospaced">
13863 ${hash{<n>}{<m>}{<string>}}
13866 See the description of the general <option>hash</option> item above for details. The
13867 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
13869 </listitem></varlistentry>
13871 <term><emphasis role="bold">${hex2b64:</emphasis><<emphasis>hexstring</emphasis>><emphasis role="bold">}</emphasis></term>
13874 <indexterm role="concept">
13875 <primary>base64 encoding</primary>
13876 <secondary>conversion from hex</secondary>
13878 <indexterm role="concept">
13879 <primary>expansion</primary>
13880 <secondary>hex to base64</secondary>
13882 <indexterm role="concept">
13883 <primary><option>hex2b64</option></primary>
13885 This operator converts a hex string into one that is base64 encoded. This can
13886 be useful for processing the output of the MD5 and SHA-1 hashing functions.
13888 </listitem></varlistentry>
13890 <term><emphasis role="bold">${lc:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13893 <indexterm role="concept">
13894 <primary>case forcing in strings</primary>
13896 <indexterm role="concept">
13897 <primary>string</primary>
13898 <secondary>case forcing</secondary>
13900 <indexterm role="concept">
13901 <primary>lower casing</primary>
13903 <indexterm role="concept">
13904 <primary>expansion</primary>
13905 <secondary>case forcing</secondary>
13907 <indexterm role="concept">
13908 <primary><option>lc</option> expansion item</primary>
13910 This forces the letters in the string into lower-case, for example:
13912 <literallayout class="monospaced">
13915 </listitem></varlistentry>
13917 <term><emphasis role="bold">${length_</emphasis><<emphasis>number</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13920 <indexterm role="concept">
13921 <primary>expansion</primary>
13922 <secondary>string truncation</secondary>
13924 <indexterm role="concept">
13925 <primary><option>length</option></primary>
13926 <secondary>expansion item</secondary>
13928 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
13929 can be used when the parameter is a fixed number (as opposed to a string that
13930 changes when expanded). The effect is the same as
13932 <literallayout class="monospaced">
13933 ${length{<number>}{<string>}}
13936 See the description of the general <option>length</option> item above for details. Note that
13937 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
13938 when <option>length</option> is used as an operator.
13940 </listitem></varlistentry>
13942 <term><emphasis role="bold">${local_part:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13945 <indexterm role="concept">
13946 <primary>expansion</primary>
13947 <secondary>local part extraction</secondary>
13949 <indexterm role="concept">
13950 <primary><option>local_part</option> expansion item</primary>
13952 The string is interpreted as an RFC 2822 address and the local part is
13953 extracted from it. If the string does not parse successfully, the result is
13956 </listitem></varlistentry>
13958 <term><emphasis role="bold">${mask:</emphasis><<emphasis>IP address</emphasis>><emphasis role="bold">/</emphasis><<emphasis>bit count</emphasis>><emphasis role="bold">}</emphasis></term>
13961 <indexterm role="concept">
13962 <primary>masked IP address</primary>
13964 <indexterm role="concept">
13965 <primary>IP address</primary>
13966 <secondary>masking</secondary>
13968 <indexterm role="concept">
13969 <primary>CIDR notation</primary>
13971 <indexterm role="concept">
13972 <primary>expansion</primary>
13973 <secondary>IP address masking</secondary>
13975 <indexterm role="concept">
13976 <primary><option>mask</option>, expansion item</primary>
13978 If the form of the string to be operated on is not an IP address followed by a
13979 slash and an integer (that is, a network address in CIDR notation), the
13980 expansion fails. Otherwise, this operator converts the IP address to binary,
13981 masks off the least significant bits according to the bit count, and converts
13982 the result back to text, with mask appended. For example,
13984 <literallayout class="monospaced">
13985 ${mask:10.111.131.206/28}
13988 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
13989 be mostly used for looking up masked addresses in files, the result for an IPv6
13990 address uses dots to separate components instead of colons, because colon
13991 terminates a key string in lsearch files. So, for example,
13993 <literallayout class="monospaced">
13994 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
13999 <literallayout class="monospaced">
14000 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
14003 Letters in IPv6 addresses are always output in lower case.
14005 </listitem></varlistentry>
14007 <term><emphasis role="bold">${md5:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14010 <indexterm role="concept">
14011 <primary>MD5 hash</primary>
14013 <indexterm role="concept">
14014 <primary>expansion</primary>
14015 <secondary>MD5 hash</secondary>
14017 <indexterm role="concept">
14018 <primary><option>md5</option> expansion item</primary>
14020 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
14021 as a 32-digit hexadecimal number, in which any letters are in lower case.
14023 </listitem></varlistentry>
14025 <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>
14028 <indexterm role="concept">
14029 <primary>expansion</primary>
14030 <secondary>numeric hash</secondary>
14032 <indexterm role="concept">
14033 <primary>hash function</primary>
14034 <secondary>numeric</secondary>
14036 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
14037 that can be used when the two parameters are fixed numbers (as opposed to
14038 strings that change when expanded). The effect is the same as
14040 <literallayout class="monospaced">
14041 ${nhash{<n>}{<m>}{<string>}}
14044 See the description of the general <option>nhash</option> item above for details.
14046 </listitem></varlistentry>
14048 <term><emphasis role="bold">${quote:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14051 <indexterm role="concept">
14052 <primary>quoting</primary>
14053 <secondary>in string expansions</secondary>
14055 <indexterm role="concept">
14056 <primary>expansion</primary>
14057 <secondary>quoting</secondary>
14059 <indexterm role="concept">
14060 <primary><option>quote</option>, expansion item</primary>
14062 The <option>quote</option> operator puts its argument into double quotes if it
14063 is an empty string or
14064 contains anything other than letters, digits, underscores, dots, and hyphens.
14065 Any occurrences of double quotes and backslashes are escaped with a backslash.
14066 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
14067 respectively For example,
14069 <literallayout class="monospaced">
14075 <literallayout class="monospaced">
14079 The place where this is useful is when the argument is a substitution from a
14080 variable or a message header.
14082 </listitem></varlistentry>
14084 <term><emphasis role="bold">${quote_local_part:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14087 <indexterm role="concept">
14088 <primary><option>quote_local_part</option> expansion item</primary>
14090 This operator is like <option>quote</option>, except that it quotes the string only if
14091 required to do so by the rules of RFC 2822 for quoting local parts. For
14092 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
14093 If you are creating a new email address from the contents of <varname>$local_part</varname>
14094 (or any other unknown data), you should always use this operator.
14096 </listitem></varlistentry>
14098 <term><emphasis role="bold">${quote_</emphasis><<emphasis>lookup-type</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14101 <indexterm role="concept">
14102 <primary>quoting</primary>
14103 <secondary>lookup-specific</secondary>
14105 This operator applies lookup-specific quoting rules to the string. Each
14106 query-style lookup type has its own quoting rules which are described with
14107 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
14109 <literallayout class="monospaced">
14110 ${quote_ldap:two * two}
14115 <literallayout class="monospaced">
14119 For single-key lookup types, no quoting is ever necessary and this operator
14120 yields an unchanged string.
14122 </listitem></varlistentry>
14124 <term><emphasis role="bold">${rfc2047:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14127 <indexterm role="concept">
14128 <primary>expansion</primary>
14129 <secondary>RFC 2047</secondary>
14131 <indexterm role="concept">
14132 <primary>RFC 2047</primary>
14133 <secondary>expansion operator</secondary>
14135 <indexterm role="concept">
14136 <primary><option>rfc2047</option> expansion item</primary>
14138 This operator encodes text according to the rules of RFC 2047. This is an
14139 encoding that is used in header lines to encode non-ASCII characters. It is
14140 assumed that the input string is in the encoding specified by the
14141 <option>headers_charset</option> option, which defaults to ISO-8859-1. If the string
14142 contains only characters in the range 33–126, and no instances of the
14145 <literallayout class="monospaced">
14146 ? = ( ) < > @ , ; : \ " . [ ] _
14149 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
14150 string, using as many <quote>encoded words</quote> as necessary to encode all the
14153 </listitem></varlistentry>
14155 <term><emphasis role="bold">${rxquote:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14158 <indexterm role="concept">
14159 <primary>quoting</primary>
14160 <secondary>in regular expressions</secondary>
14162 <indexterm role="concept">
14163 <primary>regular expressions</primary>
14164 <secondary>quoting</secondary>
14166 <indexterm role="concept">
14167 <primary><option>rxquote</option> expansion item</primary>
14169 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
14170 characters in its argument. This is useful when substituting the values of
14171 variables or headers inside regular expressions.
14173 </listitem></varlistentry>
14175 <term><emphasis role="bold">${sha1:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14178 <indexterm role="concept">
14179 <primary>SHA-1 hash</primary>
14181 <indexterm role="concept">
14182 <primary>expansion</primary>
14183 <secondary>SHA-1 hashing</secondary>
14185 <indexterm role="concept">
14186 <primary><option>sha2</option> expansion item</primary>
14188 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
14189 it as a 40-digit hexadecimal number, in which any letters are in upper case.
14191 </listitem></varlistentry>
14193 <term><emphasis role="bold">${stat:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14196 <indexterm role="concept">
14197 <primary>expansion</primary>
14198 <secondary>statting a file</secondary>
14200 <indexterm role="concept">
14201 <primary>file</primary>
14202 <secondary>extracting characteristics</secondary>
14204 <indexterm role="concept">
14205 <primary><option>stat</option> expansion item</primary>
14207 The string, after expansion, must be a file path. A call to the <function>stat()</function>
14208 function is made for this path. If <function>stat()</function> fails, an error occurs and the
14209 expansion fails. If it succeeds, the data from the stat replaces the item, as a
14210 series of <<emphasis>name</emphasis>>=<<emphasis>value</emphasis>> pairs, where the values are all numerical,
14211 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
14212 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
14213 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
14214 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
14215 can extract individual fields using the <option>extract</option> expansion item.
14218 The use of the <option>stat</option> expansion in users’ filter files can be locked out by
14219 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
14220 systems for files larger than 2GB.
14222 </listitem></varlistentry>
14224 <term><emphasis role="bold">${str2b64:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14227 <indexterm role="concept">
14228 <primary>expansion</primary>
14229 <secondary>base64 encoding</secondary>
14231 <indexterm role="concept">
14232 <primary>base64 encoding</primary>
14233 <secondary>in string expansion</secondary>
14235 <indexterm role="concept">
14236 <primary><option>str2b64</option> expansion item</primary>
14238 This operator converts a string into one that is base64 encoded.
14240 </listitem></varlistentry>
14242 <term><emphasis role="bold">${strlen:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14245 <indexterm role="concept">
14246 <primary>expansion</primary>
14247 <secondary>string length</secondary>
14249 <indexterm role="concept">
14250 <primary>string</primary>
14251 <secondary>length in expansion</secondary>
14253 <indexterm role="concept">
14254 <primary><option>strlen</option> expansion item</primary>
14256 The item is replace by the length of the expanded string, expressed as a
14257 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
14259 </listitem></varlistentry>
14261 <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>
14264 <indexterm role="concept">
14265 <primary><option>substr</option> expansion item</primary>
14267 <indexterm role="concept">
14268 <primary>substring extraction</primary>
14270 <indexterm role="concept">
14271 <primary>expansion</primary>
14272 <secondary>substring expansion</secondary>
14274 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
14275 can be used when the two parameters are fixed numbers (as opposed to strings
14276 that change when expanded). The effect is the same as
14278 <literallayout class="monospaced">
14279 ${substr{<start>}{<length>}{<string>}}
14282 See the description of the general <option>substr</option> item above for details. The
14283 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
14285 </listitem></varlistentry>
14287 <term><emphasis role="bold">${time_eval:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14290 <indexterm role="concept">
14291 <primary><option>time_eval</option> expansion item</primary>
14293 <indexterm role="concept">
14294 <primary>time interval</primary>
14295 <secondary>decoding</secondary>
14297 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
14300 </listitem></varlistentry>
14302 <term><emphasis role="bold">${time_interval:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14305 <indexterm role="concept">
14306 <primary><option>time_interval</option> expansion item</primary>
14308 <indexterm role="concept">
14309 <primary>time interval</primary>
14310 <secondary>formatting</secondary>
14312 The argument (after sub-expansion) must be a sequence of decimal digits that
14313 represents an interval of time as a number of seconds. It is converted into a
14314 number of larger units and output in Exim’s normal time format, for example,
14315 <literal>1w3d4h2m6s</literal>.
14317 </listitem></varlistentry>
14319 <term><emphasis role="bold">${uc:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14322 <indexterm role="concept">
14323 <primary>case forcing in strings</primary>
14325 <indexterm role="concept">
14326 <primary>string</primary>
14327 <secondary>case forcing</secondary>
14329 <indexterm role="concept">
14330 <primary>upper casing</primary>
14332 <indexterm role="concept">
14333 <primary>expansion</primary>
14334 <secondary>case forcing</secondary>
14336 <indexterm role="concept">
14337 <primary><option>uc</option> expansion item</primary>
14339 This forces the letters in the string into upper-case.
14341 </listitem></varlistentry>
14344 <section id="SECTexpcond">
14345 <title>Expansion conditions</title>
14347 <indexterm role="concept" id="IIDexpcond" class="startofrange">
14348 <primary>expansion</primary>
14349 <secondary>conditions</secondary>
14351 The following conditions are available for testing by the <option>${if</option> construct
14352 while expanding strings:
14356 <term><emphasis role="bold">!</emphasis><<emphasis>condition</emphasis>></term>
14359 <indexterm role="concept">
14360 <primary>expansion</primary>
14361 <secondary>negating a condition</secondary>
14363 <indexterm role="concept">
14364 <primary>negation</primary>
14365 <secondary>in expansion condition</secondary>
14367 Preceding any condition with an exclamation mark negates the result of the
14370 </listitem></varlistentry>
14372 <term><<emphasis>symbolic operator</emphasis>> <emphasis role="bold">{</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14375 <indexterm role="concept">
14376 <primary>numeric comparison</primary>
14378 <indexterm role="concept">
14379 <primary>expansion</primary>
14380 <secondary>numeric comparison</secondary>
14382 There are a number of symbolic operators for doing numeric comparisons. They
14386 <literal>= </literal> equal
14387 <literal>== </literal> equal
14388 <literal>> </literal> greater
14389 <literal>>= </literal> greater or equal
14390 <literal>< </literal> less
14391 <literal><= </literal> less or equal
14396 <literallayout class="monospaced">
14397 ${if >{$message_size}{10M} ...
14400 Note that the general negation operator provides for inequality testing. The
14401 two strings must take the form of optionally signed decimal integers,
14402 optionally followed by one of the letters <quote>K</quote> or <quote>M</quote> (in either upper or
14403 lower case), signifying multiplication by 1024 or 1024*1024, respectively.
14405 </listitem></varlistentry>
14407 <term><emphasis role="bold">crypteq {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14410 <indexterm role="concept">
14411 <primary>expansion</primary>
14412 <secondary>encrypted comparison</secondary>
14414 <indexterm role="concept">
14415 <primary>encrypted strings</primary>
14416 <secondary>comparing</secondary>
14418 <indexterm role="concept">
14419 <primary><option>crypteq</option> expansion condition</primary>
14421 This condition is included in the Exim binary if it is built to support any
14422 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
14423 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
14424 included in the binary.
14427 The <option>crypteq</option> condition has two arguments. The first is encrypted and
14428 compared against the second, which is already encrypted. The second string may
14429 be in the LDAP form for storing encrypted strings, which starts with the
14430 encryption type in curly brackets, followed by the data. If the second string
14431 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
14432 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
14433 Typically this will be a field from a password file. An example of an encrypted
14434 string in LDAP form is:
14436 <literallayout class="monospaced">
14437 {md5}CY9rzUYh03PK3k6DJie09g==
14440 If such a string appears directly in an expansion, the curly brackets have to
14441 be quoted, because they are part of the expansion syntax. For example:
14443 <literallayout class="monospaced">
14444 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
14447 The following encryption types (whose names are matched case-independently) are
14453 <indexterm role="concept">
14454 <primary>MD5 hash</primary>
14456 <indexterm role="concept">
14457 <primary>base64 encoding</primary>
14458 <secondary>in encrypted password</secondary>
14460 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
14461 printable characters to compare with the remainder of the second string. If the
14462 length of the comparison string is 24, Exim assumes that it is base64 encoded
14463 (as in the above example). If the length is 32, Exim assumes that it is a
14464 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
14470 <indexterm role="concept">
14471 <primary>SHA-1 hash</primary>
14473 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
14474 printable characters to compare with the remainder of the second string. If the
14475 length of the comparison string is 28, Exim assumes that it is base64 encoded.
14476 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
14477 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
14482 <indexterm role="concept">
14483 <primary><function>crypt()</function></primary>
14485 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
14486 only the first eight characters of the password. However, in modern operating
14487 systems this is no longer true, and in many cases the entire password is used,
14488 whatever its length.
14492 <para revisionflag="changed">
14493 <indexterm role="concept">
14494 <primary><function>crypt16()</function></primary>
14496 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was orginally created to
14497 use up to 16 characters of the password in some operating systems. Again, in
14498 modern operating systems, more characters may be used.
14502 <para revisionflag="changed">
14503 Exim has its own version of <function>crypt16()</function>, which is just a double call to
14504 <function>crypt()</function>. For operating systems that have their own version, setting
14505 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
14506 operating system version instead of its own. This option is set by default in
14507 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
14508 support <function>crypt16()</function>.
14510 <para revisionflag="changed">
14511 Some years after Exim’s <function>crypt16()</function> was implemented, a user discovered that
14512 it was not using the same algorithm as some operating systems’ versions. It
14513 turns out that as well as <function>crypt16()</function> there is a function called
14514 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
14515 algorithm, and both of them may be different to Exim’s built-in <function>crypt16()</function>.
14517 <para revisionflag="changed">
14518 However, since there is now a move away from the traditional <function>crypt()</function>
14519 functions towards using SHA1 and other algorithms, tidying up this area of
14520 Exim is seen as very low priority.
14522 <para revisionflag="changed">
14523 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
14524 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
14525 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
14526 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
14527 function by specifying it explicitly in curly brackets.
14529 </listitem></varlistentry>
14531 <term><emphasis role="bold">def:</emphasis><<emphasis>variable name</emphasis>></term>
14534 <indexterm role="concept">
14535 <primary>expansion</primary>
14536 <secondary>checking for empty variable</secondary>
14538 <indexterm role="concept">
14539 <primary><option>def</option> expansion condition</primary>
14541 The <option>def</option> condition must be followed by the name of one of the expansion
14542 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
14543 variable does not contain the empty string. For example:
14545 <literallayout class="monospaced">
14546 ${if def:sender_ident {from $sender_ident}}
14549 Note that the variable name is given without a leading <option>$</option> character. If the
14550 variable does not exist, the expansion fails.
14552 </listitem></varlistentry>
14554 <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>
14557 <indexterm role="concept">
14558 <primary>expansion</primary>
14559 <secondary>checking header line existence</secondary>
14561 This condition is true if a message is being processed and the named header
14562 exists in the message. For example,
14564 <literallayout class="monospaced">
14565 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
14568 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
14569 the header name must be terminated by a colon if white space does not follow.
14571 </listitem></varlistentry>
14573 <term><emphasis role="bold">eq {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14576 <indexterm role="concept">
14577 <primary>string</primary>
14578 <secondary>comparison</secondary>
14580 <indexterm role="concept">
14581 <primary>expansion</primary>
14582 <secondary>string comparison</secondary>
14584 <indexterm role="concept">
14585 <primary><option>eq</option> expansion condition</primary>
14587 The two substrings are first expanded. The condition is true if the two
14588 resulting strings are identical, including the case of letters.
14590 </listitem></varlistentry>
14592 <term><emphasis role="bold">eqi {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14595 <indexterm role="concept">
14596 <primary>string</primary>
14597 <secondary>comparison</secondary>
14599 <indexterm role="concept">
14600 <primary>expansion</primary>
14601 <secondary>string comparison</secondary>
14603 <indexterm role="concept">
14604 <primary><option>eqi</option> expansion condition</primary>
14606 The two substrings are first expanded. The condition is true if the two
14607 resulting strings are identical when compared in a case-independent way.
14609 </listitem></varlistentry>
14611 <term><emphasis role="bold">exists {</emphasis><<emphasis>file name</emphasis>><emphasis role="bold">}</emphasis></term>
14614 <indexterm role="concept">
14615 <primary>expansion</primary>
14616 <secondary>file existence test</secondary>
14618 <indexterm role="concept">
14619 <primary>file</primary>
14620 <secondary>existence test</secondary>
14622 <indexterm role="concept">
14623 <primary><option>exists</option>, expansion condition</primary>
14625 The substring is first expanded and then interpreted as an absolute path. The
14626 condition is true if the named file (or directory) exists. The existence test
14627 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
14628 users’ filter files may be locked out by the system administrator.
14630 </listitem></varlistentry>
14632 <term><emphasis role="bold">first_delivery</emphasis></term>
14635 <indexterm role="concept">
14636 <primary>delivery</primary>
14637 <secondary>first</secondary>
14639 <indexterm role="concept">
14640 <primary>first delivery</primary>
14642 <indexterm role="concept">
14643 <primary>expansion</primary>
14644 <secondary>first delivery test</secondary>
14646 <indexterm role="concept">
14647 <primary><option>first_delivery</option> expansion condition</primary>
14649 This condition, which has no data, is true during a message’s first delivery
14650 attempt. It is false during any subsequent delivery attempts.
14652 </listitem></varlistentry>
14654 <term><emphasis role="bold">ge {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14657 <indexterm role="concept">
14658 <primary><option>ge</option> expansion condition</primary>
14660 See <emphasis role="bold">gei</emphasis>.
14662 </listitem></varlistentry>
14664 <term><emphasis role="bold">gei {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14667 <indexterm role="concept">
14668 <primary>string</primary>
14669 <secondary>comparison</secondary>
14671 <indexterm role="concept">
14672 <primary>expansion</primary>
14673 <secondary>string comparison</secondary>
14675 <indexterm role="concept">
14676 <primary><option>gei</option> expansion condition</primary>
14678 The two substrings are first expanded. The condition is true if the first
14679 string is lexically greater than or equal to the second string: for <option>ge</option> the
14680 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
14683 </listitem></varlistentry>
14685 <term><emphasis role="bold">gt {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14688 <indexterm role="concept">
14689 <primary><option>gt</option> expansion condition</primary>
14691 See <emphasis role="bold">gti</emphasis>.
14693 </listitem></varlistentry>
14695 <term><emphasis role="bold">gti {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14698 <indexterm role="concept">
14699 <primary>string</primary>
14700 <secondary>comparison</secondary>
14702 <indexterm role="concept">
14703 <primary>expansion</primary>
14704 <secondary>string comparison</secondary>
14706 <indexterm role="concept">
14707 <primary><option>gti</option> expansion condition</primary>
14709 The two substrings are first expanded. The condition is true if the first
14710 string is lexically greater than the second string: for <option>gt</option> the comparison
14711 includes the case of letters, whereas for <option>gti</option> the comparison is
14714 </listitem></varlistentry>
14716 <term><emphasis role="bold">isip {</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14719 <indexterm role="concept">
14720 <primary><option>isip</option> expansion condition</primary>
14722 See <emphasis role="bold">isip6</emphasis>.
14724 </listitem></varlistentry>
14726 <term><emphasis role="bold">isip4 {</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14729 <indexterm role="concept">
14730 <primary><option>isip4</option> expansion condition</primary>
14732 See <emphasis role="bold">isip6</emphasis>.
14734 </listitem></varlistentry>
14736 <term><emphasis role="bold">isip6 {</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14739 <indexterm role="concept">
14740 <primary>IP address</primary>
14741 <secondary>testing string format</secondary>
14743 <indexterm role="concept">
14744 <primary>string</primary>
14745 <secondary>testing for IP address</secondary>
14747 <indexterm role="concept">
14748 <primary><option>isip6</option> expansion condition</primary>
14750 The substring is first expanded, and then tested to see if it has the form of
14751 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
14752 <option>isip4</option> and <option>isip6</option> test just for IPv4 or IPv6 addresses, respectively. For
14753 example, you could use
14755 <literallayout class="monospaced">
14756 ${if isip4{$sender_host_address}...
14759 to test which version of IP an incoming SMTP connection is using.
14761 </listitem></varlistentry>
14763 <term><emphasis role="bold">ldapauth {</emphasis><<emphasis>ldap query</emphasis>><emphasis role="bold">}</emphasis></term>
14766 <indexterm role="concept">
14767 <primary>LDAP</primary>
14768 <secondary>use for authentication</secondary>
14770 <indexterm role="concept">
14771 <primary>expansion</primary>
14772 <secondary>LDAP authentication test</secondary>
14774 <indexterm role="concept">
14775 <primary><option>ldapauth</option> expansion condition</primary>
14777 This condition supports user authentication using LDAP. See section
14778 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
14779 queries. For this use, the query must contain a user name and password. The
14780 query itself is not used, and can be empty. The condition is true if the
14781 password is not empty, and the user name and password are accepted by the LDAP
14782 server. An empty password is rejected without calling LDAP because LDAP binds
14783 with an empty password are considered anonymous regardless of the username, and
14784 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
14785 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
14788 </listitem></varlistentry>
14790 <term><emphasis role="bold">le {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14793 <indexterm role="concept">
14794 <primary><option>le</option> expansion condition</primary>
14796 See <emphasis role="bold">lei</emphasis>.
14798 </listitem></varlistentry>
14800 <term><emphasis role="bold">lei {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14803 <indexterm role="concept">
14804 <primary>string</primary>
14805 <secondary>comparison</secondary>
14807 <indexterm role="concept">
14808 <primary>expansion</primary>
14809 <secondary>string comparison</secondary>
14811 <indexterm role="concept">
14812 <primary><option>lei</option> expansion condition</primary>
14814 The two substrings are first expanded. The condition is true if the first
14815 string is lexically less than or equal to the second string: for <option>le</option> the
14816 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
14819 </listitem></varlistentry>
14821 <term><emphasis role="bold">lt {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14824 <indexterm role="concept">
14825 <primary><option>lt</option> expansion condition</primary>
14827 See <emphasis role="bold">lti</emphasis>.
14829 </listitem></varlistentry>
14831 <term><emphasis role="bold">lti {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14834 <indexterm role="concept">
14835 <primary>string</primary>
14836 <secondary>comparison</secondary>
14838 <indexterm role="concept">
14839 <primary>expansion</primary>
14840 <secondary>string comparison</secondary>
14842 <indexterm role="concept">
14843 <primary><option>lti</option> expansion condition</primary>
14845 The two substrings are first expanded. The condition is true if the first
14846 string is lexically less than the second string: for <option>lt</option> the comparison
14847 includes the case of letters, whereas for <option>lti</option> the comparison is
14850 </listitem></varlistentry>
14852 <term><emphasis role="bold">match {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14855 <indexterm role="concept">
14856 <primary>expansion</primary>
14857 <secondary>regular expression comparison</secondary>
14859 <indexterm role="concept">
14860 <primary>regular expressions</primary>
14861 <secondary>match in expanded string</secondary>
14863 <indexterm role="concept">
14864 <primary><option>match</option>, expansion condition</primary>
14866 The two substrings are first expanded. The second is then treated as a regular
14867 expression and applied to the first. Because of the pre-expansion, if the
14868 regular expression contains dollar, or backslash characters, they must be
14869 escaped. Care must also be taken if the regular expression contains braces
14870 (curly brackets). A closing brace must be escaped so that it is not taken as a
14871 premature termination of <<emphasis>string2</emphasis>>. The easiest approach is to use the
14872 <literal>\N</literal> feature to disable expansion of the regular expression.
14875 <literallayout class="monospaced">
14876 ${if match {$local_part}{\N^\d{3}\N} ...
14879 If the whole expansion string is in double quotes, further escaping of
14880 backslashes is also required.
14883 The condition is true if the regular expression match succeeds.
14884 The regular expression is not required to begin with a circumflex
14885 metacharacter, but if there is no circumflex, the expression is not anchored,
14886 and it may match anywhere in the subject, not just at the start. If you want
14887 the pattern to match at the end of the subject, you must include the <literal>$</literal>
14888 metacharacter at an appropriate point.
14891 <indexterm role="concept">
14892 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
14893 <secondary>in <option>if</option> expansion</secondary>
14895 At the start of an <option>if</option> expansion the values of the numeric variable
14896 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
14897 succeeds causes them to be reset to the substrings of that condition and they
14898 will have these values during the expansion of the success string. At the end
14899 of the <option>if</option> expansion, the previous values are restored. After testing a
14900 combination of conditions using <option>or</option>, the subsequent values of the numeric
14901 variables are those of the condition that succeeded.
14903 </listitem></varlistentry>
14905 <term><emphasis role="bold">match_address {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14908 <indexterm role="concept">
14909 <primary><option>match_address</option> expansion condition</primary>
14911 See <emphasis role="bold">match_local_part</emphasis>.
14913 </listitem></varlistentry>
14915 <term><emphasis role="bold">match_domain {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14918 <indexterm role="concept">
14919 <primary><option>match_domain</option> expansion condition</primary>
14921 See <emphasis role="bold">match_local_part</emphasis>.
14923 </listitem></varlistentry>
14925 <term><emphasis role="bold">match_ip {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14928 <indexterm role="concept">
14929 <primary><option>match_ip</option> expansion condition</primary>
14931 This condition matches an IP address to a list of IP address patterns. It must
14932 be followed by two argument strings. The first (after expansion) must be an IP
14933 address or an empty string. The second (after expansion) is a restricted host
14934 list that can match only an IP address, not a host name. For example:
14936 <literallayout class="monospaced">
14937 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
14940 The specific types of host list item that are permitted in the list are:
14945 An IP address, optionally with a CIDR mask.
14950 A single asterisk, which matches any IP address.
14955 An empty item, which matches only if the IP address is empty. This could be
14956 useful for testing for a locally submitted message or one from specific hosts
14957 in a single test such as
14959 <literallayout class="monospaced">
14960 ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
14963 where the first item in the list is the empty string.
14968 The item @[] matches any of the local host’s interface addresses.
14973 Lookups are assumed to be <quote>net-</quote> style lookups, even if <literal>net-</literal> is not
14974 specified. Thus, the following are equivalent:
14976 <literallayout class="monospaced">
14977 ${if match_ip{$sender_host_address}{lsearch;/some/file}...
14978 ${if match_ip{$sender_host_address}{net-lsearch;/some/file}...
14981 You do need to specify the <literal>net-</literal> prefix if you want to specify a
14982 specific address mask, for example, by using <literal>net24-</literal>. However, unless you
14983 are combining a <option>match_ip</option> condition with others, it is usually neater to use
14984 an expansion lookup such as:
14986 <literallayout class="monospaced">
14987 ${lookup{${mask:$sender_host_address/24}}lsearch{/some/file}...
14992 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
14994 </listitem></varlistentry>
14996 <term><emphasis role="bold">match_local_part {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14999 <indexterm role="concept">
15000 <primary>domain list</primary>
15001 <secondary>in expansion condition</secondary>
15003 <indexterm role="concept">
15004 <primary>address list</primary>
15005 <secondary>in expansion condition</secondary>
15007 <indexterm role="concept">
15008 <primary>local part list</primary>
15009 <secondary>in expansion condition</secondary>
15011 <indexterm role="concept">
15012 <primary><option>match_local_part</option> expansion condition</primary>
15014 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
15015 possible to test domain, address, and local part lists within expansions. Each
15016 condition requires two arguments: an item and a list to match. A trivial
15019 <literallayout class="monospaced">
15020 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
15023 In each case, the second argument may contain any of the allowable items for a
15024 list of the appropriate type. Also, because the second argument (after
15025 expansion) is a standard form of list, it is possible to refer to a named list.
15026 Thus, you can use conditions like this:
15028 <literallayout class="monospaced">
15029 ${if match_domain{$domain}{+local_domains}{...
15032 <indexterm role="concept">
15033 <primary><literal>+caseful</literal></primary>
15035 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
15036 item can be used, as in all address lists, to cause subsequent items to
15037 have their local parts matched casefully. Domains are always matched
15041 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
15042 hosts have two identities: a name and an IP address, and it is not clear
15043 how to specify cleanly how such a test would work. However, IP addresses can be
15044 matched using <option>match_ip</option>.
15046 </listitem></varlistentry>
15048 <term><emphasis role="bold">pam {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">:...}</emphasis></term>
15051 <indexterm role="concept">
15052 <primary>PAM authentication</primary>
15054 <indexterm role="concept">
15055 <primary>AUTH</primary>
15056 <secondary>with PAM</secondary>
15058 <indexterm role="concept">
15059 <primary>Solaris</primary>
15060 <secondary>PAM support</secondary>
15062 <indexterm role="concept">
15063 <primary>expansion</primary>
15064 <secondary>PAM authentication test</secondary>
15066 <indexterm role="concept">
15067 <primary><option>pam</option> expansion condition</primary>
15069 <emphasis>Pluggable Authentication Modules</emphasis>
15070 (<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
15071 available in the latest releases of Solaris and in some GNU/Linux
15072 distributions. The Exim support, which is intended for use in conjunction with
15073 the SMTP AUTH command, is available only if Exim is compiled with
15075 <literallayout class="monospaced">
15079 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
15080 in some releases of GNU/Linux <option>-ldl</option> is also needed.
15083 The argument string is first expanded, and the result must be a
15084 colon-separated list of strings. Leading and trailing white space is ignored.
15085 The PAM module is initialized with the service name <quote>exim</quote> and the user name
15086 taken from the first item in the colon-separated data string (<<emphasis>string1</emphasis>>).
15087 The remaining items in the data string are passed over in response to requests
15088 from the authentication function. In the simple case there will only be one
15089 request, for a password, so the data consists of just two strings.
15092 There can be problems if any of the strings are permitted to contain colon
15093 characters. In the usual way, these have to be doubled to avoid being taken as
15094 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
15095 item can be used to double any existing colons. For example, the configuration
15096 of a LOGIN authenticator might contain this setting:
15098 <literallayout class="monospaced">
15099 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
15102 For a PLAIN authenticator you could use:
15104 <literallayout class="monospaced">
15105 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
15108 In some operating systems, PAM authentication can be done only from a process
15109 running as root. Since Exim is running as the Exim user when receiving
15110 messages, this means that PAM cannot be used directly in those systems.
15111 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
15112 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>.
15113 The patched module allows one special uid/gid combination, in addition to root,
15114 to authenticate. If you build the patched module to allow the Exim user and
15115 group, PAM can then be used from an Exim authenticator.
15117 </listitem></varlistentry>
15119 <term><emphasis role="bold">pwcheck {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15122 <indexterm role="concept">
15123 <primary><emphasis>pwcheck</emphasis> daemon</primary>
15125 <indexterm role="concept">
15126 <primary>Cyrus</primary>
15128 <indexterm role="concept">
15129 <primary>expansion</primary>
15130 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
15132 <indexterm role="concept">
15133 <primary><option>pwcheck</option> expansion condition</primary>
15135 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
15136 This is one way of making it possible for passwords to be checked by a process
15137 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
15138 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
15141 The pwcheck support is not included in Exim by default. You need to specify
15142 the location of the pwcheck daemon’s socket in <filename>Local/Makefile</filename> before
15143 building Exim. For example:
15145 <literallayout class="monospaced">
15146 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
15149 You do not need to install the full Cyrus software suite in order to use
15150 the pwcheck daemon. You can compile and install just the daemon alone
15151 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
15152 access to the <filename>/var/pwcheck</filename> directory.
15155 The <option>pwcheck</option> condition takes one argument, which must be the user name and
15156 password, separated by a colon. For example, in a LOGIN authenticator
15157 configuration, you might have this:
15159 <literallayout class="monospaced">
15160 server_condition = ${if pwcheck{$auth1:$auth2}}
15162 </listitem></varlistentry>
15164 <term><emphasis role="bold">queue_running</emphasis></term>
15167 <indexterm role="concept">
15168 <primary>queue runner</primary>
15169 <secondary>detecting when delivering from</secondary>
15171 <indexterm role="concept">
15172 <primary>expansion</primary>
15173 <secondary>queue runner test</secondary>
15175 <indexterm role="concept">
15176 <primary><option>queue_runnint</option> expansion condition</primary>
15178 This condition, which has no data, is true during delivery attempts that are
15179 initiated by queue runner processes, and false otherwise.
15181 </listitem></varlistentry>
15183 <term><emphasis role="bold">radius {</emphasis><<emphasis>authentication string</emphasis>><emphasis role="bold">}</emphasis></term>
15186 <indexterm role="concept">
15187 <primary>Radius</primary>
15189 <indexterm role="concept">
15190 <primary>expansion</primary>
15191 <secondary>Radius authentication</secondary>
15193 <indexterm role="concept">
15194 <primary><option>radius</option> expansion condition</primary>
15196 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
15197 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
15198 the Radius client configuration file in order to build Exim with Radius
15202 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
15203 library, using the original API. If you are using release 0.4.0 or later of
15204 this library, you need to set
15206 <literallayout class="monospaced">
15207 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
15210 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
15211 <option>libradius</option> library that comes with FreeBSD. To do this, set
15213 <literallayout class="monospaced">
15214 RADIUS_LIB_TYPE=RADLIB
15217 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
15218 You may also have to supply a suitable setting in EXTRALIBS so that the
15219 Radius library can be found when Exim is linked.
15222 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
15223 Radius client library, which calls the Radius server. The condition is true if
15224 the authentication is successful. For example:
15226 <literallayout class="monospaced">
15227 server_condition = ${if radius{<arguments>}}
15229 </listitem></varlistentry>
15231 <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>
15234 <indexterm role="concept">
15235 <primary><emphasis>saslauthd</emphasis> daemon</primary>
15237 <indexterm role="concept">
15238 <primary>Cyrus</primary>
15240 <indexterm role="concept">
15241 <primary>expansion</primary>
15242 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
15244 <indexterm role="concept">
15245 <primary><option>saslauthd</option> expansion condition</primary>
15247 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
15248 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
15249 Using this daemon is one way of making it possible for passwords to be checked
15250 by a process that is not running as root.
15253 The saslauthd support is not included in Exim by default. You need to specify
15254 the location of the saslauthd daemon’s socket in <filename>Local/Makefile</filename> before
15255 building Exim. For example:
15257 <literallayout class="monospaced">
15258 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
15261 You do not need to install the full Cyrus software suite in order to use
15262 the saslauthd daemon. You can compile and install just the daemon alone
15263 from the Cyrus SASL library.
15266 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
15267 two are mandatory. For example:
15269 <literallayout class="monospaced">
15270 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
15273 The service and the realm are optional (which is why the arguments are enclosed
15274 in their own set of braces). For details of the meaning of the service and
15275 realm, and how to run the daemon, consult the Cyrus documentation.
15277 </listitem></varlistentry>
15281 <title>Combining expansion conditions</title>
15283 <indexterm role="concept">
15284 <primary>expansion</primary>
15285 <secondary>combining conditions</secondary>
15287 Several conditions can be tested at once by combining them using the <option>and</option>
15288 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
15289 conditions on their own, and precede their lists of sub-conditions. Each
15290 sub-condition must be enclosed in braces within the overall braces that contain
15291 the list. No repetition of <option>if</option> is used.
15295 <term><emphasis role="bold">or {{</emphasis><<emphasis>cond1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>cond2</emphasis>><emphasis role="bold">}...}</emphasis></term>
15298 <indexterm role="concept">
15299 <primary><quote>or</quote> expansion condition</primary>
15301 <indexterm role="concept">
15302 <primary>expansion</primary>
15303 <secondary><quote>or</quote> of conditions</secondary>
15305 The sub-conditions are evaluated from left to right. The condition is true if
15306 any one of the sub-conditions is true.
15309 <literallayout class="monospaced">
15310 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
15313 When a true sub-condition is found, the following ones are parsed but not
15314 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
15315 numeric variables afterwards are taken from the first one that succeeds.
15317 </listitem></varlistentry>
15319 <term><emphasis role="bold">and {{</emphasis><<emphasis>cond1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>cond2</emphasis>><emphasis role="bold">}...}</emphasis></term>
15322 <indexterm role="concept">
15323 <primary><quote>and</quote> expansion condition</primary>
15325 <indexterm role="concept">
15326 <primary>expansion</primary>
15327 <secondary><quote>and</quote> of conditions</secondary>
15329 The sub-conditions are evaluated from left to right. The condition is true if
15330 all of the sub-conditions are true. If there are several <quote>match</quote>
15331 sub-conditions, the values of the numeric variables afterwards are taken from
15332 the last one. When a false sub-condition is found, the following ones are
15333 parsed but not evaluated.
15335 </listitem></varlistentry>
15338 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
15341 <section id="SECTexpvar">
15342 <title>Expansion variables</title>
15344 <indexterm role="concept">
15345 <primary>expansion variables</primary>
15346 <secondary>list of</secondary>
15348 This section contains an alphabetical list of all the expansion variables. Some
15349 of them are available only when Exim is compiled with specific options such as
15350 support for TLS or the content scanning extension.
15354 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
15357 <indexterm role="concept">
15358 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15360 When a <option>match</option> expansion condition succeeds, these variables contain the
15361 captured substrings identified by the regular expression during subsequent
15362 processing of the success string of the containing <option>if</option> expansion item. They
15363 may also be set externally by some other matching process which precedes the
15364 expansion of the string. For example, the commands available in Exim filter
15365 files include an <option>if</option> command with its own regular expression matching
15368 </listitem></varlistentry>
15370 <term><varname>$acl_c0</varname> – <varname>$acl_c19</varname></term>
15373 Values can be placed in these variables by the <option>set</option> modifier in an ACL. The
15374 values persist throughout the lifetime of an SMTP connection. They can be used
15375 to pass information between ACLs and between different invocations of the same
15376 ACL. When a message is received, the values of these variables are saved with
15377 the message, and can be accessed by filters, routers, and transports during
15378 subsequent delivery.
15380 </listitem></varlistentry>
15382 <term><varname>$acl_m0</varname> – <varname>$acl_m19</varname></term>
15385 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
15386 retain their values while a message is being received, but are reset
15387 afterwards. They are also reset by MAIL, RSET, EHLO, HELO, and after starting a
15388 TLS session. When a message is received, the values of these variables are
15389 saved with the message, and can be accessed by filters, routers, and transports
15390 during subsequent delivery.
15392 </listitem></varlistentry>
15394 <term><varname>$acl_verify_message</varname></term>
15397 <indexterm role="concept">
15398 <primary><varname>$acl_verify_message</varname></primary>
15400 After an address verification has failed, this variable contains the failure
15401 message. It retains its value for use in subsequent modifiers. The message can
15402 be preserved by coding like this:
15404 <literallayout class="monospaced">
15405 warn !verify = sender
15406 set acl_m0 = $acl_verify_message
15409 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
15410 <option>log_message</option> modifiers, to include information about the verification
15413 </listitem></varlistentry>
15415 <term><varname>$address_data</varname></term>
15418 <indexterm role="concept">
15419 <primary><varname>$address_data</varname></primary>
15421 This variable is set by means of the <option>address_data</option> option in routers. The
15422 value then remains with the address while it is processed by subsequent routers
15423 and eventually a transport. If the transport is handling multiple addresses,
15424 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
15425 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
15429 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
15430 a recipient address, the final value is still in the variable for subsequent
15431 conditions and modifiers of the ACL statement. If routing the address caused it
15432 to be redirected to just one address, the child address is also routed as part
15433 of the verification, and in this case the final value of <varname>$address_data</varname> is
15434 from the child’s routing.
15437 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
15438 sender address, the final value is also preserved, but this time in
15439 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
15443 In both cases (recipient and sender verification), the value does not persist
15444 after the end of the current ACL statement. If you want to preserve
15445 these values for longer, you can save them in ACL variables.
15447 </listitem></varlistentry>
15449 <term><varname>$address_file</varname></term>
15452 <indexterm role="concept">
15453 <primary><varname>$address_file</varname></primary>
15455 When, as a result of aliasing, forwarding, or filtering, a message is directed
15456 to a specific file, this variable holds the name of the file when the transport
15457 is running. At other times, the variable is empty. For example, using the
15458 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
15460 <literallayout class="monospaced">
15461 /home/r2d2/savemail
15464 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
15465 contains <quote>/home/r2d2/savemail</quote>.
15468 <indexterm role="concept">
15469 <primary>Sieve filter</primary>
15470 <secondary>value of <varname>$address_file</varname></secondary>
15472 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
15473 then up to the transport configuration to generate an appropriate absolute path
15474 to the relevant file.
15476 </listitem></varlistentry>
15478 <term><varname>$address_pipe</varname></term>
15481 <indexterm role="concept">
15482 <primary><varname>$address_pipe</varname></primary>
15484 When, as a result of aliasing or forwarding, a message is directed to a pipe,
15485 this variable holds the pipe command when the transport is running.
15487 </listitem></varlistentry>
15489 <term><varname>$auth1</varname> – <varname>$auth3</varname></term>
15492 <indexterm role="concept">
15493 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
15495 These variables are used in SMTP authenticators (see chapters
15496 <xref linkend="CHAPplaintext"/>–<xref linkend="CHAPspa"/>). Elsewhere, they are empty.
15498 </listitem></varlistentry>
15500 <term><varname>$authenticated_id</varname></term>
15503 <indexterm role="concept">
15504 <primary>authentication</primary>
15505 <secondary>id</secondary>
15507 <indexterm role="concept">
15508 <primary><varname>$authenticated_id</varname></primary>
15510 When a server successfully authenticates a client it may be configured to
15511 preserve some of the authentication information in the variable
15512 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
15513 user/password authenticator configuration might preserve the user name for use
15514 in the routers. Note that this is not the same information that is saved in
15515 <varname>$sender_host_authenticated</varname>.
15516 When a message is submitted locally (that is, not over a TCP connection)
15517 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
15518 process. However, a trusted user can override this by means of the <option>-oMai</option>
15519 command line option.
15521 </listitem></varlistentry>
15523 <term><varname>$authenticated_sender</varname></term>
15526 <indexterm role="concept">
15527 <primary>sender</primary>
15528 <secondary>authenticated</secondary>
15530 <indexterm role="concept">
15531 <primary>authentication</primary>
15532 <secondary>sender</secondary>
15534 <indexterm role="concept">
15535 <primary>AUTH</primary>
15536 <secondary>on MAIL command</secondary>
15538 <indexterm role="concept">
15539 <primary><varname>$authenticated_sender</varname></primary>
15541 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
15542 SMTP MAIL command if it believes the sender is sufficiently trusted, as
15543 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
15544 <quote><></quote>, it is set as the authenticated sender of the message, and the value is
15545 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
15546 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
15549 <indexterm role="concept">
15550 <primary><varname>$qualify_domain</varname></primary>
15552 When a message is submitted locally (that is, not over a TCP connection), the
15553 value of <varname>$authenticated_sender</varname> is an address constructed from the login
15554 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
15555 can override this by means of the <option>-oMas</option> command line option.
15557 </listitem></varlistentry>
15559 <term><varname>$authentication_failed</varname></term>
15562 <indexterm role="concept">
15563 <primary>authentication</primary>
15564 <secondary>failure</secondary>
15566 <indexterm role="concept">
15567 <primary><varname>$authentication_failed</varname></primary>
15569 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
15570 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
15571 possible to distinguish between <quote>did not try to authenticate</quote>
15572 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
15573 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
15574 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
15575 negative response to an AUTH command, including (for example) an attempt to use
15576 an undefined mechanism.
15578 </listitem></varlistentry>
15580 <term><varname>$body_linecount</varname></term>
15583 <indexterm role="concept">
15584 <primary>message body</primary>
15585 <secondary>line count</secondary>
15587 <indexterm role="concept">
15588 <primary>body of message</primary>
15589 <secondary>line count</secondary>
15591 <indexterm role="concept">
15592 <primary><varname>$body_linecount</varname></primary>
15594 When a message is being received or delivered, this variable contains the
15595 number of lines in the message’s body. See also <varname>$message_linecount</varname>.
15597 </listitem></varlistentry>
15599 <term><varname>$body_zerocount</varname></term>
15602 <indexterm role="concept">
15603 <primary>message body</primary>
15604 <secondary>binary zero count</secondary>
15606 <indexterm role="concept">
15607 <primary>body of message</primary>
15608 <secondary>binary zero count</secondary>
15610 <indexterm role="concept">
15611 <primary>binary zero</primary>
15612 <secondary>in message body</secondary>
15614 <indexterm role="concept">
15615 <primary><varname>$body_zerocount</varname></primary>
15617 When a message is being received or delivered, this variable contains the
15618 number of binary zero bytes in the message’s body.
15620 </listitem></varlistentry>
15622 <term><varname>$bounce_recipient</varname></term>
15625 <indexterm role="concept">
15626 <primary><varname>$bounce_recipient</varname></primary>
15628 This is set to the recipient address of a bounce message while Exim is creating
15629 it. It is useful if a customized bounce message text file is in use (see
15630 chapter <xref linkend="CHAPemsgcust"/>).
15632 </listitem></varlistentry>
15634 <term><varname>$bounce_return_size_limit</varname></term>
15637 <indexterm role="concept">
15638 <primary><varname>$bounce_return_size_limit</varname></primary>
15640 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
15641 up to a multiple of 1000. It is useful when a customized error message text
15642 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
15644 </listitem></varlistentry>
15646 <term><varname>$caller_gid</varname></term>
15649 <indexterm role="concept">
15650 <primary>gid (group id)</primary>
15651 <secondary>caller</secondary>
15653 <indexterm role="concept">
15654 <primary><varname>$caller_gid</varname></primary>
15656 The real group id under which the process that called Exim was running. This is
15657 not the same as the group id of the originator of a message (see
15658 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
15659 incarnation normally contains the Exim gid.
15661 </listitem></varlistentry>
15663 <term><varname>$caller_uid</varname></term>
15666 <indexterm role="concept">
15667 <primary>uid (user id)</primary>
15668 <secondary>caller</secondary>
15670 <indexterm role="concept">
15671 <primary><varname>$caller_uid</varname></primary>
15673 The real user id under which the process that called Exim was running. This is
15674 not the same as the user id of the originator of a message (see
15675 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
15676 incarnation normally contains the Exim uid.
15678 </listitem></varlistentry>
15680 <term><varname>$compile_date</varname></term>
15683 <indexterm role="concept">
15684 <primary><varname>$compile_date</varname></primary>
15686 The date on which the Exim binary was compiled.
15688 </listitem></varlistentry>
15690 <term><varname>$compile_number</varname></term>
15693 <indexterm role="concept">
15694 <primary><varname>$compile_number</varname></primary>
15696 The building process for Exim keeps a count of the number
15697 of times it has been compiled. This serves to distinguish different
15698 compilations of the same version of the program.
15700 </listitem></varlistentry>
15702 <term><varname>$demime_errorlevel</varname></term>
15705 <indexterm role="concept">
15706 <primary><varname>$demime_errorlevel</varname></primary>
15708 This variable is available when Exim is compiled with
15709 the content-scanning extension and the obsolete <option>demime</option> condition. For
15710 details, see section <xref linkend="SECTdemimecond"/>.
15712 </listitem></varlistentry>
15714 <term><varname>$demime_reason</varname></term>
15717 <indexterm role="concept">
15718 <primary><varname>$demime_reason</varname></primary>
15720 This variable is available when Exim is compiled with the
15721 content-scanning extension and the obsolete <option>demime</option> condition. For details,
15722 see section <xref linkend="SECTdemimecond"/>.
15724 </listitem></varlistentry>
15726 <term><varname>$dnslist_domain</varname></term>
15729 <indexterm role="concept">
15730 <primary>black list (DNS)</primary>
15732 <indexterm role="concept">
15733 <primary><varname>$dnslist_domain</varname></primary>
15735 When a client host is found to be on a DNS (black) list,
15736 the list’s domain name is put into this variable so that it can be included in
15737 the rejection message.
15739 </listitem></varlistentry>
15741 <term><varname>$dnslist_text</varname></term>
15744 <indexterm role="concept">
15745 <primary><varname>$dnslist_text</varname></primary>
15747 When a client host is found to be on a DNS (black) list, the
15748 contents of any associated TXT record are placed in this variable.
15750 </listitem></varlistentry>
15752 <term><varname>$dnslist_value</varname></term>
15755 <indexterm role="concept">
15756 <primary><varname>$dnslist_value</varname></primary>
15758 When a client host is found to be on a DNS (black) list,
15759 the IP address from the resource record is placed in this variable.
15760 If there are multiple records, all the addresses are included, comma-space
15763 </listitem></varlistentry>
15765 <term><varname>$domain</varname></term>
15767 <para revisionflag="changed">
15768 <indexterm role="concept">
15769 <primary><varname>$domain</varname></primary>
15771 When an address is being routed, or delivered on its own, this variable
15772 contains the domain. Uppercase letters in the domain are converted into lower
15773 case for <varname>$domain</varname>.
15776 Global address rewriting happens when a message is received, so the value of
15777 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
15778 is set during user filtering, but not during system filtering, because a
15779 message may have many recipients and the system filter is called just once.
15782 When more than one address is being delivered at once (for example, several
15783 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
15784 have the same domain. Transports can be restricted to handling only one domain
15785 at a time if the value of <varname>$domain</varname> is required at transport time – this is
15786 the default for local transports. For further details of the environment in
15787 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
15790 <indexterm role="concept">
15791 <primary><option>delay_warning_condition</option></primary>
15793 At the end of a delivery, if all deferred addresses have the same domain, it is
15794 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
15797 The <varname>$domain</varname> variable is also used in some other circumstances:
15802 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
15803 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
15804 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
15805 normally set during the running of the MAIL ACL. However, if the sender address
15806 is verified with a callout during the MAIL ACL, the sender domain is placed in
15807 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
15808 the <command>smtp</command> transport.
15813 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
15814 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
15815 it can be used in the expansion of the replacement address, for example, to
15816 rewrite domains by file lookup.
15821 With one important exception, whenever a domain list is being scanned,
15822 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
15823 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
15824 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
15825 that, in a RCPT ACL, the sender domain list can be dependent on the
15826 recipient domain (which is what is in <varname>$domain</varname> at this time).
15831 <indexterm role="concept">
15832 <primary>ETRN</primary>
15833 <secondary>value of <varname>$domain</varname></secondary>
15835 <indexterm role="concept">
15836 <primary><option>smtp_etrn_command</option></primary>
15838 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
15839 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
15843 </listitem></varlistentry>
15845 <term><varname>$domain_data</varname></term>
15848 <indexterm role="concept">
15849 <primary><varname>$domain_data</varname></primary>
15851 When the <option>domains</option> option on a router matches a domain by
15852 means of a lookup, the data read by the lookup is available during the running
15853 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
15854 address to a transport, the value is available in that transport. If the
15855 transport is handling multiple addresses, the value from the first address is
15859 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
15860 domain by means of a lookup. The data read by the lookup is available during
15861 the rest of the ACL statement. In all other situations, this variable expands
15864 </listitem></varlistentry>
15866 <term><varname>$exim_gid</varname></term>
15869 <indexterm role="concept">
15870 <primary><varname>$exim_gid</varname></primary>
15872 This variable contains the numerical value of the Exim group id.
15874 </listitem></varlistentry>
15876 <term><varname>$exim_path</varname></term>
15879 <indexterm role="concept">
15880 <primary><varname>$exim_path</varname></primary>
15882 This variable contains the path to the Exim binary.
15884 </listitem></varlistentry>
15886 <term><varname>$exim_uid</varname></term>
15889 <indexterm role="concept">
15890 <primary><varname>$exim_uid</varname></primary>
15892 This variable contains the numerical value of the Exim user id.
15894 </listitem></varlistentry>
15896 <term><varname>$found_extension</varname></term>
15899 <indexterm role="concept">
15900 <primary><varname>$found_extension</varname></primary>
15902 This variable is available when Exim is compiled with the
15903 content-scanning extension and the obsolete <option>demime</option> condition. For details,
15904 see section <xref linkend="SECTdemimecond"/>.
15906 </listitem></varlistentry>
15908 <term><varname>$header_</varname><<emphasis>name</emphasis>></term>
15911 This is not strictly an expansion variable. It is expansion syntax for
15912 inserting the message header line with the given name. Note that the name must
15913 be terminated by colon or white space, because it may contain a wide variety of
15914 characters. Note also that braces must <emphasis>not</emphasis> be used.
15916 </listitem></varlistentry>
15918 <term><varname>$home</varname></term>
15921 <indexterm role="concept">
15922 <primary><varname>$home</varname></primary>
15924 When the <option>check_local_user</option> option is set for a router, the user’s home
15925 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
15926 means it is set during the running of users’ filter files. A router may also
15927 explicitly set a home directory for use by a transport; this can be overridden
15928 by a setting on the transport itself.
15931 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
15932 of the environment variable HOME.
15934 </listitem></varlistentry>
15936 <term><varname>$host</varname></term>
15939 <indexterm role="concept">
15940 <primary><varname>$host</varname></primary>
15942 If a router assigns an address to a transport (any transport), and passes a
15943 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
15944 to run is the name of the first host on the list. Note that this applies both
15945 to local and remote transports.
15948 <indexterm role="concept">
15949 <primary>transport</primary>
15950 <secondary>filter</secondary>
15952 <indexterm role="concept">
15953 <primary>filter</primary>
15954 <secondary>transport filter</secondary>
15956 For the <command>smtp</command> transport, if there is more than one host, the value of
15957 <varname>$host</varname> changes as the transport works its way through the list. In
15958 particular, when the <command>smtp</command> transport is expanding its options for encryption
15959 using TLS, or for specifying a transport filter (see chapter
15960 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
15964 When used in the client part of an authenticator configuration (see chapter
15965 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
15966 client is connected.
15968 </listitem></varlistentry>
15970 <term><varname>$host_address</varname></term>
15973 <indexterm role="concept">
15974 <primary><varname>$host_address</varname></primary>
15976 This variable is set to the remote host’s IP address whenever <varname>$host</varname> is set
15977 for a remote connection. It is also set to the IP address that is being checked
15978 when the <option>ignore_target_hosts</option> option is being processed.
15980 </listitem></varlistentry>
15982 <term><varname>$host_data</varname></term>
15985 <indexterm role="concept">
15986 <primary><varname>$host_data</varname></primary>
15988 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
15989 result of the lookup is made available in the <varname>$host_data</varname> variable. This
15990 allows you, for example, to do things like this:
15992 <literallayout class="monospaced">
15993 deny hosts = net-lsearch;/some/file
15994 message = $host_data
15996 </listitem></varlistentry>
15998 <term><varname>$host_lookup_deferred</varname></term>
16001 <indexterm role="concept">
16002 <primary>host name lookup</primary>
16003 <secondary>failure of</secondary>
16005 <indexterm role="concept">
16006 <primary><varname>$host_lookup_deferred</varname></primary>
16008 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
16009 message comes from a remote host and there is an attempt to look up the host’s
16010 name from its IP address, and the attempt is not successful, one of these
16011 variables is set to <quote>1</quote>.
16016 If the lookup receives a definite negative response (for example, a DNS lookup
16017 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
16022 If there is any kind of problem during the lookup, such that Exim cannot
16023 tell whether or not the host name is defined (for example, a timeout for a DNS
16024 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
16029 Looking up a host’s name from its IP address consists of more than just a
16030 single reverse lookup. Exim checks that a forward lookup of at least one of the
16031 names it receives from a reverse lookup yields the original IP address. If this
16032 is not the case, Exim does not accept the looked up name(s), and
16033 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
16034 IP address (for example, the existence of a PTR record in the DNS) is not
16035 sufficient on its own for the success of a host name lookup. If the reverse
16036 lookup succeeds, but there is a lookup problem such as a timeout when checking
16037 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
16038 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
16040 </listitem></varlistentry>
16042 <term><varname>$host_lookup_failed</varname></term>
16045 <indexterm role="concept">
16046 <primary><varname>$host_lookup_failed</varname></primary>
16048 See <varname>$host_lookup_deferred</varname>.
16050 </listitem></varlistentry>
16052 <term><varname>$inode</varname></term>
16055 <indexterm role="concept">
16056 <primary><varname>$inode</varname></primary>
16058 The only time this variable is set is while expanding the <option>directory_file</option>
16059 option in the <command>appendfile</command> transport. The variable contains the inode number
16060 of the temporary file which is about to be renamed. It can be used to construct
16061 a unique name for the file.
16063 </listitem></varlistentry>
16064 <varlistentry revisionflag="changed">
16065 <term><varname>$interface_address</varname></term>
16067 <para revisionflag="changed">
16068 <indexterm role="concept">
16069 <primary><varname>$interface_address</varname></primary>
16071 This is an obsolete name for <varname>$received_ip_address</varname>.
16073 </listitem></varlistentry>
16074 <varlistentry revisionflag="changed">
16075 <term><varname>$interface_port</varname></term>
16077 <para revisionflag="changed">
16078 <indexterm role="concept">
16079 <primary><varname>$interface_port</varname></primary>
16081 This is an obsolete name for <varname>$received_port</varname>.
16083 </listitem></varlistentry>
16085 <term><varname>$ldap_dn</varname></term>
16088 <indexterm role="concept">
16089 <primary><varname>$ldap_dn</varname></primary>
16091 This variable, which is available only when Exim is compiled with LDAP support,
16092 contains the DN from the last entry in the most recently successful LDAP
16095 </listitem></varlistentry>
16097 <term><varname>$load_average</varname></term>
16100 <indexterm role="concept">
16101 <primary><varname>$load_average</varname></primary>
16103 This variable contains the system load average, multiplied by 1000 to that it
16104 is an integer. For example, if the load average is 0.21, the value of the
16105 variable is 210. The value is recomputed every time the variable is referenced.
16107 </listitem></varlistentry>
16109 <term><varname>$local_part</varname></term>
16112 <indexterm role="concept">
16113 <primary><varname>$local_part</varname></primary>
16115 When an address is being routed, or delivered on its own, this
16116 variable contains the local part. When a number of addresses are being
16117 delivered together (for example, multiple RCPT commands in an SMTP
16118 session), <varname>$local_part</varname> is not set.
16121 Global address rewriting happens when a message is received, so the value of
16122 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
16123 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
16124 because a message may have many recipients and the system filter is called just
16128 <indexterm role="concept">
16129 <primary><varname>$local_part_prefix</varname></primary>
16131 <indexterm role="concept">
16132 <primary><varname>$local_part_suffix</varname></primary>
16134 If a local part prefix or suffix has been recognized, it is not included in the
16135 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
16136 any prefix or suffix are in <varname>$local_part_prefix</varname> and
16137 <varname>$local_part_suffix</varname>, respectively.
16140 When a message is being delivered to a file, pipe, or autoreply transport as a
16141 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
16142 the parent address, not to the file name or command (see <varname>$address_file</varname> and
16143 <varname>$address_pipe</varname>).
16146 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
16147 local part of the recipient address.
16150 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
16151 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
16152 it can be used in the expansion of the replacement address, for example.
16155 In all cases, all quoting is removed from the local part. For example, for both
16158 <literallayout class="monospaced">
16159 "abc:xyz"@test.example
16160 abc\:xyz@test.example
16163 the value of <varname>$local_part</varname> is
16165 <literallayout class="monospaced">
16169 If you use <varname>$local_part</varname> to create another address, you should always wrap it
16170 inside a quoting operator. For example, in a <command>redirect</command> router you could
16173 <literallayout class="monospaced">
16174 data = ${quote_local_part:$local_part}@new.domain.example
16177 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
16178 to process local parts in a case-dependent manner in a router, you can set the
16179 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
16181 </listitem></varlistentry>
16183 <term><varname>$local_part_data</varname></term>
16186 <indexterm role="concept">
16187 <primary><varname>$local_part_data</varname></primary>
16189 When the <option>local_parts</option> option on a router matches a local part by means of a
16190 lookup, the data read by the lookup is available during the running of the
16191 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
16192 to a transport, the value is available in that transport. If the transport is
16193 handling multiple addresses, the value from the first address is used.
16196 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
16197 matches a local part by means of a lookup. The data read by the lookup is
16198 available during the rest of the ACL statement. In all other situations, this
16199 variable expands to nothing.
16201 </listitem></varlistentry>
16203 <term><varname>$local_part_prefix</varname></term>
16206 <indexterm role="concept">
16207 <primary><varname>$local_part_prefix</varname></primary>
16209 When an address is being routed or delivered, and a
16210 specific prefix for the local part was recognized, it is available in this
16211 variable, having been removed from <varname>$local_part</varname>.
16213 </listitem></varlistentry>
16215 <term><varname>$local_part_suffix</varname></term>
16218 <indexterm role="concept">
16219 <primary><varname>$local_part_suffix</varname></primary>
16221 When an address is being routed or delivered, and a
16222 specific suffix for the local part was recognized, it is available in this
16223 variable, having been removed from <varname>$local_part</varname>.
16225 </listitem></varlistentry>
16227 <term><varname>$local_scan_data</varname></term>
16230 <indexterm role="concept">
16231 <primary><varname>$local_scan_data</varname></primary>
16233 This variable contains the text returned by the <function>local_scan()</function> function when
16234 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
16236 </listitem></varlistentry>
16238 <term><varname>$local_user_gid</varname></term>
16241 <indexterm role="concept">
16242 <primary><varname>$local_user_gid</varname></primary>
16244 See <varname>$local_user_uid</varname>.
16246 </listitem></varlistentry>
16248 <term><varname>$local_user_uid</varname></term>
16251 <indexterm role="concept">
16252 <primary><varname>$local_user_uid</varname></primary>
16254 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
16255 <option>check_local_user</option> router precondition succeeds. This means that their values
16256 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
16257 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
16258 router-specific expansions. At all other times, the values in these variables
16259 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
16261 </listitem></varlistentry>
16263 <term><varname>$localhost_number</varname></term>
16266 <indexterm role="concept">
16267 <primary><varname>$localhost_number</varname></primary>
16269 This contains the expanded value of the
16270 <option>localhost_number</option> option. The expansion happens after the main options have
16273 </listitem></varlistentry>
16275 <term><varname>$log_inodes</varname></term>
16278 <indexterm role="concept">
16279 <primary><varname>$log_inodes</varname></primary>
16281 The number of free inodes in the disk partition where Exim’s
16282 log files are being written. The value is recalculated whenever the variable is
16283 referenced. If the relevant file system does not have the concept of inodes,
16284 the value of is -1. See also the <option>check_log_inodes</option> option.
16286 </listitem></varlistentry>
16288 <term><varname>$log_space</varname></term>
16291 <indexterm role="concept">
16292 <primary><varname>$log_space</varname></primary>
16294 The amount of free space (as a number of kilobytes) in the disk
16295 partition where Exim’s log files are being written. The value is recalculated
16296 whenever the variable is referenced. If the operating system does not have the
16297 ability to find the amount of free space (only true for experimental systems),
16298 the space value is -1. See also the <option>check_log_space</option> option.
16300 </listitem></varlistentry>
16302 <term><varname>$mailstore_basename</varname></term>
16305 <indexterm role="concept">
16306 <primary><varname>$mailstore_basename</varname></primary>
16308 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
16309 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
16310 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
16311 contains the basename of the files that are being written, that is, the name
16312 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
16315 </listitem></varlistentry>
16317 <term><varname>$malware_name</varname></term>
16320 <indexterm role="concept">
16321 <primary><varname>$malware_name</varname></primary>
16323 This variable is available when Exim is compiled with the
16324 content-scanning extension. It is set to the name of the virus that was found
16325 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
16327 </listitem></varlistentry>
16329 <term><varname>$message_age</varname></term>
16332 <indexterm role="concept">
16333 <primary>message</primary>
16334 <secondary>age of</secondary>
16336 <indexterm role="concept">
16337 <primary><varname>$message_age</varname></primary>
16339 This variable is set at the start of a delivery attempt to contain the number
16340 of seconds since the message was received. It does not change during a single
16343 </listitem></varlistentry>
16345 <term><varname>$message_body</varname></term>
16348 <indexterm role="concept">
16349 <primary>body of message</primary>
16350 <secondary>expansion variable</secondary>
16352 <indexterm role="concept">
16353 <primary>message body</primary>
16354 <secondary>in expansion</secondary>
16356 <indexterm role="concept">
16357 <primary>binary zero</primary>
16358 <secondary>in message body</secondary>
16360 <indexterm role="concept">
16361 <primary><varname>$message_body</varname></primary>
16363 This variable contains the initial portion of a message’s
16364 body while it is being delivered, and is intended mainly for use in filter
16365 files. The maximum number of characters of the body that are put into the
16366 variable is set by the <option>message_body_visible</option> configuration option; the
16367 default is 500. Newlines are converted into spaces to make it easier to search
16368 for phrases that might be split over a line break.
16369 Binary zeros are also converted into spaces.
16371 </listitem></varlistentry>
16373 <term><varname>$message_body_end</varname></term>
16376 <indexterm role="concept">
16377 <primary>body of message</primary>
16378 <secondary>expansion variable</secondary>
16380 <indexterm role="concept">
16381 <primary>message body</primary>
16382 <secondary>in expansion</secondary>
16384 <indexterm role="concept">
16385 <primary><varname>$message_body_end</varname></primary>
16387 This variable contains the final portion of a message’s
16388 body while it is being delivered. The format and maximum size are as for
16389 <varname>$message_body</varname>.
16391 </listitem></varlistentry>
16393 <term><varname>$message_body_size</varname></term>
16396 <indexterm role="concept">
16397 <primary>body of message</primary>
16398 <secondary>size</secondary>
16400 <indexterm role="concept">
16401 <primary>message body</primary>
16402 <secondary>size</secondary>
16404 <indexterm role="concept">
16405 <primary><varname>$message_body_size</varname></primary>
16407 When a message is being delivered, this variable contains the size of the body
16408 in bytes. The count starts from the character after the blank line that
16409 separates the body from the header. Newlines are included in the count. See
16410 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
16412 </listitem></varlistentry>
16414 <term><varname>$message_exim_id</varname></term>
16417 <indexterm role="concept">
16418 <primary><varname>$message_exim_id</varname></primary>
16420 When a message is being received or delivered, this variable contains the
16421 unique message id that is generated and used by Exim to identify the message.
16422 An id is not created for a message until after its header has been successfully
16423 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
16424 line; it is the local id that Exim assigns to the message, for example:
16425 <literal>1BXTIK-0001yO-VA</literal>.
16427 </listitem></varlistentry>
16429 <term><varname>$message_headers</varname></term>
16431 <para revisionflag="changed">
16432 <indexterm role="concept">
16433 <primary><varname>$message_headers</varname></primary>
16435 This variable contains a concatenation of all the header lines when a message
16436 is being processed, except for lines added by routers or transports. The header
16437 lines are separated by newline characters. Their contents are decoded in the
16438 same way as a header line that is inserted by <option>bheader</option>.
16440 </listitem></varlistentry>
16441 <varlistentry revisionflag="changed">
16442 <term><varname>$message_headers_raw</varname></term>
16444 <para revisionflag="changed">
16445 <indexterm role="concept">
16446 <primary><varname>$message_headers_raw</varname></primary>
16448 This variable is like <varname>$message_headers</varname> except that no processing of the
16449 contents of header lines is done.
16451 </listitem></varlistentry>
16453 <term><varname>$message_id</varname></term>
16456 This is an old name for <varname>$message_exim_id</varname>, which is now deprecated.
16458 </listitem></varlistentry>
16460 <term><varname>$message_linecount</varname></term>
16463 <indexterm role="concept">
16464 <primary><varname>$message_linecount</varname></primary>
16466 This variable contains the total number of lines in the header and body of the
16467 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
16468 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
16469 number of lines received. Before delivery happens (that is, before filters,
16470 routers, and transports run) the count is increased to include the
16471 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
16472 lines that are added by ACLs. The blank line that separates the message header
16473 from the body is not counted. Here is an example of the use of this variable in
16476 <literallayout class="monospaced">
16477 deny message = Too many lines in message header
16479 ${if <{250}{${eval:$message_linecount - $body_linecount}}}
16482 In the MAIL and RCPT ACLs, the value is zero because at that stage the
16483 message has not yet been received.
16485 </listitem></varlistentry>
16487 <term><varname>$message_size</varname></term>
16490 <indexterm role="concept">
16491 <primary>size</primary>
16492 <secondary>of message</secondary>
16494 <indexterm role="concept">
16495 <primary>message</primary>
16496 <secondary>size</secondary>
16498 <indexterm role="concept">
16499 <primary><varname>$message_size</varname></primary>
16501 When a message is being processed, this variable contains its size in bytes. In
16502 most cases, the size includes those headers that were received with the
16503 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
16504 deliveries as they are written. However, there is one special case: during the
16505 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
16506 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
16507 precise size of the file that has been written. See also
16508 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
16511 <indexterm role="concept">
16512 <primary>RCPT</primary>
16513 <secondary>value of <varname>$message_size</varname></secondary>
16515 While running an ACL at the time of an SMTP RCPT command, <varname>$message_size</varname>
16516 contains the size supplied on the MAIL command, or -1 if no size was given. The
16517 value may not, of course, be truthful.
16519 </listitem></varlistentry>
16521 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
16524 A number of variables whose names start with <varname>$mime</varname> are
16525 available when Exim is compiled with the content-scanning extension. For
16526 details, see section <xref linkend="SECTscanmimepart"/>.
16528 </listitem></varlistentry>
16530 <term><varname>$n0</varname> – <varname>$n9</varname></term>
16533 These variables are counters that can be incremented by means
16534 of the <option>add</option> command in filter files.
16536 </listitem></varlistentry>
16538 <term><varname>$original_domain</varname></term>
16541 <indexterm role="concept">
16542 <primary><varname>$domain</varname></primary>
16544 <indexterm role="concept">
16545 <primary><varname>$original_domain</varname></primary>
16547 When a top-level address is being processed for delivery, this contains the
16548 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
16549 generated by an alias, forward, or filter file) is being processed, this
16550 variable contains the domain of the original address (lower cased). This
16551 differs from <varname>$parent_domain</varname> only when there is more than one level of
16552 aliasing or forwarding. When more than one address is being delivered in a
16553 single transport run, <varname>$original_domain</varname> is not set.
16556 If a new address is created by means of a <option>deliver</option> command in a system
16557 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
16558 part <emphasis>system-filter</emphasis> and the default qualify domain.
16560 </listitem></varlistentry>
16562 <term><varname>$original_local_part</varname></term>
16565 <indexterm role="concept">
16566 <primary><varname>$local_part</varname></primary>
16568 <indexterm role="concept">
16569 <primary><varname>$original_local_part</varname></primary>
16571 When a top-level address is being processed for delivery, this contains the
16572 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
16573 local part, because <varname>$original_local_part</varname> always contains the full local
16574 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
16575 filter file) is being processed, this variable contains the full local part of
16576 the original address.
16579 If the router that did the redirection processed the local part
16580 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
16581 This variable differs from <varname>$parent_local_part</varname> only when there is more than
16582 one level of aliasing or forwarding. When more than one address is being
16583 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
16586 If a new address is created by means of a <option>deliver</option> command in a system
16587 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
16588 part <emphasis>system-filter</emphasis> and the default qualify domain.
16590 </listitem></varlistentry>
16592 <term><varname>$originator_gid</varname></term>
16595 <indexterm role="concept">
16596 <primary>gid (group id)</primary>
16597 <secondary>of originating user</secondary>
16599 <indexterm role="concept">
16600 <primary>sender</primary>
16601 <secondary>gid</secondary>
16603 <indexterm role="concept">
16604 <primary><varname>$caller_gid</varname></primary>
16606 <indexterm role="concept">
16607 <primary><varname>$originator_gid</varname></primary>
16609 This variable contains the value of <varname>$caller_gid</varname> that was set when the
16610 message was received. For messages received via the command line, this is the
16611 gid of the sending user. For messages received by SMTP over TCP/IP, this is
16612 normally the gid of the Exim user.
16614 </listitem></varlistentry>
16616 <term><varname>$originator_uid</varname></term>
16619 <indexterm role="concept">
16620 <primary>uid (user id)</primary>
16621 <secondary>of originating user</secondary>
16623 <indexterm role="concept">
16624 <primary>sender</primary>
16625 <secondary>uid</secondary>
16627 <indexterm role="concept">
16628 <primary><varname>$caller_uid</varname></primary>
16630 <indexterm role="concept">
16631 <primary><varname>$originaltor_uid</varname></primary>
16633 The value of <varname>$caller_uid</varname> that was set when the message was received. For
16634 messages received via the command line, this is the uid of the sending user.
16635 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
16638 </listitem></varlistentry>
16640 <term><varname>$parent_domain</varname></term>
16643 <indexterm role="concept">
16644 <primary><varname>$parent_domain</varname></primary>
16646 This variable is similar to <varname>$original_domain</varname> (see
16647 above), except that it refers to the immediately preceding parent address.
16649 </listitem></varlistentry>
16651 <term><varname>$parent_local_part</varname></term>
16654 <indexterm role="concept">
16655 <primary><varname>$parent_local_part</varname></primary>
16657 This variable is similar to <varname>$original_local_part</varname>
16658 (see above), except that it refers to the immediately preceding parent address.
16660 </listitem></varlistentry>
16662 <term><varname>$pid</varname></term>
16665 <indexterm role="concept">
16666 <primary>pid (process id)</primary>
16667 <secondary>of current process</secondary>
16669 <indexterm role="concept">
16670 <primary><varname>$pid</varname></primary>
16672 This variable contains the current process id.
16674 </listitem></varlistentry>
16676 <term><varname>$pipe_addresses</varname></term>
16679 <indexterm role="concept">
16680 <primary>filter</primary>
16681 <secondary>transport filter</secondary>
16683 <indexterm role="concept">
16684 <primary>transport</primary>
16685 <secondary>filter</secondary>
16687 <indexterm role="concept">
16688 <primary><varname>$pipe_addresses</varname></primary>
16690 This is not an expansion variable, but is mentioned here because the string
16691 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
16692 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
16693 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
16694 It cannot be used in general expansion strings, and provokes an <quote>unknown
16695 variable</quote> error if encountered.
16697 </listitem></varlistentry>
16699 <term><varname>$primary_hostname</varname></term>
16702 <indexterm role="concept">
16703 <primary><varname>$primary_hostname</varname></primary>
16705 This variable contains the value set by <option>primary_hostname</option> in the
16706 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
16707 a single-component name, Exim calls <function>gethostbyname()</function> (or
16708 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
16709 qualified host name. See also <varname>$smtp_active_hostname</varname>.
16711 </listitem></varlistentry>
16713 <term><varname>$prvscheck_address</varname></term>
16716 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
16717 which is described in sections <xref linkend="SECTexpansionitems"/> and
16718 <xref linkend="SECTverifyPRVS"/>.
16720 </listitem></varlistentry>
16722 <term><varname>$prvscheck_keynum</varname></term>
16725 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
16726 which is described in sections <xref linkend="SECTexpansionitems"/> and
16727 <xref linkend="SECTverifyPRVS"/>.
16729 </listitem></varlistentry>
16731 <term><varname>$prvscheck_result</varname></term>
16734 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
16735 which is described in sections <xref linkend="SECTexpansionitems"/> and
16736 <xref linkend="SECTverifyPRVS"/>.
16738 </listitem></varlistentry>
16740 <term><varname>$qualify_domain</varname></term>
16743 <indexterm role="concept">
16744 <primary><varname>$qualify_domain</varname></primary>
16746 The value set for the <option>qualify_domain</option> option in the configuration file.
16748 </listitem></varlistentry>
16750 <term><varname>$qualify_recipient</varname></term>
16753 <indexterm role="concept">
16754 <primary><varname>$qualify_recipient</varname></primary>
16756 The value set for the <option>qualify_recipient</option> option in the configuration file,
16757 or if not set, the value of <varname>$qualify_domain</varname>.
16759 </listitem></varlistentry>
16761 <term><varname>$rcpt_count</varname></term>
16764 <indexterm role="concept">
16765 <primary><varname>$rcpt_count</varname></primary>
16767 When a message is being received by SMTP, this variable contains the number of
16768 RCPT commands received for the current message. If this variable is used in a
16769 RCPT ACL, its value includes the current command.
16771 </listitem></varlistentry>
16773 <term><varname>$rcpt_defer_count</varname></term>
16776 <indexterm role="concept">
16777 <primary><varname>$rcpt_defer_count</varname></primary>
16779 <indexterm role="concept">
16780 <primary>4<emphasis>xx</emphasis> responses</primary>
16781 <secondary>count of</secondary>
16783 When a message is being received by SMTP, this variable contains the number of
16784 RCPT commands in the current message that have previously been rejected with a
16785 temporary (4<emphasis>xx</emphasis>) response.
16787 </listitem></varlistentry>
16789 <term><varname>$rcpt_fail_count</varname></term>
16792 <indexterm role="concept">
16793 <primary><varname>$rcpt_fail_count</varname></primary>
16795 When a message is being received by SMTP, this variable contains the number of
16796 RCPT commands in the current message that have previously been rejected with a
16797 permanent (5<emphasis>xx</emphasis>) response.
16799 </listitem></varlistentry>
16801 <term><varname>$received_count</varname></term>
16804 <indexterm role="concept">
16805 <primary><varname>$received_count</varname></primary>
16807 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
16808 including the one added by Exim (so its value is always greater than zero). It
16809 is available in the DATA ACL, the non-SMTP ACL, and while routing and
16812 </listitem></varlistentry>
16814 <term><varname>$received_for</varname></term>
16817 <indexterm role="concept">
16818 <primary><varname>$received_for</varname></primary>
16820 If there is only a single recipient address in an incoming message, this
16821 variable contains that address when the <emphasis>Received:</emphasis> header line is being
16822 built. The value is copied after recipient rewriting has happened, but before
16823 the <function>local_scan()</function> function is run.
16825 </listitem></varlistentry>
16826 <varlistentry revisionflag="changed">
16827 <term><varname>$received_ip_address</varname></term>
16829 <para revisionflag="changed">
16830 <indexterm role="concept">
16831 <primary><varname>$received_ip_address</varname></primary>
16833 As soon as an Exim server starts processing an incoming TCP/IP connection, this
16834 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
16835 is set to the local port number. (The remote IP address and port are in
16836 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
16837 the port value is -1 unless it has been set using the <option>-oMi</option> command line
16840 <para revisionflag="changed">
16841 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
16842 could be used, for example, to make the file name for a TLS certificate depend
16843 on which interface and/or port is being used for the incoming connection. The
16844 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
16845 messages that are received, thus making these variables available at delivery
16848 <para revisionflag="changed">
16849 <emphasis role="bold">Note:</emphasis> There are no equivalent variables for outgoing connections, because
16850 the values are unknown (unless they are explicitly set by options of the
16851 <command>smtp</command> transport).
16853 </listitem></varlistentry>
16854 <varlistentry revisionflag="changed">
16855 <term><varname>$received_port</varname></term>
16857 <para revisionflag="changed">
16858 <indexterm role="concept">
16859 <primary><varname>$received_port</varname></primary>
16861 See <varname>$received_ip_address</varname>.
16863 </listitem></varlistentry>
16865 <term><varname>$received_protocol</varname></term>
16868 <indexterm role="concept">
16869 <primary><varname>$received_protocol</varname></primary>
16871 When a message is being processed, this variable contains the name of the
16872 protocol by which it was received. Most of the names used by Exim are defined
16873 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
16874 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
16875 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
16876 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
16877 connection and the client was successfully authenticated.
16880 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
16881 automatically set up on connection without the use of STARTTLS (see
16882 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
16883 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
16884 where the client initially uses EHLO, sets up an encrypted connection using
16885 STARTTLS, and then uses HELO afterwards.
16888 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
16889 messages that are injected locally by trusted callers. This is commonly used to
16890 identify messages that are being re-injected after some kind of scanning.
16892 </listitem></varlistentry>
16894 <term><varname>$received_time</varname></term>
16897 <indexterm role="concept">
16898 <primary><varname>$received_time</varname></primary>
16900 This variable contains the date and time when the current message was received,
16901 as a number of seconds since the start of the Unix epoch.
16903 </listitem></varlistentry>
16905 <term><varname>$recipient_data</varname></term>
16908 <indexterm role="concept">
16909 <primary><varname>$recipient_data</varname></primary>
16911 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
16912 condition. It contains the data from the lookup, and the value remains set
16913 until the next <option>recipients</option> test. Thus, you can do things like this:
16916 <literal>require recipients = cdb*@;/some/file</literal>
16917 <literal>deny </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
16920 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
16921 method in the address list, using the semicolon syntax as in the example above.
16922 The variable is not set for a lookup that is used as part of the string
16923 expansion that all such lists undergo before being interpreted.
16925 </listitem></varlistentry>
16927 <term><varname>$recipient_verify_failure</varname></term>
16930 <indexterm role="concept">
16931 <primary><varname>$recipient_verify_failure</varname></primary>
16933 In an ACL, when a recipient verification fails, this variable contains
16934 information about the failure. It is set to one of the following words:
16939 <quote>qualify</quote>: The address was unqualified (no domain), and the message
16940 was neither local nor came from an exempted host.
16945 <quote>route</quote>: Routing failed.
16950 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
16951 or before the MAIL command (that is, on initial connection, HELO, or
16957 <quote>recipient</quote>: The RCPT command in a callout was rejected.
16962 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
16967 The main use of this variable is expected to be to distinguish between
16968 rejections of MAIL and rejections of RCPT.
16970 </listitem></varlistentry>
16972 <term><varname>$recipients</varname></term>
16975 <indexterm role="concept">
16976 <primary><varname>$recipients</varname></primary>
16978 This variable contains a list of envelope recipients for a
16979 message. A comma and a space separate the addresses in the replacement text.
16980 However, the variable is not generally available, to prevent exposure of Bcc
16981 recipients in unprivileged users’ filter files. You can use <varname>$recipients</varname> only
16982 in these two cases:
16984 <orderedlist numeration="arabic">
16987 In a system filter file.
16992 In the ACLs associated with the DATA command and with non-SMTP messages, that
16993 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
16994 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
16995 <option>acl_not_smtp_mime</option>.
16999 </listitem></varlistentry>
17001 <term><varname>$recipients_count</varname></term>
17004 <indexterm role="concept">
17005 <primary><varname>$recipients_count</varname></primary>
17007 When a message is being processed, this variable contains the number of
17008 envelope recipients that came with the message. Duplicates are not excluded
17009 from the count. While a message is being received over SMTP, the number
17010 increases for each accepted recipient. It can be referenced in an ACL.
17012 </listitem></varlistentry>
17014 <term><varname>$regex_match_string</varname></term>
17017 <indexterm role="concept">
17018 <primary><varname>$regex_match_string</varname></primary>
17020 This variable is set to contain the matching regular expression after a
17021 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
17023 </listitem></varlistentry>
17025 <term><varname>$reply_address</varname></term>
17028 <indexterm role="concept">
17029 <primary><varname>$reply_address</varname></primary>
17031 When a message is being processed, this variable contains the contents of the
17032 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
17033 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
17034 white space, the value is not processed in any way. In particular, no RFC 2047
17035 decoding or character code translation takes place.
17037 </listitem></varlistentry>
17039 <term><varname>$return_path</varname></term>
17042 <indexterm role="concept">
17043 <primary><varname>$return_path</varname></primary>
17045 When a message is being delivered, this variable contains the return path –
17046 the sender field that will be sent as part of the envelope. It is not enclosed
17047 in <> characters. At the start of routing an address, <varname>$return_path</varname> has the
17048 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
17049 mailing list has been expanded by a router which specifies a different address
17050 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
17051 address, whereas <varname>$sender_address</varname> always contains the original sender address
17052 that was received with the message. In other words, <varname>$sender_address</varname> contains
17053 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
17056 </listitem></varlistentry>
17058 <term><varname>$return_size_limit</varname></term>
17061 <indexterm role="concept">
17062 <primary><varname>$return_size_limit</varname></primary>
17064 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
17066 </listitem></varlistentry>
17068 <term><varname>$runrc</varname></term>
17071 <indexterm role="concept">
17072 <primary>return code</primary>
17073 <secondary>from <option>run</option> expansion</secondary>
17075 <indexterm role="concept">
17076 <primary><varname>$runrc</varname></primary>
17078 This variable contains the return code from a command that is run by the
17079 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
17080 assume the order in which option values are expanded, except for those
17081 preconditions whose order of testing is documented. Therefore, you cannot
17082 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
17085 </listitem></varlistentry>
17087 <term><varname>$self_hostname</varname></term>
17090 <indexterm role="concept">
17091 <primary><option>self</option> option</primary>
17092 <secondary>value of host name</secondary>
17094 <indexterm role="concept">
17095 <primary><varname>$self_hostname</varname></primary>
17097 When an address is routed to a supposedly remote host that turns out to be the
17098 local host, what happens is controlled by the <option>self</option> generic router option.
17099 One of its values causes the address to be passed to another router. When this
17100 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
17101 original router encountered. In other circumstances its contents are null.
17103 </listitem></varlistentry>
17105 <term><varname>$sender_address</varname></term>
17107 <para revisionflag="changed">
17108 <indexterm role="concept">
17109 <primary><varname>$sender_address</varname></primary>
17111 When a message is being processed, this variable contains the sender’s address
17112 that was received in the message’s envelope. The case of letters in the address
17113 is retained, in both the local part and the domain. For bounce messages, the
17114 value of this variable is the empty string. See also <varname>$return_path</varname>.
17116 </listitem></varlistentry>
17118 <term><varname>$sender_address_data</varname></term>
17121 <indexterm role="concept">
17122 <primary><varname>$address_data</varname></primary>
17124 <indexterm role="concept">
17125 <primary><varname>$sender_address_data</varname></primary>
17127 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
17128 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
17129 distinguish it from data from a recipient address. The value does not persist
17130 after the end of the current ACL statement. If you want to preserve it for
17131 longer, you can save it in an ACL variable.
17133 </listitem></varlistentry>
17135 <term><varname>$sender_address_domain</varname></term>
17138 <indexterm role="concept">
17139 <primary><varname>$sender_address_domain</varname></primary>
17141 The domain portion of <varname>$sender_address</varname>.
17143 </listitem></varlistentry>
17145 <term><varname>$sender_address_local_part</varname></term>
17148 <indexterm role="concept">
17149 <primary><varname>$sender_address_local_part</varname></primary>
17151 The local part portion of <varname>$sender_address</varname>.
17153 </listitem></varlistentry>
17155 <term><varname>$sender_data</varname></term>
17158 <indexterm role="concept">
17159 <primary><varname>$sender_data</varname></primary>
17161 This variable is set after a lookup success in an ACL <option>senders</option> condition or
17162 in a router <option>senders</option> option. It contains the data from the lookup, and the
17163 value remains set until the next <option>senders</option> test. Thus, you can do things like
17167 <literal>require senders = cdb*@;/some/file</literal>
17168 <literal>deny </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
17171 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
17172 method in the address list, using the semicolon syntax as in the example above.
17173 The variable is not set for a lookup that is used as part of the string
17174 expansion that all such lists undergo before being interpreted.
17176 </listitem></varlistentry>
17178 <term><varname>$sender_fullhost</varname></term>
17181 <indexterm role="concept">
17182 <primary><varname>$sender_fullhost</varname></primary>
17184 When a message is received from a remote host, this variable contains the host
17185 name and IP address in a single string. It ends with the IP address in square
17186 brackets, followed by a colon and a port number if the logging of ports is
17187 enabled. The format of the rest of the string depends on whether the host
17188 issued a HELO or EHLO SMTP command, and whether the host name was verified by
17189 looking up its IP address. (Looking up the IP address can be forced by the
17190 <option>host_lookup</option> option, independent of verification.) A plain host name at the
17191 start of the string is a verified host name; if this is not present,
17192 verification either failed or was not requested. A host name in parentheses is
17193 the argument of a HELO or EHLO command. This is omitted if it is identical to
17194 the verified host name or to the host’s IP address in square brackets.
17196 </listitem></varlistentry>
17198 <term><varname>$sender_helo_name</varname></term>
17201 <indexterm role="concept">
17202 <primary><varname>$sender_helo_name</varname></primary>
17204 When a message is received from a remote host that has issued a HELO or EHLO
17205 command, the argument of that command is placed in this variable. It is also
17206 set if HELO or EHLO is used when a message is received using SMTP locally via
17207 the <option>-bs</option> or <option>-bS</option> options.
17209 </listitem></varlistentry>
17211 <term><varname>$sender_host_address</varname></term>
17214 <indexterm role="concept">
17215 <primary><varname>$sender_host_address</varname></primary>
17217 When a message is received from a remote host, this variable contains that
17218 host’s IP address. For locally submitted messages, it is empty.
17220 </listitem></varlistentry>
17222 <term><varname>$sender_host_authenticated</varname></term>
17225 <indexterm role="concept">
17226 <primary><varname>$sender_host_authenticated</varname></primary>
17228 This variable contains the name (not the public name) of the authenticator
17229 driver that successfully authenticated the client from which the message was
17230 received. It is empty if there was no successful authentication. See also
17231 <varname>$authenticated_id</varname>.
17233 </listitem></varlistentry>
17235 <term><varname>$sender_host_name</varname></term>
17238 <indexterm role="concept">
17239 <primary><varname>$sender_host_name</varname></primary>
17241 When a message is received from a remote host, this variable contains the
17242 host’s name as obtained by looking up its IP address. For messages received by
17243 other means, this variable is empty.
17246 <indexterm role="concept">
17247 <primary><varname>$host_lookup_failed</varname></primary>
17249 If the host name has not previously been looked up, a reference to
17250 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
17251 A looked up name is accepted only if it leads back to the original IP address
17252 via a forward lookup. If either the reverse or the forward lookup fails to find
17253 any data, or if the forward lookup does not yield the original IP address,
17254 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
17257 <indexterm role="concept">
17258 <primary><varname>$host_lookup_deferred</varname></primary>
17260 However, if either of the lookups cannot be completed (for example, there is a
17261 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
17262 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
17265 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
17266 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
17267 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
17268 is set to <quote>1</quote>.
17271 Exim does not automatically look up every calling host’s name. If you want
17272 maximum efficiency, you should arrange your configuration so that it avoids
17273 these lookups altogether. The lookup happens only if one or more of the
17274 following are true:
17279 A string containing <varname>$sender_host_name</varname> is expanded.
17284 The calling host matches the list in <option>host_lookup</option>. In the default
17285 configuration, this option is set to *, so it must be changed if lookups are
17286 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
17291 Exim needs the host name in order to test an item in a host list. The items
17292 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
17293 <xref linkend="SECThoslispatnamsk"/>.
17298 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
17299 In this case, the host name is required to compare with the name quoted in any
17300 EHLO or HELO commands that the client issues.
17305 The remote host issues a EHLO or HELO command that quotes one of the
17306 domains in <option>helo_lookup_domains</option>. The default value of this option is
17308 <literallayout class="monospaced">
17309 helo_lookup_domains = @ : @[]
17312 which causes a lookup if a remote host (incorrectly) gives the server’s name or
17313 IP address in an EHLO or HELO command.
17317 </listitem></varlistentry>
17319 <term><varname>$sender_host_port</varname></term>
17322 <indexterm role="concept">
17323 <primary><varname>$sender_host_port</varname></primary>
17325 When a message is received from a remote host, this variable contains the port
17326 number that was used on the remote host.
17328 </listitem></varlistentry>
17330 <term><varname>$sender_ident</varname></term>
17333 <indexterm role="concept">
17334 <primary><varname>$sender_ident</varname></primary>
17336 When a message is received from a remote host, this variable contains the
17337 identification received in response to an RFC 1413 request. When a message has
17338 been received locally, this variable contains the login name of the user that
17341 </listitem></varlistentry>
17343 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
17346 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
17347 <option>ratelimit</option> ACL condition. Details are given in section
17348 <xref linkend="SECTratelimiting"/>.
17350 </listitem></varlistentry>
17352 <term><varname>$sender_rcvhost</varname></term>
17355 <indexterm role="concept">
17356 <primary>DNS</primary>
17357 <secondary>reverse lookup</secondary>
17359 <indexterm role="concept">
17360 <primary>reverse DNS lookup</primary>
17362 <indexterm role="concept">
17363 <primary><varname>$sender_rcvhost</varname></primary>
17365 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
17366 either the verified host name (as obtained from a reverse DNS lookup) or, if
17367 there is no verified host name, the IP address in square brackets. After that
17368 there may be text in parentheses. When the first item is a verified host name,
17369 the first thing in the parentheses is the IP address in square brackets,
17370 followed by a colon and a port number if port logging is enabled. When the
17371 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
17375 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
17376 was used and its argument was not identical to the real host name or IP
17377 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
17378 all three items are present in the parentheses, a newline and tab are inserted
17379 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
17381 </listitem></varlistentry>
17383 <term><varname>$sender_verify_failure</varname></term>
17386 <indexterm role="concept">
17387 <primary><varname>$sender_verify_failure</varname></primary>
17389 In an ACL, when a sender verification fails, this variable contains information
17390 about the failure. The details are the same as for
17391 <varname>$recipient_verify_failure</varname>.
17393 </listitem></varlistentry>
17395 <term><varname>$smtp_active_hostname</varname></term>
17398 <indexterm role="concept">
17399 <primary><varname>$smtp_active_hostname</varname></primary>
17401 During an incoming SMTP session, this variable contains the value of the active
17402 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
17403 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
17404 value can be consulted during routing and delivery.
17406 </listitem></varlistentry>
17408 <term><varname>$smtp_command</varname></term>
17411 <indexterm role="concept">
17412 <primary><varname>$smtp_command</varname></primary>
17414 During the processing of an incoming SMTP command, this variable contains the
17415 entire command. This makes it possible to distinguish between HELO and EHLO in
17416 the HELO ACL, and also to distinguish between commands such as these:
17418 <literallayout class="monospaced">
17420 MAIL FROM: <>
17423 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
17424 command, the address in <varname>$smtp_command</varname> is the original address before any
17425 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
17426 the address after SMTP-time rewriting.
17428 </listitem></varlistentry>
17430 <term><varname>$smtp_command_argument</varname></term>
17433 <indexterm role="concept">
17434 <primary>SMTP command</primary>
17435 <secondary>argument for</secondary>
17437 <indexterm role="concept">
17438 <primary><varname>$smtp_command_argument</varname></primary>
17440 While an ACL is running to check an SMTP command, this variable contains the
17441 argument, that is, the text that follows the command name, with leading white
17442 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
17443 somewhat redundant, but is retained for backwards compatibility.
17445 </listitem></varlistentry>
17447 <term><varname>$sn0</varname> – <varname>$sn9</varname></term>
17450 These variables are copies of the values of the <varname>$n0</varname> – <varname>$n9</varname> accumulators
17451 that were current at the end of the system filter file. This allows a system
17452 filter file to set values that can be tested in users’ filter files. For
17453 example, a system filter could set a value indicating how likely it is that a
17454 message is junk mail.
17456 </listitem></varlistentry>
17458 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
17461 A number of variables whose names start with <varname>$spam</varname> are available when Exim
17462 is compiled with the content-scanning extension. For details, see section
17463 <xref linkend="SECTscanspamass"/>.
17465 </listitem></varlistentry>
17467 <term><varname>$spool_directory</varname></term>
17470 <indexterm role="concept">
17471 <primary><varname>$spool_directory</varname></primary>
17473 The name of Exim’s spool directory.
17475 </listitem></varlistentry>
17477 <term><varname>$spool_inodes</varname></term>
17480 <indexterm role="concept">
17481 <primary><varname>$spool_inodes</varname></primary>
17483 The number of free inodes in the disk partition where Exim’s spool files are
17484 being written. The value is recalculated whenever the variable is referenced.
17485 If the relevant file system does not have the concept of inodes, the value of
17486 is -1. See also the <option>check_spool_inodes</option> option.
17488 </listitem></varlistentry>
17490 <term><varname>$spool_space</varname></term>
17493 <indexterm role="concept">
17494 <primary><varname>$spool_space</varname></primary>
17496 The amount of free space (as a number of kilobytes) in the disk partition where
17497 Exim’s spool files are being written. The value is recalculated whenever the
17498 variable is referenced. If the operating system does not have the ability to
17499 find the amount of free space (only true for experimental systems), the space
17500 value is -1. For example, to check in an ACL that there is at least 50
17501 megabytes free on the spool, you could write:
17503 <literallayout class="monospaced">
17504 condition = ${if > {$spool_space}{50000}}
17507 See also the <option>check_spool_space</option> option.
17509 </listitem></varlistentry>
17511 <term><varname>$thisaddress</varname></term>
17514 <indexterm role="concept">
17515 <primary><varname>$thisaddress</varname></primary>
17517 This variable is set only during the processing of the <option>foranyaddress</option>
17518 command in a filter file. Its use is explained in the description of that
17519 command, which can be found in the separate document entitled <emphasis>Exim’s
17520 interfaces to mail filtering</emphasis>.
17522 </listitem></varlistentry>
17524 <term><varname>$tls_certificate_verified</varname></term>
17527 <indexterm role="concept">
17528 <primary><varname>$tls_certificate_verified</varname></primary>
17530 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
17531 message was received, and <quote>0</quote> otherwise.
17533 </listitem></varlistentry>
17535 <term><varname>$tls_cipher</varname></term>
17538 <indexterm role="concept">
17539 <primary><varname>$tls_cipher</varname></primary>
17541 When a message is received from a remote host over an encrypted SMTP
17542 connection, this variable is set to the cipher suite that was negotiated, for
17543 example DES-CBC3-SHA. In other circumstances, in particular, for message
17544 received over unencrypted connections, the variable is empty. See chapter
17545 <xref linkend="CHAPTLS"/> for details of TLS support.
17547 </listitem></varlistentry>
17549 <term><varname>$tls_peerdn</varname></term>
17552 <indexterm role="concept">
17553 <primary><varname>$tls_peerdn</varname></primary>
17555 When a message is received from a remote host over an encrypted SMTP
17556 connection, and Exim is configured to request a certificate from the client,
17557 the value of the Distinguished Name of the certificate is made available in the
17558 <varname>$tls_peerdn</varname> during subsequent processing.
17560 </listitem></varlistentry>
17562 <term><varname>$tod_bsdinbox</varname></term>
17565 <indexterm role="concept">
17566 <primary><varname>$tod_bsdinbox</varname></primary>
17568 The time of day and the date, in the format required for BSD-style mailbox
17569 files, for example: Thu Oct 17 17:14:09 1995.
17571 </listitem></varlistentry>
17573 <term><varname>$tod_epoch</varname></term>
17576 <indexterm role="concept">
17577 <primary><varname>$tod_epoch</varname></primary>
17579 The time and date as a number of seconds since the start of the Unix epoch.
17581 </listitem></varlistentry>
17583 <term><varname>$tod_full</varname></term>
17586 <indexterm role="concept">
17587 <primary><varname>$tod_full</varname></primary>
17589 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
17590 +0100. The timezone is always given as a numerical offset from UTC, with
17591 positive values used for timezones that are ahead (east) of UTC, and negative
17592 values for those that are behind (west).
17594 </listitem></varlistentry>
17596 <term><varname>$tod_log</varname></term>
17599 <indexterm role="concept">
17600 <primary><varname>$tod_log</varname></primary>
17602 The time and date in the format used for writing Exim’s log files, for example:
17603 1995-10-12 15:32:29, but without a timezone.
17605 </listitem></varlistentry>
17607 <term><varname>$tod_logfile</varname></term>
17610 <indexterm role="concept">
17611 <primary><varname>$tod_logfile</varname></primary>
17613 This variable contains the date in the format yyyymmdd. This is the format that
17614 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
17617 </listitem></varlistentry>
17619 <term><varname>$tod_zone</varname></term>
17622 <indexterm role="concept">
17623 <primary><varname>$tod_zone</varname></primary>
17625 This variable contains the numerical value of the local timezone, for example:
17628 </listitem></varlistentry>
17630 <term><varname>$tod_zulu</varname></term>
17633 <indexterm role="concept">
17634 <primary><varname>$tod_zulu</varname></primary>
17636 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
17637 by ISO 8601, for example: 20030221154023Z.
17639 </listitem></varlistentry>
17641 <term><varname>$value</varname></term>
17644 <indexterm role="concept">
17645 <primary><varname>$value</varname></primary>
17647 This variable contains the result of an expansion lookup, extraction operation,
17648 or external command, as described above.
17650 </listitem></varlistentry>
17652 <term><varname>$version_number</varname></term>
17655 <indexterm role="concept">
17656 <primary><varname>$version_number</varname></primary>
17658 The version number of Exim.
17660 </listitem></varlistentry>
17662 <term><varname>$warn_message_delay</varname></term>
17665 <indexterm role="concept">
17666 <primary><varname>$warn_message_delay</varname></primary>
17668 This variable is set only during the creation of a message warning about a
17669 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
17671 </listitem></varlistentry>
17673 <term><varname>$warn_message_recipients</varname></term>
17676 <indexterm role="concept">
17677 <primary><varname>$warn_message_recipients</varname></primary>
17679 This variable is set only during the creation of a message warning about a
17680 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
17682 </listitem></varlistentry>
17685 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
17690 <chapter id="CHAPperl">
17691 <title>Embedded Perl</title>
17693 <indexterm role="concept" id="IIDperl" class="startofrange">
17694 <primary>Perl</primary>
17695 <secondary>calling from Exim</secondary>
17697 Exim can be built to include an embedded Perl interpreter. When this is done,
17698 Perl subroutines can be called as part of the string expansion process. To make
17699 use of the Perl support, you need version 5.004 or later of Perl installed on
17700 your system. To include the embedded interpreter in the Exim binary, include
17703 <literallayout class="monospaced">
17707 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
17710 <title>Setting up so Perl can be used</title>
17712 <indexterm role="concept">
17713 <primary><option>perl_startup</option></primary>
17715 Access to Perl subroutines is via a global configuration option called
17716 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
17717 no <option>perl_startup</option> option in the Exim configuration file then no Perl
17718 interpreter is started and there is almost no overhead for Exim (since none of
17719 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
17720 option then the associated value is taken to be Perl code which is executed in
17721 a newly created Perl interpreter.
17724 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
17725 need backslashes before any characters to escape special meanings. The option
17726 should usually be something like
17728 <literallayout class="monospaced">
17729 perl_startup = do '/etc/exim.pl'
17732 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
17733 use from Exim. Exim can be configured either to start up a Perl interpreter as
17734 soon as it is entered, or to wait until the first time it is needed. Starting
17735 the interpreter at the beginning ensures that it is done while Exim still has
17736 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
17737 fact used in a particular run. Also, note that this does not mean that Exim is
17738 necessarily running as root when Perl is called at a later time. By default,
17739 the interpreter is started only when it is needed, but this can be changed in
17745 <indexterm role="concept">
17746 <primary><option>perl_at_start</option></primary>
17748 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
17749 a startup when Exim is entered.
17754 The command line option <option>-ps</option> also requests a startup when Exim is entered,
17755 overriding the setting of <option>perl_at_start</option>.
17760 There is also a command line option <option>-pd</option> (for delay) which suppresses the
17761 initial startup, even if <option>perl_at_start</option> is set.
17765 <title>Calling Perl subroutines</title>
17767 When the configuration file includes a <option>perl_startup</option> option you can make use
17768 of the string expansion item to call the Perl subroutines that are defined
17769 by the <option>perl_startup</option> code. The operator is used in any of the following
17772 <literallayout class="monospaced">
17774 ${perl{foo}{argument}}
17775 ${perl{foo}{argument1}{argument2} ... }
17778 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
17779 arguments may be passed. Passing more than this results in an expansion failure
17780 with an error message of the form
17782 <literallayout class="monospaced">
17783 Too many arguments passed to Perl subroutine "foo" (max is 8)
17786 The return value of the Perl subroutine is evaluated in a scalar context before
17787 it is passed back to Exim to be inserted into the expanded string. If the
17788 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
17789 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
17790 by obeying Perl’s <option>die</option> function, the expansion fails with the error message
17791 that was passed to <option>die</option>.
17795 <title>Calling Exim functions from Perl</title>
17797 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
17798 is available to call back into Exim’s string expansion function. For example,
17801 <literallayout class="monospaced">
17802 my $lp = Exim::expand_string('$local_part');
17805 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
17806 Note those are single quotes and not double quotes to protect against
17807 <varname>$local_part</varname> being interpolated as a Perl variable.
17810 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
17811 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
17812 expansion string, the Perl call from the original expansion string fails with
17813 an appropriate error message, in the same way as if <option>die</option> were used.
17816 <indexterm role="concept">
17817 <primary>debugging</primary>
17818 <secondary>from embedded Perl</secondary>
17820 <indexterm role="concept">
17821 <primary>log</primary>
17822 <secondary>writing from embedded Perl</secondary>
17824 Two other Exim functions are available for use from within Perl code.
17825 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim’s
17826 debugging is enabled. If you want a newline at the end, you must supply it.
17827 <emphasis>Exim::log_write()</emphasis> writes a string to Exim’s main log, adding a leading
17828 timestamp. In this case, you should not supply a terminating newline.
17832 <title>Use of standard output and error by Perl</title>
17834 <indexterm role="concept">
17835 <primary>Perl</primary>
17836 <secondary>standard output and error</secondary>
17838 You should not write to the standard error or output streams from within your
17839 Perl code, as it is not defined how these are set up. In versions of Exim
17840 before 4.50, it is possible for the standard output or error to refer to the
17841 SMTP connection during message reception via the daemon. Writing to this stream
17842 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
17843 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
17844 avoided, but the output is lost.
17847 <indexterm role="concept">
17848 <primary>Perl</primary>
17849 <secondary>use of <option>warn</option></secondary>
17851 The Perl <option>warn</option> statement writes to the standard error stream by default.
17852 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
17853 you have no control. When Exim starts up the Perl interpreter, it arranges for
17854 output from the <option>warn</option> statement to be written to the Exim main log. You can
17855 change this by including appropriate Perl magic somewhere in your Perl code.
17856 For example, to discard <option>warn</option> output completely, you need this:
17858 <literallayout class="monospaced">
17859 $SIG{__WARN__} = sub { };
17862 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
17863 example, the code for the subroutine is empty, so it does nothing, but you can
17864 include any Perl code that you like. The text of the <option>warn</option> message is passed
17865 as the first subroutine argument.
17866 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
17871 <chapter id="CHAPinterfaces">
17872 <title>Starting the daemon and the use of network interfaces</title>
17873 <titleabbrev>Starting the daemon</titleabbrev>
17875 <indexterm role="concept">
17876 <primary>daemon</primary>
17877 <secondary>starting</secondary>
17879 <indexterm role="concept">
17880 <primary>interface</primary>
17881 <secondary>listening</secondary>
17883 <indexterm role="concept">
17884 <primary>network interface</primary>
17886 <indexterm role="concept">
17887 <primary>interface</primary>
17888 <secondary>network</secondary>
17890 <indexterm role="concept">
17891 <primary>IP address</primary>
17892 <secondary>for listening</secondary>
17894 <indexterm role="concept">
17895 <primary>daemon</primary>
17896 <secondary>listening IP addresses</secondary>
17898 <indexterm role="concept">
17899 <primary>TCP/IP</primary>
17900 <secondary>setting listening interfaces</secondary>
17902 <indexterm role="concept">
17903 <primary>TCP/IP</primary>
17904 <secondary>setting listening ports</secondary>
17906 A host that is connected to a TCP/IP network may have one or more physical
17907 hardware network interfaces. Each of these interfaces may be configured as one
17908 or more <quote>logical</quote> interfaces, which are the entities that a program actually
17909 works with. Each of these logical interfaces is associated with an IP address.
17910 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
17911 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
17912 knowledge about the host’s interfaces for use in three different circumstances:
17914 <orderedlist numeration="arabic">
17917 When a listening daemon is started, Exim needs to know which interfaces
17918 and ports to listen on.
17923 When Exim is routing an address, it needs to know which IP addresses
17924 are associated with local interfaces. This is required for the correct
17925 processing of MX lists by removing the local host and others with the
17926 same or higher priority values. Also, Exim needs to detect cases
17927 when an address is routed to an IP address that in fact belongs to the
17928 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
17929 option of the smtp transport is set (as appropriate), this is treated
17930 as an error situation.
17935 When Exim connects to a remote host, it may need to know which interface to use
17936 for the outgoing connection.
17941 Exim’s default behaviour is likely to be appropriate in the vast majority
17942 of cases. If your host has only one interface, and you want all its IP
17943 addresses to be treated in the same way, and you are using only the
17944 standard SMTP port, you should not need to take any special action. The
17945 rest of this chapter does not apply to you.
17948 In a more complicated situation you may want to listen only on certain
17949 interfaces, or on different ports, and for this reason there are a number of
17950 options that can be used to influence Exim’s behaviour. The rest of this
17951 chapter describes how they operate.
17953 <para revisionflag="changed">
17954 When a message is received over TCP/IP, the interface and port that were
17955 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
17958 <title>Starting a listening daemon</title>
17960 When a listening daemon is started (by means of the <option>-bd</option> command line
17961 option), the interfaces and ports on which it listens are controlled by the
17967 <option>daemon_smtp_ports</option> contains a list of default ports. (For backward
17968 compatibility, this option can also be specified in the singular.)
17973 <option>local_interfaces</option> contains list of interface IP addresses on which to
17974 listen. Each item may optionally also specify a port.
17979 The default list separator in both cases is a colon, but this can be changed as
17980 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
17981 it is usually best to change the separator to avoid having to double all the
17982 colons. For example:
17984 <literallayout class="monospaced">
17985 local_interfaces = <; 127.0.0.1 ; \
17988 3ffe:ffff:836f::fe86:a061
17991 There are two different formats for specifying a port along with an IP address
17992 in <option>local_interfaces</option>:
17994 <orderedlist numeration="arabic">
17997 The port is added onto the address with a dot separator. For example, to listen
17998 on port 1234 on two different IP addresses:
18000 <literallayout class="monospaced">
18001 local_interfaces = <; 192.168.23.65.1234 ; \
18002 3ffe:ffff:836f::fe86:a061.1234
18007 The IP address is enclosed in square brackets, and the port is added
18008 with a colon separator, for example:
18010 <literallayout class="monospaced">
18011 local_interfaces = <; [192.168.23.65]:1234 ; \
18012 [3ffe:ffff:836f::fe86:a061]:1234
18017 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
18018 default setting contains just one port:
18020 <literallayout class="monospaced">
18021 daemon_smtp_ports = smtp
18024 If more than one port is listed, each interface that does not have its own port
18025 specified listens on all of them. Ports that are listed in
18026 <option>daemon_smtp_ports</option> can be identified either by name (defined in
18027 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
18028 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
18032 <title>Special IP listening addresses</title>
18034 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
18035 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
18036 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
18037 instead of setting up separate listening sockets for each interface. The
18038 default value of <option>local_interfaces</option> is
18040 <literallayout class="monospaced">
18041 local_interfaces = 0.0.0.0
18044 when Exim is built without IPv6 support; otherwise it is:
18046 <literallayout class="monospaced">
18047 local_interfaces = <; ::0 ; 0.0.0.0
18050 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
18054 <title>Overriding local_interfaces and daemon_smtp_ports</title>
18056 The <option>-oX</option> command line option can be used to override the values of
18057 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
18058 instance. Another way of doing this would be to use macros and the <option>-D</option>
18059 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
18060 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
18064 The value of <option>-oX</option> is a list of items. The default colon separator can be
18065 changed in the usual way if required. If there are any items that do not
18066 contain dots or colons (that is, are not IP addresses), the value of
18067 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
18068 items that do contain dots or colons, the value of <option>local_interfaces</option> is
18069 replaced by those items. Thus, for example,
18071 <literallayout class="monospaced">
18075 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
18078 <literallayout class="monospaced">
18079 -oX 192.168.34.5.1125
18082 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
18083 (However, since <option>local_interfaces</option> now contains no items without ports, the
18084 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
18087 <section id="SECTsupobssmt">
18088 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
18090 <indexterm role="concept">
18091 <primary>ssmtp protocol</primary>
18093 <indexterm role="concept">
18094 <primary>smtps protocol</primary>
18096 <indexterm role="concept">
18097 <primary>SMTP</primary>
18098 <secondary>ssmtp protocol</secondary>
18100 <indexterm role="concept">
18101 <primary>SMTP</primary>
18102 <secondary>smtps protocol</secondary>
18104 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
18105 before the STARTTLS command was standardized for SMTP. Some legacy clients
18106 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
18107 list of port numbers, connections to those ports must use SSMTP. The most
18108 common use of this option is expected to be
18110 <literallayout class="monospaced">
18111 tls_on_connect_ports = 465
18114 because 465 is the usual port number used by the legacy clients. There is also
18115 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
18116 this way when a daemon is started.
18119 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
18120 daemon to listen on those ports. You must still specify them in
18121 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
18122 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
18123 connections via the daemon.)
18127 <title>IPv6 address scopes</title>
18129 <indexterm role="concept">
18130 <primary>IPv6</primary>
18131 <secondary>address scopes</secondary>
18133 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
18134 can, in principle, have the same link-local IPv6 address on different
18135 interfaces. Thus, additional information is needed, over and above the IP
18136 address, to distinguish individual interfaces. A convention of using a
18137 percent sign followed by something (often the interface name) has been
18138 adopted in some cases, leading to addresses like this:
18140 <literallayout class="monospaced">
18141 fe80::202:b3ff:fe03:45c1%eth0
18144 To accommodate this usage, a percent sign followed by an arbitrary string is
18145 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
18146 to convert a textual IPv6 address for actual use. This function recognizes the
18147 percent convention in operating systems that support it, and it processes the
18148 address appropriately. Unfortunately, some older libraries have problems with
18149 <function>getaddrinfo()</function>. If
18151 <literallayout class="monospaced">
18152 IPV6_USE_INET_PTON=yes
18155 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
18156 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
18157 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
18158 function.) Of course, this means that the additional functionality of
18159 <function>getaddrinfo()</function> – recognizing scoped addresses – is lost.
18163 <title>Disabling IPv6</title>
18165 <indexterm role="concept">
18166 <primary>IPv6</primary>
18167 <secondary>disabling</secondary>
18169 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
18170 run on a host whose kernel does not support IPv6. The binary will fall back to
18171 using IPv4, but it may waste resources looking up AAAA records, and trying to
18172 connect to IPv6 addresses, causing delays to mail delivery. If you set the
18173 <indexterm role="option">
18174 <primary><option>disable_ipv6</option></primary>
18176 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
18177 activities take place. AAAA records are never looked up, and any IPv6 addresses
18178 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
18179 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
18180 to handle IPv6 literal addresses.
18183 On the other hand, when IPv6 is in use, there may be times when you want to
18184 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
18185 option to globally suppress the lookup of AAAA records for specified domains,
18186 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
18187 IPv6 addresses in an individual router.
18191 <title>Examples of starting a listening daemon</title>
18193 The default case in an IPv6 environment is
18195 <literallayout class="monospaced">
18196 daemon_smtp_ports = smtp
18197 local_interfaces = <; ::0 ; 0.0.0.0
18200 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
18201 Either one or two sockets may be used, depending on the characteristics of
18202 the TCP/IP stack. (This is complicated and messy; for more information,
18203 read the comments in the <filename>daemon.c</filename> source file.)
18206 To specify listening on ports 25 and 26 on all interfaces:
18208 <literallayout class="monospaced">
18209 daemon_smtp_ports = 25 : 26
18212 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
18214 <literallayout class="monospaced">
18215 local_interfaces = <; ::0.25 ; ::0.26 \
18216 0.0.0.0.25 ; 0.0.0.0.26
18219 To listen on the default port on all IPv4 interfaces, and on port 26 on the
18220 IPv4 loopback address only:
18222 <literallayout class="monospaced">
18223 local_interfaces = 0.0.0.0 : 127.0.0.1.26
18226 To specify listening on the default port on specific interfaces only:
18228 <literallayout class="monospaced">
18229 local_interfaces = 192.168.34.67 : 192.168.34.67
18232 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
18235 <section id="SECTreclocipadd">
18236 <title>Recognising the local host</title>
18238 The <option>local_interfaces</option> option is also used when Exim needs to determine
18239 whether or not an IP address refers to the local host. That is, the IP
18240 addresses of all the interfaces on which a daemon is listening are always
18244 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
18245 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
18246 available interfaces from the operating system, and extracts the relevant
18247 (that is, IPv4 or IPv6) addresses to use for checking.
18250 Some systems set up large numbers of virtual interfaces in order to provide
18251 many virtual web servers. In this situation, you may want to listen for
18252 email on only a few of the available interfaces, but nevertheless treat all
18253 interfaces as local when routing. You can do this by setting
18254 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
18255 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
18256 used for listening. Consider this example:
18258 <literallayout class="monospaced">
18259 local_interfaces = <; 127.0.0.1 ; ::1 ; \
18261 3ffe:2101:12:1:a00:20ff:fe86:a061
18263 extra_local_interfaces = <; ::0 ; 0.0.0.0
18266 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
18267 address, but all available interface addresses are treated as local when
18271 In some environments the local host name may be in an MX list, but with an IP
18272 address that is not assigned to any local interface. In other cases it may be
18273 desirable to treat other host names as if they referred to the local host. Both
18274 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
18275 This contains host names rather than IP addresses. When a host is referenced
18276 during routing, either via an MX record or directly, it is treated as the local
18277 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
18278 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
18282 <title>Delivering to a remote host</title>
18284 Delivery to a remote host is handled by the smtp transport. By default, it
18285 allows the system’s TCP/IP functions to choose which interface to use (if
18286 there is more than one) when connecting to a remote host. However, the
18287 <option>interface</option> option can be set to specify which interface is used. See the
18288 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
18294 <chapter id="CHAPmainconfig">
18295 <title>Main configuration</title>
18297 <indexterm role="concept" id="IIDconfima" class="startofrange">
18298 <primary>configuration file</primary>
18299 <secondary>main section</secondary>
18301 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
18302 <primary>main configuration</primary>
18304 The first part of the run time configuration file contains three types of item:
18309 Macro definitions: These lines start with an upper case letter. See section
18310 <xref linkend="SECTmacrodefs"/> for details of macro processing.
18315 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
18316 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
18317 section <xref linkend="SECTnamedlists"/>.
18322 Main configuration settings: Each setting occupies one line of the file
18323 (with possible continuations). If any setting is preceded by the word
18324 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
18325 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
18331 This chapter specifies all the main configuration options, along with their
18332 types and default values. For ease of finding a particular option, they appear
18333 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
18334 are now so many options, they are first listed briefly in functional groups, as
18335 an aid to finding the name of the option you are looking for. Some options are
18336 listed in more than one group.
18339 <title>Miscellaneous</title>
18340 <informaltable frame="none">
18341 <tgroup cols="2" colsep="0" rowsep="0">
18342 <colspec colwidth="196pt" align="left"/>
18343 <colspec colwidth="254pt" align="left"/>
18346 <entry><option>bi_command</option></entry>
18347 <entry>to run for <option>-bi</option> command line option</entry>
18350 <entry><option>disable_ipv6</option></entry>
18351 <entry>do no IPv6 processing</entry>
18354 <entry><option>keep_malformed</option></entry>
18355 <entry>for broken files – should not happen</entry>
18358 <entry><option>localhost_number</option></entry>
18359 <entry>for unique message ids in clusters</entry>
18362 <entry><option>message_body_visible</option></entry>
18363 <entry>how much to show in <varname>$message_body</varname></entry>
18366 <entry><option>mua_wrapper</option></entry>
18367 <entry>run in <quote>MUA wrapper</quote> mode</entry>
18370 <entry><option>print_topbitchars</option></entry>
18371 <entry>top-bit characters are printing</entry>
18374 <entry><option>timezone</option></entry>
18375 <entry>force time zone</entry>
18382 <title>Exim parameters</title>
18383 <informaltable frame="none">
18384 <tgroup cols="2" colsep="0" rowsep="0">
18385 <colspec colwidth="196pt" align="left"/>
18386 <colspec colwidth="254pt" align="left"/>
18389 <entry><option>exim_group</option></entry>
18390 <entry>override compiled-in value</entry>
18393 <entry><option>exim_path</option></entry>
18394 <entry>override compiled-in value</entry>
18397 <entry><option>exim_user</option></entry>
18398 <entry>override compiled-in value</entry>
18401 <entry><option>primary_hostname</option></entry>
18402 <entry>default from <function>uname()</function></entry>
18405 <entry><option>split_spool_directory</option></entry>
18406 <entry>use multiple directories</entry>
18409 <entry><option>spool_directory</option></entry>
18410 <entry>override compiled-in value</entry>
18417 <title>Privilege controls</title>
18418 <informaltable frame="none">
18419 <tgroup cols="2" colsep="0" rowsep="0">
18420 <colspec colwidth="196pt" align="left"/>
18421 <colspec colwidth="254pt" align="left"/>
18424 <entry><option>admin_groups</option></entry>
18425 <entry>groups that are Exim admin users</entry>
18428 <entry><option>deliver_drop_privilege</option></entry>
18429 <entry>drop root for delivery processes</entry>
18432 <entry><option>local_from_check</option></entry>
18433 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
18436 <entry><option>local_from_prefix</option></entry>
18437 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
18440 <entry><option>local_from_suffix</option></entry>
18441 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
18444 <entry><option>local_sender_retain</option></entry>
18445 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
18448 <entry><option>never_users</option></entry>
18449 <entry>do not run deliveries as these</entry>
18452 <entry><option>prod_requires_admin</option></entry>
18453 <entry>forced delivery requires admin user</entry>
18456 <entry><option>queue_list_requires_admin</option></entry>
18457 <entry>queue listing requires admin user</entry>
18460 <entry><option>trusted_groups</option></entry>
18461 <entry>groups that are trusted</entry>
18464 <entry><option>trusted_users</option></entry>
18465 <entry>users that are trusted</entry>
18472 <title>Logging</title>
18473 <informaltable frame="none">
18474 <tgroup cols="2" colsep="0" rowsep="0">
18475 <colspec colwidth="196pt" align="left"/>
18476 <colspec colwidth="254pt" align="left"/>
18479 <entry><option>hosts_connection_nolog</option></entry>
18480 <entry>exemption from connect logging</entry>
18483 <entry><option>log_file_path</option></entry>
18484 <entry>override compiled-in value</entry>
18487 <entry><option>log_selector</option></entry>
18488 <entry>set/unset optional logging</entry>
18491 <entry><option>log_timezone</option></entry>
18492 <entry>add timezone to log lines</entry>
18495 <entry><option>message_logs</option></entry>
18496 <entry>create per-message logs</entry>
18499 <entry><option>preserve_message_logs</option></entry>
18500 <entry>after message completion</entry>
18503 <entry><option>process_log_path</option></entry>
18504 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
18507 <entry><option>syslog_duplication</option></entry>
18508 <entry>controls duplicate log lines on syslog</entry>
18511 <entry><option>syslog_facility</option></entry>
18512 <entry>set syslog <quote>facility</quote> field</entry>
18515 <entry><option>syslog_processname</option></entry>
18516 <entry>set syslog <quote>ident</quote> field</entry>
18519 <entry><option>syslog_timestamp</option></entry>
18520 <entry>timestamp syslog lines</entry>
18523 <entry><option>write_rejectlog</option></entry>
18524 <entry>control use of message log</entry>
18531 <title>Frozen messages</title>
18532 <informaltable frame="none">
18533 <tgroup cols="2" colsep="0" rowsep="0">
18534 <colspec colwidth="196pt" align="left"/>
18535 <colspec colwidth="254pt" align="left"/>
18538 <entry><option>auto_thaw</option></entry>
18539 <entry>sets time for retrying frozen messages</entry>
18542 <entry><option>freeze_tell</option></entry>
18543 <entry>send message when freezing</entry>
18546 <entry><option>move_frozen_messages</option></entry>
18547 <entry>to another directory</entry>
18550 <entry><option>timeout_frozen_after</option></entry>
18551 <entry>keep frozen messages only so long</entry>
18558 <title>Data lookups</title>
18559 <informaltable frame="none">
18560 <tgroup cols="2" colsep="0" rowsep="0">
18561 <colspec colwidth="196pt" align="left"/>
18562 <colspec colwidth="254pt" align="left"/>
18565 <entry><option>ldap_default_servers</option></entry>
18566 <entry>used if no server in query</entry>
18569 <entry><option>ldap_version</option></entry>
18570 <entry>set protocol version</entry>
18573 <entry><option>lookup_open_max</option></entry>
18574 <entry>lookup files held open</entry>
18577 <entry><option>mysql_servers</option></entry>
18578 <entry>as it says</entry>
18581 <entry><option>oracle_servers</option></entry>
18582 <entry>as it says</entry>
18585 <entry><option>pgsql_servers</option></entry>
18586 <entry>as it says</entry>
18589 <entry><option>sqlite_lock_timeout</option></entry>
18590 <entry>as it says</entry>
18597 <title>Message ids</title>
18598 <informaltable frame="none">
18599 <tgroup cols="2" colsep="0" rowsep="0">
18600 <colspec colwidth="196pt" align="left"/>
18601 <colspec colwidth="254pt" align="left"/>
18604 <entry><option>message_id_header_domain</option></entry>
18605 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
18608 <entry><option>message_id_header_text</option></entry>
18609 <entry>ditto</entry>
18616 <title>Embedded Perl Startup</title>
18617 <informaltable frame="none">
18618 <tgroup cols="2" colsep="0" rowsep="0">
18619 <colspec colwidth="196pt" align="left"/>
18620 <colspec colwidth="254pt" align="left"/>
18623 <entry><option>perl_at_start</option></entry>
18624 <entry>always start the interpreter</entry>
18627 <entry><option>perl_startup</option></entry>
18628 <entry>code to obey when starting Perl</entry>
18635 <title>Daemon</title>
18636 <informaltable frame="none">
18637 <tgroup cols="2" colsep="0" rowsep="0">
18638 <colspec colwidth="196pt" align="left"/>
18639 <colspec colwidth="254pt" align="left"/>
18642 <entry><option>daemon_smtp_ports</option></entry>
18643 <entry>default ports</entry>
18646 <entry><option>daemon_startup_retries</option></entry>
18647 <entry>number of times to retry</entry>
18650 <entry><option>daemon_startup_sleep</option></entry>
18651 <entry>time to sleep between tries</entry>
18654 <entry><option>extra_local_interfaces</option></entry>
18655 <entry>not necessarily listened on</entry>
18658 <entry><option>local_interfaces</option></entry>
18659 <entry>on which to listen, with optional ports</entry>
18662 <entry><option>pid_file_path</option></entry>
18663 <entry>override compiled-in value</entry>
18666 <entry><option>queue_run_max</option></entry>
18667 <entry>maximum simultaneous queue runners</entry>
18674 <title>Resource control</title>
18675 <informaltable frame="none">
18676 <tgroup cols="2" colsep="0" rowsep="0">
18677 <colspec colwidth="196pt" align="left"/>
18678 <colspec colwidth="254pt" align="left"/>
18681 <entry><option>check_log_inodes</option></entry>
18682 <entry>before accepting a message</entry>
18685 <entry><option>check_log_space</option></entry>
18686 <entry>before accepting a message</entry>
18689 <entry><option>check_spool_inodes</option></entry>
18690 <entry>before accepting a message</entry>
18693 <entry><option>check_spool_space</option></entry>
18694 <entry>before accepting a message</entry>
18697 <entry><option>deliver_queue_load_max</option></entry>
18698 <entry>no queue deliveries if load high</entry>
18701 <entry><option>queue_only_load</option></entry>
18702 <entry>queue incoming if load high</entry>
18705 <entry><option>queue_run_max</option></entry>
18706 <entry>maximum simultaneous queue runners</entry>
18709 <entry><option>remote_max_parallel</option></entry>
18710 <entry>parallel SMTP delivery per message</entry>
18713 <entry><option>smtp_accept_max</option></entry>
18714 <entry>simultaneous incoming connections</entry>
18717 <entry><option>smtp_accept_max_nonmail</option></entry>
18718 <entry>non-mail commands</entry>
18721 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
18722 <entry>hosts to which the limit applies</entry>
18725 <entry><option>smtp_accept_max_per_connection</option></entry>
18726 <entry>messages per connection</entry>
18729 <entry><option>smtp_accept_max_per_host</option></entry>
18730 <entry>connections from one host</entry>
18733 <entry><option>smtp_accept_queue</option></entry>
18734 <entry>queue mail if more connections</entry>
18737 <entry><option>smtp_accept_queue_per_connection</option></entry>
18738 <entry>queue if more messages per connection</entry>
18741 <entry><option>smtp_accept_reserve</option></entry>
18742 <entry>only reserve hosts if more connections</entry>
18745 <entry><option>smtp_check_spool_space</option></entry>
18746 <entry>from SIZE on MAIL command</entry>
18749 <entry><option>smtp_connect_backlog</option></entry>
18750 <entry>passed to TCP/IP stack</entry>
18753 <entry><option>smtp_load_reserve</option></entry>
18754 <entry>SMTP from reserved hosts if load high</entry>
18757 <entry><option>smtp_reserve_hosts</option></entry>
18758 <entry>these are the reserve hosts</entry>
18765 <title>Policy controls</title>
18766 <informaltable frame="none">
18767 <tgroup cols="2" colsep="0" rowsep="0">
18768 <colspec colwidth="196pt" align="left"/>
18769 <colspec colwidth="254pt" align="left"/>
18772 <entry><option>acl_not_smtp</option></entry>
18773 <entry>ACL for non-SMTP messages</entry>
18776 <entry><option>acl_not_smtp_mime</option></entry>
18777 <entry>ACL for non-SMTP MIME parts</entry>
18780 <entry><option>acl_not_smtp_start</option></entry>
18781 <entry>ACL for start of non-SMTP message</entry>
18784 <entry><option>acl_smtp_auth</option></entry>
18785 <entry>ACL for AUTH</entry>
18788 <entry><option>acl_smtp_connect</option></entry>
18789 <entry>ACL for connection</entry>
18792 <entry><option>acl_smtp_data</option></entry>
18793 <entry>ACL for DATA</entry>
18796 <entry><option>acl_smtp_etrn</option></entry>
18797 <entry>ACL for ETRN</entry>
18800 <entry><option>acl_smtp_expn</option></entry>
18801 <entry>ACL for EXPN</entry>
18804 <entry><option>acl_smtp_helo</option></entry>
18805 <entry>ACL for EHLO or HELO</entry>
18808 <entry><option>acl_smtp_mail</option></entry>
18809 <entry>ACL for MAIL</entry>
18812 <entry><option>acl_smtp_mailauth</option></entry>
18813 <entry>ACL for AUTH on MAIL command</entry>
18816 <entry><option>acl_smtp_mime</option></entry>
18817 <entry>ACL for MIME parts</entry>
18820 <entry><option>acl_smtp_predata</option></entry>
18821 <entry>ACL for start of data</entry>
18824 <entry><option>acl_smtp_quit</option></entry>
18825 <entry>ACL for QUIT</entry>
18828 <entry><option>acl_smtp_rcpt</option></entry>
18829 <entry>ACL for RCPT</entry>
18832 <entry><option>acl_smtp_starttls</option></entry>
18833 <entry>ACL for STARTTLS</entry>
18836 <entry><option>acl_smtp_vrfy</option></entry>
18837 <entry>ACL for VRFY</entry>
18840 <entry><option>av_scanner</option></entry>
18841 <entry>specify virus scanner</entry>
18844 <entry><option>check_rfc2047_length</option></entry>
18845 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
18848 <entry><option>dns_csa_search_limit</option></entry>
18849 <entry>control CSA parent search depth</entry>
18852 <entry><option>dns_csa_use_reverse</option></entry>
18853 <entry>en/disable CSA IP reverse search</entry>
18856 <entry><option>header_maxsize</option></entry>
18857 <entry>total size of message header</entry>
18860 <entry><option>header_line_maxsize</option></entry>
18861 <entry>individual header line limit</entry>
18864 <entry><option>helo_accept_junk_hosts</option></entry>
18865 <entry>allow syntactic junk from these hosts</entry>
18868 <entry><option>helo_allow_chars</option></entry>
18869 <entry>allow illegal chars in HELO names</entry>
18872 <entry><option>helo_lookup_domains</option></entry>
18873 <entry>lookup hostname for these HELO names</entry>
18876 <entry><option>helo_try_verify_hosts</option></entry>
18877 <entry>HELO soft-checked for these hosts</entry>
18880 <entry><option>helo_verify_hosts</option></entry>
18881 <entry>HELO hard-checked for these hosts</entry>
18884 <entry><option>host_lookup</option></entry>
18885 <entry>host name looked up for these hosts</entry>
18888 <entry><option>host_lookup_order</option></entry>
18889 <entry>order of DNS and local name lookups</entry>
18892 <entry><option>host_reject_connection</option></entry>
18893 <entry>reject connection from these hosts</entry>
18896 <entry><option>hosts_treat_as_local</option></entry>
18897 <entry>useful in some cluster configurations</entry>
18900 <entry><option>local_scan_timeout</option></entry>
18901 <entry>timeout for <function>local_scan()</function></entry>
18904 <entry><option>message_size_limit</option></entry>
18905 <entry>for all messages</entry>
18908 <entry><option>percent_hack_domains</option></entry>
18909 <entry>recognize %-hack for these domains</entry>
18912 <entry><option>spamd_address</option></entry>
18913 <entry>set interface to SpamAssassin</entry>
18916 <entry><option>strict_acl_vars</option></entry>
18917 <entry>object to unset ACL variables</entry>
18924 <title>Callout cache</title>
18925 <informaltable frame="none">
18926 <tgroup cols="2" colsep="0" rowsep="0">
18927 <colspec colwidth="196pt" align="left"/>
18928 <colspec colwidth="254pt" align="left"/>
18931 <entry><option>callout_domain_negative_expire</option></entry>
18932 <entry>timeout for negative domain cache item</entry>
18935 <entry><option>callout_domain_positive_expire</option></entry>
18936 <entry>timeout for positive domain cache item</entry>
18939 <entry><option>callout_negative_expire</option></entry>
18940 <entry>timeout for negative address cache item</entry>
18943 <entry><option>callout_positive_expire</option></entry>
18944 <entry>timeout for positive address cache item</entry>
18947 <entry><option>callout_random_local_part</option></entry>
18948 <entry>string to use for <quote>random</quote> testing</entry>
18956 <informaltable frame="none">
18957 <tgroup cols="2" colsep="0" rowsep="0">
18958 <colspec colwidth="196pt" align="left"/>
18959 <colspec colwidth="254pt" align="left"/>
18962 <entry><option>tls_advertise_hosts</option></entry>
18963 <entry>advertise TLS to these hosts</entry>
18966 <entry><option>tls_certificate</option></entry>
18967 <entry>location of server certificate</entry>
18970 <entry><option>tls_crl</option></entry>
18971 <entry>certificate revocation list</entry>
18974 <entry><option>tls_dhparam</option></entry>
18975 <entry>DH parameters for server</entry>
18978 <entry><option>tls_on_connect_ports</option></entry>
18979 <entry>specify SSMTP (SMTPS) ports</entry>
18982 <entry><option>tls_privatekey</option></entry>
18983 <entry>location of server private key</entry>
18986 <entry><option>tls_remember_esmtp</option></entry>
18987 <entry>don’t reset after starting TLS</entry>
18990 <entry><option>tls_require_ciphers</option></entry>
18991 <entry>specify acceptable cipers</entry>
18994 <entry><option>tls_try_verify_hosts</option></entry>
18995 <entry>try to verify client certificate</entry>
18998 <entry><option>tls_verify_certificates</option></entry>
18999 <entry>expected client certificates</entry>
19002 <entry><option>tls_verify_hosts</option></entry>
19003 <entry>insist on client certificate verify</entry>
19010 <title>Local user handling</title>
19011 <informaltable frame="none">
19012 <tgroup cols="2" colsep="0" rowsep="0">
19013 <colspec colwidth="196pt" align="left"/>
19014 <colspec colwidth="254pt" align="left"/>
19017 <entry><option>finduser_retries</option></entry>
19018 <entry>useful in NIS environments</entry>
19021 <entry><option>gecos_name</option></entry>
19022 <entry>used when creating <emphasis>Sender:</emphasis></entry>
19025 <entry><option>gecos_pattern</option></entry>
19026 <entry>ditto</entry>
19029 <entry><option>max_username_length</option></entry>
19030 <entry>for systems that truncate</entry>
19033 <entry><option>unknown_login</option></entry>
19034 <entry>used when no login name found</entry>
19037 <entry><option>unknown_username</option></entry>
19038 <entry>ditto</entry>
19041 <entry><option>uucp_from_pattern</option></entry>
19042 <entry>for recognizing <quote>From </quote> lines</entry>
19045 <entry><option>uucp_from_sender</option></entry>
19046 <entry>ditto</entry>
19053 <title>All incoming messages (SMTP and non-SMTP)</title>
19054 <informaltable frame="none">
19055 <tgroup cols="2" colsep="0" rowsep="0">
19056 <colspec colwidth="196pt" align="left"/>
19057 <colspec colwidth="254pt" align="left"/>
19060 <entry><option>header_maxsize</option></entry>
19061 <entry>total size of message header</entry>
19064 <entry><option>header_line_maxsize</option></entry>
19065 <entry>individual header line limit</entry>
19068 <entry><option>message_size_limit</option></entry>
19069 <entry>applies to all messages</entry>
19072 <entry><option>percent_hack_domains</option></entry>
19073 <entry>recognize %-hack for these domains</entry>
19076 <entry><option>received_header_text</option></entry>
19077 <entry>expanded to make <emphasis>Received:</emphasis></entry>
19080 <entry><option>received_headers_max</option></entry>
19081 <entry>for mail loop detection</entry>
19084 <entry><option>recipients_max</option></entry>
19085 <entry>limit per message</entry>
19088 <entry><option>recipients_max_reject</option></entry>
19089 <entry>permanently reject excess</entry>
19096 <title>Non-SMTP incoming messages</title>
19097 <informaltable frame="none">
19098 <tgroup cols="2" colsep="0" rowsep="0">
19099 <colspec colwidth="196pt" align="left"/>
19100 <colspec colwidth="254pt" align="left"/>
19103 <entry><option>receive_timeout</option></entry>
19104 <entry>for non-SMTP messages</entry>
19111 <title>Incoming SMTP messages</title>
19113 See also the <emphasis>Policy controls</emphasis> section above.
19115 <informaltable frame="none">
19116 <tgroup cols="2" colsep="0" rowsep="0">
19117 <colspec colwidth="196pt" align="left"/>
19118 <colspec colwidth="254pt" align="left"/>
19121 <entry><option>host_lookup</option></entry>
19122 <entry>host name looked up for these hosts</entry>
19125 <entry><option>host_lookup_order</option></entry>
19126 <entry>order of DNS and local name lookups</entry>
19129 <entry><option>recipient_unqualified_hosts</option></entry>
19130 <entry>may send unqualified recipients</entry>
19133 <entry><option>rfc1413_hosts</option></entry>
19134 <entry>make ident calls to these hosts</entry>
19137 <entry><option>rfc1413_query_timeout</option></entry>
19138 <entry>zero disables ident calls</entry>
19141 <entry><option>sender_unqualified_hosts</option></entry>
19142 <entry>may send unqualified senders</entry>
19145 <entry><option>smtp_accept_keepalive</option></entry>
19146 <entry>some TCP/IP magic</entry>
19149 <entry><option>smtp_accept_max</option></entry>
19150 <entry>simultaneous incoming connections</entry>
19153 <entry><option>smtp_accept_max_nonmail</option></entry>
19154 <entry>non-mail commands</entry>
19157 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
19158 <entry>hosts to which the limit applies</entry>
19161 <entry><option>smtp_accept_max_per_connection</option></entry>
19162 <entry>messages per connection</entry>
19165 <entry><option>smtp_accept_max_per_host</option></entry>
19166 <entry>connections from one host</entry>
19169 <entry><option>smtp_accept_queue</option></entry>
19170 <entry>queue mail if more connections</entry>
19173 <entry><option>smtp_accept_queue_per_connection</option></entry>
19174 <entry>queue if more messages per connection</entry>
19177 <entry><option>smtp_accept_reserve</option></entry>
19178 <entry>only reserve hosts if more connections</entry>
19181 <entry><option>smtp_active_hostname</option></entry>
19182 <entry>host name to use in messages</entry>
19185 <entry><option>smtp_banner</option></entry>
19186 <entry>text for welcome banner</entry>
19189 <entry><option>smtp_check_spool_space</option></entry>
19190 <entry>from SIZE on MAIL command</entry>
19193 <entry><option>smtp_connect_backlog</option></entry>
19194 <entry>passed to TCP/IP stack</entry>
19197 <entry><option>smtp_enforce_sync</option></entry>
19198 <entry>of SMTP command/responses</entry>
19201 <entry><option>smtp_etrn_command</option></entry>
19202 <entry>what to run for ETRN</entry>
19205 <entry><option>smtp_etrn_serialize</option></entry>
19206 <entry>only one at once</entry>
19209 <entry><option>smtp_load_reserve</option></entry>
19210 <entry>only reserve hosts if this load</entry>
19213 <entry><option>smtp_max_unknown_commands</option></entry>
19214 <entry>before dropping connection</entry>
19217 <entry><option>smtp_ratelimit_hosts</option></entry>
19218 <entry>apply ratelimiting to these hosts</entry>
19221 <entry><option>smtp_ratelimit_mail</option></entry>
19222 <entry>ratelimit for MAIL commands</entry>
19225 <entry><option>smtp_ratelimit_rcpt</option></entry>
19226 <entry>ratelimit for RCPT commands</entry>
19229 <entry><option>smtp_receive_timeout</option></entry>
19230 <entry>per command or data line</entry>
19233 <entry><option>smtp_reserve_hosts</option></entry>
19234 <entry>these are the reserve hosts</entry>
19237 <entry><option>smtp_return_error_details</option></entry>
19238 <entry>give detail on rejections</entry>
19245 <title>SMTP extensions</title>
19246 <informaltable frame="none">
19247 <tgroup cols="2" colsep="0" rowsep="0">
19248 <colspec colwidth="196pt" align="left"/>
19249 <colspec colwidth="254pt" align="left"/>
19252 <entry><option>accept_8bitmime</option></entry>
19253 <entry>advertise 8BITMIME</entry>
19256 <entry><option>auth_advertise_hosts</option></entry>
19257 <entry>advertise AUTH to these hosts</entry>
19260 <entry><option>ignore_fromline_hosts</option></entry>
19261 <entry>allow <quote>From </quote> from these hosts</entry>
19264 <entry><option>ignore_fromline_local</option></entry>
19265 <entry>allow <quote>From </quote> from local SMTP</entry>
19268 <entry><option>pipelining_advertise_hosts</option></entry>
19269 <entry>advertise pipelining to these hosts</entry>
19272 <entry><option>tls_advertise_hosts</option></entry>
19273 <entry>advertise TLS to these hosts</entry>
19280 <title>Processing messages</title>
19281 <informaltable frame="none">
19282 <tgroup cols="2" colsep="0" rowsep="0">
19283 <colspec colwidth="196pt" align="left"/>
19284 <colspec colwidth="254pt" align="left"/>
19287 <entry><option>allow_domain_literals</option></entry>
19288 <entry>recognize domain literal syntax</entry>
19291 <entry><option>allow_mx_to_ip</option></entry>
19292 <entry>allow MX to point to IP address</entry>
19295 <entry><option>allow_utf8_domains</option></entry>
19296 <entry>in addresses</entry>
19299 <entry><option>check_rfc2047_length</option></entry>
19300 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
19303 <entry><option>delivery_date_remove</option></entry>
19304 <entry>from incoming messages</entry>
19307 <entry><option>envelope_to_remove</option></entry>
19308 <entry>from incoming messages</entry>
19311 <entry><option>extract_addresses_remove_arguments</option></entry>
19312 <entry>affects <option>-t</option> processing</entry>
19315 <entry><option>headers_charset</option></entry>
19316 <entry>default for translations</entry>
19319 <entry><option>qualify_domain</option></entry>
19320 <entry>default for senders</entry>
19323 <entry><option>qualify_recipient</option></entry>
19324 <entry>default for recipients</entry>
19327 <entry><option>return_path_remove</option></entry>
19328 <entry>from incoming messages</entry>
19331 <entry><option>strip_excess_angle_brackets</option></entry>
19332 <entry>in addresses</entry>
19335 <entry><option>strip_trailing_dot</option></entry>
19336 <entry>at end of addresses</entry>
19339 <entry><option>untrusted_set_sender</option></entry>
19340 <entry>untrusted can set envelope sender</entry>
19347 <title>System filter</title>
19348 <informaltable frame="none">
19349 <tgroup cols="2" colsep="0" rowsep="0">
19350 <colspec colwidth="196pt" align="left"/>
19351 <colspec colwidth="254pt" align="left"/>
19354 <entry><option>system_filter</option></entry>
19355 <entry>locate system filter</entry>
19358 <entry><option>system_filter_directory_transport</option></entry>
19359 <entry>transport for delivery to a directory</entry>
19362 <entry><option>system_filter_file_transport</option></entry>
19363 <entry>transport for delivery to a file</entry>
19366 <entry><option>system_filter_group</option></entry>
19367 <entry>group for filter running</entry>
19370 <entry><option>system_filter_pipe_transport</option></entry>
19371 <entry>transport for delivery to a pipe</entry>
19374 <entry><option>system_filter_reply_transport</option></entry>
19375 <entry>transport for autoreply delivery</entry>
19378 <entry><option>system_filter_user</option></entry>
19379 <entry>user for filter running</entry>
19386 <title>Routing and delivery</title>
19387 <informaltable frame="none">
19388 <tgroup cols="2" colsep="0" rowsep="0">
19389 <colspec colwidth="196pt" align="left"/>
19390 <colspec colwidth="254pt" align="left"/>
19393 <entry><option>disable_ipv6</option></entry>
19394 <entry>do no IPv6 processing</entry>
19397 <entry><option>dns_again_means_nonexist</option></entry>
19398 <entry>for broken domains</entry>
19401 <entry><option>dns_check_names_pattern</option></entry>
19402 <entry>pre-DNS syntax check</entry>
19405 <entry><option>dns_ipv4_lookup</option></entry>
19406 <entry>only v4 lookup for these domains</entry>
19409 <entry><option>dns_retrans</option></entry>
19410 <entry>parameter for resolver</entry>
19413 <entry><option>dns_retry</option></entry>
19414 <entry>parameter for resolver</entry>
19417 <entry><option>hold_domains</option></entry>
19418 <entry>hold delivery for these domains</entry>
19421 <entry><option>local_interfaces</option></entry>
19422 <entry>for routing checks</entry>
19425 <entry><option>queue_domains</option></entry>
19426 <entry>no immediate delivery for these</entry>
19429 <entry><option>queue_only</option></entry>
19430 <entry>no immediate delivery at all</entry>
19433 <entry><option>queue_only_file</option></entry>
19434 <entry>no immediate delivery if file exists</entry>
19437 <entry><option>queue_only_load</option></entry>
19438 <entry>no immediate delivery if load is high</entry>
19441 <entry><option>queue_only_override</option></entry>
19442 <entry>allow command line to override</entry>
19445 <entry><option>queue_run_in_order</option></entry>
19446 <entry>order of arrival</entry>
19449 <entry><option>queue_run_max</option></entry>
19450 <entry>of simultaneous queue runners</entry>
19453 <entry><option>queue_smtp_domains</option></entry>
19454 <entry>no immediate SMTP delivery for these</entry>
19457 <entry><option>remote_max_parallel</option></entry>
19458 <entry>parallel SMTP delivery per message</entry>
19461 <entry><option>remote_sort_domains</option></entry>
19462 <entry>order of remote deliveries</entry>
19465 <entry><option>retry_data_expire</option></entry>
19466 <entry>timeout for retry data</entry>
19469 <entry><option>retry_interval_max</option></entry>
19470 <entry>safety net for retry rules</entry>
19477 <title>Bounce and warning messages</title>
19478 <informaltable frame="none">
19479 <tgroup cols="2" colsep="0" rowsep="0">
19480 <colspec colwidth="196pt" align="left"/>
19481 <colspec colwidth="254pt" align="left"/>
19484 <entry><option>bounce_message_file</option></entry>
19485 <entry>content of bounce</entry>
19488 <entry><option>bounce_message_text</option></entry>
19489 <entry>content of bounce</entry>
19492 <entry><option>bounce_return_body</option></entry>
19493 <entry>include body if returning message</entry>
19496 <entry><option>bounce_return_message</option></entry>
19497 <entry>include original message in bounce</entry>
19500 <entry><option>bounce_return_size_limit</option></entry>
19501 <entry>limit on returned message</entry>
19504 <entry><option>bounce_sender_authentication</option></entry>
19505 <entry>send authenticated sender with bounce</entry>
19508 <entry><option>errors_copy</option></entry>
19509 <entry>copy bounce messages</entry>
19512 <entry><option>errors_reply_to</option></entry>
19513 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
19516 <entry><option>delay_warning</option></entry>
19517 <entry>time schedule</entry>
19520 <entry><option>delay_warning_condition</option></entry>
19521 <entry>condition for warning messages</entry>
19524 <entry><option>ignore_bounce_errors_after</option></entry>
19525 <entry>discard undeliverable bounces</entry>
19528 <entry><option>smtp_return_error_details</option></entry>
19529 <entry>give detail on rejections</entry>
19532 <entry><option>warn_message_file</option></entry>
19533 <entry>content of warning message</entry>
19539 <section id="SECTalomo">
19540 <title>Alphabetical list of main options</title>
19542 Those options that undergo string expansion before use are marked with
19546 <indexterm role="option">
19547 <primary><option>accept_8bitmime</option></primary>
19550 <informaltable frame="all">
19551 <tgroup cols="4" colsep="0" rowsep="0">
19552 <colspec colwidth="8*" align="left"/>
19553 <colspec colwidth="5*" align="center"/>
19554 <colspec colwidth="5*" align="center"/>
19555 <colspec colwidth="6*" align="right"/>
19558 <entry><option>accept_8bitmime</option></entry>
19559 <entry>Use: <emphasis>main</emphasis></entry>
19560 <entry>Type: <emphasis>boolean</emphasis></entry>
19561 <entry>Default: <emphasis>false</emphasis></entry>
19567 <indexterm role="concept">
19568 <primary>8BITMIME</primary>
19570 <indexterm role="concept">
19571 <primary>8-bit characters</primary>
19573 This option causes Exim to send 8BITMIME in its response to an SMTP
19574 EHLO command, and to accept the BODY= parameter on MAIL commands.
19575 However, though Exim is 8-bit clean, it is not a protocol converter, and it
19576 takes no steps to do anything special with messages received by this route.
19577 Consequently, this option is turned off by default.
19580 <indexterm role="option">
19581 <primary><option>acl_not_smtp</option></primary>
19584 <informaltable frame="all">
19585 <tgroup cols="4" colsep="0" rowsep="0">
19586 <colspec colwidth="8*" align="left"/>
19587 <colspec colwidth="5*" align="center"/>
19588 <colspec colwidth="5*" align="center"/>
19589 <colspec colwidth="6*" align="right"/>
19592 <entry><option>acl_not_smtp</option></entry>
19593 <entry>Use: <emphasis>main</emphasis></entry>
19594 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19595 <entry>Default: <emphasis>unset</emphasis></entry>
19601 <indexterm role="concept">
19602 <primary>access control lists (ACLs)</primary>
19603 <secondary>for non-SMTP messages</secondary>
19605 <indexterm role="concept">
19606 <primary>non-SMTP messages</primary>
19607 <secondary>ACLs for</secondary>
19609 This option defines the ACL that is run when a non-SMTP message has been
19610 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
19614 <indexterm role="option">
19615 <primary><option>acl_not_smtp_mime</option></primary>
19618 <informaltable frame="all">
19619 <tgroup cols="4" colsep="0" rowsep="0">
19620 <colspec colwidth="8*" align="left"/>
19621 <colspec colwidth="5*" align="center"/>
19622 <colspec colwidth="5*" align="center"/>
19623 <colspec colwidth="6*" align="right"/>
19626 <entry><option>acl_not_smtp_mime</option></entry>
19627 <entry>Use: <emphasis>main</emphasis></entry>
19628 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19629 <entry>Default: <emphasis>unset</emphasis></entry>
19635 This option defines the ACL that is run for individual MIME parts of non-SMTP
19636 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
19640 <indexterm role="option">
19641 <primary><option>acl_not_smtp_start</option></primary>
19644 <informaltable frame="all">
19645 <tgroup cols="4" colsep="0" rowsep="0">
19646 <colspec colwidth="8*" align="left"/>
19647 <colspec colwidth="5*" align="center"/>
19648 <colspec colwidth="5*" align="center"/>
19649 <colspec colwidth="6*" align="right"/>
19652 <entry><option>acl_not_smtp_start</option></entry>
19653 <entry>Use: <emphasis>main</emphasis></entry>
19654 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19655 <entry>Default: <emphasis>unset</emphasis></entry>
19661 <indexterm role="concept">
19662 <primary>access control lists (ACLs)</primary>
19663 <secondary>at start of non-SMTP message</secondary>
19665 <indexterm role="concept">
19666 <primary>non-SMTP messages</primary>
19667 <secondary>ACLs for</secondary>
19669 This option defines the ACL that is run before Exim starts reading a
19670 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
19673 <indexterm role="option">
19674 <primary><option>acl_smtp_auth</option></primary>
19677 <informaltable frame="all">
19678 <tgroup cols="4" colsep="0" rowsep="0">
19679 <colspec colwidth="8*" align="left"/>
19680 <colspec colwidth="5*" align="center"/>
19681 <colspec colwidth="5*" align="center"/>
19682 <colspec colwidth="6*" align="right"/>
19685 <entry><option>acl_smtp_auth</option></entry>
19686 <entry>Use: <emphasis>main</emphasis></entry>
19687 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19688 <entry>Default: <emphasis>unset</emphasis></entry>
19694 <indexterm role="concept">
19695 <primary>access control lists (ACLs)</primary>
19696 <secondary>setting up for SMTP commands</secondary>
19698 <indexterm role="concept">
19699 <primary>AUTH</primary>
19700 <secondary>ACL for</secondary>
19702 This option defines the ACL that is run when an SMTP AUTH command is
19703 received. See chapter <xref linkend="CHAPACL"/> for further details.
19706 <indexterm role="option">
19707 <primary><option>acl_smtp_connect</option></primary>
19710 <informaltable frame="all">
19711 <tgroup cols="4" colsep="0" rowsep="0">
19712 <colspec colwidth="8*" align="left"/>
19713 <colspec colwidth="5*" align="center"/>
19714 <colspec colwidth="5*" align="center"/>
19715 <colspec colwidth="6*" align="right"/>
19718 <entry><option>acl_smtp_connect</option></entry>
19719 <entry>Use: <emphasis>main</emphasis></entry>
19720 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19721 <entry>Default: <emphasis>unset</emphasis></entry>
19727 <indexterm role="concept">
19728 <primary>access control lists (ACLs)</primary>
19729 <secondary>on SMTP connection</secondary>
19731 This option defines the ACL that is run when an SMTP connection is received.
19732 See chapter <xref linkend="CHAPACL"/> for further details.
19735 <indexterm role="option">
19736 <primary><option>acl_smtp_data</option></primary>
19739 <informaltable frame="all">
19740 <tgroup cols="4" colsep="0" rowsep="0">
19741 <colspec colwidth="8*" align="left"/>
19742 <colspec colwidth="5*" align="center"/>
19743 <colspec colwidth="5*" align="center"/>
19744 <colspec colwidth="6*" align="right"/>
19747 <entry><option>acl_smtp_data</option></entry>
19748 <entry>Use: <emphasis>main</emphasis></entry>
19749 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19750 <entry>Default: <emphasis>unset</emphasis></entry>
19756 <indexterm role="concept">
19757 <primary>DATA</primary>
19758 <secondary>ACL for</secondary>
19760 This option defines the ACL that is run after an SMTP DATA command has been
19761 processed and the message itself has been received, but before the final
19762 acknowledgement is sent. See chapter <xref linkend="CHAPACL"/> for further details.
19765 <indexterm role="option">
19766 <primary><option>acl_smtp_etrn</option></primary>
19769 <informaltable frame="all">
19770 <tgroup cols="4" colsep="0" rowsep="0">
19771 <colspec colwidth="8*" align="left"/>
19772 <colspec colwidth="5*" align="center"/>
19773 <colspec colwidth="5*" align="center"/>
19774 <colspec colwidth="6*" align="right"/>
19777 <entry><option>acl_smtp_etrn</option></entry>
19778 <entry>Use: <emphasis>main</emphasis></entry>
19779 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19780 <entry>Default: <emphasis>unset</emphasis></entry>
19786 <indexterm role="concept">
19787 <primary>ETRN</primary>
19788 <secondary>ACL for</secondary>
19790 This option defines the ACL that is run when an SMTP ETRN command is
19791 received. See chapter <xref linkend="CHAPACL"/> for further details.
19794 <indexterm role="option">
19795 <primary><option>acl_smtp_expn</option></primary>
19798 <informaltable frame="all">
19799 <tgroup cols="4" colsep="0" rowsep="0">
19800 <colspec colwidth="8*" align="left"/>
19801 <colspec colwidth="5*" align="center"/>
19802 <colspec colwidth="5*" align="center"/>
19803 <colspec colwidth="6*" align="right"/>
19806 <entry><option>acl_smtp_expn</option></entry>
19807 <entry>Use: <emphasis>main</emphasis></entry>
19808 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19809 <entry>Default: <emphasis>unset</emphasis></entry>
19815 <indexterm role="concept">
19816 <primary>EXPN</primary>
19817 <secondary>ACL for</secondary>
19819 This option defines the ACL that is run when an SMTP EXPN command is
19820 received. See chapter <xref linkend="CHAPACL"/> for further details.
19823 <indexterm role="option">
19824 <primary><option>acl_smtp_helo</option></primary>
19827 <informaltable frame="all">
19828 <tgroup cols="4" colsep="0" rowsep="0">
19829 <colspec colwidth="8*" align="left"/>
19830 <colspec colwidth="5*" align="center"/>
19831 <colspec colwidth="5*" align="center"/>
19832 <colspec colwidth="6*" align="right"/>
19835 <entry><option>acl_smtp_helo</option></entry>
19836 <entry>Use: <emphasis>main</emphasis></entry>
19837 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19838 <entry>Default: <emphasis>unset</emphasis></entry>
19844 <indexterm role="concept">
19845 <primary>EHLO</primary>
19846 <secondary>ACL for</secondary>
19848 <indexterm role="concept">
19849 <primary>HELO</primary>
19850 <secondary>ACL for</secondary>
19852 This option defines the ACL that is run when an SMTP EHLO or HELO
19853 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
19856 <indexterm role="option">
19857 <primary><option>acl_smtp_mail</option></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>acl_smtp_mail</option></entry>
19869 <entry>Use: <emphasis>main</emphasis></entry>
19870 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19871 <entry>Default: <emphasis>unset</emphasis></entry>
19877 <indexterm role="concept">
19878 <primary>MAIL</primary>
19879 <secondary>ACL for</secondary>
19881 This option defines the ACL that is run when an SMTP MAIL command is
19882 received. See chapter <xref linkend="CHAPACL"/> for further details.
19885 <indexterm role="option">
19886 <primary><option>acl_smtp_mailauth</option></primary>
19889 <informaltable frame="all">
19890 <tgroup cols="4" colsep="0" rowsep="0">
19891 <colspec colwidth="8*" align="left"/>
19892 <colspec colwidth="5*" align="center"/>
19893 <colspec colwidth="5*" align="center"/>
19894 <colspec colwidth="6*" align="right"/>
19897 <entry><option>acl_smtp_mailauth</option></entry>
19898 <entry>Use: <emphasis>main</emphasis></entry>
19899 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19900 <entry>Default: <emphasis>unset</emphasis></entry>
19906 <indexterm role="concept">
19907 <primary>AUTH</primary>
19908 <secondary>on MAIL command</secondary>
19910 This option defines the ACL that is run when there is an AUTH parameter on
19911 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
19912 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
19915 <indexterm role="option">
19916 <primary><option>acl_smtp_mime</option></primary>
19919 <informaltable frame="all">
19920 <tgroup cols="4" colsep="0" rowsep="0">
19921 <colspec colwidth="8*" align="left"/>
19922 <colspec colwidth="5*" align="center"/>
19923 <colspec colwidth="5*" align="center"/>
19924 <colspec colwidth="6*" align="right"/>
19927 <entry><option>acl_smtp_mime</option></entry>
19928 <entry>Use: <emphasis>main</emphasis></entry>
19929 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19930 <entry>Default: <emphasis>unset</emphasis></entry>
19936 <indexterm role="concept">
19937 <primary>MIME content scanning</primary>
19938 <secondary>ACL for</secondary>
19940 This option is available when Exim is built with the content-scanning
19941 extension. It defines the ACL that is run for each MIME part in a message. See
19942 section <xref linkend="SECTscanmimepart"/> for details.
19945 <indexterm role="option">
19946 <primary><option>acl_smtp_predata</option></primary>
19949 <informaltable frame="all">
19950 <tgroup cols="4" colsep="0" rowsep="0">
19951 <colspec colwidth="8*" align="left"/>
19952 <colspec colwidth="5*" align="center"/>
19953 <colspec colwidth="5*" align="center"/>
19954 <colspec colwidth="6*" align="right"/>
19957 <entry><option>acl_smtp_predata</option></entry>
19958 <entry>Use: <emphasis>main</emphasis></entry>
19959 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19960 <entry>Default: <emphasis>unset</emphasis></entry>
19966 This option defines the ACL that is run when an SMTP DATA command is
19967 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
19971 <indexterm role="option">
19972 <primary><option>acl_smtp_quit</option></primary>
19975 <informaltable frame="all">
19976 <tgroup cols="4" colsep="0" rowsep="0">
19977 <colspec colwidth="8*" align="left"/>
19978 <colspec colwidth="5*" align="center"/>
19979 <colspec colwidth="5*" align="center"/>
19980 <colspec colwidth="6*" align="right"/>
19983 <entry><option>acl_smtp_quit</option></entry>
19984 <entry>Use: <emphasis>main</emphasis></entry>
19985 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
19986 <entry>Default: <emphasis>unset</emphasis></entry>
19992 <indexterm role="concept">
19993 <primary>QUIT</primary>
19994 <secondary>ACL for</secondary>
19996 This option defines the ACL that is run when an SMTP QUIT command is
19997 received. See chapter <xref linkend="CHAPACL"/> for further details.
20000 <indexterm role="option">
20001 <primary><option>acl_smtp_rcpt</option></primary>
20004 <informaltable frame="all">
20005 <tgroup cols="4" colsep="0" rowsep="0">
20006 <colspec colwidth="8*" align="left"/>
20007 <colspec colwidth="5*" align="center"/>
20008 <colspec colwidth="5*" align="center"/>
20009 <colspec colwidth="6*" align="right"/>
20012 <entry><option>acl_smtp_rcpt</option></entry>
20013 <entry>Use: <emphasis>main</emphasis></entry>
20014 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20015 <entry>Default: <emphasis>unset</emphasis></entry>
20021 <indexterm role="concept">
20022 <primary>RCPT</primary>
20023 <secondary>ACL for</secondary>
20025 This option defines the ACL that is run when an SMTP RCPT command is
20026 received. See chapter <xref linkend="CHAPACL"/> for further details.
20029 <indexterm role="option">
20030 <primary><option>acl_smtp_starttls</option></primary>
20033 <informaltable frame="all">
20034 <tgroup cols="4" colsep="0" rowsep="0">
20035 <colspec colwidth="8*" align="left"/>
20036 <colspec colwidth="5*" align="center"/>
20037 <colspec colwidth="5*" align="center"/>
20038 <colspec colwidth="6*" align="right"/>
20041 <entry><option>acl_smtp_starttls</option></entry>
20042 <entry>Use: <emphasis>main</emphasis></entry>
20043 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20044 <entry>Default: <emphasis>unset</emphasis></entry>
20050 <indexterm role="concept">
20051 <primary>STARTTLS</primary>
20052 <secondary>ACL for</secondary>
20054 This option defines the ACL that is run when an SMTP STARTTLS command is
20055 received. See chapter <xref linkend="CHAPACL"/> for further details.
20058 <indexterm role="option">
20059 <primary><option>acl_smtp_vrfy</option></primary>
20062 <informaltable frame="all">
20063 <tgroup cols="4" colsep="0" rowsep="0">
20064 <colspec colwidth="8*" align="left"/>
20065 <colspec colwidth="5*" align="center"/>
20066 <colspec colwidth="5*" align="center"/>
20067 <colspec colwidth="6*" align="right"/>
20070 <entry><option>acl_smtp_vrfy</option></entry>
20071 <entry>Use: <emphasis>main</emphasis></entry>
20072 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20073 <entry>Default: <emphasis>unset</emphasis></entry>
20079 <indexterm role="concept">
20080 <primary>VRFY</primary>
20081 <secondary>ACL for</secondary>
20083 This option defines the ACL that is run when an SMTP VRFY command is
20084 received. See chapter <xref linkend="CHAPACL"/> for further details.
20087 <indexterm role="option">
20088 <primary><option>admin_groups</option></primary>
20091 <informaltable frame="all">
20092 <tgroup cols="4" colsep="0" rowsep="0">
20093 <colspec colwidth="8*" align="left"/>
20094 <colspec colwidth="5*" align="center"/>
20095 <colspec colwidth="5*" align="center"/>
20096 <colspec colwidth="6*" align="right"/>
20099 <entry><option>admin_groups</option></entry>
20100 <entry>Use: <emphasis>main</emphasis></entry>
20101 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
20102 <entry>Default: <emphasis>unset</emphasis></entry>
20108 <indexterm role="concept">
20109 <primary>admin user</primary>
20111 This option is expanded just once, at the start of Exim’s processing. If the
20112 current group or any of the supplementary groups of an Exim caller is in this
20113 colon-separated list, the caller has admin privileges. If all your system
20114 programmers are in a specific group, for example, you can give them all Exim
20115 admin privileges by putting that group in <option>admin_groups</option>. However, this does
20116 not permit them to read Exim’s spool files (whose group owner is the Exim gid).
20117 To permit this, you have to add individuals to the Exim group.
20120 <indexterm role="option">
20121 <primary><option>allow_domain_literals</option></primary>
20124 <informaltable frame="all">
20125 <tgroup cols="4" colsep="0" rowsep="0">
20126 <colspec colwidth="8*" align="left"/>
20127 <colspec colwidth="5*" align="center"/>
20128 <colspec colwidth="5*" align="center"/>
20129 <colspec colwidth="6*" align="right"/>
20132 <entry><option>allow_domain_literals</option></entry>
20133 <entry>Use: <emphasis>main</emphasis></entry>
20134 <entry>Type: <emphasis>boolean</emphasis></entry>
20135 <entry>Default: <emphasis>false</emphasis></entry>
20141 <indexterm role="concept">
20142 <primary>domain literal</primary>
20144 If this option is set, the RFC 2822 domain literal format is permitted in
20145 email addresses. The option is not set by default, because the domain literal
20146 format is not normally required these days, and few people know about it. It
20147 has, however, been exploited by mail abusers.
20150 Unfortunately, it seems that some DNS black list maintainers are using this
20151 format to report black listing to postmasters. If you want to accept messages
20152 addressed to your hosts by IP address, you need to set
20153 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
20154 domains (defined in the named domain list <option>local_domains</option> in the default
20155 configuration). This <quote>magic string</quote> matches the domain literal form of all
20156 the local host’s IP addresses.
20159 <indexterm role="option">
20160 <primary><option>allow_mx_to_ip</option></primary>
20163 <informaltable frame="all">
20164 <tgroup cols="4" colsep="0" rowsep="0">
20165 <colspec colwidth="8*" align="left"/>
20166 <colspec colwidth="5*" align="center"/>
20167 <colspec colwidth="5*" align="center"/>
20168 <colspec colwidth="6*" align="right"/>
20171 <entry><option>allow_mx_to_ip</option></entry>
20172 <entry>Use: <emphasis>main</emphasis></entry>
20173 <entry>Type: <emphasis>boolean</emphasis></entry>
20174 <entry>Default: <emphasis>false</emphasis></entry>
20180 <indexterm role="concept">
20181 <primary>MX record</primary>
20182 <secondary>pointing to IP address</secondary>
20184 It appears that more and more DNS zone administrators are breaking the rules
20185 and putting domain names that look like IP addresses on the right hand side of
20186 MX records. Exim follows the rules and rejects this, giving an error message
20187 that explains the mis-configuration. However, some other MTAs support this
20188 practice, so to avoid <quote>Why can’t Exim do this?</quote> complaints,
20189 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
20190 recommended, except when you have no other choice.
20193 <indexterm role="option">
20194 <primary><option>allow_utf8_domains</option></primary>
20197 <informaltable frame="all">
20198 <tgroup cols="4" colsep="0" rowsep="0">
20199 <colspec colwidth="8*" align="left"/>
20200 <colspec colwidth="5*" align="center"/>
20201 <colspec colwidth="5*" align="center"/>
20202 <colspec colwidth="6*" align="right"/>
20205 <entry><option>allow_utf8_domains</option></entry>
20206 <entry>Use: <emphasis>main</emphasis></entry>
20207 <entry>Type: <emphasis>boolean</emphasis></entry>
20208 <entry>Default: <emphasis>false</emphasis></entry>
20214 <indexterm role="concept">
20215 <primary>domain</primary>
20216 <secondary>UTF-8 characters in</secondary>
20218 <indexterm role="concept">
20219 <primary>UTF-8</primary>
20220 <secondary>in domain name</secondary>
20222 Lots of discussion is going on about internationalized domain names. One
20223 camp is strongly in favour of just using UTF-8 characters, and it seems
20224 that at least two other MTAs permit this. This option allows Exim users to
20225 experiment if they wish.
20228 If it is set true, Exim’s domain parsing function allows valid
20229 UTF-8 multicharacters to appear in domain name components, in addition to
20230 letters, digits, and hyphens. However, just setting this option is not
20231 enough; if you want to look up these domain names in the DNS, you must also
20232 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
20233 suitable setting is:
20235 <literallayout class="monospaced">
20236 dns_check_names_pattern = (?i)^(?>(?(1)\.|())[a-z0-9\xc0-\xff]\
20237 (?>[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
20240 Alternatively, you can just disable this feature by setting
20242 <literallayout class="monospaced">
20243 dns_check_names_pattern =
20246 That is, set the option to an empty string so that no check is done.
20249 <indexterm role="option">
20250 <primary><option>auth_advertise_hosts</option></primary>
20253 <informaltable frame="all">
20254 <tgroup cols="4" colsep="0" rowsep="0">
20255 <colspec colwidth="8*" align="left"/>
20256 <colspec colwidth="5*" align="center"/>
20257 <colspec colwidth="5*" align="center"/>
20258 <colspec colwidth="6*" align="right"/>
20261 <entry><option>auth_advertise_hosts</option></entry>
20262 <entry>Use: <emphasis>main</emphasis></entry>
20263 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
20264 <entry>Default: <emphasis>*</emphasis></entry>
20270 <indexterm role="concept">
20271 <primary>authentication</primary>
20272 <secondary>advertising</secondary>
20274 <indexterm role="concept">
20275 <primary>AUTH</primary>
20276 <secondary>advertising</secondary>
20278 If any server authentication mechanisms are configured, Exim advertises them in
20279 response to an EHLO command only if the calling host matches this list.
20280 Otherwise, Exim does not advertise AUTH.
20281 Exim does not accept AUTH commands from clients to which it has not
20282 advertised the availability of AUTH. The advertising of individual
20283 authentication mechanisms can be controlled by the use of the
20284 <option>server_advertise_condition</option> generic authenticator option on the individual
20285 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
20288 Certain mail clients (for example, Netscape) require the user to provide a name
20289 and password for authentication if AUTH is advertised, even though it may
20290 not be needed (the host may accept messages from hosts on its local LAN without
20291 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
20292 to make these clients more friendly by excluding them from the set of hosts to
20293 which Exim advertises AUTH.
20296 <indexterm role="concept">
20297 <primary>AUTH</primary>
20298 <secondary>advertising when encrypted</secondary>
20300 If you want to advertise the availability of AUTH only when the connection
20301 is encrypted using TLS, you can make use of the fact that the value of this
20302 option is expanded, with a setting like this:
20304 <literallayout class="monospaced">
20305 auth_advertise_hosts = ${if eq{$tls_cipher}{}{}{*}}
20308 <indexterm role="concept">
20309 <primary><varname>$tls_cipher</varname></primary>
20311 If <varname>$tls_cipher</varname> is empty, the session is not encrypted, and the result of
20312 the expansion is empty, thus matching no hosts. Otherwise, the result of the
20313 expansion is *, which matches all hosts.
20316 <indexterm role="option">
20317 <primary><option>auto_thaw</option></primary>
20320 <informaltable frame="all">
20321 <tgroup cols="4" colsep="0" rowsep="0">
20322 <colspec colwidth="8*" align="left"/>
20323 <colspec colwidth="5*" align="center"/>
20324 <colspec colwidth="5*" align="center"/>
20325 <colspec colwidth="6*" align="right"/>
20328 <entry><option>auto_thaw</option></entry>
20329 <entry>Use: <emphasis>main</emphasis></entry>
20330 <entry>Type: <emphasis>time</emphasis></entry>
20331 <entry>Default: <emphasis>0s</emphasis></entry>
20337 <indexterm role="concept">
20338 <primary>thawing messages</primary>
20340 <indexterm role="concept">
20341 <primary>unfreezing messages</primary>
20343 If this option is set to a time greater than zero, a queue runner will try a
20344 new delivery attempt on any frozen message, other than a bounce message, if
20345 this much time has passed since it was frozen. This may result in the message
20346 being re-frozen if nothing has changed since the last attempt. It is a way of
20347 saying <quote>keep on trying, even though there are big problems</quote>.
20350 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
20351 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
20352 thought to be very useful any more, and its use should probably be avoided.
20355 <indexterm role="option">
20356 <primary><option>av_scanner</option></primary>
20359 <informaltable frame="all">
20360 <tgroup cols="4" colsep="0" rowsep="0">
20361 <colspec colwidth="8*" align="left"/>
20362 <colspec colwidth="5*" align="center"/>
20363 <colspec colwidth="5*" align="center"/>
20364 <colspec colwidth="6*" align="right"/>
20367 <entry><option>av_scanner</option></entry>
20368 <entry>Use: <emphasis>main</emphasis></entry>
20369 <entry>Type: <emphasis>string</emphasis></entry>
20370 <entry>Default: <emphasis>see below</emphasis></entry>
20376 This option is available if Exim is built with the content-scanning extension.
20377 It specifies which anti-virus scanner to use. The default value is:
20379 <literallayout class="monospaced">
20380 sophie:/var/run/sophie
20383 If the value of <option>av_scanner</option> starts with dollar character, it is expanded
20384 before use. See section <xref linkend="SECTscanvirus"/> for further details.
20387 <indexterm role="option">
20388 <primary><option>bi_command</option></primary>
20391 <informaltable frame="all">
20392 <tgroup cols="4" colsep="0" rowsep="0">
20393 <colspec colwidth="8*" align="left"/>
20394 <colspec colwidth="5*" align="center"/>
20395 <colspec colwidth="5*" align="center"/>
20396 <colspec colwidth="6*" align="right"/>
20399 <entry><option>bi_command</option></entry>
20400 <entry>Use: <emphasis>main</emphasis></entry>
20401 <entry>Type: <emphasis>string</emphasis></entry>
20402 <entry>Default: <emphasis>unset</emphasis></entry>
20408 <indexterm role="concept">
20409 <primary><option>-bi</option> option</primary>
20411 This option supplies the name of a command that is run when Exim is called with
20412 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
20413 just the command name, it is not a complete command line. If an argument is
20414 required, it must come from the <option>-oA</option> command line option.
20417 <indexterm role="option">
20418 <primary><option>bounce_message_file</option></primary>
20421 <informaltable frame="all">
20422 <tgroup cols="4" colsep="0" rowsep="0">
20423 <colspec colwidth="8*" align="left"/>
20424 <colspec colwidth="5*" align="center"/>
20425 <colspec colwidth="5*" align="center"/>
20426 <colspec colwidth="6*" align="right"/>
20429 <entry><option>bounce_message_file</option></entry>
20430 <entry>Use: <emphasis>main</emphasis></entry>
20431 <entry>Type: <emphasis>string</emphasis></entry>
20432 <entry>Default: <emphasis>unset</emphasis></entry>
20438 <indexterm role="concept">
20439 <primary>bounce message</primary>
20440 <secondary>customizing</secondary>
20442 <indexterm role="concept">
20443 <primary>customizing</primary>
20444 <secondary>bounce message</secondary>
20446 This option defines a template file containing paragraphs of text to be used
20447 for constructing bounce messages. Details of the file’s contents are given in
20448 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
20451 <indexterm role="option">
20452 <primary><option>bounce_message_text</option></primary>
20455 <informaltable frame="all">
20456 <tgroup cols="4" colsep="0" rowsep="0">
20457 <colspec colwidth="8*" align="left"/>
20458 <colspec colwidth="5*" align="center"/>
20459 <colspec colwidth="5*" align="center"/>
20460 <colspec colwidth="6*" align="right"/>
20463 <entry><option>bounce_message_text</option></entry>
20464 <entry>Use: <emphasis>main</emphasis></entry>
20465 <entry>Type: <emphasis>string</emphasis></entry>
20466 <entry>Default: <emphasis>unset</emphasis></entry>
20472 When this option is set, its contents are included in the default bounce
20473 message immediately after <quote>This message was created automatically by mail
20474 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
20477 <indexterm role="option">
20478 <primary><option>bounce_return_body</option></primary>
20481 <informaltable frame="all">
20482 <tgroup cols="4" colsep="0" rowsep="0">
20483 <colspec colwidth="8*" align="left"/>
20484 <colspec colwidth="5*" align="center"/>
20485 <colspec colwidth="5*" align="center"/>
20486 <colspec colwidth="6*" align="right"/>
20489 <entry><option>bounce_return_body</option></entry>
20490 <entry>Use: <emphasis>main</emphasis></entry>
20491 <entry>Type: <emphasis>boolean</emphasis></entry>
20492 <entry>Default: <emphasis>true</emphasis></entry>
20498 <indexterm role="concept">
20499 <primary>bounce message</primary>
20500 <secondary>including body</secondary>
20502 This option controls whether the body of an incoming message is included in a
20503 bounce message when <option>bounce_return_message</option> is true. The default setting
20504 causes the entire message, both header and body, to be returned (subject to the
20505 value of <option>bounce_return_size_limit</option>). If this option is false, only the
20506 message header is included. In the case of a non-SMTP message containing an
20507 error that is detected during reception, only those header lines preceding the
20508 point at which the error was detected are returned.
20509 <indexterm role="concept">
20510 <primary>bounce message</primary>
20511 <secondary>including original</secondary>
20515 <indexterm role="option">
20516 <primary><option>bounce_return_message</option></primary>
20519 <informaltable frame="all">
20520 <tgroup cols="4" colsep="0" rowsep="0">
20521 <colspec colwidth="8*" align="left"/>
20522 <colspec colwidth="5*" align="center"/>
20523 <colspec colwidth="5*" align="center"/>
20524 <colspec colwidth="6*" align="right"/>
20527 <entry><option>bounce_return_message</option></entry>
20528 <entry>Use: <emphasis>main</emphasis></entry>
20529 <entry>Type: <emphasis>boolean</emphasis></entry>
20530 <entry>Default: <emphasis>true</emphasis></entry>
20536 If this option is set false, none of the original message is included in
20537 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
20538 <option>bounce_return_body</option>.
20541 <indexterm role="option">
20542 <primary><option>bounce_return_size_limit</option></primary>
20545 <informaltable frame="all">
20546 <tgroup cols="4" colsep="0" rowsep="0">
20547 <colspec colwidth="8*" align="left"/>
20548 <colspec colwidth="5*" align="center"/>
20549 <colspec colwidth="5*" align="center"/>
20550 <colspec colwidth="6*" align="right"/>
20553 <entry><option>bounce_return_size_limit</option></entry>
20554 <entry>Use: <emphasis>main</emphasis></entry>
20555 <entry>Type: <emphasis>integer</emphasis></entry>
20556 <entry>Default: <emphasis>100K</emphasis></entry>
20562 <indexterm role="concept">
20563 <primary>size limit</primary>
20564 <secondary>of bounce</secondary>
20566 <indexterm role="concept">
20567 <primary>bounce message</primary>
20568 <secondary>size limit</secondary>
20570 <indexterm role="concept">
20571 <primary>limit</primary>
20572 <secondary>bounce message size</secondary>
20574 This option sets a limit in bytes on the size of messages that are returned to
20575 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
20576 limit should be less than the value of the global <option>message_size_limit</option> and of
20577 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
20578 that Exim generates. If this option is set to zero there is no limit.
20581 When the body of any message that is to be included in a bounce message is
20582 greater than the limit, it is truncated, and a comment pointing this out is
20583 added at the top. The actual cutoff may be greater than the value given, owing
20584 to the use of buffering for transferring the message in chunks (typically 8K in
20585 size). The idea is to save bandwidth on those undeliverable 15-megabyte
20589 <indexterm role="option">
20590 <primary><option>bounce_sender_authentication</option></primary>
20593 <informaltable frame="all">
20594 <tgroup cols="4" colsep="0" rowsep="0">
20595 <colspec colwidth="8*" align="left"/>
20596 <colspec colwidth="5*" align="center"/>
20597 <colspec colwidth="5*" align="center"/>
20598 <colspec colwidth="6*" align="right"/>
20601 <entry><option>bounce_sender_authentication</option></entry>
20602 <entry>Use: <emphasis>main</emphasis></entry>
20603 <entry>Type: <emphasis>string</emphasis></entry>
20604 <entry>Default: <emphasis>unset</emphasis></entry>
20610 <indexterm role="concept">
20611 <primary>bounce message</primary>
20612 <secondary>sender authentication</secondary>
20614 <indexterm role="concept">
20615 <primary>authentication</primary>
20616 <secondary>bounce message</secondary>
20618 <indexterm role="concept">
20619 <primary>AUTH</primary>
20620 <secondary>on bounce message</secondary>
20622 This option provides an authenticated sender address that is sent with any
20623 bounce messages generated by Exim that are sent over an authenticated SMTP
20624 connection. A typical setting might be:
20626 <literallayout class="monospaced">
20627 bounce_sender_authentication = mailer-daemon@my.domain.example
20630 which would cause bounce messages to be sent using the SMTP command:
20632 <literallayout class="monospaced">
20633 MAIL FROM:<> AUTH=mailer-daemon@my.domain.example
20636 The value of <option>bounce_sender_authentication</option> must always be a complete email
20640 <indexterm role="option">
20641 <primary><option>callout_domain_negative_expire</option></primary>
20644 <informaltable frame="all">
20645 <tgroup cols="4" colsep="0" rowsep="0">
20646 <colspec colwidth="8*" align="left"/>
20647 <colspec colwidth="5*" align="center"/>
20648 <colspec colwidth="5*" align="center"/>
20649 <colspec colwidth="6*" align="right"/>
20652 <entry><option>callout_domain_negative_expire</option></entry>
20653 <entry>Use: <emphasis>main</emphasis></entry>
20654 <entry>Type: <emphasis>time</emphasis></entry>
20655 <entry>Default: <emphasis>3h</emphasis></entry>
20661 <indexterm role="concept">
20662 <primary>caching</primary>
20663 <secondary>callout timeouts</secondary>
20665 <indexterm role="concept">
20666 <primary>callout</primary>
20667 <secondary>caching timeouts</secondary>
20669 This option specifies the expiry time for negative callout cache data for a
20670 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
20671 section <xref linkend="SECTcallvercache"/> for details of the caching.
20674 <indexterm role="option">
20675 <primary><option>callout_domain_positive_expire</option></primary>
20678 <informaltable frame="all">
20679 <tgroup cols="4" colsep="0" rowsep="0">
20680 <colspec colwidth="8*" align="left"/>
20681 <colspec colwidth="5*" align="center"/>
20682 <colspec colwidth="5*" align="center"/>
20683 <colspec colwidth="6*" align="right"/>
20686 <entry><option>callout_domain_positive_expire</option></entry>
20687 <entry>Use: <emphasis>main</emphasis></entry>
20688 <entry>Type: <emphasis>time</emphasis></entry>
20689 <entry>Default: <emphasis>7d</emphasis></entry>
20695 This option specifies the expiry time for positive callout cache data for a
20696 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
20697 section <xref linkend="SECTcallvercache"/> for details of the caching.
20700 <indexterm role="option">
20701 <primary><option>callout_negative_expire</option></primary>
20704 <informaltable frame="all">
20705 <tgroup cols="4" colsep="0" rowsep="0">
20706 <colspec colwidth="8*" align="left"/>
20707 <colspec colwidth="5*" align="center"/>
20708 <colspec colwidth="5*" align="center"/>
20709 <colspec colwidth="6*" align="right"/>
20712 <entry><option>callout_negative_expire</option></entry>
20713 <entry>Use: <emphasis>main</emphasis></entry>
20714 <entry>Type: <emphasis>time</emphasis></entry>
20715 <entry>Default: <emphasis>2h</emphasis></entry>
20721 This option specifies the expiry time for negative callout cache data for an
20722 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
20723 section <xref linkend="SECTcallvercache"/> for details of the caching.
20726 <indexterm role="option">
20727 <primary><option>callout_positive_expire</option></primary>
20730 <informaltable frame="all">
20731 <tgroup cols="4" colsep="0" rowsep="0">
20732 <colspec colwidth="8*" align="left"/>
20733 <colspec colwidth="5*" align="center"/>
20734 <colspec colwidth="5*" align="center"/>
20735 <colspec colwidth="6*" align="right"/>
20738 <entry><option>callout_positive_expire</option></entry>
20739 <entry>Use: <emphasis>main</emphasis></entry>
20740 <entry>Type: <emphasis>time</emphasis></entry>
20741 <entry>Default: <emphasis>24h</emphasis></entry>
20747 This option specifies the expiry time for positive callout cache data for an
20748 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
20749 section <xref linkend="SECTcallvercache"/> for details of the caching.
20752 <indexterm role="option">
20753 <primary><option>callout_random_local_part</option></primary>
20756 <informaltable frame="all">
20757 <tgroup cols="4" colsep="0" rowsep="0">
20758 <colspec colwidth="8*" align="left"/>
20759 <colspec colwidth="5*" align="center"/>
20760 <colspec colwidth="5*" align="center"/>
20761 <colspec colwidth="6*" align="right"/>
20764 <entry><option>callout_random_local_part</option></entry>
20765 <entry>Use: <emphasis>main</emphasis></entry>
20766 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20767 <entry>Default: <emphasis>see below</emphasis></entry>
20773 This option defines the <quote>random</quote> local part that can be used as part of
20774 callout verification. The default value is
20776 <literallayout class="monospaced">
20777 $primary_host_name-$tod_epoch-testing
20780 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
20783 <indexterm role="option">
20784 <primary><option>check_log_inodes</option></primary>
20787 <informaltable frame="all">
20788 <tgroup cols="4" colsep="0" rowsep="0">
20789 <colspec colwidth="8*" align="left"/>
20790 <colspec colwidth="5*" align="center"/>
20791 <colspec colwidth="5*" align="center"/>
20792 <colspec colwidth="6*" align="right"/>
20795 <entry><option>check_log_inodes</option></entry>
20796 <entry>Use: <emphasis>main</emphasis></entry>
20797 <entry>Type: <emphasis>integer</emphasis></entry>
20798 <entry>Default: <emphasis>0</emphasis></entry>
20804 See <option>check_spool_space</option> below.
20807 <indexterm role="option">
20808 <primary><option>check_log_space</option></primary>
20811 <informaltable frame="all">
20812 <tgroup cols="4" colsep="0" rowsep="0">
20813 <colspec colwidth="8*" align="left"/>
20814 <colspec colwidth="5*" align="center"/>
20815 <colspec colwidth="5*" align="center"/>
20816 <colspec colwidth="6*" align="right"/>
20819 <entry><option>check_log_space</option></entry>
20820 <entry>Use: <emphasis>main</emphasis></entry>
20821 <entry>Type: <emphasis>integer</emphasis></entry>
20822 <entry>Default: <emphasis>0</emphasis></entry>
20828 See <option>check_spool_space</option> below.
20831 <indexterm role="option">
20832 <primary><option>check_rfc2047_length</option></primary>
20834 <indexterm role="concept">
20835 <primary>RFC 2047</primary>
20836 <secondary>disabling length check</secondary>
20838 <indexterm role="option">
20839 <primary><option>check_rfc2047_length</option></primary>
20842 <informaltable frame="all">
20843 <tgroup cols="4" colsep="0" rowsep="0">
20844 <colspec colwidth="8*" align="left"/>
20845 <colspec colwidth="5*" align="center"/>
20846 <colspec colwidth="5*" align="center"/>
20847 <colspec colwidth="6*" align="right"/>
20850 <entry><option>check_rfc2047_length</option></entry>
20851 <entry>Use: <emphasis> User: main</emphasis></entry>
20852 <entry>Type: <emphasis>boolean</emphasis></entry>
20853 <entry>Default: <emphasis>true</emphasis></entry>
20859 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
20860 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
20861 word; strings to be encoded that exceed this length are supposed to use
20862 multiple encoded words. By default, Exim does not recognize encoded words that
20863 exceed the maximum length. However, it seems that some software, in violation
20864 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
20865 set false, Exim recognizes encoded words of any length.
20868 <indexterm role="option">
20869 <primary><option>check_spool_inodes</option></primary>
20872 <informaltable frame="all">
20873 <tgroup cols="4" colsep="0" rowsep="0">
20874 <colspec colwidth="8*" align="left"/>
20875 <colspec colwidth="5*" align="center"/>
20876 <colspec colwidth="5*" align="center"/>
20877 <colspec colwidth="6*" align="right"/>
20880 <entry><option>check_spool_inodes</option></entry>
20881 <entry>Use: <emphasis>main</emphasis></entry>
20882 <entry>Type: <emphasis>integer</emphasis></entry>
20883 <entry>Default: <emphasis>0</emphasis></entry>
20889 See <option>check_spool_space</option> below.
20892 <indexterm role="option">
20893 <primary><option>check_spool_space</option></primary>
20896 <informaltable frame="all">
20897 <tgroup cols="4" colsep="0" rowsep="0">
20898 <colspec colwidth="8*" align="left"/>
20899 <colspec colwidth="5*" align="center"/>
20900 <colspec colwidth="5*" align="center"/>
20901 <colspec colwidth="6*" align="right"/>
20904 <entry><option>check_spool_space</option></entry>
20905 <entry>Use: <emphasis>main</emphasis></entry>
20906 <entry>Type: <emphasis>integer</emphasis></entry>
20907 <entry>Default: <emphasis>0</emphasis></entry>
20913 <indexterm role="concept">
20914 <primary>checking disk space</primary>
20916 <indexterm role="concept">
20917 <primary>disk space</primary>
20918 <secondary>checking</secondary>
20920 <indexterm role="concept">
20921 <primary>spool directory</primary>
20922 <secondary>checking space</secondary>
20924 The four <option>check_...</option> options allow for checking of disk resources before a
20925 message is accepted.
20928 <indexterm role="concept">
20929 <primary><varname>$log_inodes</varname></primary>
20931 <indexterm role="concept">
20932 <primary><varname>$log_space</varname></primary>
20934 <indexterm role="concept">
20935 <primary><varname>$spool_inodes</varname></primary>
20937 <indexterm role="concept">
20938 <primary><varname>$spool_space</varname></primary>
20940 When any of these options are set, they apply to all incoming messages. If you
20941 want to apply different checks to different kinds of message, you can do so by
20942 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
20943 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
20946 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
20947 either value is greater than zero, for example:
20949 <literallayout class="monospaced">
20950 check_spool_space = 10M
20951 check_spool_inodes = 100
20954 The spool partition is the one that contains the directory defined by
20955 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
20959 <option>check_log_space</option> and <option>check_log_inodes</option> check the partition in which log
20960 files are written if either is greater than zero. These should be set only if
20961 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
20964 If there is less space or fewer inodes than requested, Exim refuses to accept
20965 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
20966 error response to the MAIL command. If ESMTP is in use and there was a
20967 SIZE parameter on the MAIL command, its value is added to the
20968 <option>check_spool_space</option> value, and the check is performed even if
20969 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
20972 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
20973 number of kilobytes. If a non-multiple of 1024 is specified, it is rounded up.
20976 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
20977 failure a message is written to stderr and Exim exits with a non-zero code, as
20978 it obviously cannot send an error message of any kind.
20981 <indexterm role="option">
20982 <primary><option>daemon_smtp_ports</option></primary>
20985 <informaltable frame="all">
20986 <tgroup cols="4" colsep="0" rowsep="0">
20987 <colspec colwidth="8*" align="left"/>
20988 <colspec colwidth="5*" align="center"/>
20989 <colspec colwidth="5*" align="center"/>
20990 <colspec colwidth="6*" align="right"/>
20993 <entry><option>daemon_smtp_ports</option></entry>
20994 <entry>Use: <emphasis>main</emphasis></entry>
20995 <entry>Type: <emphasis>string</emphasis></entry>
20996 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
21002 <indexterm role="concept">
21003 <primary>port</primary>
21004 <secondary>for daemon</secondary>
21006 <indexterm role="concept">
21007 <primary>TCP/IP</primary>
21008 <secondary>setting listening ports</secondary>
21010 This option specifies one or more default SMTP ports on which the Exim daemon
21011 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
21012 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
21015 <indexterm role="option">
21016 <primary><option>daemon_startup_retries</option></primary>
21019 <informaltable frame="all">
21020 <tgroup cols="4" colsep="0" rowsep="0">
21021 <colspec colwidth="8*" align="left"/>
21022 <colspec colwidth="5*" align="center"/>
21023 <colspec colwidth="5*" align="center"/>
21024 <colspec colwidth="6*" align="right"/>
21027 <entry><option>daemon_startup_retries</option></entry>
21028 <entry>Use: <emphasis>main</emphasis></entry>
21029 <entry>Type: <emphasis>integer</emphasis></entry>
21030 <entry>Default: <emphasis>9</emphasis></entry>
21036 <indexterm role="concept">
21037 <primary>daemon startup</primary>
21038 <secondary>retrying</secondary>
21040 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
21041 the daemon at startup when it cannot immediately bind a listening socket
21042 (typically because the socket is already in use): <option>daemon_startup_retries</option>
21043 defines the number of retries after the first failure, and
21044 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
21047 <indexterm role="option">
21048 <primary><option>daemon_startup_sleep</option></primary>
21051 <informaltable frame="all">
21052 <tgroup cols="4" colsep="0" rowsep="0">
21053 <colspec colwidth="8*" align="left"/>
21054 <colspec colwidth="5*" align="center"/>
21055 <colspec colwidth="5*" align="center"/>
21056 <colspec colwidth="6*" align="right"/>
21059 <entry><option>daemon_startup_sleep</option></entry>
21060 <entry>Use: <emphasis>main</emphasis></entry>
21061 <entry>Type: <emphasis>time</emphasis></entry>
21062 <entry>Default: <emphasis>30s</emphasis></entry>
21068 See <option>daemon_startup_retries</option>.
21071 <indexterm role="option">
21072 <primary><option>delay_warning</option></primary>
21075 <informaltable frame="all">
21076 <tgroup cols="4" colsep="0" rowsep="0">
21077 <colspec colwidth="8*" align="left"/>
21078 <colspec colwidth="5*" align="center"/>
21079 <colspec colwidth="5*" align="center"/>
21080 <colspec colwidth="6*" align="right"/>
21083 <entry><option>delay_warning</option></entry>
21084 <entry>Use: <emphasis>main</emphasis></entry>
21085 <entry>Type: <emphasis>time list</emphasis></entry>
21086 <entry>Default: <emphasis>24h</emphasis></entry>
21092 <indexterm role="concept">
21093 <primary>warning of delay</primary>
21095 <indexterm role="concept">
21096 <primary>delay warning</primary>
21097 <secondary>specifying</secondary>
21099 When a message is delayed, Exim sends a warning message to the sender at
21100 intervals specified by this option. The data is a colon-separated list of times
21101 after which to send warning messages. If the value of the option is an empty
21102 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
21103 message has been on the queue for longer than the last time, the last interval
21104 between the times is used to compute subsequent warning times. For example,
21107 <literallayout class="monospaced">
21108 delay_warning = 4h:8h:24h
21111 the first message is sent after 4 hours, the second after 8 hours, and
21112 the third one after 24 hours. After that, messages are sent every 16 hours,
21113 because that is the interval between the last two times on the list. If you set
21114 just one time, it specifies the repeat interval. For example, with:
21116 <literallayout class="monospaced">
21120 messages are repeated every six hours. To stop warnings after a given time, set
21121 a very large time at the end of the list. For example:
21123 <literallayout class="monospaced">
21124 delay_warning = 2h:12h:99d
21127 <indexterm role="option">
21128 <primary><option>delay_warning_condition</option></primary>
21131 <informaltable frame="all">
21132 <tgroup cols="4" colsep="0" rowsep="0">
21133 <colspec colwidth="8*" align="left"/>
21134 <colspec colwidth="5*" align="center"/>
21135 <colspec colwidth="5*" align="center"/>
21136 <colspec colwidth="6*" align="right"/>
21139 <entry><option>delay_warning_condition</option></entry>
21140 <entry>Use: <emphasis>main</emphasis></entry>
21141 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
21142 <entry>Default: <emphasis>see below</emphasis></entry>
21148 <indexterm role="concept">
21149 <primary><varname>$domain</varname></primary>
21151 The string is expanded at the time a warning message might be sent. If all the
21152 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
21153 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
21154 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
21155 <quote>false</quote> (the comparison being done caselessly) then the warning message is
21156 not sent. The default is:
21158 <literallayout class="monospaced">
21159 delay_warning_condition = ${if or {\
21160 { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
21161 { match{$h_precedence:}{(?i)bulk|list|junk} }\
21162 { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
21166 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
21167 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
21168 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
21169 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
21172 <indexterm role="option">
21173 <primary><option>deliver_drop_privilege</option></primary>
21176 <informaltable frame="all">
21177 <tgroup cols="4" colsep="0" rowsep="0">
21178 <colspec colwidth="8*" align="left"/>
21179 <colspec colwidth="5*" align="center"/>
21180 <colspec colwidth="5*" align="center"/>
21181 <colspec colwidth="6*" align="right"/>
21184 <entry><option>deliver_drop_privilege</option></entry>
21185 <entry>Use: <emphasis>main</emphasis></entry>
21186 <entry>Type: <emphasis>boolean</emphasis></entry>
21187 <entry>Default: <emphasis>false</emphasis></entry>
21193 <indexterm role="concept">
21194 <primary>unprivileged delivery</primary>
21196 <indexterm role="concept">
21197 <primary>delivery</primary>
21198 <secondary>unprivileged</secondary>
21200 If this option is set true, Exim drops its root privilege at the start of a
21201 delivery process, and runs as the Exim user throughout. This severely restricts
21202 the kinds of local delivery that are possible, but is viable in certain types
21203 of configuration. There is a discussion about the use of root privilege in
21204 chapter <xref linkend="CHAPsecurity"/>.
21207 <indexterm role="option">
21208 <primary><option>deliver_queue_load_max</option></primary>
21211 <informaltable frame="all">
21212 <tgroup cols="4" colsep="0" rowsep="0">
21213 <colspec colwidth="8*" align="left"/>
21214 <colspec colwidth="5*" align="center"/>
21215 <colspec colwidth="5*" align="center"/>
21216 <colspec colwidth="6*" align="right"/>
21219 <entry><option>deliver_queue_load_max</option></entry>
21220 <entry>Use: <emphasis>main</emphasis></entry>
21221 <entry>Type: <emphasis>fixed-point</emphasis></entry>
21222 <entry>Default: <emphasis>unset</emphasis></entry>
21228 <indexterm role="concept">
21229 <primary>load average</primary>
21231 <indexterm role="concept">
21232 <primary>queue runner</primary>
21233 <secondary>abandoning</secondary>
21235 When this option is set, a queue run is abandoned if the system load average
21236 becomes greater than the value of the option. The option has no effect on
21237 ancient operating systems on which Exim cannot determine the load average.
21238 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
21241 <indexterm role="option">
21242 <primary><option>delivery_date_remove</option></primary>
21245 <informaltable frame="all">
21246 <tgroup cols="4" colsep="0" rowsep="0">
21247 <colspec colwidth="8*" align="left"/>
21248 <colspec colwidth="5*" align="center"/>
21249 <colspec colwidth="5*" align="center"/>
21250 <colspec colwidth="6*" align="right"/>
21253 <entry><option>delivery_date_remove</option></entry>
21254 <entry>Use: <emphasis>main</emphasis></entry>
21255 <entry>Type: <emphasis>boolean</emphasis></entry>
21256 <entry>Default: <emphasis>true</emphasis></entry>
21262 <indexterm role="concept">
21263 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
21265 Exim’s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
21266 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
21267 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
21268 should not be present in incoming messages, and this option causes them to be
21269 removed at the time the message is received, to avoid any problems that might
21270 occur when a delivered message is subsequently sent on to some other recipient.
21273 <indexterm role="option">
21274 <primary><option>disable_ipv6</option></primary>
21277 <informaltable frame="all">
21278 <tgroup cols="4" colsep="0" rowsep="0">
21279 <colspec colwidth="8*" align="left"/>
21280 <colspec colwidth="5*" align="center"/>
21281 <colspec colwidth="5*" align="center"/>
21282 <colspec colwidth="6*" align="right"/>
21285 <entry><option>disable_ipv6</option></entry>
21286 <entry>Use: <emphasis>main</emphasis></entry>
21287 <entry>Type: <emphasis>boolean</emphasis></entry>
21288 <entry>Default: <emphasis>false</emphasis></entry>
21294 <indexterm role="concept">
21295 <primary>IPv6</primary>
21296 <secondary>disabling</secondary>
21298 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
21299 activities take place. AAAA records are never looked up, and any IPv6 addresses
21300 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
21301 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
21302 to handle IPv6 literal addresses.
21305 <indexterm role="option">
21306 <primary><option>dns_again_means_nonexist</option></primary>
21309 <informaltable frame="all">
21310 <tgroup cols="4" colsep="0" rowsep="0">
21311 <colspec colwidth="8*" align="left"/>
21312 <colspec colwidth="5*" align="center"/>
21313 <colspec colwidth="5*" align="center"/>
21314 <colspec colwidth="6*" align="right"/>
21317 <entry><option>dns_again_means_nonexist</option></entry>
21318 <entry>Use: <emphasis>main</emphasis></entry>
21319 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
21320 <entry>Default: <emphasis>unset</emphasis></entry>
21326 <indexterm role="concept">
21327 <primary>DNS</primary>
21328 <secondary><quote>try again</quote> response; overriding</secondary>
21330 DNS lookups give a <quote>try again</quote> response for the DNS errors
21331 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
21332 keep trying to deliver a message, or to give repeated temporary errors to
21333 incoming mail. Sometimes the effect is caused by a badly set up name server and
21334 may persist for a long time. If a domain which exhibits this problem matches
21335 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
21336 This option should be used with care. You can make it apply to reverse lookups
21337 by a setting such as this:
21339 <literallayout class="monospaced">
21340 dns_again_means_nonexist = *.in-addr.arpa
21343 This option applies to all DNS lookups that Exim does. It also applies when the
21344 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
21345 since these are most likely to be caused by DNS lookup problems. The
21346 <command>dnslookup</command> router has some options of its own for controlling what happens
21347 when lookups for MX or SRV records give temporary errors. These more specific
21348 options are applied after this global option.
21351 <indexterm role="option">
21352 <primary><option>dns_check_names_pattern</option></primary>
21355 <informaltable frame="all">
21356 <tgroup cols="4" colsep="0" rowsep="0">
21357 <colspec colwidth="8*" align="left"/>
21358 <colspec colwidth="5*" align="center"/>
21359 <colspec colwidth="5*" align="center"/>
21360 <colspec colwidth="6*" align="right"/>
21363 <entry><option>dns_check_names_pattern</option></entry>
21364 <entry>Use: <emphasis>main</emphasis></entry>
21365 <entry>Type: <emphasis>string</emphasis></entry>
21366 <entry>Default: <emphasis>see below</emphasis></entry>
21372 <indexterm role="concept">
21373 <primary>DNS</primary>
21374 <secondary>pre-check of name syntax</secondary>
21376 When this option is set to a non-empty string, it causes Exim to check domain
21377 names for characters that are not allowed in host names before handing them to
21378 the DNS resolver, because some resolvers give temporary errors for names that
21379 contain unusual characters. If a domain name contains any unwanted characters,
21380 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
21381 done by matching the domain name against a regular expression, which is the
21382 value of this option. The default pattern is
21384 <literallayout class="monospaced">
21385 dns_check_names_pattern = \
21386 (?i)^(?>(?(1)\.|())[^\W_](?>[a-z0-9/-]*[^\W_])?)+$
21389 which permits only letters, digits, slashes, and hyphens in components, but
21390 they must start and end with a letter or digit. Hyphens are not, in fact,
21391 permitted in host names, but they are found in certain NS records (which can be
21392 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
21393 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
21397 <indexterm role="option">
21398 <primary><option>dns_csa_search_limit</option></primary>
21401 <informaltable frame="all">
21402 <tgroup cols="4" colsep="0" rowsep="0">
21403 <colspec colwidth="8*" align="left"/>
21404 <colspec colwidth="5*" align="center"/>
21405 <colspec colwidth="5*" align="center"/>
21406 <colspec colwidth="6*" align="right"/>
21409 <entry><option>dns_csa_search_limit</option></entry>
21410 <entry>Use: <emphasis>main</emphasis></entry>
21411 <entry>Type: <emphasis>integer</emphasis></entry>
21412 <entry>Default: <emphasis>5</emphasis></entry>
21418 This option controls the depth of parental searching for CSA SRV records in the
21419 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
21422 <indexterm role="option">
21423 <primary><option>dns_csa_use_reverse</option></primary>
21426 <informaltable frame="all">
21427 <tgroup cols="4" colsep="0" rowsep="0">
21428 <colspec colwidth="8*" align="left"/>
21429 <colspec colwidth="5*" align="center"/>
21430 <colspec colwidth="5*" align="center"/>
21431 <colspec colwidth="6*" align="right"/>
21434 <entry><option>dns_csa_use_reverse</option></entry>
21435 <entry>Use: <emphasis>main</emphasis></entry>
21436 <entry>Type: <emphasis>boolean</emphasis></entry>
21437 <entry>Default: <emphasis>true</emphasis></entry>
21443 This option controls whether or not an IP address, given as a CSA domain, is
21444 reversed and looked up in the reverse DNS, as described in more detail in
21445 section <xref linkend="SECTverifyCSA"/>.
21448 <indexterm role="option">
21449 <primary><option>dns_ipv4_lookup</option></primary>
21452 <informaltable frame="all">
21453 <tgroup cols="4" colsep="0" rowsep="0">
21454 <colspec colwidth="8*" align="left"/>
21455 <colspec colwidth="5*" align="center"/>
21456 <colspec colwidth="5*" align="center"/>
21457 <colspec colwidth="6*" align="right"/>
21460 <entry><option>dns_ipv4_lookup</option></entry>
21461 <entry>Use: <emphasis>main</emphasis></entry>
21462 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
21463 <entry>Default: <emphasis>unset</emphasis></entry>
21469 <indexterm role="concept">
21470 <primary>IPv6</primary>
21471 <secondary>DNS lookup for AAAA records</secondary>
21473 <indexterm role="concept">
21474 <primary>DNS</primary>
21475 <secondary>IPv6 lookup for AAAA records</secondary>
21477 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
21478 looks for IPv6 address records (AAAA records) as well as IPv4 address records
21479 (A records) when trying to find IP addresses for hosts, unless the host’s
21480 domain matches this list.
21483 This is a fudge to help with name servers that give big delays or otherwise do
21484 not work for the AAAA record type. In due course, when the world’s name
21485 servers have all been upgraded, there should be no need for this option.
21488 <indexterm role="option">
21489 <primary><option>dns_retrans</option></primary>
21492 <informaltable frame="all">
21493 <tgroup cols="4" colsep="0" rowsep="0">
21494 <colspec colwidth="8*" align="left"/>
21495 <colspec colwidth="5*" align="center"/>
21496 <colspec colwidth="5*" align="center"/>
21497 <colspec colwidth="6*" align="right"/>
21500 <entry><option>dns_retrans</option></entry>
21501 <entry>Use: <emphasis>main</emphasis></entry>
21502 <entry>Type: <emphasis>time</emphasis></entry>
21503 <entry>Default: <emphasis>0s</emphasis></entry>
21509 <indexterm role="concept">
21510 <primary>DNS</primary>
21511 <secondary>resolver options</secondary>
21513 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
21514 retransmission and retry parameters for DNS lookups. Values of zero (the
21515 defaults) leave the system default settings unchanged. The first value is the
21516 time between retries, and the second is the number of retries. It isn’t
21517 totally clear exactly how these settings affect the total time a DNS lookup may
21518 take. I haven’t found any documentation about timeouts on DNS lookups; these
21519 parameter values are available in the external resolver interface structure,
21520 but nowhere does it seem to describe how they are used or what you might want
21524 <indexterm role="option">
21525 <primary><option>dns_retry</option></primary>
21528 <informaltable frame="all">
21529 <tgroup cols="4" colsep="0" rowsep="0">
21530 <colspec colwidth="8*" align="left"/>
21531 <colspec colwidth="5*" align="center"/>
21532 <colspec colwidth="5*" align="center"/>
21533 <colspec colwidth="6*" align="right"/>
21536 <entry><option>dns_retry</option></entry>
21537 <entry>Use: <emphasis>main</emphasis></entry>
21538 <entry>Type: <emphasis>integer</emphasis></entry>
21539 <entry>Default: <emphasis>0</emphasis></entry>
21545 See <option>dns_retrans</option> above.
21548 <indexterm role="option">
21549 <primary><option>drop_cr</option></primary>
21552 <informaltable frame="all">
21553 <tgroup cols="4" colsep="0" rowsep="0">
21554 <colspec colwidth="8*" align="left"/>
21555 <colspec colwidth="5*" align="center"/>
21556 <colspec colwidth="5*" align="center"/>
21557 <colspec colwidth="6*" align="right"/>
21560 <entry><option>drop_cr</option></entry>
21561 <entry>Use: <emphasis>main</emphasis></entry>
21562 <entry>Type: <emphasis>boolean</emphasis></entry>
21563 <entry>Default: <emphasis>false</emphasis></entry>
21569 This is an obsolete option that is now a no-op. It used to affect the way Exim
21570 handled CR and LF characters in incoming messages. What happens now is
21571 described in section <xref linkend="SECTlineendings"/>.
21574 <indexterm role="option">
21575 <primary><option>envelope_to_remove</option></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>envelope_to_remove</option></entry>
21587 <entry>Use: <emphasis>main</emphasis></entry>
21588 <entry>Type: <emphasis>boolean</emphasis></entry>
21589 <entry>Default: <emphasis>true</emphasis></entry>
21595 <indexterm role="concept">
21596 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
21598 Exim’s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
21599 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
21600 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
21601 messages’s envelope that caused the delivery to happen. Such headers should not
21602 be present in incoming messages, and this option causes them to be removed at
21603 the time the message is received, to avoid any problems that might occur when a
21604 delivered message is subsequently sent on to some other recipient.
21607 <indexterm role="option">
21608 <primary><option>errors_copy</option></primary>
21611 <informaltable frame="all">
21612 <tgroup cols="4" colsep="0" rowsep="0">
21613 <colspec colwidth="8*" align="left"/>
21614 <colspec colwidth="5*" align="center"/>
21615 <colspec colwidth="5*" align="center"/>
21616 <colspec colwidth="6*" align="right"/>
21619 <entry><option>errors_copy</option></entry>
21620 <entry>Use: <emphasis>main</emphasis></entry>
21621 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
21622 <entry>Default: <emphasis>unset</emphasis></entry>
21628 <indexterm role="concept">
21629 <primary>bounce message</primary>
21630 <secondary>copy to other address</secondary>
21632 <indexterm role="concept">
21633 <primary>copy of bounce message</primary>
21635 Setting this option causes Exim to send bcc copies of bounce messages that it
21636 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
21637 coming from elsewhere. The value of the option is a colon-separated list of
21638 items. Each item consists of a pattern, terminated by white space, followed by
21639 a comma-separated list of email addresses. If a pattern contains spaces, it
21640 must be enclosed in double quotes.
21643 Each pattern is processed in the same way as a single item in an address list
21644 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
21645 the bounce message, the message is copied to the addresses on the list. The
21646 items are scanned in order, and once a matching one is found, no further items
21647 are examined. For example:
21649 <literallayout class="monospaced">
21650 errors_copy = spqr@mydomain postmaster@mydomain.example :\
21651 rqps@mydomain hostmaster@mydomain.example,\
21652 postmaster@mydomain.example
21655 <indexterm role="concept">
21656 <primary><varname>$domain</varname></primary>
21658 <indexterm role="concept">
21659 <primary><varname>$local_part</varname></primary>
21661 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
21662 and <varname>$domain</varname> are set from the original recipient of the error message, and if
21663 there was any wildcard matching in the pattern, the expansion
21664 <indexterm role="concept">
21665 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
21666 <secondary>in <option>errors_copy</option></secondary>
21668 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
21671 <indexterm role="option">
21672 <primary><option>errors_reply_to</option></primary>
21675 <informaltable frame="all">
21676 <tgroup cols="4" colsep="0" rowsep="0">
21677 <colspec colwidth="8*" align="left"/>
21678 <colspec colwidth="5*" align="center"/>
21679 <colspec colwidth="5*" align="center"/>
21680 <colspec colwidth="6*" align="right"/>
21683 <entry><option>errors_reply_to</option></entry>
21684 <entry>Use: <emphasis>main</emphasis></entry>
21685 <entry>Type: <emphasis>string</emphasis></entry>
21686 <entry>Default: <emphasis>unset</emphasis></entry>
21692 <indexterm role="concept">
21693 <primary>bounce message</primary>
21694 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
21696 By default, Exim’s bounce and delivery warning messages contain the header line
21699 <literal>From: Mail Delivery System <Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>></literal>
21702 <indexterm role="option">
21703 <primary><option>quota_warn_message</option></primary>
21705 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
21706 A warning message that is generated by the <option>quota_warn_message</option> option in an
21707 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
21708 overrides the default.
21711 Experience shows that people reply to bounce messages. If the
21712 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
21713 and warning messages. For example:
21715 <literallayout class="monospaced">
21716 errors_reply_to = postmaster@my.domain.example
21719 The value of the option is not expanded. It must specify a valid RFC 2822
21720 address. However, if a warning message that is generated by the
21721 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
21722 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
21726 <indexterm role="option">
21727 <primary><option>exim_group</option></primary>
21730 <informaltable frame="all">
21731 <tgroup cols="4" colsep="0" rowsep="0">
21732 <colspec colwidth="8*" align="left"/>
21733 <colspec colwidth="5*" align="center"/>
21734 <colspec colwidth="5*" align="center"/>
21735 <colspec colwidth="6*" align="right"/>
21738 <entry><option>exim_group</option></entry>
21739 <entry>Use: <emphasis>main</emphasis></entry>
21740 <entry>Type: <emphasis>string</emphasis></entry>
21741 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
21747 <indexterm role="concept">
21748 <primary>gid (group id)</primary>
21749 <secondary>Exim’s own</secondary>
21751 <indexterm role="concept">
21752 <primary>Exim group</primary>
21754 This option changes the gid under which Exim runs when it gives up root
21755 privilege. The default value is compiled into the binary. The value of this
21756 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
21757 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
21758 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
21762 <indexterm role="option">
21763 <primary><option>exim_path</option></primary>
21766 <informaltable frame="all">
21767 <tgroup cols="4" colsep="0" rowsep="0">
21768 <colspec colwidth="8*" align="left"/>
21769 <colspec colwidth="5*" align="center"/>
21770 <colspec colwidth="5*" align="center"/>
21771 <colspec colwidth="6*" align="right"/>
21774 <entry><option>exim_path</option></entry>
21775 <entry>Use: <emphasis>main</emphasis></entry>
21776 <entry>Type: <emphasis>string</emphasis></entry>
21777 <entry>Default: <emphasis>see below</emphasis></entry>
21783 <indexterm role="concept">
21784 <primary>Exim binary</primary>
21785 <secondary>path name</secondary>
21787 This option specifies the path name of the Exim binary, which is used when Exim
21788 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
21789 the directory configured at compile time by the BIN_DIRECTORY setting. It
21790 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
21792 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
21793 you will break those Exim utilities that scan the configuration file to find
21794 where the binary is. (They then use the <option>-bP</option> option to extract option
21795 settings such as the value of <option>spool_directory</option>.)
21798 <indexterm role="option">
21799 <primary><option>exim_user</option></primary>
21802 <informaltable frame="all">
21803 <tgroup cols="4" colsep="0" rowsep="0">
21804 <colspec colwidth="8*" align="left"/>
21805 <colspec colwidth="5*" align="center"/>
21806 <colspec colwidth="5*" align="center"/>
21807 <colspec colwidth="6*" align="right"/>
21810 <entry><option>exim_user</option></entry>
21811 <entry>Use: <emphasis>main</emphasis></entry>
21812 <entry>Type: <emphasis>string</emphasis></entry>
21813 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
21819 <indexterm role="concept">
21820 <primary>uid (user id)</primary>
21821 <secondary>Exim’s own</secondary>
21823 <indexterm role="concept">
21824 <primary>Exim user</primary>
21826 This option changes the uid under which Exim runs when it gives up root
21827 privilege. The default value is compiled into the binary. Ownership of the run
21828 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
21829 options is checked against the values in the binary, not what is set here.
21832 Unless it consists entirely of digits, the string is looked up using
21833 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
21834 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
21835 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
21838 <indexterm role="option">
21839 <primary><option>extra_local_interfaces</option></primary>
21842 <informaltable frame="all">
21843 <tgroup cols="4" colsep="0" rowsep="0">
21844 <colspec colwidth="8*" align="left"/>
21845 <colspec colwidth="5*" align="center"/>
21846 <colspec colwidth="5*" align="center"/>
21847 <colspec colwidth="6*" align="right"/>
21850 <entry><option>extra_local_interfaces</option></entry>
21851 <entry>Use: <emphasis>main</emphasis></entry>
21852 <entry>Type: <emphasis>string list</emphasis></entry>
21853 <entry>Default: <emphasis>unset</emphasis></entry>
21859 This option defines network interfaces that are to be considered local when
21860 routing, but which are not used for listening by the daemon. See section
21861 <xref linkend="SECTreclocipadd"/> for details.
21864 <indexterm role="option">
21865 <primary><option>extract_addresses_remove_ arguments</option></primary>
21868 <informaltable frame="all">
21869 <tgroup cols="4" colsep="0" rowsep="0">
21870 <colspec colwidth="8*" align="left"/>
21871 <colspec colwidth="5*" align="center"/>
21872 <colspec colwidth="5*" align="center"/>
21873 <colspec colwidth="6*" align="right"/>
21876 <entry><option>extract_addresses_remove_ arguments</option></entry>
21877 <entry>Use: <emphasis>main</emphasis></entry>
21878 <entry>Type: <emphasis>boolean</emphasis></entry>
21879 <entry>Default: <emphasis>true</emphasis></entry>
21885 <indexterm role="concept">
21886 <primary><option>-t</option> option</primary>
21888 <indexterm role="concept">
21889 <primary>command line</primary>
21890 <secondary>addresses with <option>-t</option></secondary>
21892 <indexterm role="concept">
21893 <primary>Sendmail compatibility</primary>
21894 <secondary><option>-t</option> option</secondary>
21896 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
21897 are present on the command line when the <option>-t</option> option is used to build an
21898 envelope from a message’s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
21899 line addresses are removed from the recipients list. This is also how Smail
21900 behaves. However, other Sendmail documentation (the O’Reilly book) states that
21901 command line addresses are added to those obtained from the header lines. When
21902 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
21903 argument headers. If it is set false, Exim adds rather than removes argument
21907 <indexterm role="option">
21908 <primary><option>finduser_retries</option></primary>
21911 <informaltable frame="all">
21912 <tgroup cols="4" colsep="0" rowsep="0">
21913 <colspec colwidth="8*" align="left"/>
21914 <colspec colwidth="5*" align="center"/>
21915 <colspec colwidth="5*" align="center"/>
21916 <colspec colwidth="6*" align="right"/>
21919 <entry><option>finduser_retries</option></entry>
21920 <entry>Use: <emphasis>main</emphasis></entry>
21921 <entry>Type: <emphasis>integer</emphasis></entry>
21922 <entry>Default: <emphasis>0</emphasis></entry>
21928 <indexterm role="concept">
21929 <primary>NIS</primary>
21930 <secondary>looking up users; retrying</secondary>
21932 On systems running NIS or other schemes in which user and group information is
21933 distributed from a remote system, there can be times when <function>getpwnam()</function> and
21934 related functions fail, even when given valid data, because things time out.
21935 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
21936 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
21937 many extra times to find a user or a group, waiting for one second between
21941 <indexterm role="concept">
21942 <primary><filename>/etc/passwd</filename></primary>
21943 <secondary>multiple reading of</secondary>
21945 You should not set this option greater than zero if your user information is in
21946 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
21947 search the file multiple times for non-existent users, and also cause delay.
21950 <indexterm role="option">
21951 <primary><option>freeze_tell</option></primary>
21954 <informaltable frame="all">
21955 <tgroup cols="4" colsep="0" rowsep="0">
21956 <colspec colwidth="8*" align="left"/>
21957 <colspec colwidth="5*" align="center"/>
21958 <colspec colwidth="5*" align="center"/>
21959 <colspec colwidth="6*" align="right"/>
21962 <entry><option>freeze_tell</option></entry>
21963 <entry>Use: <emphasis>main</emphasis></entry>
21964 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
21965 <entry>Default: <emphasis>unset</emphasis></entry>
21971 <indexterm role="concept">
21972 <primary>freezing messages</primary>
21973 <secondary>sending a message when freezing</secondary>
21975 On encountering certain errors, or when configured to do so in a system filter,
21976 ACL, or special router, Exim freezes a message. This means that no further
21977 delivery attempts take place until an administrator thaws the message, or the
21978 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
21979 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
21980 warning message whenever it freezes something, unless the message it is
21981 freezing is a locally-generated bounce message. (Without this exception there
21982 is the possibility of looping.) The warning message is sent to the addresses
21983 supplied as the comma-separated value of this option. If several of the
21984 message’s addresses cause freezing, only a single message is sent. If the
21985 freezing was automatic, the reason(s) for freezing can be found in the message
21986 log. If you configure freezing in a filter or ACL, you must arrange for any
21987 logging that you require.
21990 <indexterm role="option">
21991 <primary><option>gecos_name</option></primary>
21994 <informaltable frame="all">
21995 <tgroup cols="4" colsep="0" rowsep="0">
21996 <colspec colwidth="8*" align="left"/>
21997 <colspec colwidth="5*" align="center"/>
21998 <colspec colwidth="5*" align="center"/>
21999 <colspec colwidth="6*" align="right"/>
22002 <entry><option>gecos_name</option></entry>
22003 <entry>Use: <emphasis>main</emphasis></entry>
22004 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
22005 <entry>Default: <emphasis>unset</emphasis></entry>
22011 <indexterm role="concept">
22012 <primary>HP-UX</primary>
22014 <indexterm role="concept">
22015 <primary><quote>gecos</quote> field</primary>
22016 <secondary>parsing</secondary>
22018 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
22019 password file to hold other information in addition to users’ real names. Exim
22020 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
22021 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
22022 of the field are used unchanged, except that, if an ampersand is encountered,
22023 it is replaced by the user’s login name with the first character forced to
22024 upper case, since this is a convention that is observed on many systems.
22027 When these options are set, <option>gecos_pattern</option> is treated as a regular
22028 expression that is to be applied to the field (again with & replaced by the
22029 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
22030 user’s name.
22033 <indexterm role="concept">
22034 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
22035 <secondary>in <option>gecos_name</option></secondary>
22037 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
22038 pick up sub-fields that were matched by the pattern. In HP-UX, where the user’s
22039 name terminates at the first comma, the following can be used:
22041 <literallayout class="monospaced">
22042 gecos_pattern = ([^,]*)
22046 <indexterm role="option">
22047 <primary><option>gecos_pattern</option></primary>
22050 <informaltable frame="all">
22051 <tgroup cols="4" colsep="0" rowsep="0">
22052 <colspec colwidth="8*" align="left"/>
22053 <colspec colwidth="5*" align="center"/>
22054 <colspec colwidth="5*" align="center"/>
22055 <colspec colwidth="6*" align="right"/>
22058 <entry><option>gecos_pattern</option></entry>
22059 <entry>Use: <emphasis>main</emphasis></entry>
22060 <entry>Type: <emphasis>string</emphasis></entry>
22061 <entry>Default: <emphasis>unset</emphasis></entry>
22067 See <option>gecos_name</option> above.
22070 <indexterm role="option">
22071 <primary><option>headers_charset</option></primary>
22074 <informaltable frame="all">
22075 <tgroup cols="4" colsep="0" rowsep="0">
22076 <colspec colwidth="8*" align="left"/>
22077 <colspec colwidth="5*" align="center"/>
22078 <colspec colwidth="5*" align="center"/>
22079 <colspec colwidth="6*" align="right"/>
22082 <entry><option>headers_charset</option></entry>
22083 <entry>Use: <emphasis>main</emphasis></entry>
22084 <entry>Type: <emphasis>string</emphasis></entry>
22085 <entry>Default: <emphasis>see below</emphasis></entry>
22091 This option sets a default character set for translating from encoded MIME
22092 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
22093 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
22094 ultimate default is ISO-8859-1. For more details see the description of header
22095 insertions in section <xref linkend="SECTexpansionitems"/>.
22098 <indexterm role="option">
22099 <primary><option>header_maxsize</option></primary>
22102 <informaltable frame="all">
22103 <tgroup cols="4" colsep="0" rowsep="0">
22104 <colspec colwidth="8*" align="left"/>
22105 <colspec colwidth="5*" align="center"/>
22106 <colspec colwidth="5*" align="center"/>
22107 <colspec colwidth="6*" align="right"/>
22110 <entry><option>header_maxsize</option></entry>
22111 <entry>Use: <emphasis>main</emphasis></entry>
22112 <entry>Type: <emphasis>integer</emphasis></entry>
22113 <entry>Default: <emphasis>see below</emphasis></entry>
22119 <indexterm role="concept">
22120 <primary>header section</primary>
22121 <secondary>maximum size of</secondary>
22123 <indexterm role="concept">
22124 <primary>limit</primary>
22125 <secondary>size of message header section</secondary>
22127 This option controls the overall maximum size of a message’s header
22128 section. The default is the value of HEADER_MAXSIZE in
22129 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
22130 sections are rejected.
22133 <indexterm role="option">
22134 <primary><option>header_line_maxsize</option></primary>
22137 <informaltable frame="all">
22138 <tgroup cols="4" colsep="0" rowsep="0">
22139 <colspec colwidth="8*" align="left"/>
22140 <colspec colwidth="5*" align="center"/>
22141 <colspec colwidth="5*" align="center"/>
22142 <colspec colwidth="6*" align="right"/>
22145 <entry><option>header_line_maxsize</option></entry>
22146 <entry>Use: <emphasis>main</emphasis></entry>
22147 <entry>Type: <emphasis>integer</emphasis></entry>
22148 <entry>Default: <emphasis>0</emphasis></entry>
22154 <indexterm role="concept">
22155 <primary>header lines</primary>
22156 <secondary>maximum size of</secondary>
22158 <indexterm role="concept">
22159 <primary>limit</primary>
22160 <secondary>size of one header line</secondary>
22162 This option limits the length of any individual header line in a message, after
22163 all the continuations have been joined together. Messages with individual
22164 header lines that are longer than the limit are rejected. The default value of
22165 zero means <quote>no limit</quote>.
22168 <indexterm role="option">
22169 <primary><option>helo_accept_junk_hosts</option></primary>
22172 <informaltable frame="all">
22173 <tgroup cols="4" colsep="0" rowsep="0">
22174 <colspec colwidth="8*" align="left"/>
22175 <colspec colwidth="5*" align="center"/>
22176 <colspec colwidth="5*" align="center"/>
22177 <colspec colwidth="6*" align="right"/>
22180 <entry><option>helo_accept_junk_hosts</option></entry>
22181 <entry>Use: <emphasis>main</emphasis></entry>
22182 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
22183 <entry>Default: <emphasis>unset</emphasis></entry>
22189 <indexterm role="concept">
22190 <primary>HELO</primary>
22191 <secondary>accepting junk data</secondary>
22193 <indexterm role="concept">
22194 <primary>EHLO</primary>
22195 <secondary>accepting junk data</secondary>
22197 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
22198 mail, and gives an error response for invalid data. Unfortunately, there are
22199 some SMTP clients that send syntactic junk. They can be accommodated by setting
22200 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
22201 if you want to do semantic checking.
22202 See also <option>helo_allow_chars</option> for a way of extending the permitted character
22206 <indexterm role="option">
22207 <primary><option>helo_allow_chars</option></primary>
22210 <informaltable frame="all">
22211 <tgroup cols="4" colsep="0" rowsep="0">
22212 <colspec colwidth="8*" align="left"/>
22213 <colspec colwidth="5*" align="center"/>
22214 <colspec colwidth="5*" align="center"/>
22215 <colspec colwidth="6*" align="right"/>
22218 <entry><option>helo_allow_chars</option></entry>
22219 <entry>Use: <emphasis>main</emphasis></entry>
22220 <entry>Type: <emphasis>string</emphasis></entry>
22221 <entry>Default: <emphasis>unset</emphasis></entry>
22227 <indexterm role="concept">
22228 <primary>HELO</primary>
22229 <secondary>underscores in</secondary>
22231 <indexterm role="concept">
22232 <primary>EHLO</primary>
22233 <secondary>underscores in</secondary>
22235 <indexterm role="concept">
22236 <primary>underscore in EHLO/HELO</primary>
22238 This option can be set to a string of rogue characters that are permitted in
22239 all EHLO and HELO names in addition to the standard letters, digits,
22240 hyphens, and dots. If you really must allow underscores, you can set
22242 <literallayout class="monospaced">
22243 helo_allow_chars = _
22246 Note that the value is one string, not a list.
22249 <indexterm role="option">
22250 <primary><option>helo_lookup_domains</option></primary>
22253 <informaltable frame="all">
22254 <tgroup cols="4" colsep="0" rowsep="0">
22255 <colspec colwidth="8*" align="left"/>
22256 <colspec colwidth="5*" align="center"/>
22257 <colspec colwidth="5*" align="center"/>
22258 <colspec colwidth="6*" align="right"/>
22261 <entry><option>helo_lookup_domains</option></entry>
22262 <entry>Use: <emphasis>main</emphasis></entry>
22263 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
22264 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
22270 <indexterm role="concept">
22271 <primary>HELO</primary>
22272 <secondary>forcing reverse lookup</secondary>
22274 <indexterm role="concept">
22275 <primary>EHLO</primary>
22276 <secondary>forcing reverse lookup</secondary>
22278 If the domain given by a client in a HELO or EHLO command matches this
22279 list, a reverse lookup is done in order to establish the host’s true name. The
22280 default forces a lookup if the client host gives the server’s name or any of
22281 its IP addresses (in brackets), something that broken clients have been seen to
22285 <indexterm role="option">
22286 <primary><option>helo_try_verify_hosts</option></primary>
22289 <informaltable frame="all">
22290 <tgroup cols="4" colsep="0" rowsep="0">
22291 <colspec colwidth="8*" align="left"/>
22292 <colspec colwidth="5*" align="center"/>
22293 <colspec colwidth="5*" align="center"/>
22294 <colspec colwidth="6*" align="right"/>
22297 <entry><option>helo_try_verify_hosts</option></entry>
22298 <entry>Use: <emphasis>main</emphasis></entry>
22299 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
22300 <entry>Default: <emphasis>unset</emphasis></entry>
22306 <indexterm role="concept">
22307 <primary>HELO verifying</primary>
22308 <secondary>optional</secondary>
22310 <indexterm role="concept">
22311 <primary>EHLO verifying</primary>
22312 <secondary>optional</secondary>
22314 By default, Exim just checks the syntax of HELO and EHLO commands (see
22315 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
22316 to do more extensive checking of the data supplied by these commands. The ACL
22317 condition <literal>verify</literal> <literal>=</literal> <literal>helo</literal> is provided to make this possible.
22318 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
22319 to force the check to occur. From release 4.53 onwards, this is no longer
22320 necessary. If the check has not been done before <literal>verify</literal> <literal>=</literal> <literal>helo</literal> is
22321 encountered, it is done at that time. Consequently, this option is obsolete.
22322 Its specification is retained here for backwards compatibility.
22325 When an EHLO or HELO command is received, if the calling host matches
22326 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
22327 EHLO command either:
22332 is an IP literal matching the calling address of the host, or
22337 <indexterm role="concept">
22338 <primary>DNS</primary>
22339 <secondary>reverse lookup</secondary>
22341 <indexterm role="concept">
22342 <primary>reverse DNS lookup</primary>
22344 matches the host name that Exim obtains by doing a reverse lookup of the
22345 calling host address, or
22350 when looked up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when
22351 available) yields the calling host address.
22356 However, the EHLO or HELO command is not rejected if any of the checks
22357 fail. Processing continues, but the result of the check is remembered, and can
22358 be detected later in an ACL by the <literal>verify</literal> <literal>=</literal> <literal>helo</literal> condition.
22361 <indexterm role="option">
22362 <primary><option>helo_verify_hosts</option></primary>
22365 <informaltable frame="all">
22366 <tgroup cols="4" colsep="0" rowsep="0">
22367 <colspec colwidth="8*" align="left"/>
22368 <colspec colwidth="5*" align="center"/>
22369 <colspec colwidth="5*" align="center"/>
22370 <colspec colwidth="6*" align="right"/>
22373 <entry><option>helo_verify_hosts</option></entry>
22374 <entry>Use: <emphasis>main</emphasis></entry>
22375 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
22376 <entry>Default: <emphasis>unset</emphasis></entry>
22382 <indexterm role="concept">
22383 <primary>HELO verifying</primary>
22384 <secondary>mandatory</secondary>
22386 <indexterm role="concept">
22387 <primary>EHLO verifying</primary>
22388 <secondary>mandatory</secondary>
22390 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
22391 backwards compatibility. For hosts that match this option, Exim checks the host
22392 name given in the HELO or EHLO in the same way as for
22393 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
22394 rejected with a 550 error, and entries are written to the main and reject logs.
22395 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
22399 <indexterm role="option">
22400 <primary><option>hold_domains</option></primary>
22403 <informaltable frame="all">
22404 <tgroup cols="4" colsep="0" rowsep="0">
22405 <colspec colwidth="8*" align="left"/>
22406 <colspec colwidth="5*" align="center"/>
22407 <colspec colwidth="5*" align="center"/>
22408 <colspec colwidth="6*" align="right"/>
22411 <entry><option>hold_domains</option></entry>
22412 <entry>Use: <emphasis>main</emphasis></entry>
22413 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
22414 <entry>Default: <emphasis>unset</emphasis></entry>
22420 <indexterm role="concept">
22421 <primary>domain</primary>
22422 <secondary>delaying delivery</secondary>
22424 <indexterm role="concept">
22425 <primary>delivery</primary>
22426 <secondary>delaying certain domains</secondary>
22428 This option allows mail for particular domains to be held on the queue
22429 manually. The option is overridden if a message delivery is forced with the
22430 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
22431 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
22432 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
22433 it is deferred every time the message is looked at.
22436 This option is intended as a temporary operational measure for delaying the
22437 delivery of mail while some problem is being sorted out, or some new
22438 configuration tested. If you just want to delay the processing of some
22439 domains until a queue run occurs, you should use <option>queue_domains</option> or
22440 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
22443 A setting of <option>hold_domains</option> does not override Exim’s code for removing
22444 messages from the queue if they have been there longer than the longest retry
22445 time in any retry rule. If you want to hold messages for longer than the normal
22446 retry times, insert a dummy retry rule with a long retry time.
22449 <indexterm role="option">
22450 <primary><option>host_lookup</option></primary>
22453 <informaltable frame="all">
22454 <tgroup cols="4" colsep="0" rowsep="0">
22455 <colspec colwidth="8*" align="left"/>
22456 <colspec colwidth="5*" align="center"/>
22457 <colspec colwidth="5*" align="center"/>
22458 <colspec colwidth="6*" align="right"/>
22461 <entry><option>host_lookup</option></entry>
22462 <entry>Use: <emphasis>main</emphasis></entry>
22463 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
22464 <entry>Default: <emphasis>unset</emphasis></entry>
22470 <indexterm role="concept">
22471 <primary>host name lookup</primary>
22472 <secondary>forcing</secondary>
22474 Exim does not look up the name of a calling host from its IP address unless it
22475 is required to compare against some host list, or the host matches
22476 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
22477 option (which normally contains IP addresses rather than host names). The
22478 default configuration file contains
22480 <literallayout class="monospaced">
22484 which causes a lookup to happen for all hosts. If the expense of these lookups
22485 is felt to be too great, the setting can be changed or removed.
22488 After a successful reverse lookup, Exim does a forward lookup on the name it
22489 has obtained, to verify that it yields the IP address that it started with. If
22490 this check fails, Exim behaves as if the name lookup failed.
22493 <indexterm role="concept">
22494 <primary><varname>$host_lookup_failed</varname></primary>
22496 <indexterm role="concept">
22497 <primary><varname>$sender_host_name</varname></primary>
22499 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
22500 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
22501 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and <literal>verify</literal> <literal>=</literal>
22502 <literal>reverse_host_lookup</literal> in ACLs.
22505 <indexterm role="option">
22506 <primary><option>host_lookup_order</option></primary>
22509 <informaltable frame="all">
22510 <tgroup cols="4" colsep="0" rowsep="0">
22511 <colspec colwidth="8*" align="left"/>
22512 <colspec colwidth="5*" align="center"/>
22513 <colspec colwidth="5*" align="center"/>
22514 <colspec colwidth="6*" align="right"/>
22517 <entry><option>host_lookup_order</option></entry>
22518 <entry>Use: <emphasis>main</emphasis></entry>
22519 <entry>Type: <emphasis>string list</emphasis></entry>
22520 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
22526 This option specifies the order of different lookup methods when Exim is trying
22527 to find a host name from an IP address. The default is to do a DNS lookup
22528 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
22529 if that fails. You can change the order of these lookups, or omit one entirely,
22533 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
22534 multiple PTR records in the DNS and the IP address is not listed in
22535 <filename>/etc/hosts</filename>. Different operating systems give different results in this
22536 case. That is why the default tries a DNS lookup first.
22539 <indexterm role="option">
22540 <primary><option>host_reject_connection</option></primary>
22543 <informaltable frame="all">
22544 <tgroup cols="4" colsep="0" rowsep="0">
22545 <colspec colwidth="8*" align="left"/>
22546 <colspec colwidth="5*" align="center"/>
22547 <colspec colwidth="5*" align="center"/>
22548 <colspec colwidth="6*" align="right"/>
22551 <entry><option>host_reject_connection</option></entry>
22552 <entry>Use: <emphasis>main</emphasis></entry>
22553 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
22554 <entry>Default: <emphasis>unset</emphasis></entry>
22560 <indexterm role="concept">
22561 <primary>host</primary>
22562 <secondary>rejecting connections from</secondary>
22564 If this option is set, incoming SMTP calls from the hosts listed are rejected
22565 as soon as the connection is made.
22566 This option is obsolete, and retained only for backward compatibility, because
22567 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
22568 connections immediately.
22571 The ability to give an immediate rejection (either by this option or using an
22572 ACL) is provided for use in unusual cases. Many hosts will just try again,
22573 sometimes without much delay. Normally, it is better to use an ACL to reject
22574 incoming messages at a later stage, such as after RCPT commands. See
22575 chapter <xref linkend="CHAPACL"/>.
22578 <indexterm role="option">
22579 <primary><option>hosts_connection_nolog</option></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>hosts_connection_nolog</option></entry>
22591 <entry>Use: <emphasis>main</emphasis></entry>
22592 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
22593 <entry>Default: <emphasis>unset</emphasis></entry>
22599 <indexterm role="concept">
22600 <primary>host</primary>
22601 <secondary>not logging connections from</secondary>
22603 This option defines a list of hosts for which connection logging does not
22604 happen, even though the <option>smtp_connection</option> log selector is set. For example,
22605 you might want not to log SMTP connections from local processes, or from
22606 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
22607 the daemon; you should therefore strive to restrict its value to a short inline
22608 list of IP addresses and networks. To disable logging SMTP connections from
22609 local processes, you must create a host list with an empty item. For example:
22611 <literallayout class="monospaced">
22612 hosts_connection_nolog = :
22615 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
22618 <indexterm role="option">
22619 <primary><option>hosts_treat_as_local</option></primary>
22622 <informaltable frame="all">
22623 <tgroup cols="4" colsep="0" rowsep="0">
22624 <colspec colwidth="8*" align="left"/>
22625 <colspec colwidth="5*" align="center"/>
22626 <colspec colwidth="5*" align="center"/>
22627 <colspec colwidth="6*" align="right"/>
22630 <entry><option>hosts_treat_as_local</option></entry>
22631 <entry>Use: <emphasis>main</emphasis></entry>
22632 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
22633 <entry>Default: <emphasis>unset</emphasis></entry>
22639 <indexterm role="concept">
22640 <primary>local host</primary>
22641 <secondary>domains treated as</secondary>
22643 <indexterm role="concept">
22644 <primary>host</primary>
22645 <secondary>treated as local</secondary>
22647 If this option is set, any host names that match the domain list are treated as
22648 if they were the local host when Exim is scanning host lists obtained from MX
22650 or other sources. Note that the value of this option is a domain list, not a
22651 host list, because it is always used to check host names, not IP addresses.
22654 This option also applies when Exim is matching the special items
22655 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
22656 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
22657 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
22658 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
22659 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
22660 interfaces and recognising the local host.
22663 <indexterm role="option">
22664 <primary><option>ignore_bounce_errors_after</option></primary>
22667 <informaltable frame="all">
22668 <tgroup cols="4" colsep="0" rowsep="0">
22669 <colspec colwidth="8*" align="left"/>
22670 <colspec colwidth="5*" align="center"/>
22671 <colspec colwidth="5*" align="center"/>
22672 <colspec colwidth="6*" align="right"/>
22675 <entry><option>ignore_bounce_errors_after</option></entry>
22676 <entry>Use: <emphasis>main</emphasis></entry>
22677 <entry>Type: <emphasis>time</emphasis></entry>
22678 <entry>Default: <emphasis>10w</emphasis></entry>
22684 <indexterm role="concept">
22685 <primary>bounce message</primary>
22686 <secondary>discarding</secondary>
22688 <indexterm role="concept">
22689 <primary>discarding bounce message</primary>
22691 This option affects the processing of bounce messages that cannot be delivered,
22692 that is, those that suffer a permanent delivery failure. (Bounce messages that
22693 suffer temporary delivery failures are of course retried in the usual way.)
22696 After a permanent delivery failure, bounce messages are frozen,
22697 because there is no sender to whom they can be returned. When a frozen bounce
22698 message has been on the queue for more than the given time, it is unfrozen at
22699 the next queue run, and a further delivery is attempted. If delivery fails
22700 again, the bounce message is discarded. This makes it possible to keep failed
22701 bounce messages around for a shorter time than the normal maximum retry time
22702 for frozen messages. For example,
22704 <literallayout class="monospaced">
22705 ignore_bounce_errors_after = 12h
22708 retries failed bounce message deliveries after 12 hours, discarding any further
22709 failures. If the value of this option is set to a zero time period, bounce
22710 failures are discarded immediately. Setting a very long time (as in the default
22711 value) has the effect of disabling this option. For ways of automatically
22712 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
22713 <option>timeout_frozen_after</option>.
22716 <indexterm role="option">
22717 <primary><option>ignore_fromline_hosts</option></primary>
22720 <informaltable frame="all">
22721 <tgroup cols="4" colsep="0" rowsep="0">
22722 <colspec colwidth="8*" align="left"/>
22723 <colspec colwidth="5*" align="center"/>
22724 <colspec colwidth="5*" align="center"/>
22725 <colspec colwidth="6*" align="right"/>
22728 <entry><option>ignore_fromline_hosts</option></entry>
22729 <entry>Use: <emphasis>main</emphasis></entry>
22730 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
22731 <entry>Default: <emphasis>unset</emphasis></entry>
22737 <indexterm role="concept">
22738 <primary><quote>From</quote> line</primary>
22740 <indexterm role="concept">
22741 <primary>UUCP</primary>
22742 <secondary><quote>From</quote> line</secondary>
22744 Some broken SMTP clients insist on sending a UUCP-like <quote>From </quote> line before
22745 the headers of a message. By default this is treated as the start of the
22746 message’s body, which means that any following headers are not recognized as
22747 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
22748 match those hosts that insist on sending it. If the sender is actually a local
22749 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
22750 <option>ignore_fromline_local</option> must be set to achieve this effect.
22753 <indexterm role="option">
22754 <primary><option>ignore_fromline_local</option></primary>
22757 <informaltable frame="all">
22758 <tgroup cols="4" colsep="0" rowsep="0">
22759 <colspec colwidth="8*" align="left"/>
22760 <colspec colwidth="5*" align="center"/>
22761 <colspec colwidth="5*" align="center"/>
22762 <colspec colwidth="6*" align="right"/>
22765 <entry><option>ignore_fromline_local</option></entry>
22766 <entry>Use: <emphasis>main</emphasis></entry>
22767 <entry>Type: <emphasis>boolean</emphasis></entry>
22768 <entry>Default: <emphasis>false</emphasis></entry>
22774 See <option>ignore_fromline_hosts</option> above.
22777 <indexterm role="option">
22778 <primary><option>keep_malformed</option></primary>
22781 <informaltable frame="all">
22782 <tgroup cols="4" colsep="0" rowsep="0">
22783 <colspec colwidth="8*" align="left"/>
22784 <colspec colwidth="5*" align="center"/>
22785 <colspec colwidth="5*" align="center"/>
22786 <colspec colwidth="6*" align="right"/>
22789 <entry><option>keep_malformed</option></entry>
22790 <entry>Use: <emphasis>main</emphasis></entry>
22791 <entry>Type: <emphasis>time</emphasis></entry>
22792 <entry>Default: <emphasis>4d</emphasis></entry>
22798 This option specifies the length of time to keep messages whose spool files
22799 have been corrupted in some way. This should, of course, never happen. At the
22800 next attempt to deliver such a message, it gets removed. The incident is
22804 <indexterm role="option">
22805 <primary><option>ldap_default_servers</option></primary>
22808 <informaltable frame="all">
22809 <tgroup cols="4" colsep="0" rowsep="0">
22810 <colspec colwidth="8*" align="left"/>
22811 <colspec colwidth="5*" align="center"/>
22812 <colspec colwidth="5*" align="center"/>
22813 <colspec colwidth="6*" align="right"/>
22816 <entry><option>ldap_default_servers</option></entry>
22817 <entry>Use: <emphasis>main</emphasis></entry>
22818 <entry>Type: <emphasis>string list</emphasis></entry>
22819 <entry>Default: <emphasis>unset</emphasis></entry>
22825 <indexterm role="concept">
22826 <primary>LDAP</primary>
22827 <secondary>default servers</secondary>
22829 This option provides a list of LDAP servers which are tried in turn when an
22830 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
22831 details of LDAP queries. This option is available only when Exim has been built
22835 <indexterm role="option">
22836 <primary><option>ldap_version</option></primary>
22839 <informaltable frame="all">
22840 <tgroup cols="4" colsep="0" rowsep="0">
22841 <colspec colwidth="8*" align="left"/>
22842 <colspec colwidth="5*" align="center"/>
22843 <colspec colwidth="5*" align="center"/>
22844 <colspec colwidth="6*" align="right"/>
22847 <entry><option>ldap_version</option></entry>
22848 <entry>Use: <emphasis>main</emphasis></entry>
22849 <entry>Type: <emphasis>integer</emphasis></entry>
22850 <entry>Default: <emphasis>unset</emphasis></entry>
22856 <indexterm role="concept">
22857 <primary>LDAP protocol version</primary>
22858 <secondary>forcing</secondary>
22860 This option can be used to force Exim to set a specific protocol version for
22861 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
22862 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
22863 the LDAP headers; otherwise it is 2. This option is available only when Exim
22864 has been built with LDAP support.
22867 <indexterm role="option">
22868 <primary><option>local_from_check</option></primary>
22871 <informaltable frame="all">
22872 <tgroup cols="4" colsep="0" rowsep="0">
22873 <colspec colwidth="8*" align="left"/>
22874 <colspec colwidth="5*" align="center"/>
22875 <colspec colwidth="5*" align="center"/>
22876 <colspec colwidth="6*" align="right"/>
22879 <entry><option>local_from_check</option></entry>
22880 <entry>Use: <emphasis>main</emphasis></entry>
22881 <entry>Type: <emphasis>boolean</emphasis></entry>
22882 <entry>Default: <emphasis>true</emphasis></entry>
22888 <indexterm role="concept">
22889 <primary><emphasis>Sender:</emphasis> header line</primary>
22890 <secondary>disabling addition of</secondary>
22892 <indexterm role="concept">
22893 <primary><emphasis>From:</emphasis> header line</primary>
22894 <secondary>disabling checking of</secondary>
22896 When a message is submitted locally (that is, not over a TCP/IP connection) by
22897 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
22898 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
22899 the domain specified by <option>qualify_domain</option>.
22902 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
22903 locally submitted message is automatically qualified by Exim, unless the
22904 <option>-bnq</option> command line option is used.
22907 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
22908 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
22909 <emphasis>Sender:</emphasis> header with an address constructed from the calling user’s login
22910 and the default qualify domain.
22913 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
22914 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
22915 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
22916 <option>local_sender_retain</option> to be true.
22919 <indexterm role="concept">
22920 <primary>envelope sender</primary>
22922 These options affect only the header lines in the message. The envelope sender
22923 is still forced to be the login id at the qualify domain unless
22924 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
22927 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
22928 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
22929 has more details about <emphasis>Sender:</emphasis> processing.
22932 <indexterm role="option">
22933 <primary><option>local_from_prefix</option></primary>
22936 <informaltable frame="all">
22937 <tgroup cols="4" colsep="0" rowsep="0">
22938 <colspec colwidth="8*" align="left"/>
22939 <colspec colwidth="5*" align="center"/>
22940 <colspec colwidth="5*" align="center"/>
22941 <colspec colwidth="6*" align="right"/>
22944 <entry><option>local_from_prefix</option></entry>
22945 <entry>Use: <emphasis>main</emphasis></entry>
22946 <entry>Type: <emphasis>string</emphasis></entry>
22947 <entry>Default: <emphasis>unset</emphasis></entry>
22953 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
22954 matching the login id (see <option>local_from_check</option> above), it can be configured to
22955 ignore certain prefixes and suffixes in the local part of the address. This is
22956 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
22957 appropriate lists, in the same form as the <option>local_part_prefix</option> and
22958 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
22961 <literallayout class="monospaced">
22962 local_from_prefix = *-
22965 is set, a <emphasis>From:</emphasis> line containing
22967 <literallayout class="monospaced">
22968 From: anything-user@your.domain.example
22971 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
22972 matches the actual sender address that is constructed from the login name and
22976 <indexterm role="option">
22977 <primary><option>local_from_suffix</option></primary>
22980 <informaltable frame="all">
22981 <tgroup cols="4" colsep="0" rowsep="0">
22982 <colspec colwidth="8*" align="left"/>
22983 <colspec colwidth="5*" align="center"/>
22984 <colspec colwidth="5*" align="center"/>
22985 <colspec colwidth="6*" align="right"/>
22988 <entry><option>local_from_suffix</option></entry>
22989 <entry>Use: <emphasis>main</emphasis></entry>
22990 <entry>Type: <emphasis>string</emphasis></entry>
22991 <entry>Default: <emphasis>unset</emphasis></entry>
22997 See <option>local_from_prefix</option> above.
23000 <indexterm role="option">
23001 <primary><option>local_interfaces</option></primary>
23004 <informaltable frame="all">
23005 <tgroup cols="4" colsep="0" rowsep="0">
23006 <colspec colwidth="8*" align="left"/>
23007 <colspec colwidth="5*" align="center"/>
23008 <colspec colwidth="5*" align="center"/>
23009 <colspec colwidth="6*" align="right"/>
23012 <entry><option>local_interfaces</option></entry>
23013 <entry>Use: <emphasis>main</emphasis></entry>
23014 <entry>Type: <emphasis>string list</emphasis></entry>
23015 <entry>Default: <emphasis>see below</emphasis></entry>
23021 This option controls which network interfaces are used by the daemon for
23022 listening; they are also used to identify the local host when routing. Chapter
23023 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
23024 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
23025 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
23026 <option>local_interfaces</option> is
23028 <literallayout class="monospaced">
23029 local_interfaces = 0.0.0.0
23032 when Exim is built without IPv6 support; otherwise it is
23034 <literallayout class="monospaced">
23035 local_interfaces = <; ::0 ; 0.0.0.0
23038 <indexterm role="option">
23039 <primary><option>local_scan_timeout</option></primary>
23042 <informaltable frame="all">
23043 <tgroup cols="4" colsep="0" rowsep="0">
23044 <colspec colwidth="8*" align="left"/>
23045 <colspec colwidth="5*" align="center"/>
23046 <colspec colwidth="5*" align="center"/>
23047 <colspec colwidth="6*" align="right"/>
23050 <entry><option>local_scan_timeout</option></entry>
23051 <entry>Use: <emphasis>main</emphasis></entry>
23052 <entry>Type: <emphasis>time</emphasis></entry>
23053 <entry>Default: <emphasis>5m</emphasis></entry>
23059 <indexterm role="concept">
23060 <primary>timeout</primary>
23061 <secondary>for <function>local_scan()</function> function</secondary>
23063 <indexterm role="concept">
23064 <primary><function>local_scan()</function> function</primary>
23065 <secondary>timeout</secondary>
23067 This timeout applies to the <function>local_scan()</function> function (see chapter
23068 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
23069 the incoming message is rejected with a temporary error if it is an SMTP
23070 message. For a non-SMTP message, the message is dropped and Exim ends with a
23071 non-zero code. The incident is logged on the main and reject logs.
23074 <indexterm role="option">
23075 <primary><option>local_sender_retain</option></primary>
23078 <informaltable frame="all">
23079 <tgroup cols="4" colsep="0" rowsep="0">
23080 <colspec colwidth="8*" align="left"/>
23081 <colspec colwidth="5*" align="center"/>
23082 <colspec colwidth="5*" align="center"/>
23083 <colspec colwidth="6*" align="right"/>
23086 <entry><option>local_sender_retain</option></entry>
23087 <entry>Use: <emphasis>main</emphasis></entry>
23088 <entry>Type: <emphasis>boolean</emphasis></entry>
23089 <entry>Default: <emphasis>false</emphasis></entry>
23095 <indexterm role="concept">
23096 <primary><emphasis>Sender:</emphasis> header line</primary>
23097 <secondary>retaining from local submission</secondary>
23099 When a message is submitted locally (that is, not over a TCP/IP connection) by
23100 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
23101 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
23102 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
23103 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
23104 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
23107 <indexterm role="option">
23108 <primary><option>localhost_number</option></primary>
23111 <informaltable frame="all">
23112 <tgroup cols="4" colsep="0" rowsep="0">
23113 <colspec colwidth="8*" align="left"/>
23114 <colspec colwidth="5*" align="center"/>
23115 <colspec colwidth="5*" align="center"/>
23116 <colspec colwidth="6*" align="right"/>
23119 <entry><option>localhost_number</option></entry>
23120 <entry>Use: <emphasis>main</emphasis></entry>
23121 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
23122 <entry>Default: <emphasis>unset</emphasis></entry>
23128 <indexterm role="concept">
23129 <primary>host</primary>
23130 <secondary>locally unique number for</secondary>
23132 <indexterm role="concept">
23133 <primary>message ids</primary>
23134 <secondary>with multiple hosts</secondary>
23136 <indexterm role="concept">
23137 <primary><varname>$localhost_number</varname></primary>
23139 Exim’s message ids are normally unique only within the local host. If
23140 uniqueness among a set of hosts is required, each host must set a different
23141 value for the <option>localhost_number</option> option. The string is expanded immediately
23142 after reading the configuration file (so that a number can be computed from the
23143 host name, for example) and the result of the expansion must be a number in the
23144 range 0–16 (or 0–10 on operating systems with case-insensitive file
23145 systems). This is available in subsequent string expansions via the variable
23146 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
23147 characters of the message id, instead of just being a fractional part of the
23148 time, are computed from the time and the local host number as described in
23149 section <xref linkend="SECTmessiden"/>.
23152 <indexterm role="option">
23153 <primary><option>log_file_path</option></primary>
23156 <informaltable frame="all">
23157 <tgroup cols="4" colsep="0" rowsep="0">
23158 <colspec colwidth="8*" align="left"/>
23159 <colspec colwidth="5*" align="center"/>
23160 <colspec colwidth="5*" align="center"/>
23161 <colspec colwidth="6*" align="right"/>
23164 <entry><option>log_file_path</option></entry>
23165 <entry>Use: <emphasis>main</emphasis></entry>
23166 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
23167 <entry>Default: <emphasis>set at compile time</emphasis></entry>
23173 <indexterm role="concept">
23174 <primary>log</primary>
23175 <secondary>file path for</secondary>
23177 This option sets the path which is used to determine the names of Exim’s log
23178 files, or indicates that logging is to be to syslog, or both. It is expanded
23179 when Exim is entered, so it can, for example, contain a reference to the host
23180 name. If no specific path is set for the log files at compile or run time, they
23181 are written in a sub-directory called <filename>log</filename> in Exim’s spool directory.
23182 Chapter <xref linkend="CHAPlog"/> contains further details about Exim’s logging, and
23183 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
23184 used. If this string is fixed at your installation (contains no expansion
23185 variables) it is recommended that you do not set this option in the
23186 configuration file, but instead supply the path using LOG_FILE_PATH in
23187 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
23188 early on – in particular, failure to read the configuration file.
23191 <indexterm role="option">
23192 <primary><option>log_selector</option></primary>
23195 <informaltable frame="all">
23196 <tgroup cols="4" colsep="0" rowsep="0">
23197 <colspec colwidth="8*" align="left"/>
23198 <colspec colwidth="5*" align="center"/>
23199 <colspec colwidth="5*" align="center"/>
23200 <colspec colwidth="6*" align="right"/>
23203 <entry><option>log_selector</option></entry>
23204 <entry>Use: <emphasis>main</emphasis></entry>
23205 <entry>Type: <emphasis>string</emphasis></entry>
23206 <entry>Default: <emphasis>unset</emphasis></entry>
23212 <indexterm role="concept">
23213 <primary>log</primary>
23214 <secondary>selectors</secondary>
23216 This option can be used to reduce or increase the number of things that Exim
23217 writes to its log files. Its argument is made up of names preceded by plus or
23218 minus characters. For example:
23220 <literallayout class="monospaced">
23221 log_selector = +arguments -retry_defer
23224 A list of possible names and what they control is given in the chapter on
23225 logging, in section <xref linkend="SECTlogselector"/>.
23228 <indexterm role="option">
23229 <primary><option>log_timezone</option></primary>
23232 <informaltable frame="all">
23233 <tgroup cols="4" colsep="0" rowsep="0">
23234 <colspec colwidth="8*" align="left"/>
23235 <colspec colwidth="5*" align="center"/>
23236 <colspec colwidth="5*" align="center"/>
23237 <colspec colwidth="6*" align="right"/>
23240 <entry><option>log_timezone</option></entry>
23241 <entry>Use: <emphasis>main</emphasis></entry>
23242 <entry>Type: <emphasis>boolean</emphasis></entry>
23243 <entry>Default: <emphasis>false</emphasis></entry>
23249 <indexterm role="concept">
23250 <primary>log</primary>
23251 <secondary>timezone for entries</secondary>
23253 <indexterm role="concept">
23254 <primary><varname>$tod_log</varname></primary>
23256 <indexterm role="concept">
23257 <primary><varname>$tod_zone</varname></primary>
23259 By default, the timestamps on log lines are in local time without the
23260 timezone. This means that if your timezone changes twice a year, the timestamps
23261 in log lines are ambiguous for an hour when the clocks go back. One way of
23262 avoiding this problem is to set the timezone to UTC. An alternative is to set
23263 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
23264 timestamps in log lines. Turning on this option can add quite a lot to the size
23265 of log files because each line is extended by 6 characters. Note that the
23266 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
23267 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
23270 <indexterm role="option">
23271 <primary><option>lookup_open_max</option></primary>
23274 <informaltable frame="all">
23275 <tgroup cols="4" colsep="0" rowsep="0">
23276 <colspec colwidth="8*" align="left"/>
23277 <colspec colwidth="5*" align="center"/>
23278 <colspec colwidth="5*" align="center"/>
23279 <colspec colwidth="6*" align="right"/>
23282 <entry><option>lookup_open_max</option></entry>
23283 <entry>Use: <emphasis>main</emphasis></entry>
23284 <entry>Type: <emphasis>integer</emphasis></entry>
23285 <entry>Default: <emphasis>25</emphasis></entry>
23291 <indexterm role="concept">
23292 <primary>too many open files</primary>
23294 <indexterm role="concept">
23295 <primary>open files</primary>
23296 <secondary>too many</secondary>
23298 <indexterm role="concept">
23299 <primary>file</primary>
23300 <secondary>too many open</secondary>
23302 <indexterm role="concept">
23303 <primary>lookup</primary>
23304 <secondary>maximum open files</secondary>
23306 <indexterm role="concept">
23307 <primary>limit</primary>
23308 <secondary>open files for lookups</secondary>
23310 This option limits the number of simultaneously open files for single-key
23311 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
23312 Exim normally keeps these files open during routing, because often the same
23313 file is required several times. If the limit is reached, Exim closes the least
23314 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
23315 actually opens two files for each logical DBM database, though it still counts
23316 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
23317 open files</quote> errors with NDBM, you need to reduce the value of
23318 <option>lookup_open_max</option>.
23321 <indexterm role="option">
23322 <primary><option>max_username_length</option></primary>
23325 <informaltable frame="all">
23326 <tgroup cols="4" colsep="0" rowsep="0">
23327 <colspec colwidth="8*" align="left"/>
23328 <colspec colwidth="5*" align="center"/>
23329 <colspec colwidth="5*" align="center"/>
23330 <colspec colwidth="6*" align="right"/>
23333 <entry><option>max_username_length</option></entry>
23334 <entry>Use: <emphasis>main</emphasis></entry>
23335 <entry>Type: <emphasis>integer</emphasis></entry>
23336 <entry>Default: <emphasis>0</emphasis></entry>
23342 <indexterm role="concept">
23343 <primary>length</primary>
23344 <secondary>of login name</secondary>
23346 <indexterm role="concept">
23347 <primary>user name</primary>
23348 <secondary>maximum length</secondary>
23350 <indexterm role="concept">
23351 <primary>limit</primary>
23352 <secondary>user name length</secondary>
23354 Some operating systems are broken in that they truncate long arguments to
23355 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
23356 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
23357 an argument that is longer behaves as if <function>getpwnam()</function> failed.
23360 <indexterm role="option">
23361 <primary><option>message_body_visible</option></primary>
23364 <informaltable frame="all">
23365 <tgroup cols="4" colsep="0" rowsep="0">
23366 <colspec colwidth="8*" align="left"/>
23367 <colspec colwidth="5*" align="center"/>
23368 <colspec colwidth="5*" align="center"/>
23369 <colspec colwidth="6*" align="right"/>
23372 <entry><option>message_body_visible</option></entry>
23373 <entry>Use: <emphasis>main</emphasis></entry>
23374 <entry>Type: <emphasis>integer</emphasis></entry>
23375 <entry>Default: <emphasis>500</emphasis></entry>
23381 <indexterm role="concept">
23382 <primary>body of message</primary>
23383 <secondary>visible size</secondary>
23385 <indexterm role="concept">
23386 <primary>message body</primary>
23387 <secondary>visible size</secondary>
23389 <indexterm role="concept">
23390 <primary><varname>$message_body</varname></primary>
23392 <indexterm role="concept">
23393 <primary><varname>$message_body_end</varname></primary>
23395 This option specifies how much of a message’s body is to be included in the
23396 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
23399 <indexterm role="option">
23400 <primary><option>message_id_header_domain</option></primary>
23403 <informaltable frame="all">
23404 <tgroup cols="4" colsep="0" rowsep="0">
23405 <colspec colwidth="8*" align="left"/>
23406 <colspec colwidth="5*" align="center"/>
23407 <colspec colwidth="5*" align="center"/>
23408 <colspec colwidth="6*" align="right"/>
23411 <entry><option>message_id_header_domain</option></entry>
23412 <entry>Use: <emphasis>main</emphasis></entry>
23413 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
23414 <entry>Default: <emphasis>unset</emphasis></entry>
23420 <indexterm role="concept">
23421 <primary><emphasis>Message-ID:</emphasis> header line</primary>
23423 If this option is set, the string is expanded and used as the right hand side
23424 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
23425 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
23426 means <quote>not received over TCP/IP.</quote>
23427 Otherwise, the primary host name is used.
23428 Only letters, digits, dot and hyphen are accepted; any other characters are
23429 replaced by hyphens. If the expansion is forced to fail, or if the result is an
23430 empty string, the option is ignored.
23433 <indexterm role="option">
23434 <primary><option>message_id_header_text</option></primary>
23437 <informaltable frame="all">
23438 <tgroup cols="4" colsep="0" rowsep="0">
23439 <colspec colwidth="8*" align="left"/>
23440 <colspec colwidth="5*" align="center"/>
23441 <colspec colwidth="5*" align="center"/>
23442 <colspec colwidth="6*" align="right"/>
23445 <entry><option>message_id_header_text</option></entry>
23446 <entry>Use: <emphasis>main</emphasis></entry>
23447 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
23448 <entry>Default: <emphasis>unset</emphasis></entry>
23454 If this variable is set, the string is expanded and used to augment the text of
23455 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
23456 message does not have one. The text of this header is required by RFC 2822 to
23457 take the form of an address. By default, Exim uses its internal message id as
23458 the local part, and the primary host name as the domain. If this option is set,
23459 it is expanded, and provided the expansion is not forced to fail, and does not
23460 yield an empty string, the result is inserted into the header immediately
23461 before the @, separated from the internal message id by a dot. Any characters
23462 that are illegal in an address are automatically converted into hyphens. This
23463 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
23464 colons will become hyphens.
23467 <indexterm role="option">
23468 <primary><option>message_logs</option></primary>
23471 <informaltable frame="all">
23472 <tgroup cols="4" colsep="0" rowsep="0">
23473 <colspec colwidth="8*" align="left"/>
23474 <colspec colwidth="5*" align="center"/>
23475 <colspec colwidth="5*" align="center"/>
23476 <colspec colwidth="6*" align="right"/>
23479 <entry><option>message_logs</option></entry>
23480 <entry>Use: <emphasis>main</emphasis></entry>
23481 <entry>Type: <emphasis>boolean</emphasis></entry>
23482 <entry>Default: <emphasis>true</emphasis></entry>
23488 <indexterm role="concept">
23489 <primary>message log</primary>
23490 <secondary>disabling</secondary>
23492 <indexterm role="concept">
23493 <primary>log</primary>
23494 <secondary>message log; disabling</secondary>
23496 If this option is turned off, per-message log files are not created in the
23497 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
23498 Exim, by reducing the number of files involved in handling a message from a
23499 minimum of four (header spool file, body spool file, delivery journal, and
23500 per-message log) to three. The other major I/O activity is Exim’s main log,
23501 which is not affected by this option.
23504 <indexterm role="option">
23505 <primary><option>message_size_limit</option></primary>
23508 <informaltable frame="all">
23509 <tgroup cols="4" colsep="0" rowsep="0">
23510 <colspec colwidth="8*" align="left"/>
23511 <colspec colwidth="5*" align="center"/>
23512 <colspec colwidth="5*" align="center"/>
23513 <colspec colwidth="6*" align="right"/>
23516 <entry><option>message_size_limit</option></entry>
23517 <entry>Use: <emphasis>main</emphasis></entry>
23518 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
23519 <entry>Default: <emphasis>50M</emphasis></entry>
23525 <indexterm role="concept">
23526 <primary>message</primary>
23527 <secondary>size limit</secondary>
23529 <indexterm role="concept">
23530 <primary>limit</primary>
23531 <secondary>message size</secondary>
23533 <indexterm role="concept">
23534 <primary>size of message</primary>
23535 <secondary>limit</secondary>
23537 This option limits the maximum size of message that Exim will process. The
23538 value is expanded for each incoming
23539 connection so, for example, it can be made to depend on the IP address of the
23540 remote host for messages arriving via TCP/IP. <emphasis role="bold">Note</emphasis>: This limit cannot be
23541 made to depend on a message’s sender or any other properties of an individual
23542 message, because it has to be advertised in the server’s response to EHLO.
23543 String expansion failure causes a temporary error. A value of zero means no
23544 limit, but its use is not recommended. See also <option>bounce_return_size_limit</option>.
23547 Incoming SMTP messages are failed with a 552 error if the limit is
23548 exceeded; locally-generated messages either get a stderr message or a delivery
23549 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
23550 an oversized message is logged in both the main and the reject logs. See also
23551 the generic transport option <option>message_size_limit</option>, which limits the size of
23552 message that an individual transport can process.
23555 <indexterm role="option">
23556 <primary><option>move_frozen_messages</option></primary>
23559 <informaltable frame="all">
23560 <tgroup cols="4" colsep="0" rowsep="0">
23561 <colspec colwidth="8*" align="left"/>
23562 <colspec colwidth="5*" align="center"/>
23563 <colspec colwidth="5*" align="center"/>
23564 <colspec colwidth="6*" align="right"/>
23567 <entry><option>move_frozen_messages</option></entry>
23568 <entry>Use: <emphasis>main</emphasis></entry>
23569 <entry>Type: <emphasis>boolean</emphasis></entry>
23570 <entry>Default: <emphasis>false</emphasis></entry>
23576 <indexterm role="concept">
23577 <primary>frozen messages</primary>
23578 <secondary>moving</secondary>
23580 This option, which is available only if Exim has been built with the setting
23582 <literallayout class="monospaced">
23583 SUPPORT_MOVE_FROZEN_MESSAGES=yes
23586 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
23587 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
23588 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
23589 standard utilities for handling such moved messages, and they do not show up in
23590 lists generated by <option>-bp</option> or by the Exim monitor.
23593 <indexterm role="option">
23594 <primary><option>mua_wrapper</option></primary>
23597 <informaltable frame="all">
23598 <tgroup cols="4" colsep="0" rowsep="0">
23599 <colspec colwidth="8*" align="left"/>
23600 <colspec colwidth="5*" align="center"/>
23601 <colspec colwidth="5*" align="center"/>
23602 <colspec colwidth="6*" align="right"/>
23605 <entry><option>mua_wrapper</option></entry>
23606 <entry>Use: <emphasis>main</emphasis></entry>
23607 <entry>Type: <emphasis>boolean</emphasis></entry>
23608 <entry>Default: <emphasis>false</emphasis></entry>
23614 Setting this option true causes Exim to run in a very restrictive mode in which
23615 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
23616 contains a full description of this facility.
23619 <indexterm role="option">
23620 <primary><option>mysql_servers</option></primary>
23623 <informaltable frame="all">
23624 <tgroup cols="4" colsep="0" rowsep="0">
23625 <colspec colwidth="8*" align="left"/>
23626 <colspec colwidth="5*" align="center"/>
23627 <colspec colwidth="5*" align="center"/>
23628 <colspec colwidth="6*" align="right"/>
23631 <entry><option>mysql_servers</option></entry>
23632 <entry>Use: <emphasis>main</emphasis></entry>
23633 <entry>Type: <emphasis>string list</emphasis></entry>
23634 <entry>Default: <emphasis>unset</emphasis></entry>
23640 <indexterm role="concept">
23641 <primary>MySQL</primary>
23642 <secondary>server list</secondary>
23644 This option provides a list of MySQL servers and associated connection data, to
23645 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECTsql"/>). The
23646 option is available only if Exim has been built with MySQL support.
23649 <indexterm role="option">
23650 <primary><option>never_users</option></primary>
23653 <informaltable frame="all">
23654 <tgroup cols="4" colsep="0" rowsep="0">
23655 <colspec colwidth="8*" align="left"/>
23656 <colspec colwidth="5*" align="center"/>
23657 <colspec colwidth="5*" align="center"/>
23658 <colspec colwidth="6*" align="right"/>
23661 <entry><option>never_users</option></entry>
23662 <entry>Use: <emphasis>main</emphasis></entry>
23663 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
23664 <entry>Default: <emphasis>unset</emphasis></entry>
23670 This option is expanded just once, at the start of Exim’s processing. Local
23671 message deliveries are normally run in processes that are setuid to the
23672 recipient, and remote deliveries are normally run under Exim’s own uid and gid.
23673 It is usually desirable to prevent any deliveries from running as root, as a
23677 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
23678 list of users that must not be used for local deliveries. This list is fixed in
23679 the binary and cannot be overridden by the configuration file. By default, it
23680 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
23681 can be used to add more users to the fixed list.
23684 If a message is to be delivered as one of the users on the fixed list or the
23685 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
23688 <literallayout class="monospaced">
23689 never_users = root:daemon:bin
23692 Including root is redundant if it is also on the fixed list, but it does no
23693 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
23697 <indexterm role="option">
23698 <primary><option>oracle_servers</option></primary>
23701 <informaltable frame="all">
23702 <tgroup cols="4" colsep="0" rowsep="0">
23703 <colspec colwidth="8*" align="left"/>
23704 <colspec colwidth="5*" align="center"/>
23705 <colspec colwidth="5*" align="center"/>
23706 <colspec colwidth="6*" align="right"/>
23709 <entry><option>oracle_servers</option></entry>
23710 <entry>Use: <emphasis>main</emphasis></entry>
23711 <entry>Type: <emphasis>string list</emphasis></entry>
23712 <entry>Default: <emphasis>unset</emphasis></entry>
23718 <indexterm role="concept">
23719 <primary>Oracle</primary>
23720 <secondary>server list</secondary>
23722 This option provides a list of Oracle servers and associated connection data,
23723 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECTsql"/>).
23724 The option is available only if Exim has been built with Oracle support.
23727 <indexterm role="option">
23728 <primary><option>percent_hack_domains</option></primary>
23731 <informaltable frame="all">
23732 <tgroup cols="4" colsep="0" rowsep="0">
23733 <colspec colwidth="8*" align="left"/>
23734 <colspec colwidth="5*" align="center"/>
23735 <colspec colwidth="5*" align="center"/>
23736 <colspec colwidth="6*" align="right"/>
23739 <entry><option>percent_hack_domains</option></entry>
23740 <entry>Use: <emphasis>main</emphasis></entry>
23741 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
23742 <entry>Default: <emphasis>unset</emphasis></entry>
23748 <indexterm role="concept">
23749 <primary><quote>percent hack</quote></primary>
23751 <indexterm role="concept">
23752 <primary>source routing</primary>
23753 <secondary>in email address</secondary>
23755 <indexterm role="concept">
23756 <primary>address</primary>
23757 <secondary>source-routed</secondary>
23759 The <quote>percent hack</quote> is the convention whereby a local part containing a
23760 percent sign is re-interpreted as a new email address, with the percent
23761 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
23762 also applied to RFC 2822 addresses that begin with an @ character. If this
23763 option is set, Exim implements the percent facility for those domains listed,
23764 but no others. This happens before an incoming SMTP address is tested against
23768 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
23769 trying to get round relaying restrictions. For this reason, it is best avoided
23770 if at all possible. Unfortunately, a number of less security-conscious MTAs
23771 implement it unconditionally. If you are running Exim on a gateway host, and
23772 routing mail through to internal MTAs without processing the local parts, it is
23773 a good idea to reject recipient addresses with percent characters in their
23774 local parts. Exim’s default configuration does this.
23777 <indexterm role="option">
23778 <primary><option>perl_at_start</option></primary>
23781 <informaltable frame="all">
23782 <tgroup cols="4" colsep="0" rowsep="0">
23783 <colspec colwidth="8*" align="left"/>
23784 <colspec colwidth="5*" align="center"/>
23785 <colspec colwidth="5*" align="center"/>
23786 <colspec colwidth="6*" align="right"/>
23789 <entry><option>perl_at_start</option></entry>
23790 <entry>Use: <emphasis>main</emphasis></entry>
23791 <entry>Type: <emphasis>boolean</emphasis></entry>
23792 <entry>Default: <emphasis>false</emphasis></entry>
23798 This option is available only when Exim is built with an embedded Perl
23799 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
23802 <indexterm role="option">
23803 <primary><option>perl_startup</option></primary>
23806 <informaltable frame="all">
23807 <tgroup cols="4" colsep="0" rowsep="0">
23808 <colspec colwidth="8*" align="left"/>
23809 <colspec colwidth="5*" align="center"/>
23810 <colspec colwidth="5*" align="center"/>
23811 <colspec colwidth="6*" align="right"/>
23814 <entry><option>perl_startup</option></entry>
23815 <entry>Use: <emphasis>main</emphasis></entry>
23816 <entry>Type: <emphasis>string</emphasis></entry>
23817 <entry>Default: <emphasis>unset</emphasis></entry>
23823 This option is available only when Exim is built with an embedded Perl
23824 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
23827 <indexterm role="option">
23828 <primary><option>pgsql_servers</option></primary>
23831 <informaltable frame="all">
23832 <tgroup cols="4" colsep="0" rowsep="0">
23833 <colspec colwidth="8*" align="left"/>
23834 <colspec colwidth="5*" align="center"/>
23835 <colspec colwidth="5*" align="center"/>
23836 <colspec colwidth="6*" align="right"/>
23839 <entry><option>pgsql_servers</option></entry>
23840 <entry>Use: <emphasis>main</emphasis></entry>
23841 <entry>Type: <emphasis>string list</emphasis></entry>
23842 <entry>Default: <emphasis>unset</emphasis></entry>
23848 <indexterm role="concept">
23849 <primary>PostgreSQL lookup type</primary>
23850 <secondary>server list</secondary>
23852 This option provides a list of PostgreSQL servers and associated connection
23853 data, to be used in conjunction with <command>pgsql</command> lookups (see section
23854 <xref linkend="SECTsql"/>). The option is available only if Exim has been built with
23855 PostgreSQL support.
23858 <indexterm role="option">
23859 <primary><option>pid_file_path</option></primary>
23862 <informaltable frame="all">
23863 <tgroup cols="4" colsep="0" rowsep="0">
23864 <colspec colwidth="8*" align="left"/>
23865 <colspec colwidth="5*" align="center"/>
23866 <colspec colwidth="5*" align="center"/>
23867 <colspec colwidth="6*" align="right"/>
23870 <entry><option>pid_file_path</option></entry>
23871 <entry>Use: <emphasis>main</emphasis></entry>
23872 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
23873 <entry>Default: <emphasis>set at compile time</emphasis></entry>
23879 <indexterm role="concept">
23880 <primary>daemon</primary>
23881 <secondary>pid file path</secondary>
23883 <indexterm role="concept">
23884 <primary>pid file</primary>
23885 <secondary>path for</secondary>
23887 This option sets the name of the file to which the Exim daemon writes its
23888 process id. The string is expanded, so it can contain, for example, references
23891 <literallayout class="monospaced">
23892 pid_file_path = /var/log/$primary_hostname/exim.pid
23895 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim’s
23897 The value set by the option can be overridden by the <option>-oP</option> command line
23898 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
23899 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
23902 <indexterm role="option">
23903 <primary><option>pipelining_advertise_hosts</option></primary>
23906 <informaltable frame="all">
23907 <tgroup cols="4" colsep="0" rowsep="0">
23908 <colspec colwidth="8*" align="left"/>
23909 <colspec colwidth="5*" align="center"/>
23910 <colspec colwidth="5*" align="center"/>
23911 <colspec colwidth="6*" align="right"/>
23914 <entry><option>pipelining_advertise_hosts</option></entry>
23915 <entry>Use: <emphasis>main</emphasis></entry>
23916 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
23917 <entry>Default: <emphasis>*</emphasis></entry>
23923 <indexterm role="concept">
23924 <primary>PIPELINING advertising</primary>
23925 <secondary>suppressing</secondary>
23927 This option can be used to suppress the advertisement of the SMTP
23928 PIPELINING extension to specific hosts. When PIPELINING is not
23929 advertised and <option>smtp_enforce_sync</option> is true, an Exim server enforces strict
23930 synchronization for each SMTP command and response.
23931 When PIPELINING is advertised, Exim assumes that clients will use it; <quote>out
23932 of order</quote> commands that are <quote>expected</quote> do not count as protocol errors (see
23933 <option>smtp_max_synprot_errors</option>).
23936 <indexterm role="option">
23937 <primary><option>preserve_message_logs</option></primary>
23940 <informaltable frame="all">
23941 <tgroup cols="4" colsep="0" rowsep="0">
23942 <colspec colwidth="8*" align="left"/>
23943 <colspec colwidth="5*" align="center"/>
23944 <colspec colwidth="5*" align="center"/>
23945 <colspec colwidth="6*" align="right"/>
23948 <entry><option>preserve_message_logs</option></entry>
23949 <entry>Use: <emphasis>main</emphasis></entry>
23950 <entry>Type: <emphasis>boolean</emphasis></entry>
23951 <entry>Default: <emphasis>false</emphasis></entry>
23957 <indexterm role="concept">
23958 <primary>message logs</primary>
23959 <secondary>preserving</secondary>
23961 If this option is set, message log files are not deleted when messages are
23962 completed. Instead, they are moved to a sub-directory of the spool directory
23963 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
23964 purposes. This is a dangerous option to set on systems with any appreciable
23965 volume of mail. Use with care!
23968 <indexterm role="option">
23969 <primary><option>primary_hostname</option></primary>
23972 <informaltable frame="all">
23973 <tgroup cols="4" colsep="0" rowsep="0">
23974 <colspec colwidth="8*" align="left"/>
23975 <colspec colwidth="5*" align="center"/>
23976 <colspec colwidth="5*" align="center"/>
23977 <colspec colwidth="6*" align="right"/>
23980 <entry><option>primary_hostname</option></entry>
23981 <entry>Use: <emphasis>main</emphasis></entry>
23982 <entry>Type: <emphasis>string</emphasis></entry>
23983 <entry>Default: <emphasis>see below</emphasis></entry>
23989 <indexterm role="concept">
23990 <primary>name</primary>
23991 <secondary>of local host</secondary>
23993 <indexterm role="concept">
23994 <primary>host</primary>
23995 <secondary>name of local</secondary>
23997 <indexterm role="concept">
23998 <primary>local host</primary>
23999 <secondary>name of</secondary>
24001 <indexterm role="concept">
24002 <primary><varname>$primary_hostname</varname></primary>
24004 This specifies the name of the current host. It is used in the default EHLO or
24005 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
24006 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
24007 The value is also used by default in some SMTP response messages from an Exim
24008 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
24011 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
24012 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
24013 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
24014 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
24015 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
24016 explicitly by this option, or defaulted.
24019 <indexterm role="option">
24020 <primary><option>print_topbitchars</option></primary>
24023 <informaltable frame="all">
24024 <tgroup cols="4" colsep="0" rowsep="0">
24025 <colspec colwidth="8*" align="left"/>
24026 <colspec colwidth="5*" align="center"/>
24027 <colspec colwidth="5*" align="center"/>
24028 <colspec colwidth="6*" align="right"/>
24031 <entry><option>print_topbitchars</option></entry>
24032 <entry>Use: <emphasis>main</emphasis></entry>
24033 <entry>Type: <emphasis>boolean</emphasis></entry>
24034 <entry>Default: <emphasis>false</emphasis></entry>
24040 <indexterm role="concept">
24041 <primary>printing characters</primary>
24043 <indexterm role="concept">
24044 <primary>8-bit characters</primary>
24046 By default, Exim considers only those characters whose codes lie in the range
24047 32–126 to be printing characters. In a number of circumstances (for example,
24048 when writing log entries) non-printing characters are converted into escape
24049 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
24050 is set, code values of 128 and above are also considered to be printing
24054 This option also affects the header syntax checks performed by the
24055 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
24056 the user’s full name when constructing From: and Sender: addresses (as
24057 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
24058 Exim to generate eight bit message headers that do not conform to the
24062 <indexterm role="option">
24063 <primary><option>process_log_path</option></primary>
24066 <informaltable frame="all">
24067 <tgroup cols="4" colsep="0" rowsep="0">
24068 <colspec colwidth="8*" align="left"/>
24069 <colspec colwidth="5*" align="center"/>
24070 <colspec colwidth="5*" align="center"/>
24071 <colspec colwidth="6*" align="right"/>
24074 <entry><option>process_log_path</option></entry>
24075 <entry>Use: <emphasis>main</emphasis></entry>
24076 <entry>Type: <emphasis>string</emphasis></entry>
24077 <entry>Default: <emphasis>unset</emphasis></entry>
24083 <indexterm role="concept">
24084 <primary>process log path</primary>
24086 <indexterm role="concept">
24087 <primary>log</primary>
24088 <secondary>process log</secondary>
24090 <indexterm role="concept">
24091 <primary><emphasis>exiwhat</emphasis></primary>
24093 This option sets the name of the file to which an Exim process writes its
24094 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
24095 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
24096 in Exim’s spool directory is used. The ability to specify the name explicitly
24097 can be useful in environments where two different Exims are running, using
24098 different spool directories.
24101 <indexterm role="option">
24102 <primary><option>prod_requires_admin</option></primary>
24105 <informaltable frame="all">
24106 <tgroup cols="4" colsep="0" rowsep="0">
24107 <colspec colwidth="8*" align="left"/>
24108 <colspec colwidth="5*" align="center"/>
24109 <colspec colwidth="5*" align="center"/>
24110 <colspec colwidth="6*" align="right"/>
24113 <entry><option>prod_requires_admin</option></entry>
24114 <entry>Use: <emphasis>main</emphasis></entry>
24115 <entry>Type: <emphasis>boolean</emphasis></entry>
24116 <entry>Default: <emphasis>true</emphasis></entry>
24122 <indexterm role="concept">
24123 <primary><option>-M</option> option</primary>
24125 <indexterm role="concept">
24126 <primary><option>-R</option> option</primary>
24128 <indexterm role="concept">
24129 <primary><option>-q</option> option</primary>
24131 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
24132 admin user unless <option>prod_requires_admin</option> is set false. See also
24133 <option>queue_list_requires_admin</option>.
24136 <indexterm role="option">
24137 <primary><option>qualify_domain</option></primary>
24140 <informaltable frame="all">
24141 <tgroup cols="4" colsep="0" rowsep="0">
24142 <colspec colwidth="8*" align="left"/>
24143 <colspec colwidth="5*" align="center"/>
24144 <colspec colwidth="5*" align="center"/>
24145 <colspec colwidth="6*" align="right"/>
24148 <entry><option>qualify_domain</option></entry>
24149 <entry>Use: <emphasis>main</emphasis></entry>
24150 <entry>Type: <emphasis>string</emphasis></entry>
24151 <entry>Default: <emphasis>see below</emphasis></entry>
24157 <indexterm role="concept">
24158 <primary>domain</primary>
24159 <secondary>for qualifying addresses</secondary>
24161 <indexterm role="concept">
24162 <primary>address</primary>
24163 <secondary>qualification</secondary>
24165 This option specifies the domain name that is added to any envelope sender
24166 addresses that do not have a domain qualification. It also applies to
24167 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
24168 are accepted by default only for locally-generated messages. Qualification is
24169 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
24170 locally-generated messages, unless the <option>-bnq</option> command line option is used.
24173 Messages from external sources must always contain fully qualified addresses,
24174 unless the sending host matches <option>sender_unqualified_hosts</option> or
24175 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
24176 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
24177 necessary. Internally, Exim always works with fully qualified envelope
24178 addresses. If <option>qualify_domain</option> is not set, it defaults to the
24179 <option>primary_hostname</option> value.
24182 <indexterm role="option">
24183 <primary><option>qualify_recipient</option></primary>
24186 <informaltable frame="all">
24187 <tgroup cols="4" colsep="0" rowsep="0">
24188 <colspec colwidth="8*" align="left"/>
24189 <colspec colwidth="5*" align="center"/>
24190 <colspec colwidth="5*" align="center"/>
24191 <colspec colwidth="6*" align="right"/>
24194 <entry><option>qualify_recipient</option></entry>
24195 <entry>Use: <emphasis>main</emphasis></entry>
24196 <entry>Type: <emphasis>string</emphasis></entry>
24197 <entry>Default: <emphasis>see below</emphasis></entry>
24203 This option allows you to specify a different domain for qualifying recipient
24204 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
24207 <indexterm role="option">
24208 <primary><option>queue_domains</option></primary>
24211 <informaltable frame="all">
24212 <tgroup cols="4" colsep="0" rowsep="0">
24213 <colspec colwidth="8*" align="left"/>
24214 <colspec colwidth="5*" align="center"/>
24215 <colspec colwidth="5*" align="center"/>
24216 <colspec colwidth="6*" align="right"/>
24219 <entry><option>queue_domains</option></entry>
24220 <entry>Use: <emphasis>main</emphasis></entry>
24221 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
24222 <entry>Default: <emphasis>unset</emphasis></entry>
24228 <indexterm role="concept">
24229 <primary>domain</primary>
24230 <secondary>specifying non-immediate delivery</secondary>
24232 <indexterm role="concept">
24233 <primary>queueing incoming messages</primary>
24235 <indexterm role="concept">
24236 <primary>message</primary>
24237 <secondary>queueing certain domains</secondary>
24239 This option lists domains for which immediate delivery is not required.
24240 A delivery process is started whenever a message is received, but only those
24241 domains that do not match are processed. All other deliveries wait until the
24242 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
24245 <indexterm role="option">
24246 <primary><option>queue_list_requires_admin</option></primary>
24249 <informaltable frame="all">
24250 <tgroup cols="4" colsep="0" rowsep="0">
24251 <colspec colwidth="8*" align="left"/>
24252 <colspec colwidth="5*" align="center"/>
24253 <colspec colwidth="5*" align="center"/>
24254 <colspec colwidth="6*" align="right"/>
24257 <entry><option>queue_list_requires_admin</option></entry>
24258 <entry>Use: <emphasis>main</emphasis></entry>
24259 <entry>Type: <emphasis>boolean</emphasis></entry>
24260 <entry>Default: <emphasis>true</emphasis></entry>
24266 <indexterm role="concept">
24267 <primary><option>-bp</option> option</primary>
24269 The <option>-bp</option> command-line option, which lists the messages that are on the
24270 queue, requires the caller to be an admin user unless
24271 <option>queue_list_requires_admin</option> is set false. See also <option>prod_requires_admin</option>.
24274 <indexterm role="option">
24275 <primary><option>queue_only</option></primary>
24278 <informaltable frame="all">
24279 <tgroup cols="4" colsep="0" rowsep="0">
24280 <colspec colwidth="8*" align="left"/>
24281 <colspec colwidth="5*" align="center"/>
24282 <colspec colwidth="5*" align="center"/>
24283 <colspec colwidth="6*" align="right"/>
24286 <entry><option>queue_only</option></entry>
24287 <entry>Use: <emphasis>main</emphasis></entry>
24288 <entry>Type: <emphasis>boolean</emphasis></entry>
24289 <entry>Default: <emphasis>false</emphasis></entry>
24295 <indexterm role="concept">
24296 <primary>queueing incoming messages</primary>
24298 <indexterm role="concept">
24299 <primary>message</primary>
24300 <secondary>queueing unconditionally</secondary>
24302 If <option>queue_only</option> is set, a delivery process is not automatically started
24303 whenever a message is received. Instead, the message waits on the queue for the
24304 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
24305 delivered immediately when certain conditions (such as heavy load) occur.
24308 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
24309 and <option>-odi</option> command line options override <option>queue_only</option> unless
24310 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
24311 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
24314 <indexterm role="option">
24315 <primary><option>queue_only_file</option></primary>
24318 <informaltable frame="all">
24319 <tgroup cols="4" colsep="0" rowsep="0">
24320 <colspec colwidth="8*" align="left"/>
24321 <colspec colwidth="5*" align="center"/>
24322 <colspec colwidth="5*" align="center"/>
24323 <colspec colwidth="6*" align="right"/>
24326 <entry><option>queue_only_file</option></entry>
24327 <entry>Use: <emphasis>main</emphasis></entry>
24328 <entry>Type: <emphasis>string</emphasis></entry>
24329 <entry>Default: <emphasis>unset</emphasis></entry>
24335 <indexterm role="concept">
24336 <primary>queueing incoming messages</primary>
24338 <indexterm role="concept">
24339 <primary>message</primary>
24340 <secondary>queueing by file existence</secondary>
24342 This option can be set to a colon-separated list of absolute path names, each
24343 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
24344 it tests for the existence of each listed path using a call to <function>stat()</function>. For
24345 each path that exists, the corresponding queuing option is set.
24346 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
24347 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
24349 <literallayout class="monospaced">
24350 queue_only_file = smtp/some/file
24353 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
24354 <filename>/some/file</filename> exists.
24357 <indexterm role="option">
24358 <primary><option>queue_only_load</option></primary>
24361 <informaltable frame="all">
24362 <tgroup cols="4" colsep="0" rowsep="0">
24363 <colspec colwidth="8*" align="left"/>
24364 <colspec colwidth="5*" align="center"/>
24365 <colspec colwidth="5*" align="center"/>
24366 <colspec colwidth="6*" align="right"/>
24369 <entry><option>queue_only_load</option></entry>
24370 <entry>Use: <emphasis>main</emphasis></entry>
24371 <entry>Type: <emphasis>fixed-point</emphasis></entry>
24372 <entry>Default: <emphasis>unset</emphasis></entry>
24378 <indexterm role="concept">
24379 <primary>load average</primary>
24381 <indexterm role="concept">
24382 <primary>queueing incoming messages</primary>
24384 <indexterm role="concept">
24385 <primary>message</primary>
24386 <secondary>queueing by load</secondary>
24388 If the system load average is higher than this value, incoming messages from
24389 all sources are queued, and no automatic deliveries are started. If this
24390 happens during local or remote SMTP input, all subsequent messages on the same
24391 connection are queued. Deliveries will subsequently be performed by queue
24392 runner processes. This option has no effect on ancient operating systems on
24393 which Exim cannot determine the load average. See also
24394 <option>deliver_queue_load_max</option> and <option>smtp_load_reserve</option>.
24397 <indexterm role="option">
24398 <primary><option>queue_only_override</option></primary>
24401 <informaltable frame="all">
24402 <tgroup cols="4" colsep="0" rowsep="0">
24403 <colspec colwidth="8*" align="left"/>
24404 <colspec colwidth="5*" align="center"/>
24405 <colspec colwidth="5*" align="center"/>
24406 <colspec colwidth="6*" align="right"/>
24409 <entry><option>queue_only_override</option></entry>
24410 <entry>Use: <emphasis>main</emphasis></entry>
24411 <entry>Type: <emphasis>boolean</emphasis></entry>
24412 <entry>Default: <emphasis>true</emphasis></entry>
24418 <indexterm role="concept">
24419 <primary>queueing incoming messages</primary>
24421 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
24422 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
24423 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
24424 to override; they are accepted, but ignored.
24427 <indexterm role="option">
24428 <primary><option>queue_run_in_order</option></primary>
24431 <informaltable frame="all">
24432 <tgroup cols="4" colsep="0" rowsep="0">
24433 <colspec colwidth="8*" align="left"/>
24434 <colspec colwidth="5*" align="center"/>
24435 <colspec colwidth="5*" align="center"/>
24436 <colspec colwidth="6*" align="right"/>
24439 <entry><option>queue_run_in_order</option></entry>
24440 <entry>Use: <emphasis>main</emphasis></entry>
24441 <entry>Type: <emphasis>boolean</emphasis></entry>
24442 <entry>Default: <emphasis>false</emphasis></entry>
24448 <indexterm role="concept">
24449 <primary>queue runner</primary>
24450 <secondary>processing messages in order</secondary>
24452 If this option is set, queue runs happen in order of message arrival instead of
24453 in an arbitrary order. For this to happen, a complete list of the entire queue
24454 must be set up before the deliveries start. When the queue is all held in a
24455 single directory (the default), a single list is created for both the ordered
24456 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
24457 single list is not created when <option>queue_run_in_order</option> is false. In this case,
24458 the sub-directories are processed one at a time (in a random order), and this
24459 avoids setting up one huge list for the whole queue. Thus, setting
24460 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
24461 when the queue is large, because of the extra work in setting up the single,
24462 large list. In most situations, <option>queue_run_in_order</option> should not be set.
24465 <indexterm role="option">
24466 <primary><option>queue_run_max</option></primary>
24469 <informaltable frame="all">
24470 <tgroup cols="4" colsep="0" rowsep="0">
24471 <colspec colwidth="8*" align="left"/>
24472 <colspec colwidth="5*" align="center"/>
24473 <colspec colwidth="5*" align="center"/>
24474 <colspec colwidth="6*" align="right"/>
24477 <entry><option>queue_run_max</option></entry>
24478 <entry>Use: <emphasis>main</emphasis></entry>
24479 <entry>Type: <emphasis>integer</emphasis></entry>
24480 <entry>Default: <emphasis>5</emphasis></entry>
24486 <indexterm role="concept">
24487 <primary>queue runner</primary>
24488 <secondary>maximum number of</secondary>
24490 This controls the maximum number of queue runner processes that an Exim daemon
24491 can run simultaneously. This does not mean that it starts them all at once,
24492 but rather that if the maximum number are still running when the time comes to
24493 start another one, it refrains from starting another one. This can happen with
24494 very large queues and/or very sluggish deliveries. This option does not,
24495 however, interlock with other processes, so additional queue runners can be
24496 started by other means, or by killing and restarting the daemon.
24499 Setting this option to zero does not suppress queue runs; rather, it disables
24500 the limit, allowing any number of simultaneous queue runner processes to be
24501 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
24502 the daemon’s command line.
24505 <indexterm role="option">
24506 <primary><option>queue_smtp_domains</option></primary>
24509 <informaltable frame="all">
24510 <tgroup cols="4" colsep="0" rowsep="0">
24511 <colspec colwidth="8*" align="left"/>
24512 <colspec colwidth="5*" align="center"/>
24513 <colspec colwidth="5*" align="center"/>
24514 <colspec colwidth="6*" align="right"/>
24517 <entry><option>queue_smtp_domains</option></entry>
24518 <entry>Use: <emphasis>main</emphasis></entry>
24519 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
24520 <entry>Default: <emphasis>unset</emphasis></entry>
24526 <indexterm role="concept">
24527 <primary>queueing incoming messages</primary>
24529 <indexterm role="concept">
24530 <primary>message</primary>
24531 <secondary>queueing remote deliveries</secondary>
24533 When this option is set, a delivery process is started whenever a message is
24534 received, routing is performed, and local deliveries take place.
24535 However, if any SMTP deliveries are required for domains that match
24536 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
24537 message waits on the queue for the next queue run. Since routing of the message
24538 has taken place, Exim knows to which remote hosts it must be delivered, and so
24539 when the queue run happens, multiple messages for the same host are delivered
24540 over a single SMTP connection. The <option>-odqs</option> command line option causes all
24541 SMTP deliveries to be queued in this way, and is equivalent to setting
24542 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
24543 <option>queue_domains</option>.
24546 <indexterm role="option">
24547 <primary><option>receive_timeout</option></primary>
24550 <informaltable frame="all">
24551 <tgroup cols="4" colsep="0" rowsep="0">
24552 <colspec colwidth="8*" align="left"/>
24553 <colspec colwidth="5*" align="center"/>
24554 <colspec colwidth="5*" align="center"/>
24555 <colspec colwidth="6*" align="right"/>
24558 <entry><option>receive_timeout</option></entry>
24559 <entry>Use: <emphasis>main</emphasis></entry>
24560 <entry>Type: <emphasis>time</emphasis></entry>
24561 <entry>Default: <emphasis>0s</emphasis></entry>
24567 <indexterm role="concept">
24568 <primary>timeout</primary>
24569 <secondary>for non-SMTP input</secondary>
24571 This option sets the timeout for accepting a non-SMTP message, that is, the
24572 maximum time that Exim waits when reading a message on the standard input. If
24573 the value is zero, it will wait for ever. This setting is overridden by the
24574 <option>-or</option> command line option. The timeout for incoming SMTP messages is
24575 controlled by <option>smtp_receive_timeout</option>.
24578 <indexterm role="option">
24579 <primary><option>received_header_text</option></primary>
24582 <informaltable frame="all">
24583 <tgroup cols="4" colsep="0" rowsep="0">
24584 <colspec colwidth="8*" align="left"/>
24585 <colspec colwidth="5*" align="center"/>
24586 <colspec colwidth="5*" align="center"/>
24587 <colspec colwidth="6*" align="right"/>
24590 <entry><option>received_header_text</option></entry>
24591 <entry>Use: <emphasis>main</emphasis></entry>
24592 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
24593 <entry>Default: <emphasis>see below</emphasis></entry>
24599 <indexterm role="concept">
24600 <primary>customizing</primary>
24601 <secondary><emphasis>Received:</emphasis> header</secondary>
24603 <indexterm role="concept">
24604 <primary><emphasis>Received:</emphasis> header line</primary>
24605 <secondary>customizing</secondary>
24607 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
24608 added to each message, except for the timestamp, which is automatically added
24609 on at the end (preceded by a semicolon). The string is expanded each time it is
24610 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
24611 added to the message. Otherwise, the string should start with the text
24612 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
24613 header lines. The default setting is:
24615 <literallayout class="monospaced">
24616 received_header_text = Received: \
24617 ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
24618 {${if def:sender_ident \
24619 {from ${quote_local_part:$sender_ident} }}\
24620 ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
24621 by $primary_hostname \
24622 ${if def:received_protocol {with $received_protocol}} \
24623 ${if def:tls_cipher {($tls_cipher)\n\t}}\
24624 (Exim $version_number)\n\t\
24625 ${if def:sender_address \
24626 {(envelope-from <$sender_address>)\n\t}}\
24627 id $message_exim_id\
24628 ${if def:received_for {\n\tfor $received_for}}
24631 The reference to the TLS cipher is omitted when Exim is built without TLS
24632 support. The use of conditional expansions ensures that this works for both
24633 locally generated messages and messages received from remote hosts, giving
24634 header lines such as the following:
24636 <literallayout class="monospaced">
24637 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
24638 by marley.carol.example with esmtp (Exim 4.00)
24639 (envelope-from <bob@carol.example>)
24640 id 16IOWa-00019l-00
24641 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
24642 Received: by scrooge.carol.example with local (Exim 4.00)
24643 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
24646 Until the body of the message has been received, the timestamp is the time when
24647 the message started to be received. Once the body has arrived, and all policy
24648 checks have taken place, the timestamp is updated to the time at which the
24649 message was accepted.
24652 <indexterm role="option">
24653 <primary><option>received_headers_max</option></primary>
24656 <informaltable frame="all">
24657 <tgroup cols="4" colsep="0" rowsep="0">
24658 <colspec colwidth="8*" align="left"/>
24659 <colspec colwidth="5*" align="center"/>
24660 <colspec colwidth="5*" align="center"/>
24661 <colspec colwidth="6*" align="right"/>
24664 <entry><option>received_headers_max</option></entry>
24665 <entry>Use: <emphasis>main</emphasis></entry>
24666 <entry>Type: <emphasis>integer</emphasis></entry>
24667 <entry>Default: <emphasis>30</emphasis></entry>
24673 <indexterm role="concept">
24674 <primary>loop</primary>
24675 <secondary>prevention</secondary>
24677 <indexterm role="concept">
24678 <primary>mail loop prevention</primary>
24680 <indexterm role="concept">
24681 <primary><emphasis>Received:</emphasis> header line</primary>
24682 <secondary>counting</secondary>
24684 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
24685 counted, and if it is greater than this parameter, a mail loop is assumed to
24686 have occurred, the delivery is abandoned, and an error message is generated.
24687 This applies to both local and remote deliveries.
24690 <indexterm role="option">
24691 <primary><option>recipient_unqualified_hosts</option></primary>
24694 <informaltable frame="all">
24695 <tgroup cols="4" colsep="0" rowsep="0">
24696 <colspec colwidth="8*" align="left"/>
24697 <colspec colwidth="5*" align="center"/>
24698 <colspec colwidth="5*" align="center"/>
24699 <colspec colwidth="6*" align="right"/>
24702 <entry><option>recipient_unqualified_hosts</option></entry>
24703 <entry>Use: <emphasis>main</emphasis></entry>
24704 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
24705 <entry>Default: <emphasis>unset</emphasis></entry>
24711 <indexterm role="concept">
24712 <primary>unqualified addresses</primary>
24714 <indexterm role="concept">
24715 <primary>host</primary>
24716 <secondary>unqualified addresses from</secondary>
24718 This option lists those hosts from which Exim is prepared to accept unqualified
24719 recipient addresses in message envelopes. The addresses are made fully
24720 qualified by the addition of the <option>qualify_recipient</option> value. This option also
24721 affects message header lines. Exim does not reject unqualified recipient
24722 addresses in headers, but it qualifies them only if the message came from a
24723 host that matches <option>recipient_unqualified_hosts</option>,
24724 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
24725 option was not set.
24728 <indexterm role="option">
24729 <primary><option>recipients_max</option></primary>
24732 <informaltable frame="all">
24733 <tgroup cols="4" colsep="0" rowsep="0">
24734 <colspec colwidth="8*" align="left"/>
24735 <colspec colwidth="5*" align="center"/>
24736 <colspec colwidth="5*" align="center"/>
24737 <colspec colwidth="6*" align="right"/>
24740 <entry><option>recipients_max</option></entry>
24741 <entry>Use: <emphasis>main</emphasis></entry>
24742 <entry>Type: <emphasis>integer</emphasis></entry>
24743 <entry>Default: <emphasis>0</emphasis></entry>
24749 <indexterm role="concept">
24750 <primary>limit</primary>
24751 <secondary>number of recipients</secondary>
24753 <indexterm role="concept">
24754 <primary>recipient</primary>
24755 <secondary>maximum number</secondary>
24757 If this option is set greater than zero, it specifies the maximum number of
24758 original recipients for any message. Additional recipients that are generated
24759 by aliasing or forwarding do not count. SMTP messages get a 452 response for
24760 all recipients over the limit; earlier recipients are delivered as normal.
24761 Non-SMTP messages with too many recipients are failed, and no deliveries are
24765 <indexterm role="concept">
24766 <primary>RCPT</primary>
24767 <secondary>maximum number of incoming</secondary>
24769 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
24770 RCPT commands in a single message.
24773 <indexterm role="option">
24774 <primary><option>recipients_max_reject</option></primary>
24777 <informaltable frame="all">
24778 <tgroup cols="4" colsep="0" rowsep="0">
24779 <colspec colwidth="8*" align="left"/>
24780 <colspec colwidth="5*" align="center"/>
24781 <colspec colwidth="5*" align="center"/>
24782 <colspec colwidth="6*" align="right"/>
24785 <entry><option>recipients_max_reject</option></entry>
24786 <entry>Use: <emphasis>main</emphasis></entry>
24787 <entry>Type: <emphasis>boolean</emphasis></entry>
24788 <entry>Default: <emphasis>false</emphasis></entry>
24794 If this option is set true, Exim rejects SMTP messages containing too many
24795 recipients by giving 552 errors to the surplus RCPT commands, and a 554
24796 error to the eventual DATA command. Otherwise (the default) it gives a 452
24797 error to the surplus RCPT commands and accepts the message on behalf of the
24798 initial set of recipients. The remote server should then re-send the message
24799 for the remaining recipients at a later time.
24802 <indexterm role="option">
24803 <primary><option>remote_max_parallel</option></primary>
24806 <informaltable frame="all">
24807 <tgroup cols="4" colsep="0" rowsep="0">
24808 <colspec colwidth="8*" align="left"/>
24809 <colspec colwidth="5*" align="center"/>
24810 <colspec colwidth="5*" align="center"/>
24811 <colspec colwidth="6*" align="right"/>
24814 <entry><option>remote_max_parallel</option></entry>
24815 <entry>Use: <emphasis>main</emphasis></entry>
24816 <entry>Type: <emphasis>integer</emphasis></entry>
24817 <entry>Default: <emphasis>2</emphasis></entry>
24823 <indexterm role="concept">
24824 <primary>delivery</primary>
24825 <secondary>parallelism for remote</secondary>
24827 This option controls parallel delivery of one message to a number of remote
24828 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
24829 does all the remote deliveries for a message one by one. Otherwise, if a single
24830 message has to be delivered to more than one remote host, or if several copies
24831 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
24832 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
24833 deliveries are required, the maximum number of processes are started, and as
24834 each one finishes, another is begun. The order of starting processes is the
24835 same as if sequential delivery were being done, and can be controlled by the
24836 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
24837 with debugging turned on, the debugging output from each delivery process is
24838 tagged with its process id.
24841 This option controls only the maximum number of parallel deliveries for one
24842 message in one Exim delivery process. Because Exim has no central queue
24843 manager, there is no way of controlling the total number of simultaneous
24844 deliveries if the configuration allows a delivery attempt as soon as a message
24848 <indexterm role="concept">
24849 <primary>number of deliveries</primary>
24851 <indexterm role="concept">
24852 <primary>delivery</primary>
24853 <secondary>maximum number of</secondary>
24855 If you want to control the total number of deliveries on the system, you
24856 need to set the <option>queue_only</option> option. This ensures that all incoming messages
24857 are added to the queue without starting a delivery process. Then set up an Exim
24858 daemon to start queue runner processes at appropriate intervals (probably
24859 fairly often, for example, every minute), and limit the total number of queue
24860 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
24861 delivers only one message at a time, the maximum number of deliveries that can
24862 then take place at once is <option>queue_run_max</option> multiplied by
24863 <option>remote_max_parallel</option>.
24866 If it is purely remote deliveries you want to control, use
24867 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
24868 doing the SMTP routing before queuing, so that several messages for the same
24869 host will eventually get delivered down the same connection.
24872 <indexterm role="option">
24873 <primary><option>remote_sort_domains</option></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>remote_sort_domains</option></entry>
24885 <entry>Use: <emphasis>main</emphasis></entry>
24886 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
24887 <entry>Default: <emphasis>unset</emphasis></entry>
24893 <indexterm role="concept">
24894 <primary>sorting remote deliveries</primary>
24896 <indexterm role="concept">
24897 <primary>delivery</primary>
24898 <secondary>sorting remote</secondary>
24900 When there are a number of remote deliveries for a message, they are sorted by
24901 domain into the order given by this list. For example,
24903 <literallayout class="monospaced">
24904 remote_sort_domains = *.cam.ac.uk:*.uk
24907 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
24908 then to those in the <option>uk</option> domain, then to any others.
24911 <indexterm role="option">
24912 <primary><option>retry_data_expire</option></primary>
24915 <informaltable frame="all">
24916 <tgroup cols="4" colsep="0" rowsep="0">
24917 <colspec colwidth="8*" align="left"/>
24918 <colspec colwidth="5*" align="center"/>
24919 <colspec colwidth="5*" align="center"/>
24920 <colspec colwidth="6*" align="right"/>
24923 <entry><option>retry_data_expire</option></entry>
24924 <entry>Use: <emphasis>main</emphasis></entry>
24925 <entry>Type: <emphasis>time</emphasis></entry>
24926 <entry>Default: <emphasis>7d</emphasis></entry>
24932 <indexterm role="concept">
24933 <primary>hints database</primary>
24934 <secondary>data expiry</secondary>
24936 This option sets a <quote>use before</quote> time on retry information in Exim’s hints
24937 database. Any older retry data is ignored. This means that, for example, once a
24938 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
24942 <indexterm role="option">
24943 <primary><option>retry_interval_max</option></primary>
24946 <informaltable frame="all">
24947 <tgroup cols="4" colsep="0" rowsep="0">
24948 <colspec colwidth="8*" align="left"/>
24949 <colspec colwidth="5*" align="center"/>
24950 <colspec colwidth="5*" align="center"/>
24951 <colspec colwidth="6*" align="right"/>
24954 <entry><option>retry_interval_max</option></entry>
24955 <entry>Use: <emphasis>main</emphasis></entry>
24956 <entry>Type: <emphasis>time</emphasis></entry>
24957 <entry>Default: <emphasis>24h</emphasis></entry>
24963 <indexterm role="concept">
24964 <primary>retry</primary>
24965 <secondary>limit on interval</secondary>
24967 <indexterm role="concept">
24968 <primary>limit</primary>
24969 <secondary>on retry interval</secondary>
24971 Chapter <xref linkend="CHAPretry"/> describes Exim’s mechanisms for controlling the
24972 intervals between delivery attempts for messages that cannot be delivered
24973 straight away. This option sets an overall limit to the length of time between
24974 retries. It cannot be set greater than 24 hours; any attempt to do so forces
24978 <indexterm role="option">
24979 <primary><option>return_path_remove</option></primary>
24982 <informaltable frame="all">
24983 <tgroup cols="4" colsep="0" rowsep="0">
24984 <colspec colwidth="8*" align="left"/>
24985 <colspec colwidth="5*" align="center"/>
24986 <colspec colwidth="5*" align="center"/>
24987 <colspec colwidth="6*" align="right"/>
24990 <entry><option>return_path_remove</option></entry>
24991 <entry>Use: <emphasis>main</emphasis></entry>
24992 <entry>Type: <emphasis>boolean</emphasis></entry>
24993 <entry>Default: <emphasis>true</emphasis></entry>
24999 <indexterm role="concept">
25000 <primary><emphasis>Return-path:</emphasis> header line</primary>
25001 <secondary>removing</secondary>
25003 RFC 2821, section 4.4, states that an SMTP server must insert a
25004 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
25005 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
25006 MAIL command. This description implies that this header should not be present
25007 in an incoming message. If <option>return_path_remove</option> is true, any existing
25008 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
25009 received. Exim’s transports have options for adding <emphasis>Return-path:</emphasis> headers at
25010 the time of delivery. They are normally used only for final local deliveries.
25013 <indexterm role="option">
25014 <primary><option>return_size_limit</option></primary>
25017 <informaltable frame="all">
25018 <tgroup cols="4" colsep="0" rowsep="0">
25019 <colspec colwidth="8*" align="left"/>
25020 <colspec colwidth="5*" align="center"/>
25021 <colspec colwidth="5*" align="center"/>
25022 <colspec colwidth="6*" align="right"/>
25025 <entry><option>return_size_limit</option></entry>
25026 <entry>Use: <emphasis>main</emphasis></entry>
25027 <entry>Type: <emphasis>integer</emphasis></entry>
25028 <entry>Default: <emphasis>100K</emphasis></entry>
25034 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
25037 <indexterm role="option">
25038 <primary><option>rfc1413_hosts</option></primary>
25041 <informaltable frame="all">
25042 <tgroup cols="4" colsep="0" rowsep="0">
25043 <colspec colwidth="8*" align="left"/>
25044 <colspec colwidth="5*" align="center"/>
25045 <colspec colwidth="5*" align="center"/>
25046 <colspec colwidth="6*" align="right"/>
25049 <entry><option>rfc1413_hosts</option></entry>
25050 <entry>Use: <emphasis>main</emphasis></entry>
25051 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
25052 <entry>Default: <emphasis>*</emphasis></entry>
25058 <indexterm role="concept">
25059 <primary>RFC 1413</primary>
25061 <indexterm role="concept">
25062 <primary>host</primary>
25063 <secondary>for RFC 1413 calls</secondary>
25065 RFC 1413 identification calls are made to any client host which matches an item
25069 <indexterm role="option">
25070 <primary><option>rfc1413_query_timeout</option></primary>
25073 <informaltable frame="all">
25074 <tgroup cols="4" colsep="0" rowsep="0">
25075 <colspec colwidth="8*" align="left"/>
25076 <colspec colwidth="5*" align="center"/>
25077 <colspec colwidth="5*" align="center"/>
25078 <colspec colwidth="6*" align="right"/>
25081 <entry><option>rfc1413_query_timeout</option></entry>
25082 <entry>Use: <emphasis>main</emphasis></entry>
25083 <entry>Type: <emphasis>time</emphasis></entry>
25084 <entry>Default: <emphasis>5s</emphasis></entry>
25090 <indexterm role="concept">
25091 <primary>RFC 1413</primary>
25092 <secondary>query timeout</secondary>
25094 <indexterm role="concept">
25095 <primary>timeout</primary>
25096 <secondary>for RFC 1413 call</secondary>
25098 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
25099 no RFC 1413 calls are ever made.
25102 <indexterm role="option">
25103 <primary><option>sender_unqualified_hosts</option></primary>
25106 <informaltable frame="all">
25107 <tgroup cols="4" colsep="0" rowsep="0">
25108 <colspec colwidth="8*" align="left"/>
25109 <colspec colwidth="5*" align="center"/>
25110 <colspec colwidth="5*" align="center"/>
25111 <colspec colwidth="6*" align="right"/>
25114 <entry><option>sender_unqualified_hosts</option></entry>
25115 <entry>Use: <emphasis>main</emphasis></entry>
25116 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
25117 <entry>Default: <emphasis>unset</emphasis></entry>
25123 <indexterm role="concept">
25124 <primary>unqualified addresses</primary>
25126 <indexterm role="concept">
25127 <primary>host</primary>
25128 <secondary>unqualified addresses from</secondary>
25130 This option lists those hosts from which Exim is prepared to accept unqualified
25131 sender addresses. The addresses are made fully qualified by the addition of
25132 <option>qualify_domain</option>. This option also affects message header lines. Exim does
25133 not reject unqualified addresses in headers that contain sender addresses, but
25134 it qualifies them only if the message came from a host that matches
25135 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
25136 using TCP/IP), and the <option>-bnq</option> option was not set.
25139 <indexterm role="option">
25140 <primary><option>smtp_accept_keepalive</option></primary>
25143 <informaltable frame="all">
25144 <tgroup cols="4" colsep="0" rowsep="0">
25145 <colspec colwidth="8*" align="left"/>
25146 <colspec colwidth="5*" align="center"/>
25147 <colspec colwidth="5*" align="center"/>
25148 <colspec colwidth="6*" align="right"/>
25151 <entry><option>smtp_accept_keepalive</option></entry>
25152 <entry>Use: <emphasis>main</emphasis></entry>
25153 <entry>Type: <emphasis>boolean</emphasis></entry>
25154 <entry>Default: <emphasis>true</emphasis></entry>
25160 <indexterm role="concept">
25161 <primary>keepalive</primary>
25162 <secondary>on incoming connection</secondary>
25164 This option controls the setting of the SO_KEEPALIVE option on incoming
25165 TCP/IP socket connections. When set, it causes the kernel to probe idle
25166 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
25167 other end of the connection should send an acknowledgement if the connection is
25168 still okay or a reset if the connection has been aborted. The reason for doing
25169 this is that it has the beneficial effect of freeing up certain types of
25170 connection that can get stuck when the remote host is disconnected without
25171 tidying up the TCP/IP call properly. The keepalive mechanism takes several
25172 hours to detect unreachable hosts.
25175 <indexterm role="option">
25176 <primary><option>smtp_accept_max</option></primary>
25179 <informaltable frame="all">
25180 <tgroup cols="4" colsep="0" rowsep="0">
25181 <colspec colwidth="8*" align="left"/>
25182 <colspec colwidth="5*" align="center"/>
25183 <colspec colwidth="5*" align="center"/>
25184 <colspec colwidth="6*" align="right"/>
25187 <entry><option>smtp_accept_max</option></entry>
25188 <entry>Use: <emphasis>main</emphasis></entry>
25189 <entry>Type: <emphasis>integer</emphasis></entry>
25190 <entry>Default: <emphasis>20</emphasis></entry>
25196 <indexterm role="concept">
25197 <primary>limit</primary>
25198 <secondary>incoming SMTP connections</secondary>
25200 <indexterm role="concept">
25201 <primary>SMTP</primary>
25202 <secondary>incoming connection count</secondary>
25204 <indexterm role="concept">
25205 <primary>inetd</primary>
25207 This option specifies the maximum number of simultaneous incoming SMTP calls
25208 that Exim will accept. It applies only to the listening daemon; there is no
25209 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
25210 value is set to zero, no limit is applied. However, it is required to be
25211 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
25212 set. See also <option>smtp_accept_reserve</option>.
25215 <indexterm role="option">
25216 <primary><option>smtp_accept_max_nonmail</option></primary>
25219 <informaltable frame="all">
25220 <tgroup cols="4" colsep="0" rowsep="0">
25221 <colspec colwidth="8*" align="left"/>
25222 <colspec colwidth="5*" align="center"/>
25223 <colspec colwidth="5*" align="center"/>
25224 <colspec colwidth="6*" align="right"/>
25227 <entry><option>smtp_accept_max_nonmail</option></entry>
25228 <entry>Use: <emphasis>main</emphasis></entry>
25229 <entry>Type: <emphasis>integer</emphasis></entry>
25230 <entry>Default: <emphasis>10</emphasis></entry>
25236 <indexterm role="concept">
25237 <primary>limit</primary>
25238 <secondary>non-mail SMTP commands</secondary>
25240 <indexterm role="concept">
25241 <primary>SMTP</primary>
25242 <secondary>limiting non-mail commands</secondary>
25244 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
25245 the connection if there are too many. This option defines <quote>too many</quote>. The
25246 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
25247 client looping sending EHLO, for example. The check is applied only if the
25248 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
25251 When a new message is expected, one occurrence of RSET is not counted. This
25252 allows a client to send one RSET between messages (this is not necessary,
25253 but some clients do it). Exim also allows one uncounted occurence of HELO
25254 or EHLO, and one occurrence of STARTTLS between messages. After
25255 starting up a TLS session, another EHLO is expected, and so it too is not
25256 counted. The first occurrence of AUTH in a connection, or immediately
25257 following STARTTLS is not counted. Otherwise, all commands other than
25258 MAIL, RCPT, DATA, and QUIT are counted.
25261 <indexterm role="option">
25262 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
25265 <informaltable frame="all">
25266 <tgroup cols="4" colsep="0" rowsep="0">
25267 <colspec colwidth="8*" align="left"/>
25268 <colspec colwidth="5*" align="center"/>
25269 <colspec colwidth="5*" align="center"/>
25270 <colspec colwidth="6*" align="right"/>
25273 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
25274 <entry>Use: <emphasis>main</emphasis></entry>
25275 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
25276 <entry>Default: <emphasis>*</emphasis></entry>
25282 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
25283 check by setting this option. The default value makes it apply to all hosts. By
25284 changing the value, you can exclude any badly-behaved hosts that you have to
25288 <indexterm role="option">
25289 <primary><option>smtp_accept_max_per_connection</option></primary>
25292 <informaltable frame="all">
25293 <tgroup cols="4" colsep="0" rowsep="0">
25294 <colspec colwidth="8*" align="left"/>
25295 <colspec colwidth="5*" align="center"/>
25296 <colspec colwidth="5*" align="center"/>
25297 <colspec colwidth="6*" align="right"/>
25300 <entry><option>smtp_accept_max_per_connection</option></entry>
25301 <entry>Use: <emphasis>main</emphasis></entry>
25302 <entry>Type: <emphasis>integer</emphasis></entry>
25303 <entry>Default: <emphasis>1000</emphasis></entry>
25309 <indexterm role="concept">
25310 <primary>SMTP incoming message count</primary>
25311 <secondary>limiting</secondary>
25313 <indexterm role="concept">
25314 <primary>limit</primary>
25315 <secondary>messages per SMTP connection</secondary>
25317 The value of this option limits the number of MAIL commands that Exim is
25318 prepared to accept over a single SMTP connection, whether or not each command
25319 results in the transfer of a message. After the limit is reached, a 421
25320 response is given to subsequent MAIL commands. This limit is a safety
25321 precaution against a client that goes mad (incidents of this type have been
25325 <indexterm role="option">
25326 <primary><option>smtp_accept_max_per_host</option></primary>
25329 <informaltable frame="all">
25330 <tgroup cols="4" colsep="0" rowsep="0">
25331 <colspec colwidth="8*" align="left"/>
25332 <colspec colwidth="5*" align="center"/>
25333 <colspec colwidth="5*" align="center"/>
25334 <colspec colwidth="6*" align="right"/>
25337 <entry><option>smtp_accept_max_per_host</option></entry>
25338 <entry>Use: <emphasis>main</emphasis></entry>
25339 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
25340 <entry>Default: <emphasis>unset</emphasis></entry>
25346 <indexterm role="concept">
25347 <primary>limit</primary>
25348 <secondary>SMTP connections from one host</secondary>
25350 <indexterm role="concept">
25351 <primary>host</primary>
25352 <secondary>limiting SMTP connections from</secondary>
25354 This option restricts the number of simultaneous IP connections from a single
25355 host (strictly, from a single IP address) to the Exim daemon. The option is
25356 expanded, to enable different limits to be applied to different hosts by
25357 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
25358 connection attempts from the same host are rejected with error code 421. The
25359 default value of zero imposes no limit. If this option is set, it is required
25360 that <option>smtp_accept_max</option> be non-zero.
25363 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
25364 constructions that take an appreciable amount of time. The expansion and test
25365 happen in the main daemon loop, in order to reject additional connections
25366 without forking additional processes (otherwise a denial-of-service attack
25367 could cause a vast number or processes to be created). While the daemon is
25368 doing this processing, it cannot accept any other incoming connections.
25371 <indexterm role="option">
25372 <primary><option>smtp_accept_queue</option></primary>
25375 <informaltable frame="all">
25376 <tgroup cols="4" colsep="0" rowsep="0">
25377 <colspec colwidth="8*" align="left"/>
25378 <colspec colwidth="5*" align="center"/>
25379 <colspec colwidth="5*" align="center"/>
25380 <colspec colwidth="6*" align="right"/>
25383 <entry><option>smtp_accept_queue</option></entry>
25384 <entry>Use: <emphasis>main</emphasis></entry>
25385 <entry>Type: <emphasis>integer</emphasis></entry>
25386 <entry>Default: <emphasis>0</emphasis></entry>
25392 <indexterm role="concept">
25393 <primary>SMTP</primary>
25394 <secondary>incoming connection count</secondary>
25396 <indexterm role="concept">
25397 <primary>queueing incoming messages</primary>
25399 <indexterm role="concept">
25400 <primary>message</primary>
25401 <secondary>queueing by SMTP connection count</secondary>
25403 If the number of simultaneous incoming SMTP calls handled via the listening
25404 daemon exceeds this value, messages received by SMTP are just placed on the
25405 queue; no delivery processes are started automatically. A value of zero implies
25406 no limit, and clearly any non-zero value is useful only if it is less than the
25407 <option>smtp_accept_max</option> value (unless that is zero). See also <option>queue_only</option>,
25408 <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the various <option>-od</option><emphasis>x</emphasis>
25409 command line options.
25412 <indexterm role="option">
25413 <primary><option>smtp_accept_queue_per_connection</option></primary>
25416 <informaltable frame="all">
25417 <tgroup cols="4" colsep="0" rowsep="0">
25418 <colspec colwidth="8*" align="left"/>
25419 <colspec colwidth="5*" align="center"/>
25420 <colspec colwidth="5*" align="center"/>
25421 <colspec colwidth="6*" align="right"/>
25424 <entry><option>smtp_accept_queue_per_connection</option></entry>
25425 <entry>Use: <emphasis>main</emphasis></entry>
25426 <entry>Type: <emphasis>integer</emphasis></entry>
25427 <entry>Default: <emphasis>10</emphasis></entry>
25433 <indexterm role="concept">
25434 <primary>queueing incoming messages</primary>
25436 <indexterm role="concept">
25437 <primary>message</primary>
25438 <secondary>queueing by message count</secondary>
25440 This option limits the number of delivery processes that Exim starts
25441 automatically when receiving messages via SMTP, whether via the daemon or by
25442 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
25443 and the number of messages received in a single SMTP session exceeds this
25444 number, subsequent messages are placed on the queue, but no delivery processes
25445 are started. This helps to limit the number of Exim processes when a server
25446 restarts after downtime and there is a lot of mail waiting for it on other
25447 systems. On large systems, the default should probably be increased, and on
25448 dial-in client systems it should probably be set to zero (that is, disabled).
25451 <indexterm role="option">
25452 <primary><option>smtp_accept_reserve</option></primary>
25455 <informaltable frame="all">
25456 <tgroup cols="4" colsep="0" rowsep="0">
25457 <colspec colwidth="8*" align="left"/>
25458 <colspec colwidth="5*" align="center"/>
25459 <colspec colwidth="5*" align="center"/>
25460 <colspec colwidth="6*" align="right"/>
25463 <entry><option>smtp_accept_reserve</option></entry>
25464 <entry>Use: <emphasis>main</emphasis></entry>
25465 <entry>Type: <emphasis>integer</emphasis></entry>
25466 <entry>Default: <emphasis>0</emphasis></entry>
25472 <indexterm role="concept">
25473 <primary>SMTP</primary>
25474 <secondary>incoming call count</secondary>
25476 <indexterm role="concept">
25477 <primary>host</primary>
25478 <secondary>reserved</secondary>
25480 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
25481 number of SMTP connections that are reserved for connections from the hosts
25482 that are specified in <option>smtp_reserve_hosts</option>. The value set in
25483 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
25484 restricted to this number of connections; the option specifies a minimum number
25485 of connection slots for them, not a maximum. It is a guarantee that that group
25486 of hosts can always get at least <option>smtp_accept_reserve</option> connections.
25489 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
25490 set to 5, once there are 45 active connections (from any hosts), new
25491 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>.
25492 See also <option>smtp_accept_max_per_host</option>.
25495 <indexterm role="option">
25496 <primary><option>smtp_active_hostname</option></primary>
25499 <informaltable frame="all">
25500 <tgroup cols="4" colsep="0" rowsep="0">
25501 <colspec colwidth="8*" align="left"/>
25502 <colspec colwidth="5*" align="center"/>
25503 <colspec colwidth="5*" align="center"/>
25504 <colspec colwidth="6*" align="right"/>
25507 <entry><option>smtp_active_hostname</option></entry>
25508 <entry>Use: <emphasis>main</emphasis></entry>
25509 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
25510 <entry>Default: <emphasis>unset</emphasis></entry>
25515 <para revisionflag="changed">
25516 <indexterm role="concept">
25517 <primary>host</primary>
25518 <secondary>name in SMTP responses</secondary>
25520 <indexterm role="concept">
25521 <primary>SMTP</primary>
25522 <secondary>host name in responses</secondary>
25524 <indexterm role="concept">
25525 <primary><varname>$primary_hostname</varname></primary>
25527 This option is provided for multi-homed servers that want to masquerade as
25528 several different hosts. At the start of an incoming SMTP connection, its value
25529 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
25530 responses. For example, it is used as domain name in the response to an
25531 incoming HELO or EHLO command.
25533 <para revisionflag="changed">
25534 <indexterm role="concept">
25535 <primary><varname>$smtp_active_hostname</varname></primary>
25537 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
25538 is saved with any messages that are received. It is therefore available for use
25539 in routers and transports when the message is later delivered.
25541 <para revisionflag="changed">
25542 If this option is unset, or if its expansion is forced to fail, or if the
25543 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
25544 used. Other expansion failures cause a message to be written to the main and
25545 panic logs, and the SMTP command receives a temporary error. Typically, the
25546 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
25549 <literallayout class="monospaced" revisionflag="changed">
25550 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
25551 {cox.mydomain}{box.mydomain}}
25553 <para revisionflag="changed">
25554 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
25555 messages, it is also used as the default for HELO commands in callout
25556 verification if there is no remote transport from which to obtain a
25557 <option>helo_data</option> value.
25560 <indexterm role="option">
25561 <primary><option>smtp_banner</option></primary>
25564 <informaltable frame="all">
25565 <tgroup cols="4" colsep="0" rowsep="0">
25566 <colspec colwidth="8*" align="left"/>
25567 <colspec colwidth="5*" align="center"/>
25568 <colspec colwidth="5*" align="center"/>
25569 <colspec colwidth="6*" align="right"/>
25572 <entry><option>smtp_banner</option></entry>
25573 <entry>Use: <emphasis>main</emphasis></entry>
25574 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
25575 <entry>Default: <emphasis>see below</emphasis></entry>
25581 <indexterm role="concept">
25582 <primary>SMTP</primary>
25583 <secondary>welcome banner</secondary>
25585 <indexterm role="concept">
25586 <primary>banner for SMTP</primary>
25588 <indexterm role="concept">
25589 <primary>welcome banner for SMTP</primary>
25591 <indexterm role="concept">
25592 <primary>customizing</primary>
25593 <secondary>SMTP banner</secondary>
25595 This string, which is expanded every time it is used, is output as the initial
25596 positive response to an SMTP connection. The default setting is:
25598 <literallayout class="monospaced">
25599 smtp_banner = $smtp_active_hostname ESMTP Exim \
25600 $version_number $tod_full
25603 Failure to expand the string causes a panic error. If you want to create a
25604 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
25605 appropriate points, but not at the end. Note that the 220 code is not included
25606 in this string. Exim adds it automatically (several times in the case of a
25607 multiline response).
25610 <indexterm role="option">
25611 <primary><option>smtp_check_spool_space</option></primary>
25614 <informaltable frame="all">
25615 <tgroup cols="4" colsep="0" rowsep="0">
25616 <colspec colwidth="8*" align="left"/>
25617 <colspec colwidth="5*" align="center"/>
25618 <colspec colwidth="5*" align="center"/>
25619 <colspec colwidth="6*" align="right"/>
25622 <entry><option>smtp_check_spool_space</option></entry>
25623 <entry>Use: <emphasis>main</emphasis></entry>
25624 <entry>Type: <emphasis>boolean</emphasis></entry>
25625 <entry>Default: <emphasis>true</emphasis></entry>
25631 <indexterm role="concept">
25632 <primary>checking disk space</primary>
25634 <indexterm role="concept">
25635 <primary>disk space</primary>
25636 <secondary>checking</secondary>
25638 <indexterm role="concept">
25639 <primary>spool directory</primary>
25640 <secondary>checking space</secondary>
25642 When this option is set, if an incoming SMTP session encounters the SIZE
25643 option on a MAIL command, it checks that there is enough space in the
25644 spool directory’s partition to accept a message of that size, while still
25645 leaving free the amount specified by <option>check_spool_space</option> (even if that value
25646 is zero). If there isn’t enough space, a temporary error code is returned.
25649 <indexterm role="option">
25650 <primary><option>smtp_connect_backlog</option></primary>
25653 <informaltable frame="all">
25654 <tgroup cols="4" colsep="0" rowsep="0">
25655 <colspec colwidth="8*" align="left"/>
25656 <colspec colwidth="5*" align="center"/>
25657 <colspec colwidth="5*" align="center"/>
25658 <colspec colwidth="6*" align="right"/>
25661 <entry><option>smtp_connect_backlog</option></entry>
25662 <entry>Use: <emphasis>main</emphasis></entry>
25663 <entry>Type: <emphasis>integer</emphasis></entry>
25664 <entry>Default: <emphasis>20</emphasis></entry>
25670 <indexterm role="concept">
25671 <primary>connection backlog</primary>
25673 <indexterm role="concept">
25674 <primary>SMTP</primary>
25675 <secondary>connection backlog</secondary>
25677 <indexterm role="concept">
25678 <primary>backlog of connections</primary>
25680 This option specifies a maximum number of waiting SMTP connections. Exim passes
25681 this value to the TCP/IP system when it sets up its listener. Once this number
25682 of connections are waiting for the daemon’s attention, subsequent connection
25683 attempts are refused at the TCP/IP level. At least, that is what the manuals
25684 say; in some circumstances such connection attempts have been observed to time
25685 out instead. For large systems it is probably a good idea to increase the
25686 value (to 50, say). It also gives some protection against denial-of-service
25687 attacks by SYN flooding.
25690 <indexterm role="option">
25691 <primary><option>smtp_enforce_sync</option></primary>
25694 <informaltable frame="all">
25695 <tgroup cols="4" colsep="0" rowsep="0">
25696 <colspec colwidth="8*" align="left"/>
25697 <colspec colwidth="5*" align="center"/>
25698 <colspec colwidth="5*" align="center"/>
25699 <colspec colwidth="6*" align="right"/>
25702 <entry><option>smtp_enforce_sync</option></entry>
25703 <entry>Use: <emphasis>main</emphasis></entry>
25704 <entry>Type: <emphasis>boolean</emphasis></entry>
25705 <entry>Default: <emphasis>true</emphasis></entry>
25711 <indexterm role="concept">
25712 <primary>SMTP</primary>
25713 <secondary>synchronization checking</secondary>
25715 <indexterm role="concept">
25716 <primary>synchronization checking in SMTP</primary>
25718 The SMTP protocol specification requires the client to wait for a response from
25719 the server at certain points in the dialogue. Without PIPELINING these
25720 synchronization points are after every command; with PIPELINING they are
25721 fewer, but they still exist.
25724 Some spamming sites send out a complete set of SMTP commands without waiting
25725 for any response. Exim protects against this by rejecting a message if the
25726 client has sent further input when it should not have. The error response <quote>554
25727 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
25728 for this error cannot be perfect because of transmission delays (unexpected
25729 input may be on its way but not yet received when Exim checks). However, it
25730 does detect many instances.
25733 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
25734 If you want to disable the check selectively (for example, only for certain
25735 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
25736 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
25739 <indexterm role="option">
25740 <primary><option>smtp_etrn_command</option></primary>
25743 <informaltable frame="all">
25744 <tgroup cols="4" colsep="0" rowsep="0">
25745 <colspec colwidth="8*" align="left"/>
25746 <colspec colwidth="5*" align="center"/>
25747 <colspec colwidth="5*" align="center"/>
25748 <colspec colwidth="6*" align="right"/>
25751 <entry><option>smtp_etrn_command</option></entry>
25752 <entry>Use: <emphasis>main</emphasis></entry>
25753 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
25754 <entry>Default: <emphasis>unset</emphasis></entry>
25760 <indexterm role="concept">
25761 <primary>ETRN</primary>
25762 <secondary>command to be run</secondary>
25764 <indexterm role="concept">
25765 <primary><varname>$domain</varname></primary>
25767 If this option is set, the given command is run whenever an SMTP ETRN
25768 command is received from a host that is permitted to issue such commands (see
25769 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
25770 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
25771 argument of the ETRN command, and no syntax checking is done on it. For
25774 <literallayout class="monospaced">
25775 smtp_etrn_command = /etc/etrn_command $domain \
25776 $sender_host_address
25779 A new process is created to run the command, but Exim does not wait for it to
25780 complete. Consequently, its status cannot be checked. If the command cannot be
25781 run, a line is written to the panic log, but the ETRN caller still receives
25782 a 250 success response. Exim is normally running under its own uid when
25783 receiving SMTP, so it is not possible for it to change the uid before running
25787 <indexterm role="option">
25788 <primary><option>smtp_etrn_serialize</option></primary>
25791 <informaltable frame="all">
25792 <tgroup cols="4" colsep="0" rowsep="0">
25793 <colspec colwidth="8*" align="left"/>
25794 <colspec colwidth="5*" align="center"/>
25795 <colspec colwidth="5*" align="center"/>
25796 <colspec colwidth="6*" align="right"/>
25799 <entry><option>smtp_etrn_serialize</option></entry>
25800 <entry>Use: <emphasis>main</emphasis></entry>
25801 <entry>Type: <emphasis>boolean</emphasis></entry>
25802 <entry>Default: <emphasis>true</emphasis></entry>
25808 <indexterm role="concept">
25809 <primary>ETRN</primary>
25810 <secondary>serializing</secondary>
25812 When this option is set, it prevents the simultaneous execution of more than
25813 one identical command as a result of ETRN in an SMTP connection. See
25814 section <xref linkend="SECTETRN"/> for details.
25817 <indexterm role="option">
25818 <primary><option>smtp_load_reserve</option></primary>
25821 <informaltable frame="all">
25822 <tgroup cols="4" colsep="0" rowsep="0">
25823 <colspec colwidth="8*" align="left"/>
25824 <colspec colwidth="5*" align="center"/>
25825 <colspec colwidth="5*" align="center"/>
25826 <colspec colwidth="6*" align="right"/>
25829 <entry><option>smtp_load_reserve</option></entry>
25830 <entry>Use: <emphasis>main</emphasis></entry>
25831 <entry>Type: <emphasis>fixed-point</emphasis></entry>
25832 <entry>Default: <emphasis>unset</emphasis></entry>
25838 <indexterm role="concept">
25839 <primary>load average</primary>
25841 If the system load average ever gets higher than this, incoming SMTP calls are
25842 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
25843 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
25844 the load is over the limit. The option has no effect on ancient operating
25845 systems on which Exim cannot determine the load average. See also
25846 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
25849 <indexterm role="option">
25850 <primary><option>smtp_max_synprot_errors</option></primary>
25853 <informaltable frame="all">
25854 <tgroup cols="4" colsep="0" rowsep="0">
25855 <colspec colwidth="8*" align="left"/>
25856 <colspec colwidth="5*" align="center"/>
25857 <colspec colwidth="5*" align="center"/>
25858 <colspec colwidth="6*" align="right"/>
25861 <entry><option>smtp_max_synprot_errors</option></entry>
25862 <entry>Use: <emphasis>main</emphasis></entry>
25863 <entry>Type: <emphasis>integer</emphasis></entry>
25864 <entry>Default: <emphasis>3</emphasis></entry>
25870 <indexterm role="concept">
25871 <primary>SMTP</primary>
25872 <secondary>limiting syntax and protocol errors</secondary>
25874 <indexterm role="concept">
25875 <primary>limit</primary>
25876 <secondary>SMTP syntax and protocol errors</secondary>
25878 Exim rejects SMTP commands that contain syntax or protocol errors. In
25879 particular, a syntactically invalid email address, as in this command:
25881 <literallayout class="monospaced">
25882 RCPT TO:<abc xyz@a.b.c>
25885 causes immediate rejection of the command, before any other tests are done.
25886 (The ACL cannot be run if there is no valid address to set up for it.) An
25887 example of a protocol error is receiving RCPT before MAIL. If there are
25888 too many syntax or protocol errors in one SMTP session, the connection is
25889 dropped. The limit is set by this option.
25892 <indexterm role="concept">
25893 <primary>PIPELINING</primary>
25894 <secondary>expected errors</secondary>
25896 When the PIPELINING extension to SMTP is in use, some protocol errors are
25897 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
25898 Exim assumes that PIPELINING will be used if it advertises it (see
25899 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
25900 not count towards the limit.
25903 <indexterm role="option">
25904 <primary><option>smtp_max_unknown_commands</option></primary>
25907 <informaltable frame="all">
25908 <tgroup cols="4" colsep="0" rowsep="0">
25909 <colspec colwidth="8*" align="left"/>
25910 <colspec colwidth="5*" align="center"/>
25911 <colspec colwidth="5*" align="center"/>
25912 <colspec colwidth="6*" align="right"/>
25915 <entry><option>smtp_max_unknown_commands</option></entry>
25916 <entry>Use: <emphasis>main</emphasis></entry>
25917 <entry>Type: <emphasis>integer</emphasis></entry>
25918 <entry>Default: <emphasis>3</emphasis></entry>
25924 <indexterm role="concept">
25925 <primary>SMTP</primary>
25926 <secondary>limiting unknown commands</secondary>
25928 <indexterm role="concept">
25929 <primary>limit</primary>
25930 <secondary>unknown SMTP commands</secondary>
25932 If there are too many unrecognized commands in an incoming SMTP session, an
25933 Exim server drops the connection. This is a defence against some kinds of abuse
25936 into making connections to SMTP ports; in these circumstances, a number of
25937 non-SMTP command lines are sent first.
25940 <indexterm role="option">
25941 <primary><option>smtp_ratelimit_hosts</option></primary>
25944 <informaltable frame="all">
25945 <tgroup cols="4" colsep="0" rowsep="0">
25946 <colspec colwidth="8*" align="left"/>
25947 <colspec colwidth="5*" align="center"/>
25948 <colspec colwidth="5*" align="center"/>
25949 <colspec colwidth="6*" align="right"/>
25952 <entry><option>smtp_ratelimit_hosts</option></entry>
25953 <entry>Use: <emphasis>main</emphasis></entry>
25954 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
25955 <entry>Default: <emphasis>unset</emphasis></entry>
25961 <indexterm role="concept">
25962 <primary>SMTP</primary>
25963 <secondary>rate limiting</secondary>
25965 <indexterm role="concept">
25966 <primary>limit</primary>
25967 <secondary>rate of message arrival</secondary>
25969 <indexterm role="concept">
25970 <primary>RCPT</primary>
25971 <secondary>rate limiting</secondary>
25973 Some sites find it helpful to be able to limit the rate at which certain hosts
25974 can send them messages, and the rate at which an individual message can specify
25978 Exim has two rate-limiting facilities. This section describes the older
25979 facility, which can limit rates within a single connection. The newer
25980 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
25981 <xref linkend="SECTratelimiting"/> for details of the newer facility.
25984 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
25985 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
25986 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
25987 respectively. Each option, if set, must contain a set of four comma-separated
25993 A threshold, before which there is no rate limiting.
25998 An initial time delay. Unlike other times in Exim, numbers with decimal
25999 fractional parts are allowed here.
26004 A factor by which to increase the delay each time.
26009 A maximum value for the delay. This should normally be less than 5 minutes,
26010 because after that time, the client is liable to timeout the SMTP command.
26015 For example, these settings have been used successfully at the site which
26016 first suggested this feature, for controlling mail from their customers:
26018 <literallayout class="monospaced">
26019 smtp_ratelimit_mail = 2,0.5s,1.05,4m
26020 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
26023 The first setting specifies delays that are applied to MAIL commands after
26024 two have been received over a single connection. The initial delay is 0.5
26025 seconds, increasing by a factor of 1.05 each time. The second setting applies
26026 delays to RCPT commands when more than four occur in a single message.
26029 <indexterm role="option">
26030 <primary><option>smtp_ratelimit_mail</option></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>smtp_ratelimit_mail</option></entry>
26042 <entry>Use: <emphasis>main</emphasis></entry>
26043 <entry>Type: <emphasis>string</emphasis></entry>
26044 <entry>Default: <emphasis>unset</emphasis></entry>
26050 See <option>smtp_ratelimit_hosts</option> above.
26053 <indexterm role="option">
26054 <primary><option>smtp_ratelimit_rcpt</option></primary>
26057 <informaltable frame="all">
26058 <tgroup cols="4" colsep="0" rowsep="0">
26059 <colspec colwidth="8*" align="left"/>
26060 <colspec colwidth="5*" align="center"/>
26061 <colspec colwidth="5*" align="center"/>
26062 <colspec colwidth="6*" align="right"/>
26065 <entry><option>smtp_ratelimit_rcpt</option></entry>
26066 <entry>Use: <emphasis>main</emphasis></entry>
26067 <entry>Type: <emphasis>string</emphasis></entry>
26068 <entry>Default: <emphasis>unset</emphasis></entry>
26074 See <option>smtp_ratelimit_hosts</option> above.
26077 <indexterm role="option">
26078 <primary><option>smtp_receive_timeout</option></primary>
26081 <informaltable frame="all">
26082 <tgroup cols="4" colsep="0" rowsep="0">
26083 <colspec colwidth="8*" align="left"/>
26084 <colspec colwidth="5*" align="center"/>
26085 <colspec colwidth="5*" align="center"/>
26086 <colspec colwidth="6*" align="right"/>
26089 <entry><option>smtp_receive_timeout</option></entry>
26090 <entry>Use: <emphasis>main</emphasis></entry>
26091 <entry>Type: <emphasis>time</emphasis></entry>
26092 <entry>Default: <emphasis>5m</emphasis></entry>
26098 <indexterm role="concept">
26099 <primary>timeout</primary>
26100 <secondary>for SMTP input</secondary>
26102 <indexterm role="concept">
26103 <primary>SMTP timeout</primary>
26104 <secondary>input</secondary>
26106 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
26107 input, including batch SMTP. If a line of input (either an SMTP command or a
26108 data line) is not received within this time, the SMTP connection is dropped and
26109 the message is abandoned.
26110 A line is written to the log containing one of the following messages:
26112 <literallayout class="monospaced">
26113 SMTP command timeout on connection from...
26114 SMTP data timeout on connection from...
26117 The former means that Exim was expecting to read an SMTP command; the latter
26118 means that it was in the DATA phase, reading the contents of a message.
26121 <indexterm role="concept">
26122 <primary><option>-os</option> option</primary>
26124 The value set by this option can be overridden by the
26125 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
26126 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
26127 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
26128 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
26131 <indexterm role="option">
26132 <primary><option>smtp_reserve_hosts</option></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>smtp_reserve_hosts</option></entry>
26144 <entry>Use: <emphasis>main</emphasis></entry>
26145 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
26146 <entry>Default: <emphasis>unset</emphasis></entry>
26152 This option defines hosts for which SMTP connections are reserved; see
26153 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
26156 <indexterm role="option">
26157 <primary><option>smtp_return_error_details</option></primary>
26160 <informaltable frame="all">
26161 <tgroup cols="4" colsep="0" rowsep="0">
26162 <colspec colwidth="8*" align="left"/>
26163 <colspec colwidth="5*" align="center"/>
26164 <colspec colwidth="5*" align="center"/>
26165 <colspec colwidth="6*" align="right"/>
26168 <entry><option>smtp_return_error_details</option></entry>
26169 <entry>Use: <emphasis>main</emphasis></entry>
26170 <entry>Type: <emphasis>boolean</emphasis></entry>
26171 <entry>Default: <emphasis>false</emphasis></entry>
26177 <indexterm role="concept">
26178 <primary>SMTP</primary>
26179 <secondary>details policy failures</secondary>
26181 <indexterm role="concept">
26182 <primary>policy control rejection</primary>
26183 <secondary>returning details</secondary>
26185 In the default state, Exim uses bland messages such as
26186 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
26187 reasons. Many sysadmins like this because it gives away little information
26188 to spammers. However, some other syadmins who are applying strict checking
26189 policies want to give out much fuller information about failures. Setting
26190 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
26191 example, instead of <quote>Administrative prohibition</quote>, it might give:
26193 <literallayout class="monospaced">
26194 550-Rejected after DATA: '>' missing at end of address:
26195 550 failing address in "From" header is: <user@dom.ain
26198 <indexterm role="option">
26199 <primary><option>spamd_address</option></primary>
26202 <informaltable frame="all">
26203 <tgroup cols="4" colsep="0" rowsep="0">
26204 <colspec colwidth="8*" align="left"/>
26205 <colspec colwidth="5*" align="center"/>
26206 <colspec colwidth="5*" align="center"/>
26207 <colspec colwidth="6*" align="right"/>
26210 <entry><option>spamd_address</option></entry>
26211 <entry>Use: <emphasis>main</emphasis></entry>
26212 <entry>Type: <emphasis>string</emphasis></entry>
26213 <entry>Default: <emphasis>see below</emphasis></entry>
26219 This option is available when Exim is compiled with the content-scanning
26220 extension. It specifies how Exim connects to SpamAssassin’s <option>spamd</option> daemon.
26221 The default value is
26223 <literallayout class="monospaced">
26227 See section <xref linkend="SECTscanspamass"/> for more details.
26230 <indexterm role="option">
26231 <primary><option>split_spool_directory</option></primary>
26234 <informaltable frame="all">
26235 <tgroup cols="4" colsep="0" rowsep="0">
26236 <colspec colwidth="8*" align="left"/>
26237 <colspec colwidth="5*" align="center"/>
26238 <colspec colwidth="5*" align="center"/>
26239 <colspec colwidth="6*" align="right"/>
26242 <entry><option>split_spool_directory</option></entry>
26243 <entry>Use: <emphasis>main</emphasis></entry>
26244 <entry>Type: <emphasis>boolean</emphasis></entry>
26245 <entry>Default: <emphasis>false</emphasis></entry>
26251 <indexterm role="concept">
26252 <primary>multiple spool directories</primary>
26254 <indexterm role="concept">
26255 <primary>spool directory</primary>
26256 <secondary>split</secondary>
26258 <indexterm role="concept">
26259 <primary>directories</primary>
26260 <secondary>multiple</secondary>
26262 If this option is set, it causes Exim to split its input directory into 62
26263 subdirectories, each with a single alphanumeric character as its name. The
26264 sixth character of the message id is used to allocate messages to
26265 subdirectories; this is the least significant base-62 digit of the time of
26266 arrival of the message.
26269 Splitting up the spool in this way may provide better performance on systems
26270 where there are long mail queues, by reducing the number of files in any one
26271 directory. The msglog directory is also split up in a similar way to the input
26272 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
26273 are still placed in the single directory <filename>msglog.OLD</filename>.
26276 It is not necessary to take any special action for existing messages when
26277 changing <option>split_spool_directory</option>. Exim notices messages that are in the
26278 <quote>wrong</quote> place, and continues to process them. If the option is turned off
26279 after a period of being on, the subdirectories will eventually empty and be
26280 automatically deleted.
26283 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
26284 changes. Instead of creating a list of all messages in the queue, and then
26285 trying to deliver each one in turn, it constructs a list of those in one
26286 sub-directory and tries to deliver them, before moving on to the next
26287 sub-directory. The sub-directories are processed in a random order. This
26288 spreads out the scanning of the input directories, and uses less memory. It is
26289 particularly beneficial when there are lots of messages on the queue. However,
26290 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
26291 entire queue has to be scanned and sorted before any deliveries can start.
26294 <indexterm role="option">
26295 <primary><option>spool_directory</option></primary>
26298 <informaltable frame="all">
26299 <tgroup cols="4" colsep="0" rowsep="0">
26300 <colspec colwidth="8*" align="left"/>
26301 <colspec colwidth="5*" align="center"/>
26302 <colspec colwidth="5*" align="center"/>
26303 <colspec colwidth="6*" align="right"/>
26306 <entry><option>spool_directory</option></entry>
26307 <entry>Use: <emphasis>main</emphasis></entry>
26308 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26309 <entry>Default: <emphasis>set at compile time</emphasis></entry>
26315 <indexterm role="concept">
26316 <primary>spool directory</primary>
26317 <secondary>path to</secondary>
26319 This defines the directory in which Exim keeps its spool, that is, the messages
26320 it is waiting to deliver. The default value is taken from the compile-time
26321 configuration setting, if there is one. If not, this option must be set. The
26322 string is expanded, so it can contain, for example, a reference to
26323 <varname>$primary_hostname</varname>.
26326 If the spool directory name is fixed on your installation, it is recommended
26327 that you set it at build time rather than from this option, particularly if the
26328 log files are being written to the spool directory (see <option>log_file_path</option>).
26329 Otherwise log files cannot be used for errors that are detected early on, such
26330 as failures in the configuration file.
26333 By using this option to override the compiled-in path, it is possible to run
26334 tests of Exim without using the standard spool.
26337 <indexterm role="option">
26338 <primary><option>sqlite_lock_timeout</option></primary>
26341 <informaltable frame="all">
26342 <tgroup cols="4" colsep="0" rowsep="0">
26343 <colspec colwidth="8*" align="left"/>
26344 <colspec colwidth="5*" align="center"/>
26345 <colspec colwidth="5*" align="center"/>
26346 <colspec colwidth="6*" align="right"/>
26349 <entry><option>sqlite_lock_timeout</option></entry>
26350 <entry>Use: <emphasis>main</emphasis></entry>
26351 <entry>Type: <emphasis>time</emphasis></entry>
26352 <entry>Default: <emphasis>5s</emphasis></entry>
26358 <indexterm role="concept">
26359 <primary>sqlite</primary>
26360 <secondary>lock timeout</secondary>
26362 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
26363 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
26365 <para revisionflag="changed">
26366 <indexterm role="option">
26367 <primary><option>strict_acl_vars</option></primary>
26370 <informaltable frame="all" revisionflag="changed">
26371 <tgroup cols="4" colsep="0" rowsep="0">
26372 <colspec colwidth="8*" align="left"/>
26373 <colspec colwidth="5*" align="center"/>
26374 <colspec colwidth="5*" align="center"/>
26375 <colspec colwidth="6*" align="right"/>
26378 <entry><option>strict_acl_vars</option></entry>
26379 <entry>Use: <emphasis>main</emphasis></entry>
26380 <entry>Type: <emphasis>boolean</emphasis></entry>
26381 <entry>Default: <emphasis>false</emphasis></entry>
26386 <para revisionflag="changed">
26387 <indexterm role="concept">
26388 <primary>ACL variables</primary>
26389 <secondary>handling unset</secondary>
26391 This option controls what happens if a syntactically valid but undefined ACL
26392 variable is referenced. If it is false (the default), an empty string
26393 is substituted; if it is true, an error is generated. See section
26394 <xref linkend="SECTaclvariables"/> for details of ACL variables.
26397 <indexterm role="option">
26398 <primary><option>strip_excess_angle_brackets</option></primary>
26401 <informaltable frame="all">
26402 <tgroup cols="4" colsep="0" rowsep="0">
26403 <colspec colwidth="8*" align="left"/>
26404 <colspec colwidth="5*" align="center"/>
26405 <colspec colwidth="5*" align="center"/>
26406 <colspec colwidth="6*" align="right"/>
26409 <entry><option>strip_excess_angle_brackets</option></entry>
26410 <entry>Use: <emphasis>main</emphasis></entry>
26411 <entry>Type: <emphasis>boolean</emphasis></entry>
26412 <entry>Default: <emphasis>false</emphasis></entry>
26418 <indexterm role="concept">
26419 <primary>angle brackets</primary>
26420 <secondary>excess</secondary>
26422 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
26423 items in addresses are stripped. For example, <emphasis><<xxx@a.b.c.d>></emphasis> is
26424 treated as <emphasis><xxx@a.b.c.d></emphasis>. If this is in the envelope and the message is
26425 passed on to another MTA, the excess angle brackets are not passed on. If this
26426 option is not set, multiple pairs of angle brackets cause a syntax error.
26429 <indexterm role="option">
26430 <primary><option>strip_trailing_dot</option></primary>
26433 <informaltable frame="all">
26434 <tgroup cols="4" colsep="0" rowsep="0">
26435 <colspec colwidth="8*" align="left"/>
26436 <colspec colwidth="5*" align="center"/>
26437 <colspec colwidth="5*" align="center"/>
26438 <colspec colwidth="6*" align="right"/>
26441 <entry><option>strip_trailing_dot</option></entry>
26442 <entry>Use: <emphasis>main</emphasis></entry>
26443 <entry>Type: <emphasis>boolean</emphasis></entry>
26444 <entry>Default: <emphasis>false</emphasis></entry>
26450 <indexterm role="concept">
26451 <primary>trailing dot on domain</primary>
26453 <indexterm role="concept">
26454 <primary>dot</primary>
26455 <secondary>trailing on domain</secondary>
26457 If this option is set, a trailing dot at the end of a domain in an address is
26458 ignored. If this is in the envelope and the message is passed on to another
26459 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
26460 domain causes a syntax error.
26461 However, addresses in header lines are checked only when an ACL requests header
26465 <indexterm role="option">
26466 <primary><option>syslog_duplication</option></primary>
26469 <informaltable frame="all">
26470 <tgroup cols="4" colsep="0" rowsep="0">
26471 <colspec colwidth="8*" align="left"/>
26472 <colspec colwidth="5*" align="center"/>
26473 <colspec colwidth="5*" align="center"/>
26474 <colspec colwidth="6*" align="right"/>
26477 <entry><option>syslog_duplication</option></entry>
26478 <entry>Use: <emphasis>main</emphasis></entry>
26479 <entry>Type: <emphasis>boolean</emphasis></entry>
26480 <entry>Default: <emphasis>true</emphasis></entry>
26486 <indexterm role="concept">
26487 <primary>syslog</primary>
26488 <secondary>duplicate log lines; suppressing</secondary>
26490 When Exim is logging to syslog, it writes the log lines for its three
26491 separate logs at different syslog priorities so that they can in principle
26492 be separated on the logging hosts. Some installations do not require this
26493 separation, and in those cases, the duplication of certain log lines is a
26494 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
26495 particular log line is written to syslog. For lines that normally go to
26496 both the main log and the reject log, the reject log version (possibly
26497 containing message header lines) is written, at LOG_NOTICE priority.
26498 Lines that normally go to both the main and the panic log are written at
26499 the LOG_ALERT priority.
26502 <indexterm role="option">
26503 <primary><option>syslog_facility</option></primary>
26506 <informaltable frame="all">
26507 <tgroup cols="4" colsep="0" rowsep="0">
26508 <colspec colwidth="8*" align="left"/>
26509 <colspec colwidth="5*" align="center"/>
26510 <colspec colwidth="5*" align="center"/>
26511 <colspec colwidth="6*" align="right"/>
26514 <entry><option>syslog_facility</option></entry>
26515 <entry>Use: <emphasis>main</emphasis></entry>
26516 <entry>Type: <emphasis>string</emphasis></entry>
26517 <entry>Default: <emphasis>unset</emphasis></entry>
26523 <indexterm role="concept">
26524 <primary>syslog</primary>
26525 <secondary>facility; setting</secondary>
26527 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
26528 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
26529 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
26530 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
26531 details of Exim’s logging.
26534 <indexterm role="option">
26535 <primary><option>syslog_processname</option></primary>
26538 <informaltable frame="all">
26539 <tgroup cols="4" colsep="0" rowsep="0">
26540 <colspec colwidth="8*" align="left"/>
26541 <colspec colwidth="5*" align="center"/>
26542 <colspec colwidth="5*" align="center"/>
26543 <colspec colwidth="6*" align="right"/>
26546 <entry><option>syslog_processname</option></entry>
26547 <entry>Use: <emphasis>main</emphasis></entry>
26548 <entry>Type: <emphasis>string</emphasis></entry>
26549 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
26555 <indexterm role="concept">
26556 <primary>syslog</primary>
26557 <secondary>process name; setting</secondary>
26559 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
26560 syslog. The value must be no longer than 32 characters. See chapter
26561 <xref linkend="CHAPlog"/> for details of Exim’s logging.
26564 <indexterm role="option">
26565 <primary><option>syslog_timestamp</option></primary>
26568 <informaltable frame="all">
26569 <tgroup cols="4" colsep="0" rowsep="0">
26570 <colspec colwidth="8*" align="left"/>
26571 <colspec colwidth="5*" align="center"/>
26572 <colspec colwidth="5*" align="center"/>
26573 <colspec colwidth="6*" align="right"/>
26576 <entry><option>syslog_timestamp</option></entry>
26577 <entry>Use: <emphasis>main</emphasis></entry>
26578 <entry>Type: <emphasis>boolean</emphasis></entry>
26579 <entry>Default: <emphasis>true</emphasis></entry>
26585 <indexterm role="concept">
26586 <primary>syslog</primary>
26587 <secondary>timestamps</secondary>
26589 If <option>syslog_timestamp</option> is set false, the timestamps on Exim’s log lines are
26590 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
26591 details of Exim’s logging.
26594 <indexterm role="option">
26595 <primary><option>system_filter</option></primary>
26598 <informaltable frame="all">
26599 <tgroup cols="4" colsep="0" rowsep="0">
26600 <colspec colwidth="8*" align="left"/>
26601 <colspec colwidth="5*" align="center"/>
26602 <colspec colwidth="5*" align="center"/>
26603 <colspec colwidth="6*" align="right"/>
26606 <entry><option>system_filter</option></entry>
26607 <entry>Use: <emphasis>main</emphasis></entry>
26608 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26609 <entry>Default: <emphasis>unset</emphasis></entry>
26615 <indexterm role="concept">
26616 <primary>filter</primary>
26617 <secondary>system filter</secondary>
26619 <indexterm role="concept">
26620 <primary>system filter</primary>
26621 <secondary>specifying</secondary>
26623 <indexterm role="concept">
26624 <primary>Sieve filter</primary>
26625 <secondary>not available for system filter</secondary>
26627 This option specifies an Exim filter file that is applied to all messages at
26628 the start of each delivery attempt, before any routing is done. System filters
26629 must be Exim filters; they cannot be Sieve filters. If the system filter
26630 generates any deliveries to files or pipes, or any new mail messages, the
26631 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
26632 which transports are to be used. Details of this facility are given in chapter
26633 <xref linkend="CHAPsystemfilter"/>.
26636 <indexterm role="option">
26637 <primary><option>system_filter_directory_transport</option></primary>
26640 <informaltable frame="all">
26641 <tgroup cols="4" colsep="0" rowsep="0">
26642 <colspec colwidth="8*" align="left"/>
26643 <colspec colwidth="5*" align="center"/>
26644 <colspec colwidth="5*" align="center"/>
26645 <colspec colwidth="6*" align="right"/>
26648 <entry><option>system_filter_directory_transport</option></entry>
26649 <entry>Use: <emphasis>main</emphasis></entry>
26650 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26651 <entry>Default: <emphasis>unset</emphasis></entry>
26657 <indexterm role="concept">
26658 <primary><varname>$address_file</varname></primary>
26660 This sets the name of the transport driver that is to be used when the
26661 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
26662 implying delivery of each message into a separate file in some directory.
26663 During the delivery, the variable <varname>$address_file</varname> contains the path name.
26666 <indexterm role="option">
26667 <primary><option>system_filter_file_transport</option></primary>
26670 <informaltable frame="all">
26671 <tgroup cols="4" colsep="0" rowsep="0">
26672 <colspec colwidth="8*" align="left"/>
26673 <colspec colwidth="5*" align="center"/>
26674 <colspec colwidth="5*" align="center"/>
26675 <colspec colwidth="6*" align="right"/>
26678 <entry><option>system_filter_file_transport</option></entry>
26679 <entry>Use: <emphasis>main</emphasis></entry>
26680 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26681 <entry>Default: <emphasis>unset</emphasis></entry>
26687 <indexterm role="concept">
26688 <primary>file</primary>
26689 <secondary>transport for system filter</secondary>
26691 This sets the name of the transport driver that is to be used when the <option>save</option>
26692 command in a system message filter specifies a path not ending in <quote>/</quote>. During
26693 the delivery, the variable <varname>$address_file</varname> contains the path name.
26696 <indexterm role="option">
26697 <primary><option>system_filter_group</option></primary>
26700 <informaltable frame="all">
26701 <tgroup cols="4" colsep="0" rowsep="0">
26702 <colspec colwidth="8*" align="left"/>
26703 <colspec colwidth="5*" align="center"/>
26704 <colspec colwidth="5*" align="center"/>
26705 <colspec colwidth="6*" align="right"/>
26708 <entry><option>system_filter_group</option></entry>
26709 <entry>Use: <emphasis>main</emphasis></entry>
26710 <entry>Type: <emphasis>string</emphasis></entry>
26711 <entry>Default: <emphasis>unset</emphasis></entry>
26717 <indexterm role="concept">
26718 <primary>gid (group id)</primary>
26719 <secondary>system filter</secondary>
26721 This option is used only when <option>system_filter_user</option> is also set. It sets the
26722 gid under which the system filter is run, overriding any gid that is associated
26723 with the user. The value may be numerical or symbolic.
26726 <indexterm role="option">
26727 <primary><option>system_filter_pipe_transport</option></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>system_filter_pipe_transport</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><command>pipe</command> transport</primary>
26749 <secondary>for system filter</secondary>
26751 <indexterm role="concept">
26752 <primary><varname>$address_pipe</varname></primary>
26754 This specifies the transport driver that is to be used when a <option>pipe</option> command
26755 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
26756 contains the pipe command.
26759 <indexterm role="option">
26760 <primary><option>system_filter_reply_transport</option></primary>
26763 <informaltable frame="all">
26764 <tgroup cols="4" colsep="0" rowsep="0">
26765 <colspec colwidth="8*" align="left"/>
26766 <colspec colwidth="5*" align="center"/>
26767 <colspec colwidth="5*" align="center"/>
26768 <colspec colwidth="6*" align="right"/>
26771 <entry><option>system_filter_reply_transport</option></entry>
26772 <entry>Use: <emphasis>main</emphasis></entry>
26773 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26774 <entry>Default: <emphasis>unset</emphasis></entry>
26780 <indexterm role="concept">
26781 <primary><command>autoreply</command> transport</primary>
26782 <secondary>for system filter</secondary>
26784 This specifies the transport driver that is to be used when a <option>mail</option> command
26785 is used in a system filter.
26788 <indexterm role="option">
26789 <primary><option>system_filter_user</option></primary>
26792 <informaltable frame="all">
26793 <tgroup cols="4" colsep="0" rowsep="0">
26794 <colspec colwidth="8*" align="left"/>
26795 <colspec colwidth="5*" align="center"/>
26796 <colspec colwidth="5*" align="center"/>
26797 <colspec colwidth="6*" align="right"/>
26800 <entry><option>system_filter_user</option></entry>
26801 <entry>Use: <emphasis>main</emphasis></entry>
26802 <entry>Type: <emphasis>string</emphasis></entry>
26803 <entry>Default: <emphasis>unset</emphasis></entry>
26809 <indexterm role="concept">
26810 <primary>uid (user id)</primary>
26811 <secondary>system filter</secondary>
26813 If this option is not set, the system filter is run in the main Exim delivery
26814 process, as root. When the option is set, the system filter runs in a separate
26815 process, as the given user. Unless the string consists entirely of digits, it
26816 is looked up in the password data. Failure to find the named user causes a
26817 configuration error. The gid is either taken from the password data, or
26818 specified by <option>system_filter_group</option>. When the uid is specified numerically,
26819 <option>system_filter_group</option> is required to be set.
26822 If the system filter generates any pipe, file, or reply deliveries, the uid
26823 under which the filter is run is used when transporting them, unless a
26824 transport option overrides. Normally you should set <option>system_filter_user</option> if
26825 your system filter generates these kinds of delivery.
26828 <indexterm role="option">
26829 <primary><option>tcp_nodelay</option></primary>
26832 <informaltable frame="all">
26833 <tgroup cols="4" colsep="0" rowsep="0">
26834 <colspec colwidth="8*" align="left"/>
26835 <colspec colwidth="5*" align="center"/>
26836 <colspec colwidth="5*" align="center"/>
26837 <colspec colwidth="6*" align="right"/>
26840 <entry><option>tcp_nodelay</option></entry>
26841 <entry>Use: <emphasis>main</emphasis></entry>
26842 <entry>Type: <emphasis>boolean</emphasis></entry>
26843 <entry>Default: <emphasis>true</emphasis></entry>
26849 <indexterm role="concept">
26850 <primary>daemon</primary>
26851 <secondary>TCP_NODELAY on sockets</secondary>
26853 <indexterm role="concept">
26854 <primary>Nagle algorithm</primary>
26856 <indexterm role="concept">
26857 <primary>TCP_NODELAY on listening sockets</primary>
26859 If this option is set false, it stops the Exim daemon setting the
26860 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
26861 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
26862 performance in interactive (character-by-character) situations. Turning it off
26863 should improve Exim’s performance a bit, so that is what happens by default.
26864 However, it appears that some broken clients cannot cope, and time out. Hence
26865 this option. It affects only those sockets that are set up for listening by the
26866 daemon. Sockets created by the smtp transport for delivering mail always set
26870 <indexterm role="option">
26871 <primary><option>timeout_frozen_after</option></primary>
26874 <informaltable frame="all">
26875 <tgroup cols="4" colsep="0" rowsep="0">
26876 <colspec colwidth="8*" align="left"/>
26877 <colspec colwidth="5*" align="center"/>
26878 <colspec colwidth="5*" align="center"/>
26879 <colspec colwidth="6*" align="right"/>
26882 <entry><option>timeout_frozen_after</option></entry>
26883 <entry>Use: <emphasis>main</emphasis></entry>
26884 <entry>Type: <emphasis>time</emphasis></entry>
26885 <entry>Default: <emphasis>0s</emphasis></entry>
26891 <indexterm role="concept">
26892 <primary>frozen messages</primary>
26893 <secondary>timing out</secondary>
26895 <indexterm role="concept">
26896 <primary>timeout</primary>
26897 <secondary>frozen messages</secondary>
26899 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
26900 message of any kind that has been on the queue for longer than the given time
26901 is automatically cancelled at the next queue run. If the frozen message is a
26902 bounce message, it is just discarded; otherwise, a bounce is sent to the
26903 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
26904 If you want to timeout frozen bounce messages earlier than other kinds of
26905 frozen message, see <option>ignore_bounce_errors_after</option>.
26907 <para revisionflag="changed">
26908 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
26909 frozen messages remain on the queue forever (except for any frozen bounce
26910 messages that are released by <option>ignore_bounce_errors_after</option>).
26913 <indexterm role="option">
26914 <primary><option>timezone</option></primary>
26917 <informaltable frame="all">
26918 <tgroup cols="4" colsep="0" rowsep="0">
26919 <colspec colwidth="8*" align="left"/>
26920 <colspec colwidth="5*" align="center"/>
26921 <colspec colwidth="5*" align="center"/>
26922 <colspec colwidth="6*" align="right"/>
26925 <entry><option>timezone</option></entry>
26926 <entry>Use: <emphasis>main</emphasis></entry>
26927 <entry>Type: <emphasis>string</emphasis></entry>
26928 <entry>Default: <emphasis>unset</emphasis></entry>
26934 <indexterm role="concept">
26935 <primary>timezone</primary>
26936 <secondary>setting</secondary>
26938 The value of <option>timezone</option> is used to set the environment variable TZ while
26939 running Exim (if it is different on entry). This ensures that all timestamps
26940 created by Exim are in the required timezone. If you want all your timestamps
26941 to be in UTC (aka GMT) you should set
26943 <literallayout class="monospaced">
26947 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
26948 or, if that is not set, from the value of the TZ environment variable when Exim
26949 is built. If <option>timezone</option> is set to the empty string, either at build or run
26950 time, any existing TZ variable is removed from the environment when Exim
26951 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
26952 unfortunately not all, operating systems.
26955 <indexterm role="option">
26956 <primary><option>tls_advertise_hosts</option></primary>
26959 <informaltable frame="all">
26960 <tgroup cols="4" colsep="0" rowsep="0">
26961 <colspec colwidth="8*" align="left"/>
26962 <colspec colwidth="5*" align="center"/>
26963 <colspec colwidth="5*" align="center"/>
26964 <colspec colwidth="6*" align="right"/>
26967 <entry><option>tls_advertise_hosts</option></entry>
26968 <entry>Use: <emphasis>main</emphasis></entry>
26969 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
26970 <entry>Default: <emphasis>unset</emphasis></entry>
26976 <indexterm role="concept">
26977 <primary>TLS</primary>
26978 <secondary>advertising</secondary>
26980 <indexterm role="concept">
26981 <primary>encryption</primary>
26982 <secondary>on SMTP connection</secondary>
26984 <indexterm role="concept">
26985 <primary>SMTP</primary>
26986 <secondary>encrypted connection</secondary>
26988 When Exim is built with support for TLS encrypted connections, the availability
26989 of the STARTTLS command to set up an encrypted session is advertised in
26990 response to EHLO only to those client hosts that match this option. See
26991 chapter <xref linkend="CHAPTLS"/> for details of Exim’s support for TLS.
26994 <indexterm role="option">
26995 <primary><option>tls_certificate</option></primary>
26998 <informaltable frame="all">
26999 <tgroup cols="4" colsep="0" rowsep="0">
27000 <colspec colwidth="8*" align="left"/>
27001 <colspec colwidth="5*" align="center"/>
27002 <colspec colwidth="5*" align="center"/>
27003 <colspec colwidth="6*" align="right"/>
27006 <entry><option>tls_certificate</option></entry>
27007 <entry>Use: <emphasis>main</emphasis></entry>
27008 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27009 <entry>Default: <emphasis>unset</emphasis></entry>
27015 <indexterm role="concept">
27016 <primary>TLS</primary>
27017 <secondary>server certificate; location of</secondary>
27019 <indexterm role="concept">
27020 <primary>certificate for server</primary>
27021 <secondary>location of</secondary>
27023 The value of this option is expanded, and must then be the absolute path to a
27024 file which contains the server’s certificates. The server’s private key is also
27025 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
27026 <xref linkend="CHAPTLS"/> for further details.
27029 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
27030 receiving incoming messages as a server. If you want to supply certificates for
27031 use when sending messages as a client, you must set the <option>tls_certificate</option>
27032 option in the relevant <command>smtp</command> transport.
27035 <indexterm role="option">
27036 <primary><option>tls_crl</option></primary>
27039 <informaltable frame="all">
27040 <tgroup cols="4" colsep="0" rowsep="0">
27041 <colspec colwidth="8*" align="left"/>
27042 <colspec colwidth="5*" align="center"/>
27043 <colspec colwidth="5*" align="center"/>
27044 <colspec colwidth="6*" align="right"/>
27047 <entry><option>tls_crl</option></entry>
27048 <entry>Use: <emphasis>main</emphasis></entry>
27049 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27050 <entry>Default: <emphasis>unset</emphasis></entry>
27056 <indexterm role="concept">
27057 <primary>TLS</primary>
27058 <secondary>server certificate revocation list</secondary>
27060 <indexterm role="concept">
27061 <primary>certificate</primary>
27062 <secondary>revocation list for server</secondary>
27064 This option specifies a certificate revocation list. The expanded value must
27065 be the name of a file that contains a CRL in PEM format.
27068 <indexterm role="option">
27069 <primary><option>tls_dhparam</option></primary>
27072 <informaltable frame="all">
27073 <tgroup cols="4" colsep="0" rowsep="0">
27074 <colspec colwidth="8*" align="left"/>
27075 <colspec colwidth="5*" align="center"/>
27076 <colspec colwidth="5*" align="center"/>
27077 <colspec colwidth="6*" align="right"/>
27080 <entry><option>tls_dhparam</option></entry>
27081 <entry>Use: <emphasis>main</emphasis></entry>
27082 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27083 <entry>Default: <emphasis>unset</emphasis></entry>
27089 <indexterm role="concept">
27090 <primary>TLS</primary>
27091 <secondary>D-H parameters for server</secondary>
27093 The value of this option is expanded, and must then be the absolute path to
27094 a file which contains the server’s DH parameter values.
27095 This is used only for OpenSSL. When Exim is linked with GnuTLS, this option is
27096 ignored. See section <xref linkend="SECTopenvsgnu"/> for further details.
27099 <indexterm role="option">
27100 <primary><option>tls_on_connect_ports</option></primary>
27103 <informaltable frame="all">
27104 <tgroup cols="4" colsep="0" rowsep="0">
27105 <colspec colwidth="8*" align="left"/>
27106 <colspec colwidth="5*" align="center"/>
27107 <colspec colwidth="5*" align="center"/>
27108 <colspec colwidth="6*" align="right"/>
27111 <entry><option>tls_on_connect_ports</option></entry>
27112 <entry>Use: <emphasis>main</emphasis></entry>
27113 <entry>Type: <emphasis>string list</emphasis></entry>
27114 <entry>Default: <emphasis>unset</emphasis></entry>
27120 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
27121 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
27122 set up without waiting for the client to issue a STARTTLS command. For
27123 further details, see section <xref linkend="SECTsupobssmt"/>.
27126 <indexterm role="option">
27127 <primary><option>tls_privatekey</option></primary>
27130 <informaltable frame="all">
27131 <tgroup cols="4" colsep="0" rowsep="0">
27132 <colspec colwidth="8*" align="left"/>
27133 <colspec colwidth="5*" align="center"/>
27134 <colspec colwidth="5*" align="center"/>
27135 <colspec colwidth="6*" align="right"/>
27138 <entry><option>tls_privatekey</option></entry>
27139 <entry>Use: <emphasis>main</emphasis></entry>
27140 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27141 <entry>Default: <emphasis>unset</emphasis></entry>
27147 <indexterm role="concept">
27148 <primary>TLS</primary>
27149 <secondary>server private key; location of</secondary>
27151 The value of this option is expanded, and must then be the absolute path to a
27152 file which contains the server’s private key. If this option is unset, or if
27153 the expansion is forced to fail, or the result is an empty string, the private
27154 key is assumed to be in the same file as the server’s certificates. See chapter
27155 <xref linkend="CHAPTLS"/> for further details.
27158 <indexterm role="option">
27159 <primary><option>tls_remember_esmtp</option></primary>
27162 <informaltable frame="all">
27163 <tgroup cols="4" colsep="0" rowsep="0">
27164 <colspec colwidth="8*" align="left"/>
27165 <colspec colwidth="5*" align="center"/>
27166 <colspec colwidth="5*" align="center"/>
27167 <colspec colwidth="6*" align="right"/>
27170 <entry><option>tls_remember_esmtp</option></entry>
27171 <entry>Use: <emphasis>main</emphasis></entry>
27172 <entry>Type: <emphasis>boolean</emphasis></entry>
27173 <entry>Default: <emphasis>false</emphasis></entry>
27179 <indexterm role="concept">
27180 <primary>TLS</primary>
27181 <secondary>esmtp state; remembering</secondary>
27183 <indexterm role="concept">
27184 <primary>TLS</primary>
27185 <secondary>broken clients</secondary>
27187 If this option is set true, Exim violates the RFCs by remembering that it is in
27188 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
27189 support for broken clients that fail to send a new EHLO after starting a
27193 <indexterm role="option">
27194 <primary><option>tls_require_ciphers</option></primary>
27197 <informaltable frame="all">
27198 <tgroup cols="4" colsep="0" rowsep="0">
27199 <colspec colwidth="8*" align="left"/>
27200 <colspec colwidth="5*" align="center"/>
27201 <colspec colwidth="5*" align="center"/>
27202 <colspec colwidth="6*" align="right"/>
27205 <entry><option>tls_require_ciphers</option></entry>
27206 <entry>Use: <emphasis>main</emphasis></entry>
27207 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27208 <entry>Default: <emphasis>unset</emphasis></entry>
27214 <indexterm role="concept">
27215 <primary>TLS</primary>
27216 <secondary>requiring specific ciphers</secondary>
27218 <indexterm role="concept">
27219 <primary>cipher</primary>
27220 <secondary>requiring specific</secondary>
27222 This option controls which ciphers can be used for incoming TLS connections.
27223 The <command>smtp</command> transport has an option of the same name for controlling outgoing
27224 connections. This option is expanded for each connection, so can be varied for
27225 different clients if required. The value of this option must be a list of
27226 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
27227 in somewhat different ways. If GnuTLS is being used, the client controls the
27228 preference order of the available ciphers. Details are given in sections
27229 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
27232 <indexterm role="option">
27233 <primary><option>tls_try_verify_hosts</option></primary>
27236 <informaltable frame="all">
27237 <tgroup cols="4" colsep="0" rowsep="0">
27238 <colspec colwidth="8*" align="left"/>
27239 <colspec colwidth="5*" align="center"/>
27240 <colspec colwidth="5*" align="center"/>
27241 <colspec colwidth="6*" align="right"/>
27244 <entry><option>tls_try_verify_hosts</option></entry>
27245 <entry>Use: <emphasis>main</emphasis></entry>
27246 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
27247 <entry>Default: <emphasis>unset</emphasis></entry>
27253 <indexterm role="concept">
27254 <primary>TLS</primary>
27255 <secondary>client certificate verification</secondary>
27257 <indexterm role="concept">
27258 <primary>certificate</primary>
27259 <secondary>verification of client</secondary>
27261 See <option>tls_verify_hosts</option> below.
27264 <indexterm role="option">
27265 <primary><option>tls_verify_certificates</option></primary>
27268 <informaltable frame="all">
27269 <tgroup cols="4" colsep="0" rowsep="0">
27270 <colspec colwidth="8*" align="left"/>
27271 <colspec colwidth="5*" align="center"/>
27272 <colspec colwidth="5*" align="center"/>
27273 <colspec colwidth="6*" align="right"/>
27276 <entry><option>tls_verify_certificates</option></entry>
27277 <entry>Use: <emphasis>main</emphasis></entry>
27278 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27279 <entry>Default: <emphasis>unset</emphasis></entry>
27285 <indexterm role="concept">
27286 <primary>TLS</primary>
27287 <secondary>client certificate verification</secondary>
27289 <indexterm role="concept">
27290 <primary>certificate</primary>
27291 <secondary>verification of client</secondary>
27293 The value of this option is expanded, and must then be the absolute path to
27294 a file containing permitted certificates for clients that
27295 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>. Alternatively, if you
27296 are using OpenSSL, you can set <option>tls_verify_certificates</option> to the name of a
27297 directory containing certificate files. This does not work with GnuTLS; the
27298 option must be set to the name of a single file if you are using GnuTLS.
27301 <indexterm role="option">
27302 <primary><option>tls_verify_hosts</option></primary>
27305 <informaltable frame="all">
27306 <tgroup cols="4" colsep="0" rowsep="0">
27307 <colspec colwidth="8*" align="left"/>
27308 <colspec colwidth="5*" align="center"/>
27309 <colspec colwidth="5*" align="center"/>
27310 <colspec colwidth="6*" align="right"/>
27313 <entry><option>tls_verify_hosts</option></entry>
27314 <entry>Use: <emphasis>main</emphasis></entry>
27315 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
27316 <entry>Default: <emphasis>unset</emphasis></entry>
27322 <indexterm role="concept">
27323 <primary>TLS</primary>
27324 <secondary>client certificate verification</secondary>
27326 <indexterm role="concept">
27327 <primary>certificate</primary>
27328 <secondary>verification of client</secondary>
27330 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
27331 certificates from clients.
27332 The expected certificates are defined by <option>tls_verify_certificates</option>, which
27333 must be set. A configuration error occurs if either <option>tls_verify_hosts</option> or
27334 <option>tls_try_verify_hosts</option> is set and <option>tls_verify_certificates</option> is not set.
27337 Any client that matches <option>tls_verify_hosts</option> is constrained by
27338 <option>tls_verify_certificates</option>. The client must present one of the listed
27339 certificates. If it does not, the connection is aborted.
27342 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
27343 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
27344 certificate and checks it against <option>tls_verify_certificates</option>, but does not
27345 abort the connection if there is no certificate or if it does not match. This
27346 state can be detected in an ACL, which makes it possible to implement policies
27347 such as <quote>accept for relay only if a verified certificate has been received,
27348 but accept for local delivery if encrypted, even without a verified
27349 certificate</quote>.
27352 Client hosts that match neither of these lists are not asked to present
27356 <indexterm role="option">
27357 <primary><option>trusted_groups</option></primary>
27360 <informaltable frame="all">
27361 <tgroup cols="4" colsep="0" rowsep="0">
27362 <colspec colwidth="8*" align="left"/>
27363 <colspec colwidth="5*" align="center"/>
27364 <colspec colwidth="5*" align="center"/>
27365 <colspec colwidth="6*" align="right"/>
27368 <entry><option>trusted_groups</option></entry>
27369 <entry>Use: <emphasis>main</emphasis></entry>
27370 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
27371 <entry>Default: <emphasis>unset</emphasis></entry>
27377 <indexterm role="concept">
27378 <primary>trusted group</primary>
27380 <indexterm role="concept">
27381 <primary>group</primary>
27382 <secondary>trusted</secondary>
27384 This option is expanded just once, at the start of Exim’s processing. If this
27385 option is set, any process that is running in one of the listed groups, or
27386 which has one of them as a supplementary group, is trusted. The groups can be
27387 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
27388 details of what trusted callers are permitted to do. If neither
27389 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
27393 <indexterm role="option">
27394 <primary><option>trusted_users</option></primary>
27397 <informaltable frame="all">
27398 <tgroup cols="4" colsep="0" rowsep="0">
27399 <colspec colwidth="8*" align="left"/>
27400 <colspec colwidth="5*" align="center"/>
27401 <colspec colwidth="5*" align="center"/>
27402 <colspec colwidth="6*" align="right"/>
27405 <entry><option>trusted_users</option></entry>
27406 <entry>Use: <emphasis>main</emphasis></entry>
27407 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
27408 <entry>Default: <emphasis>unset</emphasis></entry>
27414 <indexterm role="concept">
27415 <primary>trusted user</primary>
27417 <indexterm role="concept">
27418 <primary>user</primary>
27419 <secondary>trusted</secondary>
27421 This option is expanded just once, at the start of Exim’s processing. If this
27422 option is set, any process that is running as one of the listed users is
27423 trusted. The users can be specified numerically or by name. See section
27424 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
27425 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
27426 Exim user are trusted.
27429 <indexterm role="option">
27430 <primary><option>unknown_login</option></primary>
27433 <informaltable frame="all">
27434 <tgroup cols="4" colsep="0" rowsep="0">
27435 <colspec colwidth="8*" align="left"/>
27436 <colspec colwidth="5*" align="center"/>
27437 <colspec colwidth="5*" align="center"/>
27438 <colspec colwidth="6*" align="right"/>
27441 <entry><option>unknown_login</option></entry>
27442 <entry>Use: <emphasis>main</emphasis></entry>
27443 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27444 <entry>Default: <emphasis>unset</emphasis></entry>
27450 <indexterm role="concept">
27451 <primary>uid (user id)</primary>
27452 <secondary>unknown caller</secondary>
27454 <indexterm role="concept">
27455 <primary><varname>$caller_uid</varname></primary>
27457 This is a specialized feature for use in unusual configurations. By default, if
27458 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
27459 gives up. The <option>unknown_login</option> option can be used to set a login name to be
27460 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
27461 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
27462 is used for the user’s real name (gecos field), unless this has been set by the
27463 <option>-F</option> option.
27466 <indexterm role="option">
27467 <primary><option>unknown_username</option></primary>
27470 <informaltable frame="all">
27471 <tgroup cols="4" colsep="0" rowsep="0">
27472 <colspec colwidth="8*" align="left"/>
27473 <colspec colwidth="5*" align="center"/>
27474 <colspec colwidth="5*" align="center"/>
27475 <colspec colwidth="6*" align="right"/>
27478 <entry><option>unknown_username</option></entry>
27479 <entry>Use: <emphasis>main</emphasis></entry>
27480 <entry>Type: <emphasis>string</emphasis></entry>
27481 <entry>Default: <emphasis>unset</emphasis></entry>
27487 See <option>unknown_login</option>.
27490 <indexterm role="option">
27491 <primary><option>untrusted_set_sender</option></primary>
27494 <informaltable frame="all">
27495 <tgroup cols="4" colsep="0" rowsep="0">
27496 <colspec colwidth="8*" align="left"/>
27497 <colspec colwidth="5*" align="center"/>
27498 <colspec colwidth="5*" align="center"/>
27499 <colspec colwidth="6*" align="right"/>
27502 <entry><option>untrusted_set_sender</option></entry>
27503 <entry>Use: <emphasis>main</emphasis></entry>
27504 <entry>Type: <emphasis>address list</emphasis>†<emphasis></emphasis></entry>
27505 <entry>Default: <emphasis>unset</emphasis></entry>
27511 <indexterm role="concept">
27512 <primary>trusted user</primary>
27514 <indexterm role="concept">
27515 <primary>sender</primary>
27516 <secondary>setting by untrusted user</secondary>
27518 <indexterm role="concept">
27519 <primary>untrusted user</primary>
27520 <secondary>setting sender</secondary>
27522 <indexterm role="concept">
27523 <primary>user</primary>
27524 <secondary>untrusted setting sender</secondary>
27526 <indexterm role="concept">
27527 <primary>envelope sender</primary>
27529 When an untrusted user submits a message to Exim using the standard input, Exim
27530 normally creates an envelope sender address from the user’s login and the
27531 default qualification domain. Data from the <option>-f</option> option (for setting envelope
27532 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
27533 is used) is ignored.
27536 However, untrusted users are permitted to set an empty envelope sender address,
27537 to declare that a message should never generate any bounces. For example:
27539 <literallayout class="monospaced">
27540 exim -f '<>' user@domain.example
27543 <indexterm role="concept">
27544 <primary><varname>$sender_ident</varname></primary>
27546 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
27547 other envelope sender addresses in a controlled way. When it is set, untrusted
27548 users are allowed to set envelope sender addresses that match any of the
27549 patterns in the list. Like all address lists, the string is expanded. The
27550 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
27551 users to setting senders that start with their login ids
27552 followed by a hyphen
27553 by a setting like this:
27555 <literallayout class="monospaced">
27556 untrusted_set_sender = ^$sender_ident-
27559 If you want to allow untrusted users to set envelope sender addresses without
27560 restriction, you can use
27562 <literallayout class="monospaced">
27563 untrusted_set_sender = *
27566 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
27567 only to the setting of the envelope sender. It does not permit untrusted users
27568 to use the other options which trusted user can use to override message
27569 parameters. Furthermore, it does not stop Exim from removing an existing
27570 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
27571 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
27572 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
27573 described in section <xref linkend="SECTthesenhea"/>.
27576 The log line for a message’s arrival shows the envelope sender following
27577 <quote><=</quote>. For local messages, the user’s login always follows, after <quote>U=</quote>. In
27578 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
27579 envelope sender address, the user’s login is shown in parentheses after the
27583 <indexterm role="option">
27584 <primary><option>uucp_from_pattern</option></primary>
27587 <informaltable frame="all">
27588 <tgroup cols="4" colsep="0" rowsep="0">
27589 <colspec colwidth="8*" align="left"/>
27590 <colspec colwidth="5*" align="center"/>
27591 <colspec colwidth="5*" align="center"/>
27592 <colspec colwidth="6*" align="right"/>
27595 <entry><option>uucp_from_pattern</option></entry>
27596 <entry>Use: <emphasis>main</emphasis></entry>
27597 <entry>Type: <emphasis>string</emphasis></entry>
27598 <entry>Default: <emphasis>see below</emphasis></entry>
27604 <indexterm role="concept">
27605 <primary><quote>From</quote> line</primary>
27607 <indexterm role="concept">
27608 <primary>UUCP</primary>
27609 <secondary><quote>From</quote> line</secondary>
27611 Some applications that pass messages to an MTA via a command line interface use
27612 an initial line starting with <quote>From </quote> to pass the envelope sender. In
27613 particular, this is used by UUCP software. Exim recognizes such a line by means
27614 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
27615 matches, the sender address is constructed by expanding the contents of
27616 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
27617 default pattern recognizes lines in the following two forms:
27619 <literallayout class="monospaced">
27620 From ph10 Fri Jan 5 12:35 GMT 1996
27621 From ph10 Fri, 7 Jan 97 14:00:00 GMT
27624 The pattern can be seen by running
27626 <literallayout class="monospaced">
27627 exim -bP uucp_from_pattern
27630 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
27631 year in the second case. The first word after <quote>From </quote> is matched in the
27632 regular expression by a parenthesized subpattern. The default value for
27633 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
27634 (<quote>ph10</quote> in the example above) as the message’s sender. See also
27635 <option>ignore_fromline_hosts</option>.
27638 <indexterm role="option">
27639 <primary><option>uucp_from_sender</option></primary>
27642 <informaltable frame="all">
27643 <tgroup cols="4" colsep="0" rowsep="0">
27644 <colspec colwidth="8*" align="left"/>
27645 <colspec colwidth="5*" align="center"/>
27646 <colspec colwidth="5*" align="center"/>
27647 <colspec colwidth="6*" align="right"/>
27650 <entry><option>uucp_from_sender</option></entry>
27651 <entry>Use: <emphasis>main</emphasis></entry>
27652 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27653 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
27659 See <option>uucp_from_pattern</option> above.
27662 <indexterm role="option">
27663 <primary><option>warn_message_file</option></primary>
27666 <informaltable frame="all">
27667 <tgroup cols="4" colsep="0" rowsep="0">
27668 <colspec colwidth="8*" align="left"/>
27669 <colspec colwidth="5*" align="center"/>
27670 <colspec colwidth="5*" align="center"/>
27671 <colspec colwidth="6*" align="right"/>
27674 <entry><option>warn_message_file</option></entry>
27675 <entry>Use: <emphasis>main</emphasis></entry>
27676 <entry>Type: <emphasis>string</emphasis></entry>
27677 <entry>Default: <emphasis>unset</emphasis></entry>
27683 <indexterm role="concept">
27684 <primary>warning of delay</primary>
27685 <secondary>customizing the message</secondary>
27687 <indexterm role="concept">
27688 <primary>customizing</primary>
27689 <secondary>warning message</secondary>
27691 This option defines a template file containing paragraphs of text to be used
27692 for constructing the warning message which is sent by Exim when a message has
27693 been on the queue for a specified amount of time, as specified by
27694 <option>delay_warning</option>. Details of the file’s contents are given in chapter
27695 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
27698 <indexterm role="option">
27699 <primary><option>write_rejectlog</option></primary>
27702 <informaltable frame="all">
27703 <tgroup cols="4" colsep="0" rowsep="0">
27704 <colspec colwidth="8*" align="left"/>
27705 <colspec colwidth="5*" align="center"/>
27706 <colspec colwidth="5*" align="center"/>
27707 <colspec colwidth="6*" align="right"/>
27710 <entry><option>write_rejectlog</option></entry>
27711 <entry>Use: <emphasis>main</emphasis></entry>
27712 <entry>Type: <emphasis>boolean</emphasis></entry>
27713 <entry>Default: <emphasis>true</emphasis></entry>
27719 <indexterm role="concept">
27720 <primary>reject log</primary>
27721 <secondary>disabling</secondary>
27723 If this option is set false, Exim no longer writes anything to the reject log.
27724 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
27725 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
27726 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
27731 <chapter id="CHAProutergeneric">
27732 <title>Generic options for routers</title>
27734 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
27735 <primary>options</primary>
27736 <secondary>generic; for routers</secondary>
27738 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
27739 <primary>generic options</primary>
27740 <secondary>router</secondary>
27742 This chapter describes the generic options that apply to all routers.
27743 Those that are preconditions are marked with ‡ in the <quote>use</quote> field.
27746 For a general description of how a router operates, see sections
27747 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
27748 which the preconditions are tested. The order of expansion of the options that
27749 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
27750 <option>headers_remove</option>, <option>transport</option>.
27753 <indexterm role="option">
27754 <primary><option>address_data</option></primary>
27757 <informaltable frame="all">
27758 <tgroup cols="4" colsep="0" rowsep="0">
27759 <colspec colwidth="8*" align="left"/>
27760 <colspec colwidth="5*" align="center"/>
27761 <colspec colwidth="5*" align="center"/>
27762 <colspec colwidth="6*" align="right"/>
27765 <entry><option>address_data</option></entry>
27766 <entry>Use: <emphasis>routers</emphasis></entry>
27767 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27768 <entry>Default: <emphasis>unset</emphasis></entry>
27774 <indexterm role="concept">
27775 <primary>router</primary>
27776 <secondary>data attached to address</secondary>
27778 The string is expanded just before the router is run, that is, after all the
27779 precondition tests have succeeded. If the expansion is forced to fail, the
27780 router declines, the value of <option>address_data</option> remains unchanged, and the
27781 <option>more</option> option controls what happens next. Other expansion failures cause
27782 delivery of the address to be deferred.
27785 <indexterm role="concept">
27786 <primary><varname>$address_data</varname></primary>
27788 When the expansion succeeds, the value is retained with the address, and can be
27789 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
27790 routers, and the eventual transport.
27793 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
27794 that runs a user’s filter file, the contents of <varname>$address_data</varname> are accessible
27795 in the filter. This is not normally a problem, because such data is usually
27796 either not confidential or it <quote>belongs</quote> to the current user, but if you do
27797 put confidential data into <varname>$address_data</varname> you need to remember this point.
27800 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
27801 with the address, though it can be changed by another <option>address_data</option> setting
27802 on a subsequent router. If a router generates child addresses, the value of
27803 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
27804 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
27807 The idea of <option>address_data</option> is that you can use it to look up a lot of data
27808 for the address once, and then pick out parts of the data later. For example,
27809 you could use a single LDAP lookup to return a string of the form
27811 <literallayout class="monospaced">
27812 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
27815 In the transport you could pick out the mailbox by a setting such as
27817 <literallayout class="monospaced">
27818 file = ${extract{mailbox}{$address_data}}
27821 This makes the configuration file less messy, and also reduces the number of
27822 lookups (though Exim does cache lookups).
27825 The <option>address_data</option> facility is also useful as a means of passing information
27826 from one router to another, and from a router to a transport. In addition, if
27829 <indexterm role="concept">
27830 <primary><varname>$sender_address_data</varname></primary>
27832 <indexterm role="concept">
27833 <primary><varname>$address_data</varname></primary>
27835 When <varname>$address_data</varname> is set by a router when verifying a recipient address
27836 from an ACL, it remains available for use in the rest of the ACL statement.
27837 After verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
27840 <indexterm role="option">
27841 <primary><option>address_test</option></primary>
27844 <informaltable frame="all">
27845 <tgroup cols="4" colsep="0" rowsep="0">
27846 <colspec colwidth="8*" align="left"/>
27847 <colspec colwidth="5*" align="center"/>
27848 <colspec colwidth="5*" align="center"/>
27849 <colspec colwidth="6*" align="right"/>
27852 <entry><option>address_test</option></entry>
27853 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
27854 <entry>Type: <emphasis>boolean</emphasis></entry>
27855 <entry>Default: <emphasis>true</emphasis></entry>
27861 <indexterm role="concept">
27862 <primary><option>-bt</option> option</primary>
27864 <indexterm role="concept">
27865 <primary>router</primary>
27866 <secondary>skipping when address testing</secondary>
27868 If this option is set false, the router is skipped when routing is being tested
27869 by means of the <option>-bt</option> command line option. This can be a convenience when
27870 your first router sends messages to an external scanner, because it saves you
27871 having to set the <quote>already scanned</quote> indicator when testing real address
27875 <indexterm role="option">
27876 <primary><option>cannot_route_message</option></primary>
27879 <informaltable frame="all">
27880 <tgroup cols="4" colsep="0" rowsep="0">
27881 <colspec colwidth="8*" align="left"/>
27882 <colspec colwidth="5*" align="center"/>
27883 <colspec colwidth="5*" align="center"/>
27884 <colspec colwidth="6*" align="right"/>
27887 <entry><option>cannot_route_message</option></entry>
27888 <entry>Use: <emphasis>routers</emphasis></entry>
27889 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27890 <entry>Default: <emphasis>unset</emphasis></entry>
27896 <indexterm role="concept">
27897 <primary>router</primary>
27898 <secondary>customizing <quote>cannot route</quote> message</secondary>
27900 <indexterm role="concept">
27901 <primary>customizing</primary>
27902 <secondary><quote>cannot route</quote> message</secondary>
27904 This option specifies a text message that is used when an address cannot be
27905 routed because Exim has run out of routers. The default message is
27906 <quote>Unrouteable address</quote>. This option is useful only on routers that have
27907 <option>more</option> set false, or on the very last router in a configuration, because the
27908 value that is used is taken from the last router that is considered. This
27909 includes a router that is skipped because its preconditions are not met, as
27910 well as a router that declines. For example, using the default configuration,
27913 <literallayout class="monospaced">
27914 cannot_route_message = Remote domain not found in DNS
27917 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
27920 <literallayout class="monospaced">
27921 cannot_route_message = Unknown local user
27924 on the final router that checks for local users. If string expansion fails for
27925 this option, the default message is used. Unless the expansion failure was
27926 explicitly forced, a message about the failure is written to the main and panic
27927 logs, in addition to the normal message about the routing failure.
27930 <indexterm role="option">
27931 <primary><option>caseful_local_part</option></primary>
27934 <informaltable frame="all">
27935 <tgroup cols="4" colsep="0" rowsep="0">
27936 <colspec colwidth="8*" align="left"/>
27937 <colspec colwidth="5*" align="center"/>
27938 <colspec colwidth="5*" align="center"/>
27939 <colspec colwidth="6*" align="right"/>
27942 <entry><option>caseful_local_part</option></entry>
27943 <entry>Use: <emphasis>routers</emphasis></entry>
27944 <entry>Type: <emphasis>boolean</emphasis></entry>
27945 <entry>Default: <emphasis>false</emphasis></entry>
27951 <indexterm role="concept">
27952 <primary>case of local parts</primary>
27954 <indexterm role="concept">
27955 <primary>router</primary>
27956 <secondary>case of local parts</secondary>
27958 By default, routers handle the local parts of addresses in a case-insensitive
27959 manner, though the actual case is preserved for transmission with the message.
27960 If you want the case of letters to be significant in a router, you must set
27961 this option true. For individual router options that contain address or local
27962 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
27963 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
27967 <indexterm role="concept">
27968 <primary><varname>$local_part</varname></primary>
27970 <indexterm role="concept">
27971 <primary><varname>$original_local_part</varname></primary>
27973 <indexterm role="concept">
27974 <primary><varname>$parent_local_part</varname></primary>
27976 The value of the <varname>$local_part</varname> variable is forced to lower case while a
27977 router is running unless <option>caseful_local_part</option> is set. When a router assigns
27978 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
27979 is the same as it was in the router. Similarly, when a router generates child
27980 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
27981 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
27984 This option applies to the processing of an address by a router. When a
27985 recipient address is being processed in an ACL, there is a separate <option>control</option>
27986 modifier that can be used to specify case-sensitive processing within the ACL
27987 (see section <xref linkend="SECTcontrols"/>).
27990 <indexterm role="option">
27991 <primary><option>check_local_user</option></primary>
27994 <informaltable frame="all">
27995 <tgroup cols="4" colsep="0" rowsep="0">
27996 <colspec colwidth="8*" align="left"/>
27997 <colspec colwidth="5*" align="center"/>
27998 <colspec colwidth="5*" align="center"/>
27999 <colspec colwidth="6*" align="right"/>
28002 <entry><option>check_local_user</option></entry>
28003 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
28004 <entry>Type: <emphasis>boolean</emphasis></entry>
28005 <entry>Default: <emphasis>false</emphasis></entry>
28011 <indexterm role="concept">
28012 <primary>local user</primary>
28013 <secondary>checking in router</secondary>
28015 <indexterm role="concept">
28016 <primary>router</primary>
28017 <secondary>checking for local user</secondary>
28019 <indexterm role="concept">
28020 <primary><filename>/etc/passwd</filename></primary>
28022 <indexterm role="concept">
28023 <primary><varname>$home</varname></primary>
28025 When this option is true, Exim checks that the local part of the recipient
28026 address (with affixes removed if relevant) is the name of an account on the
28027 local system. The check is done by calling the <function>getpwnam()</function> function rather
28028 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
28029 holding password data (such as NIS) are supported. If the local part is a local
28030 user, <varname>$home</varname> is set from the password data, and can be tested in other
28031 preconditions that are evaluated after this one (the order of evaluation is
28032 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
28033 overridden by <option>router_home_directory</option>. If the local part is not a local user,
28034 the router is skipped.
28037 If you want to check that the local part is either the name of a local user
28038 or matches something else, you cannot combine <option>check_local_user</option> with a
28039 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
28040 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
28041 setting to achieve this. For example:
28043 <literallayout class="monospaced">
28044 local_parts = passwd;$local_part : lsearch;/etc/other/users
28047 Note, however, that the side effects of <option>check_local_user</option> (such as setting
28048 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
28049 <option>local_parts</option> (or any other) precondition.
28052 <indexterm role="option">
28053 <primary><option>condition</option></primary>
28056 <informaltable frame="all">
28057 <tgroup cols="4" colsep="0" rowsep="0">
28058 <colspec colwidth="8*" align="left"/>
28059 <colspec colwidth="5*" align="center"/>
28060 <colspec colwidth="5*" align="center"/>
28061 <colspec colwidth="6*" align="right"/>
28064 <entry><option>condition</option></entry>
28065 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
28066 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28067 <entry>Default: <emphasis>unset</emphasis></entry>
28073 <indexterm role="concept">
28074 <primary>router</primary>
28075 <secondary>customized precondition</secondary>
28077 This option specifies a general precondition test that has to succeed for the
28078 router to be called. The <option>condition</option> option is the last precondition to be
28079 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
28080 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
28081 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
28082 router is skipped, and the address is offered to the next one.
28085 If the result is any other value, the router is run (as this is the last
28086 precondition to be evaluated, all the other preconditions must be true).
28089 The <option>condition</option> option provides a means of applying custom conditions to the
28090 running of routers. Note that in the case of a simple conditional expansion,
28091 the default expansion values are exactly what is wanted. For example:
28093 <literallayout class="monospaced">
28094 condition = ${if >{$message_age}{600}}
28097 Because of the default behaviour of the string expansion, this is equivalent to
28099 <literallayout class="monospaced">
28100 condition = ${if >{$message_age}{600}{true}{}}
28103 If the expansion fails (other than forced failure) delivery is deferred. Some
28104 of the other precondition options are common special cases that could in fact
28105 be specified using <option>condition</option>.
28108 <indexterm role="option">
28109 <primary><option>debug_print</option></primary>
28112 <informaltable frame="all">
28113 <tgroup cols="4" colsep="0" rowsep="0">
28114 <colspec colwidth="8*" align="left"/>
28115 <colspec colwidth="5*" align="center"/>
28116 <colspec colwidth="5*" align="center"/>
28117 <colspec colwidth="6*" align="right"/>
28120 <entry><option>debug_print</option></entry>
28121 <entry>Use: <emphasis>routers</emphasis></entry>
28122 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28123 <entry>Default: <emphasis>unset</emphasis></entry>
28129 <indexterm role="concept">
28130 <primary>testing</primary>
28131 <secondary>variables in drivers</secondary>
28133 If this option is set and debugging is enabled (see the <option>-d</option> command line
28134 option), the string is expanded and included in the debugging output.
28135 If expansion of the string fails, the error message is written to the debugging
28136 output, and Exim carries on processing.
28137 This option is provided to help with checking out the values of variables and
28138 so on when debugging router configurations. For example, if a <option>condition</option>
28139 option appears not to be working, <option>debug_print</option> can be used to output the
28140 variables it references. The output happens after checks for <option>domains</option>,
28141 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
28142 are tested. A newline is added to the text if it does not end with one.
28145 <indexterm role="option">
28146 <primary><option>disable_logging</option></primary>
28149 <informaltable frame="all">
28150 <tgroup cols="4" colsep="0" rowsep="0">
28151 <colspec colwidth="8*" align="left"/>
28152 <colspec colwidth="5*" align="center"/>
28153 <colspec colwidth="5*" align="center"/>
28154 <colspec colwidth="6*" align="right"/>
28157 <entry><option>disable_logging</option></entry>
28158 <entry>Use: <emphasis>routers</emphasis></entry>
28159 <entry>Type: <emphasis>boolean</emphasis></entry>
28160 <entry>Default: <emphasis>false</emphasis></entry>
28166 If this option is set true, nothing is logged for any routing errors
28167 or for any deliveries caused by this router. You should not set this option
28168 unless you really, really know what you are doing. See also the generic
28169 transport option of the same name.
28172 <indexterm role="option">
28173 <primary><option>domains</option></primary>
28176 <informaltable frame="all">
28177 <tgroup cols="4" colsep="0" rowsep="0">
28178 <colspec colwidth="8*" align="left"/>
28179 <colspec colwidth="5*" align="center"/>
28180 <colspec colwidth="5*" align="center"/>
28181 <colspec colwidth="6*" align="right"/>
28184 <entry><option>domains</option></entry>
28185 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
28186 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
28187 <entry>Default: <emphasis>unset</emphasis></entry>
28193 <indexterm role="concept">
28194 <primary>router</primary>
28195 <secondary>restricting to specific domains</secondary>
28197 <indexterm role="concept">
28198 <primary><varname>$domain_data</varname></primary>
28200 If this option is set, the router is skipped unless the current domain matches
28201 the list. If the match is achieved by means of a file lookup, the data that the
28202 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
28203 expansions of the driver’s private options. See section <xref linkend="SECTrouprecon"/> for
28204 a list of the order in which preconditions are evaluated.
28207 <indexterm role="option">
28208 <primary><option>driver</option></primary>
28211 <informaltable frame="all">
28212 <tgroup cols="4" colsep="0" rowsep="0">
28213 <colspec colwidth="8*" align="left"/>
28214 <colspec colwidth="5*" align="center"/>
28215 <colspec colwidth="5*" align="center"/>
28216 <colspec colwidth="6*" align="right"/>
28219 <entry><option>driver</option></entry>
28220 <entry>Use: <emphasis>routers</emphasis></entry>
28221 <entry>Type: <emphasis>string</emphasis></entry>
28222 <entry>Default: <emphasis>unset</emphasis></entry>
28228 This option must always be set. It specifies which of the available routers is
28232 <indexterm role="option">
28233 <primary><option>errors_to</option></primary>
28236 <informaltable frame="all">
28237 <tgroup cols="4" colsep="0" rowsep="0">
28238 <colspec colwidth="8*" align="left"/>
28239 <colspec colwidth="5*" align="center"/>
28240 <colspec colwidth="5*" align="center"/>
28241 <colspec colwidth="6*" align="right"/>
28244 <entry><option>errors_to</option></entry>
28245 <entry>Use: <emphasis>routers</emphasis></entry>
28246 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28247 <entry>Default: <emphasis>unset</emphasis></entry>
28253 <indexterm role="concept">
28254 <primary>envelope sender</primary>
28256 <indexterm role="concept">
28257 <primary>router</primary>
28258 <secondary>changing address for errors</secondary>
28260 If a router successfully handles an address, it may assign the address to a
28261 transport for delivery or it may generate child addresses. In both cases, if
28262 there is a delivery problem during later processing, the resulting bounce
28263 message is sent to the address that results from expanding this string,
28264 provided that the address verifies successfully. The <option>errors_to</option> option is
28265 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
28268 The <option>errors_to</option> setting associated with an address can be overridden if it
28269 subsequently passes through other routers that have their own <option>errors_to</option>
28270 settings, or if the message is delivered by a transport with a <option>return_path</option>
28274 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
28275 the expansion fails to verify, the errors address associated with the incoming
28276 address is used. At top level, this is the envelope sender. A non-forced
28277 expansion failure causes delivery to be deferred.
28280 If an address for which <option>errors_to</option> has been set ends up being delivered over
28281 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
28282 any bounces that are generated by other MTAs on the delivery route are also
28283 sent there. You can set <option>errors_to</option> to the empty string by either of these
28286 <literallayout class="monospaced">
28291 An expansion item that yields an empty string has the same effect. If you do
28292 this, a locally detected delivery error for addresses processed by this router
28293 no longer gives rise to a bounce message; the error is discarded. If the
28294 address is delivered to a remote host, the return path is set to <literal><></literal>, unless
28295 overridden by the <option>return_path</option> option on the transport.
28298 <indexterm role="concept">
28299 <primary><varname>$address_data</varname></primary>
28301 If for some reason you want to discard local errors, but use a non-empty
28302 MAIL command for remote delivery, you can preserve the original return
28303 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
28304 setting <option>return_path</option>.
28307 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
28308 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
28309 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
28312 <indexterm role="option">
28313 <primary><option>expn</option></primary>
28316 <informaltable frame="all">
28317 <tgroup cols="4" colsep="0" rowsep="0">
28318 <colspec colwidth="8*" align="left"/>
28319 <colspec colwidth="5*" align="center"/>
28320 <colspec colwidth="5*" align="center"/>
28321 <colspec colwidth="6*" align="right"/>
28324 <entry><option>expn</option></entry>
28325 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
28326 <entry>Type: <emphasis>boolean</emphasis></entry>
28327 <entry>Default: <emphasis>true</emphasis></entry>
28333 <indexterm role="concept">
28334 <primary>address</primary>
28335 <secondary>testing</secondary>
28337 <indexterm role="concept">
28338 <primary>testing</primary>
28339 <secondary>addresses</secondary>
28341 <indexterm role="concept">
28342 <primary>EXPN</primary>
28343 <secondary>router skipping</secondary>
28345 <indexterm role="concept">
28346 <primary>router</primary>
28347 <secondary>skipping for EXPN</secondary>
28349 If this option is turned off, the router is skipped when testing an address
28350 as a result of processing an SMTP EXPN command. You might, for example,
28351 want to turn it off on a router for users’ <filename>.forward</filename> files, while leaving it
28352 on for the system alias file.
28353 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
28357 The use of the SMTP EXPN command is controlled by an ACL (see chapter
28358 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
28359 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
28362 <indexterm role="option">
28363 <primary><option>fail_verify</option></primary>
28366 <informaltable frame="all">
28367 <tgroup cols="4" colsep="0" rowsep="0">
28368 <colspec colwidth="8*" align="left"/>
28369 <colspec colwidth="5*" align="center"/>
28370 <colspec colwidth="5*" align="center"/>
28371 <colspec colwidth="6*" align="right"/>
28374 <entry><option>fail_verify</option></entry>
28375 <entry>Use: <emphasis>routers</emphasis></entry>
28376 <entry>Type: <emphasis>boolean</emphasis></entry>
28377 <entry>Default: <emphasis>false</emphasis></entry>
28383 <indexterm role="concept">
28384 <primary>router</primary>
28385 <secondary>forcing verification failure</secondary>
28387 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
28388 <option>fail_verify_recipient</option> to the same value.
28391 <indexterm role="option">
28392 <primary><option>fail_verify_recipient</option></primary>
28395 <informaltable frame="all">
28396 <tgroup cols="4" colsep="0" rowsep="0">
28397 <colspec colwidth="8*" align="left"/>
28398 <colspec colwidth="5*" align="center"/>
28399 <colspec colwidth="5*" align="center"/>
28400 <colspec colwidth="6*" align="right"/>
28403 <entry><option>fail_verify_recipient</option></entry>
28404 <entry>Use: <emphasis>routers</emphasis></entry>
28405 <entry>Type: <emphasis>boolean</emphasis></entry>
28406 <entry>Default: <emphasis>false</emphasis></entry>
28412 If this option is true and an address is accepted by this router when
28413 verifying a recipient, verification fails.
28416 <indexterm role="option">
28417 <primary><option>fail_verify_sender</option></primary>
28420 <informaltable frame="all">
28421 <tgroup cols="4" colsep="0" rowsep="0">
28422 <colspec colwidth="8*" align="left"/>
28423 <colspec colwidth="5*" align="center"/>
28424 <colspec colwidth="5*" align="center"/>
28425 <colspec colwidth="6*" align="right"/>
28428 <entry><option>fail_verify_sender</option></entry>
28429 <entry>Use: <emphasis>routers</emphasis></entry>
28430 <entry>Type: <emphasis>boolean</emphasis></entry>
28431 <entry>Default: <emphasis>false</emphasis></entry>
28437 If this option is true and an address is accepted by this router when
28438 verifying a sender, verification fails.
28441 <indexterm role="option">
28442 <primary><option>fallback_hosts</option></primary>
28445 <informaltable frame="all">
28446 <tgroup cols="4" colsep="0" rowsep="0">
28447 <colspec colwidth="8*" align="left"/>
28448 <colspec colwidth="5*" align="center"/>
28449 <colspec colwidth="5*" align="center"/>
28450 <colspec colwidth="6*" align="right"/>
28453 <entry><option>fallback_hosts</option></entry>
28454 <entry>Use: <emphasis>routers</emphasis></entry>
28455 <entry>Type: <emphasis>string list</emphasis></entry>
28456 <entry>Default: <emphasis>unset</emphasis></entry>
28462 <indexterm role="concept">
28463 <primary>router</primary>
28464 <secondary>fallback hosts</secondary>
28466 <indexterm role="concept">
28467 <primary>fallback</primary>
28468 <secondary>hosts specified on router</secondary>
28470 String expansion is not applied to this option. The argument must be a
28471 colon-separated list of host names or IP addresses. The list separator can be
28472 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
28473 each name or address. In fact, the format of each item is exactly the same as
28474 defined for the list of hosts in a <command>manualroute</command> router (see section
28475 <xref linkend="SECTformatonehostitem"/>).
28478 If a router queues an address for a remote transport, this host list is
28479 associated with the address, and used instead of the transport’s fallback host
28480 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
28481 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
28482 transport for further details.
28485 <indexterm role="option">
28486 <primary><option>group</option></primary>
28489 <informaltable frame="all">
28490 <tgroup cols="4" colsep="0" rowsep="0">
28491 <colspec colwidth="8*" align="left"/>
28492 <colspec colwidth="5*" align="center"/>
28493 <colspec colwidth="5*" align="center"/>
28494 <colspec colwidth="6*" align="right"/>
28497 <entry><option>group</option></entry>
28498 <entry>Use: <emphasis>routers</emphasis></entry>
28499 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28500 <entry>Default: <emphasis>see below</emphasis></entry>
28506 <indexterm role="concept">
28507 <primary>gid (group id)</primary>
28508 <secondary>local delivery</secondary>
28510 <indexterm role="concept">
28511 <primary>local transports</primary>
28512 <secondary>uid and gid</secondary>
28514 <indexterm role="concept">
28515 <primary>transport</primary>
28516 <secondary>local</secondary>
28518 <indexterm role="concept">
28519 <primary>router</primary>
28520 <secondary>setting group</secondary>
28522 When a router queues an address for a transport, and the transport does not
28523 specify a group, the group given here is used when running the delivery
28525 The group may be specified numerically or by name. If expansion fails, the
28526 error is logged and delivery is deferred.
28527 The default is unset, unless <option>check_local_user</option> is set, when the default
28528 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
28529 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
28532 <indexterm role="option">
28533 <primary><option>headers_add</option></primary>
28536 <informaltable frame="all">
28537 <tgroup cols="4" colsep="0" rowsep="0">
28538 <colspec colwidth="8*" align="left"/>
28539 <colspec colwidth="5*" align="center"/>
28540 <colspec colwidth="5*" align="center"/>
28541 <colspec colwidth="6*" align="right"/>
28544 <entry><option>headers_add</option></entry>
28545 <entry>Use: <emphasis>routers</emphasis></entry>
28546 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28547 <entry>Default: <emphasis>unset</emphasis></entry>
28553 <indexterm role="concept">
28554 <primary>header lines</primary>
28555 <secondary>adding</secondary>
28557 <indexterm role="concept">
28558 <primary>router</primary>
28559 <secondary>adding header lines</secondary>
28561 This option specifies a string of text that is expanded at routing time, and
28562 associated with any addresses that are accepted by the router. However, this
28563 option has no effect when an address is just being verified. The way in which
28564 the text is used to add header lines at transport time is described in section
28565 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
28566 message is in the process of being transported. This means that references to
28567 header lines in string expansions in the transport’s configuration do not
28568 <quote>see</quote> the added header lines.
28571 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
28572 <option>headers_remove</option> and <option>transport</option>. If the expanded string is empty, or if
28573 the expansion is forced to fail, the option has no effect. Other expansion
28574 failures are treated as configuration errors.
28577 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
28578 router that has the <option>one_time</option> option set.
28581 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
28582 additions are deleted when the address is passed on to subsequent routers.
28585 <indexterm role="option">
28586 <primary><option>headers_remove</option></primary>
28589 <informaltable frame="all">
28590 <tgroup cols="4" colsep="0" rowsep="0">
28591 <colspec colwidth="8*" align="left"/>
28592 <colspec colwidth="5*" align="center"/>
28593 <colspec colwidth="5*" align="center"/>
28594 <colspec colwidth="6*" align="right"/>
28597 <entry><option>headers_remove</option></entry>
28598 <entry>Use: <emphasis>routers</emphasis></entry>
28599 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28600 <entry>Default: <emphasis>unset</emphasis></entry>
28606 <indexterm role="concept">
28607 <primary>header lines</primary>
28608 <secondary>removing</secondary>
28610 <indexterm role="concept">
28611 <primary>router</primary>
28612 <secondary>removing header lines</secondary>
28614 This option specifies a string of text that is expanded at routing time, and
28615 associated with any addresses that are accepted by the router. However, this
28616 option has no effect when an address is just being verified. The way in which
28617 the text is used to remove header lines at transport time is described in
28618 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
28619 the message is in the process of being transported. This means that references
28620 to header lines in string expansions in the transport’s configuration still
28621 <quote>see</quote> the original header lines.
28624 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
28625 <option>headers_add</option>, but before <option>transport</option>. If the expansion is forced to fail,
28626 the option has no effect. Other expansion failures are treated as configuration
28630 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
28631 router that has the <option>one_time</option> option set.
28634 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
28635 removal requests are deleted when the address is passed on to subsequent
28639 <indexterm role="option">
28640 <primary><option>ignore_target_hosts</option></primary>
28643 <informaltable frame="all">
28644 <tgroup cols="4" colsep="0" rowsep="0">
28645 <colspec colwidth="8*" align="left"/>
28646 <colspec colwidth="5*" align="center"/>
28647 <colspec colwidth="5*" align="center"/>
28648 <colspec colwidth="6*" align="right"/>
28651 <entry><option>ignore_target_hosts</option></entry>
28652 <entry>Use: <emphasis>routers</emphasis></entry>
28653 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
28654 <entry>Default: <emphasis>unset</emphasis></entry>
28660 <indexterm role="concept">
28661 <primary>IP address</primary>
28662 <secondary>discarding</secondary>
28664 <indexterm role="concept">
28665 <primary>router</primary>
28666 <secondary>discarding IP addresses</secondary>
28668 Although this option is a host list, it should normally contain IP address
28669 entries rather than names. If any host that is looked up by the router has an
28670 IP address that matches an item in this list, Exim behaves as if that IP
28671 address did not exist. This option allows you to cope with rogue DNS entries
28674 <literallayout class="monospaced">
28675 remote.domain.example. A 127.0.0.1
28680 <literallayout class="monospaced">
28681 ignore_target_hosts = 127.0.0.1
28684 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
28685 discarded in this way, the router declines. In a conventional configuration, an
28686 attempt to mail to such a domain would normally provoke the <quote>unrouteable
28687 domain</quote> error, and an attempt to verify an address in the domain would fail.
28688 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
28689 router declines if presented with one of the listed addresses.
28692 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
28693 means of the first or the second of the following settings, respectively:
28695 <literallayout class="monospaced">
28696 ignore_target_hosts = 0.0.0.0/0
28697 ignore_target_hosts = <; 0::0/0
28700 The pattern in the first line matches all IPv4 addresses, whereas the pattern
28701 in the second line matches all IPv6 addresses.
28704 This option may also be useful for ignoring link-local and site-local IPv6
28705 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
28706 is expanded before use as a list, it is possible to make it dependent on the
28707 domain that is being routed.
28710 <indexterm role="concept">
28711 <primary><varname>$host_address</varname></primary>
28713 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
28717 <indexterm role="option">
28718 <primary><option>initgroups</option></primary>
28721 <informaltable frame="all">
28722 <tgroup cols="4" colsep="0" rowsep="0">
28723 <colspec colwidth="8*" align="left"/>
28724 <colspec colwidth="5*" align="center"/>
28725 <colspec colwidth="5*" align="center"/>
28726 <colspec colwidth="6*" align="right"/>
28729 <entry><option>initgroups</option></entry>
28730 <entry>Use: <emphasis>routers</emphasis></entry>
28731 <entry>Type: <emphasis>boolean</emphasis></entry>
28732 <entry>Default: <emphasis>false</emphasis></entry>
28738 <indexterm role="concept">
28739 <primary>additional groups</primary>
28741 <indexterm role="concept">
28742 <primary>groups</primary>
28743 <secondary>additional</secondary>
28745 <indexterm role="concept">
28746 <primary>local transports</primary>
28747 <secondary>uid and gid</secondary>
28749 <indexterm role="concept">
28750 <primary>transport</primary>
28751 <secondary>local</secondary>
28753 If the router queues an address for a transport, and this option is true, and
28754 the uid supplied by the router is not overridden by the transport, the
28755 <function>initgroups()</function> function is called when running the transport to ensure that
28756 any additional groups associated with the uid are set up. See also <option>group</option>
28757 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
28760 <indexterm role="option">
28761 <primary><option>local_part_prefix</option></primary>
28764 <informaltable frame="all">
28765 <tgroup cols="4" colsep="0" rowsep="0">
28766 <colspec colwidth="8*" align="left"/>
28767 <colspec colwidth="5*" align="center"/>
28768 <colspec colwidth="5*" align="center"/>
28769 <colspec colwidth="6*" align="right"/>
28772 <entry><option>local_part_prefix</option></entry>
28773 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
28774 <entry>Type: <emphasis>string list</emphasis></entry>
28775 <entry>Default: <emphasis>unset</emphasis></entry>
28781 <indexterm role="concept">
28782 <primary>router</primary>
28783 <secondary>prefix for local part</secondary>
28785 <indexterm role="concept">
28786 <primary>prefix</primary>
28787 <secondary>for local part; used in router</secondary>
28789 If this option is set, the router is skipped unless the local part starts with
28790 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
28791 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
28795 The list is scanned from left to right, and the first prefix that matches is
28796 used. A limited form of wildcard is available; if the prefix begins with an
28797 asterisk, it matches the longest possible sequence of arbitrary characters at
28798 the start of the local part. An asterisk should therefore always be followed by
28799 some character that does not occur in normal local parts.
28800 <indexterm role="concept">
28801 <primary>multiple mailboxes</primary>
28803 <indexterm role="concept">
28804 <primary>mailbox</primary>
28805 <secondary>multiple</secondary>
28807 Wildcarding can be used to set up multiple user mailboxes, as described in
28808 section <xref linkend="SECTmulbox"/>.
28811 <indexterm role="concept">
28812 <primary><varname>$local_part</varname></primary>
28814 <indexterm role="concept">
28815 <primary><varname>$local_part_prefix</varname></primary>
28817 During the testing of the <option>local_parts</option> option, and while the router is
28818 running, the prefix is removed from the local part, and is available in the
28819 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
28820 the router accepts the address, this remains true during subsequent delivery by
28821 a transport. In particular, the local part that is transmitted in the RCPT
28822 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
28823 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
28824 the relevant transport.
28827 When an address is being verified, <option>local_part_prefix</option> affects only the
28828 behaviour of the router. If the callout feature of verification is in use, this
28829 means that the full address, including the prefix, will be used during the
28833 The prefix facility is commonly used to handle local parts of the form
28834 <option>owner-something</option>. Another common use is to support local parts of the form
28835 <option>real-username</option> to bypass a user’s <filename>.forward</filename> file – helpful when trying
28836 to tell a user their forwarding is broken – by placing a router like this one
28837 immediately before the router that handles <filename>.forward</filename> files:
28839 <literallayout class="monospaced">
28842 local_part_prefix = real-
28844 transport = local_delivery
28847 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
28848 both conditions must be met if not optional. Care must be taken if wildcards
28849 are used in both a prefix and a suffix on the same router. Different
28850 separator characters must be used to avoid ambiguity.
28853 <indexterm role="option">
28854 <primary><option>local_part_prefix_optional</option></primary>
28857 <informaltable frame="all">
28858 <tgroup cols="4" colsep="0" rowsep="0">
28859 <colspec colwidth="8*" align="left"/>
28860 <colspec colwidth="5*" align="center"/>
28861 <colspec colwidth="5*" align="center"/>
28862 <colspec colwidth="6*" align="right"/>
28865 <entry><option>local_part_prefix_optional</option></entry>
28866 <entry>Use: <emphasis>routers</emphasis></entry>
28867 <entry>Type: <emphasis>boolean</emphasis></entry>
28868 <entry>Default: <emphasis>false</emphasis></entry>
28874 See <option>local_part_prefix</option> above.
28877 <indexterm role="option">
28878 <primary><option>local_part_suffix</option></primary>
28881 <informaltable frame="all">
28882 <tgroup cols="4" colsep="0" rowsep="0">
28883 <colspec colwidth="8*" align="left"/>
28884 <colspec colwidth="5*" align="center"/>
28885 <colspec colwidth="5*" align="center"/>
28886 <colspec colwidth="6*" align="right"/>
28889 <entry><option>local_part_suffix</option></entry>
28890 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
28891 <entry>Type: <emphasis>string list</emphasis></entry>
28892 <entry>Default: <emphasis>unset</emphasis></entry>
28898 <indexterm role="concept">
28899 <primary>router</primary>
28900 <secondary>suffix for local part</secondary>
28902 <indexterm role="concept">
28903 <primary>suffix for local part</primary>
28904 <secondary>used in router</secondary>
28906 This option operates in the same way as <option>local_part_prefix</option>, except that the
28907 local part must end (rather than start) with the given string, the
28908 <option>local_part_suffix_optional</option> option determines whether the suffix is
28909 mandatory, and the wildcard * character, if present, must be the last
28910 character of the suffix. This option facility is commonly used to handle local
28911 parts of the form <option>something-request</option> and multiple user mailboxes of the form
28912 <option>username-foo</option>.
28915 <indexterm role="option">
28916 <primary><option>local_part_suffix_optional</option></primary>
28919 <informaltable frame="all">
28920 <tgroup cols="4" colsep="0" rowsep="0">
28921 <colspec colwidth="8*" align="left"/>
28922 <colspec colwidth="5*" align="center"/>
28923 <colspec colwidth="5*" align="center"/>
28924 <colspec colwidth="6*" align="right"/>
28927 <entry><option>local_part_suffix_optional</option></entry>
28928 <entry>Use: <emphasis>routers</emphasis></entry>
28929 <entry>Type: <emphasis>boolean</emphasis></entry>
28930 <entry>Default: <emphasis>false</emphasis></entry>
28936 See <option>local_part_suffix</option> above.
28939 <indexterm role="option">
28940 <primary><option>local_parts</option></primary>
28943 <informaltable frame="all">
28944 <tgroup cols="4" colsep="0" rowsep="0">
28945 <colspec colwidth="8*" align="left"/>
28946 <colspec colwidth="5*" align="center"/>
28947 <colspec colwidth="5*" align="center"/>
28948 <colspec colwidth="6*" align="right"/>
28951 <entry><option>local_parts</option></entry>
28952 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
28953 <entry>Type: <emphasis>local part list</emphasis>†<emphasis></emphasis></entry>
28954 <entry>Default: <emphasis>unset</emphasis></entry>
28960 <indexterm role="concept">
28961 <primary>router</primary>
28962 <secondary>restricting to specific local parts</secondary>
28964 <indexterm role="concept">
28965 <primary>local part</primary>
28966 <secondary>checking in router</secondary>
28968 The router is run only if the local part of the address matches the list.
28969 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
28971 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
28972 string is expanded, it is possible to make it depend on the domain, for
28975 <literallayout class="monospaced">
28976 local_parts = dbm;/usr/local/specials/$domain
28979 <indexterm role="concept">
28980 <primary><varname>$local_part_data</varname></primary>
28982 If the match is achieved by a lookup, the data that the lookup returned
28983 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
28984 expansions of the router’s private options. You might use this option, for
28985 example, if you have a large number of local virtual domains, and you want to
28986 send all postmaster mail to the same place without having to set up an alias in
28987 each virtual domain:
28989 <literallayout class="monospaced">
28992 local_parts = postmaster
28993 data = postmaster@real.domain.example
28996 <indexterm role="option">
28997 <primary><option>log_as_local</option></primary>
29000 <informaltable frame="all">
29001 <tgroup cols="4" colsep="0" rowsep="0">
29002 <colspec colwidth="8*" align="left"/>
29003 <colspec colwidth="5*" align="center"/>
29004 <colspec colwidth="5*" align="center"/>
29005 <colspec colwidth="6*" align="right"/>
29008 <entry><option>log_as_local</option></entry>
29009 <entry>Use: <emphasis>routers</emphasis></entry>
29010 <entry>Type: <emphasis>boolean</emphasis></entry>
29011 <entry>Default: <emphasis>see below</emphasis></entry>
29017 <indexterm role="concept">
29018 <primary>log</primary>
29019 <secondary>delivery line</secondary>
29021 <indexterm role="concept">
29022 <primary>delivery</primary>
29023 <secondary>log line format</secondary>
29025 Exim has two logging styles for delivery, the idea being to make local
29026 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
29027 recipient address is given just as the local part, without a domain. The use of
29028 this style is controlled by this option. It defaults to true for the <command>accept</command>
29029 router, and false for all the others. This option applies only when a
29030 router assigns an address to a transport. It has no effect on routers that
29031 redirect addresses.
29034 <indexterm role="option">
29035 <primary><option>more</option></primary>
29038 <informaltable frame="all">
29039 <tgroup cols="4" colsep="0" rowsep="0">
29040 <colspec colwidth="8*" align="left"/>
29041 <colspec colwidth="5*" align="center"/>
29042 <colspec colwidth="5*" align="center"/>
29043 <colspec colwidth="6*" align="right"/>
29046 <entry><option>more</option></entry>
29047 <entry>Use: <emphasis>routers</emphasis></entry>
29048 <entry>Type: <emphasis>boolean</emphasis>†<emphasis></emphasis></entry>
29049 <entry>Default: <emphasis>true</emphasis></entry>
29055 The result of string expansion for this option must be a valid boolean value,
29056 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
29057 result causes an error, and delivery is deferred. If the expansion is forced to
29058 fail, the default value for the option (true) is used. Other failures cause
29059 delivery to be deferred.
29062 If this option is set false, and the router declines to handle the address, no
29063 further routers are tried, routing fails, and the address is bounced.
29064 <indexterm role="concept">
29065 <primary><option>self</option> option</primary>
29067 However, if the router explicitly passes an address to the following router by
29068 means of the setting
29070 <literallayout class="monospaced">
29074 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
29075 does not affect the behaviour if one of the precondition tests fails. In that
29076 case, the address is always passed to the next router.
29079 Note that <option>address_data</option> is not considered to be a precondition. If its
29080 expansion is forced to fail, the router declines, and the value of <option>more</option>
29081 controls what happens next.
29084 <indexterm role="option">
29085 <primary><option>pass_on_timeout</option></primary>
29088 <informaltable frame="all">
29089 <tgroup cols="4" colsep="0" rowsep="0">
29090 <colspec colwidth="8*" align="left"/>
29091 <colspec colwidth="5*" align="center"/>
29092 <colspec colwidth="5*" align="center"/>
29093 <colspec colwidth="6*" align="right"/>
29096 <entry><option>pass_on_timeout</option></entry>
29097 <entry>Use: <emphasis>routers</emphasis></entry>
29098 <entry>Type: <emphasis>boolean</emphasis></entry>
29099 <entry>Default: <emphasis>false</emphasis></entry>
29105 <indexterm role="concept">
29106 <primary>timeout</primary>
29107 <secondary>of router</secondary>
29109 <indexterm role="concept">
29110 <primary>router</primary>
29111 <secondary>timeout</secondary>
29113 If a router times out during a host lookup, it normally causes deferral of the
29114 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
29115 router, overriding <option>no_more</option>. This may be helpful for systems that are
29116 intermittently connected to the Internet, or those that want to pass to a smart
29117 host any messages that cannot immediately be delivered.
29120 There are occasional other temporary errors that can occur while doing DNS
29121 lookups. They are treated in the same way as a timeout, and this option
29122 applies to all of them.
29125 <indexterm role="option">
29126 <primary><option>pass_router</option></primary>
29129 <informaltable frame="all">
29130 <tgroup cols="4" colsep="0" rowsep="0">
29131 <colspec colwidth="8*" align="left"/>
29132 <colspec colwidth="5*" align="center"/>
29133 <colspec colwidth="5*" align="center"/>
29134 <colspec colwidth="6*" align="right"/>
29137 <entry><option>pass_router</option></entry>
29138 <entry>Use: <emphasis>routers</emphasis></entry>
29139 <entry>Type: <emphasis>string</emphasis></entry>
29140 <entry>Default: <emphasis>unset</emphasis></entry>
29146 <indexterm role="concept">
29147 <primary>router</primary>
29148 <secondary>go to after <quote>pass</quote></secondary>
29150 When a router returns <quote>pass</quote>, the address is normally handed on to the next
29151 router in sequence. This can be changed by setting <option>pass_router</option> to the name
29152 of another router. However (unlike <option>redirect_router</option>) the named router must
29153 be below the current router, to avoid loops. Note that this option applies only
29154 to the special case of <quote>pass</quote>. It does not apply when a router returns
29155 <quote>decline</quote>.
29158 <indexterm role="option">
29159 <primary><option>redirect_router</option></primary>
29162 <informaltable frame="all">
29163 <tgroup cols="4" colsep="0" rowsep="0">
29164 <colspec colwidth="8*" align="left"/>
29165 <colspec colwidth="5*" align="center"/>
29166 <colspec colwidth="5*" align="center"/>
29167 <colspec colwidth="6*" align="right"/>
29170 <entry><option>redirect_router</option></entry>
29171 <entry>Use: <emphasis>routers</emphasis></entry>
29172 <entry>Type: <emphasis>string</emphasis></entry>
29173 <entry>Default: <emphasis>unset</emphasis></entry>
29179 <indexterm role="concept">
29180 <primary>router</primary>
29181 <secondary>start at after redirection</secondary>
29183 Sometimes an administrator knows that it is pointless to reprocess addresses
29184 generated from alias or forward files with the same router again. For
29185 example, if an alias file translates real names into login ids there is no
29186 point searching the alias file a second time, especially if it is a large file.
29189 The <option>redirect_router</option> option can be set to the name of any router instance.
29190 It causes the routing of any generated addresses to start at the named router
29191 instead of at the first router. This option has no effect if the router in
29192 which it is set does not generate new addresses.
29195 <indexterm role="option">
29196 <primary><option>require_files</option></primary>
29199 <informaltable frame="all">
29200 <tgroup cols="4" colsep="0" rowsep="0">
29201 <colspec colwidth="8*" align="left"/>
29202 <colspec colwidth="5*" align="center"/>
29203 <colspec colwidth="5*" align="center"/>
29204 <colspec colwidth="6*" align="right"/>
29207 <entry><option>require_files</option></entry>
29208 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29209 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
29210 <entry>Default: <emphasis>unset</emphasis></entry>
29216 <indexterm role="concept">
29217 <primary>file</primary>
29218 <secondary>requiring for router</secondary>
29220 <indexterm role="concept">
29221 <primary>router</primary>
29222 <secondary>requiring file existence</secondary>
29224 This option provides a general mechanism for predicating the running of a
29225 router on the existence or non-existence of certain files or directories.
29226 Before running a router, as one of its precondition tests, Exim works its way
29227 through the <option>require_files</option> list, expanding each item separately.
29230 Because the list is split before expansion, any colons in expansion items must
29231 be doubled, or the facility for using a different list separator must be used.
29232 If any expansion is forced to fail, the item is ignored. Other expansion
29233 failures cause routing of the address to be deferred.
29236 If any expanded string is empty, it is ignored. Otherwise, except as described
29237 below, each string must be a fully qualified file path, optionally preceded by
29238 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
29239 existence of the files or directories. The router is skipped if any paths not
29240 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
29243 <indexterm role="concept">
29244 <primary>NFS</primary>
29246 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
29247 the message is deferred. This can happen when NFS-mounted filesystems are
29251 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
29252 options, so you cannot use it to check for the existence of a file in which to
29253 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
29254 full list of the order in which preconditions are evaluated.) However, as
29255 these options are all expanded, you can use the <option>exists</option> expansion condition
29256 to make such tests. The <option>require_files</option> option is intended for checking files
29257 that the router may be going to use internally, or which are needed by a
29258 transport (for example <filename>.procmailrc</filename>).
29261 During delivery, the <function>stat()</function> function is run as root, but there is a
29262 facility for some checking of the accessibility of a file by another user.
29263 This is not a proper permissions check, but just a <quote>rough</quote> check that
29264 operates as follows:
29267 If an item in a <option>require_files</option> list does not contain any forward slash
29268 characters, it is taken to be the user (and optional group, separated by a
29269 comma) to be checked for subsequent files in the list. If no group is specified
29270 but the user is specified symbolically, the gid associated with the uid is
29273 <literallayout class="monospaced">
29274 require_files = mail:/some/file
29275 require_files = $local_part:$home/.procmailrc
29278 If a user or group name in a <option>require_files</option> list does not exist, the
29279 <option>require_files</option> condition fails.
29282 Exim performs the check by scanning along the components of the file path, and
29283 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
29284 directories, and <quote>r</quote> access on the final file. Note that this means that file
29285 access control lists, if the operating system has them, are ignored.
29288 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
29289 incoming SMTP message, Exim is not running as root, but under its own uid. This
29290 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
29291 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
29292 user is not permitted to read one of the directories on the file’s path.
29295 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
29296 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
29297 without root access. In this case, if a check for access by a particular user
29298 is requested, Exim creates a subprocess that runs as that user, and tries the
29299 check again in that process.
29302 The default action for handling an unresolved EACCES is to consider it to
29303 be caused by a configuration error, and routing is deferred because the
29304 existence or non-existence of the file cannot be determined. However, in some
29305 circumstances it may be desirable to treat this condition as if the file did
29306 not exist. If the file name (or the exclamation mark that precedes the file
29307 name for non-existence) is preceded by a plus sign, the EACCES error is treated
29308 as if the file did not exist. For example:
29310 <literallayout class="monospaced">
29311 require_files = +/some/file
29314 If the router is not an essential part of verification (for example, it
29315 handles users’ <filename>.forward</filename> files), another solution is to set the <option>verify</option>
29316 option false so that the router is skipped when verifying.
29319 <indexterm role="option">
29320 <primary><option>retry_use_local_part</option></primary>
29323 <informaltable frame="all">
29324 <tgroup cols="4" colsep="0" rowsep="0">
29325 <colspec colwidth="8*" align="left"/>
29326 <colspec colwidth="5*" align="center"/>
29327 <colspec colwidth="5*" align="center"/>
29328 <colspec colwidth="6*" align="right"/>
29331 <entry><option>retry_use_local_part</option></entry>
29332 <entry>Use: <emphasis>routers</emphasis></entry>
29333 <entry>Type: <emphasis>boolean</emphasis></entry>
29334 <entry>Default: <emphasis>see below</emphasis></entry>
29340 <indexterm role="concept">
29341 <primary>hints database</primary>
29342 <secondary>retry keys</secondary>
29344 <indexterm role="concept">
29345 <primary>local part</primary>
29346 <secondary>in retry keys</secondary>
29348 When a delivery suffers a temporary routing failure, a retry record is created
29349 in Exim’s hints database. For addresses whose routing depends only on the
29350 domain, the key for the retry record should not involve the local part, but for
29351 other addresses, both the domain and the local part should be included.
29352 Usually, remote routing is of the former kind, and local routing is of the
29356 This option controls whether the local part is used to form the key for retry
29357 hints for addresses that suffer temporary errors while being handled by this
29358 router. The default value is true for any router that has <option>check_local_user</option>
29359 set, and false otherwise. Note that this option does not apply to hints keys
29360 for transport delays; they are controlled by a generic transport option of the
29364 The setting of <option>retry_use_local_part</option> applies only to the router on which it
29365 appears. If the router generates child addresses, they are routed
29366 independently; this setting does not become attached to them.
29369 <indexterm role="option">
29370 <primary><option>router_home_directory</option></primary>
29373 <informaltable frame="all">
29374 <tgroup cols="4" colsep="0" rowsep="0">
29375 <colspec colwidth="8*" align="left"/>
29376 <colspec colwidth="5*" align="center"/>
29377 <colspec colwidth="5*" align="center"/>
29378 <colspec colwidth="6*" align="right"/>
29381 <entry><option>router_home_directory</option></entry>
29382 <entry>Use: <emphasis>routers</emphasis></entry>
29383 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29384 <entry>Default: <emphasis>unset</emphasis></entry>
29390 <indexterm role="concept">
29391 <primary>router</primary>
29392 <secondary>home directory for</secondary>
29394 <indexterm role="concept">
29395 <primary>home directory</primary>
29396 <secondary>for router</secondary>
29398 <indexterm role="concept">
29399 <primary><varname>$home</varname></primary>
29401 This option sets a home directory for use while the router is running. (Compare
29402 <option>transport_home_directory</option>, which sets a home directory for later
29403 transporting.) In particular, if used on a <command>redirect</command> router, this option
29404 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
29405 forced expansion failure causes the option to be ignored – other failures
29406 cause the router to defer.
29409 Expansion of <option>router_home_directory</option> happens immediately after the
29410 <option>check_local_user</option> test (if configured), before any further expansions take
29412 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29414 While the router is running, <option>router_home_directory</option> overrides the value of
29415 <varname>$home</varname> that came from <option>check_local_user</option>.
29418 When a router accepts an address and assigns it to a local transport (including
29419 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
29420 delivery), the home directory setting for the transport is taken from the first
29421 of these values that is set:
29426 The <option>home_directory</option> option on the transport;
29431 The <option>transport_home_directory</option> option on the router;
29436 The password data if <option>check_local_user</option> is set on the router;
29441 The <option>router_home_directory</option> option on the router.
29446 In other words, <option>router_home_directory</option> overrides the password data for the
29447 router, but not for the transport.
29450 <indexterm role="option">
29451 <primary><option>self</option></primary>
29454 <informaltable frame="all">
29455 <tgroup cols="4" colsep="0" rowsep="0">
29456 <colspec colwidth="8*" align="left"/>
29457 <colspec colwidth="5*" align="center"/>
29458 <colspec colwidth="5*" align="center"/>
29459 <colspec colwidth="6*" align="right"/>
29462 <entry><option>self</option></entry>
29463 <entry>Use: <emphasis>routers</emphasis></entry>
29464 <entry>Type: <emphasis>string</emphasis></entry>
29465 <entry>Default: <emphasis>freeze</emphasis></entry>
29471 <indexterm role="concept">
29472 <primary>MX record</primary>
29473 <secondary>pointing to local host</secondary>
29475 <indexterm role="concept">
29476 <primary>local host</primary>
29477 <secondary>MX pointing to</secondary>
29479 This option applies to those routers that use a recipient address to find a
29480 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
29481 and <command>manualroute</command> routers.
29482 Certain configurations of the <command>queryprogram</command> router can also specify a list
29484 Usually such routers are configured to send the message to a remote host via an
29485 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
29486 host on the list turns out to be the local host.
29487 The way in which Exim checks for the local host is described in section
29488 <xref linkend="SECTreclocipadd"/>.
29491 Normally this situation indicates either an error in Exim’s configuration (for
29492 example, the router should be configured not to process this domain), or an
29493 error in the DNS (for example, the MX should not point to this host). For this
29494 reason, the default action is to log the incident, defer the address, and
29495 freeze the message. The following alternatives are provided for use in special
29500 <term><option>defer</option></term>
29503 Delivery of the message is tried again later, but the message is not frozen.
29505 </listitem></varlistentry>
29507 <term><option>reroute</option>: <<emphasis>domain</emphasis>></term>
29510 The domain is changed to the given domain, and the address is passed back to
29511 be reprocessed by the routers. No rewriting of headers takes place. This
29512 behaviour is essentially a redirection.
29514 </listitem></varlistentry>
29516 <term><option>reroute: rewrite:</option> <<emphasis>domain</emphasis>></term>
29519 The domain is changed to the given domain, and the address is passed back to be
29520 reprocessed by the routers. Any headers that contain the original domain are
29523 </listitem></varlistentry>
29525 <term><option>pass</option></term>
29528 <indexterm role="concept">
29529 <primary><option>more</option> option</primary>
29531 <indexterm role="concept">
29532 <primary><varname>$self_hostname</varname></primary>
29534 The router passes the address to the next router, or to the router named in the
29535 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
29536 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
29537 name of the local host that the router encountered. This can be used to
29538 distinguish between different cases for hosts with multiple names. The
29541 <literallayout class="monospaced">
29546 ensures that only those addresses that routed to the local host are passed on.
29547 Without <option>no_more</option>, addresses that were declined for other reasons would also
29548 be passed to the next router.
29550 </listitem></varlistentry>
29552 <term><option>fail</option></term>
29555 Delivery fails and an error report is generated.
29557 </listitem></varlistentry>
29559 <term><option>send</option></term>
29562 <indexterm role="concept">
29563 <primary>local host</primary>
29564 <secondary>sending to</secondary>
29566 The anomaly is ignored and the address is queued for the transport. This
29567 setting should be used with extreme caution. For an <command>smtp</command> transport, it
29568 makes sense only in cases where the program that is listening on the SMTP port
29569 is not this version of Exim. That is, it must be some other MTA, or Exim with a
29570 different configuration file that handles the domain in another way.
29572 </listitem></varlistentry>
29575 <indexterm role="option">
29576 <primary><option>senders</option></primary>
29579 <informaltable frame="all">
29580 <tgroup cols="4" colsep="0" rowsep="0">
29581 <colspec colwidth="8*" align="left"/>
29582 <colspec colwidth="5*" align="center"/>
29583 <colspec colwidth="5*" align="center"/>
29584 <colspec colwidth="6*" align="right"/>
29587 <entry><option>senders</option></entry>
29588 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29589 <entry>Type: <emphasis>address list</emphasis>†<emphasis></emphasis></entry>
29590 <entry>Default: <emphasis>unset</emphasis></entry>
29596 <indexterm role="concept">
29597 <primary>router</primary>
29598 <secondary>checking senders</secondary>
29600 If this option is set, the router is skipped unless the message’s sender
29601 address matches something on the list.
29602 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29606 There are issues concerning verification when the running of routers is
29607 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
29608 setting, it sets the sender to the null string. When using the <option>-bt</option> option
29609 to check a configuration file, it is necessary also to use the <option>-f</option> option to
29610 set an appropriate sender. For incoming mail, the sender is unset when
29611 verifying the sender, but is available when verifying any recipients. If the
29612 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
29616 <indexterm role="option">
29617 <primary><option>translate_ip_address</option></primary>
29620 <informaltable frame="all">
29621 <tgroup cols="4" colsep="0" rowsep="0">
29622 <colspec colwidth="8*" align="left"/>
29623 <colspec colwidth="5*" align="center"/>
29624 <colspec colwidth="5*" align="center"/>
29625 <colspec colwidth="6*" align="right"/>
29628 <entry><option>translate_ip_address</option></entry>
29629 <entry>Use: <emphasis>routers</emphasis></entry>
29630 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29631 <entry>Default: <emphasis>unset</emphasis></entry>
29637 <indexterm role="concept">
29638 <primary>IP address</primary>
29639 <secondary>translating</secondary>
29641 <indexterm role="concept">
29642 <primary>packet radio</primary>
29644 <indexterm role="concept">
29645 <primary>router</primary>
29646 <secondary>IP address translation</secondary>
29648 There exist some rare networking situations (for example, packet radio) where
29649 it is helpful to be able to translate IP addresses generated by normal routing
29650 mechanisms into other IP addresses, thus performing a kind of manual IP
29651 routing. This should be done only if the normal IP routing of the TCP/IP stack
29652 is inadequate or broken. Because this is an extremely uncommon requirement, the
29653 code to support this option is not included in the Exim binary unless
29654 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
29657 <indexterm role="concept">
29658 <primary><varname>$host_address</varname></primary>
29660 The <option>translate_ip_address</option> string is expanded for every IP address generated
29661 by the router, with the generated address set in <varname>$host_address</varname>. If the
29662 expansion is forced to fail, no action is taken.
29663 For any other expansion error, delivery of the message is deferred.
29664 If the result of the expansion is an IP address, that replaces the original
29665 address; otherwise the result is assumed to be a host name – this is looked
29666 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
29667 produce one or more replacement IP addresses. For example, to subvert all IP
29668 addresses in some specific networks, this could be added to a router:
29670 <literallayout class="monospaced">
29671 translate_ip_address = \
29672 ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
29676 The file would contain lines like
29678 <literallayout class="monospaced">
29679 10.2.3.128/26 some.host
29680 10.8.4.34/26 10.44.8.15
29683 You should not make use of this facility unless you really understand what you
29687 <indexterm role="option">
29688 <primary><option>transport</option></primary>
29691 <informaltable frame="all">
29692 <tgroup cols="4" colsep="0" rowsep="0">
29693 <colspec colwidth="8*" align="left"/>
29694 <colspec colwidth="5*" align="center"/>
29695 <colspec colwidth="5*" align="center"/>
29696 <colspec colwidth="6*" align="right"/>
29699 <entry><option>transport</option></entry>
29700 <entry>Use: <emphasis>routers</emphasis></entry>
29701 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29702 <entry>Default: <emphasis>unset</emphasis></entry>
29708 This option specifies the transport to be used when a router accepts an address
29709 and sets it up for delivery. A transport is never needed if a router is used
29710 only for verification. The value of the option is expanded at routing time,
29711 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
29712 and result must be the name of one of the configured transports. If it is not,
29713 delivery is deferred.
29716 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
29717 have some private options that set up transports for pipe and file deliveries
29718 (see chapter <xref linkend="CHAPredirect"/>).
29721 <indexterm role="option">
29722 <primary><option>transport_current_directory</option></primary>
29725 <informaltable frame="all">
29726 <tgroup cols="4" colsep="0" rowsep="0">
29727 <colspec colwidth="8*" align="left"/>
29728 <colspec colwidth="5*" align="center"/>
29729 <colspec colwidth="5*" align="center"/>
29730 <colspec colwidth="6*" align="right"/>
29733 <entry><option>transport_current_directory</option></entry>
29734 <entry>Use: <emphasis>routers</emphasis></entry>
29735 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29736 <entry>Default: <emphasis>unset</emphasis></entry>
29742 <indexterm role="concept">
29743 <primary>current directory for local transport</primary>
29745 This option associates a current directory with any address that is routed
29746 to a local transport. This can happen either because a transport is
29747 explicitly configured for the router, or because it generates a delivery to a
29748 file or a pipe. During the delivery process (that is, at transport time), this
29749 option string is expanded and is set as the current directory, unless
29750 overridden by a setting on the transport.
29751 If the expansion fails for any reason, including forced failure, an error is
29752 logged, and delivery is deferred.
29753 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
29757 <indexterm role="option">
29758 <primary><option>transport_home_directory</option></primary>
29761 <informaltable frame="all">
29762 <tgroup cols="4" colsep="0" rowsep="0">
29763 <colspec colwidth="8*" align="left"/>
29764 <colspec colwidth="5*" align="center"/>
29765 <colspec colwidth="5*" align="center"/>
29766 <colspec colwidth="6*" align="right"/>
29769 <entry><option>transport_home_directory</option></entry>
29770 <entry>Use: <emphasis>routers</emphasis></entry>
29771 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29772 <entry>Default: <emphasis>see below</emphasis></entry>
29778 <indexterm role="concept">
29779 <primary>home directory</primary>
29780 <secondary>for local transport</secondary>
29782 This option associates a home directory with any address that is routed to a
29783 local transport. This can happen either because a transport is explicitly
29784 configured for the router, or because it generates a delivery to a file or a
29785 pipe. During the delivery process (that is, at transport time), the option
29786 string is expanded and is set as the home directory, unless overridden by a
29787 setting of <option>home_directory</option> on the transport.
29788 If the expansion fails for any reason, including forced failure, an error is
29789 logged, and delivery is deferred.
29792 If the transport does not specify a home directory, and
29793 <option>transport_home_directory</option> is not set for the router, the home directory for
29794 the tranport is taken from the password data if <option>check_local_user</option> is set for
29795 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
29796 is set; if not, no home directory is set for the transport.
29799 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
29803 <indexterm role="option">
29804 <primary><option>unseen</option></primary>
29807 <informaltable frame="all">
29808 <tgroup cols="4" colsep="0" rowsep="0">
29809 <colspec colwidth="8*" align="left"/>
29810 <colspec colwidth="5*" align="center"/>
29811 <colspec colwidth="5*" align="center"/>
29812 <colspec colwidth="6*" align="right"/>
29815 <entry><option>unseen</option></entry>
29816 <entry>Use: <emphasis>routers</emphasis></entry>
29817 <entry>Type: <emphasis>boolean</emphasis>†<emphasis></emphasis></entry>
29818 <entry>Default: <emphasis>false</emphasis></entry>
29824 <indexterm role="concept">
29825 <primary>router</primary>
29826 <secondary>carrying on after success</secondary>
29828 The result of string expansion for this option must be a valid boolean value,
29829 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
29830 result causes an error, and delivery is deferred. If the expansion is forced to
29831 fail, the default value for the option (false) is used. Other failures cause
29832 delivery to be deferred.
29835 When this option is set true, routing does not cease if the router accepts the
29836 address. Instead, a copy of the incoming address is passed to the next router,
29837 overriding a false setting of <option>more</option>. There is little point in setting
29838 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
29839 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
29840 sometimes true and sometimes false).
29843 <indexterm role="concept">
29844 <primary>copy of message (<option>unseen</option> option)</primary>
29846 The <option>unseen</option> option can be used to cause copies of messages to be delivered
29847 to some other destination, while also carrying out a normal delivery. In
29848 effect, the current address is made into a <quote>parent</quote> that has two children –
29849 one that is delivered as specified by this router, and a clone that goes on to
29850 be routed further. For this reason, <option>unseen</option> may not be combined with the
29851 <option>one_time</option> option in a <command>redirect</command> router.
29854 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
29855 this router or by previous routers affect the <quote>unseen</quote> copy of the message
29856 only. The clone that continues to be processed by further routers starts with
29857 no added headers and none specified for removal. However, any data that was set
29858 by the <option>address_data</option> option in the current or previous routers is passed on.
29859 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
29860 qualifier in filter files.
29863 <indexterm role="option">
29864 <primary><option>user</option></primary>
29867 <informaltable frame="all">
29868 <tgroup cols="4" colsep="0" rowsep="0">
29869 <colspec colwidth="8*" align="left"/>
29870 <colspec colwidth="5*" align="center"/>
29871 <colspec colwidth="5*" align="center"/>
29872 <colspec colwidth="6*" align="right"/>
29875 <entry><option>user</option></entry>
29876 <entry>Use: <emphasis>routers</emphasis></entry>
29877 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29878 <entry>Default: <emphasis>see below</emphasis></entry>
29884 <indexterm role="concept">
29885 <primary>uid (user id)</primary>
29886 <secondary>local delivery</secondary>
29888 <indexterm role="concept">
29889 <primary>local transports</primary>
29890 <secondary>uid and gid</secondary>
29892 <indexterm role="concept">
29893 <primary>transport</primary>
29894 <secondary>local</secondary>
29896 <indexterm role="concept">
29897 <primary>router</primary>
29898 <secondary>user for filter processing</secondary>
29900 <indexterm role="concept">
29901 <primary>filter</primary>
29902 <secondary>user for processing</secondary>
29904 When a router queues an address for a transport, and the transport does not
29905 specify a user, the user given here is used when running the delivery process.
29906 The user may be specified numerically or by name. If expansion fails, the
29907 error is logged and delivery is deferred.
29908 This user is also used by the <command>redirect</command> router when running a filter file.
29909 The default is unset, except when <option>check_local_user</option> is set. In this case,
29910 the default is taken from the password information. If the user is specified as
29911 a name, and <option>group</option> is not set, the group associated with the user is used.
29912 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
29913 <xref linkend="CHAPenvironment"/>.
29916 <indexterm role="option">
29917 <primary><option>verify</option></primary>
29920 <informaltable frame="all">
29921 <tgroup cols="4" colsep="0" rowsep="0">
29922 <colspec colwidth="8*" align="left"/>
29923 <colspec colwidth="5*" align="center"/>
29924 <colspec colwidth="5*" align="center"/>
29925 <colspec colwidth="6*" align="right"/>
29928 <entry><option>verify</option></entry>
29929 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29930 <entry>Type: <emphasis>boolean</emphasis></entry>
29931 <entry>Default: <emphasis>true</emphasis></entry>
29937 Setting this option has the effect of setting <option>verify_sender</option> and
29938 <option>verify_recipient</option> to the same value.
29941 <indexterm role="option">
29942 <primary><option>verify_only</option></primary>
29945 <informaltable frame="all">
29946 <tgroup cols="4" colsep="0" rowsep="0">
29947 <colspec colwidth="8*" align="left"/>
29948 <colspec colwidth="5*" align="center"/>
29949 <colspec colwidth="5*" align="center"/>
29950 <colspec colwidth="6*" align="right"/>
29953 <entry><option>verify_only</option></entry>
29954 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29955 <entry>Type: <emphasis>boolean</emphasis></entry>
29956 <entry>Default: <emphasis>false</emphasis></entry>
29962 <indexterm role="concept">
29963 <primary>EXPN</primary>
29964 <secondary>with <option>verify_only</option></secondary>
29966 <indexterm role="concept">
29967 <primary><option>-bv</option> option</primary>
29969 <indexterm role="concept">
29970 <primary>router</primary>
29971 <secondary>used only when verifying</secondary>
29973 If this option is set, the router is used only when verifying an address or
29974 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
29975 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
29976 restricted to verifying only senders or recipients by means of
29977 <option>verify_sender</option> and <option>verify_recipient</option>.
29980 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
29981 SMTP message, Exim is not running as root, but under its own uid. If the router
29982 accesses any files, you need to make sure that they are accessible to the Exim
29986 <indexterm role="option">
29987 <primary><option>verify_recipient</option></primary>
29990 <informaltable frame="all">
29991 <tgroup cols="4" colsep="0" rowsep="0">
29992 <colspec colwidth="8*" align="left"/>
29993 <colspec colwidth="5*" align="center"/>
29994 <colspec colwidth="5*" align="center"/>
29995 <colspec colwidth="6*" align="right"/>
29998 <entry><option>verify_recipient</option></entry>
29999 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
30000 <entry>Type: <emphasis>boolean</emphasis></entry>
30001 <entry>Default: <emphasis>true</emphasis></entry>
30007 If this option is false, the router is skipped when verifying recipient
30009 or testing recipient verification using <option>-bv</option>.
30010 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30014 <indexterm role="option">
30015 <primary><option>verify_sender</option></primary>
30018 <informaltable frame="all">
30019 <tgroup cols="4" colsep="0" rowsep="0">
30020 <colspec colwidth="8*" align="left"/>
30021 <colspec colwidth="5*" align="center"/>
30022 <colspec colwidth="5*" align="center"/>
30023 <colspec colwidth="6*" align="right"/>
30026 <entry><option>verify_sender</option></entry>
30027 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
30028 <entry>Type: <emphasis>boolean</emphasis></entry>
30029 <entry>Default: <emphasis>true</emphasis></entry>
30035 If this option is false, the router is skipped when verifying sender addresses
30036 or testing sender verification using <option>-bvs</option>.
30037 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30039 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
30040 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
30045 <title>The accept router</title>
30047 <indexterm role="concept">
30048 <primary><command>accept</command> router</primary>
30050 <indexterm role="concept">
30051 <primary>routers</primary>
30052 <secondary><command>accept</command></secondary>
30054 The <command>accept</command> router has no private options of its own. Unless it is being
30055 used purely for verification (see <option>verify_only</option>) a transport is required to
30056 be defined by the generic <option>transport</option> option. If the preconditions that are
30057 specified by generic options are met, the router accepts the address and queues
30058 it for the given transport. The most common use of this router is for setting
30059 up deliveries to local mailboxes. For example:
30061 <literallayout class="monospaced">
30064 domains = mydomain.example
30066 transport = local_delivery
30069 The <option>domains</option> condition in this example checks the domain of the address, and
30070 <option>check_local_user</option> checks that the local part is the login of a local user.
30071 When both preconditions are met, the <command>accept</command> router runs, and queues the
30072 address for the <command>local_delivery</command> transport.
30076 <chapter id="CHAPdnslookup">
30077 <title>The dnslookup router</title>
30079 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
30080 <primary><command>dnslookup</command> router</primary>
30082 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
30083 <primary>routers</primary>
30084 <secondary><command>dnslookup</command></secondary>
30086 The <command>dnslookup</command> router looks up the hosts that handle mail for the
30087 recipient’s domain in the DNS. A transport must always be set for this router,
30088 unless <option>verify_only</option> is set.
30091 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
30092 SRV records. If none are found, or if SRV support is not configured,
30093 MX records are looked up. If no MX records exist, address records are sought.
30094 However, <option>mx_domains</option> can be set to disable the direct use of address
30098 MX records of equal priority are sorted by Exim into a random order. Exim then
30099 looks for address records for the host names obtained from MX or SRV records.
30100 When a host has more than one IP address, they are sorted into a random order,
30101 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
30102 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
30103 generic option, the router declines.
30106 Unless they have the highest priority (lowest MX value), MX records that point
30107 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
30108 are discarded, together with any other MX records of equal or lower priority.
30111 <indexterm role="concept">
30112 <primary>MX record</primary>
30113 <secondary>pointing to local host</secondary>
30115 <indexterm role="concept">
30116 <primary>local host</primary>
30117 <secondary>MX pointing to</secondary>
30119 <indexterm role="concept">
30120 <primary><option>self</option> option</primary>
30121 <secondary>in <command>dnslookup</command> router</secondary>
30123 If the host pointed to by the highest priority MX record, or looked up as an
30124 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
30125 happens is controlled by the generic <option>self</option> option.
30127 <section id="SECTprowitdnsloo">
30128 <title>Problems with DNS lookups</title>
30130 There have been problems with DNS servers when SRV records are looked up.
30131 Some mis-behaving servers return a DNS error or timeout when a non-existent
30132 SRV record is sought. Similar problems have in the past been reported for
30133 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
30134 problem, but it is heavy-handed because it is a global option.
30137 For this reason, there are two options, <option>srv_fail_domains</option> and
30138 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
30139 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
30140 an attempt to look up an SRV or MX record causes one of these results, and the
30141 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
30142 such record</quote>. In the case of an SRV lookup, this means that the router
30143 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
30144 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
30145 case routing fails.
30149 <title>Private options for dnslookup</title>
30151 <indexterm role="concept">
30152 <primary>options</primary>
30153 <secondary><command>dnslookup</command> router</secondary>
30155 The private options for the <command>dnslookup</command> router are as follows:
30158 <indexterm role="option">
30159 <primary><option>check_secondary_mx</option></primary>
30162 <informaltable frame="all">
30163 <tgroup cols="4" colsep="0" rowsep="0">
30164 <colspec colwidth="8*" align="left"/>
30165 <colspec colwidth="5*" align="center"/>
30166 <colspec colwidth="5*" align="center"/>
30167 <colspec colwidth="6*" align="right"/>
30170 <entry><option>check_secondary_mx</option></entry>
30171 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30172 <entry>Type: <emphasis>boolean</emphasis></entry>
30173 <entry>Default: <emphasis>false</emphasis></entry>
30179 <indexterm role="concept">
30180 <primary>MX record</primary>
30181 <secondary>checking for secondary</secondary>
30183 If this option is set, the router declines unless the local host is found in
30184 (and removed from) the list of hosts obtained by MX lookup. This can be used to
30185 process domains for which the local host is a secondary mail exchanger
30186 differently to other domains. The way in which Exim decides whether a host is
30187 the local host is described in section <xref linkend="SECTreclocipadd"/>.
30190 <indexterm role="option">
30191 <primary><option>check_srv</option></primary>
30194 <informaltable frame="all">
30195 <tgroup cols="4" colsep="0" rowsep="0">
30196 <colspec colwidth="8*" align="left"/>
30197 <colspec colwidth="5*" align="center"/>
30198 <colspec colwidth="5*" align="center"/>
30199 <colspec colwidth="6*" align="right"/>
30202 <entry><option>check_srv</option></entry>
30203 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30204 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30205 <entry>Default: <emphasis>unset</emphasis></entry>
30211 <indexterm role="concept">
30212 <primary>SRV record</primary>
30213 <secondary>enabling use of</secondary>
30215 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
30216 addition to MX and address records. The support is disabled by default. To
30217 enable SRV support, set the <option>check_srv</option> option to the name of the service
30218 required. For example,
30220 <literallayout class="monospaced">
30224 looks for SRV records that refer to the normal smtp service. The option is
30225 expanded, so the service name can vary from message to message or address
30226 to address. This might be helpful if SRV records are being used for a
30227 submission service. If the expansion is forced to fail, the <option>check_srv</option>
30228 option is ignored, and the router proceeds to look for MX records in the
30232 When the expansion succeeds, the router searches first for SRV records for
30233 the given service (it assumes TCP protocol). A single SRV record with a
30234 host name that consists of just a single dot indicates <quote>no such service for
30235 this domain</quote>; if this is encountered, the router declines. If other kinds of
30236 SRV record are found, they are used to construct a host list for delivery
30237 according to the rules of RFC 2782. MX records are not sought in this case.
30240 When no SRV records are found, MX records (and address records) are sought in
30241 the traditional way. In other words, SRV records take precedence over MX
30242 records, just as MX records take precedence over address records. Note that
30243 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
30244 defined it. It is apparently believed that MX records are sufficient for email
30245 and that SRV records should not be used for this purpose. However, SRV records
30246 have an additional <quote>weight</quote> feature which some people might find useful when
30247 trying to split an SMTP load between hosts of different power.
30250 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim’s behaviour
30251 when there is a DNS lookup error.
30254 <indexterm role="option">
30255 <primary><option>mx_domains</option></primary>
30258 <informaltable frame="all">
30259 <tgroup cols="4" colsep="0" rowsep="0">
30260 <colspec colwidth="8*" align="left"/>
30261 <colspec colwidth="5*" align="center"/>
30262 <colspec colwidth="5*" align="center"/>
30263 <colspec colwidth="6*" align="right"/>
30266 <entry><option>mx_domains</option></entry>
30267 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30268 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
30269 <entry>Default: <emphasis>unset</emphasis></entry>
30275 <indexterm role="concept">
30276 <primary>MX record</primary>
30277 <secondary>required to exist</secondary>
30279 <indexterm role="concept">
30280 <primary>SRV record</primary>
30281 <secondary>required to exist</secondary>
30283 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
30284 record in order to be recognised. (The name of this option could be improved.)
30285 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
30286 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
30289 <literallayout class="monospaced">
30290 mx_domains = ! *.discworld.fict.example : *.fict.example
30293 This specifies that messages addressed to a domain that matches the list but
30294 has no MX record should be bounced immediately instead of being routed using
30295 the address record.
30298 <indexterm role="option">
30299 <primary><option>mx_fail_domains</option></primary>
30302 <informaltable frame="all">
30303 <tgroup cols="4" colsep="0" rowsep="0">
30304 <colspec colwidth="8*" align="left"/>
30305 <colspec colwidth="5*" align="center"/>
30306 <colspec colwidth="5*" align="center"/>
30307 <colspec colwidth="6*" align="right"/>
30310 <entry><option>mx_fail_domains</option></entry>
30311 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30312 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
30313 <entry>Default: <emphasis>unset</emphasis></entry>
30319 If the DNS lookup for MX records for one of the domains in this list causes a
30320 DNS lookup error, Exim behaves as if no MX records were found. See section
30321 <xref linkend="SECTprowitdnsloo"/> for more discussion.
30324 <indexterm role="option">
30325 <primary><option>qualify_single</option></primary>
30328 <informaltable frame="all">
30329 <tgroup cols="4" colsep="0" rowsep="0">
30330 <colspec colwidth="8*" align="left"/>
30331 <colspec colwidth="5*" align="center"/>
30332 <colspec colwidth="5*" align="center"/>
30333 <colspec colwidth="6*" align="right"/>
30336 <entry><option>qualify_single</option></entry>
30337 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30338 <entry>Type: <emphasis>boolean</emphasis></entry>
30339 <entry>Default: <emphasis>true</emphasis></entry>
30345 <indexterm role="concept">
30346 <primary>DNS</primary>
30347 <secondary>resolver options</secondary>
30349 <indexterm role="concept">
30350 <primary>DNS</primary>
30351 <secondary>qualifying single-component names</secondary>
30353 When this option is true, the resolver option RES_DEFNAMES is set for DNS
30354 lookups. Typically, but not standardly, this causes the resolver to qualify
30355 single-component names with the default domain. For example, on a machine
30356 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
30357 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
30358 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
30359 <emphasis>resolv.conf</emphasis>.
30362 <indexterm role="option">
30363 <primary><option>rewrite_headers</option></primary>
30366 <informaltable frame="all">
30367 <tgroup cols="4" colsep="0" rowsep="0">
30368 <colspec colwidth="8*" align="left"/>
30369 <colspec colwidth="5*" align="center"/>
30370 <colspec colwidth="5*" align="center"/>
30371 <colspec colwidth="6*" align="right"/>
30374 <entry><option>rewrite_headers</option></entry>
30375 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30376 <entry>Type: <emphasis>boolean</emphasis></entry>
30377 <entry>Default: <emphasis>true</emphasis></entry>
30383 <indexterm role="concept">
30384 <primary>rewriting</primary>
30385 <secondary>header lines</secondary>
30387 <indexterm role="concept">
30388 <primary>header lines</primary>
30389 <secondary>rewriting</secondary>
30391 If the domain name in the address that is being processed is not fully
30392 qualified, it may be expanded to its full form by a DNS lookup. For example, if
30393 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
30394 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
30395 occur as a result of setting the <option>widen_domains</option> option. If
30396 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
30397 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
30398 header lines of the message are rewritten with the full domain name.
30401 This option should be turned off only when it is known that no message is
30402 ever going to be sent outside an environment where the abbreviation makes
30406 When an MX record is looked up in the DNS and matches a wildcard record, name
30407 servers normally return a record containing the name that has been looked up,
30408 making it impossible to detect whether a wildcard was present or not. However,
30409 some name servers have recently been seen to return the wildcard entry. If the
30410 name returned by a DNS lookup begins with an asterisk, it is not used for
30414 <indexterm role="option">
30415 <primary><option>same_domain_copy_routing</option></primary>
30418 <informaltable frame="all">
30419 <tgroup cols="4" colsep="0" rowsep="0">
30420 <colspec colwidth="8*" align="left"/>
30421 <colspec colwidth="5*" align="center"/>
30422 <colspec colwidth="5*" align="center"/>
30423 <colspec colwidth="6*" align="right"/>
30426 <entry><option>same_domain_copy_routing</option></entry>
30427 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30428 <entry>Type: <emphasis>boolean</emphasis></entry>
30429 <entry>Default: <emphasis>false</emphasis></entry>
30435 <indexterm role="concept">
30436 <primary>address</primary>
30437 <secondary>copying routing</secondary>
30439 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
30440 to the same list of hosts. However, this cannot be presumed, because the router
30441 options and preconditions may refer to the local part of the address. By
30442 default, therefore, Exim routes each address in a message independently. DNS
30443 servers run caches, so repeated DNS lookups are not normally expensive, and in
30444 any case, personal messages rarely have more than a few recipients.
30447 If you are running mailing lists with large numbers of subscribers at the same
30448 domain, and you are using a <command>dnslookup</command> router which is independent of the
30449 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
30450 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
30451 routes an address to a remote transport, any other unrouted addresses in the
30452 message that have the same domain are automatically given the same routing
30453 without processing them independently,
30454 provided the following conditions are met:
30459 No router that processed the address specified <option>headers_add</option> or
30460 <option>headers_remove</option>.
30465 The router did not change the address in any way, for example, by <quote>widening</quote>
30471 <indexterm role="option">
30472 <primary><option>search_parents</option></primary>
30475 <informaltable frame="all">
30476 <tgroup cols="4" colsep="0" rowsep="0">
30477 <colspec colwidth="8*" align="left"/>
30478 <colspec colwidth="5*" align="center"/>
30479 <colspec colwidth="5*" align="center"/>
30480 <colspec colwidth="6*" align="right"/>
30483 <entry><option>search_parents</option></entry>
30484 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30485 <entry>Type: <emphasis>boolean</emphasis></entry>
30486 <entry>Default: <emphasis>false</emphasis></entry>
30492 <indexterm role="concept">
30493 <primary>DNS</primary>
30494 <secondary>resolver options</secondary>
30496 When this option is true, the resolver option RES_DNSRCH is set for DNS
30497 lookups. This is different from the <option>qualify_single</option> option in that it
30498 applies to domains containing dots. Typically, but not standardly, it causes
30499 the resolver to search for the name in the current domain and in parent
30500 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
30501 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
30502 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
30503 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
30506 Setting this option true can cause problems in domains that have a wildcard MX
30507 record, because any domain that does not have its own MX record matches the
30511 <indexterm role="option">
30512 <primary><option>srv_fail_domains</option></primary>
30515 <informaltable frame="all">
30516 <tgroup cols="4" colsep="0" rowsep="0">
30517 <colspec colwidth="8*" align="left"/>
30518 <colspec colwidth="5*" align="center"/>
30519 <colspec colwidth="5*" align="center"/>
30520 <colspec colwidth="6*" align="right"/>
30523 <entry><option>srv_fail_domains</option></entry>
30524 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30525 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
30526 <entry>Default: <emphasis>unset</emphasis></entry>
30532 If the DNS lookup for SRV records for one of the domains in this list causes a
30533 DNS lookup error, Exim behaves as if no SRV records were found. See section
30534 <xref linkend="SECTprowitdnsloo"/> for more discussion.
30537 <indexterm role="option">
30538 <primary><option>widen_domains</option></primary>
30541 <informaltable frame="all">
30542 <tgroup cols="4" colsep="0" rowsep="0">
30543 <colspec colwidth="8*" align="left"/>
30544 <colspec colwidth="5*" align="center"/>
30545 <colspec colwidth="5*" align="center"/>
30546 <colspec colwidth="6*" align="right"/>
30549 <entry><option>widen_domains</option></entry>
30550 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30551 <entry>Type: <emphasis>string list</emphasis></entry>
30552 <entry>Default: <emphasis>unset</emphasis></entry>
30558 <indexterm role="concept">
30559 <primary>domain</primary>
30560 <secondary>partial; widening</secondary>
30562 If a DNS lookup fails and this option is set, each of its strings in turn is
30563 added onto the end of the domain, and the lookup is tried again. For example,
30566 <literallayout class="monospaced">
30567 widen_domains = fict.example:ref.example
30570 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
30571 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
30572 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
30573 and <option>search_parents</option> options can cause some widening to be undertaken inside
30574 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
30575 when verifying, unless <option>rewrite_headers</option> is false (not the default).
30579 <title>Effect of qualify_single and search_parents</title>
30581 When a domain from an envelope recipient is changed by the resolver as a result
30582 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
30583 corresponding address in the message’s header lines unless <option>rewrite_headers</option>
30584 is set false. Exim then re-routes the address, using the full domain.
30587 These two options affect only the DNS lookup that takes place inside the router
30588 for the domain of the address that is being routed. They do not affect lookups
30589 such as that implied by
30591 <literallayout class="monospaced">
30595 that may happen while processing a router precondition before the router is
30596 entered. No widening ever takes place for these lookups.
30597 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
30598 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
30604 <title>The ipliteral router</title>
30606 <indexterm role="concept">
30607 <primary><command>ipliteral</command> router</primary>
30609 <indexterm role="concept">
30610 <primary>domain literal</primary>
30611 <secondary>routing</secondary>
30613 <indexterm role="concept">
30614 <primary>routers</primary>
30615 <secondary><command>ipliteral</command></secondary>
30617 This router has no private options. Unless it is being used purely for
30618 verification (see <option>verify_only</option>) a transport is required to be defined by the
30619 generic <option>transport</option> option. The router accepts the address if its domain part
30620 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
30621 router handles the address
30623 <literallayout class="monospaced">
30627 by setting up delivery to the host with that IP address. IPv4 domain literals
30628 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
30629 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
30631 <literallayout class="monospaced">
30632 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
30635 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
30636 grounds that sooner or later somebody will try it.
30639 <indexterm role="concept">
30640 <primary><option>self</option> option</primary>
30641 <secondary>in <command>ipliteral</command> router</secondary>
30643 If the IP address matches something in <option>ignore_target_hosts</option>, the router
30644 declines. If an IP literal turns out to refer to the local host, the generic
30645 <option>self</option> option determines what happens.
30648 The RFCs require support for domain literals; however, their use is
30649 controversial in today’s Internet. If you want to use this router, you must
30650 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
30651 Exim will not recognize the domain literal syntax in addresses.
30656 <title>The iplookup router</title>
30658 <indexterm role="concept">
30659 <primary><command>iplookup</command> router</primary>
30661 <indexterm role="concept">
30662 <primary>routers</primary>
30663 <secondary><command>iplookup</command></secondary>
30665 The <command>iplookup</command> router was written to fulfil a specific requirement in
30666 Cambridge University (which in fact no longer exists). For this reason, it is
30667 not included in the binary of Exim by default. If you want to include it, you
30670 <literallayout class="monospaced">
30671 ROUTER_IPLOOKUP=yes
30674 in your <filename>Local/Makefile</filename> configuration file.
30677 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
30678 connection to one or more specific hosts. The host can then return the same or
30679 a different address – in effect rewriting the recipient address in the
30680 message’s envelope. The new address is then passed on to subsequent routers. If
30681 this process fails, the address can be passed on to other routers, or delivery
30682 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
30683 must not be specified for it.
30686 <indexterm role="concept">
30687 <primary>options</primary>
30688 <secondary><command>iplookup</command> router</secondary>
30690 <indexterm role="option">
30691 <primary><option>hosts</option></primary>
30694 <informaltable frame="all">
30695 <tgroup cols="4" colsep="0" rowsep="0">
30696 <colspec colwidth="8*" align="left"/>
30697 <colspec colwidth="5*" align="center"/>
30698 <colspec colwidth="5*" align="center"/>
30699 <colspec colwidth="6*" align="right"/>
30702 <entry><option>hosts</option></entry>
30703 <entry>Use: <emphasis>iplookup</emphasis></entry>
30704 <entry>Type: <emphasis>string</emphasis></entry>
30705 <entry>Default: <emphasis>unset</emphasis></entry>
30711 This option must be supplied. Its value is a colon-separated list of host
30712 names. The hosts are looked up using <function>gethostbyname()</function>
30713 (or <function>getipnodebyname()</function> when available)
30714 and are tried in order until one responds to the query. If none respond, what
30715 happens is controlled by <option>optional</option>.
30718 <indexterm role="option">
30719 <primary><option>optional</option></primary>
30722 <informaltable frame="all">
30723 <tgroup cols="4" colsep="0" rowsep="0">
30724 <colspec colwidth="8*" align="left"/>
30725 <colspec colwidth="5*" align="center"/>
30726 <colspec colwidth="5*" align="center"/>
30727 <colspec colwidth="6*" align="right"/>
30730 <entry><option>optional</option></entry>
30731 <entry>Use: <emphasis>iplookup</emphasis></entry>
30732 <entry>Type: <emphasis>boolean</emphasis></entry>
30733 <entry>Default: <emphasis>false</emphasis></entry>
30739 If <option>optional</option> is true, if no response is obtained from any host, the address
30740 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
30741 delivery to the address is deferred.
30744 <indexterm role="option">
30745 <primary><option>port</option></primary>
30748 <informaltable frame="all">
30749 <tgroup cols="4" colsep="0" rowsep="0">
30750 <colspec colwidth="8*" align="left"/>
30751 <colspec colwidth="5*" align="center"/>
30752 <colspec colwidth="5*" align="center"/>
30753 <colspec colwidth="6*" align="right"/>
30756 <entry><option>port</option></entry>
30757 <entry>Use: <emphasis>iplookup</emphasis></entry>
30758 <entry>Type: <emphasis>integer</emphasis></entry>
30759 <entry>Default: <emphasis>0</emphasis></entry>
30765 <indexterm role="concept">
30766 <primary>port</primary>
30767 <secondary><command>iplookup</command> router</secondary>
30769 This option must be supplied. It specifies the port number for the TCP or UDP
30773 <indexterm role="option">
30774 <primary><option>protocol</option></primary>
30777 <informaltable frame="all">
30778 <tgroup cols="4" colsep="0" rowsep="0">
30779 <colspec colwidth="8*" align="left"/>
30780 <colspec colwidth="5*" align="center"/>
30781 <colspec colwidth="5*" align="center"/>
30782 <colspec colwidth="6*" align="right"/>
30785 <entry><option>protocol</option></entry>
30786 <entry>Use: <emphasis>iplookup</emphasis></entry>
30787 <entry>Type: <emphasis>string</emphasis></entry>
30788 <entry>Default: <emphasis>udp</emphasis></entry>
30794 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
30795 protocols is to be used.
30798 <indexterm role="option">
30799 <primary><option>query</option></primary>
30802 <informaltable frame="all">
30803 <tgroup cols="4" colsep="0" rowsep="0">
30804 <colspec colwidth="8*" align="left"/>
30805 <colspec colwidth="5*" align="center"/>
30806 <colspec colwidth="5*" align="center"/>
30807 <colspec colwidth="6*" align="right"/>
30810 <entry><option>query</option></entry>
30811 <entry>Use: <emphasis>iplookup</emphasis></entry>
30812 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30813 <entry>Default: <emphasis><literal>$local_part@$domain $local_part@$domain</literal></emphasis></entry>
30819 This defines the content of the query that is sent to the remote hosts. The
30820 repetition serves as a way of checking that a response is to the correct query
30821 in the default case (see <option>response_pattern</option> below).
30824 <indexterm role="option">
30825 <primary><option>reroute</option></primary>
30828 <informaltable frame="all">
30829 <tgroup cols="4" colsep="0" rowsep="0">
30830 <colspec colwidth="8*" align="left"/>
30831 <colspec colwidth="5*" align="center"/>
30832 <colspec colwidth="5*" align="center"/>
30833 <colspec colwidth="6*" align="right"/>
30836 <entry><option>reroute</option></entry>
30837 <entry>Use: <emphasis>iplookup</emphasis></entry>
30838 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30839 <entry>Default: <emphasis>unset</emphasis></entry>
30845 If this option is not set, the rerouted address is precisely the byte string
30846 returned by the remote host, up to the first white space, if any. If set, the
30847 string is expanded to form the rerouted address. It can include parts matched
30848 in the response by <option>response_pattern</option> by means of numeric variables such as
30849 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
30850 whether or not a pattern is in use. In all cases, the rerouted address must end
30851 up in the form <emphasis>local_part@domain</emphasis>.
30854 <indexterm role="option">
30855 <primary><option>response_pattern</option></primary>
30858 <informaltable frame="all">
30859 <tgroup cols="4" colsep="0" rowsep="0">
30860 <colspec colwidth="8*" align="left"/>
30861 <colspec colwidth="5*" align="center"/>
30862 <colspec colwidth="5*" align="center"/>
30863 <colspec colwidth="6*" align="right"/>
30866 <entry><option>response_pattern</option></entry>
30867 <entry>Use: <emphasis>iplookup</emphasis></entry>
30868 <entry>Type: <emphasis>string</emphasis></entry>
30869 <entry>Default: <emphasis>unset</emphasis></entry>
30875 This option can be set to a regular expression that is applied to the string
30876 returned from the remote host. If the pattern does not match the response, the
30877 router declines. If <option>response_pattern</option> is not set, no checking of the
30878 response is done, unless the query was defaulted, in which case there is a
30879 check that the text returned after the first white space is the original
30880 address. This checks that the answer that has been received is in response to
30881 the correct question. For example, if the response is just a new domain, the
30882 following could be used:
30884 <literallayout class="monospaced">
30885 response_pattern = ^([^@]+)$
30886 reroute = $local_part@$1
30889 <indexterm role="option">
30890 <primary><option>timeout</option></primary>
30893 <informaltable frame="all">
30894 <tgroup cols="4" colsep="0" rowsep="0">
30895 <colspec colwidth="8*" align="left"/>
30896 <colspec colwidth="5*" align="center"/>
30897 <colspec colwidth="5*" align="center"/>
30898 <colspec colwidth="6*" align="right"/>
30901 <entry><option>timeout</option></entry>
30902 <entry>Use: <emphasis>iplookup</emphasis></entry>
30903 <entry>Type: <emphasis>time</emphasis></entry>
30904 <entry>Default: <emphasis>5s</emphasis></entry>
30910 This specifies the amount of time to wait for a response from the remote
30911 machine. The same timeout is used for the <function>connect()</function> function for a TCP
30912 call. It does not apply to UDP.
30917 <title>The manualroute router</title>
30919 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
30920 <primary><command>manualroute</command> router</primary>
30922 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
30923 <primary>routers</primary>
30924 <secondary><command>manualroute</command></secondary>
30926 <indexterm role="concept">
30927 <primary>domain</primary>
30928 <secondary>manually routing</secondary>
30930 The <command>manualroute</command> router is so-called because it provides a way of manually
30931 routing an address according to its domain. It is mainly used when you want to
30932 route addresses to remote hosts according to your own rules, bypassing the
30933 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
30934 route to local transports, a facility that may be useful if you want to save
30935 messages for dial-in hosts in local files.
30938 The <command>manualroute</command> router compares a list of domain patterns with the domain
30939 it is trying to route. If there is no match, the router declines. Each pattern
30940 has associated with it a list of hosts and some other optional data, which may
30941 include a transport. The combination of a pattern and its data is called a
30942 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
30943 generic <option>transport</option> option must specify a transport, unless the router is
30944 being used purely for verification (see <option>verify_only</option>).
30947 <indexterm role="concept">
30948 <primary><varname>$host</varname></primary>
30950 In the case of verification, matching the domain pattern is sufficient for the
30951 router to accept the address. When actually routing an address for delivery,
30952 an address that matches a domain pattern is queued for the associated
30953 transport. If the transport is not a local one, a host list must be associated
30954 with the pattern; IP addresses are looked up for the hosts, and these are
30955 passed to the transport along with the mail address. For local transports, a
30956 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
30960 The list of routing rules can be provided as an inline string in
30961 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
30962 or database by setting <option>route_data</option>. Only one of these settings may appear in
30963 any one instance of <command>manualroute</command>. The format of routing rules is described
30964 below, following the list of private options.
30966 <section id="SECTprioptman">
30967 <title>Private options for manualroute</title>
30969 <indexterm role="concept">
30970 <primary>options</primary>
30971 <secondary><command>manualroute</command> router</secondary>
30973 The private options for the <command>manualroute</command> router are as follows:
30976 <indexterm role="option">
30977 <primary><option>host_find_failed</option></primary>
30980 <informaltable frame="all">
30981 <tgroup cols="4" colsep="0" rowsep="0">
30982 <colspec colwidth="8*" align="left"/>
30983 <colspec colwidth="5*" align="center"/>
30984 <colspec colwidth="5*" align="center"/>
30985 <colspec colwidth="6*" align="right"/>
30988 <entry><option>host_find_failed</option></entry>
30989 <entry>Use: <emphasis>manualroute</emphasis></entry>
30990 <entry>Type: <emphasis>string</emphasis></entry>
30991 <entry>Default: <emphasis>freeze</emphasis></entry>
30997 This option controls what happens when <command>manualroute</command> tries to find an IP
30998 address for a host, and the host does not exist. The option can be set to one
31001 <literallayout class="monospaced">
31009 The default assumes that this state is a serious configuration error. The
31010 difference between <quote>pass</quote> and <quote>decline</quote> is that the former forces the
31011 address to be passed to the next router (or the router defined by
31012 <option>pass_router</option>),
31013 <indexterm role="concept">
31014 <primary><option>more</option> option</primary>
31016 overriding <option>no_more</option>, whereas the latter passes the address to the next
31017 router only if <option>more</option> is true.
31020 This option applies only to a definite <quote>does not exist</quote> state; if a host
31021 lookup gets a temporary error, delivery is deferred unless the generic
31022 <option>pass_on_timeout</option> option is set.
31025 <indexterm role="option">
31026 <primary><option>hosts_randomize</option></primary>
31029 <informaltable frame="all">
31030 <tgroup cols="4" colsep="0" rowsep="0">
31031 <colspec colwidth="8*" align="left"/>
31032 <colspec colwidth="5*" align="center"/>
31033 <colspec colwidth="5*" align="center"/>
31034 <colspec colwidth="6*" align="right"/>
31037 <entry><option>hosts_randomize</option></entry>
31038 <entry>Use: <emphasis>manualroute</emphasis></entry>
31039 <entry>Type: <emphasis>boolean</emphasis></entry>
31040 <entry>Default: <emphasis>false</emphasis></entry>
31046 <indexterm role="concept">
31047 <primary>randomized host list</primary>
31049 <indexterm role="concept">
31050 <primary>host</primary>
31051 <secondary>list of; randomized</secondary>
31053 If this option is set, the order of the items in a host list in a routing rule
31054 is randomized each time the list is used, unless an option in the routing rule
31055 overrides (see below). Randomizing the order of a host list can be used to do
31056 crude load sharing. However, if more than one mail address is routed by the
31057 same router to the same host list, the host lists are considered to be the same
31058 (even though they may be randomized into different orders) for the purpose of
31059 deciding whether to batch the deliveries into a single SMTP transaction.
31062 When <option>hosts_randomize</option> is true, a host list may be split
31063 into groups whose order is separately randomized. This makes it possible to
31064 set up MX-like behaviour. The boundaries between groups are indicated by an
31065 item that is just <literal>+</literal> in the host list. For example:
31067 <literallayout class="monospaced">
31068 route_list = * host1:host2:host3:+:host4:host5
31071 The order of the first three hosts and the order of the last two hosts is
31072 randomized for each use, but the first three always end up before the last two.
31073 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
31074 randomized host list is passed to an <command>smtp</command> transport that also has
31075 <option>hosts_randomize set</option>, the list is not re-randomized.
31078 <indexterm role="option">
31079 <primary><option>route_data</option></primary>
31082 <informaltable frame="all">
31083 <tgroup cols="4" colsep="0" rowsep="0">
31084 <colspec colwidth="8*" align="left"/>
31085 <colspec colwidth="5*" align="center"/>
31086 <colspec colwidth="5*" align="center"/>
31087 <colspec colwidth="6*" align="right"/>
31090 <entry><option>route_data</option></entry>
31091 <entry>Use: <emphasis>manualroute</emphasis></entry>
31092 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
31093 <entry>Default: <emphasis>unset</emphasis></entry>
31099 If this option is set, it must expand to yield the data part of a routing rule.
31100 Typically, the expansion string includes a lookup based on the domain. For
31103 <literallayout class="monospaced">
31104 route_data = ${lookup{$domain}dbm{/etc/routes}}
31107 If the expansion is forced to fail, or the result is an empty string, the
31108 router declines. Other kinds of expansion failure cause delivery to be
31112 <indexterm role="option">
31113 <primary><option>route_list</option></primary>
31116 <informaltable frame="all">
31117 <tgroup cols="4" colsep="0" rowsep="0">
31118 <colspec colwidth="8*" align="left"/>
31119 <colspec colwidth="5*" align="center"/>
31120 <colspec colwidth="5*" align="center"/>
31121 <colspec colwidth="6*" align="right"/>
31124 <entry><option>route_list</option></entry>
31125 <entry>Use: <emphasis>manualroute</emphasis></entry>
31126 <entry>Type: <emphasis> </emphasis></entry>
31127 <entry>Default: <emphasis>string</emphasis></entry>
31133 This string is a list of routing rules, in the form defined below. Note that,
31134 unlike most string lists, the items are separated by semicolons. This is so
31135 that they may contain colon-separated host lists.
31138 <indexterm role="option">
31139 <primary><option>same_domain_copy_routing</option></primary>
31142 <informaltable frame="all">
31143 <tgroup cols="4" colsep="0" rowsep="0">
31144 <colspec colwidth="8*" align="left"/>
31145 <colspec colwidth="5*" align="center"/>
31146 <colspec colwidth="5*" align="center"/>
31147 <colspec colwidth="6*" align="right"/>
31150 <entry><option>same_domain_copy_routing</option></entry>
31151 <entry>Use: <emphasis>manualroute</emphasis></entry>
31152 <entry>Type: <emphasis>boolean</emphasis></entry>
31153 <entry>Default: <emphasis>false</emphasis></entry>
31159 <indexterm role="concept">
31160 <primary>address</primary>
31161 <secondary>copying routing</secondary>
31163 Addresses with the same domain are normally routed by the <command>manualroute</command>
31164 router to the same list of hosts. However, this cannot be presumed, because the
31165 router options and preconditions may refer to the local part of the address. By
31166 default, therefore, Exim routes each address in a message independently. DNS
31167 servers run caches, so repeated DNS lookups are not normally expensive, and in
31168 any case, personal messages rarely have more than a few recipients.
31171 If you are running mailing lists with large numbers of subscribers at the same
31172 domain, and you are using a <command>manualroute</command> router which is independent of the
31173 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
31174 lookups for identical domains in one message. In this case, when
31175 <command>manualroute</command> routes an address to a remote transport, any other unrouted
31176 addresses in the message that have the same domain are automatically given the
31177 same routing without processing them independently. However, this is only done
31178 if <option>headers_add</option> and <option>headers_remove</option> are unset.
31182 <title>Routing rules in route_list</title>
31184 The value of <option>route_list</option> is a string consisting of a sequence of routing
31185 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
31186 entered as two semicolons. Alternatively, the list separator can be changed as
31187 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
31188 Empty rules are ignored. The format of each rule is
31191 <<emphasis>domain pattern</emphasis>> <<emphasis>list of hosts</emphasis>> <<emphasis>options</emphasis>>
31194 The following example contains two rules, each with a simple domain pattern and
31197 <literallayout class="monospaced">
31199 dict.ref.example mail-1.ref.example:mail-2.ref.example ; \
31200 thes.ref.example mail-3.ref.example:mail-4.ref.example
31203 The three parts of a rule are separated by white space. The pattern and the
31204 list of hosts can be enclosed in quotes if necessary, and if they are, the
31205 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
31206 single domain pattern, which is the only mandatory item in the rule. The
31207 pattern is in the same format as one item in a domain list (see section
31208 <xref linkend="SECTdomainlist"/>),
31209 except that it may not be the name of an interpolated file.
31210 That is, it may be wildcarded, or a regular expression, or a file or database
31211 lookup (with semicolons doubled, because of the use of semicolon as a separator
31212 in a <option>route_list</option>).
31215 The rules in <option>route_list</option> are searched in order until one of the patterns
31216 matches the domain that is being routed. The list of hosts and then options are
31217 then used as described below. If there is no match, the router declines. When
31218 <option>route_list</option> is set, <option>route_data</option> must not be set.
31222 <title>Routing rules in route_data</title>
31224 The use of <option>route_list</option> is convenient when there are only a small number of
31225 routing rules. For larger numbers, it is easier to use a file or database to
31226 hold the routing information, and use the <option>route_data</option> option instead.
31227 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
31228 Most commonly, <option>route_data</option> is set as a string that contains an
31229 expansion lookup. For example, suppose we place two routing rules in a file
31232 <literallayout class="monospaced">
31233 dict.ref.example: mail-1.ref.example:mail-2.ref.example
31234 thes.ref.example: mail-3.ref.example:mail-4.ref.example
31237 This data can be accessed by setting
31239 <literallayout class="monospaced">
31240 route_data = ${lookup{$domain}lsearch{/the/file/name}}
31243 Failure of the lookup results in an empty string, causing the router to
31244 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
31245 requirement is that the result of expanding the string is a list of hosts,
31246 possibly followed by options, separated by white space. The list of hosts must
31247 be enclosed in quotes if it contains white space.
31251 <title>Format of the list of hosts</title>
31253 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
31254 always separately expanded before use. If the expansion fails, the router
31255 declines. The result of the expansion must be a colon-separated list of names
31256 and/or IP addresses, optionally also including ports. The format of each item
31257 in the list is described in the next section. The list separator can be changed
31258 as described in section <xref linkend="SECTlistconstruct"/>.
31261 If the list of hosts was obtained from a <option>route_list</option> item, the following
31262 variables are set during its expansion:
31267 <indexterm role="concept">
31268 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
31269 <secondary>in <command>manualroute</command> router</secondary>
31271 If the domain was matched against a regular expression, the numeric variables
31272 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
31274 <literallayout class="monospaced">
31275 route_list = ^domain(\d+) host-$1.text.example
31280 <varname>$0</varname> is always set to the entire domain.
31285 <varname>$1</varname> is also set when partial matching is done in a file lookup.
31290 <indexterm role="concept">
31291 <primary><varname>$value</varname></primary>
31293 If the pattern that matched the domain was a lookup item, the data that was
31294 looked up is available in the expansion variable <varname>$value</varname>. For example:
31296 <literallayout class="monospaced">
31297 route_list = lsearch;;/some/file.routes $value
31302 Note the doubling of the semicolon in the pattern that is necessary because
31303 semicolon is the default route list separator.
31306 <section id="SECTformatonehostitem">
31307 <title>Format of one host item</title>
31309 Each item in the list of hosts is either a host name or an IP address,
31310 optionally with an attached port number. When no port is given, an IP address
31311 is not enclosed in brackets. When a port is specified, it overrides the port
31312 specification on the transport. The port is separated from the name or address
31313 by a colon. This leads to some complications:
31318 Because colon is the default separator for the list of hosts, either
31319 the colon that specifies a port must be doubled, or the list separator must
31320 be changed. The following two examples have the same effect:
31322 <literallayout class="monospaced">
31323 route_list = * "host1.tld::1225 : host2.tld::1226"
31324 route_list = * "<+ host1.tld:1225 + host2.tld:1226"
31329 When IPv6 addresses are involved, it gets worse, because they contain
31330 colons of their own. To make this case easier, it is permitted to
31331 enclose an IP address (either v4 or v6) in square brackets if a port
31332 number follows. For example:
31334 <literallayout class="monospaced">
31335 route_list = * "</ [10.1.1.1]:1225 / [::1]:1226"
31340 <section id="SECThostshowused">
31341 <title>How the list of hosts is used</title>
31343 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
31344 the hosts is tried, in the order specified, when carrying out the SMTP
31345 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
31346 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
31350 Hosts may be listed by name or by IP address. An unadorned name in the list of
31351 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
31352 interpreted as an indirection to a sublist of hosts obtained by looking up MX
31353 records in the DNS. For example:
31355 <literallayout class="monospaced">
31356 route_list = * x.y.z:p.q.r/MX:e.f.g
31359 If this feature is used with a port specifier, the port must come last. For
31362 <literallayout class="monospaced">
31363 route_list = * dom1.tld/mx::1225
31366 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
31367 randomized before any lookups are done. Exim then scans the list; for any name
31368 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
31369 be an interface on the local host and the item is not the first in the list,
31370 Exim discards it and any subsequent items. If it is the first item, what
31371 happens is controlled by the
31372 <indexterm role="concept">
31373 <primary><option>self</option> option</primary>
31374 <secondary>in <command>manualroute</command> router</secondary>
31376 <option>self</option> option of the router.
31379 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
31380 hosts obtained by looking up MX records for the name. This is always a DNS
31381 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
31382 below) are not relevant here. The order of these hosts is determined by the
31383 preference values in the MX records, according to the usual rules. Because
31384 randomizing happens before the MX lookup, it does not affect the order that is
31385 defined by MX preferences.
31388 If the local host is present in the sublist obtained from MX records, but is
31389 not the most preferred host in that list, it and any equally or less
31390 preferred hosts are removed before the sublist is inserted into the main list.
31393 If the local host is the most preferred host in the MX list, what happens
31394 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
31395 is not the first item (that is, there are previous hosts in the main list),
31396 Exim discards this name and any subsequent items in the main list.
31399 If the MX item is first in the list of hosts, and the local host is the
31400 most preferred host, what happens is controlled by the <option>self</option> option of the
31404 DNS failures when lookup up the MX records are treated in the same way as DNS
31405 failures when looking up IP addresses: <option>pass_on_timeout</option> and
31406 <option>host_find_failed</option> are used when relevant.
31409 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
31410 whether obtained from an MX lookup or not.
31413 <section id="SECThowoptused">
31414 <title>How the options are used</title>
31416 The options are a sequence of words; in practice no more than three are ever
31417 present. One of the words can be the name of a transport; this overrides the
31418 <option>transport</option> option on the router for this particular routing rule only. The
31419 other words (if present) control randomization of the list of hosts on a
31420 per-rule basis, and how the IP addresses of the hosts are to be found when
31421 routing to a remote transport. These options are as follows:
31426 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
31427 setting of <option>hosts_randomize</option> for this routing rule only.
31432 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
31433 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
31438 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
31439 find IP addresses. This function may ultimately cause a DNS lookup, but it may
31440 also look in <filename>/etc/hosts</filename> or other sources of information.
31445 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
31446 no address records are found. If there is a temporary DNS error (such as a
31447 timeout), delivery is deferred.
31454 <literallayout class="monospaced">
31455 route_list = domain1 host1:host2:host3 randomize bydns;\
31456 domain2 host4:host5
31459 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
31460 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
31461 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
31462 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
31466 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
31467 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
31468 instead of TRY_AGAIN. That is why the default action is to try a DNS
31469 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
31473 If no IP address for a host can be found, what happens is controlled by the
31474 <option>host_find_failed</option> option.
31477 <indexterm role="concept">
31478 <primary><varname>$host</varname></primary>
31480 When an address is routed to a local transport, IP addresses are not looked up.
31481 The host list is passed to the transport in the <varname>$host</varname> variable.
31485 <title>Manualroute examples</title>
31487 In some of the examples that follow, the presence of the <option>remote_smtp</option>
31488 transport, as defined in the default configuration file, is assumed:
31493 <indexterm role="concept">
31494 <primary>smart host</primary>
31495 <secondary>example router</secondary>
31497 The <command>manualroute</command> router can be used to forward all external mail to a
31498 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
31499 named domain list that contains your local domains, for example:
31501 <literallayout class="monospaced">
31502 domainlist local_domains = my.domain.example
31505 You can arrange for all other domains to be routed to a smart host by making
31506 your first router something like this:
31508 <literallayout class="monospaced">
31510 driver = manualroute
31511 domains = !+local_domains
31512 transport = remote_smtp
31513 route_list = * smarthost.ref.example
31516 This causes all non-local addresses to be sent to the single host
31517 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
31518 they are tried in order
31519 (but you can use <option>hosts_randomize</option> to vary the order each time).
31520 Another way of configuring the same thing is this:
31522 <literallayout class="monospaced">
31524 driver = manualroute
31525 transport = remote_smtp
31526 route_list = !+local_domains smarthost.ref.example
31529 There is no difference in behaviour between these two routers as they stand.
31530 However, they behave differently if <option>no_more</option> is added to them. In the first
31531 example, the router is skipped if the domain does not match the <option>domains</option>
31532 precondition; the following router is always tried. If the router runs, it
31533 always matches the domain and so can never decline. Therefore, <option>no_more</option>
31534 would have no effect. In the second case, the router is never skipped; it
31535 always runs. However, if it doesn’t match the domain, it declines. In this case
31536 <option>no_more</option> would prevent subsequent routers from running.
31541 <indexterm role="concept">
31542 <primary>mail hub example</primary>
31544 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
31545 records in the DNS and delivers it via its own private routing mechanism. Often
31546 the final destinations are behind a firewall, with the mail hub being the one
31547 machine that can connect to machines both inside and outside the firewall. The
31548 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
31549 to the correct hosts. For a small number of domains, the routing can be inline,
31550 using the <option>route_list</option> option, but for a larger number a file or database
31551 lookup is easier to manage.
31554 If the domain names are in fact the names of the machines to which the mail is
31555 to be sent by the mail hub, the configuration can be quite simple. For
31558 <literallayout class="monospaced">
31560 driver = manualroute
31561 transport = remote_smtp
31562 route_list = *.rhodes.tvs.example $domain
31565 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
31566 whose names are the same as the mail domains. A similar approach can be taken
31567 if the host name can be obtained from the domain name by a string manipulation
31568 that the expansion facilities can handle. Otherwise, a lookup based on the
31569 domain can be used to find the host:
31571 <literallayout class="monospaced">
31573 driver = manualroute
31574 transport = remote_smtp
31575 route_data = ${lookup {$domain} cdb {/internal/host/routes}}
31578 The result of the lookup must be the name or IP address of the host (or
31579 hosts) to which the address is to be routed. If the lookup fails, the route
31580 data is empty, causing the router to decline. The address then passes to the
31586 <indexterm role="concept">
31587 <primary>batched SMTP output example</primary>
31589 <indexterm role="concept">
31590 <primary>SMTP</primary>
31591 <secondary>batched outgoing; example</secondary>
31593 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
31594 SMTP format for onward transportation by some other means. This is one way of
31595 storing mail for a dial-up host when it is not connected. The route list entry
31596 can be as simple as a single domain name in a configuration like this:
31598 <literallayout class="monospaced">
31600 driver = manualroute
31601 transport = batchsmtp_appendfile
31602 route_list = saved.domain.example
31605 though often a pattern is used to pick up more than one domain. If there are
31606 several domains or groups of domains with different transport requirements,
31607 different transports can be listed in the routing information:
31609 <literallayout class="monospaced">
31611 driver = manualroute
31613 *.saved.domain1.example $domain batch_appendfile; \
31614 *.saved.domain2.example \
31615 ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
31619 <indexterm role="concept">
31620 <primary><varname>$domain</varname></primary>
31622 <indexterm role="concept">
31623 <primary><varname>$host</varname></primary>
31625 The first of these just passes the domain in the <varname>$host</varname> variable, which
31626 doesn’t achieve much (since it is also in <varname>$domain</varname>), but the second does a
31627 file lookup to find a value to pass, causing the router to decline to handle
31628 the address if the lookup fails.
31633 <indexterm role="concept">
31634 <primary>UUCP</primary>
31635 <secondary>example of router for</secondary>
31637 Routing mail directly to UUCP software is a specific case of the use of
31638 <command>manualroute</command> in a gateway to another mail environment. This is an example of
31639 one way it can be done:
31641 <literallayout class="monospaced">
31646 command = /usr/local/bin/uux -r - \
31647 ${substr_-5:$host}!rmail ${local_part}
31648 return_fail_output = true
31653 driver = manualroute
31655 ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
31658 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
31660 <literallayout class="monospaced">
31661 darksite.ethereal.example: darksite.UUCP
31664 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
31665 makes clear the distinction between the domain name
31666 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
31671 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
31672 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
31677 <chapter id="CHAPdriverlast">
31678 <title>The queryprogram router</title>
31680 <indexterm role="concept" id="IIDquerou1" class="startofrange">
31681 <primary><command>queryprogram</command> router</primary>
31683 <indexterm role="concept" id="IIDquerou2" class="startofrange">
31684 <primary>routers</primary>
31685 <secondary><command>queryprogram</command></secondary>
31687 <indexterm role="concept">
31688 <primary>routing</primary>
31689 <secondary>by external program</secondary>
31691 The <command>queryprogram</command> router routes an address by running an external command
31692 and acting on its output. This is an expensive way to route, and is intended
31693 mainly for use in lightly-loaded systems, or for performing experiments.
31694 However, if it is possible to use the precondition options (<option>domains</option>,
31695 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
31696 be used in special cases, even on a busy host. There are the following private
31698 <indexterm role="concept">
31699 <primary>options</primary>
31700 <secondary><command>queryprogram</command> router</secondary>
31704 <indexterm role="option">
31705 <primary><option>command</option></primary>
31708 <informaltable frame="all">
31709 <tgroup cols="4" colsep="0" rowsep="0">
31710 <colspec colwidth="8*" align="left"/>
31711 <colspec colwidth="5*" align="center"/>
31712 <colspec colwidth="5*" align="center"/>
31713 <colspec colwidth="6*" align="right"/>
31716 <entry><option>command</option></entry>
31717 <entry>Use: <emphasis>queryprogram</emphasis></entry>
31718 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
31719 <entry>Default: <emphasis>unset</emphasis></entry>
31725 This option must be set. It specifies the command that is to be run. The
31726 command is split up into a command name and arguments, and then each is
31727 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
31728 <xref linkend="CHAPpipetransport"/>).
31731 <indexterm role="option">
31732 <primary><option>command_group</option></primary>
31735 <informaltable frame="all">
31736 <tgroup cols="4" colsep="0" rowsep="0">
31737 <colspec colwidth="8*" align="left"/>
31738 <colspec colwidth="5*" align="center"/>
31739 <colspec colwidth="5*" align="center"/>
31740 <colspec colwidth="6*" align="right"/>
31743 <entry><option>command_group</option></entry>
31744 <entry>Use: <emphasis>queryprogram</emphasis></entry>
31745 <entry>Type: <emphasis>string</emphasis></entry>
31746 <entry>Default: <emphasis>unset</emphasis></entry>
31752 <indexterm role="concept">
31753 <primary>gid (group id)</primary>
31754 <secondary>in <command>queryprogram</command> router</secondary>
31756 This option specifies a gid to be set when running the command while routing an
31757 address for deliver. It must be set if <option>command_user</option> specifies a numerical
31758 uid. If it begins with a digit, it is interpreted as the numerical value of the
31759 gid. Otherwise it is looked up using <function>getgrnam()</function>.
31762 <indexterm role="option">
31763 <primary><option>command_user</option></primary>
31766 <informaltable frame="all">
31767 <tgroup cols="4" colsep="0" rowsep="0">
31768 <colspec colwidth="8*" align="left"/>
31769 <colspec colwidth="5*" align="center"/>
31770 <colspec colwidth="5*" align="center"/>
31771 <colspec colwidth="6*" align="right"/>
31774 <entry><option>command_user</option></entry>
31775 <entry>Use: <emphasis>queryprogram</emphasis></entry>
31776 <entry>Type: <emphasis>string</emphasis></entry>
31777 <entry>Default: <emphasis>unset</emphasis></entry>
31783 <indexterm role="concept">
31784 <primary>uid (user id)</primary>
31785 <secondary>for <command>queryprogram</command></secondary>
31787 This option must be set. It specifies the uid which is set when running the
31788 command while routing an address for delivery. If the value begins with a digit,
31789 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
31790 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
31791 not set, a value for the gid also.
31794 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
31795 root, which it does during a normal delivery in a conventional configuration.
31796 However, when an address is being verified during message reception, Exim is
31797 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
31798 is called from a non-root process, Exim cannot change uid or gid before running
31799 the command. In this circumstance the command runs under the current uid and
31803 <indexterm role="option">
31804 <primary><option>current_directory</option></primary>
31807 <informaltable frame="all">
31808 <tgroup cols="4" colsep="0" rowsep="0">
31809 <colspec colwidth="8*" align="left"/>
31810 <colspec colwidth="5*" align="center"/>
31811 <colspec colwidth="5*" align="center"/>
31812 <colspec colwidth="6*" align="right"/>
31815 <entry><option>current_directory</option></entry>
31816 <entry>Use: <emphasis>queryprogram</emphasis></entry>
31817 <entry>Type: <emphasis>string</emphasis></entry>
31818 <entry>Default: <emphasis>/</emphasis></entry>
31824 This option specifies an absolute path which is made the current directory
31825 before running the command.
31828 <indexterm role="option">
31829 <primary><option>timeout</option></primary>
31832 <informaltable frame="all">
31833 <tgroup cols="4" colsep="0" rowsep="0">
31834 <colspec colwidth="8*" align="left"/>
31835 <colspec colwidth="5*" align="center"/>
31836 <colspec colwidth="5*" align="center"/>
31837 <colspec colwidth="6*" align="right"/>
31840 <entry><option>timeout</option></entry>
31841 <entry>Use: <emphasis>queryprogram</emphasis></entry>
31842 <entry>Type: <emphasis>time</emphasis></entry>
31843 <entry>Default: <emphasis>1h</emphasis></entry>
31849 If the command does not complete within the timeout period, its process group
31850 is killed and the message is frozen. A value of zero time specifies no
31854 The standard output of the command is connected to a pipe, which is read when
31855 the command terminates. It should consist of a single line of output,
31856 containing up to five fields, separated by white space. The maximum length of
31857 the line is 1023 characters. Longer lines are silently truncated. The first
31858 field is one of the following words (case-insensitive):
31863 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
31869 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
31870 <option>no_more</option> is set.
31875 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
31876 subsequent text on the line is an error message. If the router is run as part
31877 of address verification during an incoming SMTP message, the message is
31878 included in the SMTP response.
31883 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
31884 subsequent text on the line is an error message which is logged. It is not
31885 included in any SMTP response.
31890 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
31895 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
31896 <option>pass_router</option>), overriding <option>no_more</option>.
31901 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
31902 new addresses, which are routed independently, starting with the first router,
31903 or the router specified by <option>redirect_router</option>, if set.
31908 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
31909 number of keyed data values, as follows (split into two lines here, to fit on
31912 <literallayout class="monospaced">
31913 ACCEPT TRANSPORT=<transport> HOSTS=<list of hosts>
31914 LOOKUP=byname|bydns DATA=<text>
31917 The data items can be given in any order, and all are optional. If no transport
31918 is included, the transport specified by the generic <option>transport</option> option is
31919 used. The list of hosts and the lookup type are needed only if the transport is
31920 an <command>smtp</command> transport that does not itself supply a list of hosts.
31923 The format of the list of hosts is the same as for the <command>manualroute</command> router.
31924 As well as host names and IP addresses with optional port numbers, as described
31925 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
31926 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
31927 (see section <xref linkend="SECThostshowused"/>).
31930 If the lookup type is not specified, Exim behaves as follows when trying to
31931 find an IP address for each host: First, a DNS lookup is done. If this yields
31932 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
31933 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
31934 result of the lookup is the result of that call.
31937 <indexterm role="concept">
31938 <primary><varname>$address_data</varname></primary>
31940 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
31941 variable. For example, this return line
31943 <literallayout class="monospaced">
31944 accept hosts=x1.y.example:x2.y.example data="rule1"
31947 routes the address to the default transport, passing a list of two hosts. When
31948 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
31949 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
31950 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
31954 <chapter id="CHAPredirect">
31955 <title>The redirect router</title>
31957 <indexterm role="concept" id="IIDredrou1" class="startofrange">
31958 <primary><command>redirect</command> router</primary>
31960 <indexterm role="concept" id="IIDredrou2" class="startofrange">
31961 <primary>routers</primary>
31962 <secondary><command>redirect</command></secondary>
31964 <indexterm role="concept">
31965 <primary>alias file</primary>
31966 <secondary>in a <command>redirect</command> router</secondary>
31968 <indexterm role="concept">
31969 <primary>address redirection</primary>
31970 <secondary><command>redirect</command> router</secondary>
31972 The <command>redirect</command> router handles several kinds of address redirection. Its most
31973 common uses are for resolving local part aliases from a central alias file
31974 (usually called <filename>/etc/aliases</filename>) and for handling users’ personal <filename>.forward</filename>
31975 files, but it has many other potential uses. The incoming address can be
31976 redirected in several different ways:
31981 It can be replaced by one or more new addresses which are themselves routed
31987 It can be routed to be delivered to a given file or directory.
31992 It can be routed to be delivered to a specified pipe command.
31997 It can cause an automatic reply to be generated.
32002 It can be forced to fail, with a custom error message.
32007 It can be temporarily deferred.
32012 It can be discarded.
32017 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
32018 However, there are some private options which define transports for delivery to
32019 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
32020 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
32023 <title>Redirection data</title>
32025 The router operates by interpreting a text string which it obtains either by
32026 expanding the contents of the <option>data</option> option, or by reading the entire
32027 contents of a file whose name is given in the <option>file</option> option. These two
32028 options are mutually exclusive. The first is commonly used for handling system
32029 aliases, in a configuration like this:
32031 <literallayout class="monospaced">
32034 data = ${lookup{$local_part}lsearch{/etc/aliases}}
32037 If the lookup fails, the expanded string in this example is empty. When the
32038 expansion of <option>data</option> results in an empty string, the router declines. A forced
32039 expansion failure also causes the router to decline; other expansion failures
32040 cause delivery to be deferred.
32043 A configuration using <option>file</option> is commonly used for handling users’
32044 <filename>.forward</filename> files, like this:
32046 <literallayout class="monospaced">
32050 file = $home/.forward
32054 If the file does not exist, or causes no action to be taken (for example, it is
32055 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
32056 is not the case when the file contains syntactically valid items that happen to
32057 yield empty addresses, for example, items containing only RFC 2822 address
32062 <title>Forward files and address verification</title>
32064 <indexterm role="concept">
32065 <primary>address redirection</primary>
32066 <secondary>while verifying</secondary>
32068 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users’
32069 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
32074 When Exim is receiving an incoming SMTP message from a remote host, it is
32075 running under the Exim uid, not as root. Exim is unable to change uid to read
32076 the file as the user, and it may not be able to read it as the Exim user. So in
32077 practice the router may not be able to operate.
32082 However, even when the router can operate, the existence of a <filename>.forward</filename> file
32083 is unimportant when verifying an address. What should be checked is whether the
32084 local part is a valid user name or not. Cutting out the redirection processing
32085 saves some resources.
32091 <title>Interpreting redirection data</title>
32093 <indexterm role="concept">
32094 <primary>Sieve filter</primary>
32095 <secondary>specifying in redirection data</secondary>
32097 <indexterm role="concept">
32098 <primary>filter</primary>
32099 <secondary>specifying in redirection data</secondary>
32101 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
32102 can be interpreted in two different ways:
32107 If the <option>allow_filter</option> option is set true, and the data begins with the text
32108 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
32109 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
32110 respectively. Details of the syntax and semantics of filter files are described
32111 in a separate document entitled <emphasis>Exim’s interfaces to mail filtering</emphasis>; this
32112 document is intended for use by end users.
32117 Otherwise, the data must be a comma-separated list of redirection items, as
32118 described in the next section.
32123 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
32124 in a non-filter redirection list must always be an absolute path. A filter may
32125 generate a relative path – how this is handled depends on the transport’s
32126 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
32127 for the <command>appendfile</command> transport.
32130 <section id="SECTitenonfilred">
32131 <title>Items in a non-filter redirection list</title>
32133 <indexterm role="concept">
32134 <primary>address redirection</primary>
32135 <secondary>non-filter list items</secondary>
32137 When the redirection data is not an Exim or Sieve filter, for example, if it
32138 comes from a conventional alias or forward file, it consists of a list of
32139 addresses, file names, pipe commands, or certain special items (see section
32140 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
32141 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
32142 depending on their default values. The items in the list are separated by
32143 commas or newlines.
32144 If a comma is required in an item, the entire item must be enclosed in double
32148 Lines starting with a # character are comments, and are ignored, and # may
32149 also appear following a comma, in which case everything between the # and the
32150 next newline character is ignored.
32153 If an item is entirely enclosed in double quotes, these are removed. Otherwise
32154 double quotes are retained because some forms of mail address require their use
32155 (but never to enclose the entire address). In the following description,
32156 <quote>item</quote> refers to what remains after any surrounding double quotes have been
32160 <indexterm role="concept">
32161 <primary><varname>$local_part</varname></primary>
32163 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
32164 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
32165 of the <option>quote_local_part</option> expansion operator, in case the local part contains
32166 special characters. For example, to redirect all mail for the domain
32167 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
32170 <literallayout class="monospaced">
32171 data = ${quote_local_part:$local_part}@newdomain.example
32174 <section id="SECTredlocmai">
32175 <title>Redirecting to a local mailbox</title>
32177 <indexterm role="concept">
32178 <primary>routing</primary>
32179 <secondary>loops in</secondary>
32181 <indexterm role="concept">
32182 <primary>loop while routing</primary>
32183 <secondary>avoidance of</secondary>
32185 <indexterm role="concept">
32186 <primary>address redirection</primary>
32187 <secondary>to local mailbox</secondary>
32189 A redirection item may safely be the same as the address currently under
32190 consideration. This does not cause a routing loop, because a router is
32191 automatically skipped if any ancestor of the address that is being processed
32192 is the same as the current address and was processed by the current router.
32193 Such an address is therefore passed to the following routers, so it is handled
32194 as if there were no redirection. When making this loop-avoidance test, the
32195 complete local part, including any prefix or suffix, is used.
32198 <indexterm role="concept">
32199 <primary>address redirection</primary>
32200 <secondary>local part without domain</secondary>
32202 Specifying the same local part without a domain is a common usage in personal
32203 filter files when the user wants to have messages delivered to the local
32204 mailbox and also forwarded elsewhere. For example, the user whose login is
32205 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
32207 <literallayout class="monospaced">
32208 cleo, cleopatra@egypt.example
32211 <indexterm role="concept">
32212 <primary>backslash in alias file</primary>
32214 <indexterm role="concept">
32215 <primary>alias file</primary>
32216 <secondary>backslash in</secondary>
32218 For compatibility with other MTAs, such unqualified local parts may be
32219 preceeded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
32220 it does make a difference if more than one domain is being handled
32224 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
32225 2822 address that does not include a domain, the item is qualified using the
32226 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
32227 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
32228 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
32231 Care must be taken if there are alias names for local users.
32232 Consider an MTA handling a single local domain where the system alias file
32235 <literallayout class="monospaced">
32239 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
32240 messages in the local mailbox, and also forward copies elsewhere. He creates
32243 <literallayout class="monospaced">
32244 Sam.Reman, spqr@reme.elsewhere.example
32247 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
32248 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
32249 second time round, because it has previously routed it,
32250 and the following routers presumably cannot handle the alias. The forward file
32251 should really contain
32253 <literallayout class="monospaced">
32254 spqr, spqr@reme.elsewhere.example
32257 but because this is such a common error, the <option>check_ancestor</option> option (see
32258 below) exists to provide a way to get round it. This is normally set on a
32259 <command>redirect</command> router that is handling users’ <filename>.forward</filename> files.
32262 <section id="SECTspecitredli">
32263 <title>Special items in redirection lists</title>
32265 In addition to addresses, the following types of item may appear in redirection
32266 lists (that is, in non-filter redirection data):
32271 <indexterm role="concept">
32272 <primary>pipe</primary>
32273 <secondary>in redirection list</secondary>
32275 <indexterm role="concept">
32276 <primary>address redirection</primary>
32277 <secondary>to pipe</secondary>
32279 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
32280 as a valid RFC 2822 address that includes a domain. A transport for running the
32281 command must be specified by the <option>pipe_transport</option> option.
32282 Normally, either the router or the transport specifies a user and a group under
32283 which to run the delivery. The default is to use the Exim user and group.
32286 Single or double quotes can be used for enclosing the individual arguments of
32287 the pipe command; no interpretation of escapes is done for single quotes. If
32288 the command contains a comma character, it is necessary to put the whole item
32289 in double quotes, for example:
32291 <literallayout class="monospaced">
32292 "|/some/command ready,steady,go"
32295 since items in redirection lists are terminated by commas. Do not, however,
32296 quote just the command. An item such as
32298 <literallayout class="monospaced">
32299 |"/some/command ready,steady,go"
32302 is interpreted as a pipe with a rather strange command name, and no arguments.
32307 <indexterm role="concept">
32308 <primary>file</primary>
32309 <secondary>in redirection list</secondary>
32311 <indexterm role="concept">
32312 <primary>address redirection</primary>
32313 <secondary>to file</secondary>
32315 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
32316 parse as a valid RFC 2822 address that includes a domain. For example,
32318 <literallayout class="monospaced">
32319 /home/world/minbari
32322 is treated as a file name, but
32324 <literallayout class="monospaced">
32325 /s=molari/o=babylon/@x400gate.way
32328 is treated as an address. For a file name, a transport must be specified using
32329 the <option>file_transport</option> option. However, if the generated path name ends with a
32330 forward slash character, it is interpreted as a directory name rather than a
32331 file name, and <option>directory_transport</option> is used instead.
32334 Normally, either the router or the transport specifies a user and a group under
32335 which to run the delivery. The default is to use the Exim user and group.
32338 <indexterm role="concept">
32339 <primary><filename>/dev/null</filename></primary>
32341 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
32342 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
32343 instead of a transport name. In this case the user and group are not used.
32348 <indexterm role="concept">
32349 <primary>included address list</primary>
32351 <indexterm role="concept">
32352 <primary>address redirection</primary>
32353 <secondary>included external list</secondary>
32355 If an item is of the form
32357 <literallayout class="monospaced">
32358 :include:<path name>
32361 a list of further items is taken from the given file and included at that
32362 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
32363 out-of-line addition to the list. The items in the included list are separated
32364 by commas or newlines and are not subject to expansion. If this is the first
32365 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
32366 the alias name. This example is incorrect:
32368 <literallayout class="monospaced">
32369 list1 :include:/opt/lists/list1
32372 It must be given as
32374 <literallayout class="monospaced">
32375 list1: :include:/opt/lists/list1
32380 <indexterm role="concept">
32381 <primary>address redirection</primary>
32382 <secondary>to black hole</secondary>
32384 Sometimes you want to throw away mail to a particular local part. Making the
32385 <option>data</option> option expand to an empty string does not work, because that causes
32386 the router to decline. Instead, the alias item
32387 <indexterm role="concept">
32388 <primary>black hole</primary>
32390 <indexterm role="concept">
32391 <primary>abandoning mail</primary>
32394 <literallayout class="monospaced">
32398 can be used. It does what its name implies. No delivery is done, and no error
32399 message is generated. This has the same effect as specifing <filename>/dev/null</filename>, but
32400 can be independently disabled.
32403 <emphasis role="bold">Warning</emphasis>: If <literal>:blackhole:</literal> appears anywhere in a redirection list, no
32404 delivery is done for the original local part, even if other redirection items
32405 are present. If you are generating a multi-item list (for example, by reading a
32406 database) and need the ability to provide a no-op item, you must use
32407 <filename>/dev/null</filename>.
32412 <indexterm role="concept">
32413 <primary>delivery</primary>
32414 <secondary>forcing failure</secondary>
32416 <indexterm role="concept">
32417 <primary>delivery</primary>
32418 <secondary>forcing deferral</secondary>
32420 <indexterm role="concept">
32421 <primary>failing delivery</primary>
32422 <secondary>forcing</secondary>
32424 <indexterm role="concept">
32425 <primary>deferred delivery</primary>
32426 <secondary>forcing</secondary>
32428 <indexterm role="concept">
32429 <primary>customizing</primary>
32430 <secondary>failure message</secondary>
32432 An attempt to deliver a particular address can be deferred or forced to fail by
32433 redirection items of the form
32435 <literallayout class="monospaced">
32440 respectively. When a redirection list contains such an item, it applies to the
32441 entire redirection; any other items in the list are ignored (<emphasis>:blackhole:</emphasis> is
32442 different). Any text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error
32443 text associated with the failure. For example, an alias file might contain:
32445 <literallayout class="monospaced">
32446 X.Employee: :fail: Gone away, no forwarding address
32449 In the case of an address that is being verified from an ACL or as the subject
32451 <indexterm role="concept">
32452 <primary>VRFY error text</primary>
32453 <secondary>display of</secondary>
32455 VRFY command, the text is included in the SMTP error response by
32457 <indexterm role="concept">
32458 <primary>EXPN error text</primary>
32459 <secondary>display of</secondary>
32461 The text is not included in the response to an EXPN command. In non-SMTP cases
32462 the text is included in the error message that Exim generates.
32465 <indexterm role="concept">
32466 <primary>SMTP</primary>
32467 <secondary>error codes</secondary>
32469 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
32470 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
32471 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
32472 followed by a space, and the very first digit is the same as the default error
32473 code, the code from the message is used instead. If the very first digit is
32474 incorrect, a panic error is logged, and the default code is used. You can
32475 suppress the use of the supplied code in a redirect router by setting the
32476 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
32480 <indexterm role="concept">
32481 <primary><varname>$acl_verify_message</varname></primary>
32483 In an ACL, an explicitly provided message overrides the default, but the
32484 default message is available in the variable <varname>$acl_verify_message</varname> and can
32485 therefore be included in a custom message if this is desired.
32488 Normally the error text is the rest of the redirection list – a comma does
32489 not terminate it – but a newline does act as a terminator. Newlines are not
32490 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
32491 as part of the continuation process, but they may exist in other kinds of
32492 lookup and in <emphasis>:include:</emphasis> files.
32495 During routing for message delivery (as opposed to verification), a redirection
32496 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
32497 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
32498 subsequent delivery attempt can happen at a later time. If an address is
32499 deferred for too long, it will ultimately fail, because the normal retry
32505 <indexterm role="concept">
32506 <primary>alias file</primary>
32507 <secondary>exception to default</secondary>
32509 Sometimes it is useful to use a single-key search type with a default (see
32510 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
32511 for exceptions to the default. These can be handled by aliasing them to
32513 <literallayout class="monospaced">
32517 This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command> router to
32518 decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which results in
32519 an empty redirection list has the same effect.
32525 <title>Duplicate addresses</title>
32527 <indexterm role="concept">
32528 <primary>duplicate addresses</primary>
32530 <indexterm role="concept">
32531 <primary>address duplicate</primary>
32532 <secondary>discarding</secondary>
32534 <indexterm role="concept">
32535 <primary>pipe</primary>
32536 <secondary>duplicated</secondary>
32538 Exim removes duplicate addresses from the list to which it is delivering, so as
32539 to deliver just one copy to each address. This does not apply to deliveries
32540 routed to pipes by different immediate parent addresses, but an indirect
32541 aliasing scheme of the type
32543 <literallayout class="monospaced">
32544 pipe: |/some/command $local_part
32549 does not work with a message that is addressed to both local parts, because
32550 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
32551 discarded as being the same as a previously handled address. However, a scheme
32554 <literallayout class="monospaced">
32555 localpart1: |/some/command $local_part
32556 localpart2: |/some/command $local_part
32559 does result in two different pipe deliveries, because the immediate parents of
32560 the pipes are distinct.
32564 <title>Repeated redirection expansion</title>
32566 <indexterm role="concept">
32567 <primary>repeated redirection expansion</primary>
32569 <indexterm role="concept">
32570 <primary>address redirection</primary>
32571 <secondary>repeated for each delivery attempt</secondary>
32573 When a message cannot be delivered to all of its recipients immediately,
32574 leading to two or more delivery attempts, redirection expansion is carried out
32575 afresh each time for those addresses whose children were not all previously
32576 delivered. If redirection is being used as a mailing list, this can lead to new
32577 members of the list receiving copies of old messages. The <option>one_time</option> option
32578 can be used to avoid this.
32582 <title>Errors in redirection lists</title>
32584 <indexterm role="concept">
32585 <primary>address redirection</primary>
32586 <secondary>errors</secondary>
32588 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
32589 error is skipped, and an entry is written to the main log. This may be useful
32590 for mailing lists that are automatically managed. Otherwise, if an error is
32591 detected while generating the list of new addresses, the original address is
32592 deferred. See also <option>syntax_errors_to</option>.
32596 <title>Private options for the redirect router</title>
32598 <indexterm role="concept">
32599 <primary>options</primary>
32600 <secondary><command>redirect</command> router</secondary>
32602 The private options for the <command>redirect</command> router are as follows:
32605 <indexterm role="option">
32606 <primary><option>allow_defer</option></primary>
32609 <informaltable frame="all">
32610 <tgroup cols="4" colsep="0" rowsep="0">
32611 <colspec colwidth="8*" align="left"/>
32612 <colspec colwidth="5*" align="center"/>
32613 <colspec colwidth="5*" align="center"/>
32614 <colspec colwidth="6*" align="right"/>
32617 <entry><option>allow_defer</option></entry>
32618 <entry>Use: <emphasis>redirect</emphasis></entry>
32619 <entry>Type: <emphasis>boolean</emphasis></entry>
32620 <entry>Default: <emphasis>false</emphasis></entry>
32626 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
32627 data, or the <option>defer</option> command in an Exim filter file.
32630 <indexterm role="option">
32631 <primary><option>allow_fail</option></primary>
32634 <informaltable frame="all">
32635 <tgroup cols="4" colsep="0" rowsep="0">
32636 <colspec colwidth="8*" align="left"/>
32637 <colspec colwidth="5*" align="center"/>
32638 <colspec colwidth="5*" align="center"/>
32639 <colspec colwidth="6*" align="right"/>
32642 <entry><option>allow_fail</option></entry>
32643 <entry>Use: <emphasis>redirect</emphasis></entry>
32644 <entry>Type: <emphasis>boolean</emphasis></entry>
32645 <entry>Default: <emphasis>false</emphasis></entry>
32651 <indexterm role="concept">
32652 <primary>failing delivery</primary>
32653 <secondary>from filter</secondary>
32655 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
32656 and the <option>fail</option> command may be used in an Exim filter file.
32659 <indexterm role="option">
32660 <primary><option>allow_filter</option></primary>
32663 <informaltable frame="all">
32664 <tgroup cols="4" colsep="0" rowsep="0">
32665 <colspec colwidth="8*" align="left"/>
32666 <colspec colwidth="5*" align="center"/>
32667 <colspec colwidth="5*" align="center"/>
32668 <colspec colwidth="6*" align="right"/>
32671 <entry><option>allow_filter</option></entry>
32672 <entry>Use: <emphasis>redirect</emphasis></entry>
32673 <entry>Type: <emphasis>boolean</emphasis></entry>
32674 <entry>Default: <emphasis>false</emphasis></entry>
32680 <indexterm role="concept">
32681 <primary>filter</primary>
32682 <secondary>enabling use of</secondary>
32684 <indexterm role="concept">
32685 <primary>Sieve filter</primary>
32686 <secondary>enabling use of</secondary>
32688 Setting this option allows Exim to interpret redirection data that starts with
32689 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
32690 are some features of Exim filter files that some administrators may wish to
32691 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
32694 It is also possible to lock out Exim filters or Sieve filters while allowing
32695 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
32698 The filter is run using the uid and gid set by the generic <option>user</option> and
32699 <option>group</option> options. These take their defaults from the password data if
32700 <option>check_local_user</option> is set, so in the normal case of users’ personal filter
32701 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
32702 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
32705 <indexterm role="option">
32706 <primary><option>allow_freeze</option></primary>
32709 <informaltable frame="all">
32710 <tgroup cols="4" colsep="0" rowsep="0">
32711 <colspec colwidth="8*" align="left"/>
32712 <colspec colwidth="5*" align="center"/>
32713 <colspec colwidth="5*" align="center"/>
32714 <colspec colwidth="6*" align="right"/>
32717 <entry><option>allow_freeze</option></entry>
32718 <entry>Use: <emphasis>redirect</emphasis></entry>
32719 <entry>Type: <emphasis>boolean</emphasis></entry>
32720 <entry>Default: <emphasis>false</emphasis></entry>
32726 <indexterm role="concept">
32727 <primary>freezing messages</primary>
32728 <secondary>allowing in filter</secondary>
32730 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
32731 This command is more normally encountered in system filters, and is disabled by
32732 default for redirection filters because it isn’t something you usually want to
32733 let ordinary users do.
32736 <indexterm role="option">
32737 <primary><option>check_ancestor</option></primary>
32740 <informaltable frame="all">
32741 <tgroup cols="4" colsep="0" rowsep="0">
32742 <colspec colwidth="8*" align="left"/>
32743 <colspec colwidth="5*" align="center"/>
32744 <colspec colwidth="5*" align="center"/>
32745 <colspec colwidth="6*" align="right"/>
32748 <entry><option>check_ancestor</option></entry>
32749 <entry>Use: <emphasis>redirect</emphasis></entry>
32750 <entry>Type: <emphasis>boolean</emphasis></entry>
32751 <entry>Default: <emphasis>false</emphasis></entry>
32757 This option is concerned with handling generated addresses that are the same
32758 as some address in the list of redirection ancestors of the current address.
32759 Although it is turned off by default in the code, it is set in the default
32760 configuration file for handling users’ <filename>.forward</filename> files. It is recommended
32761 for this use of the <command>redirect</command> router.
32764 When <option>check_ancestor</option> is set, if a generated address (including the domain)
32765 is the same as any ancestor of the current address, it is replaced by a copy of
32766 the current address. This helps in the case where local part A is aliased to B,
32767 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
32768 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
32769 <filename> jb/.forward</filename> contains:
32771 <literallayout class="monospaced">
32772 \Joe.Bloggs, <other item(s)>
32775 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
32776 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
32777 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
32778 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
32779 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
32780 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
32781 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
32782 original address. See also the <option>repeat_use</option> option below.
32785 <indexterm role="option">
32786 <primary><option>check_group</option></primary>
32789 <informaltable frame="all">
32790 <tgroup cols="4" colsep="0" rowsep="0">
32791 <colspec colwidth="8*" align="left"/>
32792 <colspec colwidth="5*" align="center"/>
32793 <colspec colwidth="5*" align="center"/>
32794 <colspec colwidth="6*" align="right"/>
32797 <entry><option>check_group</option></entry>
32798 <entry>Use: <emphasis>redirect</emphasis></entry>
32799 <entry>Type: <emphasis>boolean</emphasis></entry>
32800 <entry>Default: <emphasis>see below</emphasis></entry>
32806 When the <option>file</option> option is used, the group owner of the file is checked only
32807 when this option is set. The permitted groups are those listed in the
32808 <option>owngroups</option> option, together with the user’s default group if
32809 <option>check_local_user</option> is set. If the file has the wrong group, routing is
32810 deferred. The default setting for this option is true if <option>check_local_user</option>
32811 is set and the <option>modemask</option> option permits the group write bit, or if the
32812 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
32815 <indexterm role="option">
32816 <primary><option>check_owner</option></primary>
32819 <informaltable frame="all">
32820 <tgroup cols="4" colsep="0" rowsep="0">
32821 <colspec colwidth="8*" align="left"/>
32822 <colspec colwidth="5*" align="center"/>
32823 <colspec colwidth="5*" align="center"/>
32824 <colspec colwidth="6*" align="right"/>
32827 <entry><option>check_owner</option></entry>
32828 <entry>Use: <emphasis>redirect</emphasis></entry>
32829 <entry>Type: <emphasis>boolean</emphasis></entry>
32830 <entry>Default: <emphasis>see below</emphasis></entry>
32836 When the <option>file</option> option is used, the owner of the file is checked only when
32837 this option is set. If <option>check_local_user</option> is set, the local user is
32838 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
32839 option. The default value for this option is true if <option>check_local_user</option> or
32840 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
32843 <indexterm role="option">
32844 <primary><option>data</option></primary>
32847 <informaltable frame="all">
32848 <tgroup cols="4" colsep="0" rowsep="0">
32849 <colspec colwidth="8*" align="left"/>
32850 <colspec colwidth="5*" align="center"/>
32851 <colspec colwidth="5*" align="center"/>
32852 <colspec colwidth="6*" align="right"/>
32855 <entry><option>data</option></entry>
32856 <entry>Use: <emphasis>redirect</emphasis></entry>
32857 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
32858 <entry>Default: <emphasis>unset</emphasis></entry>
32864 This option is mutually exclusive with <option>file</option>. One or other of them must be
32865 set, but not both. The contents of <option>data</option> are expanded, and then used as the
32866 list of forwarding items, or as a set of filtering instructions. If the
32867 expansion is forced to fail, or the result is an empty string or a string that
32868 has no effect (consists entirely of comments), the router declines.
32871 When filtering instructions are used, the string must begin with <quote>#Exim
32872 filter</quote>, and all comments in the string, including this initial one, must be
32873 terminated with newline characters. For example:
32875 <literallayout class="monospaced">
32876 data = #Exim filter\n\
32877 if $h_to: contains Exim then save $home/mail/exim endif
32880 If you are reading the data from a database where newlines cannot be included,
32881 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
32882 choice into a newline.
32885 <indexterm role="option">
32886 <primary><option>directory_transport</option></primary>
32889 <informaltable frame="all">
32890 <tgroup cols="4" colsep="0" rowsep="0">
32891 <colspec colwidth="8*" align="left"/>
32892 <colspec colwidth="5*" align="center"/>
32893 <colspec colwidth="5*" align="center"/>
32894 <colspec colwidth="6*" align="right"/>
32897 <entry><option>directory_transport</option></entry>
32898 <entry>Use: <emphasis>redirect</emphasis></entry>
32899 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
32900 <entry>Default: <emphasis>unset</emphasis></entry>
32906 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
32907 ending with a slash is specified as a new <quote>address</quote>. The transport used is
32908 specified by this option, which, after expansion, must be the name of a
32909 configured transport. This should normally be an <command>appendfile</command> transport.
32912 <indexterm role="option">
32913 <primary><option>file</option></primary>
32916 <informaltable frame="all">
32917 <tgroup cols="4" colsep="0" rowsep="0">
32918 <colspec colwidth="8*" align="left"/>
32919 <colspec colwidth="5*" align="center"/>
32920 <colspec colwidth="5*" align="center"/>
32921 <colspec colwidth="6*" align="right"/>
32924 <entry><option>file</option></entry>
32925 <entry>Use: <emphasis>redirect</emphasis></entry>
32926 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
32927 <entry>Default: <emphasis>unset</emphasis></entry>
32933 This option specifies the name of a file that contains the redirection data. It
32934 is mutually exclusive with the <option>data</option> option. The string is expanded before
32935 use; if the expansion is forced to fail, the router declines. Other expansion
32936 failures cause delivery to be deferred. The result of a successful expansion
32937 must be an absolute path. The entire file is read and used as the redirection
32938 data. If the data is an empty string or a string that has no effect (consists
32939 entirely of comments), the router declines.
32942 <indexterm role="concept">
32943 <primary>NFS</primary>
32944 <secondary>checking for file existence</secondary>
32946 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
32947 runs a check on the containing directory,
32948 unless <option>ignore_enotdir</option> is true (see below).
32949 If the directory does not appear to exist, delivery is deferred. This can
32950 happen when users’ <filename>.forward</filename> files are in NFS-mounted directories, and there
32951 is a mount problem. If the containing directory does exist, but the file does
32952 not, the router declines.
32955 <indexterm role="option">
32956 <primary><option>file_transport</option></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>file_transport</option></entry>
32968 <entry>Use: <emphasis>redirect</emphasis></entry>
32969 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
32970 <entry>Default: <emphasis>unset</emphasis></entry>
32976 <indexterm role="concept">
32977 <primary><varname>$address_file</varname></primary>
32979 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
32980 ending in a slash is specified as a new <quote>address</quote>. The transport used is
32981 specified by this option, which, after expansion, must be the name of a
32982 configured transport. This should normally be an <command>appendfile</command> transport. When
32983 it is running, the file name is in <varname>$address_file</varname>.
32986 <indexterm role="option">
32987 <primary><option>filter_prepend_home</option></primary>
32990 <informaltable frame="all">
32991 <tgroup cols="4" colsep="0" rowsep="0">
32992 <colspec colwidth="8*" align="left"/>
32993 <colspec colwidth="5*" align="center"/>
32994 <colspec colwidth="5*" align="center"/>
32995 <colspec colwidth="6*" align="right"/>
32998 <entry><option>filter_prepend_home</option></entry>
32999 <entry>Use: <emphasis>redirect</emphasis></entry>
33000 <entry>Type: <emphasis>boolean</emphasis></entry>
33001 <entry>Default: <emphasis>true</emphasis></entry>
33007 When this option is true, if a <command>save</command> command in an Exim filter specifies a
33008 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
33009 relative path. If this option is set false, this action does not happen. The
33010 relative path is then passed to the transport unmodified.
33013 <indexterm role="option">
33014 <primary><option>forbid_blackhole</option></primary>
33017 <informaltable frame="all">
33018 <tgroup cols="4" colsep="0" rowsep="0">
33019 <colspec colwidth="8*" align="left"/>
33020 <colspec colwidth="5*" align="center"/>
33021 <colspec colwidth="5*" align="center"/>
33022 <colspec colwidth="6*" align="right"/>
33025 <entry><option>forbid_blackhole</option></entry>
33026 <entry>Use: <emphasis>redirect</emphasis></entry>
33027 <entry>Type: <emphasis>boolean</emphasis></entry>
33028 <entry>Default: <emphasis>false</emphasis></entry>
33034 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
33038 <indexterm role="option">
33039 <primary><option>forbid_exim_filter</option></primary>
33042 <informaltable frame="all">
33043 <tgroup cols="4" colsep="0" rowsep="0">
33044 <colspec colwidth="8*" align="left"/>
33045 <colspec colwidth="5*" align="center"/>
33046 <colspec colwidth="5*" align="center"/>
33047 <colspec colwidth="6*" align="right"/>
33050 <entry><option>forbid_exim_filter</option></entry>
33051 <entry>Use: <emphasis>redirect</emphasis></entry>
33052 <entry>Type: <emphasis>boolean</emphasis></entry>
33053 <entry>Default: <emphasis>false</emphasis></entry>
33059 If this option is set true, only Sieve filters are permitted when
33060 <option>allow_filter</option> is true.
33063 <indexterm role="option">
33064 <primary><option>forbid_file</option></primary>
33067 <informaltable frame="all">
33068 <tgroup cols="4" colsep="0" rowsep="0">
33069 <colspec colwidth="8*" align="left"/>
33070 <colspec colwidth="5*" align="center"/>
33071 <colspec colwidth="5*" align="center"/>
33072 <colspec colwidth="6*" align="right"/>
33075 <entry><option>forbid_file</option></entry>
33076 <entry>Use: <emphasis>redirect</emphasis></entry>
33077 <entry>Type: <emphasis>boolean</emphasis></entry>
33078 <entry>Default: <emphasis>false</emphasis></entry>
33084 <indexterm role="concept">
33085 <primary>delivery</primary>
33086 <secondary>to file; forbidding</secondary>
33088 <indexterm role="concept">
33089 <primary>Sieve filter</primary>
33090 <secondary>forbidding delivery to a file</secondary>
33092 <indexterm role="concept">
33093 <primary>Sieve filter</primary>
33094 <secondary><quote>keep</quote> facility; disabling</secondary>
33096 If this option is true, this router may not generate a new address that
33097 specifies delivery to a local file or directory, either from a filter or from a
33098 conventional forward file. This option is forced to be true if <option>one_time</option> is
33099 set. It applies to Sieve filters as well as to Exim filters, but if true, it
33100 locks out the Sieve’s <quote>keep</quote> facility.
33103 <indexterm role="option">
33104 <primary><option>forbid_filter_dlfunc</option></primary>
33107 <informaltable frame="all">
33108 <tgroup cols="4" colsep="0" rowsep="0">
33109 <colspec colwidth="8*" align="left"/>
33110 <colspec colwidth="5*" align="center"/>
33111 <colspec colwidth="5*" align="center"/>
33112 <colspec colwidth="6*" align="right"/>
33115 <entry><option>forbid_filter_dlfunc</option></entry>
33116 <entry>Use: <emphasis>redirect</emphasis></entry>
33117 <entry>Type: <emphasis>boolean</emphasis></entry>
33118 <entry>Default: <emphasis>false</emphasis></entry>
33124 <indexterm role="concept">
33125 <primary>filter</primary>
33126 <secondary>locking out certain features</secondary>
33128 If this option is true, string expansions in Exim filters are not allowed to
33129 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
33133 <indexterm role="option">
33134 <primary><option>forbid_filter_existstest</option></primary>
33137 <informaltable frame="all">
33138 <tgroup cols="4" colsep="0" rowsep="0">
33139 <colspec colwidth="8*" align="left"/>
33140 <colspec colwidth="5*" align="center"/>
33141 <colspec colwidth="5*" align="center"/>
33142 <colspec colwidth="6*" align="right"/>
33145 <entry><option>forbid_filter_existstest</option></entry>
33146 <entry>Use: <emphasis>redirect</emphasis></entry>
33147 <entry>Type: <emphasis>boolean</emphasis></entry>
33148 <entry>Default: <emphasis>false</emphasis></entry>
33154 <indexterm role="concept">
33155 <primary>expansion</primary>
33156 <secondary>statting a file</secondary>
33158 If this option is true, string expansions in Exim filters are not allowed to
33159 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
33162 <indexterm role="option">
33163 <primary><option>forbid_filter_logwrite</option></primary>
33166 <informaltable frame="all">
33167 <tgroup cols="4" colsep="0" rowsep="0">
33168 <colspec colwidth="8*" align="left"/>
33169 <colspec colwidth="5*" align="center"/>
33170 <colspec colwidth="5*" align="center"/>
33171 <colspec colwidth="6*" align="right"/>
33174 <entry><option>forbid_filter_logwrite</option></entry>
33175 <entry>Use: <emphasis>redirect</emphasis></entry>
33176 <entry>Type: <emphasis>boolean</emphasis></entry>
33177 <entry>Default: <emphasis>false</emphasis></entry>
33183 If this option is true, use of the logging facility in Exim filters is not
33184 permitted. Logging is in any case available only if the filter is being run
33185 under some unprivileged uid (which is normally the case for ordinary users’
33186 <filename>.forward</filename> files).
33189 <indexterm role="option">
33190 <primary><option>forbid_filter_lookup</option></primary>
33193 <informaltable frame="all">
33194 <tgroup cols="4" colsep="0" rowsep="0">
33195 <colspec colwidth="8*" align="left"/>
33196 <colspec colwidth="5*" align="center"/>
33197 <colspec colwidth="5*" align="center"/>
33198 <colspec colwidth="6*" align="right"/>
33201 <entry><option>forbid_filter_lookup</option></entry>
33202 <entry>Use: <emphasis>redirect</emphasis></entry>
33203 <entry>Type: <emphasis>boolean</emphasis></entry>
33204 <entry>Default: <emphasis>false</emphasis></entry>
33210 If this option is true, string expansions in Exim filter files are not allowed
33211 to make use of <option>lookup</option> items.
33214 <indexterm role="option">
33215 <primary><option>forbid_filter_perl</option></primary>
33218 <informaltable frame="all">
33219 <tgroup cols="4" colsep="0" rowsep="0">
33220 <colspec colwidth="8*" align="left"/>
33221 <colspec colwidth="5*" align="center"/>
33222 <colspec colwidth="5*" align="center"/>
33223 <colspec colwidth="6*" align="right"/>
33226 <entry><option>forbid_filter_perl</option></entry>
33227 <entry>Use: <emphasis>redirect</emphasis></entry>
33228 <entry>Type: <emphasis>boolean</emphasis></entry>
33229 <entry>Default: <emphasis>false</emphasis></entry>
33235 This option has an effect only if Exim is built with embedded Perl support. If
33236 it is true, string expansions in Exim filter files are not allowed to make use
33237 of the embedded Perl support.
33240 <indexterm role="option">
33241 <primary><option>forbid_filter_readfile</option></primary>
33244 <informaltable frame="all">
33245 <tgroup cols="4" colsep="0" rowsep="0">
33246 <colspec colwidth="8*" align="left"/>
33247 <colspec colwidth="5*" align="center"/>
33248 <colspec colwidth="5*" align="center"/>
33249 <colspec colwidth="6*" align="right"/>
33252 <entry><option>forbid_filter_readfile</option></entry>
33253 <entry>Use: <emphasis>redirect</emphasis></entry>
33254 <entry>Type: <emphasis>boolean</emphasis></entry>
33255 <entry>Default: <emphasis>false</emphasis></entry>
33261 If this option is true, string expansions in Exim filter files are not allowed
33262 to make use of <option>readfile</option> items.
33265 <indexterm role="option">
33266 <primary><option>forbid_filter_readsocket</option></primary>
33269 <informaltable frame="all">
33270 <tgroup cols="4" colsep="0" rowsep="0">
33271 <colspec colwidth="8*" align="left"/>
33272 <colspec colwidth="5*" align="center"/>
33273 <colspec colwidth="5*" align="center"/>
33274 <colspec colwidth="6*" align="right"/>
33277 <entry><option>forbid_filter_readsocket</option></entry>
33278 <entry>Use: <emphasis>redirect</emphasis></entry>
33279 <entry>Type: <emphasis>boolean</emphasis></entry>
33280 <entry>Default: <emphasis>false</emphasis></entry>
33286 If this option is true, string expansions in Exim filter files are not allowed
33287 to make use of <option>readsocket</option> items.
33290 <indexterm role="option">
33291 <primary><option>forbid_filter_reply</option></primary>
33294 <informaltable frame="all">
33295 <tgroup cols="4" colsep="0" rowsep="0">
33296 <colspec colwidth="8*" align="left"/>
33297 <colspec colwidth="5*" align="center"/>
33298 <colspec colwidth="5*" align="center"/>
33299 <colspec colwidth="6*" align="right"/>
33302 <entry><option>forbid_filter_reply</option></entry>
33303 <entry>Use: <emphasis>redirect</emphasis></entry>
33304 <entry>Type: <emphasis>boolean</emphasis></entry>
33305 <entry>Default: <emphasis>false</emphasis></entry>
33311 If this option is true, this router may not generate an automatic reply
33312 message. Automatic replies can be generated only from Exim or Sieve filter
33313 files, not from traditional forward files. This option is forced to be true if
33314 <option>one_time</option> is set.
33317 <indexterm role="option">
33318 <primary><option>forbid_filter_run</option></primary>
33321 <informaltable frame="all">
33322 <tgroup cols="4" colsep="0" rowsep="0">
33323 <colspec colwidth="8*" align="left"/>
33324 <colspec colwidth="5*" align="center"/>
33325 <colspec colwidth="5*" align="center"/>
33326 <colspec colwidth="6*" align="right"/>
33329 <entry><option>forbid_filter_run</option></entry>
33330 <entry>Use: <emphasis>redirect</emphasis></entry>
33331 <entry>Type: <emphasis>boolean</emphasis></entry>
33332 <entry>Default: <emphasis>false</emphasis></entry>
33338 If this option is true, string expansions in Exim filter files are not allowed
33339 to make use of <option>run</option> items.
33342 <indexterm role="option">
33343 <primary><option>forbid_include</option></primary>
33346 <informaltable frame="all">
33347 <tgroup cols="4" colsep="0" rowsep="0">
33348 <colspec colwidth="8*" align="left"/>
33349 <colspec colwidth="5*" align="center"/>
33350 <colspec colwidth="5*" align="center"/>
33351 <colspec colwidth="6*" align="right"/>
33354 <entry><option>forbid_include</option></entry>
33355 <entry>Use: <emphasis>redirect</emphasis></entry>
33356 <entry>Type: <emphasis>boolean</emphasis></entry>
33357 <entry>Default: <emphasis>false</emphasis></entry>
33363 If this option is true, items of the form
33365 <literallayout class="monospaced">
33366 :include:<path name>
33369 are not permitted in non-filter redirection lists.
33372 <indexterm role="option">
33373 <primary><option>forbid_pipe</option></primary>
33376 <informaltable frame="all">
33377 <tgroup cols="4" colsep="0" rowsep="0">
33378 <colspec colwidth="8*" align="left"/>
33379 <colspec colwidth="5*" align="center"/>
33380 <colspec colwidth="5*" align="center"/>
33381 <colspec colwidth="6*" align="right"/>
33384 <entry><option>forbid_pipe</option></entry>
33385 <entry>Use: <emphasis>redirect</emphasis></entry>
33386 <entry>Type: <emphasis>boolean</emphasis></entry>
33387 <entry>Default: <emphasis>false</emphasis></entry>
33393 <indexterm role="concept">
33394 <primary>delivery</primary>
33395 <secondary>to pipe; forbidding</secondary>
33397 If this option is true, this router may not generate a new address which
33398 specifies delivery to a pipe, either from an Exim filter or from a conventional
33399 forward file. This option is forced to be true if <option>one_time</option> is set.
33402 <indexterm role="option">
33403 <primary><option>forbid_sieve_filter</option></primary>
33406 <informaltable frame="all">
33407 <tgroup cols="4" colsep="0" rowsep="0">
33408 <colspec colwidth="8*" align="left"/>
33409 <colspec colwidth="5*" align="center"/>
33410 <colspec colwidth="5*" align="center"/>
33411 <colspec colwidth="6*" align="right"/>
33414 <entry><option>forbid_sieve_filter</option></entry>
33415 <entry>Use: <emphasis>redirect</emphasis></entry>
33416 <entry>Type: <emphasis>boolean</emphasis></entry>
33417 <entry>Default: <emphasis>false</emphasis></entry>
33423 If this option is set true, only Exim filters are permitted when
33424 <option>allow_filter</option> is true.
33427 <indexterm role="concept">
33428 <primary>SMTP</primary>
33429 <secondary>error codes</secondary>
33431 <indexterm role="option">
33432 <primary><option>forbid_smtp_code</option></primary>
33435 <informaltable frame="all">
33436 <tgroup cols="4" colsep="0" rowsep="0">
33437 <colspec colwidth="8*" align="left"/>
33438 <colspec colwidth="5*" align="center"/>
33439 <colspec colwidth="5*" align="center"/>
33440 <colspec colwidth="6*" align="right"/>
33443 <entry><option>forbid_smtp_code</option></entry>
33444 <entry>Use: <emphasis>redirect</emphasis></entry>
33445 <entry>Type: <emphasis>boolean</emphasis></entry>
33446 <entry>Default: <emphasis>false</emphasis></entry>
33452 If this option is set true, any SMTP error codes that are present at the start
33453 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
33454 the default codes (451 and 550, respectively) are always used.
33457 <indexterm role="option">
33458 <primary><option>hide_child_in_errmsg</option></primary>
33461 <informaltable frame="all">
33462 <tgroup cols="4" colsep="0" rowsep="0">
33463 <colspec colwidth="8*" align="left"/>
33464 <colspec colwidth="5*" align="center"/>
33465 <colspec colwidth="5*" align="center"/>
33466 <colspec colwidth="6*" align="right"/>
33469 <entry><option>hide_child_in_errmsg</option></entry>
33470 <entry>Use: <emphasis>redirect</emphasis></entry>
33471 <entry>Type: <emphasis>boolean</emphasis></entry>
33472 <entry>Default: <emphasis>false</emphasis></entry>
33478 <indexterm role="concept">
33479 <primary>bounce message</primary>
33480 <secondary>redirection details; suppressing</secondary>
33482 If this option is true, it prevents Exim from quoting a child address if it
33483 generates a bounce or delay message for it. Instead it says <quote>an address
33484 generated from <<emphasis>the top level address</emphasis>></quote>. Of course, this applies only to
33485 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
33486 bounce may well quote the generated address.
33489 <indexterm role="option">
33490 <primary><option>ignore_eacces</option></primary>
33493 <informaltable frame="all">
33494 <tgroup cols="4" colsep="0" rowsep="0">
33495 <colspec colwidth="8*" align="left"/>
33496 <colspec colwidth="5*" align="center"/>
33497 <colspec colwidth="5*" align="center"/>
33498 <colspec colwidth="6*" align="right"/>
33501 <entry><option>ignore_eacces</option></entry>
33502 <entry>Use: <emphasis>redirect</emphasis></entry>
33503 <entry>Type: <emphasis>boolean</emphasis></entry>
33504 <entry>Default: <emphasis>false</emphasis></entry>
33510 <indexterm role="concept">
33511 <primary>EACCES</primary>
33513 If this option is set and an attempt to open a redirection file yields the
33514 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
33515 file did not exist.
33518 <indexterm role="option">
33519 <primary><option>ignore_enotdir</option></primary>
33522 <informaltable frame="all">
33523 <tgroup cols="4" colsep="0" rowsep="0">
33524 <colspec colwidth="8*" align="left"/>
33525 <colspec colwidth="5*" align="center"/>
33526 <colspec colwidth="5*" align="center"/>
33527 <colspec colwidth="6*" align="right"/>
33530 <entry><option>ignore_enotdir</option></entry>
33531 <entry>Use: <emphasis>redirect</emphasis></entry>
33532 <entry>Type: <emphasis>boolean</emphasis></entry>
33533 <entry>Default: <emphasis>false</emphasis></entry>
33539 <indexterm role="concept">
33540 <primary>ENOTDIR</primary>
33542 If this option is set and an attempt to open a redirection file yields the
33543 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
33544 router behaves as if the file did not exist.
33547 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
33548 router that has the <option>file</option> option set discovers that the file does not exist
33549 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
33550 against unmounted NFS directories. If the parent can not be statted, delivery
33551 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
33552 is set, because that option tells Exim to ignore <quote>something on the path is not
33553 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
33554 that some operating systems give ENOENT where others give ENOTDIR.
33557 <indexterm role="option">
33558 <primary><option>include_directory</option></primary>
33561 <informaltable frame="all">
33562 <tgroup cols="4" colsep="0" rowsep="0">
33563 <colspec colwidth="8*" align="left"/>
33564 <colspec colwidth="5*" align="center"/>
33565 <colspec colwidth="5*" align="center"/>
33566 <colspec colwidth="6*" align="right"/>
33569 <entry><option>include_directory</option></entry>
33570 <entry>Use: <emphasis>redirect</emphasis></entry>
33571 <entry>Type: <emphasis>string</emphasis></entry>
33572 <entry>Default: <emphasis>unset</emphasis></entry>
33578 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
33579 redirection list must start with this directory.
33582 <indexterm role="option">
33583 <primary><option>modemask</option></primary>
33586 <informaltable frame="all">
33587 <tgroup cols="4" colsep="0" rowsep="0">
33588 <colspec colwidth="8*" align="left"/>
33589 <colspec colwidth="5*" align="center"/>
33590 <colspec colwidth="5*" align="center"/>
33591 <colspec colwidth="6*" align="right"/>
33594 <entry><option>modemask</option></entry>
33595 <entry>Use: <emphasis>redirect</emphasis></entry>
33596 <entry>Type: <emphasis>octal integer</emphasis></entry>
33597 <entry>Default: <emphasis>022</emphasis></entry>
33603 This specifies mode bits which must not be set for a file specified by the
33604 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
33607 <indexterm role="option">
33608 <primary><option>one_time</option></primary>
33611 <informaltable frame="all">
33612 <tgroup cols="4" colsep="0" rowsep="0">
33613 <colspec colwidth="8*" align="left"/>
33614 <colspec colwidth="5*" align="center"/>
33615 <colspec colwidth="5*" align="center"/>
33616 <colspec colwidth="6*" align="right"/>
33619 <entry><option>one_time</option></entry>
33620 <entry>Use: <emphasis>redirect</emphasis></entry>
33621 <entry>Type: <emphasis>boolean</emphasis></entry>
33622 <entry>Default: <emphasis>false</emphasis></entry>
33628 <indexterm role="concept">
33629 <primary>one-time aliasing/forwarding expansion</primary>
33631 <indexterm role="concept">
33632 <primary>alias file</primary>
33633 <secondary>one-time expansion</secondary>
33635 <indexterm role="concept">
33636 <primary>forward file</primary>
33637 <secondary>one-time expansion</secondary>
33639 <indexterm role="concept">
33640 <primary>mailing lists</primary>
33641 <secondary>one-time expansion</secondary>
33643 <indexterm role="concept">
33644 <primary>address redirection</primary>
33645 <secondary>one-time expansion</secondary>
33647 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
33648 files each time it tries to deliver a message causes a problem when one or more
33649 of the generated addresses fails be delivered at the first attempt. The problem
33650 is not one of duplicate delivery – Exim is clever enough to handle that –
33651 but of what happens when the redirection list changes during the time that the
33652 message is on Exim’s queue. This is particularly true in the case of mailing
33653 lists, where new subscribers might receive copies of messages that were posted
33654 before they subscribed.
33657 If <option>one_time</option> is set and any addresses generated by the router fail to
33658 deliver at the first attempt, the failing addresses are added to the message as
33659 <quote>top level</quote> addresses, and the parent address that generated them is marked
33660 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
33664 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
33665 router would be lost if delivery did not succeed at the first attempt. For this
33666 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
33667 permitted when <option>one_time</option> is set.
33670 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
33671 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
33672 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
33675 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
33676 <option>one_time</option>.
33679 The original top-level address is remembered with each of the generated
33680 addresses, and is output in any log messages. However, any intermediate parent
33681 addresses are not recorded. This makes a difference to the log only if
33682 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
33683 typically be used for mailing lists, where there is normally just one level of
33687 <indexterm role="option">
33688 <primary><option>owners</option></primary>
33691 <informaltable frame="all">
33692 <tgroup cols="4" colsep="0" rowsep="0">
33693 <colspec colwidth="8*" align="left"/>
33694 <colspec colwidth="5*" align="center"/>
33695 <colspec colwidth="5*" align="center"/>
33696 <colspec colwidth="6*" align="right"/>
33699 <entry><option>owners</option></entry>
33700 <entry>Use: <emphasis>redirect</emphasis></entry>
33701 <entry>Type: <emphasis>string list</emphasis></entry>
33702 <entry>Default: <emphasis>unset</emphasis></entry>
33708 <indexterm role="concept">
33709 <primary>ownership</primary>
33710 <secondary>alias file</secondary>
33712 <indexterm role="concept">
33713 <primary>ownership</primary>
33714 <secondary>forward file</secondary>
33716 <indexterm role="concept">
33717 <primary>alias file</primary>
33718 <secondary>ownership</secondary>
33720 <indexterm role="concept">
33721 <primary>forward file</primary>
33722 <secondary>ownership</secondary>
33724 This specifies a list of permitted owners for the file specified by <option>file</option>.
33725 This list is in addition to the local user when <option>check_local_user</option> is set.
33726 See <option>check_owner</option> above.
33729 <indexterm role="option">
33730 <primary><option>owngroups</option></primary>
33733 <informaltable frame="all">
33734 <tgroup cols="4" colsep="0" rowsep="0">
33735 <colspec colwidth="8*" align="left"/>
33736 <colspec colwidth="5*" align="center"/>
33737 <colspec colwidth="5*" align="center"/>
33738 <colspec colwidth="6*" align="right"/>
33741 <entry><option>owngroups</option></entry>
33742 <entry>Use: <emphasis>redirect</emphasis></entry>
33743 <entry>Type: <emphasis>string list</emphasis></entry>
33744 <entry>Default: <emphasis>unset</emphasis></entry>
33750 This specifies a list of permitted groups for the file specified by <option>file</option>.
33751 The list is in addition to the local user’s primary group when
33752 <option>check_local_user</option> is set. See <option>check_group</option> above.
33755 <indexterm role="option">
33756 <primary><option>pipe_transport</option></primary>
33759 <informaltable frame="all">
33760 <tgroup cols="4" colsep="0" rowsep="0">
33761 <colspec colwidth="8*" align="left"/>
33762 <colspec colwidth="5*" align="center"/>
33763 <colspec colwidth="5*" align="center"/>
33764 <colspec colwidth="6*" align="right"/>
33767 <entry><option>pipe_transport</option></entry>
33768 <entry>Use: <emphasis>redirect</emphasis></entry>
33769 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33770 <entry>Default: <emphasis>unset</emphasis></entry>
33776 <indexterm role="concept">
33777 <primary><varname>$address_pipe</varname></primary>
33779 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
33780 starting with a vertical bar character is specified as a new <quote>address</quote>. The
33781 transport used is specified by this option, which, after expansion, must be the
33782 name of a configured transport. This should normally be a <command>pipe</command> transport.
33783 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
33786 <indexterm role="option">
33787 <primary><option>qualify_domain</option></primary>
33790 <informaltable frame="all">
33791 <tgroup cols="4" colsep="0" rowsep="0">
33792 <colspec colwidth="8*" align="left"/>
33793 <colspec colwidth="5*" align="center"/>
33794 <colspec colwidth="5*" align="center"/>
33795 <colspec colwidth="6*" align="right"/>
33798 <entry><option>qualify_domain</option></entry>
33799 <entry>Use: <emphasis>redirect</emphasis></entry>
33800 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33801 <entry>Default: <emphasis>unset</emphasis></entry>
33807 <indexterm role="concept">
33808 <primary><varname>$qualify_recipient</varname></primary>
33810 If this option is set, and an unqualified address (one without a domain) is
33811 generated, and that address would normally be qualified by the global setting
33812 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
33813 expanding this string. If the expansion fails, the router declines. If you want
33814 to revert to the default, you can have the expansion generate
33815 <varname>$qualify_recipient</varname>.
33818 This option applies to all unqualified addresses generated by Exim filters,
33819 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
33820 not preceded by a backslash. Sieve filters cannot generate unqualified
33824 <indexterm role="option">
33825 <primary><option>qualify_preserve_domain</option></primary>
33828 <informaltable frame="all">
33829 <tgroup cols="4" colsep="0" rowsep="0">
33830 <colspec colwidth="8*" align="left"/>
33831 <colspec colwidth="5*" align="center"/>
33832 <colspec colwidth="5*" align="center"/>
33833 <colspec colwidth="6*" align="right"/>
33836 <entry><option>qualify_preserve_domain</option></entry>
33837 <entry>Use: <emphasis>redirect</emphasis></entry>
33838 <entry>Type: <emphasis>boolean</emphasis></entry>
33839 <entry>Default: <emphasis>false</emphasis></entry>
33845 <indexterm role="concept">
33846 <primary>domain</primary>
33847 <secondary>in redirection; preserving</secondary>
33849 <indexterm role="concept">
33850 <primary>preserving domain in redirection</primary>
33852 <indexterm role="concept">
33853 <primary>address redirection</primary>
33854 <secondary>domain; preserving</secondary>
33856 If this option is set, the router’s local <option>qualify_domain</option> option must not be
33857 set (a configuration error occurs if it is). If an unqualified address (one
33858 without a domain) is generated, it is qualified with the domain of the parent
33859 address (the immediately preceding ancestor) instead of the global
33860 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
33861 this applies whether or not the address is preceded by a backslash.
33864 <indexterm role="option">
33865 <primary><option>repeat_use</option></primary>
33868 <informaltable frame="all">
33869 <tgroup cols="4" colsep="0" rowsep="0">
33870 <colspec colwidth="8*" align="left"/>
33871 <colspec colwidth="5*" align="center"/>
33872 <colspec colwidth="5*" align="center"/>
33873 <colspec colwidth="6*" align="right"/>
33876 <entry><option>repeat_use</option></entry>
33877 <entry>Use: <emphasis>redirect</emphasis></entry>
33878 <entry>Type: <emphasis>boolean</emphasis></entry>
33879 <entry>Default: <emphasis>true</emphasis></entry>
33885 If this option is set false, the router is skipped for a child address that has
33886 any ancestor that was routed by this router. This test happens before any of
33887 the other preconditions are tested. Exim’s default anti-looping rules skip
33888 only when the ancestor is the same as the current address. See also
33889 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
33892 <indexterm role="option">
33893 <primary><option>reply_transport</option></primary>
33896 <informaltable frame="all">
33897 <tgroup cols="4" colsep="0" rowsep="0">
33898 <colspec colwidth="8*" align="left"/>
33899 <colspec colwidth="5*" align="center"/>
33900 <colspec colwidth="5*" align="center"/>
33901 <colspec colwidth="6*" align="right"/>
33904 <entry><option>reply_transport</option></entry>
33905 <entry>Use: <emphasis>redirect</emphasis></entry>
33906 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33907 <entry>Default: <emphasis>unset</emphasis></entry>
33913 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
33914 <option>vacation</option> command is used in a filter file. The transport used is specified
33915 by this option, which, after expansion, must be the name of a configured
33916 transport. This should normally be an <command>autoreply</command> transport. Other transports
33917 are unlikely to do anything sensible or useful.
33920 <indexterm role="option">
33921 <primary><option>rewrite</option></primary>
33924 <informaltable frame="all">
33925 <tgroup cols="4" colsep="0" rowsep="0">
33926 <colspec colwidth="8*" align="left"/>
33927 <colspec colwidth="5*" align="center"/>
33928 <colspec colwidth="5*" align="center"/>
33929 <colspec colwidth="6*" align="right"/>
33932 <entry><option>rewrite</option></entry>
33933 <entry>Use: <emphasis>redirect</emphasis></entry>
33934 <entry>Type: <emphasis>boolean</emphasis></entry>
33935 <entry>Default: <emphasis>true</emphasis></entry>
33941 <indexterm role="concept">
33942 <primary>address redirection</primary>
33943 <secondary>disabling rewriting</secondary>
33945 If this option is set false, addresses generated by the router are not
33946 subject to address rewriting. Otherwise, they are treated like new addresses
33947 and are rewritten according to the global rewriting rules.
33950 <indexterm role="option">
33951 <primary><option>sieve_subaddress</option></primary>
33954 <informaltable frame="all">
33955 <tgroup cols="4" colsep="0" rowsep="0">
33956 <colspec colwidth="8*" align="left"/>
33957 <colspec colwidth="5*" align="center"/>
33958 <colspec colwidth="5*" align="center"/>
33959 <colspec colwidth="6*" align="right"/>
33962 <entry><option>sieve_subaddress</option></entry>
33963 <entry>Use: <emphasis>redirect</emphasis></entry>
33964 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33965 <entry>Default: <emphasis>unset</emphasis></entry>
33971 The value of this option is passed to a Sieve filter to specify the
33972 :subaddress part of an address.
33975 <indexterm role="option">
33976 <primary><option>sieve_useraddress</option></primary>
33979 <informaltable frame="all">
33980 <tgroup cols="4" colsep="0" rowsep="0">
33981 <colspec colwidth="8*" align="left"/>
33982 <colspec colwidth="5*" align="center"/>
33983 <colspec colwidth="5*" align="center"/>
33984 <colspec colwidth="6*" align="right"/>
33987 <entry><option>sieve_useraddress</option></entry>
33988 <entry>Use: <emphasis>redirect</emphasis></entry>
33989 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33990 <entry>Default: <emphasis>unset</emphasis></entry>
33996 The value of this option is passed to a Sieve filter to specify the :user part
33997 of an address. However, if it is unset, the entire original local part
33998 (including any prefix or suffix) is used for :user.
34001 <indexterm role="option">
34002 <primary><option>sieve_vacation_directory</option></primary>
34005 <informaltable frame="all">
34006 <tgroup cols="4" colsep="0" rowsep="0">
34007 <colspec colwidth="8*" align="left"/>
34008 <colspec colwidth="5*" align="center"/>
34009 <colspec colwidth="5*" align="center"/>
34010 <colspec colwidth="6*" align="right"/>
34013 <entry><option>sieve_vacation_directory</option></entry>
34014 <entry>Use: <emphasis>redirect</emphasis></entry>
34015 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34016 <entry>Default: <emphasis>unset</emphasis></entry>
34022 <indexterm role="concept">
34023 <primary>Sieve filter</primary>
34024 <secondary>vacation directory</secondary>
34026 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
34027 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
34028 (do not put anything else in that directory), and ensure that the
34029 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
34030 needs their own directory; Exim will create it if necessary.
34033 <indexterm role="option">
34034 <primary><option>skip_syntax_errors</option></primary>
34037 <informaltable frame="all">
34038 <tgroup cols="4" colsep="0" rowsep="0">
34039 <colspec colwidth="8*" align="left"/>
34040 <colspec colwidth="5*" align="center"/>
34041 <colspec colwidth="5*" align="center"/>
34042 <colspec colwidth="6*" align="right"/>
34045 <entry><option>skip_syntax_errors</option></entry>
34046 <entry>Use: <emphasis>redirect</emphasis></entry>
34047 <entry>Type: <emphasis>boolean</emphasis></entry>
34048 <entry>Default: <emphasis>false</emphasis></entry>
34054 <indexterm role="concept">
34055 <primary>forward file</primary>
34056 <secondary>broken</secondary>
34058 <indexterm role="concept">
34059 <primary>address redirection</primary>
34060 <secondary>broken files</secondary>
34062 <indexterm role="concept">
34063 <primary>alias file</primary>
34064 <secondary>broken</secondary>
34066 <indexterm role="concept">
34067 <primary>broken alias or forward files</primary>
34069 <indexterm role="concept">
34070 <primary>ignoring faulty addresses</primary>
34072 <indexterm role="concept">
34073 <primary>skipping faulty addresses</primary>
34075 <indexterm role="concept">
34076 <primary>error</primary>
34077 <secondary>skipping bad syntax</secondary>
34079 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
34080 non-filter redirection data are skipped, and each failing address is logged. If
34081 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
34082 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
34083 are expanded and placed at the head of the error message generated by
34084 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
34085 be the same address as the generic <option>errors_to</option> option. The
34086 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
34089 If all the addresses in a redirection list are skipped because of syntax
34090 errors, the router declines to handle the original address, and it is passed to
34091 the following routers.
34094 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
34095 error in the filter causes filtering to be abandoned without any action being
34096 taken. The incident is logged, and the router declines to handle the address,
34097 so it is passed to the following routers.
34100 <indexterm role="concept">
34101 <primary>Sieve filter</primary>
34102 <secondary>syntax errors in</secondary>
34104 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
34105 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
34106 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
34109 <option>skip_syntax_errors</option> can be used to specify that errors in users’ forward
34110 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
34111 option, used with an address that does not get redirected, can be used to
34112 notify users of these errors, by means of a router like this:
34114 <literallayout class="monospaced">
34119 file = $home/.forward
34120 file_transport = address_file
34121 pipe_transport = address_pipe
34122 reply_transport = address_reply
34125 syntax_errors_to = real-$local_part@$domain
34126 syntax_errors_text = \
34127 This is an automatically generated message. An error has\n\
34128 been found in your .forward file. Details of the error are\n\
34129 reported below. While this error persists, you will receive\n\
34130 a copy of this message for every message that is addressed\n\
34131 to you. If your .forward file is a filter file, or if it is\n\
34132 a non-filter file containing no valid forwarding addresses,\n\
34133 a copy of each incoming message will be put in your normal\n\
34134 mailbox. If a non-filter file contains at least one valid\n\
34135 forwarding address, forwarding to the valid addresses will\n\
34136 happen, and those will be the only deliveries that occur.
34139 You also need a router to ensure that local addresses that are prefixed by
34140 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
34141 put this immediately before the <command>userforward</command> router:
34143 <literallayout class="monospaced">
34147 local_part_prefix = real-
34148 transport = local_delivery
34151 <indexterm role="option">
34152 <primary><option>syntax_errors_text</option></primary>
34155 <informaltable frame="all">
34156 <tgroup cols="4" colsep="0" rowsep="0">
34157 <colspec colwidth="8*" align="left"/>
34158 <colspec colwidth="5*" align="center"/>
34159 <colspec colwidth="5*" align="center"/>
34160 <colspec colwidth="6*" align="right"/>
34163 <entry><option>syntax_errors_text</option></entry>
34164 <entry>Use: <emphasis>redirect</emphasis></entry>
34165 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34166 <entry>Default: <emphasis>unset</emphasis></entry>
34172 See <option>skip_syntax_errors</option> above.
34175 <indexterm role="option">
34176 <primary><option>syntax_errors_to</option></primary>
34179 <informaltable frame="all">
34180 <tgroup cols="4" colsep="0" rowsep="0">
34181 <colspec colwidth="8*" align="left"/>
34182 <colspec colwidth="5*" align="center"/>
34183 <colspec colwidth="5*" align="center"/>
34184 <colspec colwidth="6*" align="right"/>
34187 <entry><option>syntax_errors_to</option></entry>
34188 <entry>Use: <emphasis>redirect</emphasis></entry>
34189 <entry>Type: <emphasis>string</emphasis></entry>
34190 <entry>Default: <emphasis>unset</emphasis></entry>
34196 See <option>skip_syntax_errors</option> above.
34197 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
34198 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
34203 <chapter id="CHAPenvironment">
34204 <title>Environment for running local transports</title>
34205 <titleabbrev>Environment for local transports</titleabbrev>
34207 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
34208 <primary>local transports</primary>
34209 <secondary>environment for</secondary>
34211 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
34212 <primary>environment for local transports</primary>
34214 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
34215 <primary>transport</primary>
34216 <secondary>local; environment for</secondary>
34218 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
34219 transport can be thought of as similar to a pipe.) Exim always runs transports
34220 in subprocesses, under specified uids and gids. Typical deliveries to local
34221 mailboxes run under the uid and gid of the local user.
34224 Exim also sets a specific current directory while running the transport; for
34225 some transports a home directory setting is also relevant. The <command>pipe</command>
34226 transport is the only one that sets up environment variables; see section
34227 <xref linkend="SECTpipeenv"/> for details.
34230 The values used for the uid, gid, and the directories may come from several
34231 different places. In many cases, the router that handles the address associates
34232 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
34233 or <option>user</option> options. However, values may also be given in the transport’s own
34234 configuration, and these override anything that comes from the router.
34237 <title>Concurrent deliveries</title>
34239 <indexterm role="concept">
34240 <primary>concurrent deliveries</primary>
34242 <indexterm role="concept">
34243 <primary>simultaneous deliveries</primary>
34245 If two different messages for the same local recpient arrive more or less
34246 simultaneously, the two delivery processes are likely to run concurrently. When
34247 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
34248 rules to stop concurrent processes from writing to the same file at the same
34252 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
34253 locking that is needed. Here is a silly example:
34255 <literallayout class="monospaced">
34258 command = /bin/sh -c 'cat >>/some/file'
34261 This is supposed to write the message at the end of the file. However, if two
34262 messages arrive at the same time, the file will be scrambled. You can use the
34263 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
34264 file using the same algorithm that Exim itself uses.
34267 <section id="SECTenvuidgid">
34268 <title>Uids and gids</title>
34270 <indexterm role="concept">
34271 <primary>local transports</primary>
34272 <secondary>uid and gid</secondary>
34274 <indexterm role="concept">
34275 <primary>transport</primary>
34276 <secondary>local; uid and gid</secondary>
34278 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
34279 overrides any group that the router set in the address, even if <option>user</option> is not
34280 set for the transport. This makes it possible, for example, to run local mail
34281 delivery under the uid of the recipient (set by the router), but in a special
34282 group (set by the transport). For example:
34284 <literallayout class="monospaced">
34286 # User/group are set by check_local_user in this router
34290 transport = group_delivery
34293 # This transport overrides the group
34295 driver = appendfile
34296 file = /var/spool/mail/$local_part
34300 If <option>user</option> is set for a transport, its value overrides what is set in the
34301 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
34302 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
34306 <indexterm role="concept">
34307 <primary><option>initgroups</option> option</primary>
34309 When the uid is taken from the transport’s configuration, the <function>initgroups()</function>
34310 function is called for the groups associated with that uid if the
34311 <option>initgroups</option> option is set for the transport. When the uid is not specified
34312 by the transport, but is associated with the address by a router, the option
34313 for calling <function>initgroups()</function> is taken from the router configuration.
34316 <indexterm role="concept">
34317 <primary><command>pipe</command> transport</primary>
34318 <secondary>uid for</secondary>
34320 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
34321 is set and <option>user</option> is not set, the uid of the process that called Exim to
34322 receive the message is used, and if <option>group</option> is not set, the corresponding
34323 original gid is also used.
34326 This is the detailed preference order for obtaining a gid; the first of the
34327 following that is set is used:
34332 A <option>group</option> setting of the transport;
34337 A <option>group</option> setting of the router;
34342 A gid associated with a user setting of the router, either as a result of
34343 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
34348 The group associated with a non-numeric <option>user</option> setting of the transport;
34353 In a <command>pipe</command> transport, the creator’s gid if <option>deliver_as_creator</option> is set and
34354 the uid is the creator’s uid;
34359 The Exim gid if the Exim uid is being used as a default.
34364 If, for example, the user is specified numerically on the router and there are
34365 no group settings, no gid is available. In this situation, an error occurs.
34366 This is different for the uid, for which there always is an ultimate default.
34367 The first of the following that is set is used:
34372 A <option>user</option> setting of the transport;
34377 In a <command>pipe</command> transport, the creator’s uid if <option>deliver_as_creator</option> is set;
34382 A <option>user</option> setting of the router;
34387 A <option>check_local_user</option> setting of the router;
34397 Of course, an error will still occur if the uid that is chosen is on the
34398 <option>never_users</option> list.
34402 <title>Current and home directories</title>
34404 <indexterm role="concept">
34405 <primary>current directory for local transport</primary>
34407 <indexterm role="concept">
34408 <primary>home directory</primary>
34409 <secondary>for local transport</secondary>
34411 <indexterm role="concept">
34412 <primary>transport</primary>
34413 <secondary>local; home directory for</secondary>
34415 <indexterm role="concept">
34416 <primary>transport</primary>
34417 <secondary>local; current directory for</secondary>
34419 Routers may set current and home directories for local transports by means of
34420 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
34421 However, if the transport’s <option>current_directory</option> or <option>home_directory</option> options
34422 are set, they override the router’s values. In detail, the home directory
34423 for a local transport is taken from the first of these values that is set:
34428 The <option>home_directory</option> option on the transport;
34433 The <option>transport_home_directory</option> option on the router;
34438 The password data if <option>check_local_user</option> is set on the router;
34443 The <option>router_home_directory</option> option on the router.
34448 The current directory is taken from the first of these values that is set:
34453 The <option>current_directory</option> option on the transport;
34458 The <option>transport_current_directory</option> option on the router.
34463 If neither the router nor the transport sets a current directory, Exim uses the
34464 value of the home directory, if it is set. Otherwise it sets the current
34465 directory to <filename>/</filename> before running a local transport.
34469 <title>Expansion variables derived from the address</title>
34471 <indexterm role="concept">
34472 <primary><varname>$domain</varname></primary>
34474 <indexterm role="concept">
34475 <primary><varname>$local_part</varname></primary>
34477 <indexterm role="concept">
34478 <primary><varname>$original_domain</varname></primary>
34480 Normally a local delivery is handling a single address, and in that case the
34481 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
34482 deliveries. However, in some circumstances more than one address may be handled
34483 at once (for example, while writing batch SMTP for onward transmission by some
34484 other means). In this case, the variables associated with the local part are
34485 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
34486 and <varname>$original_domain</varname> is never set.
34487 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
34488 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
34489 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
34494 <chapter id="CHAPtransportgeneric">
34495 <title>Generic options for transports</title>
34497 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
34498 <primary>generic options</primary>
34499 <secondary>transport</secondary>
34501 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
34502 <primary>options</primary>
34503 <secondary>generic; for transports</secondary>
34505 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
34506 <primary>transport</primary>
34507 <secondary>generic options for</secondary>
34509 The following generic options apply to all transports:
34512 <indexterm role="option">
34513 <primary><option>body_only</option></primary>
34516 <informaltable frame="all">
34517 <tgroup cols="4" colsep="0" rowsep="0">
34518 <colspec colwidth="8*" align="left"/>
34519 <colspec colwidth="5*" align="center"/>
34520 <colspec colwidth="5*" align="center"/>
34521 <colspec colwidth="6*" align="right"/>
34524 <entry><option>body_only</option></entry>
34525 <entry>Use: <emphasis>transports</emphasis></entry>
34526 <entry>Type: <emphasis>boolean</emphasis></entry>
34527 <entry>Default: <emphasis>false</emphasis></entry>
34533 <indexterm role="concept">
34534 <primary>transport</primary>
34535 <secondary>body only</secondary>
34537 <indexterm role="concept">
34538 <primary>message</primary>
34539 <secondary>transporting body only</secondary>
34541 <indexterm role="concept">
34542 <primary>body of message</primary>
34543 <secondary>transporting</secondary>
34545 If this option is set, the message’s headers are not transported. It is
34546 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
34547 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
34548 <option>message_suffix</option> should be checked, because this option does not
34549 automatically suppress them.
34552 <indexterm role="option">
34553 <primary><option>current_directory</option></primary>
34556 <informaltable frame="all">
34557 <tgroup cols="4" colsep="0" rowsep="0">
34558 <colspec colwidth="8*" align="left"/>
34559 <colspec colwidth="5*" align="center"/>
34560 <colspec colwidth="5*" align="center"/>
34561 <colspec colwidth="6*" align="right"/>
34564 <entry><option>current_directory</option></entry>
34565 <entry>Use: <emphasis>transports</emphasis></entry>
34566 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34567 <entry>Default: <emphasis>unset</emphasis></entry>
34573 <indexterm role="concept">
34574 <primary>transport</primary>
34575 <secondary>current directory for</secondary>
34577 This specifies the current directory that is to be set while running the
34578 transport, overriding any value that may have been set by the router.
34579 If the expansion fails for any reason, including forced failure, an error is
34580 logged, and delivery is deferred.
34583 <indexterm role="option">
34584 <primary><option>disable_logging</option></primary>
34587 <informaltable frame="all">
34588 <tgroup cols="4" colsep="0" rowsep="0">
34589 <colspec colwidth="8*" align="left"/>
34590 <colspec colwidth="5*" align="center"/>
34591 <colspec colwidth="5*" align="center"/>
34592 <colspec colwidth="6*" align="right"/>
34595 <entry><option>disable_logging</option></entry>
34596 <entry>Use: <emphasis>transports</emphasis></entry>
34597 <entry>Type: <emphasis>boolean</emphasis></entry>
34598 <entry>Default: <emphasis>false</emphasis></entry>
34604 If this option is set true, nothing is logged for any
34605 deliveries by the transport or for any
34606 transport errors. You should not set this option unless you really, really know
34607 what you are doing.
34610 <indexterm role="option">
34611 <primary><option>debug_print</option></primary>
34614 <informaltable frame="all">
34615 <tgroup cols="4" colsep="0" rowsep="0">
34616 <colspec colwidth="8*" align="left"/>
34617 <colspec colwidth="5*" align="center"/>
34618 <colspec colwidth="5*" align="center"/>
34619 <colspec colwidth="6*" align="right"/>
34622 <entry><option>debug_print</option></entry>
34623 <entry>Use: <emphasis>transports</emphasis></entry>
34624 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34625 <entry>Default: <emphasis>unset</emphasis></entry>
34631 <indexterm role="concept">
34632 <primary>testing</primary>
34633 <secondary>variables in drivers</secondary>
34635 If this option is set and debugging is enabled (see the <option>-d</option> command line
34636 option), the string is expanded and included in the debugging output when the
34638 If expansion of the string fails, the error message is written to the debugging
34639 output, and Exim carries on processing.
34640 This facility is provided to help with checking out the values of variables and
34641 so on when debugging driver configurations. For example, if a <option>headers_add</option>
34642 option is not working properly, <option>debug_print</option> could be used to output the
34643 variables it references. A newline is added to the text if it does not end with
34647 <indexterm role="option">
34648 <primary><option>delivery_date_add</option></primary>
34651 <informaltable frame="all">
34652 <tgroup cols="4" colsep="0" rowsep="0">
34653 <colspec colwidth="8*" align="left"/>
34654 <colspec colwidth="5*" align="center"/>
34655 <colspec colwidth="5*" align="center"/>
34656 <colspec colwidth="6*" align="right"/>
34659 <entry><option>delivery_date_add</option></entry>
34660 <entry>Use: <emphasis>transports</emphasis></entry>
34661 <entry>Type: <emphasis>boolean</emphasis></entry>
34662 <entry>Default: <emphasis>false</emphasis></entry>
34668 <indexterm role="concept">
34669 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
34671 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
34672 This gives the actual time the delivery was made. As this is not a standard
34673 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
34674 requests its removal from incoming messages, so that delivered messages can
34675 safely be resent to other recipients.
34678 <indexterm role="option">
34679 <primary><option>driver</option></primary>
34682 <informaltable frame="all">
34683 <tgroup cols="4" colsep="0" rowsep="0">
34684 <colspec colwidth="8*" align="left"/>
34685 <colspec colwidth="5*" align="center"/>
34686 <colspec colwidth="5*" align="center"/>
34687 <colspec colwidth="6*" align="right"/>
34690 <entry><option>driver</option></entry>
34691 <entry>Use: <emphasis>transports</emphasis></entry>
34692 <entry>Type: <emphasis>string</emphasis></entry>
34693 <entry>Default: <emphasis>unset</emphasis></entry>
34699 This specifies which of the available transport drivers is to be used.
34700 There is no default, and this option must be set for every transport.
34703 <indexterm role="option">
34704 <primary><option>envelope_to_add</option></primary>
34707 <informaltable frame="all">
34708 <tgroup cols="4" colsep="0" rowsep="0">
34709 <colspec colwidth="8*" align="left"/>
34710 <colspec colwidth="5*" align="center"/>
34711 <colspec colwidth="5*" align="center"/>
34712 <colspec colwidth="6*" align="right"/>
34715 <entry><option>envelope_to_add</option></entry>
34716 <entry>Use: <emphasis>transports</emphasis></entry>
34717 <entry>Type: <emphasis>boolean</emphasis></entry>
34718 <entry>Default: <emphasis>false</emphasis></entry>
34724 <indexterm role="concept">
34725 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
34727 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
34728 This gives the original address(es) in the incoming envelope that caused this
34729 delivery to happen. More than one address may be present if the transport is
34730 configured to handle several addresses at once, or if more than one original
34731 address was redirected to the same final address. As this is not a standard
34732 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
34733 its removal from incoming messages, so that delivered messages can safely be
34734 resent to other recipients.
34737 <indexterm role="option">
34738 <primary><option>group</option></primary>
34741 <informaltable frame="all">
34742 <tgroup cols="4" colsep="0" rowsep="0">
34743 <colspec colwidth="8*" align="left"/>
34744 <colspec colwidth="5*" align="center"/>
34745 <colspec colwidth="5*" align="center"/>
34746 <colspec colwidth="6*" align="right"/>
34749 <entry><option>group</option></entry>
34750 <entry>Use: <emphasis>transports</emphasis></entry>
34751 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34752 <entry>Default: <emphasis>Exim group</emphasis></entry>
34758 <indexterm role="concept">
34759 <primary>transport</primary>
34760 <secondary>group; specifying</secondary>
34762 This option specifies a gid for running the transport process, overriding any
34763 value that the router supplies, and also overriding any value associated with
34764 <option>user</option> (see below).
34767 <indexterm role="option">
34768 <primary><option>headers_add</option></primary>
34771 <informaltable frame="all">
34772 <tgroup cols="4" colsep="0" rowsep="0">
34773 <colspec colwidth="8*" align="left"/>
34774 <colspec colwidth="5*" align="center"/>
34775 <colspec colwidth="5*" align="center"/>
34776 <colspec colwidth="6*" align="right"/>
34779 <entry><option>headers_add</option></entry>
34780 <entry>Use: <emphasis>transports</emphasis></entry>
34781 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34782 <entry>Default: <emphasis>unset</emphasis></entry>
34788 <indexterm role="concept">
34789 <primary>header lines</primary>
34790 <secondary>adding in transport</secondary>
34792 <indexterm role="concept">
34793 <primary>transport</primary>
34794 <secondary>header lines; adding</secondary>
34796 This option specifies a string of text that is expanded and added to the header
34797 portion of a message as it is transported, as described in section
34798 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
34799 routers. If the result of the expansion is an empty string, or if the expansion
34800 is forced to fail, no action is taken. Other expansion failures are treated as
34801 errors and cause the delivery to be deferred.
34804 <indexterm role="option">
34805 <primary><option>headers_only</option></primary>
34808 <informaltable frame="all">
34809 <tgroup cols="4" colsep="0" rowsep="0">
34810 <colspec colwidth="8*" align="left"/>
34811 <colspec colwidth="5*" align="center"/>
34812 <colspec colwidth="5*" align="center"/>
34813 <colspec colwidth="6*" align="right"/>
34816 <entry><option>headers_only</option></entry>
34817 <entry>Use: <emphasis>transports</emphasis></entry>
34818 <entry>Type: <emphasis>boolean</emphasis></entry>
34819 <entry>Default: <emphasis>false</emphasis></entry>
34825 <indexterm role="concept">
34826 <primary>transport</primary>
34827 <secondary>header lines only</secondary>
34829 <indexterm role="concept">
34830 <primary>message</primary>
34831 <secondary>transporting headers only</secondary>
34833 <indexterm role="concept">
34834 <primary>header lines</primary>
34835 <secondary>transporting</secondary>
34837 If this option is set, the message’s body is not transported. It is mutually
34838 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
34839 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
34840 checked, since this option does not automatically suppress them.
34843 <indexterm role="option">
34844 <primary><option>headers_remove</option></primary>
34847 <informaltable frame="all">
34848 <tgroup cols="4" colsep="0" rowsep="0">
34849 <colspec colwidth="8*" align="left"/>
34850 <colspec colwidth="5*" align="center"/>
34851 <colspec colwidth="5*" align="center"/>
34852 <colspec colwidth="6*" align="right"/>
34855 <entry><option>headers_remove</option></entry>
34856 <entry>Use: <emphasis>transports</emphasis></entry>
34857 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34858 <entry>Default: <emphasis>unset</emphasis></entry>
34864 <indexterm role="concept">
34865 <primary>header lines</primary>
34866 <secondary>removing</secondary>
34868 <indexterm role="concept">
34869 <primary>transport</primary>
34870 <secondary>header lines; removing</secondary>
34872 This option specifies a string that is expanded into a list of header names;
34873 these headers are omitted from the message as it is transported, as described
34874 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
34875 routers. If the result of the expansion is an empty string, or if the expansion
34876 is forced to fail, no action is taken. Other expansion failures are treated as
34877 errors and cause the delivery to be deferred.
34880 <indexterm role="option">
34881 <primary><option>headers_rewrite</option></primary>
34884 <informaltable frame="all">
34885 <tgroup cols="4" colsep="0" rowsep="0">
34886 <colspec colwidth="8*" align="left"/>
34887 <colspec colwidth="5*" align="center"/>
34888 <colspec colwidth="5*" align="center"/>
34889 <colspec colwidth="6*" align="right"/>
34892 <entry><option>headers_rewrite</option></entry>
34893 <entry>Use: <emphasis>transports</emphasis></entry>
34894 <entry>Type: <emphasis>string</emphasis></entry>
34895 <entry>Default: <emphasis>unset</emphasis></entry>
34901 <indexterm role="concept">
34902 <primary>transport</primary>
34903 <secondary>header lines; rewriting</secondary>
34905 <indexterm role="concept">
34906 <primary>rewriting</primary>
34907 <secondary>at transport time</secondary>
34909 This option allows addresses in header lines to be rewritten at transport time,
34910 that is, as the message is being copied to its destination. The contents of the
34911 option are a colon-separated list of rewriting rules. Each rule is in exactly
34912 the same form as one of the general rewriting rules that are applied when a
34913 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
34916 <literallayout class="monospaced">
34917 headers_rewrite = a@b c@d f : \
34921 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
34922 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
34923 header lines just before they are written out at transport time, so they affect
34924 only those copies of the message that pass through the transport. However, only
34925 the message’s original header lines, and any that were added by a system
34926 filter, are rewritten. If a router or transport adds header lines, they are not
34927 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
34928 envelope. You can change the return path using <option>return_path</option>, but you cannot
34929 change envelope recipients at this time.
34932 <indexterm role="option">
34933 <primary><option>home_directory</option></primary>
34936 <informaltable frame="all">
34937 <tgroup cols="4" colsep="0" rowsep="0">
34938 <colspec colwidth="8*" align="left"/>
34939 <colspec colwidth="5*" align="center"/>
34940 <colspec colwidth="5*" align="center"/>
34941 <colspec colwidth="6*" align="right"/>
34944 <entry><option>home_directory</option></entry>
34945 <entry>Use: <emphasis>transports</emphasis></entry>
34946 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34947 <entry>Default: <emphasis>unset</emphasis></entry>
34953 <indexterm role="concept">
34954 <primary>transport</primary>
34955 <secondary>home directory for</secondary>
34957 <indexterm role="concept">
34958 <primary><varname>$home</varname></primary>
34960 This option specifies a home directory setting for a local transport,
34961 overriding any value that may be set by the router. The home directory is
34962 placed in <varname>$home</varname> while expanding the transport’s private options. It is also
34963 used as the current directory if no current directory is set by the
34964 <option>current_directory</option> option on the transport or the
34965 <option>transport_current_directory</option> option on the router. If the expansion fails
34966 for any reason, including forced failure, an error is logged, and delivery is
34970 <indexterm role="option">
34971 <primary><option>initgroups</option></primary>
34974 <informaltable frame="all">
34975 <tgroup cols="4" colsep="0" rowsep="0">
34976 <colspec colwidth="8*" align="left"/>
34977 <colspec colwidth="5*" align="center"/>
34978 <colspec colwidth="5*" align="center"/>
34979 <colspec colwidth="6*" align="right"/>
34982 <entry><option>initgroups</option></entry>
34983 <entry>Use: <emphasis>transports</emphasis></entry>
34984 <entry>Type: <emphasis>boolean</emphasis></entry>
34985 <entry>Default: <emphasis>false</emphasis></entry>
34991 <indexterm role="concept">
34992 <primary>additional groups</primary>
34994 <indexterm role="concept">
34995 <primary>groups</primary>
34996 <secondary>additional</secondary>
34998 <indexterm role="concept">
34999 <primary>transport</primary>
35000 <secondary>group; additional</secondary>
35002 If this option is true and the uid for the delivery process is provided by the
35003 transport, the <function>initgroups()</function> function is called when running the transport
35004 to ensure that any additional groups associated with the uid are set up.
35007 <indexterm role="option">
35008 <primary><option>message_size_limit</option></primary>
35011 <informaltable frame="all">
35012 <tgroup cols="4" colsep="0" rowsep="0">
35013 <colspec colwidth="8*" align="left"/>
35014 <colspec colwidth="5*" align="center"/>
35015 <colspec colwidth="5*" align="center"/>
35016 <colspec colwidth="6*" align="right"/>
35019 <entry><option>message_size_limit</option></entry>
35020 <entry>Use: <emphasis>transports</emphasis></entry>
35021 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35022 <entry>Default: <emphasis>0</emphasis></entry>
35028 <indexterm role="concept">
35029 <primary>limit</primary>
35030 <secondary>message size per transport</secondary>
35032 <indexterm role="concept">
35033 <primary>size of message</primary>
35034 <secondary>limit</secondary>
35036 <indexterm role="concept">
35037 <primary>transport</primary>
35038 <secondary>message size; limiting</secondary>
35040 This option controls the size of messages passed through the transport. It is
35041 expanded before use; the result of the expansion must be a sequence of digits,
35042 optionally followed by K or M.
35043 If the expansion fails for any reason, including forced failure, or if the
35044 result is not of the required form, delivery is deferred.
35045 If the value is greater than zero and the size of a message exceeds this
35046 limit, the address is failed. If there is any chance that the resulting bounce
35047 message could be routed to the same transport, you should ensure that
35048 <option>return_size_limit</option> is less than the transport’s <option>message_size_limit</option>, as
35049 otherwise the bounce message will fail to get delivered.
35052 <indexterm role="option">
35053 <primary><option>rcpt_include_affixes</option></primary>
35056 <informaltable frame="all">
35057 <tgroup cols="4" colsep="0" rowsep="0">
35058 <colspec colwidth="8*" align="left"/>
35059 <colspec colwidth="5*" align="center"/>
35060 <colspec colwidth="5*" align="center"/>
35061 <colspec colwidth="6*" align="right"/>
35064 <entry><option>rcpt_include_affixes</option></entry>
35065 <entry>Use: <emphasis>transports</emphasis></entry>
35066 <entry>Type: <emphasis>boolean</emphasis></entry>
35067 <entry>Default: <emphasis>false</emphasis></entry>
35073 <indexterm role="concept">
35074 <primary>prefix</primary>
35075 <secondary>for local part; including in envelope</secondary>
35077 <indexterm role="concept">
35078 <primary>suffix</primary>
35079 <secondary>for local part; including in envelope</secondary>
35081 <indexterm role="concept">
35082 <primary>local part</primary>
35083 <secondary>prefix</secondary>
35085 <indexterm role="concept">
35086 <primary>local part</primary>
35087 <secondary>suffix</secondary>
35089 When this option is false (the default), and an address that has had any
35090 affixes (prefixes or suffixes) removed from the local part is delivered by any
35091 form of SMTP or LMTP, the affixes are not included. For example, if a router
35094 <literallayout class="monospaced">
35095 local_part_prefix = *-
35098 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
35101 <literallayout class="monospaced">
35102 RCPT TO:<xyz@some.domain>
35105 This is also the case when an ACL-time callout is being used to verify a
35106 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
35107 whole local part is included in the RCPT command. This option applies to BSMTP
35108 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
35109 <command>lmtp</command> and <command>smtp</command> transports.
35112 <indexterm role="option">
35113 <primary><option>retry_use_local_part</option></primary>
35116 <informaltable frame="all">
35117 <tgroup cols="4" colsep="0" rowsep="0">
35118 <colspec colwidth="8*" align="left"/>
35119 <colspec colwidth="5*" align="center"/>
35120 <colspec colwidth="5*" align="center"/>
35121 <colspec colwidth="6*" align="right"/>
35124 <entry><option>retry_use_local_part</option></entry>
35125 <entry>Use: <emphasis>transports</emphasis></entry>
35126 <entry>Type: <emphasis>boolean</emphasis></entry>
35127 <entry>Default: <emphasis>see below</emphasis></entry>
35133 <indexterm role="concept">
35134 <primary>hints database</primary>
35135 <secondary>retry keys</secondary>
35137 When a delivery suffers a temporary failure, a retry record is created
35138 in Exim’s hints database. For remote deliveries, the key for the retry record
35139 is based on the name and/or IP address of the failing remote host. For local
35140 deliveries, the key is normally the entire address, including both the local
35141 part and the domain. This is suitable for most common cases of local delivery
35142 temporary failure – for example, exceeding a mailbox quota should delay only
35143 deliveries to that mailbox, not to the whole domain.
35146 However, in some special cases you may want to treat a temporary local delivery
35147 as a failure associated with the domain, and not with a particular local part.
35148 (For example, if you are storing all mail for some domain in files.) You can do
35149 this by setting <option>retry_use_local_part</option> false.
35152 For all the local transports, its default value is true. For remote transports,
35153 the default value is false for tidiness, but changing the value has no effect
35154 on a remote transport in the current implementation.
35157 <indexterm role="option">
35158 <primary><option>return_path</option></primary>
35161 <informaltable frame="all">
35162 <tgroup cols="4" colsep="0" rowsep="0">
35163 <colspec colwidth="8*" align="left"/>
35164 <colspec colwidth="5*" align="center"/>
35165 <colspec colwidth="5*" align="center"/>
35166 <colspec colwidth="6*" align="right"/>
35169 <entry><option>return_path</option></entry>
35170 <entry>Use: <emphasis>transports</emphasis></entry>
35171 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35172 <entry>Default: <emphasis>unset</emphasis></entry>
35178 <indexterm role="concept">
35179 <primary>envelope sender</primary>
35181 <indexterm role="concept">
35182 <primary>transport</primary>
35183 <secondary>return path; changing</secondary>
35185 <indexterm role="concept">
35186 <primary>return path</primary>
35187 <secondary>changing in transport</secondary>
35189 If this option is set, the string is expanded at transport time and replaces
35190 the existing return path (envelope sender) value in the copy of the message
35191 that is being delivered. An empty return path is permitted. This feature is
35192 designed for remote deliveries, where the value of this option is used in the
35193 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
35194 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
35195 header line, if one is added to the message (see the next option).
35198 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
35199 <option>return_path_on_delivery</option> to the log selector.
35202 <indexterm role="concept">
35203 <primary><varname>$return_path</varname></primary>
35205 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
35206 either the message’s envelope sender, or an address set by the
35207 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
35208 replacement occurs; if it fails for another reason, delivery is deferred. This
35209 option can be used to support VERP (Variable Envelope Return Paths) – see
35210 section <xref linkend="SECTverp"/>.
35213 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
35214 remote server rejects a message at SMTP time, the bounce message is not sent to
35215 the value of this option. It is sent to the previously set errors address.
35216 This defaults to the incoming sender address, but can be changed by setting
35217 <option>errors_to</option> in a router.
35220 <indexterm role="option">
35221 <primary><option>return_path_add</option></primary>
35224 <informaltable frame="all">
35225 <tgroup cols="4" colsep="0" rowsep="0">
35226 <colspec colwidth="8*" align="left"/>
35227 <colspec colwidth="5*" align="center"/>
35228 <colspec colwidth="5*" align="center"/>
35229 <colspec colwidth="6*" align="right"/>
35232 <entry><option>return_path_add</option></entry>
35233 <entry>Use: <emphasis>transports</emphasis></entry>
35234 <entry>Type: <emphasis>boolean</emphasis></entry>
35235 <entry>Default: <emphasis>false</emphasis></entry>
35241 <indexterm role="concept">
35242 <primary><emphasis>Return-path:</emphasis> header line</primary>
35244 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
35245 Although the return path is normally available in the prefix line of BSD
35246 mailboxes, this is commonly not displayed by MUAs, and so the user does not
35247 have easy access to it.
35250 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
35251 the delivery SMTP server makes the final delivery</quote>. This implies that this
35252 header should not be present in incoming messages. Exim has a configuration
35253 option, <option>return_path_remove</option>, which requests removal of this header from
35254 incoming messages, so that delivered messages can safely be resent to other
35258 <indexterm role="option">
35259 <primary><option>shadow_condition</option></primary>
35262 <informaltable frame="all">
35263 <tgroup cols="4" colsep="0" rowsep="0">
35264 <colspec colwidth="8*" align="left"/>
35265 <colspec colwidth="5*" align="center"/>
35266 <colspec colwidth="5*" align="center"/>
35267 <colspec colwidth="6*" align="right"/>
35270 <entry><option>shadow_condition</option></entry>
35271 <entry>Use: <emphasis>transports</emphasis></entry>
35272 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35273 <entry>Default: <emphasis>unset</emphasis></entry>
35279 See <option>shadow_transport</option> below.
35282 <indexterm role="option">
35283 <primary><option>shadow_transport</option></primary>
35286 <informaltable frame="all">
35287 <tgroup cols="4" colsep="0" rowsep="0">
35288 <colspec colwidth="8*" align="left"/>
35289 <colspec colwidth="5*" align="center"/>
35290 <colspec colwidth="5*" align="center"/>
35291 <colspec colwidth="6*" align="right"/>
35294 <entry><option>shadow_transport</option></entry>
35295 <entry>Use: <emphasis>transports</emphasis></entry>
35296 <entry>Type: <emphasis>string</emphasis></entry>
35297 <entry>Default: <emphasis>unset</emphasis></entry>
35303 <indexterm role="concept">
35304 <primary>shadow transport</primary>
35306 <indexterm role="concept">
35307 <primary>transport</primary>
35308 <secondary>shadow</secondary>
35310 A local transport may set the <option>shadow_transport</option> option to the name of
35311 another local transport. Shadow remote transports are not supported.
35314 Whenever a delivery to the main transport succeeds, and either
35315 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
35316 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
35317 passed to the shadow transport, with the same delivery address or addresses. If
35318 expansion fails, no action is taken except that non-forced expansion failures
35319 cause a log line to be written.
35322 The result of the shadow transport is discarded and does not affect the
35323 subsequent processing of the message. Only a single level of shadowing is
35324 provided; the <option>shadow_transport</option> option is ignored on any transport when it
35325 is running as a shadow. Options concerned with output from pipes are also
35326 ignored. The log line for the successful delivery has an item added on the end,
35329 <literallayout class="monospaced">
35330 ST=<shadow transport name>
35333 If the shadow transport did not succeed, the error message is put in
35334 parentheses afterwards. Shadow transports can be used for a number of different
35335 purposes, including keeping more detailed log information than Exim normally
35336 provides, and implementing automatic acknowledgement policies based on message
35337 headers that some sites insist on.
35340 <indexterm role="option">
35341 <primary><option>transport_filter</option></primary>
35344 <informaltable frame="all">
35345 <tgroup cols="4" colsep="0" rowsep="0">
35346 <colspec colwidth="8*" align="left"/>
35347 <colspec colwidth="5*" align="center"/>
35348 <colspec colwidth="5*" align="center"/>
35349 <colspec colwidth="6*" align="right"/>
35352 <entry><option>transport_filter</option></entry>
35353 <entry>Use: <emphasis>transports</emphasis></entry>
35354 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35355 <entry>Default: <emphasis>unset</emphasis></entry>
35361 <indexterm role="concept">
35362 <primary>transport</primary>
35363 <secondary>filter</secondary>
35365 <indexterm role="concept">
35366 <primary>filter</primary>
35367 <secondary>transport filter</secondary>
35369 This option sets up a filtering (in the Unix shell sense) process for messages
35370 at transport time. It should not be confused with mail filtering as set up by
35371 individual users or via a system filter.
35374 When the message is about to be written out, the command specified by
35375 <option>transport_filter</option> is started up in a separate, parallel process, and
35376 the entire message, including the header lines, is passed to it on its standard
35377 input (this in fact is done from a third process, to avoid deadlock). The
35378 command must be specified as an absolute path.
35381 The lines of the message that are written to the transport filter are
35382 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
35383 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
35384 lines beginning with a dot, and also before any processing implied by the
35385 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
35386 <command>pipe</command> transports.
35389 The standard error for the filter process is set to the same destination as its
35390 standard output; this is read and written to the message’s ultimate
35391 destination. The process that writes the message to the filter, the
35392 filter itself, and the original process that reads the result and delivers it
35393 are all run in parallel, like a shell pipeline.
35396 The filter can perform any transformations it likes, but of course should take
35397 care not to break RFC 2822 syntax. A demonstration Perl script is provided in
35398 <filename>util/transport-filter.pl</filename>; this makes a few arbitrary modifications just to
35399 show the possibilities. Exim does not check the result, except to test for a
35400 final newline when SMTP is in use. All messages transmitted over SMTP must end
35401 with a newline, so Exim supplies one if it is missing.
35404 <indexterm role="concept">
35405 <primary>content scanning</primary>
35406 <secondary>per user</secondary>
35408 A transport filter can be used to provide content-scanning on a per-user basis
35409 at delivery time if the only required effect of the scan is to modify the
35410 message. For example, a content scan could insert a new header line containing
35411 a spam score. This could be interpreted by a filter in the user’s MUA. It is
35412 not possible to discard a message at this stage.
35415 <indexterm role="concept">
35416 <primary>SMTP</primary>
35417 <secondary>SIZE</secondary>
35419 A problem might arise if the filter increases the size of a message that is
35420 being sent down an SMTP connection. If the receiving SMTP server has indicated
35421 support for the SIZE parameter, Exim will have sent the size of the message
35422 at the start of the SMTP session. If what is actually sent is substantially
35423 more, the server might reject the message. This can be worked round by setting
35424 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
35425 additions to the message, or to disable the use of SIZE altogether.
35428 <indexterm role="concept">
35429 <primary><varname>$pipe_addresses</varname></primary>
35431 The value of the <option>transport_filter</option> option is the command string for starting
35432 the filter, which is run directly from Exim, not under a shell. The string is
35433 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
35434 Exim breaks it up into arguments and then expands each argument separately (see
35435 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
35436 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
35437 of arguments, one for each address that applies to this delivery. (This isn’t
35438 an ideal name for this feature here, but as it was already implemented for the
35439 <command>pipe</command> transport, it seemed sensible not to change it.)
35442 <indexterm role="concept">
35443 <primary><varname>$host</varname></primary>
35445 <indexterm role="concept">
35446 <primary><varname>$host_address</varname></primary>
35448 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
35449 transport is a remote one. They contain the name and IP address of the host to
35450 which the message is being sent. For example:
35452 <literallayout class="monospaced">
35453 transport_filter = /some/directory/transport-filter.pl \
35454 $host $host_address $sender_address $pipe_addresses
35457 Two problems arise if you want to use more complicated expansion items to
35458 generate transport filter commands, both of which due to the fact that the
35459 command is split up <emphasis>before</emphasis> expansion.
35464 If an expansion item contains white space, you must quote it, so that it is all
35465 part of the same command item. If the entire option setting is one such
35466 expansion item, you have to take care what kind of quoting you use. For
35469 <literallayout class="monospaced">
35470 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
35473 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
35474 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
35475 stripped by Exim when it read the option’s value. When the value is used, if
35476 the single quotes were missing, the line would be split into two items,
35477 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
35478 Exim tried to expand the first one.
35483 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
35484 expansion cannot generate multiple arguments, or a command name followed by
35485 arguments. Consider this example:
35487 <literallayout class="monospaced">
35488 transport_filter = ${lookup{$host}lsearch{/some/file}\
35489 {$value}{/bin/cat}}
35492 The result of the lookup is interpreted as the name of the command, even
35493 if it contains white space. The simplest way round this is to use a shell:
35495 <literallayout class="monospaced">
35496 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/some/file}\
35497 {$value}{/bin/cat}}
35502 The filter process is run under the same uid and gid as the normal delivery.
35503 For remote deliveries this is the Exim uid/gid by default. The command should
35504 normally yield a zero return code. Transport filters are not supposed to fail.
35505 A non-zero code is taken to mean that the transport filter encountered some
35506 serious problem. Delivery of the message is deferred; the message remains on
35507 the queue and is tried again later. It is not possible to cause a message to be
35508 bounced from a transport filter.
35511 If a transport filter is set on an autoreply transport, the original message is
35512 passed through the filter as it is being copied into the newly generated
35513 message, which happens if the <option>return_message</option> option is set.
35516 <indexterm role="option">
35517 <primary><option>transport_filter_timeout</option></primary>
35520 <informaltable frame="all">
35521 <tgroup cols="4" colsep="0" rowsep="0">
35522 <colspec colwidth="8*" align="left"/>
35523 <colspec colwidth="5*" align="center"/>
35524 <colspec colwidth="5*" align="center"/>
35525 <colspec colwidth="6*" align="right"/>
35528 <entry><option>transport_filter_timeout</option></entry>
35529 <entry>Use: <emphasis>transports</emphasis></entry>
35530 <entry>Type: <emphasis>time</emphasis></entry>
35531 <entry>Default: <emphasis>5m</emphasis></entry>
35537 <indexterm role="concept">
35538 <primary>transport filter</primary>
35539 <secondary>timeout</secondary>
35541 When Exim is reading the output of a transport filter, it a applies a timeout
35542 that can be set by this option. Exceeding the timeout is normally treated as a
35543 temporary delivery failure. However, if a transport filter is used with a
35544 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
35545 way as a timeout in the pipe command itself. By default, a timeout is a hard
35546 error, but if the <command>pipe</command> transport’s <option>timeout_defer</option> option is set true, it
35547 becomes a temporary error.
35550 <indexterm role="option">
35551 <primary><option>user</option></primary>
35554 <informaltable frame="all">
35555 <tgroup cols="4" colsep="0" rowsep="0">
35556 <colspec colwidth="8*" align="left"/>
35557 <colspec colwidth="5*" align="center"/>
35558 <colspec colwidth="5*" align="center"/>
35559 <colspec colwidth="6*" align="right"/>
35562 <entry><option>user</option></entry>
35563 <entry>Use: <emphasis>transports</emphasis></entry>
35564 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35565 <entry>Default: <emphasis>Exim user</emphasis></entry>
35571 <indexterm role="concept">
35572 <primary>uid (user id)</primary>
35573 <secondary>local delivery</secondary>
35575 <indexterm role="concept">
35576 <primary>transport user</primary>
35577 <secondary>specifying</secondary>
35579 This option specifies the user under whose uid the delivery process is to be
35580 run, overriding any uid that may have been set by the router. If the user is
35581 given as a name, the uid is looked up from the password data, and the
35582 associated group is taken as the value of the gid to be used if the <option>group</option>
35586 For deliveries that use local transports, a user and group are normally
35587 specified explicitly or implicitly (for example, as a result of
35588 <option>check_local_user</option>) by the router or transport.
35591 <indexterm role="concept">
35592 <primary>hints database</primary>
35593 <secondary>access by remote transport</secondary>
35595 For remote transports, you should leave this option unset unless you really are
35596 sure you know what you are doing. When a remote transport is running, it needs
35597 to be able to access Exim’s hints databases, because each host may have its own
35599 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
35600 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
35601 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
35605 <chapter id="CHAPbatching">
35606 <title>Address batching in local transports</title>
35607 <titleabbrev>Address batching</titleabbrev>
35609 <indexterm role="concept">
35610 <primary>transport</primary>
35611 <secondary>local; address batching in</secondary>
35613 The only remote transport (<command>smtp</command>) is normally configured to handle more than
35614 one address at a time, so that when several addresses are routed to the same
35615 remote host, just one copy of the message is sent. Local transports, however,
35616 normally handle one address at a time. That is, a separate instance of the
35617 transport is run for each address that is routed to the transport. A separate
35618 copy of the message is delivered each time.
35621 <indexterm role="concept">
35622 <primary>batched local delivery</primary>
35624 <indexterm role="concept">
35625 <primary><option>batch_max</option></primary>
35627 <indexterm role="concept">
35628 <primary><option>batch_id</option></primary>
35630 In special cases, it may be desirable to handle several addresses at once in a
35631 local transport, for example:
35636 In an <command>appendfile</command> transport, when storing messages in files for later
35637 delivery by some other means, a single copy of the message with multiple
35638 recipients saves space.
35643 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
35644 a single copy saves time, and is the normal way LMTP is expected to work.
35649 In a <command>pipe</command> transport, when passing the message
35650 to a scanner program or
35651 to some other delivery mechanism such as UUCP, multiple recipients may be
35657 These three local transports all have the same options for controlling multiple
35658 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
35659 repeating the information for each transport, these options are described here.
35662 The <option>batch_max</option> option specifies the maximum number of addresses that can be
35663 delivered together in a single run of the transport. Its default value is one
35664 (no batching). When more than one address is routed to a transport that has a
35665 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
35666 (that is, in a single run of the transport with multiple recipients), subject
35667 to certain conditions:
35672 <indexterm role="concept">
35673 <primary><varname>$local_part</varname></primary>
35675 If any of the transport’s options contain a reference to <varname>$local_part</varname>, no
35676 batching is possible.
35681 <indexterm role="concept">
35682 <primary><varname>$domain</varname></primary>
35684 If any of the transport’s options contain a reference to <varname>$domain</varname>, only
35685 addresses with the same domain are batched.
35690 <indexterm role="concept">
35691 <primary>customizing</primary>
35692 <secondary>batching condition</secondary>
35694 If <option>batch_id</option> is set, it is expanded for each address, and only those
35695 addresses with the same expanded value are batched. This allows you to specify
35696 customized batching conditions. Failure of the expansion for any reason,
35697 including forced failure, disables batching, but it does not stop the delivery
35703 Batched addresses must also have the same errors address (where to send
35704 delivery errors), the same header additions and removals, the same user and
35705 group for the transport, and if a host list is present, the first host must
35711 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
35712 both when the file or pipe command is specified in the transport, and when it
35713 is specified by a <command>redirect</command> router, but all the batched addresses must of
35714 course be routed to the same file or pipe command. These two transports have an
35715 option called <option>use_bsmtp</option>, which causes them to deliver the message in
35716 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
35717 <option>check_string</option> and <option>escape_string</option> options are forced to the values
35719 <literallayout class="monospaced">
35721 escape_string = ".."
35724 when batched SMTP is in use. A full description of the batch SMTP mechanism is
35725 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
35726 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
35729 <indexterm role="concept">
35730 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
35732 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
35733 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
35734 that are being processed together. If you are using a batching <command>appendfile</command>
35735 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
35736 addresses is to set the <option>envelope_to_add</option> option.
35739 <indexterm role="concept">
35740 <primary><command>pipe</command> transport</primary>
35741 <secondary>with multiple addresses</secondary>
35743 <indexterm role="concept">
35744 <primary><varname>$pipe_addresses</varname></primary>
35746 If you are using a <command>pipe</command> transport without BSMTP, and setting the
35747 transport’s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
35748 the command. This is not a true variable; it is a bit of magic that causes each
35749 of the recipient addresses to be inserted into the command as a separate
35750 argument. This provides a way of accessing all the addresses that are being
35751 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
35752 are specififed by a <command>redirect</command> router.
35756 <chapter id="CHAPappendfile">
35757 <title>The appendfile transport</title>
35759 <indexterm role="concept" id="IIDapptra1" class="startofrange">
35760 <primary><command>appendfile</command> transport</primary>
35762 <indexterm role="concept" id="IIDapptra2" class="startofrange">
35763 <primary>transports</primary>
35764 <secondary><command>appendfile</command></secondary>
35766 <indexterm role="concept">
35767 <primary>directory creation</primary>
35769 <indexterm role="concept">
35770 <primary>creating directories</primary>
35772 The <command>appendfile</command> transport delivers a message by appending it to an existing
35773 file, or by creating an entirely new file in a specified directory. Single
35774 files to which messages are appended can be in the traditional Unix mailbox
35775 format, or optionally in the MBX format supported by the Pine MUA and
35776 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
35777 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
35778 to give added protection against failures that happen part-way through the
35779 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
35780 supported. For all file formats, Exim attempts to create as many levels of
35781 directory as necessary, provided that <option>create_directory</option> is set.
35784 The code for the optional formats is not included in the Exim binary by
35785 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
35786 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
35790 <indexterm role="concept">
35791 <primary>quota</primary>
35792 <secondary>system</secondary>
35794 Exim recognises system quota errors, and generates an appropriate message. Exim
35795 also supports its own quota control within the transport, for use when the
35796 system facility is unavailable or cannot be used for some reason.
35799 If there is an error while appending to a file (for example, quota exceeded or
35800 partition filled), Exim attempts to reset the file’s length and last
35801 modification time back to what they were before. If there is an error while
35802 creating an entirely new file, the new file is removed.
35805 Before appending to a file, a number of security checks are made, and the
35806 file is locked. A detailed description is given below, after the list of
35810 The <command>appendfile</command> transport is most commonly used for local deliveries to
35811 users’ mailboxes. However, it can also be used as a pseudo-remote transport for
35812 putting messages into files for remote delivery by some means other than Exim.
35813 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
35816 <section id="SECTfildiropt">
35817 <title>The file and directory options</title>
35819 The <option>file</option> option specifies a single file, to which the message is appended;
35820 the <option>directory</option> option specifies a directory, in which a new file containing
35821 the message is created. Only one of these two options can be set, and for
35822 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
35825 <indexterm role="concept">
35826 <primary><varname>$address_file</varname></primary>
35828 <indexterm role="concept">
35829 <primary><varname>$local_part</varname></primary>
35831 However, <command>appendfile</command> is also used for delivering messages to files or
35832 directories whose names (or parts of names) are obtained from alias,
35833 forwarding, or filtering operations (for example, a <option>save</option> command in a
35834 user’s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
35835 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
35836 name (or partial name) of the file or directory generated by the redirection
35837 operation. There are two cases:
35842 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
35843 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
35844 common case when users with local accounts use filtering to sort mail into
35845 different folders. See for example, the <command>address_file</command> transport in the
35846 default configuration. If the path ends with a slash, it is assumed to be the
35847 name of a directory. A delivery to a directory can also be forced by setting
35848 <option>maildir_format</option> or <option>mailstore_format</option>.
35853 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
35854 used to determine the file or directory name for the delivery. Normally, the
35855 contents of <varname>$address_file</varname> are used in some way in the string expansion.
35860 <indexterm role="concept">
35861 <primary>Sieve filter</primary>
35862 <secondary>configuring <command>appendfile</command></secondary>
35864 <indexterm role="concept">
35865 <primary>Sieve filter</primary>
35866 <secondary>relative mailbox path handling</secondary>
35868 As an example of the second case, consider an environment where users do not
35869 have home directories. They may be permitted to use Exim filter commands of the
35872 <literallayout class="monospaced">
35876 or Sieve filter commands of the form:
35878 <literallayout class="monospaced">
35879 require "fileinto";
35880 fileinto "folder23";
35883 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
35884 must transform the relative path into an appropriate absolute file name. In the
35885 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
35886 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
35887 way of handling this requirement:
35889 <literallayout class="monospaced">
35890 file = ${if eq{$address_file}{inbox} \
35891 {/var/mail/$local_part} \
35892 {${if eq{${substr_0_1:$address_file}}{/} \
35894 {$home/mail/$address_file} \
35899 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
35900 location, absolute paths are used without change, and other folders are in the
35901 <filename>mail</filename> directory within the home directory.
35904 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
35905 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
35906 the router. In particular, this is the case if <option>check_local_user</option> is set. If
35907 you want to prevent this happening at routing time, you can set
35908 <option>router_home_directory</option> empty. This forces the router to pass the relative
35909 path to the transport.
35912 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
35913 the <option>file</option> or <option>directory</option> option is still used if it is set.
35917 <title>Private options for appendfile</title>
35919 <indexterm role="concept">
35920 <primary>options</primary>
35921 <secondary><command>appendfile</command> transport</secondary>
35925 <indexterm role="option">
35926 <primary><option>allow_fifo</option></primary>
35929 <informaltable frame="all">
35930 <tgroup cols="4" colsep="0" rowsep="0">
35931 <colspec colwidth="8*" align="left"/>
35932 <colspec colwidth="5*" align="center"/>
35933 <colspec colwidth="5*" align="center"/>
35934 <colspec colwidth="6*" align="right"/>
35937 <entry><option>allow_fifo</option></entry>
35938 <entry>Use: <emphasis>appendfile</emphasis></entry>
35939 <entry>Type: <emphasis>boolean</emphasis></entry>
35940 <entry>Default: <emphasis>false</emphasis></entry>
35946 <indexterm role="concept">
35947 <primary>fifo (named pipe)</primary>
35949 <indexterm role="concept">
35950 <primary>named pipe (fifo)</primary>
35952 <indexterm role="concept">
35953 <primary>pipe</primary>
35954 <secondary>named (fifo)</secondary>
35956 Setting this option permits delivery to named pipes (FIFOs) as well as to
35957 regular files. If no process is reading the named pipe at delivery time, the
35958 delivery is deferred.
35961 <indexterm role="option">
35962 <primary><option>allow_symlink</option></primary>
35965 <informaltable frame="all">
35966 <tgroup cols="4" colsep="0" rowsep="0">
35967 <colspec colwidth="8*" align="left"/>
35968 <colspec colwidth="5*" align="center"/>
35969 <colspec colwidth="5*" align="center"/>
35970 <colspec colwidth="6*" align="right"/>
35973 <entry><option>allow_symlink</option></entry>
35974 <entry>Use: <emphasis>appendfile</emphasis></entry>
35975 <entry>Type: <emphasis>boolean</emphasis></entry>
35976 <entry>Default: <emphasis>false</emphasis></entry>
35982 <indexterm role="concept">
35983 <primary>symbolic link</primary>
35984 <secondary>to mailbox</secondary>
35986 <indexterm role="concept">
35987 <primary>mailbox</primary>
35988 <secondary>symbolic link</secondary>
35990 By default, <command>appendfile</command> will not deliver if the path name for the file is
35991 that of a symbolic link. Setting this option relaxes that constraint, but there
35992 are security issues involved in the use of symbolic links. Be sure you know
35993 what you are doing if you set this. Details of exactly what this option affects
35994 are included in the discussion which follows this list of options.
35997 <indexterm role="option">
35998 <primary><option>batch_id</option></primary>
36001 <informaltable frame="all">
36002 <tgroup cols="4" colsep="0" rowsep="0">
36003 <colspec colwidth="8*" align="left"/>
36004 <colspec colwidth="5*" align="center"/>
36005 <colspec colwidth="5*" align="center"/>
36006 <colspec colwidth="6*" align="right"/>
36009 <entry><option>batch_id</option></entry>
36010 <entry>Use: <emphasis>appendfile</emphasis></entry>
36011 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36012 <entry>Default: <emphasis>unset</emphasis></entry>
36018 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
36019 However, batching is automatically disabled for <command>appendfile</command> deliveries that
36020 happen as a result of forwarding or aliasing or other redirection directly to a
36024 <indexterm role="option">
36025 <primary><option>batch_max</option></primary>
36028 <informaltable frame="all">
36029 <tgroup cols="4" colsep="0" rowsep="0">
36030 <colspec colwidth="8*" align="left"/>
36031 <colspec colwidth="5*" align="center"/>
36032 <colspec colwidth="5*" align="center"/>
36033 <colspec colwidth="6*" align="right"/>
36036 <entry><option>batch_max</option></entry>
36037 <entry>Use: <emphasis>appendfile</emphasis></entry>
36038 <entry>Type: <emphasis>integer</emphasis></entry>
36039 <entry>Default: <emphasis>1</emphasis></entry>
36045 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
36048 <indexterm role="option">
36049 <primary><option>check_group</option></primary>
36052 <informaltable frame="all">
36053 <tgroup cols="4" colsep="0" rowsep="0">
36054 <colspec colwidth="8*" align="left"/>
36055 <colspec colwidth="5*" align="center"/>
36056 <colspec colwidth="5*" align="center"/>
36057 <colspec colwidth="6*" align="right"/>
36060 <entry><option>check_group</option></entry>
36061 <entry>Use: <emphasis>appendfile</emphasis></entry>
36062 <entry>Type: <emphasis>boolean</emphasis></entry>
36063 <entry>Default: <emphasis>false</emphasis></entry>
36069 When this option is set, the group owner of the file defined by the <option>file</option>
36070 option is checked to see that it is the same as the group under which the
36071 delivery process is running. The default setting is false because the default
36072 file mode is 0600, which means that the group is irrelevant.
36075 <indexterm role="option">
36076 <primary><option>check_owner</option></primary>
36079 <informaltable frame="all">
36080 <tgroup cols="4" colsep="0" rowsep="0">
36081 <colspec colwidth="8*" align="left"/>
36082 <colspec colwidth="5*" align="center"/>
36083 <colspec colwidth="5*" align="center"/>
36084 <colspec colwidth="6*" align="right"/>
36087 <entry><option>check_owner</option></entry>
36088 <entry>Use: <emphasis>appendfile</emphasis></entry>
36089 <entry>Type: <emphasis>boolean</emphasis></entry>
36090 <entry>Default: <emphasis>true</emphasis></entry>
36096 When this option is set, the owner of the file defined by the <option>file</option> option
36097 is checked to ensure that it is the same as the user under which the delivery
36098 process is running.
36101 <indexterm role="option">
36102 <primary><option>check_string</option></primary>
36105 <informaltable frame="all">
36106 <tgroup cols="4" colsep="0" rowsep="0">
36107 <colspec colwidth="8*" align="left"/>
36108 <colspec colwidth="5*" align="center"/>
36109 <colspec colwidth="5*" align="center"/>
36110 <colspec colwidth="6*" align="right"/>
36113 <entry><option>check_string</option></entry>
36114 <entry>Use: <emphasis>appendfile</emphasis></entry>
36115 <entry>Type: <emphasis>string</emphasis></entry>
36116 <entry>Default: <emphasis>see below</emphasis></entry>
36122 <indexterm role="concept">
36123 <primary><quote>From</quote> line</primary>
36125 As <command>appendfile</command> writes the message, the start of each line is tested for
36126 matching <option>check_string</option>, and if it does, the initial matching characters are
36127 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
36128 a literal string, not a regular expression, and the case of any letters it
36129 contains is significant.
36132 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
36133 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
36134 configuration are ignored. Otherwise, they default to <quote>From </quote> and
36135 <quote>>From </quote> when the <option>file</option> option is set, and unset when any of the
36136 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
36139 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
36140 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
36141 <quote>From </quote> indicates the start of a new message. All four options need changing
36142 if another format is used. For example, to deliver to mailboxes in MMDF format:
36143 <indexterm role="concept">
36144 <primary>MMDF format mailbox</primary>
36146 <indexterm role="concept">
36147 <primary>mailbox</primary>
36148 <secondary>MMDF format</secondary>
36151 <literallayout class="monospaced">
36152 check_string = "\1\1\1\1\n"
36153 escape_string = "\1\1\1\1 \n"
36154 message_prefix = "\1\1\1\1\n"
36155 message_suffix = "\1\1\1\1\n"
36158 <indexterm role="option">
36159 <primary><option>create_directory</option></primary>
36162 <informaltable frame="all">
36163 <tgroup cols="4" colsep="0" rowsep="0">
36164 <colspec colwidth="8*" align="left"/>
36165 <colspec colwidth="5*" align="center"/>
36166 <colspec colwidth="5*" align="center"/>
36167 <colspec colwidth="6*" align="right"/>
36170 <entry><option>create_directory</option></entry>
36171 <entry>Use: <emphasis>appendfile</emphasis></entry>
36172 <entry>Type: <emphasis>boolean</emphasis></entry>
36173 <entry>Default: <emphasis>true</emphasis></entry>
36179 <indexterm role="concept">
36180 <primary>directory creation</primary>
36182 When this option is true, Exim attempts to create any missing superior
36183 directories for the file that it is about to write. A created directory’s mode
36184 is given by the <option>directory_mode</option> option.
36187 The group ownership of a newly created directory is highly dependent on the
36188 operating system (and possibly the file system) that is being used. For
36189 example, in Solaris, if the parent directory has the setgid bit set, its group
36190 is propagated to the child; if not, the currently set group is used. However,
36191 in FreeBSD, the parent’s group is always used.
36194 <indexterm role="option">
36195 <primary><option>create_file</option></primary>
36198 <informaltable frame="all">
36199 <tgroup cols="4" colsep="0" rowsep="0">
36200 <colspec colwidth="8*" align="left"/>
36201 <colspec colwidth="5*" align="center"/>
36202 <colspec colwidth="5*" align="center"/>
36203 <colspec colwidth="6*" align="right"/>
36206 <entry><option>create_file</option></entry>
36207 <entry>Use: <emphasis>appendfile</emphasis></entry>
36208 <entry>Type: <emphasis>string</emphasis></entry>
36209 <entry>Default: <emphasis>anywhere</emphasis></entry>
36215 This option constrains the location of files and directories that are created
36216 by this transport. It applies to files defined by the <option>file</option> option and
36217 directories defined by the <option>directory</option> option. In the case of maildir
36218 delivery, it applies to the top level directory, not the maildir directories
36222 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
36223 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
36224 set for the transport. This option is not useful when an explicit file name is
36225 given for normal mailbox deliveries. It is intended for the case when file
36226 names are generated from users’ <filename>.forward</filename> files. These are usually handled
36227 by an <command>appendfile</command> transport called <option>address_file</option>. See also
36228 <option>file_must_exist</option>.
36231 <indexterm role="option">
36232 <primary><option>directory</option></primary>
36235 <informaltable frame="all">
36236 <tgroup cols="4" colsep="0" rowsep="0">
36237 <colspec colwidth="8*" align="left"/>
36238 <colspec colwidth="5*" align="center"/>
36239 <colspec colwidth="5*" align="center"/>
36240 <colspec colwidth="6*" align="right"/>
36243 <entry><option>directory</option></entry>
36244 <entry>Use: <emphasis>appendfile</emphasis></entry>
36245 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36246 <entry>Default: <emphasis>unset</emphasis></entry>
36252 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
36253 or <option>directory</option> must be set, unless the delivery is the direct result of a
36254 redirection (see section <xref linkend="SECTfildiropt"/>).
36257 When <option>directory</option> is set, the string is expanded, and the message is delivered
36258 into a new file or files in or below the given directory, instead of being
36259 appended to a single mailbox file. A number of different formats are provided
36260 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
36261 <xref linkend="SECTopdir"/> for further details of this form of delivery.
36264 <indexterm role="option">
36265 <primary><option>directory_file</option></primary>
36268 <informaltable frame="all">
36269 <tgroup cols="4" colsep="0" rowsep="0">
36270 <colspec colwidth="8*" align="left"/>
36271 <colspec colwidth="5*" align="center"/>
36272 <colspec colwidth="5*" align="center"/>
36273 <colspec colwidth="6*" align="right"/>
36276 <entry><option>directory_file</option></entry>
36277 <entry>Use: <emphasis>appendfile</emphasis></entry>
36278 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36279 <entry>Default: <emphasis><literal>q${base62:$tod_epoch}-$inode</literal></emphasis></entry>
36285 <indexterm role="concept">
36286 <primary>base62</primary>
36288 <indexterm role="concept">
36289 <primary><varname>$inode</varname></primary>
36291 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
36292 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
36293 whose name is obtained by expanding this string. The default value generates a
36294 unique name from the current time, in base 62 form, and the inode of the file.
36295 The variable <varname>$inode</varname> is available only when expanding this option.
36298 <indexterm role="option">
36299 <primary><option>directory_mode</option></primary>
36302 <informaltable frame="all">
36303 <tgroup cols="4" colsep="0" rowsep="0">
36304 <colspec colwidth="8*" align="left"/>
36305 <colspec colwidth="5*" align="center"/>
36306 <colspec colwidth="5*" align="center"/>
36307 <colspec colwidth="6*" align="right"/>
36310 <entry><option>directory_mode</option></entry>
36311 <entry>Use: <emphasis>appendfile</emphasis></entry>
36312 <entry>Type: <emphasis>octal integer</emphasis></entry>
36313 <entry>Default: <emphasis>0700</emphasis></entry>
36319 If <command>appendfile</command> creates any directories as a result of the
36320 <option>create_directory</option> option, their mode is specified by this option.
36323 <indexterm role="option">
36324 <primary><option>escape_string</option></primary>
36327 <informaltable frame="all">
36328 <tgroup cols="4" colsep="0" rowsep="0">
36329 <colspec colwidth="8*" align="left"/>
36330 <colspec colwidth="5*" align="center"/>
36331 <colspec colwidth="5*" align="center"/>
36332 <colspec colwidth="6*" align="right"/>
36335 <entry><option>escape_string</option></entry>
36336 <entry>Use: <emphasis>appendfile</emphasis></entry>
36337 <entry>Type: <emphasis>string</emphasis></entry>
36338 <entry>Default: <emphasis>see description</emphasis></entry>
36344 See <option>check_string</option> above.
36347 <indexterm role="option">
36348 <primary><option>file</option></primary>
36351 <informaltable frame="all">
36352 <tgroup cols="4" colsep="0" rowsep="0">
36353 <colspec colwidth="8*" align="left"/>
36354 <colspec colwidth="5*" align="center"/>
36355 <colspec colwidth="5*" align="center"/>
36356 <colspec colwidth="6*" align="right"/>
36359 <entry><option>file</option></entry>
36360 <entry>Use: <emphasis>appendfile</emphasis></entry>
36361 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36362 <entry>Default: <emphasis>unset</emphasis></entry>
36368 This option is mutually exclusive with the <option>directory</option> option, but one of
36369 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
36370 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
36371 specifies a single file, to which the message is appended. One or more of
36372 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
36373 <option>file</option>.
36376 <indexterm role="concept">
36377 <primary>NFS</primary>
36378 <secondary>lock file</secondary>
36380 <indexterm role="concept">
36381 <primary>locking files</primary>
36383 <indexterm role="concept">
36384 <primary>lock files</primary>
36386 If you are using more than one host to deliver over NFS into the same
36387 mailboxes, you should always use lock files.
36390 The string value is expanded for each delivery, and must yield an absolute
36391 path. The most common settings of this option are variations on one of these
36394 <literallayout class="monospaced">
36395 file = /var/spool/mail/$local_part
36396 file = /home/$local_part/inbox
36400 <indexterm role="concept">
36401 <primary><quote>sticky</quote> bit</primary>
36403 In the first example, all deliveries are done into the same directory. If Exim
36404 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
36405 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
36406 deliveries to be possible, or alternatively the <option>group</option> option can be used to
36407 run the delivery under a group id which has write access to the directory.
36410 <indexterm role="option">
36411 <primary><option>file_format</option></primary>
36414 <informaltable frame="all">
36415 <tgroup cols="4" colsep="0" rowsep="0">
36416 <colspec colwidth="8*" align="left"/>
36417 <colspec colwidth="5*" align="center"/>
36418 <colspec colwidth="5*" align="center"/>
36419 <colspec colwidth="6*" align="right"/>
36422 <entry><option>file_format</option></entry>
36423 <entry>Use: <emphasis>appendfile</emphasis></entry>
36424 <entry>Type: <emphasis>string</emphasis></entry>
36425 <entry>Default: <emphasis>unset</emphasis></entry>
36431 <indexterm role="concept">
36432 <primary>file</primary>
36433 <secondary>mailbox; checking existing format</secondary>
36435 This option requests the transport to check the format of an existing file
36436 before adding to it. The check consists of matching a specific string at the
36437 start of the file. The value of the option consists of an even number of
36438 colon-separated strings. The first of each pair is the test string, and the
36439 second is the name of a transport. If the transport associated with a matched
36440 string is not the current transport, control is passed over to the other
36441 transport. For example, suppose the standard <command>local_delivery</command> transport has
36444 <literallayout class="monospaced">
36445 file_format = "From : local_delivery :\
36446 \1\1\1\1\n : local_mmdf_delivery"
36449 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
36450 a mailbox begins with four binary ones followed by a newline, control is passed
36451 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
36452 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
36453 is assumed to match the current transport. If the start of a mailbox doesn’t
36454 match any string, or if the transport named for a given string is not defined,
36455 delivery is deferred.
36458 <indexterm role="option">
36459 <primary><option>file_must_exist</option></primary>
36462 <informaltable frame="all">
36463 <tgroup cols="4" colsep="0" rowsep="0">
36464 <colspec colwidth="8*" align="left"/>
36465 <colspec colwidth="5*" align="center"/>
36466 <colspec colwidth="5*" align="center"/>
36467 <colspec colwidth="6*" align="right"/>
36470 <entry><option>file_must_exist</option></entry>
36471 <entry>Use: <emphasis>appendfile</emphasis></entry>
36472 <entry>Type: <emphasis>boolean</emphasis></entry>
36473 <entry>Default: <emphasis>false</emphasis></entry>
36479 If this option is true, the file specified by the <option>file</option> option must exist.
36480 A temporary error occurs if it does not, causing delivery to be deferred.
36481 If this option is false, the file is created if it does not exist.
36484 <indexterm role="option">
36485 <primary><option>lock_fcntl_timeout</option></primary>
36488 <informaltable frame="all">
36489 <tgroup cols="4" colsep="0" rowsep="0">
36490 <colspec colwidth="8*" align="left"/>
36491 <colspec colwidth="5*" align="center"/>
36492 <colspec colwidth="5*" align="center"/>
36493 <colspec colwidth="6*" align="right"/>
36496 <entry><option>lock_fcntl_timeout</option></entry>
36497 <entry>Use: <emphasis>appendfile</emphasis></entry>
36498 <entry>Type: <emphasis>time</emphasis></entry>
36499 <entry>Default: <emphasis>0s</emphasis></entry>
36505 <indexterm role="concept">
36506 <primary>timeout</primary>
36507 <secondary>mailbox locking</secondary>
36509 <indexterm role="concept">
36510 <primary>mailbox locking</primary>
36511 <secondary>blocking and non-blocking</secondary>
36513 <indexterm role="concept">
36514 <primary>locking files</primary>
36516 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
36517 when locking an open mailbox file. If the call fails, the delivery process
36518 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
36519 Non-blocking calls are used so that the file is not kept open during the wait
36520 for the lock; the reason for this is to make it as safe as possible for
36521 deliveries over NFS in the case when processes might be accessing an NFS
36522 mailbox without using a lock file. This should not be done, but
36523 misunderstandings and hence misconfigurations are not unknown.
36526 On a busy system, however, the performance of a non-blocking lock approach is
36527 not as good as using a blocking lock with a timeout. In this case, the waiting
36528 is done inside the system call, and Exim’s delivery process acquires the lock
36529 and can proceed as soon as the previous lock holder releases it.
36532 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
36533 timeout, are used. There may still be some retrying: the maximum number of
36536 <literallayout class="monospaced">
36537 (lock_retries * lock_interval) / lock_fcntl_timeout
36540 rounded up to the next whole number. In other words, the total time during
36541 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
36542 <option>lock_fcntl_timeout</option> is set very large.
36545 You should consider setting this option if you are getting a lot of delayed
36546 local deliveries because of errors of the form
36548 <literallayout class="monospaced">
36549 failed to lock mailbox /some/file (fcntl)
36552 <indexterm role="option">
36553 <primary><option>lock_flock_timeout</option></primary>
36556 <informaltable frame="all">
36557 <tgroup cols="4" colsep="0" rowsep="0">
36558 <colspec colwidth="8*" align="left"/>
36559 <colspec colwidth="5*" align="center"/>
36560 <colspec colwidth="5*" align="center"/>
36561 <colspec colwidth="6*" align="right"/>
36564 <entry><option>lock_flock_timeout</option></entry>
36565 <entry>Use: <emphasis>appendfile</emphasis></entry>
36566 <entry>Type: <emphasis>time</emphasis></entry>
36567 <entry>Default: <emphasis>0s</emphasis></entry>
36573 This timeout applies to file locking when using <function>flock()</function> (see
36574 <option>use_flock</option>); the timeout operates in a similar manner to
36575 <option>lock_fcntl_timeout</option>.
36578 <indexterm role="option">
36579 <primary><option>lock_interval</option></primary>
36582 <informaltable frame="all">
36583 <tgroup cols="4" colsep="0" rowsep="0">
36584 <colspec colwidth="8*" align="left"/>
36585 <colspec colwidth="5*" align="center"/>
36586 <colspec colwidth="5*" align="center"/>
36587 <colspec colwidth="6*" align="right"/>
36590 <entry><option>lock_interval</option></entry>
36591 <entry>Use: <emphasis>appendfile</emphasis></entry>
36592 <entry>Type: <emphasis>time</emphasis></entry>
36593 <entry>Default: <emphasis>3s</emphasis></entry>
36599 This specifies the time to wait between attempts to lock the file. See below
36600 for details of locking.
36603 <indexterm role="option">
36604 <primary><option>lock_retries</option></primary>
36607 <informaltable frame="all">
36608 <tgroup cols="4" colsep="0" rowsep="0">
36609 <colspec colwidth="8*" align="left"/>
36610 <colspec colwidth="5*" align="center"/>
36611 <colspec colwidth="5*" align="center"/>
36612 <colspec colwidth="6*" align="right"/>
36615 <entry><option>lock_retries</option></entry>
36616 <entry>Use: <emphasis>appendfile</emphasis></entry>
36617 <entry>Type: <emphasis>integer</emphasis></entry>
36618 <entry>Default: <emphasis>10</emphasis></entry>
36624 This specifies the maximum number of attempts to lock the file. A value of zero
36625 is treated as 1. See below for details of locking.
36628 <indexterm role="option">
36629 <primary><option>lockfile_mode</option></primary>
36632 <informaltable frame="all">
36633 <tgroup cols="4" colsep="0" rowsep="0">
36634 <colspec colwidth="8*" align="left"/>
36635 <colspec colwidth="5*" align="center"/>
36636 <colspec colwidth="5*" align="center"/>
36637 <colspec colwidth="6*" align="right"/>
36640 <entry><option>lockfile_mode</option></entry>
36641 <entry>Use: <emphasis>appendfile</emphasis></entry>
36642 <entry>Type: <emphasis>octal integer</emphasis></entry>
36643 <entry>Default: <emphasis>0600</emphasis></entry>
36649 This specifies the mode of the created lock file, when a lock file is being
36650 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
36653 <indexterm role="option">
36654 <primary><option>lockfile_timeout</option></primary>
36657 <informaltable frame="all">
36658 <tgroup cols="4" colsep="0" rowsep="0">
36659 <colspec colwidth="8*" align="left"/>
36660 <colspec colwidth="5*" align="center"/>
36661 <colspec colwidth="5*" align="center"/>
36662 <colspec colwidth="6*" align="right"/>
36665 <entry><option>lockfile_timeout</option></entry>
36666 <entry>Use: <emphasis>appendfile</emphasis></entry>
36667 <entry>Type: <emphasis>time</emphasis></entry>
36668 <entry>Default: <emphasis>30m</emphasis></entry>
36674 <indexterm role="concept">
36675 <primary>timeout</primary>
36676 <secondary>mailbox locking</secondary>
36678 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
36679 exists and is older than this value, it is assumed to have been left behind by
36680 accident, and Exim attempts to remove it.
36683 <indexterm role="option">
36684 <primary><option>mailbox_filecount</option></primary>
36687 <informaltable frame="all">
36688 <tgroup cols="4" colsep="0" rowsep="0">
36689 <colspec colwidth="8*" align="left"/>
36690 <colspec colwidth="5*" align="center"/>
36691 <colspec colwidth="5*" align="center"/>
36692 <colspec colwidth="6*" align="right"/>
36695 <entry><option>mailbox_filecount</option></entry>
36696 <entry>Use: <emphasis>appendfile</emphasis></entry>
36697 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36698 <entry>Default: <emphasis>unset</emphasis></entry>
36704 <indexterm role="concept">
36705 <primary>mailbox</primary>
36706 <secondary>specifying size of</secondary>
36708 <indexterm role="concept">
36709 <primary>size</primary>
36710 <secondary>of mailbox</secondary>
36712 If this option is set, it is expanded, and the result is taken as the current
36713 number of files in the mailbox. It must be a decimal number, optionally
36714 followed by K or M. This provides a way of obtaining this information from an
36715 external source that maintains the data.
36718 <indexterm role="option">
36719 <primary><option>mailbox_size</option></primary>
36722 <informaltable frame="all">
36723 <tgroup cols="4" colsep="0" rowsep="0">
36724 <colspec colwidth="8*" align="left"/>
36725 <colspec colwidth="5*" align="center"/>
36726 <colspec colwidth="5*" align="center"/>
36727 <colspec colwidth="6*" align="right"/>
36730 <entry><option>mailbox_size</option></entry>
36731 <entry>Use: <emphasis>appendfile</emphasis></entry>
36732 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36733 <entry>Default: <emphasis>unset</emphasis></entry>
36739 <indexterm role="concept">
36740 <primary>mailbox</primary>
36741 <secondary>specifying size of</secondary>
36743 <indexterm role="concept">
36744 <primary>size</primary>
36745 <secondary>of mailbox</secondary>
36747 If this option is set, it is expanded, and the result is taken as the current
36748 size the mailbox. It must be a decimal number, optionally followed by K or M.
36749 This provides a way of obtaining this information from an external source that
36750 maintains the data. This is likely to be helpful for maildir deliveries where
36751 it is computationally expensive to compute the size of a mailbox.
36754 <indexterm role="option">
36755 <primary><option>maildir_format</option></primary>
36758 <informaltable frame="all">
36759 <tgroup cols="4" colsep="0" rowsep="0">
36760 <colspec colwidth="8*" align="left"/>
36761 <colspec colwidth="5*" align="center"/>
36762 <colspec colwidth="5*" align="center"/>
36763 <colspec colwidth="6*" align="right"/>
36766 <entry><option>maildir_format</option></entry>
36767 <entry>Use: <emphasis>appendfile</emphasis></entry>
36768 <entry>Type: <emphasis>boolean</emphasis></entry>
36769 <entry>Default: <emphasis>false</emphasis></entry>
36775 <indexterm role="concept">
36776 <primary>maildir format</primary>
36777 <secondary>specifying</secondary>
36779 If this option is set with the <option>directory</option> option, the delivery is into a new
36780 file, in the <quote>maildir</quote> format that is used by other mail software. When the
36781 transport is activated directly from a <command>redirect</command> router (for example, the
36782 <command>address_file</command> transport in the default configuration), setting
36783 <option>maildir_format</option> causes the path received from the router to be treated as a
36784 directory, whether or not it ends with <literal>/</literal>. This option is available only if
36785 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
36786 <xref linkend="SECTmaildirdelivery"/> below for further details.
36789 <indexterm role="option">
36790 <primary><option>maildir_quota_directory_regex</option></primary>
36793 <informaltable frame="all">
36794 <tgroup cols="4" colsep="0" rowsep="0">
36795 <colspec colwidth="8*" align="left"/>
36796 <colspec colwidth="5*" align="center"/>
36797 <colspec colwidth="5*" align="center"/>
36798 <colspec colwidth="6*" align="right"/>
36801 <entry><option>maildir_quota_directory_regex</option></entry>
36802 <entry>Use: <emphasis>appendfile</emphasis></entry>
36803 <entry>Type: <emphasis>string</emphasis></entry>
36804 <entry>Default: <emphasis>See below</emphasis></entry>
36810 <indexterm role="concept">
36811 <primary>maildir format</primary>
36812 <secondary>quota; directories included in</secondary>
36814 <indexterm role="concept">
36815 <primary>quota</primary>
36816 <secondary>maildir; directories included in</secondary>
36818 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
36819 a regular expression for specifying directories, relative to the quota
36820 directory (see <option>quota_directory</option>), that should be included in the quota
36821 calculation. The default value is:
36823 <literallayout class="monospaced">
36824 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
36827 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
36828 (directories whose names begin with a dot). If you want to exclude the
36829 <filename>Trash</filename>
36830 folder from the count (as some sites do), you need to change this setting to
36832 <literallayout class="monospaced">
36833 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
36836 This uses a negative lookahead in the regular expression to exclude the
36837 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
36838 calculations, quota processing is bypassed for any messages that are delivered
36839 directly into that directory.
36842 <indexterm role="option">
36843 <primary><option>maildir_retries</option></primary>
36846 <informaltable frame="all">
36847 <tgroup cols="4" colsep="0" rowsep="0">
36848 <colspec colwidth="8*" align="left"/>
36849 <colspec colwidth="5*" align="center"/>
36850 <colspec colwidth="5*" align="center"/>
36851 <colspec colwidth="6*" align="right"/>
36854 <entry><option>maildir_retries</option></entry>
36855 <entry>Use: <emphasis>appendfile</emphasis></entry>
36856 <entry>Type: <emphasis>integer</emphasis></entry>
36857 <entry>Default: <emphasis>10</emphasis></entry>
36863 This option specifies the number of times to retry when writing a file in
36864 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
36867 <indexterm role="option">
36868 <primary><option>maildir_tag</option></primary>
36871 <informaltable frame="all">
36872 <tgroup cols="4" colsep="0" rowsep="0">
36873 <colspec colwidth="8*" align="left"/>
36874 <colspec colwidth="5*" align="center"/>
36875 <colspec colwidth="5*" align="center"/>
36876 <colspec colwidth="6*" align="right"/>
36879 <entry><option>maildir_tag</option></entry>
36880 <entry>Use: <emphasis>appendfile</emphasis></entry>
36881 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36882 <entry>Default: <emphasis>unset</emphasis></entry>
36888 This option applies only to deliveries in maildir format, and is described in
36889 section <xref linkend="SECTmaildirdelivery"/> below.
36892 <indexterm role="option">
36893 <primary><option>maildir_use_size_file</option></primary>
36896 <informaltable frame="all">
36897 <tgroup cols="4" colsep="0" rowsep="0">
36898 <colspec colwidth="8*" align="left"/>
36899 <colspec colwidth="5*" align="center"/>
36900 <colspec colwidth="5*" align="center"/>
36901 <colspec colwidth="6*" align="right"/>
36904 <entry><option>maildir_use_size_file</option></entry>
36905 <entry>Use: <emphasis>appendfile</emphasis></entry>
36906 <entry>Type: <emphasis>boolean</emphasis></entry>
36907 <entry>Default: <emphasis>false</emphasis></entry>
36913 <indexterm role="concept">
36914 <primary>maildir format</primary>
36915 <secondary><filename>maildirsize</filename> file</secondary>
36917 Setting this option true enables support for <filename>maildirsize</filename> files. Exim
36918 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
36919 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
36920 value is zero. See <option>maildir_quota_directory_regex</option> above and section
36921 <xref linkend="SECTmaildirdelivery"/> below for further details.
36924 <indexterm role="option">
36925 <primary><option>maildirfolder_create_regex</option></primary>
36928 <informaltable frame="all">
36929 <tgroup cols="4" colsep="0" rowsep="0">
36930 <colspec colwidth="8*" align="left"/>
36931 <colspec colwidth="5*" align="center"/>
36932 <colspec colwidth="5*" align="center"/>
36933 <colspec colwidth="6*" align="right"/>
36936 <entry><option>maildirfolder_create_regex</option></entry>
36937 <entry>Use: <emphasis>appendfile</emphasis></entry>
36938 <entry>Type: <emphasis>string</emphasis></entry>
36939 <entry>Default: <emphasis>unset</emphasis></entry>
36945 <indexterm role="concept">
36946 <primary>maildir format</primary>
36947 <secondary><filename>maildirfolder</filename> file</secondary>
36949 <indexterm role="concept">
36950 <primary><filename>maildirfolder</filename>, creating</primary>
36952 The value of this option is a regular expression. If it is unset, it has no
36953 effect. Otherwise, before a maildir delivery takes place, the pattern is
36954 matched against the name of the maildir directory, that is, the directory
36955 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
36956 delivery. If there is a match, Exim checks for the existence of a file called
36957 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
36958 See section <xref linkend="SECTmaildirdelivery"/> for more details.
36961 <indexterm role="option">
36962 <primary><option>mailstore_format</option></primary>
36965 <informaltable frame="all">
36966 <tgroup cols="4" colsep="0" rowsep="0">
36967 <colspec colwidth="8*" align="left"/>
36968 <colspec colwidth="5*" align="center"/>
36969 <colspec colwidth="5*" align="center"/>
36970 <colspec colwidth="6*" align="right"/>
36973 <entry><option>mailstore_format</option></entry>
36974 <entry>Use: <emphasis>appendfile</emphasis></entry>
36975 <entry>Type: <emphasis>boolean</emphasis></entry>
36976 <entry>Default: <emphasis>false</emphasis></entry>
36982 <indexterm role="concept">
36983 <primary>mailstore format</primary>
36984 <secondary>specifying</secondary>
36986 If this option is set with the <option>directory</option> option, the delivery is into two
36987 new files in <quote>mailstore</quote> format. The option is available only if
36988 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
36989 below for further details.
36992 <indexterm role="option">
36993 <primary><option>mailstore_prefix</option></primary>
36996 <informaltable frame="all">
36997 <tgroup cols="4" colsep="0" rowsep="0">
36998 <colspec colwidth="8*" align="left"/>
36999 <colspec colwidth="5*" align="center"/>
37000 <colspec colwidth="5*" align="center"/>
37001 <colspec colwidth="6*" align="right"/>
37004 <entry><option>mailstore_prefix</option></entry>
37005 <entry>Use: <emphasis>appendfile</emphasis></entry>
37006 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37007 <entry>Default: <emphasis>unset</emphasis></entry>
37013 This option applies only to deliveries in mailstore format, and is described in
37014 section <xref linkend="SECTopdir"/> below.
37017 <indexterm role="option">
37018 <primary><option>mailstore_suffix</option></primary>
37021 <informaltable frame="all">
37022 <tgroup cols="4" colsep="0" rowsep="0">
37023 <colspec colwidth="8*" align="left"/>
37024 <colspec colwidth="5*" align="center"/>
37025 <colspec colwidth="5*" align="center"/>
37026 <colspec colwidth="6*" align="right"/>
37029 <entry><option>mailstore_suffix</option></entry>
37030 <entry>Use: <emphasis>appendfile</emphasis></entry>
37031 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37032 <entry>Default: <emphasis>unset</emphasis></entry>
37038 This option applies only to deliveries in mailstore format, and is described in
37039 section <xref linkend="SECTopdir"/> below.
37042 <indexterm role="option">
37043 <primary><option>mbx_format</option></primary>
37046 <informaltable frame="all">
37047 <tgroup cols="4" colsep="0" rowsep="0">
37048 <colspec colwidth="8*" align="left"/>
37049 <colspec colwidth="5*" align="center"/>
37050 <colspec colwidth="5*" align="center"/>
37051 <colspec colwidth="6*" align="right"/>
37054 <entry><option>mbx_format</option></entry>
37055 <entry>Use: <emphasis>appendfile</emphasis></entry>
37056 <entry>Type: <emphasis>boolean</emphasis></entry>
37057 <entry>Default: <emphasis>false</emphasis></entry>
37063 <indexterm role="concept">
37064 <primary>locking files</primary>
37066 <indexterm role="concept">
37067 <primary>file</primary>
37068 <secondary>locking</secondary>
37070 <indexterm role="concept">
37071 <primary>file</primary>
37072 <secondary>MBX format</secondary>
37074 <indexterm role="concept">
37075 <primary>MBX format</primary>
37076 <secondary>specifying</secondary>
37078 This option is available only if Exim has been compiled with SUPPORT_MBX
37079 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
37080 the message is appended to the mailbox file in MBX format instead of
37081 traditional Unix format. This format is supported by Pine4 and its associated
37082 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
37085 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
37086 automatically changed by the use of <option>mbx_format</option>. They should normally be set
37087 empty when using MBX format, so this option almost always appears in this
37090 <literallayout class="monospaced">
37096 If none of the locking options are mentioned in the configuration,
37097 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
37098 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
37099 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
37100 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
37101 should not be used if any program that does not use this form of locking is
37102 going to access the mailbox, nor should it be used if the mailbox file is NFS
37103 mounted, because it works only when the mailbox is accessed from a single host.
37106 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
37107 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
37108 (this means for the whole of a Pine or IMAP session), Exim will not be able to
37109 append messages to it.
37112 <indexterm role="option">
37113 <primary><option>message_prefix</option></primary>
37116 <informaltable frame="all">
37117 <tgroup cols="4" colsep="0" rowsep="0">
37118 <colspec colwidth="8*" align="left"/>
37119 <colspec colwidth="5*" align="center"/>
37120 <colspec colwidth="5*" align="center"/>
37121 <colspec colwidth="6*" align="right"/>
37124 <entry><option>message_prefix</option></entry>
37125 <entry>Use: <emphasis>appendfile</emphasis></entry>
37126 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37127 <entry>Default: <emphasis>see below</emphasis></entry>
37133 <indexterm role="concept">
37134 <primary><quote>From</quote> line</primary>
37136 The string specified here is expanded and output at the start of every message.
37137 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
37138 in which case it is:
37140 <literallayout class="monospaced">
37141 message_prefix = "From ${if def:return_path{$return_path}\
37142 {MAILER-DAEMON}} $tod_bsdinbox\n"
37145 <indexterm role="option">
37146 <primary><option>message_suffix</option></primary>
37149 <informaltable frame="all">
37150 <tgroup cols="4" colsep="0" rowsep="0">
37151 <colspec colwidth="8*" align="left"/>
37152 <colspec colwidth="5*" align="center"/>
37153 <colspec colwidth="5*" align="center"/>
37154 <colspec colwidth="6*" align="right"/>
37157 <entry><option>message_suffix</option></entry>
37158 <entry>Use: <emphasis>appendfile</emphasis></entry>
37159 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37160 <entry>Default: <emphasis>see below</emphasis></entry>
37166 The string specified here is expanded and output at the end of every message.
37167 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
37168 in which case it is a single newline character. The suffix can be suppressed by
37171 <literallayout class="monospaced">
37175 <indexterm role="option">
37176 <primary><option>mode</option></primary>
37179 <informaltable frame="all">
37180 <tgroup cols="4" colsep="0" rowsep="0">
37181 <colspec colwidth="8*" align="left"/>
37182 <colspec colwidth="5*" align="center"/>
37183 <colspec colwidth="5*" align="center"/>
37184 <colspec colwidth="6*" align="right"/>
37187 <entry><option>mode</option></entry>
37188 <entry>Use: <emphasis>appendfile</emphasis></entry>
37189 <entry>Type: <emphasis>octal integer</emphasis></entry>
37190 <entry>Default: <emphasis>0600</emphasis></entry>
37196 If the output file is created, it is given this mode. If it already exists and
37197 has wider permissions, they are reduced to this mode. If it has narrower
37198 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
37199 if the delivery is the result of a <option>save</option> command in a filter file specifing
37200 a particular mode, the mode of the output file is always forced to take that
37201 value, and this option is ignored.
37204 <indexterm role="option">
37205 <primary><option>mode_fail_narrower</option></primary>
37208 <informaltable frame="all">
37209 <tgroup cols="4" colsep="0" rowsep="0">
37210 <colspec colwidth="8*" align="left"/>
37211 <colspec colwidth="5*" align="center"/>
37212 <colspec colwidth="5*" align="center"/>
37213 <colspec colwidth="6*" align="right"/>
37216 <entry><option>mode_fail_narrower</option></entry>
37217 <entry>Use: <emphasis>appendfile</emphasis></entry>
37218 <entry>Type: <emphasis>boolean</emphasis></entry>
37219 <entry>Default: <emphasis>true</emphasis></entry>
37225 This option applies in the case when an existing mailbox file has a narrower
37226 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
37227 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
37228 continues with the delivery attempt, using the existing mode of the file.
37231 <indexterm role="option">
37232 <primary><option>notify_comsat</option></primary>
37235 <informaltable frame="all">
37236 <tgroup cols="4" colsep="0" rowsep="0">
37237 <colspec colwidth="8*" align="left"/>
37238 <colspec colwidth="5*" align="center"/>
37239 <colspec colwidth="5*" align="center"/>
37240 <colspec colwidth="6*" align="right"/>
37243 <entry><option>notify_comsat</option></entry>
37244 <entry>Use: <emphasis>appendfile</emphasis></entry>
37245 <entry>Type: <emphasis>boolean</emphasis></entry>
37246 <entry>Default: <emphasis>false</emphasis></entry>
37252 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
37253 successful delivery to a user mailbox. This is the daemon that notifies logged
37254 on users about incoming mail.
37257 <indexterm role="option">
37258 <primary><option>quota</option></primary>
37261 <informaltable frame="all">
37262 <tgroup cols="4" colsep="0" rowsep="0">
37263 <colspec colwidth="8*" align="left"/>
37264 <colspec colwidth="5*" align="center"/>
37265 <colspec colwidth="5*" align="center"/>
37266 <colspec colwidth="6*" align="right"/>
37269 <entry><option>quota</option></entry>
37270 <entry>Use: <emphasis>appendfile</emphasis></entry>
37271 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37272 <entry>Default: <emphasis>unset</emphasis></entry>
37278 <indexterm role="concept">
37279 <primary>quota</primary>
37280 <secondary>imposed by Exim</secondary>
37282 This option imposes a limit on the size of the file to which Exim is appending,
37283 or to the total space used in the directory tree when the <option>directory</option> option
37284 is set. In the latter case, computation of the space used is expensive, because
37285 all the files in the directory (and any sub-directories) have to be
37286 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
37287 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
37288 have no shell access to their mailboxes).
37291 As there is no interlock against two simultaneous deliveries into a
37292 multi-file mailbox, it is possible for the quota to be overrun in this case.
37293 For single-file mailboxes, of course, an interlock is a necessity.
37296 A file’s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
37297 may be a lot less than the actual amount of disk space allocated to the file.
37298 If the sizes of a number of files are being added up, the rounding effect can
37299 become quite noticeable, especially on systems that have large block sizes.
37300 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
37301 the obvious value which users understand most easily.
37304 The value of the option is expanded, and must then be a numerical value
37305 (decimal point allowed), optionally followed by one of the letters K, M, or G,
37306 for kilobytes, megabytes, or gigabytes. If Exim is running on a system with
37307 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
37311 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
37314 The expansion happens while Exim is running as root, before it changes uid for
37315 the delivery. This means that files that are inaccessible to the end user can
37316 be used to hold quota values that are looked up in the expansion. When delivery
37317 fails because this quota is exceeded, the handling of the error is as for
37318 system quota failures.
37321 By default, Exim’s quota checking mimics system quotas, and restricts the
37322 mailbox to the specified maximum size, though the value is not accurate to the
37323 last byte, owing to separator lines and additional headers that may get added
37324 during message delivery. When a mailbox is nearly full, large messages may get
37325 refused even though small ones are accepted, because the size of the current
37326 message is added to the quota when the check is made. This behaviour can be
37327 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
37328 for exceeding the quota does not include the current message. Thus, deliveries
37329 continue until the quota has been exceeded; thereafter, no further messages are
37330 delivered. See also <option>quota_warn_threshold</option>.
37333 <indexterm role="option">
37334 <primary><option>quota_directory</option></primary>
37337 <informaltable frame="all">
37338 <tgroup cols="4" colsep="0" rowsep="0">
37339 <colspec colwidth="8*" align="left"/>
37340 <colspec colwidth="5*" align="center"/>
37341 <colspec colwidth="5*" align="center"/>
37342 <colspec colwidth="6*" align="right"/>
37345 <entry><option>quota_directory</option></entry>
37346 <entry>Use: <emphasis>appendfile</emphasis></entry>
37347 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37348 <entry>Default: <emphasis>unset</emphasis></entry>
37354 This option defines the directory to check for quota purposes when delivering
37355 into individual files. The default is the delivery directory, or, if a file
37356 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
37357 delivery directory.
37360 <indexterm role="option">
37361 <primary><option>quota_filecount</option></primary>
37364 <informaltable frame="all">
37365 <tgroup cols="4" colsep="0" rowsep="0">
37366 <colspec colwidth="8*" align="left"/>
37367 <colspec colwidth="5*" align="center"/>
37368 <colspec colwidth="5*" align="center"/>
37369 <colspec colwidth="6*" align="right"/>
37372 <entry><option>quota_filecount</option></entry>
37373 <entry>Use: <emphasis>appendfile</emphasis></entry>
37374 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37375 <entry>Default: <emphasis>0</emphasis></entry>
37381 This option applies when the <option>directory</option> option is set. It limits the total
37382 number of files in the directory (compare the inode limit in system quotas). It
37383 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
37384 failure causes delivery to be deferred. A value of zero is interpreted as
37385 <quote>no quota</quote>.
37388 <indexterm role="option">
37389 <primary><option>quota_is_inclusive</option></primary>
37392 <informaltable frame="all">
37393 <tgroup cols="4" colsep="0" rowsep="0">
37394 <colspec colwidth="8*" align="left"/>
37395 <colspec colwidth="5*" align="center"/>
37396 <colspec colwidth="5*" align="center"/>
37397 <colspec colwidth="6*" align="right"/>
37400 <entry><option>quota_is_inclusive</option></entry>
37401 <entry>Use: <emphasis>appendfile</emphasis></entry>
37402 <entry>Type: <emphasis>boolean</emphasis></entry>
37403 <entry>Default: <emphasis>true</emphasis></entry>
37409 See <option>quota</option> above.
37412 <indexterm role="option">
37413 <primary><option>quota_size_regex</option></primary>
37416 <informaltable frame="all">
37417 <tgroup cols="4" colsep="0" rowsep="0">
37418 <colspec colwidth="8*" align="left"/>
37419 <colspec colwidth="5*" align="center"/>
37420 <colspec colwidth="5*" align="center"/>
37421 <colspec colwidth="6*" align="right"/>
37424 <entry><option>quota_size_regex</option></entry>
37425 <entry>Use: <emphasis>appendfile</emphasis></entry>
37426 <entry>Type: <emphasis>string</emphasis></entry>
37427 <entry>Default: <emphasis>unset</emphasis></entry>
37433 This option applies when one of the delivery modes that writes a separate file
37434 for each message is being used. When Exim wants to find the size of one of
37435 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
37436 If this is set to a regular expression that matches the file name, and it
37437 captures one string, that string is interpreted as a representation of the
37438 file’s size. The value of <option>quota_size_regex</option> is not expanded.
37441 This feature is useful only when users have no shell access to their mailboxes
37442 – otherwise they could defeat the quota simply by renaming the files. This
37443 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
37444 the file length to the file name. For example:
37446 <literallayout class="monospaced">
37447 maildir_tag = ,S=$message_size
37448 quota_size_regex = ,S=(\d+)
37451 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
37452 number of lines in the message.
37455 The regular expression should not assume that the length is at the end of the
37456 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
37457 sometimes add other information onto the ends of message file names.
37460 <indexterm role="option">
37461 <primary><option>quota_warn_message</option></primary>
37464 <informaltable frame="all">
37465 <tgroup cols="4" colsep="0" rowsep="0">
37466 <colspec colwidth="8*" align="left"/>
37467 <colspec colwidth="5*" align="center"/>
37468 <colspec colwidth="5*" align="center"/>
37469 <colspec colwidth="6*" align="right"/>
37472 <entry><option>quota_warn_message</option></entry>
37473 <entry>Use: <emphasis>appendfile</emphasis></entry>
37474 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37475 <entry>Default: <emphasis>see below</emphasis></entry>
37481 See below for the use of this option. If it is not set when
37482 <option>quota_warn_threshold</option> is set, it defaults to
37484 <literallayout class="monospaced">
37485 quota_warn_message = "\
37486 To: $local_part@$domain\n\
37487 Subject: Your mailbox\n\n\
37488 This message is automatically created \
37489 by mail delivery software.\n\n\
37490 The size of your mailbox has exceeded \
37491 a warning threshold that is\n\
37492 set by the system administrator.\n"
37495 <indexterm role="option">
37496 <primary><option>quota_warn_threshold</option></primary>
37499 <informaltable frame="all">
37500 <tgroup cols="4" colsep="0" rowsep="0">
37501 <colspec colwidth="8*" align="left"/>
37502 <colspec colwidth="5*" align="center"/>
37503 <colspec colwidth="5*" align="center"/>
37504 <colspec colwidth="6*" align="right"/>
37507 <entry><option>quota_warn_threshold</option></entry>
37508 <entry>Use: <emphasis>appendfile</emphasis></entry>
37509 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37510 <entry>Default: <emphasis>0</emphasis></entry>
37516 <indexterm role="concept">
37517 <primary>quota</primary>
37518 <secondary>warning threshold</secondary>
37520 <indexterm role="concept">
37521 <primary>mailbox</primary>
37522 <secondary>size warning</secondary>
37524 <indexterm role="concept">
37525 <primary>size</primary>
37526 <secondary>of mailbox</secondary>
37528 This option is expanded in the same way as <option>quota</option> (see above). If the
37529 resulting value is greater than zero, and delivery of the message causes the
37530 size of the file or total space in the directory tree to cross the given
37531 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
37532 may be specified as a percentage of it by following the value with a percent
37535 <literallayout class="monospaced">
37537 quota_warn_threshold = 75%
37540 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
37541 percent sign is ignored.
37544 The warning message itself is specified by the <option>quota_warn_message</option> option,
37545 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
37546 warning message. These do not necessarily have to include the recipient(s) of
37547 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
37548 can include any other header lines that you want. If you do not include a
37549 <emphasis>From:</emphasis> line, the default is:
37551 <literallayout class="monospaced">
37552 From: Mail Delivery System <mailer-daemon@$qualify_domain_sender>
37555 <indexterm role="option">
37556 <primary><option>errors_reply_to</option></primary>
37558 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
37562 The <option>quota</option> option does not have to be set in order to use this option; they
37563 are independent of one another except when the threshold is specified as a
37567 <indexterm role="option">
37568 <primary><option>use_bsmtp</option></primary>
37571 <informaltable frame="all">
37572 <tgroup cols="4" colsep="0" rowsep="0">
37573 <colspec colwidth="8*" align="left"/>
37574 <colspec colwidth="5*" align="center"/>
37575 <colspec colwidth="5*" align="center"/>
37576 <colspec colwidth="6*" align="right"/>
37579 <entry><option>use_bsmtp</option></entry>
37580 <entry>Use: <emphasis>appendfile</emphasis></entry>
37581 <entry>Type: <emphasis>boolean</emphasis></entry>
37582 <entry>Default: <emphasis>false</emphasis></entry>
37588 <indexterm role="concept">
37589 <primary>envelope sender</primary>
37591 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
37592 format, with the envelope sender and recipient(s) included as SMTP commands. If
37593 you want to include a leading HELO command with such messages, you can do
37594 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
37595 for details of batch SMTP.
37598 <indexterm role="option">
37599 <primary><option>use_crlf</option></primary>
37602 <informaltable frame="all">
37603 <tgroup cols="4" colsep="0" rowsep="0">
37604 <colspec colwidth="8*" align="left"/>
37605 <colspec colwidth="5*" align="center"/>
37606 <colspec colwidth="5*" align="center"/>
37607 <colspec colwidth="6*" align="right"/>
37610 <entry><option>use_crlf</option></entry>
37611 <entry>Use: <emphasis>appendfile</emphasis></entry>
37612 <entry>Type: <emphasis>boolean</emphasis></entry>
37613 <entry>Default: <emphasis>false</emphasis></entry>
37619 <indexterm role="concept">
37620 <primary>carriage return</primary>
37622 <indexterm role="concept">
37623 <primary>linefeed</primary>
37625 This option causes lines to be terminated with the two-character CRLF sequence
37626 (carriage return, linefeed) instead of just a linefeed character. In the case
37627 of batched SMTP, the byte sequence written to the file is then an exact image
37628 of what would be sent down a real SMTP connection.
37631 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
37632 written verbatim, so must contain their own carriage return characters if these
37633 are needed. In cases where these options have non-empty defaults, the values
37634 end with a single linefeed, so they must be changed to end with <literal>\r\n</literal> if
37635 <option>use_crlf</option> is set.
37638 <indexterm role="option">
37639 <primary><option>use_fcntl_lock</option></primary>
37642 <informaltable frame="all">
37643 <tgroup cols="4" colsep="0" rowsep="0">
37644 <colspec colwidth="8*" align="left"/>
37645 <colspec colwidth="5*" align="center"/>
37646 <colspec colwidth="5*" align="center"/>
37647 <colspec colwidth="6*" align="right"/>
37650 <entry><option>use_fcntl_lock</option></entry>
37651 <entry>Use: <emphasis>appendfile</emphasis></entry>
37652 <entry>Type: <emphasis>boolean</emphasis></entry>
37653 <entry>Default: <emphasis>see below</emphasis></entry>
37659 This option controls the use of the <function>fcntl()</function> function to lock a file for
37660 exclusive use when a message is being appended. It is set by default unless
37661 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
37662 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
37663 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
37666 <indexterm role="option">
37667 <primary><option>use_flock_lock</option></primary>
37670 <informaltable frame="all">
37671 <tgroup cols="4" colsep="0" rowsep="0">
37672 <colspec colwidth="8*" align="left"/>
37673 <colspec colwidth="5*" align="center"/>
37674 <colspec colwidth="5*" align="center"/>
37675 <colspec colwidth="6*" align="right"/>
37678 <entry><option>use_flock_lock</option></entry>
37679 <entry>Use: <emphasis>appendfile</emphasis></entry>
37680 <entry>Type: <emphasis>boolean</emphasis></entry>
37681 <entry>Default: <emphasis>false</emphasis></entry>
37687 This option is provided to support the use of <function>flock()</function> for file locking, for
37688 the few situations where it is needed. Most modern operating systems support
37689 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
37690 each other. Exim uses <function>fcntl()</function> locking by default.
37693 This option is required only if you are using an operating system where
37694 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
37695 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
37696 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
37699 <indexterm role="concept">
37700 <primary>Solaris</primary>
37701 <secondary><function>flock()</function> support</secondary>
37703 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
37704 have it (and some, I think, provide a not quite right version built on top of
37705 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
37706 the ability to use it, and any attempt to do so will cause a configuration
37710 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
37711 is just being mapped onto <function>fcntl()</function> by the OS).
37714 <indexterm role="option">
37715 <primary><option>use_lockfile</option></primary>
37718 <informaltable frame="all">
37719 <tgroup cols="4" colsep="0" rowsep="0">
37720 <colspec colwidth="8*" align="left"/>
37721 <colspec colwidth="5*" align="center"/>
37722 <colspec colwidth="5*" align="center"/>
37723 <colspec colwidth="6*" align="right"/>
37726 <entry><option>use_lockfile</option></entry>
37727 <entry>Use: <emphasis>appendfile</emphasis></entry>
37728 <entry>Type: <emphasis>boolean</emphasis></entry>
37729 <entry>Default: <emphasis>see below</emphasis></entry>
37735 If this option is turned off, Exim does not attempt to create a lock file when
37736 appending to a mailbox file. In this situation, the only locking is by
37737 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
37738 sure that every MUA that is ever going to look at your users’ mailboxes uses
37739 <function>fcntl()</function> rather than a lock file, and even then only when you are not
37740 delivering over NFS from more than one host.
37743 <indexterm role="concept">
37744 <primary>NFS</primary>
37745 <secondary>lock file</secondary>
37747 In order to append to an NFS file safely from more than one host, it is
37748 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
37749 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
37753 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
37754 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
37755 except when <option>mbx_format</option> is set.
37758 <indexterm role="option">
37759 <primary><option>use_mbx_lock</option></primary>
37762 <informaltable frame="all">
37763 <tgroup cols="4" colsep="0" rowsep="0">
37764 <colspec colwidth="8*" align="left"/>
37765 <colspec colwidth="5*" align="center"/>
37766 <colspec colwidth="5*" align="center"/>
37767 <colspec colwidth="6*" align="right"/>
37770 <entry><option>use_mbx_lock</option></entry>
37771 <entry>Use: <emphasis>appendfile</emphasis></entry>
37772 <entry>Type: <emphasis>boolean</emphasis></entry>
37773 <entry>Default: <emphasis>see below</emphasis></entry>
37779 This option is available only if Exim has been compiled with SUPPORT_MBX
37780 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
37781 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
37782 of the locking options are mentioned in the configuration. The locking rules
37783 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
37784 the IMAP4 and POP daemons that come with it (see the discussion below). The
37785 rules allow for shared access to the mailbox. However, this kind of locking
37786 does not work when the mailbox is NFS mounted.
37789 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
37790 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
37791 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
37792 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
37795 <section id="SECTopappend">
37796 <title>Operational details for appending</title>
37798 <indexterm role="concept">
37799 <primary>appending to a file</primary>
37801 <indexterm role="concept">
37802 <primary>file</primary>
37803 <secondary>appending</secondary>
37805 Before appending to a file, the following preparations are made:
37810 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
37816 <indexterm role="concept">
37817 <primary>directory creation</primary>
37819 If any directories on the file’s path are missing, Exim creates them if the
37820 <option>create_directory</option> option is set. A created directory’s mode is given by the
37821 <option>directory_mode</option> option.
37826 If <option>file_format</option> is set, the format of an existing file is checked. If this
37827 indicates that a different transport should be used, control is passed to that
37833 <indexterm role="concept">
37834 <primary>file</primary>
37835 <secondary>locking</secondary>
37837 <indexterm role="concept">
37838 <primary>locking files</primary>
37840 <indexterm role="concept">
37841 <primary>NFS</primary>
37842 <secondary>lock file</secondary>
37844 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
37845 reliably over NFS, as follows:
37847 <orderedlist numeration="arabic">
37850 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
37851 current time, primary host name, and process id added, by opening for writing
37852 as a new file. If this fails with an access error, delivery is deferred.
37857 Close the hitching post file, and hard link it to the lock file name.
37862 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
37863 Unlink the hitching post name.
37868 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
37869 then unlink hitching post name. If the number of links is exactly two, creation
37870 of the lock file succeeded but something (for example, an NFS server crash and
37871 restart) caused this fact not to be communicated to the <function>link()</function> call.
37876 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
37877 up to <option>lock_retries</option> times. However, since any program that writes to a
37878 mailbox should complete its task very quickly, it is reasonable to time out old
37879 lock files that are normally the result of user agent and system crashes. If an
37880 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
37881 it before trying again.
37888 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
37889 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
37890 than non-existence, delivery is deferred.
37895 <indexterm role="concept">
37896 <primary>symbolic link</primary>
37897 <secondary>to mailbox</secondary>
37899 <indexterm role="concept">
37900 <primary>mailbox</primary>
37901 <secondary>symbolic link</secondary>
37903 If the file does exist and is a symbolic link, delivery is deferred, unless the
37904 <option>allow_symlink</option> option is set, in which case the ownership of the link is
37905 checked, and then <function>stat()</function> is called to find out about the real file, which
37906 is then subjected to the checks below. The check on the top-level link
37907 ownership prevents one user creating a link for another’s mailbox in a sticky
37908 directory, though allowing symbolic links in this case is definitely not a good
37909 idea. If there is a chain of symbolic links, the intermediate ones are not
37915 If the file already exists but is not a regular file, or if the file’s owner
37916 and group (if the group is being checked – see <option>check_group</option> above) are
37917 different from the user and group under which the delivery is running,
37918 delivery is deferred.
37923 If the file’s permissions are more generous than specified, they are reduced.
37924 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
37925 is set false, in which case the delivery is tried using the existing
37931 The file’s inode number is saved, and the file is then opened for appending.
37932 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
37933 hadn’t existed (see below). For any other failures, delivery is deferred.
37938 If the file is opened successfully, check that the inode number hasn’t
37939 changed, that it is still a regular file, and that the owner and permissions
37940 have not changed. If anything is wrong, defer delivery and freeze the message.
37945 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
37946 option is set. Otherwise, check that the file is being created in a permitted
37947 directory if the <option>create_file</option> option is set (deferring on failure), and then
37948 open for writing as a new file, with the O_EXCL and O_CREAT options,
37949 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
37950 set). In this case, which can happen if the link points to a non-existent file,
37951 the file is opened for writing using O_CREAT but not O_EXCL, because
37952 that prevents link following.
37957 <indexterm role="concept">
37958 <primary>loop</primary>
37959 <secondary>while file testing</secondary>
37961 If opening fails because the file exists, obey the tests given above for
37962 existing files. However, to avoid looping in a situation where the file is
37963 being continuously created and destroyed, the exists/not-exists loop is broken
37964 after 10 repetitions, and the message is then frozen.
37969 If opening fails with any other error, defer delivery.
37974 <indexterm role="concept">
37975 <primary>file</primary>
37976 <secondary>locking</secondary>
37978 <indexterm role="concept">
37979 <primary>locking files</primary>
37981 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
37982 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
37983 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
37984 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
37985 file, and an exclusive lock on the file whose name is
37987 <literallayout class="monospaced">
37988 /tmp/.<device-number>.<inode-number>
37991 using the device and inode numbers of the open mailbox file, in accordance with
37992 the MBX locking rules. This file is created with a mode that is specified by
37993 the <option>lockfile_mode</option> option.
37996 If Exim fails to lock the file, there are two possible courses of action,
37997 depending on the value of the locking timeout. This is obtained from
37998 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
38001 If the timeout value is zero, the file is closed, Exim waits for
38002 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
38003 to lock it again. This happens up to <option>lock_retries</option> times, after which the
38004 delivery is deferred.
38007 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
38008 <function>flock()</function> are used (with the given timeout), so there has already been some
38009 waiting involved by the time locking fails. Nevertheless, Exim does not give up
38010 immediately. It retries up to
38012 <literallayout class="monospaced">
38013 (lock_retries * lock_interval) / <timeout>
38016 times (rounded up).
38021 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
38022 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
38025 <section id="SECTopdir">
38026 <title>Operational details for delivery to a new file</title>
38028 <indexterm role="concept">
38029 <primary>delivery</primary>
38030 <secondary>to single file</secondary>
38032 <indexterm role="concept">
38033 <primary><quote>From</quote> line</primary>
38035 When the <option>directory</option> option is set instead of <option>file</option>, each message is
38036 delivered into a newly-created file or set of files. When <command>appendfile</command> is
38037 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
38038 <option>directory</option> is normally set, because the path for delivery is supplied by the
38039 router. (See for example, the <command>address_file</command> transport in the default
38040 configuration.) In this case, delivery is to a new file if either the path name
38041 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
38044 No locking is required while writing the message to a new file, so the various
38045 locking options of the transport are ignored. The <quote>From</quote> line that by default
38046 separates messages in a single file is not normally needed, nor is the escaping
38047 of message lines that start with <quote>From</quote>, and there is no need to ensure a
38048 newline at the end of each message. Consequently, the default values for
38049 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
38050 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
38053 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
38054 the files in the delivery directory by default. However, you can specify a
38055 different directory by setting <option>quota_directory</option>. Also, for maildir
38056 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
38059 <indexterm role="concept">
38060 <primary>maildir format</primary>
38062 <indexterm role="concept">
38063 <primary>mailstore format</primary>
38065 There are three different ways in which delivery to individual files can be
38066 done, controlled by the settings of the <option>maildir_format</option> and
38067 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
38068 formats is not included in the binary unless SUPPORT_MAILDIR or
38069 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
38072 <indexterm role="concept">
38073 <primary>directory creation</primary>
38075 In all three cases an attempt is made to create the directory and any necessary
38076 sub-directories if they do not exist, provided that the <option>create_directory</option>
38077 option is set (the default). The location of a created directory can be
38078 constrained by setting <option>create_file</option>. A created directory’s mode is given by
38079 the <option>directory_mode</option> option. If creation fails, or if the
38080 <option>create_directory</option> option is not set when creation is required, delivery is
38084 <section id="SECTmaildirdelivery">
38085 <title>Maildir delivery</title>
38087 <indexterm role="concept">
38088 <primary>maildir format</primary>
38089 <secondary>description of</secondary>
38091 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
38092 it to a file whose name is <filename>tmp/<stime>.H<mtime>P<pid>.<host></filename> in the
38093 directory that is defined by the <option>directory</option> option (the <quote>delivery
38094 directory</quote>). If the delivery is successful, the file is renamed into the
38095 <filename>new</filename> subdirectory.
38098 In the file name, <<emphasis>stime</emphasis>> is the current time of day in seconds, and
38099 <<emphasis>mtime</emphasis>> is the microsecond fraction of the time. After a maildir delivery,
38100 Exim checks that the time-of-day clock has moved on by at least one microsecond
38101 before terminating the delivery process. This guarantees uniqueness for the
38102 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
38103 opening it. If any response other than ENOENT (does not exist) is given,
38104 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
38107 Before Exim carries out a maildir delivery, it ensures that subdirectories
38108 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
38109 do not exist, Exim tries to create them and any superior directories in their
38110 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
38111 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
38112 contains matches the delivery directory, Exim also ensures that a file called
38113 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
38114 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
38117 These features make it possible to use Exim to create all the necessary files
38118 and directories in a maildir mailbox, including subdirectories for maildir++
38119 folders. Consider this example:
38121 <literallayout class="monospaced">
38122 maildir_format = true
38123 directory = /var/mail/$local_part\
38124 ${if eq{$local_part_suffix}{}{}\
38125 {/.${substr_1:$local_part_suffix}}}
38126 maildirfolder_create_regex = /\.[^/]+$
38129 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
38130 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
38131 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
38132 not match this name, so Exim will not look for or create the file
38133 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
38134 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
38137 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
38138 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
38139 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
38140 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
38141 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
38144 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
38145 not inadvertently match the toplevel maildir directory, because a
38146 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
38149 <indexterm role="concept">
38150 <primary>quota</primary>
38151 <secondary>in maildir delivery</secondary>
38153 <indexterm role="concept">
38154 <primary>maildir++</primary>
38156 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
38157 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
38158 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
38159 Exim assumes the directory is a maildir++ folder directory, which is one level
38160 down from the user’s top level mailbox directory. This causes it to start at
38161 the parent directory instead of the current directory when calculating the
38162 amount of space used.
38165 One problem with delivering into a multi-file mailbox is that it is
38166 computationally expensive to compute the size of the mailbox for quota
38167 checking. Various approaches have been taken to reduce the amount of work
38168 needed. The next two sections describe two of them. A third alternative is to
38169 use some external process for maintaining the size data, and use the expansion
38170 of the <option>mailbox_size</option> option as a way of importing it into Exim.
38174 <title>Using tags to record message sizes</title>
38176 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
38177 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
38178 tag is added to its name. However, if adding the tag takes the length of the
38179 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
38180 the tag is dropped and the maildir file is created with no tag.
38183 <indexterm role="concept">
38184 <primary><varname>$message_size</varname></primary>
38186 Tags can be used to encode the size of files in their names; see
38187 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
38188 happens after the message has been written. The value of the <varname>$message_size</varname>
38189 variable is set to the number of bytes actually written. If the expansion is
38190 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
38191 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
38192 Non-printing characters in the string are ignored; if the resulting string is
38193 empty, it is ignored. If it starts with an alphanumeric character, a leading
38198 <title>Using a maildirsize file</title>
38200 <indexterm role="concept">
38201 <primary>quota</primary>
38202 <secondary>in maildir delivery</secondary>
38204 <indexterm role="concept">
38205 <primary>maildir format</primary>
38206 <secondary><filename>maildirsize</filename> file</secondary>
38208 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
38209 storing quota and message size information in a file called <filename>maildirsize</filename>
38210 within the toplevel maildir directory. If this file does not exist, Exim
38211 creates it, setting the quota from the <option>quota</option> option of the transport. If
38212 the maildir directory itself does not exist, it is created before any attempt
38213 to write a <filename>maildirsize</filename> file.
38216 The <filename>maildirsize</filename> file is used to hold information about the sizes of
38217 messages in the maildir, thus speeding up quota calculations. The quota value
38218 in the file is just a cache; if the quota is changed in the transport, the new
38219 value overrides the cached value when the next message is delivered. The cache
38220 is maintained for the benefit of other programs that access the maildir and
38221 need to know the quota.
38224 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
38225 file is maintained (with a zero quota setting), but no quota is imposed.
38228 A regular expression is available for controlling which directories in the
38229 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
38230 See the description of the <option>maildir_quota_directory_regex</option> option above for
38235 <title>Mailstore delivery</title>
38237 <indexterm role="concept">
38238 <primary>mailstore format</primary>
38239 <secondary>description of</secondary>
38241 If the <option>mailstore_format</option> option is true, each message is written as two
38242 files in the given directory. A unique base name is constructed from the
38243 message id and the current delivery process, and the files that are written use
38244 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
38245 contains the message’s envelope, and the <filename>.msg</filename> file contains the message
38246 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
38249 During delivery, the envelope is first written to a file with the suffix
38250 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
38251 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
38252 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
38253 file before accessing either of them. An alternative approach is to wait for
38254 the absence of a <filename>.tmp</filename> file.
38257 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
38258 option, expanded and terminated by a newline if there isn’t one. Then follows
38259 the sender address on one line, then all the recipient addresses, one per line.
38260 There can be more than one recipient only if the <option>batch_max</option> option is set
38261 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
38262 appended to the file, followed by a newline if it does not end with one.
38265 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
38266 failure, it is ignored. Other expansion errors are treated as serious
38267 configuration errors, and delivery is deferred. The variable
38268 <varname>$mailstore_basename</varname> is available for use during these expansions.
38272 <title>Non-special new file delivery</title>
38274 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
38275 file is created directly in the named directory. For example, when delivering
38276 messages into files in batched SMTP format for later delivery to some host (see
38277 section <xref linkend="SECTbatchSMTP"/>), a setting such as
38279 <literallayout class="monospaced">
38280 directory = /var/bsmtp/$host
38283 might be used. A message is written to a file with a temporary name, which is
38284 then renamed when the delivery is complete. The final name is obtained by
38285 expanding the contents of the <option>directory_file</option> option.
38286 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
38287 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
38293 <title>The autoreply transport</title>
38295 <indexterm role="concept" id="IIDauttra1" class="startofrange">
38296 <primary>transports</primary>
38297 <secondary><command>autoreply</command></secondary>
38299 <indexterm role="concept" id="IIDauttra2" class="startofrange">
38300 <primary><command>autoreply</command> transport</primary>
38302 The <command>autoreply</command> transport is not a true transport in that it does not cause
38303 the message to be transmitted. Instead, it generates a new mail message as an
38304 automatic reply to the incoming message. <emphasis>References:</emphasis> and
38305 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
38306 to the rules in RFCs 2822 and 3834, respectively.
38309 If the router that passes the message to this transport does not have the
38310 <option>unseen</option> option set, the original message (for the current recipient) is not
38311 delivered anywhere. However, when the <option>unseen</option> option is set on the router
38312 that passes the message to this transport, routing of the address continues, so
38313 another router can set up a normal message delivery.
38316 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
38317 <quote>vacation</quote> message being the standard example. However, it can also be run
38318 directly from a router like any other transport. To reduce the possibility of
38319 message cascades, messages created by the <command>autoreply</command> transport always have
38320 empty envelope sender addresses, like bounce messages.
38323 The parameters of the message to be sent can be specified in the configuration
38324 by options described below. However, these are used only when the address
38325 passed to the transport does not contain its own reply information. When the
38326 transport is run as a consequence of a
38327 <option>mail</option>
38328 or <option>vacation</option> command in a filter file, the parameters of the message are
38329 supplied by the filter, and passed with the address. The transport’s options
38330 that define the message are then ignored (so they are not usually set in this
38331 case). The message is specified entirely by the filter or by the transport; it
38332 is never built from a mixture of options. However, the <option>file_optional</option>,
38333 <option>mode</option>, and <option>return_message</option> options apply in all cases.
38336 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
38337 command in a user’s filter file, <command>autoreply</command> normally runs under the uid and
38338 gid of the user, and with appropriate current and home directories (see chapter
38339 <xref linkend="CHAPenvironment"/>).
38342 There is a subtle difference between routing a message to a <command>pipe</command> transport
38343 that generates some text to be returned to the sender, and routing it to an
38344 <command>autoreply</command> transport. This difference is noticeable only if more than one
38345 address from the same message is so handled. In the case of a pipe, the
38346 separate outputs from the different addresses are gathered up and returned to
38347 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
38348 message is generated for each address that is passed to it.
38351 Non-printing characters are not permitted in the header lines generated for the
38352 message that <command>autoreply</command> creates, with the exception of newlines that are
38353 immediately followed by white space. If any non-printing characters are found,
38354 the transport defers.
38355 Whether characters with the top bit set count as printing characters or not is
38356 controlled by the <option>print_topbitchars</option> global option.
38359 If any of the generic options for manipulating headers (for example,
38360 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
38361 of the original message that is included in the generated message when
38362 <option>return_message</option> is set. They do not apply to the generated message itself.
38365 <indexterm role="concept">
38366 <primary><varname>$sender_address</varname></primary>
38368 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
38369 the message, indicating that there were no recipients, it does not treat this
38370 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
38371 is empty (because the incoming message is a bounce message) do not cause
38372 problems. They are just discarded.
38375 <title>Private options for autoreply</title>
38377 <indexterm role="concept">
38378 <primary>options</primary>
38379 <secondary><command>autoreply</command> transport</secondary>
38383 <indexterm role="option">
38384 <primary><option>bcc</option></primary>
38387 <informaltable frame="all">
38388 <tgroup cols="4" colsep="0" rowsep="0">
38389 <colspec colwidth="8*" align="left"/>
38390 <colspec colwidth="5*" align="center"/>
38391 <colspec colwidth="5*" align="center"/>
38392 <colspec colwidth="6*" align="right"/>
38395 <entry><option>bcc</option></entry>
38396 <entry>Use: <emphasis>autoreply</emphasis></entry>
38397 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38398 <entry>Default: <emphasis>unset</emphasis></entry>
38404 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
38405 message when the message is specified by the transport.
38408 <indexterm role="option">
38409 <primary><option>cc</option></primary>
38412 <informaltable frame="all">
38413 <tgroup cols="4" colsep="0" rowsep="0">
38414 <colspec colwidth="8*" align="left"/>
38415 <colspec colwidth="5*" align="center"/>
38416 <colspec colwidth="5*" align="center"/>
38417 <colspec colwidth="6*" align="right"/>
38420 <entry><option>cc</option></entry>
38421 <entry>Use: <emphasis>autoreply</emphasis></entry>
38422 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38423 <entry>Default: <emphasis>unset</emphasis></entry>
38429 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
38430 when the message is specified by the transport.
38433 <indexterm role="option">
38434 <primary><option>file</option></primary>
38437 <informaltable frame="all">
38438 <tgroup cols="4" colsep="0" rowsep="0">
38439 <colspec colwidth="8*" align="left"/>
38440 <colspec colwidth="5*" align="center"/>
38441 <colspec colwidth="5*" align="center"/>
38442 <colspec colwidth="6*" align="right"/>
38445 <entry><option>file</option></entry>
38446 <entry>Use: <emphasis>autoreply</emphasis></entry>
38447 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38448 <entry>Default: <emphasis>unset</emphasis></entry>
38454 The contents of the file are sent as the body of the message when the message
38455 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
38456 string comes first.
38459 <indexterm role="option">
38460 <primary><option>file_expand</option></primary>
38463 <informaltable frame="all">
38464 <tgroup cols="4" colsep="0" rowsep="0">
38465 <colspec colwidth="8*" align="left"/>
38466 <colspec colwidth="5*" align="center"/>
38467 <colspec colwidth="5*" align="center"/>
38468 <colspec colwidth="6*" align="right"/>
38471 <entry><option>file_expand</option></entry>
38472 <entry>Use: <emphasis>autoreply</emphasis></entry>
38473 <entry>Type: <emphasis>boolean</emphasis></entry>
38474 <entry>Default: <emphasis>false</emphasis></entry>
38480 If this is set, the contents of the file named by the <option>file</option> option are
38481 subjected to string expansion as they are added to the message.
38484 <indexterm role="option">
38485 <primary><option>file_optional</option></primary>
38488 <informaltable frame="all">
38489 <tgroup cols="4" colsep="0" rowsep="0">
38490 <colspec colwidth="8*" align="left"/>
38491 <colspec colwidth="5*" align="center"/>
38492 <colspec colwidth="5*" align="center"/>
38493 <colspec colwidth="6*" align="right"/>
38496 <entry><option>file_optional</option></entry>
38497 <entry>Use: <emphasis>autoreply</emphasis></entry>
38498 <entry>Type: <emphasis>boolean</emphasis></entry>
38499 <entry>Default: <emphasis>false</emphasis></entry>
38505 If this option is true, no error is generated if the file named by the <option>file</option>
38506 option or passed with the address does not exist or cannot be read.
38509 <indexterm role="option">
38510 <primary><option>from</option></primary>
38513 <informaltable frame="all">
38514 <tgroup cols="4" colsep="0" rowsep="0">
38515 <colspec colwidth="8*" align="left"/>
38516 <colspec colwidth="5*" align="center"/>
38517 <colspec colwidth="5*" align="center"/>
38518 <colspec colwidth="6*" align="right"/>
38521 <entry><option>from</option></entry>
38522 <entry>Use: <emphasis>autoreply</emphasis></entry>
38523 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38524 <entry>Default: <emphasis>unset</emphasis></entry>
38530 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
38531 specified by the transport.
38534 <indexterm role="option">
38535 <primary><option>headers</option></primary>
38538 <informaltable frame="all">
38539 <tgroup cols="4" colsep="0" rowsep="0">
38540 <colspec colwidth="8*" align="left"/>
38541 <colspec colwidth="5*" align="center"/>
38542 <colspec colwidth="5*" align="center"/>
38543 <colspec colwidth="6*" align="right"/>
38546 <entry><option>headers</option></entry>
38547 <entry>Use: <emphasis>autoreply</emphasis></entry>
38548 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38549 <entry>Default: <emphasis>unset</emphasis></entry>
38555 This specifies additional RFC 2822 headers that are to be added to the message
38556 when the message is specified by the transport. Several can be given by using
38557 <quote>\n</quote> to separate them. There is no check on the format.
38560 <indexterm role="option">
38561 <primary><option>log</option></primary>
38564 <informaltable frame="all">
38565 <tgroup cols="4" colsep="0" rowsep="0">
38566 <colspec colwidth="8*" align="left"/>
38567 <colspec colwidth="5*" align="center"/>
38568 <colspec colwidth="5*" align="center"/>
38569 <colspec colwidth="6*" align="right"/>
38572 <entry><option>log</option></entry>
38573 <entry>Use: <emphasis>autoreply</emphasis></entry>
38574 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38575 <entry>Default: <emphasis>unset</emphasis></entry>
38581 This option names a file in which a record of every message sent is logged when
38582 the message is specified by the transport.
38585 <indexterm role="option">
38586 <primary><option>mode</option></primary>
38589 <informaltable frame="all">
38590 <tgroup cols="4" colsep="0" rowsep="0">
38591 <colspec colwidth="8*" align="left"/>
38592 <colspec colwidth="5*" align="center"/>
38593 <colspec colwidth="5*" align="center"/>
38594 <colspec colwidth="6*" align="right"/>
38597 <entry><option>mode</option></entry>
38598 <entry>Use: <emphasis>autoreply</emphasis></entry>
38599 <entry>Type: <emphasis>octal integer</emphasis></entry>
38600 <entry>Default: <emphasis>0600</emphasis></entry>
38606 If either the log file or the <quote>once</quote> file has to be created, this mode is
38610 <indexterm role="option">
38611 <primary><option>never_mail</option></primary>
38614 <informaltable frame="all">
38615 <tgroup cols="4" colsep="0" rowsep="0">
38616 <colspec colwidth="8*" align="left"/>
38617 <colspec colwidth="5*" align="center"/>
38618 <colspec colwidth="5*" align="center"/>
38619 <colspec colwidth="6*" align="right"/>
38622 <entry><option>never_mail</option></entry>
38623 <entry>Use: <emphasis>autoreply</emphasis></entry>
38624 <entry>Type: <emphasis>address list</emphasis>†<emphasis></emphasis></entry>
38625 <entry>Default: <emphasis>unset</emphasis></entry>
38631 If any run of the transport creates a message with a recipient that matches any
38632 item in the list, that recipient is quietly discarded. If all recipients are
38633 discarded, no message is created. This applies both when the recipients are
38634 generated by a filter and when they are specified in the transport.
38637 <indexterm role="option">
38638 <primary><option>once</option></primary>
38641 <informaltable frame="all">
38642 <tgroup cols="4" colsep="0" rowsep="0">
38643 <colspec colwidth="8*" align="left"/>
38644 <colspec colwidth="5*" align="center"/>
38645 <colspec colwidth="5*" align="center"/>
38646 <colspec colwidth="6*" align="right"/>
38649 <entry><option>once</option></entry>
38650 <entry>Use: <emphasis>autoreply</emphasis></entry>
38651 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38652 <entry>Default: <emphasis>unset</emphasis></entry>
38658 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
38659 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
38660 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
38663 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
38664 By default, if <option>once</option> is set to a non-empty file name, the message
38665 is not sent if a potential recipient is already listed in the database.
38666 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
38667 message is sent if that much time has elapsed since a message was last sent to
38668 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
38669 prevents a message from being sent a second time – in this case, zero means
38673 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
38674 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
38675 greater than zero, it changes the way Exim implements the <option>once</option> option.
38676 Instead of using a DBM file to record every recipient it sends to, it uses a
38677 regular file, whose size will never get larger than the given value.
38680 In the file, Exim keeps a linear list of recipient addresses and the times at
38681 which they were sent messages. If the file is full when a new address needs to
38682 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
38683 means that a given recipient may receive multiple messages, but at
38684 unpredictable intervals that depend on the rate of turnover of addresses in the
38685 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
38688 <indexterm role="option">
38689 <primary><option>once_file_size</option></primary>
38692 <informaltable frame="all">
38693 <tgroup cols="4" colsep="0" rowsep="0">
38694 <colspec colwidth="8*" align="left"/>
38695 <colspec colwidth="5*" align="center"/>
38696 <colspec colwidth="5*" align="center"/>
38697 <colspec colwidth="6*" align="right"/>
38700 <entry><option>once_file_size</option></entry>
38701 <entry>Use: <emphasis>autoreply</emphasis></entry>
38702 <entry>Type: <emphasis>integer</emphasis></entry>
38703 <entry>Default: <emphasis>0</emphasis></entry>
38709 See <option>once</option> above.
38712 <indexterm role="option">
38713 <primary><option>once_repeat</option></primary>
38716 <informaltable frame="all">
38717 <tgroup cols="4" colsep="0" rowsep="0">
38718 <colspec colwidth="8*" align="left"/>
38719 <colspec colwidth="5*" align="center"/>
38720 <colspec colwidth="5*" align="center"/>
38721 <colspec colwidth="6*" align="right"/>
38724 <entry><option>once_repeat</option></entry>
38725 <entry>Use: <emphasis>autoreply</emphasis></entry>
38726 <entry>Type: <emphasis>time</emphasis>†<emphasis></emphasis></entry>
38727 <entry>Default: <emphasis>0s</emphasis></entry>
38733 See <option>once</option> above.
38734 After expansion, the value of this option must be a valid time value.
38737 <indexterm role="option">
38738 <primary><option>reply_to</option></primary>
38741 <informaltable frame="all">
38742 <tgroup cols="4" colsep="0" rowsep="0">
38743 <colspec colwidth="8*" align="left"/>
38744 <colspec colwidth="5*" align="center"/>
38745 <colspec colwidth="5*" align="center"/>
38746 <colspec colwidth="6*" align="right"/>
38749 <entry><option>reply_to</option></entry>
38750 <entry>Use: <emphasis>autoreply</emphasis></entry>
38751 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38752 <entry>Default: <emphasis>unset</emphasis></entry>
38758 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
38759 specified by the transport.
38762 <indexterm role="option">
38763 <primary><option>return_message</option></primary>
38766 <informaltable frame="all">
38767 <tgroup cols="4" colsep="0" rowsep="0">
38768 <colspec colwidth="8*" align="left"/>
38769 <colspec colwidth="5*" align="center"/>
38770 <colspec colwidth="5*" align="center"/>
38771 <colspec colwidth="6*" align="right"/>
38774 <entry><option>return_message</option></entry>
38775 <entry>Use: <emphasis>autoreply</emphasis></entry>
38776 <entry>Type: <emphasis>boolean</emphasis></entry>
38777 <entry>Default: <emphasis>false</emphasis></entry>
38783 If this is set, a copy of the original message is returned with the new
38784 message, subject to the maximum size set in the <option>return_size_limit</option> global
38785 configuration option.
38788 <indexterm role="option">
38789 <primary><option>subject</option></primary>
38792 <informaltable frame="all">
38793 <tgroup cols="4" colsep="0" rowsep="0">
38794 <colspec colwidth="8*" align="left"/>
38795 <colspec colwidth="5*" align="center"/>
38796 <colspec colwidth="5*" align="center"/>
38797 <colspec colwidth="6*" align="right"/>
38800 <entry><option>subject</option></entry>
38801 <entry>Use: <emphasis>autoreply</emphasis></entry>
38802 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38803 <entry>Default: <emphasis>unset</emphasis></entry>
38809 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
38810 specified by the transport. It is tempting to quote the original subject in
38811 automatic responses. For example:
38813 <literallayout class="monospaced">
38814 subject = Re: $h_subject:
38817 There is a danger in doing this, however. It may allow a third party to
38818 subscribe your users to an opt-in mailing list, provided that the list accepts
38819 bounce messages as subscription confirmations. Well-managed lists require a
38820 non-bounce message to confirm a subscription, so the danger is relatively
38824 <indexterm role="option">
38825 <primary><option>text</option></primary>
38828 <informaltable frame="all">
38829 <tgroup cols="4" colsep="0" rowsep="0">
38830 <colspec colwidth="8*" align="left"/>
38831 <colspec colwidth="5*" align="center"/>
38832 <colspec colwidth="5*" align="center"/>
38833 <colspec colwidth="6*" align="right"/>
38836 <entry><option>text</option></entry>
38837 <entry>Use: <emphasis>autoreply</emphasis></entry>
38838 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38839 <entry>Default: <emphasis>unset</emphasis></entry>
38845 This specifies a single string to be used as the body of the message when the
38846 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
38847 the text comes first.
38850 <indexterm role="option">
38851 <primary><option>to</option></primary>
38854 <informaltable frame="all">
38855 <tgroup cols="4" colsep="0" rowsep="0">
38856 <colspec colwidth="8*" align="left"/>
38857 <colspec colwidth="5*" align="center"/>
38858 <colspec colwidth="5*" align="center"/>
38859 <colspec colwidth="6*" align="right"/>
38862 <entry><option>to</option></entry>
38863 <entry>Use: <emphasis>autoreply</emphasis></entry>
38864 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38865 <entry>Default: <emphasis>unset</emphasis></entry>
38871 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
38872 when the message is specified by the transport.
38873 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
38874 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
38879 <chapter id="CHAPLMTP">
38880 <title>The lmtp transport</title>
38882 <indexterm role="concept">
38883 <primary>transports</primary>
38884 <secondary><command>lmtp</command></secondary>
38886 <indexterm role="concept">
38887 <primary><command>lmtp</command> transport</primary>
38889 <indexterm role="concept">
38890 <primary>LMTP</primary>
38891 <secondary>over a pipe</secondary>
38893 <indexterm role="concept">
38894 <primary>LMTP</primary>
38895 <secondary>over a socket</secondary>
38897 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
38899 or by interacting with a Unix domain socket.
38900 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
38901 transports. Exim also has support for using LMTP over TCP/IP; this is
38902 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
38903 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
38904 has it commented out. You need to ensure that
38906 <literallayout class="monospaced">
38910 <indexterm role="concept">
38911 <primary>options</primary>
38912 <secondary><command>lmtp</command> transport</secondary>
38914 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
38915 included in the Exim binary. The private options of the <command>lmtp</command> transport are
38919 <indexterm role="option">
38920 <primary><option>batch_id</option></primary>
38923 <informaltable frame="all">
38924 <tgroup cols="4" colsep="0" rowsep="0">
38925 <colspec colwidth="8*" align="left"/>
38926 <colspec colwidth="5*" align="center"/>
38927 <colspec colwidth="5*" align="center"/>
38928 <colspec colwidth="6*" align="right"/>
38931 <entry><option>batch_id</option></entry>
38932 <entry>Use: <emphasis>lmtp</emphasis></entry>
38933 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38934 <entry>Default: <emphasis>unset</emphasis></entry>
38940 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
38943 <indexterm role="option">
38944 <primary><option>batch_max</option></primary>
38947 <informaltable frame="all">
38948 <tgroup cols="4" colsep="0" rowsep="0">
38949 <colspec colwidth="8*" align="left"/>
38950 <colspec colwidth="5*" align="center"/>
38951 <colspec colwidth="5*" align="center"/>
38952 <colspec colwidth="6*" align="right"/>
38955 <entry><option>batch_max</option></entry>
38956 <entry>Use: <emphasis>lmtp</emphasis></entry>
38957 <entry>Type: <emphasis>integer</emphasis></entry>
38958 <entry>Default: <emphasis>1</emphasis></entry>
38964 This limits the number of addresses that can be handled in a single delivery.
38965 Most LMTP servers can handle several addresses at once, so it is normally a
38966 good idea to increase this value. See the description of local delivery
38967 batching in chapter <xref linkend="CHAPbatching"/>.
38970 <indexterm role="option">
38971 <primary><option>command</option></primary>
38974 <informaltable frame="all">
38975 <tgroup cols="4" colsep="0" rowsep="0">
38976 <colspec colwidth="8*" align="left"/>
38977 <colspec colwidth="5*" align="center"/>
38978 <colspec colwidth="5*" align="center"/>
38979 <colspec colwidth="6*" align="right"/>
38982 <entry><option>command</option></entry>
38983 <entry>Use: <emphasis>lmtp</emphasis></entry>
38984 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38985 <entry>Default: <emphasis>unset</emphasis></entry>
38991 This option must be set if <option>socket</option> is not set. The string is a command which
38992 is run in a separate process. It is split up into a command name and list of
38993 arguments, each of which is separately expanded (so expansion cannot change the
38994 number of arguments). The command is run directly, not via a shell. The message
38995 is passed to the new process using the standard input and output to operate the
38999 <indexterm role="option">
39000 <primary><option>ignore_quota</option></primary>
39003 <informaltable frame="all">
39004 <tgroup cols="4" colsep="0" rowsep="0">
39005 <colspec colwidth="8*" align="left"/>
39006 <colspec colwidth="5*" align="center"/>
39007 <colspec colwidth="5*" align="center"/>
39008 <colspec colwidth="6*" align="right"/>
39011 <entry><option>ignore_quota</option></entry>
39012 <entry>Use: <emphasis>lmtp</emphasis></entry>
39013 <entry>Type: <emphasis>boolean</emphasis></entry>
39014 <entry>Default: <emphasis>false</emphasis></entry>
39020 <indexterm role="concept">
39021 <primary>LMTP</primary>
39022 <secondary>ignoring quota errors</secondary>
39024 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
39025 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
39026 in its response to the LHLO command.
39029 <indexterm role="option">
39030 <primary><option>socket</option></primary>
39033 <informaltable frame="all">
39034 <tgroup cols="4" colsep="0" rowsep="0">
39035 <colspec colwidth="8*" align="left"/>
39036 <colspec colwidth="5*" align="center"/>
39037 <colspec colwidth="5*" align="center"/>
39038 <colspec colwidth="6*" align="right"/>
39041 <entry><option>socket</option></entry>
39042 <entry>Use: <emphasis>lmtp</emphasis></entry>
39043 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39044 <entry>Default: <emphasis>unset</emphasis></entry>
39050 This option must be set if <option>command</option> is not set. The result of expansion must
39051 be the name of a Unix domain socket. The transport connects to the socket and
39052 delivers the message to it using the LMTP protocol.
39055 <indexterm role="option">
39056 <primary><option>timeout</option></primary>
39059 <informaltable frame="all">
39060 <tgroup cols="4" colsep="0" rowsep="0">
39061 <colspec colwidth="8*" align="left"/>
39062 <colspec colwidth="5*" align="center"/>
39063 <colspec colwidth="5*" align="center"/>
39064 <colspec colwidth="6*" align="right"/>
39067 <entry><option>timeout</option></entry>
39068 <entry>Use: <emphasis>lmtp</emphasis></entry>
39069 <entry>Type: <emphasis>time</emphasis></entry>
39070 <entry>Default: <emphasis>5m</emphasis></entry>
39076 The transport is aborted if the created process
39077 or Unix domain socket
39078 does not respond to LMTP commands or message input within this timeout.
39081 Here is an example of a typical LMTP transport:
39083 <literallayout class="monospaced">
39086 command = /some/local/lmtp/delivery/program
39091 This delivers up to 20 addresses at a time, in a mixture of domains if
39092 necessary, running as the user <emphasis>exim</emphasis>.
39096 <chapter id="CHAPpipetransport">
39097 <title>The pipe transport</title>
39099 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
39100 <primary>transports</primary>
39101 <secondary><command>pipe</command></secondary>
39103 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
39104 <primary><command>pipe</command> transport</primary>
39106 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
39107 running in another process. One example is the use of <command>pipe</command> as a
39108 pseudo-remote transport for passing messages to some other delivery mechanism
39109 (such as UUCP). Another is the use by individual users to automatically process
39110 their incoming messages. The <command>pipe</command> transport can be used in one of the
39116 <indexterm role="concept">
39117 <primary><varname>$local_part</varname></primary>
39119 A router routes one address to a transport in the normal way, and the
39120 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
39121 contains the local part of the address (as usual), and the command that is run
39122 is specified by the <option>command</option> option on the transport.
39127 <indexterm role="concept">
39128 <primary><varname>$pipe_addresses</varname></primary>
39130 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
39131 transport can handle more than one address in a single run. In this case, when
39132 more than one address is routed to the transport, <varname>$local_part</varname> is not set
39133 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
39134 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
39135 that are routed to the transport.
39140 <indexterm role="concept">
39141 <primary><varname>$address_pipe</varname></primary>
39143 A router redirects an address directly to a pipe command (for example, from an
39144 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
39145 pipe command, and the <option>command</option> option on the transport is ignored. If only
39146 one address is being transported (<option>batch_max</option> is not greater than one, or
39147 only one address was redirected to this pipe command), <varname>$local_part</varname> contains
39148 the local part that was redirected.
39153 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
39154 deliver messages over pipes using the LMTP interactive protocol. This is
39155 implemented by the <command>lmtp</command> transport.
39158 In the case when <command>pipe</command> is run as a consequence of an entry in a local user’s
39159 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
39160 other cases, the uid and gid have to be specified explicitly, either on the
39161 transport or on the router that handles the address. Current and <quote>home</quote>
39162 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
39163 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
39164 for a discussion of local delivery batching.
39167 <title>Concurrent delivery</title>
39169 If two messages arrive at almost the same time, and both are routed to a pipe
39170 delivery, the two pipe transports may be run concurrently. You must ensure that
39171 any pipe commands you set up are robust against this happening. If the commands
39172 write to a file, the <option>exim_lock</option> utility might be of use.
39176 <title>Returned status and data</title>
39178 <indexterm role="concept">
39179 <primary><command>pipe</command> transport</primary>
39180 <secondary>returned data</secondary>
39182 If the command exits with a non-zero return code, the delivery is deemed to
39183 have failed, unless either the <option>ignore_status</option> option is set (in which case
39184 the return code is treated as zero), or the return code is one of those listed
39185 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
39186 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
39187 logged, but are not included in the bounce message, which merely contains
39188 <quote>local delivery failed</quote>.
39191 If the return code is greater than 128 and the command being run is a shell
39192 script, it normally means that the script was terminated by a signal whose
39193 value is the return code minus 128.
39196 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
39197 return code is set to 127. This is the value that a shell returns if it is
39198 asked to run a non-existent command. The wording for the log line suggests that
39199 a non-existent command may be the problem.
39202 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
39203 set and the command produces any output on its standard output or standard
39204 error streams, the command is considered to have failed, even if it gave a zero
39205 return code or if <option>ignore_status</option> is set. The output from the command is
39206 included as part of the bounce message. The <option>return_fail_output</option> option is
39207 similar, except that output is returned only when the command exits with a
39208 failure return code, that is, a value other than zero or a code that matches
39209 <option>temp_errors</option>.
39212 <section id="SECThowcommandrun">
39213 <title>How the command is run</title>
39215 <indexterm role="concept">
39216 <primary><command>pipe</command> transport</primary>
39217 <secondary>path for command</secondary>
39219 The command line is (by default) broken down into a command name and arguments
39220 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
39221 <option>restrict_to_path</option> options can be used to restrict the commands that may be
39225 <indexterm role="concept">
39226 <primary>quoting</primary>
39227 <secondary>in pipe command</secondary>
39229 Unquoted arguments are delimited by white space. If an argument appears in
39230 double quotes, backslash is interpreted as an escape character in the usual
39231 way. If an argument appears in single quotes, no escaping is done.
39234 String expansion is applied to the command line except when it comes from a
39235 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
39236 expansion is applied to each argument in turn rather than to the whole line.
39237 For this reason, any string expansion item that contains white space must be
39238 quoted so as to be contained within a single argument. A setting such as
39240 <literallayout class="monospaced">
39241 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
39244 will not work, because the expansion item gets split between several
39245 arguments. You have to write
39247 <literallayout class="monospaced">
39248 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
39251 to ensure that it is all in one argument. The expansion is done in this way,
39252 argument by argument, so that the number of arguments cannot be changed as a
39253 result of expansion, and quotes or backslashes in inserted variables do not
39254 interact with external quoting. However, this leads to problems if you want to
39255 generate multiple arguments (or the command name plus arguments) from a single
39256 expansion. In this situation, the simplest solution is to use a shell. For
39259 <literallayout class="monospaced">
39260 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
39263 <indexterm role="concept">
39264 <primary>transport</primary>
39265 <secondary>filter</secondary>
39267 <indexterm role="concept">
39268 <primary>filter</primary>
39269 <secondary>transport filter</secondary>
39271 <indexterm role="concept">
39272 <primary><varname>$pipe_addresses</varname></primary>
39274 Special handling takes place when an argument consists of precisely the text
39275 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
39276 place this string is recognized is when it appears as an argument for a pipe or
39277 transport filter command. It causes each address that is being handled to be
39278 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
39279 avoids any problems with spaces or shell metacharacters, and is of use when a
39280 <command>pipe</command> transport is handling groups of addresses in a batch.
39283 After splitting up into arguments and expansion, the resulting command is run
39284 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
39285 message that is being delivered is supplied on the standard input, and the
39286 standard output and standard error are both connected to a single pipe that is
39287 read by Exim. The <option>max_output</option> option controls how much output the command
39288 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
39289 control what is done with it.
39292 Not running the command under a shell (by default) lessens the security risks
39293 in cases when a command from a user’s filter file is built out of data that was
39294 taken from an incoming message. If a shell is required, it can of course be
39295 explicitly specified as the command to be run. However, there are circumstances
39296 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
39297 under a shell and cannot easily be modified. To allow for these cases, there is
39298 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
39299 works. Instead of breaking up the command line as just described, it expands it
39300 as a single string and passes the result to <filename>/bin/sh</filename>. The
39301 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
39302 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
39305 <section id="SECTpipeenv">
39306 <title>Environment variables</title>
39308 <indexterm role="concept">
39309 <primary><command>pipe</command> transport</primary>
39310 <secondary>environment for command</secondary>
39312 <indexterm role="concept">
39313 <primary>environment for pipe transport</primary>
39315 The environment variables listed below are set up when the command is invoked.
39316 This list is a compromise for maximum compatibility with other MTAs. Note that
39317 the <option>environment</option> option can be used to add additional variables to this
39321 <literal>DOMAIN </literal> the domain of the address
39322 <literal>HOME </literal> the home directory, if set
39323 <literal>HOST </literal> the host name when called from a router (see below)
39324 <literal>LOCAL_PART </literal> see below
39325 <literal>LOCAL_PART_PREFIX </literal> see below
39326 <literal>LOCAL_PART_SUFFIX </literal> see below
39327 <literal>LOGNAME </literal> see below
39328 <literal>MESSAGE_ID </literal> Exim’s local ID for the message
39329 <literal>PATH </literal> as specified by the <option>path</option> option below
39330 <literal>QUALIFY_DOMAIN </literal> the sender qualification domain
39331 <literal>RECIPIENT </literal> the complete recipient address
39332 <literal>SENDER </literal> the sender of the message (empty if a bounce)
39333 <literal>SHELL </literal> <literal>/bin/sh</literal>
39334 <literal>TZ </literal> the value of the <option>timezone</option> option, if set
39335 <literal>USER </literal> see below
39338 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
39339 router, LOCAL_PART is set to the local part of the address. When it is
39340 called as a result of a forward or alias expansion, LOCAL_PART is set to
39341 the local part of the address that was expanded. In both cases, any affixes are
39342 removed from the local part, and made available in LOCAL_PART_PREFIX and
39343 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
39344 same value as LOCAL_PART for compatibility with other MTAs.
39347 <indexterm role="concept">
39348 <primary>HOST</primary>
39350 HOST is set only when a <command>pipe</command> transport is called from a router that
39351 associates hosts with an address, typically when using <command>pipe</command> as a
39352 pseudo-remote transport. HOST is set to the first host name specified by
39356 <indexterm role="concept">
39357 <primary>HOME</primary>
39359 If the transport’s generic <option>home_directory</option> option is set, its value is used
39360 for the HOME environment variable. Otherwise, a home directory may be set
39361 by the router’s <option>transport_home_directory</option> option, which defaults to the
39362 user’s home directory if <option>check_local_user</option> is set.
39366 <title>Private options for pipe</title>
39368 <indexterm role="concept">
39369 <primary>options</primary>
39370 <secondary><command>pipe</command> transport</secondary>
39374 <indexterm role="option">
39375 <primary><option>allow_commands</option></primary>
39378 <informaltable frame="all">
39379 <tgroup cols="4" colsep="0" rowsep="0">
39380 <colspec colwidth="8*" align="left"/>
39381 <colspec colwidth="5*" align="center"/>
39382 <colspec colwidth="5*" align="center"/>
39383 <colspec colwidth="6*" align="right"/>
39386 <entry><option>allow_commands</option></entry>
39387 <entry>Use: <emphasis>pipe</emphasis></entry>
39388 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
39389 <entry>Default: <emphasis>unset</emphasis></entry>
39395 <indexterm role="concept">
39396 <primary><command>pipe</command> transport</primary>
39397 <secondary>permitted commands</secondary>
39399 The string is expanded, and is then interpreted as a colon-separated list of
39400 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
39401 permitted are those in the <option>allow_commands</option> list. They need not be absolute
39402 paths; the <option>path</option> option is still used for relative paths. If
39403 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
39404 in the <option>allow_commands</option> list, or a name without any slashes that is found on
39405 the path. In other words, if neither <option>allow_commands</option> nor
39406 <option>restrict_to_path</option> is set, there is no restriction on the command, but
39407 otherwise only commands that are permitted by one or the other are allowed. For
39410 <literallayout class="monospaced">
39411 allow_commands = /usr/bin/vacation
39414 and <option>restrict_to_path</option> is not set, the only permitted command is
39415 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
39416 <option>use_shell</option> is set.
39419 <indexterm role="option">
39420 <primary><option>batch_id</option></primary>
39423 <informaltable frame="all">
39424 <tgroup cols="4" colsep="0" rowsep="0">
39425 <colspec colwidth="8*" align="left"/>
39426 <colspec colwidth="5*" align="center"/>
39427 <colspec colwidth="5*" align="center"/>
39428 <colspec colwidth="6*" align="right"/>
39431 <entry><option>batch_id</option></entry>
39432 <entry>Use: <emphasis>pipe</emphasis></entry>
39433 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39434 <entry>Default: <emphasis>unset</emphasis></entry>
39440 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
39443 <indexterm role="option">
39444 <primary><option>batch_max</option></primary>
39447 <informaltable frame="all">
39448 <tgroup cols="4" colsep="0" rowsep="0">
39449 <colspec colwidth="8*" align="left"/>
39450 <colspec colwidth="5*" align="center"/>
39451 <colspec colwidth="5*" align="center"/>
39452 <colspec colwidth="6*" align="right"/>
39455 <entry><option>batch_max</option></entry>
39456 <entry>Use: <emphasis>pipe</emphasis></entry>
39457 <entry>Type: <emphasis>integer</emphasis></entry>
39458 <entry>Default: <emphasis>1</emphasis></entry>
39464 This limits the number of addresses that can be handled in a single delivery.
39465 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
39468 <indexterm role="option">
39469 <primary><option>check_string</option></primary>
39472 <informaltable frame="all">
39473 <tgroup cols="4" colsep="0" rowsep="0">
39474 <colspec colwidth="8*" align="left"/>
39475 <colspec colwidth="5*" align="center"/>
39476 <colspec colwidth="5*" align="center"/>
39477 <colspec colwidth="6*" align="right"/>
39480 <entry><option>check_string</option></entry>
39481 <entry>Use: <emphasis>pipe</emphasis></entry>
39482 <entry>Type: <emphasis>string</emphasis></entry>
39483 <entry>Default: <emphasis>unset</emphasis></entry>
39489 As <command>pipe</command> writes the message, the start of each line is tested for matching
39490 <option>check_string</option>, and if it does, the initial matching characters are replaced
39491 by the contents of <option>escape_string</option>, provided both are set. The value of
39492 <option>check_string</option> is a literal string, not a regular expression, and the case of
39493 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
39494 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
39495 the SMTP escaping protocol. Any settings made in the configuration file are
39499 <indexterm role="option">
39500 <primary><option>command</option></primary>
39503 <informaltable frame="all">
39504 <tgroup cols="4" colsep="0" rowsep="0">
39505 <colspec colwidth="8*" align="left"/>
39506 <colspec colwidth="5*" align="center"/>
39507 <colspec colwidth="5*" align="center"/>
39508 <colspec colwidth="6*" align="right"/>
39511 <entry><option>command</option></entry>
39512 <entry>Use: <emphasis>pipe</emphasis></entry>
39513 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39514 <entry>Default: <emphasis>unset</emphasis></entry>
39520 This option need not be set when <command>pipe</command> is being used to deliver to pipes
39521 obtained directly from address redirections. In other cases, the option must be
39522 set, to provide a command to be run. It need not yield an absolute path (see
39523 the <option>path</option> option below). The command is split up into separate arguments by
39524 Exim, and each argument is separately expanded, as described in section
39525 <xref linkend="SECThowcommandrun"/> above.
39528 <indexterm role="option">
39529 <primary><option>environment</option></primary>
39532 <informaltable frame="all">
39533 <tgroup cols="4" colsep="0" rowsep="0">
39534 <colspec colwidth="8*" align="left"/>
39535 <colspec colwidth="5*" align="center"/>
39536 <colspec colwidth="5*" align="center"/>
39537 <colspec colwidth="6*" align="right"/>
39540 <entry><option>environment</option></entry>
39541 <entry>Use: <emphasis>pipe</emphasis></entry>
39542 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39543 <entry>Default: <emphasis>unset</emphasis></entry>
39549 <indexterm role="concept">
39550 <primary><command>pipe</command> transport</primary>
39551 <secondary>environment for command</secondary>
39553 <indexterm role="concept">
39554 <primary>environment for <command>pipe</command> transport</primary>
39556 This option is used to add additional variables to the environment in which the
39557 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
39558 a string which is expanded, and then interpreted as a colon-separated list of
39559 environment settings of the form <<emphasis>name</emphasis>>=<<emphasis>value</emphasis>>.
39562 <indexterm role="option">
39563 <primary><option>escape_string</option></primary>
39566 <informaltable frame="all">
39567 <tgroup cols="4" colsep="0" rowsep="0">
39568 <colspec colwidth="8*" align="left"/>
39569 <colspec colwidth="5*" align="center"/>
39570 <colspec colwidth="5*" align="center"/>
39571 <colspec colwidth="6*" align="right"/>
39574 <entry><option>escape_string</option></entry>
39575 <entry>Use: <emphasis>pipe</emphasis></entry>
39576 <entry>Type: <emphasis>string</emphasis></entry>
39577 <entry>Default: <emphasis>unset</emphasis></entry>
39583 See <option>check_string</option> above.
39586 <indexterm role="option">
39587 <primary><option>freeze_exec_fail</option></primary>
39590 <informaltable frame="all">
39591 <tgroup cols="4" colsep="0" rowsep="0">
39592 <colspec colwidth="8*" align="left"/>
39593 <colspec colwidth="5*" align="center"/>
39594 <colspec colwidth="5*" align="center"/>
39595 <colspec colwidth="6*" align="right"/>
39598 <entry><option>freeze_exec_fail</option></entry>
39599 <entry>Use: <emphasis>pipe</emphasis></entry>
39600 <entry>Type: <emphasis>boolean</emphasis></entry>
39601 <entry>Default: <emphasis>false</emphasis></entry>
39607 <indexterm role="concept">
39608 <primary>exec failure</primary>
39610 <indexterm role="concept">
39611 <primary>failure of exec</primary>
39613 <indexterm role="concept">
39614 <primary><command>pipe</command> transport</primary>
39615 <secondary>failure of exec</secondary>
39617 Failure to exec the command in a pipe transport is by default treated like
39618 any other failure while running the command. However, if <option>freeze_exec_fail</option>
39619 is set, failure to exec is treated specially, and causes the message to be
39620 frozen, whatever the setting of <option>ignore_status</option>.
39623 <indexterm role="option">
39624 <primary><option>ignore_status</option></primary>
39627 <informaltable frame="all">
39628 <tgroup cols="4" colsep="0" rowsep="0">
39629 <colspec colwidth="8*" align="left"/>
39630 <colspec colwidth="5*" align="center"/>
39631 <colspec colwidth="5*" align="center"/>
39632 <colspec colwidth="6*" align="right"/>
39635 <entry><option>ignore_status</option></entry>
39636 <entry>Use: <emphasis>pipe</emphasis></entry>
39637 <entry>Type: <emphasis>boolean</emphasis></entry>
39638 <entry>Default: <emphasis>false</emphasis></entry>
39644 If this option is true, the status returned by the subprocess that is set up to
39645 run the command is ignored, and Exim behaves as if zero had been returned.
39646 Otherwise, a non-zero status or termination by signal causes an error return
39647 from the transport unless the status value is one of those listed in
39648 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
39651 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
39652 See the <option>timeout_defer</option> option for how timeouts are handled.
39655 <indexterm role="option">
39656 <primary><option>log_defer_output</option></primary>
39659 <informaltable frame="all">
39660 <tgroup cols="4" colsep="0" rowsep="0">
39661 <colspec colwidth="8*" align="left"/>
39662 <colspec colwidth="5*" align="center"/>
39663 <colspec colwidth="5*" align="center"/>
39664 <colspec colwidth="6*" align="right"/>
39667 <entry><option>log_defer_output</option></entry>
39668 <entry>Use: <emphasis>pipe</emphasis></entry>
39669 <entry>Type: <emphasis>boolean</emphasis></entry>
39670 <entry>Default: <emphasis>false</emphasis></entry>
39676 <indexterm role="concept">
39677 <primary><command>pipe</command> transport</primary>
39678 <secondary>logging output</secondary>
39680 If this option is set, and the status returned by the command is
39681 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
39682 and any output was produced, the first line of it is written to the main log.
39685 <indexterm role="option">
39686 <primary><option>log_fail_output</option></primary>
39689 <informaltable frame="all">
39690 <tgroup cols="4" colsep="0" rowsep="0">
39691 <colspec colwidth="8*" align="left"/>
39692 <colspec colwidth="5*" align="center"/>
39693 <colspec colwidth="5*" align="center"/>
39694 <colspec colwidth="6*" align="right"/>
39697 <entry><option>log_fail_output</option></entry>
39698 <entry>Use: <emphasis>pipe</emphasis></entry>
39699 <entry>Type: <emphasis>boolean</emphasis></entry>
39700 <entry>Default: <emphasis>false</emphasis></entry>
39706 If this option is set, and the command returns any output, and also ends with a
39707 return code that is neither zero nor one of the return codes listed in
39708 <option>temp_errors</option> (that is, the delivery failed), the first line of output is
39709 written to the main log. This option and <option>log_output</option> are mutually exclusive.
39710 Only one of them may be set.
39713 <indexterm role="option">
39714 <primary><option>log_output</option></primary>
39717 <informaltable frame="all">
39718 <tgroup cols="4" colsep="0" rowsep="0">
39719 <colspec colwidth="8*" align="left"/>
39720 <colspec colwidth="5*" align="center"/>
39721 <colspec colwidth="5*" align="center"/>
39722 <colspec colwidth="6*" align="right"/>
39725 <entry><option>log_output</option></entry>
39726 <entry>Use: <emphasis>pipe</emphasis></entry>
39727 <entry>Type: <emphasis>boolean</emphasis></entry>
39728 <entry>Default: <emphasis>false</emphasis></entry>
39734 If this option is set and the command returns any output, the first line of
39735 output is written to the main log, whatever the return code. This option and
39736 <option>log_fail_output</option> are mutually exclusive. Only one of them may be set.
39739 <indexterm role="option">
39740 <primary><option>max_output</option></primary>
39743 <informaltable frame="all">
39744 <tgroup cols="4" colsep="0" rowsep="0">
39745 <colspec colwidth="8*" align="left"/>
39746 <colspec colwidth="5*" align="center"/>
39747 <colspec colwidth="5*" align="center"/>
39748 <colspec colwidth="6*" align="right"/>
39751 <entry><option>max_output</option></entry>
39752 <entry>Use: <emphasis>pipe</emphasis></entry>
39753 <entry>Type: <emphasis>integer</emphasis></entry>
39754 <entry>Default: <emphasis>20K</emphasis></entry>
39760 This specifies the maximum amount of output that the command may produce on its
39761 standard output and standard error file combined. If the limit is exceeded, the
39762 process running the command is killed. This is intended as a safety measure to
39763 catch runaway processes. The limit is applied independently of the settings of
39764 the options that control what is done with such output (for example,
39765 <option>return_output</option>). Because of buffering effects, the amount of output may
39766 exceed the limit by a small amount before Exim notices.
39769 <indexterm role="option">
39770 <primary><option>message_prefix</option></primary>
39773 <informaltable frame="all">
39774 <tgroup cols="4" colsep="0" rowsep="0">
39775 <colspec colwidth="8*" align="left"/>
39776 <colspec colwidth="5*" align="center"/>
39777 <colspec colwidth="5*" align="center"/>
39778 <colspec colwidth="6*" align="right"/>
39781 <entry><option>message_prefix</option></entry>
39782 <entry>Use: <emphasis>pipe</emphasis></entry>
39783 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39784 <entry>Default: <emphasis>see below</emphasis></entry>
39790 The string specified here is expanded and output at the start of every message.
39791 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
39793 <literallayout class="monospaced">
39795 From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
39799 <indexterm role="concept">
39800 <primary>Cyrus</primary>
39802 <indexterm role="concept">
39803 <primary><option>tmail</option></primary>
39805 <indexterm role="concept">
39806 <primary><quote>From</quote> line</primary>
39808 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
39809 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
39810 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
39813 <literallayout class="monospaced">
39817 <indexterm role="option">
39818 <primary><option>message_suffix</option></primary>
39821 <informaltable frame="all">
39822 <tgroup cols="4" colsep="0" rowsep="0">
39823 <colspec colwidth="8*" align="left"/>
39824 <colspec colwidth="5*" align="center"/>
39825 <colspec colwidth="5*" align="center"/>
39826 <colspec colwidth="6*" align="right"/>
39829 <entry><option>message_suffix</option></entry>
39830 <entry>Use: <emphasis>pipe</emphasis></entry>
39831 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39832 <entry>Default: <emphasis>see below</emphasis></entry>
39838 The string specified here is expanded and output at the end of every message.
39839 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
39840 The suffix can be suppressed by setting
39842 <literallayout class="monospaced">
39846 <indexterm role="option">
39847 <primary><option>path</option></primary>
39850 <informaltable frame="all">
39851 <tgroup cols="4" colsep="0" rowsep="0">
39852 <colspec colwidth="8*" align="left"/>
39853 <colspec colwidth="5*" align="center"/>
39854 <colspec colwidth="5*" align="center"/>
39855 <colspec colwidth="6*" align="right"/>
39858 <entry><option>path</option></entry>
39859 <entry>Use: <emphasis>pipe</emphasis></entry>
39860 <entry>Type: <emphasis>string</emphasis></entry>
39861 <entry>Default: <emphasis><literal>/bin:/usr/bin</literal></emphasis></entry>
39867 This option specifies the string that is set up in the PATH environment
39868 variable of the subprocess. If the <option>command</option> option does not yield an
39869 absolute path name, the command is sought in the PATH directories, in the usual
39870 way. <emphasis role="bold">Warning</emphasis>: This does not apply to a command specified as a transport
39874 <indexterm role="option">
39875 <primary><option>pipe_as_creator</option></primary>
39878 <informaltable frame="all">
39879 <tgroup cols="4" colsep="0" rowsep="0">
39880 <colspec colwidth="8*" align="left"/>
39881 <colspec colwidth="5*" align="center"/>
39882 <colspec colwidth="5*" align="center"/>
39883 <colspec colwidth="6*" align="right"/>
39886 <entry><option>pipe_as_creator</option></entry>
39887 <entry>Use: <emphasis>pipe</emphasis></entry>
39888 <entry>Type: <emphasis>boolean</emphasis></entry>
39889 <entry>Default: <emphasis>false</emphasis></entry>
39895 <indexterm role="concept">
39896 <primary>uid (user id)</primary>
39897 <secondary>local delivery</secondary>
39899 If the generic <option>user</option> option is not set and this option is true, the delivery
39900 process is run under the uid that was in force when Exim was originally called
39901 to accept the message. If the group id is not otherwise set (via the generic
39902 <option>group</option> option), the gid that was in force when Exim was originally called to
39903 accept the message is used.
39906 <indexterm role="option">
39907 <primary><option>restrict_to_path</option></primary>
39910 <informaltable frame="all">
39911 <tgroup cols="4" colsep="0" rowsep="0">
39912 <colspec colwidth="8*" align="left"/>
39913 <colspec colwidth="5*" align="center"/>
39914 <colspec colwidth="5*" align="center"/>
39915 <colspec colwidth="6*" align="right"/>
39918 <entry><option>restrict_to_path</option></entry>
39919 <entry>Use: <emphasis>pipe</emphasis></entry>
39920 <entry>Type: <emphasis>boolean</emphasis></entry>
39921 <entry>Default: <emphasis>false</emphasis></entry>
39927 When this option is set, any command name not listed in <option>allow_commands</option> must
39928 contain no slashes. The command is searched for only in the directories listed
39929 in the <option>path</option> option. This option is intended for use in the case when a pipe
39930 command has been generated from a user’s <filename>.forward</filename> file. This is usually
39931 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
39934 <indexterm role="option">
39935 <primary><option>return_fail_output</option></primary>
39938 <informaltable frame="all">
39939 <tgroup cols="4" colsep="0" rowsep="0">
39940 <colspec colwidth="8*" align="left"/>
39941 <colspec colwidth="5*" align="center"/>
39942 <colspec colwidth="5*" align="center"/>
39943 <colspec colwidth="6*" align="right"/>
39946 <entry><option>return_fail_output</option></entry>
39947 <entry>Use: <emphasis>pipe</emphasis></entry>
39948 <entry>Type: <emphasis>boolean</emphasis></entry>
39949 <entry>Default: <emphasis>false</emphasis></entry>
39955 If this option is true, and the command produced any output and ended with a
39956 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
39957 is, the delivery failed), the output is returned in the bounce message.
39958 However, if the message has a null sender (that is, it is itself a bounce
39959 message), output from the command is discarded. This option and
39960 <option>return_output</option> are mutually exclusive. Only one of them may be set.
39963 <indexterm role="option">
39964 <primary><option>return_output</option></primary>
39967 <informaltable frame="all">
39968 <tgroup cols="4" colsep="0" rowsep="0">
39969 <colspec colwidth="8*" align="left"/>
39970 <colspec colwidth="5*" align="center"/>
39971 <colspec colwidth="5*" align="center"/>
39972 <colspec colwidth="6*" align="right"/>
39975 <entry><option>return_output</option></entry>
39976 <entry>Use: <emphasis>pipe</emphasis></entry>
39977 <entry>Type: <emphasis>boolean</emphasis></entry>
39978 <entry>Default: <emphasis>false</emphasis></entry>
39984 If this option is true, and the command produced any output, the delivery is
39985 deemed to have failed whatever the return code from the command, and the output
39986 is returned in the bounce message. Otherwise, the output is just discarded.
39987 However, if the message has a null sender (that is, it is a bounce message),
39988 output from the command is always discarded, whatever the setting of this
39989 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
39990 of them may be set.
39993 <indexterm role="option">
39994 <primary><option>temp_errors</option></primary>
39997 <informaltable frame="all">
39998 <tgroup cols="4" colsep="0" rowsep="0">
39999 <colspec colwidth="8*" align="left"/>
40000 <colspec colwidth="5*" align="center"/>
40001 <colspec colwidth="5*" align="center"/>
40002 <colspec colwidth="6*" align="right"/>
40005 <entry><option>temp_errors</option></entry>
40006 <entry>Use: <emphasis>pipe</emphasis></entry>
40007 <entry>Type: <emphasis>string list</emphasis></entry>
40008 <entry>Default: <emphasis>see below</emphasis></entry>
40014 <indexterm role="concept">
40015 <primary><command>pipe</command> transport</primary>
40016 <secondary>temporary failure</secondary>
40018 This option contains either a colon-separated list of numbers, or a single
40019 asterisk. If <option>ignore_status</option> is false
40020 and <option>return_output</option> is not set,
40021 and the command exits with a non-zero return code, the failure is treated as
40022 temporary and the delivery is deferred if the return code matches one of the
40023 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
40024 codes are treated as permanent errors. The default setting contains the codes
40025 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
40026 compiled on a system that does not define these macros, it assumes values of 75
40027 and 73, respectively.
40030 <indexterm role="option">
40031 <primary><option>timeout</option></primary>
40034 <informaltable frame="all">
40035 <tgroup cols="4" colsep="0" rowsep="0">
40036 <colspec colwidth="8*" align="left"/>
40037 <colspec colwidth="5*" align="center"/>
40038 <colspec colwidth="5*" align="center"/>
40039 <colspec colwidth="6*" align="right"/>
40042 <entry><option>timeout</option></entry>
40043 <entry>Use: <emphasis>pipe</emphasis></entry>
40044 <entry>Type: <emphasis>time</emphasis></entry>
40045 <entry>Default: <emphasis>1h</emphasis></entry>
40051 If the command fails to complete within this time, it is killed. This normally
40052 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
40053 specifies no timeout. In order to ensure that any subprocesses created by the
40054 command are also killed, Exim makes the initial process a process group leader,
40055 and kills the whole process group on a timeout. However, this can be defeated
40056 if one of the processes starts a new process group.
40059 <indexterm role="option">
40060 <primary><option>timeout_defer</option></primary>
40063 <informaltable frame="all">
40064 <tgroup cols="4" colsep="0" rowsep="0">
40065 <colspec colwidth="8*" align="left"/>
40066 <colspec colwidth="5*" align="center"/>
40067 <colspec colwidth="5*" align="center"/>
40068 <colspec colwidth="6*" align="right"/>
40071 <entry><option>timeout_defer</option></entry>
40072 <entry>Use: <emphasis>pipe</emphasis></entry>
40073 <entry>Type: <emphasis>boolean</emphasis></entry>
40074 <entry>Default: <emphasis>false</emphasis></entry>
40080 A timeout in a <command>pipe</command> transport, either in the command that the transport
40081 runs, or in a transport filter that is associated with it, is by default
40082 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
40083 is set true, both kinds of timeout become temporary errors, causing the
40084 delivery to be deferred.
40087 <indexterm role="option">
40088 <primary><option>umask</option></primary>
40091 <informaltable frame="all">
40092 <tgroup cols="4" colsep="0" rowsep="0">
40093 <colspec colwidth="8*" align="left"/>
40094 <colspec colwidth="5*" align="center"/>
40095 <colspec colwidth="5*" align="center"/>
40096 <colspec colwidth="6*" align="right"/>
40099 <entry><option>umask</option></entry>
40100 <entry>Use: <emphasis>pipe</emphasis></entry>
40101 <entry>Type: <emphasis>octal integer</emphasis></entry>
40102 <entry>Default: <emphasis>022</emphasis></entry>
40108 This specifies the umask setting for the subprocess that runs the command.
40111 <indexterm role="option">
40112 <primary><option>use_bsmtp</option></primary>
40115 <informaltable frame="all">
40116 <tgroup cols="4" colsep="0" rowsep="0">
40117 <colspec colwidth="8*" align="left"/>
40118 <colspec colwidth="5*" align="center"/>
40119 <colspec colwidth="5*" align="center"/>
40120 <colspec colwidth="6*" align="right"/>
40123 <entry><option>use_bsmtp</option></entry>
40124 <entry>Use: <emphasis>pipe</emphasis></entry>
40125 <entry>Type: <emphasis>boolean</emphasis></entry>
40126 <entry>Default: <emphasis>false</emphasis></entry>
40132 <indexterm role="concept">
40133 <primary>envelope sender</primary>
40135 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
40136 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
40137 commands. If you want to include a leading HELO command with such messages,
40138 you can do so by setting the <option>message_prefix</option> option. See section
40139 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
40142 <indexterm role="option">
40143 <primary><option>use_classresources</option></primary>
40146 <informaltable frame="all">
40147 <tgroup cols="4" colsep="0" rowsep="0">
40148 <colspec colwidth="8*" align="left"/>
40149 <colspec colwidth="5*" align="center"/>
40150 <colspec colwidth="5*" align="center"/>
40151 <colspec colwidth="6*" align="right"/>
40154 <entry><option>use_classresources</option></entry>
40155 <entry>Use: <emphasis>pipe</emphasis></entry>
40156 <entry>Type: <emphasis>boolean</emphasis></entry>
40157 <entry>Default: <emphasis>false</emphasis></entry>
40163 <indexterm role="concept">
40164 <primary>class resources (BSD)</primary>
40166 This option is available only when Exim is running on FreeBSD, NetBSD, or
40167 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
40168 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
40169 limits for the uid under which the pipe is to run are obtained from the login
40173 <indexterm role="option">
40174 <primary><option>use_crlf</option></primary>
40177 <informaltable frame="all">
40178 <tgroup cols="4" colsep="0" rowsep="0">
40179 <colspec colwidth="8*" align="left"/>
40180 <colspec colwidth="5*" align="center"/>
40181 <colspec colwidth="5*" align="center"/>
40182 <colspec colwidth="6*" align="right"/>
40185 <entry><option>use_crlf</option></entry>
40186 <entry>Use: <emphasis>pipe</emphasis></entry>
40187 <entry>Type: <emphasis>boolean</emphasis></entry>
40188 <entry>Default: <emphasis>false</emphasis></entry>
40194 <indexterm role="concept">
40195 <primary>carriage return</primary>
40197 <indexterm role="concept">
40198 <primary>linefeed</primary>
40200 This option causes lines to be terminated with the two-character CRLF sequence
40201 (carriage return, linefeed) instead of just a linefeed character. In the case
40202 of batched SMTP, the byte sequence written to the pipe is then an exact image
40203 of what would be sent down a real SMTP connection.
40206 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
40207 written verbatim, so must contain their own carriage return characters if these
40208 are needed. Since the default values for both <option>message_prefix</option> and
40209 <option>message_suffix</option> end with a single linefeed, their values must be changed to
40210 end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
40213 <indexterm role="option">
40214 <primary><option>use_shell</option></primary>
40217 <informaltable frame="all">
40218 <tgroup cols="4" colsep="0" rowsep="0">
40219 <colspec colwidth="8*" align="left"/>
40220 <colspec colwidth="5*" align="center"/>
40221 <colspec colwidth="5*" align="center"/>
40222 <colspec colwidth="6*" align="right"/>
40225 <entry><option>use_shell</option></entry>
40226 <entry>Use: <emphasis>pipe</emphasis></entry>
40227 <entry>Type: <emphasis>boolean</emphasis></entry>
40228 <entry>Default: <emphasis>false</emphasis></entry>
40234 <indexterm role="concept">
40235 <primary><varname>$pipe_addresses</varname></primary>
40237 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
40238 instead of being run directly from the transport, as described in section
40239 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
40240 where the command is expected to be run under a shell and cannot easily be
40241 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
40242 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
40243 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
40244 its <option>-c</option> option.
40248 <title>Using an external local delivery agent</title>
40250 <indexterm role="concept">
40251 <primary>local delivery</primary>
40252 <secondary>using an external agent</secondary>
40254 <indexterm role="concept">
40255 <primary><emphasis>procmail</emphasis></primary>
40257 <indexterm role="concept">
40258 <primary>external local delivery</primary>
40260 <indexterm role="concept">
40261 <primary>delivery</primary>
40262 <secondary><emphasis>procmail</emphasis></secondary>
40264 <indexterm role="concept">
40265 <primary>delivery</primary>
40266 <secondary>by external agent</secondary>
40268 The <command>pipe</command> transport can be used to pass all messages that require local
40269 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
40270 this, care must be taken to ensure that the pipe is run under an appropriate
40271 uid and gid. In some configurations one wants this to be a uid that is trusted
40272 by the delivery agent to supply the correct sender of the message. It may be
40273 necessary to recompile or reconfigure the delivery agent so that it trusts an
40274 appropriate user. The following is an example transport and router
40275 configuration for <option>procmail</option>:
40277 <literallayout class="monospaced">
40281 command = /usr/local/bin/procmail -d $local_part
40285 check_string = "From "
40286 escape_string = ">From "
40294 transport = procmail_pipe
40297 In this example, the pipe is run as the local user, but with the group set to
40298 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
40299 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
40300 user to supply a correct sender address. If you do not specify either a
40301 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
40302 home directory is the user’s home directory by default.
40305 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
40307 <literallayout class="monospaced">
40311 as shown in some <option>procmail</option> documentation, because Exim does not by default
40312 use a shell to run pipe commands.
40315 <indexterm role="concept">
40316 <primary>Cyrus</primary>
40318 The next example shows a transport and a router for a system where local
40319 deliveries are handled by the Cyrus IMAP server.
40321 <literallayout class="monospaced">
40323 local_delivery_cyrus:
40325 command = /usr/cyrus/bin/deliver \
40326 -m ${substr_1:$local_part_suffix} -- $local_part
40338 local_part_suffix = .*
40339 transport = local_delivery_cyrus
40342 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
40343 <option>return_output</option> to cause any text written by Cyrus to be returned to the
40345 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
40346 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
40351 <chapter id="CHAPsmtptrans">
40352 <title>The smtp transport</title>
40354 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
40355 <primary>transports</primary>
40356 <secondary><command>smtp</command></secondary>
40358 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
40359 <primary><command>smtp</command> transport</primary>
40361 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
40362 or LMTP protocol. The list of hosts to try can either be taken from the address
40363 that is being processed (having been set up by the router), or specified
40364 explicitly for the transport. Timeout and retry processing (see chapter
40365 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
40368 <title>Multiple messages on a single connection</title>
40370 The sending of multiple messages over a single TCP/IP connection can arise in
40376 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
40377 routed to the same host, more than one copy of the message has to be sent to
40378 that host. In this situation, multiple copies may be sent in a single run of
40379 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
40380 does when it has too many addresses to send in one message also depends on the
40381 value of the global <option>remote_max_parallel</option> option. Details are given in
40382 section <xref linkend="SECToutSMTPTCP"/>.)
40387 <indexterm role="concept">
40388 <primary>hints database</primary>
40389 <secondary>remembering routing</secondary>
40391 When a message has been successfully delivered over a TCP/IP connection, Exim
40392 looks in its hints database to see if there are any other messages awaiting a
40393 connection to the same host. If there are, a new delivery process is started
40394 for one of them, and the current TCP/IP connection is passed on to it. The new
40395 process may in turn send multiple copies and possibly create yet another
40401 For each copy sent over the same TCP/IP connection, a sequence counter is
40402 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
40403 no further messages are sent over that connection.
40407 <title>Use of the $host variable</title>
40409 <indexterm role="concept">
40410 <primary><varname>$host</varname></primary>
40412 <indexterm role="concept">
40413 <primary><varname>$host_address</varname></primary>
40415 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
40416 <varname>$host_address</varname> are the name and IP address of the first host on the host list
40417 passed by the router. However, when the transport is about to connect to a
40418 specific host, and while it is connected to that host, <varname>$host</varname> and
40419 <varname>$host_address</varname> are set to the values for that host. These are the values
40420 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
40421 <option>serialize_hosts</option>, and the various TLS options are expanded.
40425 <title>Private options for smtp</title>
40427 <indexterm role="concept">
40428 <primary>options</primary>
40429 <secondary><command>smtp</command> transport</secondary>
40431 The private options of the <command>smtp</command> transport are as follows:
40433 <para revisionflag="changed">
40434 <indexterm role="option">
40435 <primary><option>address_retry_include_sender</option></primary>
40438 <informaltable frame="all" revisionflag="changed">
40439 <tgroup cols="4" colsep="0" rowsep="0">
40440 <colspec colwidth="8*" align="left"/>
40441 <colspec colwidth="5*" align="center"/>
40442 <colspec colwidth="5*" align="center"/>
40443 <colspec colwidth="6*" align="right"/>
40446 <entry><option>address_retry_include_sender</option></entry>
40447 <entry>Use: <emphasis>smtp</emphasis></entry>
40448 <entry>Type: <emphasis>boolean</emphasis></entry>
40449 <entry>Default: <emphasis>true</emphasis></entry>
40454 <para revisionflag="changed">
40455 <indexterm role="concept">
40456 <primary>4<emphasis>xx</emphasis> responses</primary>
40457 <secondary>retrying after</secondary>
40459 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
40460 is the combination of sender and recipient that is delayed in subsequent queue
40461 runs until the retry time is reached. You can delay the recipient without
40462 reference to the sender (which is what earlier versions of Exim did), by
40463 setting <option>address_retry_include_sender</option> false. However, this can lead to
40464 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
40467 <indexterm role="option">
40468 <primary><option>allow_localhost</option></primary>
40471 <informaltable frame="all">
40472 <tgroup cols="4" colsep="0" rowsep="0">
40473 <colspec colwidth="8*" align="left"/>
40474 <colspec colwidth="5*" align="center"/>
40475 <colspec colwidth="5*" align="center"/>
40476 <colspec colwidth="6*" align="right"/>
40479 <entry><option>allow_localhost</option></entry>
40480 <entry>Use: <emphasis>smtp</emphasis></entry>
40481 <entry>Type: <emphasis>boolean</emphasis></entry>
40482 <entry>Default: <emphasis>false</emphasis></entry>
40488 <indexterm role="concept">
40489 <primary>local host</primary>
40490 <secondary>sending to</secondary>
40492 <indexterm role="concept">
40493 <primary>fallback</primary>
40494 <secondary>hosts specified on transport</secondary>
40496 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
40497 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
40498 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
40499 the delivery anyway. This should be used only in special cases when the
40500 configuration ensures that no looping will result (for example, a differently
40501 configured Exim is listening on the port to which the message is sent).
40504 <indexterm role="option">
40505 <primary><option>authenticated_sender</option></primary>
40508 <informaltable frame="all">
40509 <tgroup cols="4" colsep="0" rowsep="0">
40510 <colspec colwidth="8*" align="left"/>
40511 <colspec colwidth="5*" align="center"/>
40512 <colspec colwidth="5*" align="center"/>
40513 <colspec colwidth="6*" align="right"/>
40516 <entry><option>authenticated_sender</option></entry>
40517 <entry>Use: <emphasis>smtp</emphasis></entry>
40518 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40519 <entry>Default: <emphasis>unset</emphasis></entry>
40525 <indexterm role="concept">
40526 <primary>Cyrus</primary>
40528 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
40529 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
40530 overriding any existing authenticated sender value. If the string expansion is
40531 forced to fail, the option is ignored. Other expansion failures cause delivery
40532 to be deferred. If the result of expansion is an empty string, that is also
40536 If the SMTP session is not authenticated, the expansion of
40537 <option>authenticated_sender</option> still happens (and can cause the delivery to be
40538 deferred if it fails), but no AUTH= item is added to MAIL commands
40539 unless <option>authenticated_sender_force</option> is true.
40542 This option allows you to use the <command>smtp</command> transport in LMTP mode to
40543 deliver mail to Cyrus IMAP and provide the proper local part as the
40544 <quote>authenticated sender</quote>, via a setting such as:
40546 <literallayout class="monospaced">
40547 authenticated_sender = $local_part
40550 This removes the need for IMAP subfolders to be assigned special ACLs to
40551 allow direct delivery to those subfolders.
40554 Because of expected uses such as that just described for Cyrus (when no
40555 domain is involved), there is no checking on the syntax of the provided
40559 <indexterm role="option">
40560 <primary><option>authenticated_sender_force</option></primary>
40563 <informaltable frame="all">
40564 <tgroup cols="4" colsep="0" rowsep="0">
40565 <colspec colwidth="8*" align="left"/>
40566 <colspec colwidth="5*" align="center"/>
40567 <colspec colwidth="5*" align="center"/>
40568 <colspec colwidth="6*" align="right"/>
40571 <entry><option>authenticated_sender_force</option></entry>
40572 <entry>Use: <emphasis>smtp</emphasis></entry>
40573 <entry>Type: <emphasis>boolean</emphasis></entry>
40574 <entry>Default: <emphasis>false</emphasis></entry>
40580 If this option is set true, the <option>authenticated_sender</option> option’s value
40581 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
40582 authenticated as a client.
40585 <indexterm role="option">
40586 <primary><option>command_timeout</option></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>command_timeout</option></entry>
40598 <entry>Use: <emphasis>smtp</emphasis></entry>
40599 <entry>Type: <emphasis>time</emphasis></entry>
40600 <entry>Default: <emphasis>5m</emphasis></entry>
40606 This sets a timeout for receiving a response to an SMTP command that has been
40607 sent out. It is also used when waiting for the initial banner line from the
40608 remote host. Its value must not be zero.
40611 <indexterm role="option">
40612 <primary><option>connect_timeout</option></primary>
40615 <informaltable frame="all">
40616 <tgroup cols="4" colsep="0" rowsep="0">
40617 <colspec colwidth="8*" align="left"/>
40618 <colspec colwidth="5*" align="center"/>
40619 <colspec colwidth="5*" align="center"/>
40620 <colspec colwidth="6*" align="right"/>
40623 <entry><option>connect_timeout</option></entry>
40624 <entry>Use: <emphasis>smtp</emphasis></entry>
40625 <entry>Type: <emphasis>time</emphasis></entry>
40626 <entry>Default: <emphasis>5m</emphasis></entry>
40632 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
40633 to a remote host. A setting of zero allows the system timeout (typically
40634 several minutes) to act. To have any effect, the value of this option must be
40635 less than the system timeout. However, it has been observed that on some
40636 systems there is no system timeout, which is why the default value for this
40637 option is 5 minutes, a value recommended by RFC 1123.
40640 <indexterm role="option">
40641 <primary><option>connection_max_messages</option></primary>
40644 <informaltable frame="all">
40645 <tgroup cols="4" colsep="0" rowsep="0">
40646 <colspec colwidth="8*" align="left"/>
40647 <colspec colwidth="5*" align="center"/>
40648 <colspec colwidth="5*" align="center"/>
40649 <colspec colwidth="6*" align="right"/>
40652 <entry><option>connection_max_messages</option></entry>
40653 <entry>Use: <emphasis>smtp</emphasis></entry>
40654 <entry>Type: <emphasis>integer</emphasis></entry>
40655 <entry>Default: <emphasis>500</emphasis></entry>
40661 <indexterm role="concept">
40662 <primary>SMTP</primary>
40663 <secondary>passed connection</secondary>
40665 <indexterm role="concept">
40666 <primary>SMTP</primary>
40667 <secondary>multiple deliveries</secondary>
40669 <indexterm role="concept">
40670 <primary>multiple SMTP deliveries</primary>
40672 This controls the maximum number of separate message deliveries that are sent
40673 over a single TCP/IP connection. If the value is zero, there is no limit.
40674 For testing purposes, this value can be overridden by the <option>-oB</option> command line
40678 <indexterm role="option">
40679 <primary><option>data_timeout</option></primary>
40682 <informaltable frame="all">
40683 <tgroup cols="4" colsep="0" rowsep="0">
40684 <colspec colwidth="8*" align="left"/>
40685 <colspec colwidth="5*" align="center"/>
40686 <colspec colwidth="5*" align="center"/>
40687 <colspec colwidth="6*" align="right"/>
40690 <entry><option>data_timeout</option></entry>
40691 <entry>Use: <emphasis>smtp</emphasis></entry>
40692 <entry>Type: <emphasis>time</emphasis></entry>
40693 <entry>Default: <emphasis>5m</emphasis></entry>
40699 This sets a timeout for the transmission of each block in the data portion of
40700 the message. As a result, the overall timeout for a message depends on the size
40701 of the message. Its value must not be zero. See also <option>final_timeout</option>.
40704 <indexterm role="option">
40705 <primary><option>delay_after_cutoff</option></primary>
40708 <informaltable frame="all">
40709 <tgroup cols="4" colsep="0" rowsep="0">
40710 <colspec colwidth="8*" align="left"/>
40711 <colspec colwidth="5*" align="center"/>
40712 <colspec colwidth="5*" align="center"/>
40713 <colspec colwidth="6*" align="right"/>
40716 <entry><option>delay_after_cutoff</option></entry>
40717 <entry>Use: <emphasis>smtp</emphasis></entry>
40718 <entry>Type: <emphasis>boolean</emphasis></entry>
40719 <entry>Default: <emphasis>true</emphasis></entry>
40725 This option controls what happens when all remote IP addresses for a given
40726 domain have been inaccessible for so long that they have passed their retry
40730 In the default state, if the next retry time has not been reached for any of
40731 them, the address is bounced without trying any deliveries. In other words,
40732 Exim delays retrying an IP address after the final cutoff time until a new
40733 retry time is reached, and can therefore bounce an address without ever trying
40734 a delivery, when machines have been down for a long time. Some people are
40735 unhappy at this prospect, so...
40738 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
40739 addresses are past their final cutoff time, Exim tries to deliver to those
40740 IP addresses that have not been tried since the message arrived. If there are
40741 none, of if they all fail, the address is bounced. In other words, it does not
40742 delay when a new message arrives, but immediately tries those expired IP
40743 addresses that haven’t been tried since the message arrived. If there is a
40744 continuous stream of messages for the dead hosts, unsetting
40745 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
40749 <indexterm role="option">
40750 <primary><option>dns_qualify_single</option></primary>
40753 <informaltable frame="all">
40754 <tgroup cols="4" colsep="0" rowsep="0">
40755 <colspec colwidth="8*" align="left"/>
40756 <colspec colwidth="5*" align="center"/>
40757 <colspec colwidth="5*" align="center"/>
40758 <colspec colwidth="6*" align="right"/>
40761 <entry><option>dns_qualify_single</option></entry>
40762 <entry>Use: <emphasis>smtp</emphasis></entry>
40763 <entry>Type: <emphasis>boolean</emphasis></entry>
40764 <entry>Default: <emphasis>true</emphasis></entry>
40770 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
40771 and the <option>gethostbyname</option> option is false,
40772 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
40773 in chapter <xref linkend="CHAPdnslookup"/> for more details.
40776 <indexterm role="option">
40777 <primary><option>dns_search_parents</option></primary>
40780 <informaltable frame="all">
40781 <tgroup cols="4" colsep="0" rowsep="0">
40782 <colspec colwidth="8*" align="left"/>
40783 <colspec colwidth="5*" align="center"/>
40784 <colspec colwidth="5*" align="center"/>
40785 <colspec colwidth="6*" align="right"/>
40788 <entry><option>dns_search_parents</option></entry>
40789 <entry>Use: <emphasis>smtp</emphasis></entry>
40790 <entry>Type: <emphasis>boolean</emphasis></entry>
40791 <entry>Default: <emphasis>false</emphasis></entry>
40797 <indexterm role="concept">
40798 <primary><option>search_parents</option></primary>
40800 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
40801 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
40802 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
40806 <indexterm role="option">
40807 <primary><option>fallback_hosts</option></primary>
40810 <informaltable frame="all">
40811 <tgroup cols="4" colsep="0" rowsep="0">
40812 <colspec colwidth="8*" align="left"/>
40813 <colspec colwidth="5*" align="center"/>
40814 <colspec colwidth="5*" align="center"/>
40815 <colspec colwidth="6*" align="right"/>
40818 <entry><option>fallback_hosts</option></entry>
40819 <entry>Use: <emphasis>smtp</emphasis></entry>
40820 <entry>Type: <emphasis>string list</emphasis></entry>
40821 <entry>Default: <emphasis>unset</emphasis></entry>
40827 <indexterm role="concept">
40828 <primary>fallback</primary>
40829 <secondary>hosts specified on transport</secondary>
40831 String expansion is not applied to this option. The argument must be a
40832 colon-separated list of host names or IP addresses, optionally also including
40833 port numbers, though the separator can be changed, as described in section
40834 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
40835 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
40836 in section <xref linkend="SECTformatonehostitem"/>.
40839 Fallback hosts can also be specified on routers, which associate them with the
40840 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
40841 <option>fallback_hosts</option> specified on the transport is used only if the address does
40842 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
40843 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
40844 However, <option>hosts_randomize</option> does apply to fallback host lists.
40847 If Exim is unable to deliver to any of the hosts for a particular address, and
40848 the errors are not permanent rejections, the address is put on a separate
40849 transport queue with its host list replaced by the fallback hosts, unless the
40850 address was routed via MX records and the current host was in the original MX
40851 list. In that situation, the fallback host list is not used.
40854 Once normal deliveries are complete, the fallback queue is delivered by
40855 re-running the same transports with the new host lists. If several failing
40856 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
40857 copy of the message is sent.
40860 The resolution of the host names on the fallback list is controlled by the
40861 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
40862 both to cases when the host list comes with the address and when it is taken
40863 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
40864 fails</quote> facility.
40867 <indexterm role="option">
40868 <primary><option>final_timeout</option></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>final_timeout</option></entry>
40880 <entry>Use: <emphasis>smtp</emphasis></entry>
40881 <entry>Type: <emphasis>time</emphasis></entry>
40882 <entry>Default: <emphasis>10m</emphasis></entry>
40888 This is the timeout that applies while waiting for the response to the final
40889 line containing just <quote>.</quote> that terminates a message. Its value must not be
40893 <indexterm role="option">
40894 <primary><option>gethostbyname</option></primary>
40897 <informaltable frame="all">
40898 <tgroup cols="4" colsep="0" rowsep="0">
40899 <colspec colwidth="8*" align="left"/>
40900 <colspec colwidth="5*" align="center"/>
40901 <colspec colwidth="5*" align="center"/>
40902 <colspec colwidth="6*" align="right"/>
40905 <entry><option>gethostbyname</option></entry>
40906 <entry>Use: <emphasis>smtp</emphasis></entry>
40907 <entry>Type: <emphasis>boolean</emphasis></entry>
40908 <entry>Default: <emphasis>false</emphasis></entry>
40914 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
40915 being used, names are looked up using <function>gethostbyname()</function>
40916 (or <function>getipnodebyname()</function> when available)
40917 instead of using the DNS. Of course, that function may in fact use the DNS, but
40918 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
40921 <indexterm role="option">
40922 <primary><option>helo_data</option></primary>
40925 <informaltable frame="all">
40926 <tgroup cols="4" colsep="0" rowsep="0">
40927 <colspec colwidth="8*" align="left"/>
40928 <colspec colwidth="5*" align="center"/>
40929 <colspec colwidth="5*" align="center"/>
40930 <colspec colwidth="6*" align="right"/>
40933 <entry><option>helo_data</option></entry>
40934 <entry>Use: <emphasis>smtp</emphasis></entry>
40935 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40936 <entry>Default: <emphasis><literal>$primary_hostname</literal></emphasis></entry>
40942 <indexterm role="concept">
40943 <primary>HELO argument</primary>
40944 <secondary>setting</secondary>
40946 <indexterm role="concept">
40947 <primary>EHLO argument</primary>
40948 <secondary>setting</secondary>
40950 <indexterm role="concept">
40951 <primary>LHLO argument</primary>
40952 <secondary>setting</secondary>
40954 The value of this option is expanded, and used as the argument for the EHLO,
40955 HELO, or LHLO command that starts the outgoing SMTP or LMTP session. The
40956 variables <varname>$host</varname> and <varname>$host_address</varname> are set to the identity of the remote
40957 host, and can be used to generate different values for different servers.
40960 <indexterm role="option">
40961 <primary><option>hosts</option></primary>
40964 <informaltable frame="all">
40965 <tgroup cols="4" colsep="0" rowsep="0">
40966 <colspec colwidth="8*" align="left"/>
40967 <colspec colwidth="5*" align="center"/>
40968 <colspec colwidth="5*" align="center"/>
40969 <colspec colwidth="6*" align="right"/>
40972 <entry><option>hosts</option></entry>
40973 <entry>Use: <emphasis>smtp</emphasis></entry>
40974 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
40975 <entry>Default: <emphasis>unset</emphasis></entry>
40981 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
40982 finds the hosts by looking up the address domain in the DNS, or by
40983 <command>manualroute</command>, which has lists of hosts in its configuration. However,
40984 email addresses can be passed to the <command>smtp</command> transport by any router, and not
40985 all of them can provide an associated list of hosts.
40988 The <option>hosts</option> option specifies a list of hosts to be used if the address being
40989 processed does not have any hosts associated with it. The hosts specified by
40990 <option>hosts</option> are also used, whether or not the address has its own hosts, if
40991 <option>hosts_override</option> is set.
40994 The string is first expanded, before being interpreted as a colon-separated
40995 list of host names or IP addresses, possibly including port numbers. The
40996 separator may be changed to something other than colon, as described in section
40997 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
40998 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
40999 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
41000 of the <command>manualroute</command> router is not available here.
41003 If the expansion fails, delivery is deferred. Unless the failure was caused by
41004 the inability to complete a lookup, the error is logged to the panic log as
41005 well as the main log. Host names are looked up either by searching directly for
41006 address records in the DNS or by calling <function>gethostbyname()</function> (or
41007 <function>getipnodebyname()</function> when available), depending on the setting of the
41008 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
41009 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
41013 During delivery, the hosts are tried in order, subject to their retry status,
41014 unless <option>hosts_randomize</option> is set.
41017 <indexterm role="option">
41018 <primary><option>hosts_avoid_esmtp</option></primary>
41021 <informaltable frame="all">
41022 <tgroup cols="4" colsep="0" rowsep="0">
41023 <colspec colwidth="8*" align="left"/>
41024 <colspec colwidth="5*" align="center"/>
41025 <colspec colwidth="5*" align="center"/>
41026 <colspec colwidth="6*" align="right"/>
41029 <entry><option>hosts_avoid_esmtp</option></entry>
41030 <entry>Use: <emphasis>smtp</emphasis></entry>
41031 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
41032 <entry>Default: <emphasis>unset</emphasis></entry>
41038 <indexterm role="concept">
41039 <primary>ESMTP</primary>
41040 <secondary>avoiding use of</secondary>
41042 <indexterm role="concept">
41043 <primary>HELO</primary>
41044 <secondary>forcing use of</secondary>
41046 <indexterm role="concept">
41047 <primary>EHLO</primary>
41048 <secondary>avoiding use of</secondary>
41050 <indexterm role="concept">
41051 <primary>PIPELINING</primary>
41052 <secondary>avoiding the use of</secondary>
41054 This option is for use with broken hosts that announce ESMTP facilities (for
41055 example, PIPELINING) and then fail to implement them properly. When a host
41056 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
41057 start of the SMTP session. This means that it cannot use any of the ESMTP
41058 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
41061 <indexterm role="option">
41062 <primary><option>hosts_avoid_tls</option></primary>
41065 <informaltable frame="all">
41066 <tgroup cols="4" colsep="0" rowsep="0">
41067 <colspec colwidth="8*" align="left"/>
41068 <colspec colwidth="5*" align="center"/>
41069 <colspec colwidth="5*" align="center"/>
41070 <colspec colwidth="6*" align="right"/>
41073 <entry><option>hosts_avoid_tls</option></entry>
41074 <entry>Use: <emphasis>smtp</emphasis></entry>
41075 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
41076 <entry>Default: <emphasis>unset</emphasis></entry>
41082 <indexterm role="concept">
41083 <primary>TLS</primary>
41084 <secondary>avoiding for certain hosts</secondary>
41086 Exim will not try to start a TLS session when delivering to any host that
41087 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
41090 <indexterm role="option">
41091 <primary><option>hosts_max_try</option></primary>
41094 <informaltable frame="all">
41095 <tgroup cols="4" colsep="0" rowsep="0">
41096 <colspec colwidth="8*" align="left"/>
41097 <colspec colwidth="5*" align="center"/>
41098 <colspec colwidth="5*" align="center"/>
41099 <colspec colwidth="6*" align="right"/>
41102 <entry><option>hosts_max_try</option></entry>
41103 <entry>Use: <emphasis>smtp</emphasis></entry>
41104 <entry>Type: <emphasis>integer</emphasis></entry>
41105 <entry>Default: <emphasis>5</emphasis></entry>
41111 <indexterm role="concept">
41112 <primary>host</primary>
41113 <secondary>maximum number to try</secondary>
41115 <indexterm role="concept">
41116 <primary>limit</primary>
41117 <secondary>number of hosts tried</secondary>
41119 <indexterm role="concept">
41120 <primary>limit</primary>
41121 <secondary>number of MX tried</secondary>
41123 <indexterm role="concept">
41124 <primary>MX record</primary>
41125 <secondary>maximum tried</secondary>
41127 This option limits the number of IP addresses that are tried for any one
41128 delivery in cases where there are temporary delivery errors. Section
41129 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
41132 <indexterm role="option">
41133 <primary><option>hosts_max_try_hardlimit</option></primary>
41136 <informaltable frame="all">
41137 <tgroup cols="4" colsep="0" rowsep="0">
41138 <colspec colwidth="8*" align="left"/>
41139 <colspec colwidth="5*" align="center"/>
41140 <colspec colwidth="5*" align="center"/>
41141 <colspec colwidth="6*" align="right"/>
41144 <entry><option>hosts_max_try_hardlimit</option></entry>
41145 <entry>Use: <emphasis>smtp</emphasis></entry>
41146 <entry>Type: <emphasis>integer</emphasis></entry>
41147 <entry>Default: <emphasis>50</emphasis></entry>
41153 This is an additional check on the maximum number of IP addresses that Exim
41154 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
41158 <indexterm role="option">
41159 <primary><option>hosts_nopass_tls</option></primary>
41162 <informaltable frame="all">
41163 <tgroup cols="4" colsep="0" rowsep="0">
41164 <colspec colwidth="8*" align="left"/>
41165 <colspec colwidth="5*" align="center"/>
41166 <colspec colwidth="5*" align="center"/>
41167 <colspec colwidth="6*" align="right"/>
41170 <entry><option>hosts_nopass_tls</option></entry>
41171 <entry>Use: <emphasis>smtp</emphasis></entry>
41172 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
41173 <entry>Default: <emphasis>unset</emphasis></entry>
41179 <indexterm role="concept">
41180 <primary>TLS</primary>
41181 <secondary>passing connection</secondary>
41183 <indexterm role="concept">
41184 <primary>multiple SMTP deliveries</primary>
41186 <indexterm role="concept">
41187 <primary>TLS</primary>
41188 <secondary>multiple message deliveries</secondary>
41190 For any host that matches this list, a connection on which a TLS session has
41191 been started will not be passed to a new delivery process for sending another
41192 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
41193 explanation of when this might be needed.
41196 <indexterm role="option">
41197 <primary><option>hosts_override</option></primary>
41200 <informaltable frame="all">
41201 <tgroup cols="4" colsep="0" rowsep="0">
41202 <colspec colwidth="8*" align="left"/>
41203 <colspec colwidth="5*" align="center"/>
41204 <colspec colwidth="5*" align="center"/>
41205 <colspec colwidth="6*" align="right"/>
41208 <entry><option>hosts_override</option></entry>
41209 <entry>Use: <emphasis>smtp</emphasis></entry>
41210 <entry>Type: <emphasis>boolean</emphasis></entry>
41211 <entry>Default: <emphasis>false</emphasis></entry>
41217 If this option is set and the <option>hosts</option> option is also set, any hosts that are
41218 attached to the address are ignored, and instead the hosts specified by the
41219 <option>hosts</option> option are always used. This option does not apply to
41220 <option>fallback_hosts</option>.
41223 <indexterm role="option">
41224 <primary><option>hosts_randomize</option></primary>
41227 <informaltable frame="all">
41228 <tgroup cols="4" colsep="0" rowsep="0">
41229 <colspec colwidth="8*" align="left"/>
41230 <colspec colwidth="5*" align="center"/>
41231 <colspec colwidth="5*" align="center"/>
41232 <colspec colwidth="6*" align="right"/>
41235 <entry><option>hosts_randomize</option></entry>
41236 <entry>Use: <emphasis>smtp</emphasis></entry>
41237 <entry>Type: <emphasis>boolean</emphasis></entry>
41238 <entry>Default: <emphasis>false</emphasis></entry>
41244 <indexterm role="concept">
41245 <primary>randomized host list</primary>
41247 <indexterm role="concept">
41248 <primary>host</primary>
41249 <secondary>list of; randomized</secondary>
41251 <indexterm role="concept">
41252 <primary>fallback</primary>
41253 <secondary>randomized hosts</secondary>
41255 If this option is set, and either the list of hosts is taken from the
41256 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
41257 were not obtained from MX records (this includes fallback hosts from the
41258 router), and were not randomizied by the router, the order of trying the hosts
41259 is randomized each time the transport runs. Randomizing the order of a host
41260 list can be used to do crude load sharing.
41263 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
41264 order is separately randomized. This makes it possible to set up MX-like
41265 behaviour. The boundaries between groups are indicated by an item that is just
41266 <literal>+</literal> in the host list. For example:
41268 <literallayout class="monospaced">
41269 hosts = host1:host2:host3:+:host4:host5
41272 The order of the first three hosts and the order of the last two hosts is
41273 randomized for each use, but the first three always end up before the last two.
41274 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
41277 <indexterm role="option">
41278 <primary><option>hosts_require_auth</option></primary>
41281 <informaltable frame="all">
41282 <tgroup cols="4" colsep="0" rowsep="0">
41283 <colspec colwidth="8*" align="left"/>
41284 <colspec colwidth="5*" align="center"/>
41285 <colspec colwidth="5*" align="center"/>
41286 <colspec colwidth="6*" align="right"/>
41289 <entry><option>hosts_require_auth</option></entry>
41290 <entry>Use: <emphasis>smtp</emphasis></entry>
41291 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
41292 <entry>Default: <emphasis>unset</emphasis></entry>
41298 <indexterm role="concept">
41299 <primary>authentication</primary>
41300 <secondary>required by client</secondary>
41302 This option provides a list of servers for which authentication must succeed
41303 before Exim will try to transfer a message. If authentication fails for
41304 servers which are not in this list, Exim tries to send unauthenticated. If
41305 authentication fails for one of these servers, delivery is deferred. This
41306 temporary error is detectable in the retry rules, so it can be turned into a
41307 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
41308 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
41311 <indexterm role="option">
41312 <primary><option>hosts_require_tls</option></primary>
41315 <informaltable frame="all">
41316 <tgroup cols="4" colsep="0" rowsep="0">
41317 <colspec colwidth="8*" align="left"/>
41318 <colspec colwidth="5*" align="center"/>
41319 <colspec colwidth="5*" align="center"/>
41320 <colspec colwidth="6*" align="right"/>
41323 <entry><option>hosts_require_tls</option></entry>
41324 <entry>Use: <emphasis>smtp</emphasis></entry>
41325 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
41326 <entry>Default: <emphasis>unset</emphasis></entry>
41332 <indexterm role="concept">
41333 <primary>TLS</primary>
41334 <secondary>requiring for certain servers</secondary>
41336 Exim will insist on using a TLS session when delivering to any host that
41337 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
41338 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
41339 incoming messages, use an appropriate ACL.
41342 <indexterm role="option">
41343 <primary><option>hosts_try_auth</option></primary>
41346 <informaltable frame="all">
41347 <tgroup cols="4" colsep="0" rowsep="0">
41348 <colspec colwidth="8*" align="left"/>
41349 <colspec colwidth="5*" align="center"/>
41350 <colspec colwidth="5*" align="center"/>
41351 <colspec colwidth="6*" align="right"/>
41354 <entry><option>hosts_try_auth</option></entry>
41355 <entry>Use: <emphasis>smtp</emphasis></entry>
41356 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
41357 <entry>Default: <emphasis>unset</emphasis></entry>
41363 <indexterm role="concept">
41364 <primary>authentication</primary>
41365 <secondary>optional in client</secondary>
41367 This option provides a list of servers to which, provided they announce
41368 authentication support, Exim will attempt to authenticate as a client when it
41369 connects. If authentication fails, Exim will try to transfer the message
41370 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
41371 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
41374 <indexterm role="option">
41375 <primary><option>interface</option></primary>
41378 <informaltable frame="all">
41379 <tgroup cols="4" colsep="0" rowsep="0">
41380 <colspec colwidth="8*" align="left"/>
41381 <colspec colwidth="5*" align="center"/>
41382 <colspec colwidth="5*" align="center"/>
41383 <colspec colwidth="6*" align="right"/>
41386 <entry><option>interface</option></entry>
41387 <entry>Use: <emphasis>smtp</emphasis></entry>
41388 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
41389 <entry>Default: <emphasis>unset</emphasis></entry>
41394 <para revisionflag="changed">
41395 <indexterm role="concept">
41396 <primary>bind IP address</primary>
41398 <indexterm role="concept">
41399 <primary>IP address</primary>
41400 <secondary>binding</secondary>
41402 <indexterm role="concept">
41403 <primary><varname>$host</varname></primary>
41405 <indexterm role="concept">
41406 <primary><varname>$host_address</varname></primary>
41408 This option specifies which interface to bind to when making an outgoing SMTP
41409 call. <emphasis role="bold">Note:</emphasis> Do not confuse this with the interface address that was used
41410 when a message was received, which is in <varname>$received_ip_address</varname>, formerly
41411 known as <varname>$interface_address</varname>. The name was changed to minimize confusion with
41412 the outgoing interface address. There is no variable that contains an outgoing
41413 interface address because, unless it is set by this option, its value is
41417 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
41418 <varname>$host_address</varname> refer to the host to which a connection is about to be made
41419 during the expansion of the string. Forced expansion failure, or an empty
41420 string result causes the option to be ignored. Otherwise, after expansion, the
41421 string must be a list of IP addresses, colon-separated by default, but the
41422 separator can be changed in the usual way. For example:
41424 <literallayout class="monospaced">
41425 interface = <; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
41428 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
41429 connection. If none of them are the correct type, the option is ignored. If
41430 <option>interface</option> is not set, or is ignored, the system’s IP functions choose which
41431 interface to use if the host has more than one.
41434 <indexterm role="option">
41435 <primary><option>keepalive</option></primary>
41438 <informaltable frame="all">
41439 <tgroup cols="4" colsep="0" rowsep="0">
41440 <colspec colwidth="8*" align="left"/>
41441 <colspec colwidth="5*" align="center"/>
41442 <colspec colwidth="5*" align="center"/>
41443 <colspec colwidth="6*" align="right"/>
41446 <entry><option>keepalive</option></entry>
41447 <entry>Use: <emphasis>smtp</emphasis></entry>
41448 <entry>Type: <emphasis>boolean</emphasis></entry>
41449 <entry>Default: <emphasis>true</emphasis></entry>
41455 <indexterm role="concept">
41456 <primary>keepalive</primary>
41457 <secondary>on outgoing connection</secondary>
41459 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
41460 connections. When set, it causes the kernel to probe idle connections
41461 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
41462 of the connection should send a acknowledgement if the connection is still okay
41463 or a reset if the connection has been aborted. The reason for doing this is
41464 that it has the beneficial effect of freeing up certain types of connection
41465 that can get stuck when the remote host is disconnected without tidying up the
41466 TCP/IP call properly. The keepalive mechanism takes several hours to detect
41470 <indexterm role="option">
41471 <primary><option>lmtp_ignore_quota</option></primary>
41474 <informaltable frame="all">
41475 <tgroup cols="4" colsep="0" rowsep="0">
41476 <colspec colwidth="8*" align="left"/>
41477 <colspec colwidth="5*" align="center"/>
41478 <colspec colwidth="5*" align="center"/>
41479 <colspec colwidth="6*" align="right"/>
41482 <entry><option>lmtp_ignore_quota</option></entry>
41483 <entry>Use: <emphasis>smtp</emphasis></entry>
41484 <entry>Type: <emphasis>boolean</emphasis></entry>
41485 <entry>Default: <emphasis>false</emphasis></entry>
41491 <indexterm role="concept">
41492 <primary>LMTP</primary>
41493 <secondary>ignoring quota errors</secondary>
41495 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
41496 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
41497 has advertised support for IGNOREQUOTA in its response to the LHLO command.
41500 <indexterm role="option">
41501 <primary><option>max_rcpt</option></primary>
41504 <informaltable frame="all">
41505 <tgroup cols="4" colsep="0" rowsep="0">
41506 <colspec colwidth="8*" align="left"/>
41507 <colspec colwidth="5*" align="center"/>
41508 <colspec colwidth="5*" align="center"/>
41509 <colspec colwidth="6*" align="right"/>
41512 <entry><option>max_rcpt</option></entry>
41513 <entry>Use: <emphasis>smtp</emphasis></entry>
41514 <entry>Type: <emphasis>integer</emphasis></entry>
41515 <entry>Default: <emphasis>100</emphasis></entry>
41521 <indexterm role="concept">
41522 <primary>RCPT</primary>
41523 <secondary>maximum number of outgoing</secondary>
41525 This option limits the number of RCPT commands that are sent in a single
41526 SMTP message transaction. Each set of addresses is treated independently, and
41527 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
41531 <indexterm role="option">
41532 <primary><option>multi_domain</option></primary>
41535 <informaltable frame="all">
41536 <tgroup cols="4" colsep="0" rowsep="0">
41537 <colspec colwidth="8*" align="left"/>
41538 <colspec colwidth="5*" align="center"/>
41539 <colspec colwidth="5*" align="center"/>
41540 <colspec colwidth="6*" align="right"/>
41543 <entry><option>multi_domain</option></entry>
41544 <entry>Use: <emphasis>smtp</emphasis></entry>
41545 <entry>Type: <emphasis>boolean</emphasis></entry>
41546 <entry>Default: <emphasis>true</emphasis></entry>
41552 <indexterm role="concept">
41553 <primary><varname>$domain</varname></primary>
41555 When this option is set, the <command>smtp</command> transport can handle a number of
41556 addresses containing a mixture of different domains provided they all resolve
41557 to the same list of hosts. Turning the option off restricts the transport to
41558 handling only one domain at a time. This is useful if you want to use
41559 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
41560 is a single domain involved in a remote delivery.
41563 <indexterm role="option">
41564 <primary><option>port</option></primary>
41567 <informaltable frame="all">
41568 <tgroup cols="4" colsep="0" rowsep="0">
41569 <colspec colwidth="8*" align="left"/>
41570 <colspec colwidth="5*" align="center"/>
41571 <colspec colwidth="5*" align="center"/>
41572 <colspec colwidth="6*" align="right"/>
41575 <entry><option>port</option></entry>
41576 <entry>Use: <emphasis>smtp</emphasis></entry>
41577 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
41578 <entry>Default: <emphasis>see below</emphasis></entry>
41583 <para revisionflag="changed">
41584 <indexterm role="concept">
41585 <primary>port</primary>
41586 <secondary>sending TCP/IP</secondary>
41588 <indexterm role="concept">
41589 <primary>TCP/IP</primary>
41590 <secondary>setting outgoing port</secondary>
41592 This option specifies the TCP/IP port on the server to which Exim connects.
41593 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
41594 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
41595 The name was changed to minimize confusion with the outgoing port. There is no
41596 variable that contains an outgoing port.
41599 If the value of this option begins with a digit it is taken as a port number;
41600 otherwise it is looked up using <function>getservbyname()</function>. The default value is
41601 normally <quote>smtp</quote>, but if <option>protocol</option> is set to <quote>lmtp</quote>, the default is
41602 <quote>lmtp</quote>. If the expansion fails, or if a port number cannot be found, delivery
41606 <indexterm role="option">
41607 <primary><option>protocol</option></primary>
41610 <informaltable frame="all">
41611 <tgroup cols="4" colsep="0" rowsep="0">
41612 <colspec colwidth="8*" align="left"/>
41613 <colspec colwidth="5*" align="center"/>
41614 <colspec colwidth="5*" align="center"/>
41615 <colspec colwidth="6*" align="right"/>
41618 <entry><option>protocol</option></entry>
41619 <entry>Use: <emphasis>smtp</emphasis></entry>
41620 <entry>Type: <emphasis>string</emphasis></entry>
41621 <entry>Default: <emphasis>smtp</emphasis></entry>
41627 <indexterm role="concept">
41628 <primary>LMTP</primary>
41629 <secondary>over TCP/IP</secondary>
41631 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
41632 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
41633 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
41634 deliveries into closed message stores. Exim also has support for running LMTP
41635 over a pipe to a local process – see chapter <xref linkend="CHAPLMTP"/>.
41638 <indexterm role="option">
41639 <primary><option>retry_include_ip_address</option></primary>
41642 <informaltable frame="all">
41643 <tgroup cols="4" colsep="0" rowsep="0">
41644 <colspec colwidth="8*" align="left"/>
41645 <colspec colwidth="5*" align="center"/>
41646 <colspec colwidth="5*" align="center"/>
41647 <colspec colwidth="6*" align="right"/>
41650 <entry><option>retry_include_ip_address</option></entry>
41651 <entry>Use: <emphasis>smtp</emphasis></entry>
41652 <entry>Type: <emphasis>boolean</emphasis></entry>
41653 <entry>Default: <emphasis>true</emphasis></entry>
41659 Exim normally includes both the host name and the IP address in the key it
41660 constructs for indexing retry data after a temporary delivery failure. This
41661 means that when one of several IP addresses for a host is failing, it gets
41662 tried periodically (controlled by the retry rules), but use of the other IP
41663 addresses is not affected.
41666 However, in some dialup environments hosts are assigned a different IP address
41667 each time they connect. In this situation the use of the IP address as part of
41668 the retry key leads to undesirable behaviour. Setting this option false causes
41669 Exim to use only the host name. This should normally be done on a separate
41670 instance of the <command>smtp</command> transport, set up specially to handle the dialup
41674 <indexterm role="option">
41675 <primary><option>serialize_hosts</option></primary>
41678 <informaltable frame="all">
41679 <tgroup cols="4" colsep="0" rowsep="0">
41680 <colspec colwidth="8*" align="left"/>
41681 <colspec colwidth="5*" align="center"/>
41682 <colspec colwidth="5*" align="center"/>
41683 <colspec colwidth="6*" align="right"/>
41686 <entry><option>serialize_hosts</option></entry>
41687 <entry>Use: <emphasis>smtp</emphasis></entry>
41688 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
41689 <entry>Default: <emphasis>unset</emphasis></entry>
41695 <indexterm role="concept">
41696 <primary>serializing connections</primary>
41698 <indexterm role="concept">
41699 <primary>host</primary>
41700 <secondary>serializing connections</secondary>
41702 Because Exim operates in a distributed manner, if several messages for the same
41703 host arrive at around the same time, more than one simultaneous connection to
41704 the remote host can occur. This is not usually a problem except when there is a
41705 slow link between the hosts. In that situation it may be helpful to restrict
41706 Exim to one connection at a time. This can be done by setting
41707 <option>serialize_hosts</option> to match the relevant hosts.
41710 <indexterm role="concept">
41711 <primary>hints database</primary>
41712 <secondary>serializing deliveries to a host</secondary>
41714 Exim implements serialization by means of a hints database in which a record is
41715 written whenever a process connects to one of the restricted hosts. The record
41716 is deleted when the connection is completed. Obviously there is scope for
41717 records to get left lying around if there is a system or program crash. To
41718 guard against this, Exim ignores any records that are more than six hours old.
41721 If you set up this kind of serialization, you should also arrange to delete the
41722 relevant hints database whenever your system reboots. The names of the files
41723 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
41724 may be one or two files, depending on the type of DBM in use. The same files
41725 are used for ETRN serialization.
41728 <indexterm role="option">
41729 <primary><option>size_addition</option></primary>
41732 <informaltable frame="all">
41733 <tgroup cols="4" colsep="0" rowsep="0">
41734 <colspec colwidth="8*" align="left"/>
41735 <colspec colwidth="5*" align="center"/>
41736 <colspec colwidth="5*" align="center"/>
41737 <colspec colwidth="6*" align="right"/>
41740 <entry><option>size_addition</option></entry>
41741 <entry>Use: <emphasis>smtp</emphasis></entry>
41742 <entry>Type: <emphasis>integer</emphasis></entry>
41743 <entry>Default: <emphasis>1024</emphasis></entry>
41749 <indexterm role="concept">
41750 <primary>SMTP</primary>
41751 <secondary>SIZE</secondary>
41753 <indexterm role="concept">
41754 <primary>message</primary>
41755 <secondary>size issue for transport filter</secondary>
41757 <indexterm role="concept">
41758 <primary>size</primary>
41759 <secondary>of message</secondary>
41761 <indexterm role="concept">
41762 <primary>transport</primary>
41763 <secondary>filter</secondary>
41765 <indexterm role="concept">
41766 <primary>filter</primary>
41767 <secondary>transport filter</secondary>
41769 If a remote SMTP server indicates that it supports the SIZE option of the
41770 MAIL command, Exim uses this to pass over the message size at the start of
41771 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
41772 sends, to allow for headers and other text that may be added during delivery by
41773 configuration options or in a transport filter. It may be necessary to increase
41774 this if a lot of text is added to messages.
41777 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
41778 the use of the SIZE option altogether.
41781 <indexterm role="option">
41782 <primary><option>tls_certificate</option></primary>
41785 <informaltable frame="all">
41786 <tgroup cols="4" colsep="0" rowsep="0">
41787 <colspec colwidth="8*" align="left"/>
41788 <colspec colwidth="5*" align="center"/>
41789 <colspec colwidth="5*" align="center"/>
41790 <colspec colwidth="6*" align="right"/>
41793 <entry><option>tls_certificate</option></entry>
41794 <entry>Use: <emphasis>smtp</emphasis></entry>
41795 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
41796 <entry>Default: <emphasis>unset</emphasis></entry>
41802 <indexterm role="concept">
41803 <primary>TLS client certificate</primary>
41804 <secondary>location of</secondary>
41806 <indexterm role="concept">
41807 <primary>certificate for client</primary>
41808 <secondary>location of</secondary>
41810 <indexterm role="concept">
41811 <primary><varname>$host</varname></primary>
41813 <indexterm role="concept">
41814 <primary><varname>$host_address</varname></primary>
41816 The value of this option must be the absolute path to a file which contains the
41817 client’s certificate, for possible use when sending a message over an encrypted
41818 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
41819 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
41823 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
41824 certificate when sending messages as a client. The global option of the same
41825 name specifies the certificate for Exim as a server; it is not automatically
41826 assumed that the same certificate should be used when Exim is operating as a
41830 <indexterm role="option">
41831 <primary><option>tls_crl</option></primary>
41834 <informaltable frame="all">
41835 <tgroup cols="4" colsep="0" rowsep="0">
41836 <colspec colwidth="8*" align="left"/>
41837 <colspec colwidth="5*" align="center"/>
41838 <colspec colwidth="5*" align="center"/>
41839 <colspec colwidth="6*" align="right"/>
41842 <entry><option>tls_crl</option></entry>
41843 <entry>Use: <emphasis>smtp</emphasis></entry>
41844 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
41845 <entry>Default: <emphasis>unset</emphasis></entry>
41851 <indexterm role="concept">
41852 <primary>TLS</primary>
41853 <secondary>client certificate revocation list</secondary>
41855 <indexterm role="concept">
41856 <primary>certificate</primary>
41857 <secondary>revocation list for client</secondary>
41859 This option specifies a certificate revocation list. The expanded value must
41860 be the name of a file that contains a CRL in PEM format.
41863 <indexterm role="option">
41864 <primary><option>tls_privatekey</option></primary>
41867 <informaltable frame="all">
41868 <tgroup cols="4" colsep="0" rowsep="0">
41869 <colspec colwidth="8*" align="left"/>
41870 <colspec colwidth="5*" align="center"/>
41871 <colspec colwidth="5*" align="center"/>
41872 <colspec colwidth="6*" align="right"/>
41875 <entry><option>tls_privatekey</option></entry>
41876 <entry>Use: <emphasis>smtp</emphasis></entry>
41877 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
41878 <entry>Default: <emphasis>unset</emphasis></entry>
41884 <indexterm role="concept">
41885 <primary>TLS client private key</primary>
41886 <secondary>location of</secondary>
41888 <indexterm role="concept">
41889 <primary><varname>$host</varname></primary>
41891 <indexterm role="concept">
41892 <primary><varname>$host_address</varname></primary>
41894 The value of this option must be the absolute path to a file which contains the
41895 client’s private key. This is used when sending a message over an encrypted
41896 connection using a client certificate. The values of <varname>$host</varname> and
41897 <varname>$host_address</varname> are set to the name and address of the server during the
41898 expansion. If this option is unset, or the expansion is forced to fail, or the
41899 result is an empty string, the private key is assumed to be in the same file as
41900 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
41903 <indexterm role="option">
41904 <primary><option>tls_require_ciphers</option></primary>
41907 <informaltable frame="all">
41908 <tgroup cols="4" colsep="0" rowsep="0">
41909 <colspec colwidth="8*" align="left"/>
41910 <colspec colwidth="5*" align="center"/>
41911 <colspec colwidth="5*" align="center"/>
41912 <colspec colwidth="6*" align="right"/>
41915 <entry><option>tls_require_ciphers</option></entry>
41916 <entry>Use: <emphasis>smtp</emphasis></entry>
41917 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
41918 <entry>Default: <emphasis>unset</emphasis></entry>
41924 <indexterm role="concept">
41925 <primary>TLS</primary>
41926 <secondary>requiring specific ciphers</secondary>
41928 <indexterm role="concept">
41929 <primary>cipher</primary>
41930 <secondary>requiring specific</secondary>
41932 <indexterm role="concept">
41933 <primary><varname>$host</varname></primary>
41935 <indexterm role="concept">
41936 <primary><varname>$host_address</varname></primary>
41938 The value of this option must be a list of permitted cipher suites, for use
41939 when setting up an outgoing encrypted connection. (There is a global option of
41940 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
41941 <varname>$host_address</varname> are set to the name and address of the server during the
41942 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
41943 is used in different ways by OpenSSL and GnuTLS (see sections
41944 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
41945 ciphers is a preference order.
41948 <indexterm role="option">
41949 <primary><option>tls_tempfail_tryclear</option></primary>
41952 <informaltable frame="all">
41953 <tgroup cols="4" colsep="0" rowsep="0">
41954 <colspec colwidth="8*" align="left"/>
41955 <colspec colwidth="5*" align="center"/>
41956 <colspec colwidth="5*" align="center"/>
41957 <colspec colwidth="6*" align="right"/>
41960 <entry><option>tls_tempfail_tryclear</option></entry>
41961 <entry>Use: <emphasis>smtp</emphasis></entry>
41962 <entry>Type: <emphasis>boolean</emphasis></entry>
41963 <entry>Default: <emphasis>true</emphasis></entry>
41969 <indexterm role="concept">
41970 <primary>4<emphasis>xx</emphasis> responses</primary>
41971 <secondary>to STARTTLS</secondary>
41973 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
41974 setting up a TLS session, this option determines whether or not Exim should try
41975 to deliver the message unencrypted. If it is set false, delivery to the
41976 current host is deferred; if there are other hosts, they are tried. If this
41977 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
41978 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
41979 TLS negotiation fails, Exim closes the current connection (because it is in an
41980 unknown state), opens a new one to the same host, and then tries the delivery
41984 <indexterm role="option">
41985 <primary><option>tls_verify_certificates</option></primary>
41988 <informaltable frame="all">
41989 <tgroup cols="4" colsep="0" rowsep="0">
41990 <colspec colwidth="8*" align="left"/>
41991 <colspec colwidth="5*" align="center"/>
41992 <colspec colwidth="5*" align="center"/>
41993 <colspec colwidth="6*" align="right"/>
41996 <entry><option>tls_verify_certificates</option></entry>
41997 <entry>Use: <emphasis>smtp</emphasis></entry>
41998 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
41999 <entry>Default: <emphasis>unset</emphasis></entry>
42005 <indexterm role="concept">
42006 <primary>TLS</primary>
42007 <secondary>server certificate verification</secondary>
42009 <indexterm role="concept">
42010 <primary>certificate</primary>
42011 <secondary>verification of server</secondary>
42013 <indexterm role="concept">
42014 <primary><varname>$host</varname></primary>
42016 <indexterm role="concept">
42017 <primary><varname>$host_address</varname></primary>
42019 The value of this option must be the absolute path to a file containing
42020 permitted server certificates, for use when setting up an encrypted connection.
42021 Alternatively, if you are using OpenSSL, you can set
42022 <option>tls_verify_certificates</option> to the name of a directory containing certificate
42023 files. This does not work with GnuTLS; the option must be set to the name of a
42024 single file if you are using GnuTLS. The values of <varname>$host</varname> and
42025 <varname>$host_address</varname> are set to the name and address of the server during the
42026 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
42029 <section id="SECTvalhosmax">
42030 <title>How the limits for the number of hosts to try are used</title>
42032 <indexterm role="concept">
42033 <primary>host</primary>
42034 <secondary>maximum number to try</secondary>
42036 <indexterm role="concept">
42037 <primary>limit</primary>
42038 <secondary>hosts; maximum number tried</secondary>
42040 There are two options that are concerned with the number of hosts that are
42041 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
42042 <option>hosts_max_try_hardlimit</option>.
42045 The <option>hosts_max_try</option> option limits the number of hosts that are tried
42046 for a single delivery. However, despite the term <quote>host</quote> in its name, the
42047 option actually applies to each IP address independently. In other words, a
42048 multihomed host is treated as several independent hosts, just as it is for
42052 Many of the larger ISPs have multiple MX records which often point to
42053 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
42054 created as a result of routing one of these domains.
42057 Trying every single IP address on such a long list does not seem sensible; if
42058 several at the top of the list fail, it is reasonable to assume there is some
42059 problem that is likely to affect all of them. Roughly speaking, the value of
42060 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
42061 delivery. However, the logic cannot be quite that simple.
42064 Firstly, IP addresses that are skipped because their retry times have not
42065 arrived do not count, and in addition, addresses that are past their retry
42066 limits are also not counted, even when they are tried. This means that when
42067 some IP addresses are past their retry limits, more than the value of
42068 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
42069 that all IP addresses are considered before timing out an email address (but
42070 see below for an exception).
42073 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
42074 list to see if there is a subsequent host with a different (higher valued) MX.
42075 If there is, that host is considered next, and the current IP address is used
42076 but not counted. This behaviour helps in the case of a domain with a retry rule
42077 that hardly ever delays any hosts, as is now explained:
42080 Consider the case of a long list of hosts with one MX value, and a few with a
42081 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
42082 hosts at the top of the list are tried at first. With the default retry rule,
42083 which specifies increasing retry times, the higher MX hosts are eventually
42084 tried when those at the top of the list are skipped because they have not
42085 reached their retry times.
42088 However, it is common practice to put a fixed short retry time on domains for
42089 large ISPs, on the grounds that their servers are rarely down for very long.
42090 Unfortunately, these are exactly the domains that tend to resolve to long lists
42091 of hosts. The short retry time means that the lowest MX hosts are tried every
42092 time. The attempts may be in a different order because of random sorting, but
42093 without the special MX check, the higher MX hosts would never be tried until
42094 all the lower MX hosts had timed out (which might be several days), because
42095 there are always some lower MX hosts that have reached their retry times. With
42096 the special check, Exim considers at least one IP address from each MX value at
42097 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
42101 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
42102 particular, Exim normally eventually tries all the IP addresses before timing
42103 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
42104 reasonable thing to do. Recently, however, some lunatic DNS configurations have
42105 been set up with hundreds of IP addresses for some domains. It can
42106 take a very long time indeed for an address to time out in these cases.
42109 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
42110 Exim never tries more than this number of IP addresses; if it hits this limit
42111 and they are all timed out, the email address is bounced, even though not all
42112 possible IP addresses have been tried.
42113 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
42114 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
42119 <chapter id="CHAPrewrite">
42120 <title>Address rewriting</title>
42122 <indexterm role="concept" id="IIDaddrew" class="startofrange">
42123 <primary>rewriting</primary>
42124 <secondary>addresses</secondary>
42126 There are some circumstances in which Exim automatically rewrites domains in
42127 addresses. The two most common are when an address is given without a domain
42128 (referred to as an <quote>unqualified address</quote>) or when an address contains an
42129 abbreviated domain that is expanded by DNS lookup.
42132 Unqualified envelope addresses are accepted only for locally submitted
42133 messages, or for messages that are received from hosts matching
42134 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
42135 appropriate. Unqualified addresses in header lines are qualified if they are in
42136 locally submitted messages, or messages from hosts that are permitted to send
42137 unqualified envelope addresses. Otherwise, unqualified addresses in header
42138 lines are neither qualified nor rewritten.
42141 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
42142 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
42143 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
42144 do this. The new RFCs do not contain this suggestion.
42147 <title>Explicitly configured address rewriting</title>
42149 This chapter describes the rewriting rules that can be used in the
42150 main rewrite section of the configuration file, and also in the generic
42151 <option>headers_rewrite</option> option that can be set on any transport.
42154 Some people believe that configured address rewriting is a Mortal Sin.
42155 Others believe that life is not possible without it. Exim provides the
42156 facility; you do not have to use it.
42159 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
42160 configuration file are applied to addresses in incoming messages, both envelope
42161 addresses and addresses in header lines. Each rule specifies the types of
42162 address to which it applies.
42165 Whether or not addresses in header lines are rewritten depends on the origin of
42166 the headers and the type of rewriting. Global rewriting, that is, rewriting
42167 rules from the rewrite section of the configuration file, is applied only to
42168 those headers that were received with the message. Header lines that are added
42169 by ACLs or by a system filter or by individual routers or transports (which
42170 are specific to individual recipient addresses) are not rewritten by the global
42174 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
42175 applies all headers except those added by routers and transports. That is, as
42176 well as the headers that were received with the message, it also applies to
42177 headers that were added by an ACL or a system filter.
42180 In general, rewriting addresses from your own system or domain has some
42181 legitimacy. Rewriting other addresses should be done only with great care and
42182 in special circumstances. The author of Exim believes that rewriting should be
42183 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
42184 Although it can sometimes be used as a routing tool, this is very strongly
42188 There are two commonly encountered circumstances where rewriting is used, as
42189 illustrated by these examples:
42194 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
42195 exchange mail with each other behind a firewall, but there is only a single
42196 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
42197 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
42202 A host rewrites the local parts of its own users so that, for example,
42203 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
42209 <title>When does rewriting happen?</title>
42211 <indexterm role="concept">
42212 <primary>rewriting</primary>
42213 <secondary>timing of</secondary>
42215 <indexterm role="concept">
42216 <primary>access control lists (ACLs)</primary>
42217 <secondary>rewriting addresses in</secondary>
42219 Configured address rewriting can take place at several different stages of a
42220 message’s processing.
42223 <indexterm role="concept">
42224 <primary><varname>$sender_address</varname></primary>
42226 At the start of an ACL for MAIL, the sender address may have been rewritten
42227 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
42228 ordinary rewrite rules have yet been applied. If, however, the sender address
42229 is verified in the ACL, it is rewritten before verification, and remains
42230 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
42231 rewritten address. This also applies if sender verification happens in a
42232 RCPT ACL. Otherwise, when the sender address is not verified, it is
42233 rewritten as soon as a message’s header lines have been received.
42236 <indexterm role="concept">
42237 <primary><varname>$domain</varname></primary>
42239 <indexterm role="concept">
42240 <primary><varname>$local_part</varname></primary>
42242 Similarly, at the start of an ACL for RCPT, the current recipient’s address
42243 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
42244 rewrite rules have yet been applied to it. However, the behaviour is different
42245 from the sender address when a recipient is verified. The address is rewritten
42246 for the verification, but the rewriting is not remembered at this stage. The
42247 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
42248 as they were before (that is, they contain the unrewritten – except for
42249 SMTP-time rewriting – address).
42252 As soon as a message’s header lines have been received, all the envelope
42253 recipient addresses are permanently rewritten, and rewriting is also applied to
42254 the addresses in the header lines (if configured). This happens before adding
42255 any header lines that were specified in MAIL or RCPT ACLs, and
42256 <indexterm role="concept">
42257 <primary><function>local_scan()</function> function</primary>
42258 <secondary>address rewriting; timing of</secondary>
42260 before the DATA ACL and <function>local_scan()</function> functions are run.
42263 When an address is being routed, either for delivery or for verification,
42264 rewriting is applied immediately to child addresses that are generated by
42265 redirection, unless <option>no_rewrite</option> is set on the router.
42268 <indexterm role="concept">
42269 <primary>envelope sender</primary>
42270 <secondary>rewriting at transport time</secondary>
42272 <indexterm role="concept">
42273 <primary>rewriting</primary>
42274 <secondary>at transport time</secondary>
42276 <indexterm role="concept">
42277 <primary>header lines</primary>
42278 <secondary>rewriting at transport time</secondary>
42280 At transport time, additional rewriting of addresses in header lines can be
42281 specified by setting the generic <option>headers_rewrite</option> option on a transport.
42282 This option contains rules that are identical in form to those in the rewrite
42283 section of the configuration file. They are applied to the original message
42284 header lines and any that were added by ACLs or a system filter. They are not
42285 applied to header lines that are added by routers or the transport.
42288 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
42289 transport option. However, it is not possible to rewrite envelope recipients at
42294 <title>Testing the rewriting rules that apply on input</title>
42296 <indexterm role="concept">
42297 <primary>rewriting</primary>
42298 <secondary>testing</secondary>
42300 <indexterm role="concept">
42301 <primary>testing</primary>
42302 <secondary>rewriting</secondary>
42304 Exim’s input rewriting configuration appears in a part of the run time
42305 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
42306 <option>-brw</option> command line option. This takes an address (which can be a full RFC
42307 2822 address) as its argument. The output is a list of how the address would be
42308 transformed by the rewriting rules for each of the different places it might
42309 appear in an incoming message, that is, for each different header and for the
42310 envelope sender and recipient fields. For example,
42312 <literallayout class="monospaced">
42313 exim -brw ph10@exim.workshop.example
42316 might produce the output
42318 <literallayout class="monospaced">
42319 sender: Philip.Hazel@exim.workshop.example
42320 from: Philip.Hazel@exim.workshop.example
42321 to: ph10@exim.workshop.example
42322 cc: ph10@exim.workshop.example
42323 bcc: ph10@exim.workshop.example
42324 reply-to: Philip.Hazel@exim.workshop.example
42325 env-from: Philip.Hazel@exim.workshop.example
42326 env-to: ph10@exim.workshop.example
42329 which shows that rewriting has been set up for that address when used in any of
42330 the source fields, but not when it appears as a recipient address. At the
42331 present time, there is no equivalent way of testing rewriting rules that are
42332 set for a particular transport.
42336 <title>Rewriting rules</title>
42338 <indexterm role="concept">
42339 <primary>rewriting</primary>
42340 <secondary>rules</secondary>
42342 The rewrite section of the configuration file consists of lines of rewriting
42346 <<emphasis>source pattern</emphasis>> <<emphasis>replacement</emphasis>> <<emphasis>flags</emphasis>>
42349 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
42350 transport option are given as a colon-separated list. Each item in the list
42351 takes the same form as a line in the main rewriting configuration (except that
42352 any colons must be doubled, of course).
42355 The formats of source patterns and replacement strings are described below.
42356 Each is terminated by white space, unless enclosed in double quotes, in which
42357 case normal quoting conventions apply inside the quotes. The flags are single
42358 characters which may appear in any order. Spaces and tabs between them are
42362 For each address that could potentially be rewritten, the rules are scanned in
42363 order, and replacements for the address from earlier rules can themselves be
42364 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
42367 The order in which addresses are rewritten is undefined, may change between
42368 releases, and must not be relied on, with one exception: when a message is
42369 received, the envelope sender is always rewritten first, before any header
42370 lines are rewritten. For example, the replacement string for a rewrite of an
42371 address in <emphasis>To:</emphasis> must not assume that the message’s address in <emphasis>From:</emphasis> has
42372 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
42373 that the envelope sender has already been rewritten.
42376 <indexterm role="concept">
42377 <primary><varname>$domain</varname></primary>
42379 <indexterm role="concept">
42380 <primary><varname>$local_part</varname></primary>
42382 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
42383 string to refer to the address that is being rewritten. Note that lookup-driven
42384 rewriting can be done by a rule of the form
42386 <literallayout class="monospaced">
42390 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
42391 refer to the address that is being rewritten.
42395 <title>Rewriting patterns</title>
42397 <indexterm role="concept">
42398 <primary>rewriting</primary>
42399 <secondary>patterns</secondary>
42401 <indexterm role="concept">
42402 <primary>address list</primary>
42403 <secondary>in a rewriting pattern</secondary>
42405 The source pattern in a rewriting rule is any item which may appear in an
42406 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
42407 single-item address list, which means that it is expanded before being tested
42408 against the address. As always, if you use a regular expression as a pattern,
42409 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
42410 facility to suppress string expansion within the regular expression.
42413 Domains in patterns should be given in lower case. Local parts in patterns are
42414 case-sensitive. If you want to do case-insensitive matching of local parts, you
42415 can use a regular expression that starts with <literal>^(?i)</literal>.
42418 <indexterm role="concept">
42419 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
42420 <secondary>in rewriting rules</secondary>
42422 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
42423 depending on the type of match which occurred. These can be used in the
42424 replacement string to insert portions of the incoming address. <varname>$0</varname> always
42425 refers to the complete incoming address. When a regular expression is used, the
42426 numerical variables are set from its capturing subexpressions. For other types
42427 of pattern they are set as follows:
42432 If a local part or domain starts with an asterisk, the numerical variables
42433 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
42434 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
42437 <literallayout class="monospaced">
42438 *queen@*.fict.example
42441 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
42443 <literallayout class="monospaced">
42444 $0 = hearts-queen@wonderland.fict.example
42449 Note that if the local part does not start with an asterisk, but the domain
42450 does, it is <varname>$1</varname> that contains the wild part of the domain.
42455 If the domain part of the pattern is a partial lookup, the wild and fixed parts
42456 of the domain are placed in the next available numerical variables. Suppose,
42457 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
42458 rewriting rule of the form
42461 <literal>*@partial-dbm;/some/dbm/file</literal> <<emphasis>replacement string</emphasis>>
42464 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
42466 <literallayout class="monospaced">
42472 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
42473 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
42474 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
42475 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
42476 whole domain. For non-partial domain lookups, no numerical variables are set.
42482 <title>Rewriting replacements</title>
42484 <indexterm role="concept">
42485 <primary>rewriting</primary>
42486 <secondary>replacements</secondary>
42488 If the replacement string for a rule is a single asterisk, addresses that
42489 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
42490 rewriting rules are scanned. For example,
42492 <literallayout class="monospaced">
42493 hatta@lookingglass.fict.example * f
42496 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
42497 <emphasis>From:</emphasis> headers.
42500 <indexterm role="concept">
42501 <primary><varname>$domain</varname></primary>
42503 <indexterm role="concept">
42504 <primary><varname>$local_part</varname></primary>
42506 If the replacement string is not a single asterisk, it is expanded, and must
42507 yield a fully qualified address. Within the expansion, the variables
42508 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
42509 Any letters they contain retain their original case – they are not lower
42510 cased. The numerical variables are set up according to the type of pattern that
42511 matched the address, as described above. If the expansion is forced to fail by
42512 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
42513 current rule is abandoned, but subsequent rules may take effect. Any other
42514 expansion failure causes the entire rewriting operation to be abandoned, and an
42515 entry written to the panic log.
42519 <title>Rewriting flags</title>
42521 There are three different kinds of flag that may appear on rewriting rules:
42526 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
42532 A flag that specifies rewriting at SMTP time: S.
42537 Flags that control the rewriting process: Q, q, R, w.
42542 For rules that are part of the <option>headers_rewrite</option> generic transport option,
42543 E, F, T, and S are not permitted.
42547 <title>Flags specifying which headers and envelope addresses to rewrite</title>
42549 <indexterm role="concept">
42550 <primary>rewriting</primary>
42551 <secondary>flags</secondary>
42553 If none of the following flag letters, nor the <quote>S</quote> flag (see section
42554 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
42555 and to both the sender and recipient fields of the envelope, whereas a
42556 transport-time rewriting rule just applies to all headers. Otherwise, the
42557 rewriting rule is skipped unless the relevant addresses are being processed.
42560 <literal>E</literal> rewrite all envelope fields
42561 <literal>F</literal> rewrite the envelope From field
42562 <literal>T</literal> rewrite the envelope To field
42563 <literal>b</literal> rewrite the <emphasis>Bcc:</emphasis> header
42564 <literal>c</literal> rewrite the <emphasis>Cc:</emphasis> header
42565 <literal>f</literal> rewrite the <emphasis>From:</emphasis> header
42566 <literal>h</literal> rewrite all headers
42567 <literal>r</literal> rewrite the <emphasis>Reply-To:</emphasis> header
42568 <literal>s</literal> rewrite the <emphasis>Sender:</emphasis> header
42569 <literal>t</literal> rewrite the <emphasis>To:</emphasis> header
42572 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
42573 restrict this to special known cases in your own domains.
42576 <section id="SECTrewriteS">
42577 <title>The SMTP-time rewriting flag</title>
42579 <indexterm role="concept">
42580 <primary>SMTP</primary>
42581 <secondary>rewriting malformed addresses</secondary>
42583 <indexterm role="concept">
42584 <primary>RCPT</primary>
42585 <secondary>rewriting argument of</secondary>
42587 <indexterm role="concept">
42588 <primary>MAIL</primary>
42589 <secondary>rewriting argument of</secondary>
42591 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
42592 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
42593 before any other processing; even before syntax checking. The pattern is
42594 required to be a regular expression, and it is matched against the whole of the
42595 data for the command, including any surrounding angle brackets.
42598 <indexterm role="concept">
42599 <primary><varname>$domain</varname></primary>
42601 <indexterm role="concept">
42602 <primary><varname>$local_part</varname></primary>
42604 This form of rewrite rule allows for the handling of addresses that are not
42605 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
42606 input). Because the input is not required to be a syntactically valid address,
42607 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
42608 expansion of the replacement string. The result of rewriting replaces the
42609 original address in the MAIL or RCPT command.
42613 <title>Flags controlling the rewriting process</title>
42615 There are four flags which control the way the rewriting process works. These
42616 take effect only when a rule is invoked, that is, when the address is of the
42617 correct type (matches the flags) and matches the pattern:
42622 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
42623 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
42624 absence of <quote>Q</quote> the rewritten address must always include a domain.
42629 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
42630 even if no rewriting actually takes place because of a <quote>fail</quote> in the
42631 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
42632 (does not match the flags) or does not match the pattern.
42637 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
42638 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
42639 rewriting once it fails to match (after at least one successful rewrite).
42644 <indexterm role="concept">
42645 <primary>rewriting</primary>
42646 <secondary>whole addresses</secondary>
42648 When an address in a header is rewritten, the rewriting normally applies only
42649 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
42650 left unchanged. For example, rewriting might change
42652 <literallayout class="monospaced">
42653 From: Ford Prefect <fp42@restaurant.hitch.fict.example>
42658 <literallayout class="monospaced">
42659 From: Ford Prefect <prefectf@hitch.fict.example>
42662 <indexterm role="concept">
42663 <primary>RFC 2047</primary>
42665 Sometimes there is a need to replace the whole address item, and this can be
42666 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
42667 causes an address in a header line to be rewritten, the entire address is
42668 replaced, not just the working part. The replacement must be a complete RFC
42669 2822 address, including the angle brackets if necessary. If text outside angle
42670 brackets contains a character whose value is greater than 126 or less than 32
42671 (except for tab), the text is encoded according to RFC 2047. The character set
42672 is taken from <option>headers_charset</option>, which defaults to ISO-8859-1.
42675 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
42676 rewritten, all but the working part of the replacement address is discarded.
42682 <title>Rewriting examples</title>
42684 Here is an example of the two common rewriting paradigms:
42686 <literallayout class="monospaced">
42687 *@*.hitch.fict.example $1@hitch.fict.example
42688 *@hitch.fict.example ${lookup{$1}dbm{/etc/realnames}\
42689 {$value}fail}@hitch.fict.example bctfrF
42692 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
42693 the string expansion to fail if the lookup does not succeed. In this context it
42694 has the effect of leaving the original address unchanged, but Exim goes on to
42695 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
42696 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
42697 explicitly, which would cause the rewritten address to be the same as before,
42698 at the cost of a small bit of processing. Not supplying either of these is an
42699 error, since the rewritten address would then contain no local part.
42702 The first example above replaces the domain with a superior, more general
42703 domain. This may not be desirable for certain local parts. If the rule
42705 <literallayout class="monospaced">
42706 root@*.hitch.fict.example *
42709 were inserted before the first rule, rewriting would be suppressed for the
42710 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
42713 Rewriting can be made conditional on a number of tests, by making use of
42714 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
42715 messages that originate outside the local host:
42717 <literallayout class="monospaced">
42718 *@*.hitch.fict.example "${if !eq {$sender_host_address}{}\
42719 {$1@hitch.fict.example}fail}"
42722 The replacement string is quoted in this example because it contains white
42726 <indexterm role="concept">
42727 <primary>rewriting</primary>
42728 <secondary>bang paths</secondary>
42730 <indexterm role="concept">
42731 <primary>bang paths</primary>
42732 <secondary>rewriting</secondary>
42734 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
42735 an address it treats it as an unqualified local part which it qualifies with
42736 the local qualification domain (if the source of the message is local or if the
42737 remote host is permitted to send unqualified addresses). Rewriting can
42738 sometimes be used to handle simple bang paths with a fixed number of
42739 components. For example, the rule
42741 <literallayout class="monospaced">
42742 \N^([^!]+)!(.*)@your.domain.example$\N $2@$1
42745 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
42746 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
42747 a global rewriting rule for envelope addresses. It can provide a backdoor
42748 method for using your system as a relay, because the incoming addresses appear
42749 to be local. If the bang path addresses are received via SMTP, it is safer to
42750 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
42751 can be done on the rewritten addresses.
42752 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
42757 <chapter id="CHAPretry">
42758 <title>Retry configuration</title>
42760 <indexterm role="concept" id="IIDretconf1" class="startofrange">
42761 <primary>retry configuration</primary>
42762 <secondary>description of</secondary>
42764 <indexterm role="concept" id="IIDregconf2" class="startofrange">
42765 <primary>configuration file</primary>
42766 <secondary>retry section</secondary>
42768 The <quote>retry</quote> section of the run time configuration file contains a list of
42769 retry rules that control how often Exim tries to deliver messages that cannot
42770 be delivered at the first attempt. If there are no retry rules, temporary
42771 errors are treated as permanent. The <option>-brt</option> command line option can be used
42772 to test which retry rule will be used for a given address, domain and error.
42775 The most common cause of retries is temporary failure to deliver to a remote
42776 host because the host is down, or inaccessible because of a network problem.
42777 Exim’s retry processing in this case is applied on a per-host (strictly, per IP
42778 address) basis, not on a per-message basis. Thus, if one message has recently
42779 been delayed, delivery of a new message to the same host is not immediately
42780 tried, but waits for the host’s retry time to arrive. If the <option>retry_defer</option>
42781 log selector is set, the message
42782 <indexterm role="concept">
42783 <primary>retry</primary>
42784 <secondary>time not reached</secondary>
42786 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
42787 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
42788 the handling of errors during remote deliveries.
42791 Retry processing applies to routing as well as to delivering, except as covered
42792 in the next paragraph. The retry rules do not distinguish between these
42793 actions. It is not possible, for example, to specify different behaviour for
42794 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
42795 the host <emphasis>snark.fict.example</emphasis>. I didn’t think anyone would ever need this
42796 added complication, so did not implement it. However, although they share the
42797 same retry rule, the actual retry times for routing and transporting a given
42798 domain are maintained independently.
42801 When a delivery is not part of a queue run (typically an immediate delivery on
42802 receipt of a message), the routers are always run, and local deliveries are
42803 always attempted, even if retry times are set for them. This makes for better
42804 behaviour if one particular message is causing problems (for example, causing
42805 quota overflow, or provoking an error in a filter file). If such a delivery
42806 suffers a temporary failure, the retry data is updated as normal, and
42807 subsequent delivery attempts from queue runs occur only when the retry time for
42808 the local address is reached.
42811 <title>Changing retry rules</title>
42813 If you change the retry rules in your configuration, you should consider
42814 whether or not to delete the retry data that is stored in Exim’s spool area in
42815 files with names like <filename>db/retry</filename>. Deleting any of Exim’s hints files is
42816 always safe; that is why they are called <quote>hints</quote>.
42819 The hints retry data contains suggested retry times based on the previous
42820 rules. In the case of a long-running problem with a remote host, it might
42821 record the fact that the host has timed out. If your new rules increase the
42822 timeout time for such a host, you should definitely remove the old retry data
42823 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
42824 messages that it should now be retaining.
42828 <title>Format of retry rules</title>
42830 <indexterm role="concept">
42831 <primary>retry</primary>
42832 <secondary>rules</secondary>
42834 Each retry rule occupies one line and consists of three or four parts,
42835 separated by white space: a pattern, an error name, an optional list of sender
42836 addresses, and a list of retry parameters. The pattern and sender lists must be
42837 enclosed in double quotes if they contain white space. The rules are searched
42838 in order until one is found where the pattern, error name, and sender list (if
42839 present) match the failing host or address, the error that occurred, and the
42840 message’s sender, respectively.
42843 The pattern is any single item that may appear in an address list (see section
42844 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
42845 which means that it is expanded before being tested against the address that
42846 has been delayed. A negated address list item is permitted. Address
42847 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
42848 which makes it possible for many retry rules to start with just a domain. For
42851 <literallayout class="monospaced">
42852 lookingglass.fict.example * F,24h,30m;
42855 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
42858 <literallayout class="monospaced">
42859 alice@lookingglass.fict.example * F,24h,30m;
42862 applies only to temporary failures involving the local part <option>alice</option>.
42863 In practice, almost all rules start with a domain name pattern without a local
42867 <indexterm role="concept">
42868 <primary>regular expressions</primary>
42869 <secondary>in retry rules</secondary>
42871 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a routing rule pattern, it
42872 must match a complete address, not just a domain, because that is how regular
42873 expressions work in address lists.
42876 <literal>^\Nxyz\d+\.abc\.example$\N * G,1h,10m,2</literal> <option>Wrong</option>
42877 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N * G,1h,10m,2</literal> <option>Right</option>
42881 <title>Choosing which retry rule to use for address errors</title>
42883 When Exim is looking for a retry rule after a routing attempt has failed (for
42884 example, after a DNS timeout), each line in the retry configuration is tested
42885 against the complete address only if <option>retry_use_local_part</option> is set for the
42886 router. Otherwise, only the domain is used, except when matching against a
42887 regular expression, when the local part of the address is replaced with <quote>*</quote>.
42888 A domain on its own can match a domain pattern, or a pattern that starts with
42889 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
42890 <option>check_local_user</option> is true, and false for other routers.
42893 Similarly, when Exim is looking for a retry rule after a local delivery has
42894 failed (for example, after a mailbox full error), each line in the retry
42895 configuration is tested against the complete address only if
42896 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
42899 <para revisionflag="changed">
42900 <indexterm role="concept">
42901 <primary>4<emphasis>xx</emphasis> responses</primary>
42902 <secondary>retry rules for</secondary>
42904 However, when Exim is looking for a retry rule after a remote delivery attempt
42905 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
42906 whole address is always used as the key when searching the retry rules. The
42907 rule that is found is used to create a retry time for the combination of the
42908 failing address and the message’s sender. It is the combination of sender and
42909 recipient that is delayed in subsequent queue runs until its retry time is
42910 reached. You can delay the recipient without regard to the sender by setting
42911 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
42912 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
42917 <title>Choosing which retry rule to use for host and message errors</title>
42919 For a temporary error that is not related to an individual address (for
42920 example, a connection timeout), each line in the retry configuration is checked
42921 twice. First, the name of the remote host is used as a domain name (preceded by
42922 <quote>*@</quote> when matching a regular expression). If this does not match the line,
42923 the domain from the email address is tried in a similar fashion. For example,
42924 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
42926 <literallayout class="monospaced">
42927 a.b.c.example MX 5 x.y.z.example
42932 and the retry rules are
42934 <literallayout class="monospaced">
42935 p.q.r.example * F,24h,30m;
42936 a.b.c.example * F,4d,45m;
42939 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
42940 first rule matches neither the host nor the domain, so Exim looks at the second
42941 rule. This does not match the host, but it does match the domain, so it is used
42942 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
42943 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
42944 first retry rule is used, because it matches the host.
42947 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
42948 first rule to determine retry times, but for all the other hosts for the domain
42949 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
42950 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
42953 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
42954 However, if a message is routed directly to an IP address without the use of a
42955 host name, for example, if a <command>manualroute</command> router contains a setting such as:
42957 <literallayout class="monospaced">
42958 route_list = *.a.example 192.168.34.23
42961 then the <quote>host name</quote> that is used when searching for a retry rule is the
42962 textual form of the IP address.
42966 <title>Retry rules for specific errors</title>
42968 <indexterm role="concept">
42969 <primary>retry</primary>
42970 <secondary>specific errors; specifying</secondary>
42972 The second field in a retry rule is the name of a particular error, or an
42973 asterisk, which matches any error. The errors that can be tested for are:
42977 <term><option>auth_failed</option></term>
42980 Authentication failed when trying to send to a host in the
42981 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
42983 </listitem></varlistentry>
42985 <term><option>data_4xx</option></term>
42988 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
42989 after the command, or after sending the message’s data.
42991 </listitem></varlistentry>
42993 <term><option>mail_4xx</option></term>
42996 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
42998 </listitem></varlistentry>
43000 <term><option>rcpt_4xx</option></term>
43003 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
43005 </listitem></varlistentry>
43008 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x’s can be given
43009 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
43010 recognize 452 errors given to RCPT commands for addresses in a certain domain,
43011 and have retries every ten minutes with a one-hour timeout, you could set up a
43012 retry rule of this form:
43014 <literallayout class="monospaced">
43015 the.domain.name rcpt_452 F,1h,10m
43018 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
43019 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
43023 <term><option>lost_connection</option></term>
43026 A server unexpectedly closed the SMTP connection. There may, of course,
43027 legitimate reasons for this (host died, network died), but if it repeats a lot
43028 for the same host, it indicates something odd.
43030 </listitem></varlistentry>
43032 <term><option>refused_MX</option></term>
43035 A connection to a host obtained from an MX record was refused.
43037 </listitem></varlistentry>
43039 <term><option>refused_A</option></term>
43042 A connection to a host not obtained from an MX record was refused.
43044 </listitem></varlistentry>
43046 <term><option>refused</option></term>
43049 A connection was refused.
43051 </listitem></varlistentry>
43053 <term><option>timeout_connect_MX</option></term>
43056 A connection attempt to a host obtained from an MX record timed out.
43058 </listitem></varlistentry>
43060 <term><option>timeout_connect_A</option></term>
43063 A connection attempt to a host not obtained from an MX record timed out.
43065 </listitem></varlistentry>
43067 <term><option>timeout_connect</option></term>
43070 A connection attempt timed out.
43072 </listitem></varlistentry>
43074 <term><option>timeout_MX</option></term>
43077 There was a timeout while connecting or during an SMTP session with a host
43078 obtained from an MX record.
43080 </listitem></varlistentry>
43082 <term><option>timeout_A</option></term>
43085 There was a timeout while connecting or during an SMTP session with a host not
43086 obtained from an MX record.
43088 </listitem></varlistentry>
43090 <term><option>timeout</option></term>
43093 There was a timeout while connecting or during an SMTP session.
43095 </listitem></varlistentry>
43097 <term><option>tls_required</option></term>
43100 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
43101 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
43102 to STARTTLS, or there was a problem setting up the TLS connection.
43104 </listitem></varlistentry>
43106 <term><option>quota</option></term>
43109 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
43112 </listitem></varlistentry>
43114 <term><option>quota_</option><<emphasis>time</emphasis>></term>
43117 <indexterm role="concept">
43118 <primary>quota</primary>
43119 <secondary>error testing in retry rule</secondary>
43121 <indexterm role="concept">
43122 <primary>retry</primary>
43123 <secondary>quota error testing</secondary>
43125 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
43126 transport, and the mailbox has not been accessed for <<emphasis>time</emphasis>>. For example,
43127 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
43130 </listitem></varlistentry>
43133 <indexterm role="concept">
43134 <primary>mailbox</primary>
43135 <secondary>time of last read</secondary>
43137 The idea of <option>quota_</option><<emphasis>time</emphasis>> is to make it possible to have shorter
43138 timeouts when the mailbox is full and is not being read by its owner. Ideally,
43139 it should be based on the last time that the user accessed the mailbox.
43140 However, it is not always possible to determine this. Exim uses the following
43146 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
43147 used. As no new messages are being delivered (because the mailbox is over
43148 quota), Exim does not access the file, so this is the time of last user access.
43153 <indexterm role="concept">
43154 <primary>maildir format</primary>
43155 <secondary>time of last read</secondary>
43157 For a maildir delivery, the time of last modification of the <filename>new</filename>
43158 subdirectory is used. As the mailbox is over quota, no new files are created in
43159 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
43160 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
43161 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
43162 time that is used is therefore the last time that the user read a new message.
43167 For other kinds of multi-file mailbox, the time of last access cannot be
43168 obtained, so a retry rule that uses this type of error field is never matched.
43173 The quota errors apply both to system-enforced quotas and to Exim’s own quota
43174 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
43175 when a local delivery is deferred because a partition is full (the ENOSPC
43180 <title>Retry rules for specified senders</title>
43182 <indexterm role="concept">
43183 <primary>retry</primary>
43184 <secondary>rules; sender-specific</secondary>
43186 You can specify retry rules that apply only when the failing message has a
43187 specific sender. In particular, this can be used to define retry rules that
43188 apply only to bounce messages. The third item in a retry rule can be of this
43192 <literal>senders=</literal><<emphasis>address list</emphasis>>
43195 The retry timings themselves are then the fourth item. For example:
43197 <literallayout class="monospaced">
43198 * rcpt_4xx senders=: F,1h,30m
43201 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
43202 host. If the address list contains white space, it must be enclosed in quotes.
43205 <literallayout class="monospaced">
43206 a.domain rcpt_452 senders="xb.dom : yc.dom" G,8h,10m,1.5
43209 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
43210 (which do not depend on the recipient). The reason is that the sender is used
43211 only to match the retry rule. Once the rule has been found for a host error,
43212 its contents are used to set a retry time for the host, and this will apply to
43213 all messages, not just those with specific senders.
43216 When testing retry rules using <option>-brt</option>, you can supply a sender using the
43217 <option>-f</option> command line option, like this:
43219 <literallayout class="monospaced">
43220 exim -f "" -brt user@dom.ain
43223 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
43224 list is never matched.
43228 <title>Retry parameters</title>
43230 <indexterm role="concept">
43231 <primary>retry</primary>
43232 <secondary>parameters in rules</secondary>
43234 The third (or fourth, if a senders list is present) field in a retry rule is a
43235 sequence of retry parameter sets, separated by semicolons. Each set consists of
43238 <<emphasis>letter</emphasis>>,<<emphasis>cutoff time</emphasis>>,<<emphasis>arguments</emphasis>>
43241 The letter identifies the algorithm for computing a new retry time; the cutoff
43242 time is the time beyond which this algorithm no longer applies, and the
43243 arguments vary the algorithm’s action. The cutoff time is measured from the
43244 time that the first failure for the domain (combined with the local part if
43245 relevant) was detected, not from the time the message was received.
43248 <indexterm role="concept">
43249 <primary>retry</primary>
43250 <secondary>algorithms</secondary>
43252 <indexterm role="concept">
43253 <primary>retry</primary>
43254 <secondary>fixed intervals</secondary>
43256 <indexterm role="concept">
43257 <primary>retry</primary>
43258 <secondary>increasing intervals</secondary>
43260 <indexterm role="concept">
43261 <primary>retry</primary>
43262 <secondary>random intervals</secondary>
43264 The available algorithms are:
43269 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
43275 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
43276 specifies a starting value for the interval, and the second a multiplier, which
43277 is used to increase the size of the interval at each retry.
43282 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
43283 retry, the previous interval is multiplied by the factor in order to get a
43284 maximum for the next interval. The mininum interval is the first argument of
43285 the parameter, and an actual interval is chosen randomly between them. Such a
43286 rule has been found to be helpful in cluster configurations when all the
43287 members of the cluster restart at once, and may therefore synchronize their
43288 queue processing times.
43293 When computing the next retry time, the algorithm definitions are scanned in
43294 order until one whose cutoff time has not yet passed is reached. This is then
43295 used to compute a new retry time that is later than the current time. In the
43296 case of fixed interval retries, this simply means adding the interval to the
43297 current time. For geometrically increasing intervals, retry intervals are
43298 computed from the rule’s parameters until one that is greater than the previous
43299 interval is found. The main configuration variable
43300 <indexterm role="concept">
43301 <primary>limit</primary>
43302 <secondary>retry interval</secondary>
43304 <indexterm role="concept">
43305 <primary>retry interval</primary>
43306 <secondary>maximum</secondary>
43308 <indexterm role="concept">
43309 <primary><option>retry_interval_max</option></primary>
43311 <option>retry_interval_max</option> limits the maximum interval between retries. It
43312 cannot be set greater than <literal>24h</literal>, which is its default value.
43315 A single remote domain may have a number of hosts associated with it, and each
43316 host may have more than one IP address. Retry algorithms are selected on the
43317 basis of the domain name, but are applied to each IP address independently. If,
43318 for example, a host has two IP addresses and one is unusable, Exim will
43319 generate retry times for it and will not try to use it until its next retry
43320 time comes. Thus the good IP address is likely to be tried first most of the
43324 <indexterm role="concept">
43325 <primary>hints database</primary>
43326 <secondary>use for retrying</secondary>
43328 Retry times are hints rather than promises. Exim does not make any attempt to
43329 run deliveries exactly at the computed times. Instead, a queue runner process
43330 starts delivery processes for delayed messages periodically, and these attempt
43331 new deliveries only for those addresses that have passed their next retry time.
43332 If a new message arrives for a deferred address, an immediate delivery attempt
43333 occurs only if the address has passed its retry time. In the absence of new
43334 messages, the minimum time between retries is the interval between queue runner
43335 processes. There is not much point in setting retry times of five minutes if
43336 your queue runners happen only once an hour, unless there are a significant
43337 number of incoming messages (which might be the case on a system that is
43338 sending everything to a smart host, for example).
43341 The data in the retry hints database can be inspected by using the
43342 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
43343 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
43344 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
43345 are for the hosts associated with a particular mail domain, and also for local
43346 deliveries that have been deferred.
43350 <title>Retry rule examples</title>
43352 Here are some example retry rules:
43354 <literallayout class="monospaced">
43355 alice@wonderland.fict.example quota_5d F,7d,3h
43356 wonderland.fict.example quota_5d
43357 wonderland.fict.example * F,1h,15m; G,2d,1h,2;
43358 lookingglass.fict.example * F,24h,30m;
43359 * refused_A F,2h,20m;
43360 * * F,2h,15m; G,16h,1h,1.5; F,5d,8h
43363 The first rule sets up special handling for mail to
43364 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
43365 mailbox has not been read for at least 5 days. Retries continue every three
43366 hours for 7 days. The second rule handles over-quota errors for all other local
43367 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
43368 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
43369 fail are bounced immediately if the mailbox has not been read for at least 5
43373 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
43374 happen every 15 minutes for an hour, then with geometrically increasing
43375 intervals until two days have passed since a delivery first failed. After the
43376 first hour there is a delay of one hour, then two hours, then four hours, and
43377 so on (this is a rather extreme example).
43380 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
43381 They happen every 30 minutes for 24 hours only. The remaining two rules handle
43382 all other domains, with special action for connection refusal from hosts that
43383 were not obtained from an MX record.
43386 The final rule in a retry configuration should always have asterisks in the
43387 first two fields so as to provide a general catch-all for any addresses that do
43388 not have their own special handling. This example tries every 15 minutes for 2
43389 hours, then with intervals starting at one hour and increasing by a factor of
43390 1.5 up to 16 hours, then every 8 hours up to 5 days.
43394 <title>Timeout of retry data</title>
43396 <indexterm role="concept">
43397 <primary>timeout</primary>
43398 <secondary>of retry data</secondary>
43400 <indexterm role="concept">
43401 <primary><option>retry_data_expire</option></primary>
43403 <indexterm role="concept">
43404 <primary>hints database</primary>
43405 <secondary>data expiry</secondary>
43407 <indexterm role="concept">
43408 <primary>retry</primary>
43409 <secondary>timeout of data</secondary>
43411 Exim timestamps the data that it writes to its retry hints database. When it
43412 consults the data during a delivery it ignores any that is older than the value
43413 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn’t
43414 been tried for 7 days, Exim will try to deliver to it immediately a message
43415 arrives, and if that fails, it will calculate a retry time as if it were
43416 failing for the first time.
43419 This improves the behaviour for messages routed to rarely-used hosts such as MX
43420 backups. If such a host was down at one time, and happens to be down again when
43421 Exim tries a month later, using the old retry data would imply that it had been
43422 down all the time, which is not a justified assumption.
43425 If a host really is permanently dead, this behaviour causes a burst of retries
43426 every now and again, but only if messages routed to it are rare. If there is a
43427 message at least once every 7 days the retry data never expires.
43431 <title>Long-term failures</title>
43433 <indexterm role="concept">
43434 <primary>delivery failure</primary>
43435 <secondary>long-term</secondary>
43437 <indexterm role="concept">
43438 <primary>retry</primary>
43439 <secondary>after long-term failure</secondary>
43441 Special processing happens when an email address has been failing for so long
43442 that the cutoff time for the last algorithm is reached. For example, using the
43443 default retry rule:
43445 <literallayout class="monospaced">
43446 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
43449 the cutoff time is four days. Reaching the retry cutoff is independent of how
43450 long any specific message has been failing; it is the length of continuous
43451 failure for the recipient address that counts.
43454 When the cutoff time is reached for a local delivery, or for all the IP
43455 addresses associated with a remote delivery, a subsequent delivery failure
43456 causes Exim to give up on the address, and a bounce message is generated.
43457 In order to cater for new messages that use the failing address, a next retry
43458 time is still computed from the final algorithm, and is used as follows:
43461 For local deliveries, one delivery attempt is always made for any subsequent
43462 messages. If this delivery fails, the address fails immediately. The
43463 post-cutoff retry time is not used.
43466 If the delivery is remote, there are two possibilities, controlled by the
43467 <indexterm role="concept">
43468 <primary><option>delay_after_cutoff</option></primary>
43470 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
43471 default. Until the post-cutoff retry time for one of the IP addresses is
43472 reached, the failing email address is bounced immediately, without a delivery
43473 attempt taking place. After that time, one new delivery attempt is made to
43474 those IP addresses that are past their retry times, and if that still fails,
43475 the address is bounced and new retry times are computed.
43478 In other words, when all the hosts for a given email address have been failing
43479 for a long time, Exim bounces rather then defers until one of the hosts’ retry
43480 times is reached. Then it tries once, and bounces if that attempt fails. This
43481 behaviour ensures that few resources are wasted in repeatedly trying to deliver
43482 to a broken destination, but if the host does recover, Exim will eventually
43486 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
43487 addresses are past their final cutoff time, Exim tries to deliver to those IP
43488 addresses that have not been tried since the message arrived. If there are
43489 no suitable IP addresses, or if they all fail, the address is bounced. In other
43490 words, it does not delay when a new message arrives, but tries the expired
43491 addresses immediately, unless they have been tried since the message arrived.
43492 If there is a continuous stream of messages for the failing domains, setting
43493 <option>delay_after_cutoff</option> false means that there will be many more attempts to
43494 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
43499 <title>Deliveries that work intermittently</title>
43501 <indexterm role="concept">
43502 <primary>retry</primary>
43503 <secondary>intermittently working deliveries</secondary>
43505 Some additional logic is needed to cope with cases where a host is
43506 intermittently available, or when a message has some attribute that prevents
43507 its delivery when others to the same address get through. In this situation,
43508 because some messages are successfully delivered, the <quote>retry clock</quote> for the
43509 host or address keeps getting reset by the successful deliveries, and so
43510 failing messages remain on the queue for ever because the cutoff time is never
43514 Two exceptional actions are applied to prevent this happening. The first
43515 applies to errors that are related to a message rather than a remote host.
43516 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
43517 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
43518 commands, and quota failures. For this type of error, if a message’s arrival
43519 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
43520 is used when scanning the retry rules to decide when to try next and when to
43521 time out the address.
43524 The exceptional second action applies in all cases. If a message has been on
43525 the queue for longer than the cutoff time of any applicable retry rule for a
43526 given address, a delivery is attempted for that address, even if it is not yet
43527 time, and if this delivery fails, the address is timed out. A new retry time is
43528 not computed in this case, so that other messages for the same address are
43529 considered immediately.
43530 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
43531 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
43536 <chapter id="CHAPSMTPAUTH">
43537 <title>SMTP authentication</title>
43539 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
43540 <primary>SMTP</primary>
43541 <secondary>authentication configuration</secondary>
43543 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
43544 <primary>authentication</primary>
43546 The <quote>authenticators</quote> section of Exim’s run time configuration is concerned
43547 with SMTP authentication. This facility is an extension to the SMTP protocol,
43548 described in RFC 2554, which allows a client SMTP host to authenticate itself
43549 to a server. This is a common way for a server to recognize clients that are
43550 permitted to use it as a relay. SMTP authentication is not of relevance to the
43551 transfer of mail between servers that have no managerial connection with each
43555 <indexterm role="concept">
43556 <primary>AUTH</primary>
43557 <secondary>description of</secondary>
43559 Very briefly, the way SMTP authentication works is as follows:
43564 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
43565 the client’s EHLO command.
43570 The client issues an AUTH command, naming a specific mechanism. The command
43571 may, optionally, contain some authentication data.
43576 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
43577 appropriate responses. In simple authentication mechanisms, the challenges are
43578 just prompts for user names and passwords. The server does not have to issue
43579 any challenges – in some mechanisms the relevant data may all be transmitted
43580 with the AUTH command.
43585 The server either accepts or denies authentication.
43590 If authentication succeeds, the client may optionally make use of the AUTH
43591 option on the MAIL command to pass an authenticated sender in subsequent
43592 mail transactions. Authentication lasts for the remainder of the SMTP
43598 If authentication fails, the client may give up, or it may try a different
43599 authentication mechanism, or it may try transferring mail over the
43600 unauthenticated connection.
43605 If you are setting up a client, and want to know which authentication
43606 mechanisms the server supports, you can use Telnet to connect to port 25 (the
43607 SMTP port) on the server, and issue an EHLO command. The response to this
43608 includes the list of supported mechanisms. For example:
43611 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
43612 <literal>Trying 192.168.34.25...</literal>
43613 <literal>Connected to server.example.</literal>
43614 <literal>Escape character is '^]'.</literal>
43615 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
43616 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
43617 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
43618 <literal>250-SIZE 52428800</literal>
43619 <literal>250-PIPELINING</literal>
43620 <literal>250-AUTH PLAIN</literal>
43621 <literal>250 HELP</literal>
43624 The second-last line of this example output shows that the server supports
43625 authentication using the PLAIN mechanism. In Exim, the different authentication
43626 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
43627 routers and transports, which authenticators are included in the binary is
43628 controlled by build-time definitions. The following are currently available,
43629 included by setting
43631 <literallayout class="monospaced">
43633 AUTH_CYRUS_SASL=yes
43638 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
43639 authentication mechanism (RFC 2195), and the second provides an interface to
43640 the Cyrus SASL authentication library. The third can be configured to support
43641 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
43642 not formally documented, but used by several MUAs. The fourth authenticator
43643 supports Microsoft’s <emphasis>Secure Password Authentication</emphasis> mechanism.
43646 The authenticators are configured using the same syntax as other drivers (see
43647 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
43648 authentication section need be present in the configuration file. Each
43649 authenticator can in principle have both server and client functions. When Exim
43650 is receiving SMTP mail, it is acting as a server; when it is sending out
43651 messages over SMTP, it is acting as a client. Authenticator configuration
43652 options are provided for use in both these circumstances.
43655 To make it clear which options apply to which situation, the prefixes
43656 <option>server_</option> and <option>client_</option> are used on option names that are specific to
43657 either the server or the client function, respectively. Server and client
43658 functions are disabled if none of their options are set. If an authenticator is
43659 to be used for both server and client functions, a single definition, using
43660 both sets of options, is required. For example:
43662 <literallayout class="monospaced">
43665 public_name = CRAM-MD5
43666 server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
43668 client_secret = secret2
43671 The <option>server_</option> option is used when Exim is acting as a server, and the
43672 <option>client_</option> options when it is acting as a client.
43675 Descriptions of the individual authenticators are given in subsequent chapters.
43676 The remainder of this chapter covers the generic options for the
43677 authenticators, followed by general discussion of the way authentication works
43681 <title>Generic options for authenticators</title>
43683 <indexterm role="concept">
43684 <primary>authentication</primary>
43685 <secondary>generic options</secondary>
43687 <indexterm role="concept">
43688 <primary>options</primary>
43689 <secondary>generic; for authenticators</secondary>
43693 <indexterm role="option">
43694 <primary><option>driver</option></primary>
43697 <informaltable frame="all">
43698 <tgroup cols="4" colsep="0" rowsep="0">
43699 <colspec colwidth="8*" align="left"/>
43700 <colspec colwidth="5*" align="center"/>
43701 <colspec colwidth="5*" align="center"/>
43702 <colspec colwidth="6*" align="right"/>
43705 <entry><option>driver</option></entry>
43706 <entry>Use: <emphasis>authenticators</emphasis></entry>
43707 <entry>Type: <emphasis>string</emphasis></entry>
43708 <entry>Default: <emphasis>unset</emphasis></entry>
43714 This option must always be set. It specifies which of the available
43715 authenticators is to be used.
43718 <indexterm role="option">
43719 <primary><option>public_name</option></primary>
43722 <informaltable frame="all">
43723 <tgroup cols="4" colsep="0" rowsep="0">
43724 <colspec colwidth="8*" align="left"/>
43725 <colspec colwidth="5*" align="center"/>
43726 <colspec colwidth="5*" align="center"/>
43727 <colspec colwidth="6*" align="right"/>
43730 <entry><option>public_name</option></entry>
43731 <entry>Use: <emphasis>authenticators</emphasis></entry>
43732 <entry>Type: <emphasis>string</emphasis></entry>
43733 <entry>Default: <emphasis>unset</emphasis></entry>
43739 This option specifies the name of the authentication mechanism that the driver
43740 implements, and by which it is known to the outside world. These names should
43741 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
43742 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
43743 defaults to the driver’s instance name.
43746 <indexterm role="option">
43747 <primary><option>server_advertise_condition</option></primary>
43750 <informaltable frame="all">
43751 <tgroup cols="4" colsep="0" rowsep="0">
43752 <colspec colwidth="8*" align="left"/>
43753 <colspec colwidth="5*" align="center"/>
43754 <colspec colwidth="5*" align="center"/>
43755 <colspec colwidth="6*" align="right"/>
43758 <entry><option>server_advertise_condition</option></entry>
43759 <entry>Use: <emphasis>authenticators</emphasis></entry>
43760 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43761 <entry>Default: <emphasis>unset</emphasis></entry>
43767 When a server is about to advertise an authentication mechanism, the condition
43768 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
43769 mechanism is not advertised.
43770 If the expansion fails, the mechanism is not advertised. If the failure was not
43771 forced, and was not caused by a lookup defer, the incident is logged.
43772 See section <xref linkend="SECTauthexiser"/> below for further discussion.
43774 <para revisionflag="changed">
43775 <indexterm role="option">
43776 <primary><option>server_condition</option></primary>
43779 <informaltable frame="all" revisionflag="changed">
43780 <tgroup cols="4" colsep="0" rowsep="0">
43781 <colspec colwidth="8*" align="left"/>
43782 <colspec colwidth="5*" align="center"/>
43783 <colspec colwidth="5*" align="center"/>
43784 <colspec colwidth="6*" align="right"/>
43787 <entry><option>server_condition</option></entry>
43788 <entry>Use: <emphasis>authenticators</emphasis></entry>
43789 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43790 <entry>Default: <emphasis>unset</emphasis></entry>
43795 <para revisionflag="changed">
43796 This option must be set for a <option>plaintext</option> server authenticator, where it
43797 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
43800 <para revisionflag="changed">
43801 For the other authenticators, <option>server_condition</option> can be used as an additional
43802 authentication or authorization mechanism that is applied after the other
43803 authenticator conditions succeed. If it is set, it is expanded when the
43804 authenticator would otherwise return a success code. If the expansion is forced
43805 to fail, authentication fails. Any other expansion failure causes a temporary
43806 error code to be returned. If the result of a successful expansion is an empty
43807 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
43808 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
43809 other result, a temporary error code is returned, with the expanded string as
43813 <indexterm role="option">
43814 <primary><option>server_debug_print</option></primary>
43817 <informaltable frame="all">
43818 <tgroup cols="4" colsep="0" rowsep="0">
43819 <colspec colwidth="8*" align="left"/>
43820 <colspec colwidth="5*" align="center"/>
43821 <colspec colwidth="5*" align="center"/>
43822 <colspec colwidth="6*" align="right"/>
43825 <entry><option>server_debug_print</option></entry>
43826 <entry>Use: <emphasis>authenticators</emphasis></entry>
43827 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43828 <entry>Default: <emphasis>unset</emphasis></entry>
43834 If this option is set and authentication debugging is enabled (see the <option>-d</option>
43835 command line option), the string is expanded and included in the debugging
43836 output when the authenticator is run as a server. This can help with checking
43837 out the values of variables.
43838 If expansion of the string fails, the error message is written to the debugging
43839 output, and Exim carries on processing.
43842 <indexterm role="option">
43843 <primary><option>server_set_id</option></primary>
43846 <informaltable frame="all">
43847 <tgroup cols="4" colsep="0" rowsep="0">
43848 <colspec colwidth="8*" align="left"/>
43849 <colspec colwidth="5*" align="center"/>
43850 <colspec colwidth="5*" align="center"/>
43851 <colspec colwidth="6*" align="right"/>
43854 <entry><option>server_set_id</option></entry>
43855 <entry>Use: <emphasis>authenticators</emphasis></entry>
43856 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43857 <entry>Default: <emphasis>unset</emphasis></entry>
43863 <indexterm role="concept">
43864 <primary><varname>$authenticated_id</varname></primary>
43866 When an Exim server successfully authenticates a client, this string is
43867 expanded using data from the authentication, and preserved for any incoming
43868 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
43869 lines for incoming messages. For example, a user/password authenticator
43870 configuration might preserve the user name that was used to authenticate, and
43871 refer to it subsequently during delivery of the message.
43872 If expansion fails, the option is ignored.
43875 <indexterm role="option">
43876 <primary><option>server_mail_auth_condition</option></primary>
43879 <informaltable frame="all">
43880 <tgroup cols="4" colsep="0" rowsep="0">
43881 <colspec colwidth="8*" align="left"/>
43882 <colspec colwidth="5*" align="center"/>
43883 <colspec colwidth="5*" align="center"/>
43884 <colspec colwidth="6*" align="right"/>
43887 <entry><option>server_mail_auth_condition</option></entry>
43888 <entry>Use: <emphasis>authenticators</emphasis></entry>
43889 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43890 <entry>Default: <emphasis>unset</emphasis></entry>
43896 This option allows a server to discard authenticated sender addresses supplied
43897 as part of MAIL commands in SMTP connections that are authenticated by the
43898 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
43899 as part of the authentication process; instead its (unexpanded) value is
43900 remembered for later use.
43901 How it is used is described in the following section.
43904 <section id="SECTauthparamail">
43905 <title>The AUTH parameter on MAIL commands</title>
43907 <indexterm role="concept">
43908 <primary>authentication</primary>
43909 <secondary>sender; authenticated</secondary>
43911 <indexterm role="concept">
43912 <primary>AUTH</primary>
43913 <secondary>on MAIL command</secondary>
43915 When a client supplied an AUTH= item on a MAIL command, Exim applies
43916 the following checks before accepting it as the authenticated sender of the
43922 If the connection is not using extended SMTP (that is, HELO was used rather
43923 than EHLO), the use of AUTH= is a syntax error.
43928 If the value of the AUTH= parameter is <quote><></quote>, it is ignored.
43933 <indexterm role="concept">
43934 <primary><varname>$authenticated_sender</varname></primary>
43936 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
43937 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
43938 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
43939 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
43940 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
43941 given for the MAIL command.
43946 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
43947 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
43953 If the AUTH= value was accepted by either of the two previous rules, and
43954 the client has authenticated, and the authenticator has a setting for the
43955 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
43956 valued that was saved from the authenticator is expanded. If the expansion
43957 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
43958 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
43959 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
43965 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
43966 hosts to which Exim authenticates as a client. Do not confuse this value with
43967 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
43968 process, and which is not usually a complete email address.
43971 <indexterm role="concept">
43972 <primary><varname>$sender_address</varname></primary>
43974 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
43975 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
43976 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
43977 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
43981 <section id="SECTauthexiser">
43982 <title>Authentication on an Exim server</title>
43984 <indexterm role="concept">
43985 <primary>authentication</primary>
43986 <secondary>on an Exim server</secondary>
43988 When Exim receives an EHLO command, it advertises the public names of those
43989 authenticators that are configured as servers, subject to the following
43995 The client host must match <option>auth_advertise_hosts</option> (default *).
44000 It the <option>server_advertise_condition</option> option is set, its expansion must not
44001 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
44006 The order in which the authenticators are defined controls the order in which
44007 the mechanisms are advertised.
44010 Some mail clients (for example, some versions of Netscape) require the user to
44011 provide a name and password for authentication whenever AUTH is advertised,
44012 even though authentication may not in fact be needed (for example, Exim may be
44013 set up to allow unconditional relaying from the client by an IP address check).
44014 You can make such clients more friendly by not advertising AUTH to them.
44015 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
44016 that runs for RCPT) to relay without authentication, you should set
44018 <literallayout class="monospaced">
44019 auth_advertise_hosts = ! 10.9.8.0/24
44022 so that no authentication mechanisms are advertised to them.
44025 The <option>server_advertise_condition</option> controls the advertisement of individual
44026 authentication mechanisms. For example, it can be used to restrict the
44027 advertisement of a patricular mechanism to encrypted connections, by a setting
44030 <literallayout class="monospaced">
44031 server_advertise_condition = ${if eq{$tls_cipher}{}{no}{yes}}
44034 <indexterm role="concept">
44035 <primary><varname>$tls_cipher</varname></primary>
44037 If the session is encrypted, <varname>$tls_cipher</varname> is not empty, and so the expansion
44038 yields <quote>yes</quote>, which allows the advertisement to happen.
44041 When an Exim server receives an AUTH command from a client, it rejects it
44042 immediately if AUTH was not advertised in response to an earlier EHLO
44043 command. This is the case if
44048 The client host does not match <option>auth_advertise_hosts</option>; or
44053 No authenticators are configured with server options; or
44058 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
44059 server authenticators.
44064 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
44065 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
44066 AUTH is accepted from any client host.
44069 If AUTH is not rejected by the ACL, Exim searches its configuration for a
44070 server authentication mechanism that was advertised in response to EHLO and
44071 that matches the one named in the AUTH command. If it finds one, it runs
44072 the appropriate authentication protocol, and authentication either succeeds or
44073 fails. If there is no matching advertised mechanism, the AUTH command is
44074 rejected with a 504 error.
44077 <indexterm role="concept">
44078 <primary><varname>$received_protocol</varname></primary>
44080 <indexterm role="concept">
44081 <primary><varname>$sender_host_authenticated</varname></primary>
44083 When a message is received from an authenticated host, the value of
44084 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
44085 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
44086 public name) of the authenticator driver that successfully authenticated the
44087 client from which the message was received. This variable is empty if there was
44088 no successful authentication.
44092 <title>Testing server authentication</title>
44094 <indexterm role="concept">
44095 <primary>authentication</primary>
44096 <secondary>testing a server</secondary>
44098 <indexterm role="concept">
44099 <primary>AUTH</primary>
44100 <secondary>testing a server</secondary>
44102 <indexterm role="concept">
44103 <primary>base64 encoding</primary>
44104 <secondary>creating authentication test data</secondary>
44106 Exim’s <option>-bh</option> option can be useful for testing server authentication
44107 configurations. The data for the AUTH command has to be sent using base64
44108 encoding. A quick way to produce such data for testing is the following Perl
44111 <literallayout class="monospaced">
44113 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
44116 <indexterm role="concept">
44117 <primary>binary zero</primary>
44118 <secondary>in authentication data</secondary>
44120 This interprets its argument as a Perl string, and then encodes it. The
44121 interpretation as a Perl string allows binary zeros, which are required for
44122 some kinds of authentication, to be included in the data. For example, a
44123 command line to run this script on such data might be
44125 <literallayout class="monospaced">
44126 encode '\0user\0password'
44129 Note the use of single quotes to prevent the shell interpreting the
44130 backslashes, so that they can be interpreted by Perl to specify characters
44131 whose code value is zero.
44134 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
44135 digit, you must use three zeros instead of one after the leading backslash. If
44136 you do not, the octal digit that starts your string will be incorrectly
44137 interpreted as part of the code for the first character.
44140 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
44141 specially, you must use a Perl escape to prevent them being misinterpreted. For
44142 example, a command such as
44144 <literallayout class="monospaced">
44145 encode '\0user@domain.com\0pas$$word'
44148 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
44151 If you have the <option>mimencode</option> command installed, another way to do produce
44152 base64-encoded strings is to run the command
44154 <literallayout class="monospaced">
44155 echo -e -n `\0user\0password' | mimencode
44158 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
44159 in the argument, and the <option>-n</option> option specifies no newline at the end of its
44160 output. However, not all versions of <option>echo</option> recognize these options, so you
44161 should check your version before relying on this suggestion.
44165 <title>Authentication by an Exim client</title>
44167 <indexterm role="concept">
44168 <primary>authentication</primary>
44169 <secondary>on an Exim client</secondary>
44171 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
44172 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
44173 announces support for authentication, and the host matches an entry in either
44174 of these options, Exim (as a client) tries to authenticate as follows:
44179 For each authenticator that is configured as a client, it searches the
44180 authentication mechanisms announced by the server for one whose name
44181 matches the public name of the authenticator.
44186 <indexterm role="concept">
44187 <primary><varname>$host</varname></primary>
44189 <indexterm role="concept">
44190 <primary><varname>$host_address</varname></primary>
44192 When it finds one that matches, it runs the authenticator’s client code.
44193 The variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string
44194 expansions that the client might do. They are set to the server’s name and
44195 IP address. If any expansion is forced to fail, the authentication attempt
44197 and Exim moves on to the next authenticator.
44198 Otherwise an expansion failure causes delivery to be
44204 If the result of the authentication attempt is a temporary error or a timeout,
44205 Exim abandons trying to send the message to the host for the moment. It will
44206 try again later. If there are any backup hosts available, they are tried in the
44212 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
44213 carries on searching the list of authenticators and tries another one if
44214 possible. If all authentication attempts give permanent errors, or if there are
44215 no attempts because no mechanisms match (or option expansions force failure),
44216 what happens depends on whether the host matches <option>hosts_require_auth</option> or
44217 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
44218 delivery is deferred. The error can be detected in the retry rules, and thereby
44219 turned into a permanent error if you wish. In the second case, Exim tries to
44220 deliver the message unauthenticated.
44225 <indexterm role="concept">
44226 <primary>AUTH</primary>
44227 <secondary>on MAIL command</secondary>
44229 When Exim has authenticated itself to a remote server, it adds the AUTH
44230 parameter to the MAIL commands it sends, if it has an authenticated sender for
44231 the message. If the message came from a remote host, the authenticated sender
44232 is the one that was receiving on an incoming MAIL command, provided that the
44233 incoming connection was authenticated and the <option>server_mail_auth</option> condition
44234 allowed the authenticated sender to be retained. If a local process calls Exim
44235 to send a message, the sender address that is built from the login name and
44236 <option>qualify_domain</option> is treated as authenticated. However, if the
44237 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
44238 the authenticated sender that was received with the message.
44239 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
44240 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
44245 <chapter id="CHAPplaintext">
44246 <title>The plaintext authenticator</title>
44248 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
44249 <primary><command>plaintext</command> authenticator</primary>
44251 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
44252 <primary>authenticators</primary>
44253 <secondary><command>plaintext</command></secondary>
44255 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
44256 LOGIN authentication mechanisms, both of which transfer authentication data as
44257 plain (unencrypted) text (though base64 encoded). The use of plain text is a
44258 security risk; you are strongly advised to insist on the use of SMTP encryption
44259 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
44260 use unencrypted plain text, you should not use the same passwords for SMTP
44261 connections as you do for login accounts.
44263 <section revisionflag="changed">
44264 <title>Plaintext options</title>
44265 <para revisionflag="changed">
44266 <indexterm role="concept">
44267 <primary>options</primary>
44268 <secondary><command>plaintext</command> authenticator (server)</secondary>
44270 When configured as a server, <command>plaintext</command> uses the following options:
44272 <para revisionflag="changed">
44273 <indexterm role="option">
44274 <primary><option>server_condition</option></primary>
44277 <informaltable frame="all" revisionflag="changed">
44278 <tgroup cols="4" colsep="0" rowsep="0">
44279 <colspec colwidth="8*" align="left"/>
44280 <colspec colwidth="5*" align="center"/>
44281 <colspec colwidth="5*" align="center"/>
44282 <colspec colwidth="6*" align="right"/>
44285 <entry><option>server_condition</option></entry>
44286 <entry>Use: <emphasis>authenticators</emphasis></entry>
44287 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44288 <entry>Default: <emphasis>unset</emphasis></entry>
44293 <para revisionflag="changed">
44294 This is actually a global authentication option, but it must be set in order to
44295 configure the <command>plaintext</command> driver as a server. Its use is described below.
44298 <indexterm role="option">
44299 <primary><option>server_prompts</option></primary>
44302 <informaltable frame="all">
44303 <tgroup cols="4" colsep="0" rowsep="0">
44304 <colspec colwidth="8*" align="left"/>
44305 <colspec colwidth="5*" align="center"/>
44306 <colspec colwidth="5*" align="center"/>
44307 <colspec colwidth="6*" align="right"/>
44310 <entry><option>server_prompts</option></entry>
44311 <entry>Use: <emphasis>plaintext</emphasis></entry>
44312 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44313 <entry>Default: <emphasis>unset</emphasis></entry>
44319 The contents of this option, after expansion, must be a colon-separated list of
44320 prompt strings. If expansion fails, a temporary authentication rejection is
44324 <section id="SECTplainserver">
44325 <title>Using plaintext in a server</title>
44327 <indexterm role="concept">
44328 <primary>AUTH</primary>
44329 <secondary>in <command>plaintext</command> authenticator</secondary>
44331 <indexterm role="concept">
44332 <primary>binary zero</primary>
44333 <secondary>in <command>plaintext</command> authenticator</secondary>
44335 <indexterm role="concept">
44336 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
44337 <secondary>in <command>plaintext</command> authenticator</secondary>
44339 <indexterm role="concept">
44340 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
44342 <indexterm role="concept">
44343 <primary>base64 encoding</primary>
44344 <secondary>in <command>plaintext</command> authenticator</secondary>
44348 When running as a server, <command>plaintext</command> performs the authentication test by
44349 expanding a string. The data sent by the client with the AUTH command, or in
44350 response to subsequent prompts, is base64 encoded, and so may contain any byte
44351 values when decoded. If any data is supplied with the command, it is treated as
44352 a list of strings, separated by NULs (binary zeros), the first three of which
44353 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
44354 (neither LOGIN nor PLAIN uses more than three strings).
44357 For compatibility with previous releases of Exim, the values are also placed in
44358 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
44359 variables for this purpose is now deprecated, as it can lead to confusion in
44360 string expansions that also use them for other things.
44363 If there are more strings in <option>server_prompts</option> than the number of strings
44364 supplied with the AUTH command, the remaining prompts are used to obtain more
44365 data. Each response from the client may be a list of NUL-separated strings.
44368 <indexterm role="concept">
44369 <primary><varname>$authenticated_id</varname></primary>
44371 Once a sufficient number of data strings have been received,
44372 <option>server_condition</option> is expanded. If the expansion is forced to fail,
44373 authentication fails. Any other expansion failure causes a temporary error code
44374 to be returned. If the result of a successful expansion is an empty string,
44375 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
44376 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
44377 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
44378 For any other result, a temporary error code is returned, with the expanded
44379 string as the error text.
44382 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user’s
44383 password, be sure to make the authentication fail if the user is unknown.
44384 There are good and bad examples at the end of the next section.
44388 <title>The PLAIN authentication mechanism</title>
44390 <indexterm role="concept">
44391 <primary>PLAIN authentication mechanism</primary>
44393 <indexterm role="concept">
44394 <primary>authentication</primary>
44395 <secondary>PLAIN mechanism</secondary>
44397 <indexterm role="concept">
44398 <primary>binary zero</primary>
44399 <secondary>in <command>plaintext</command> authenticator</secondary>
44401 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
44402 sent as one item of data (that is, one combined string containing two NUL
44403 separators). The data is sent either as part of the AUTH command, or
44404 subsequently in response to an empty prompt from the server.
44407 The second and third strings are a user name and a corresponding password.
44408 Using a single fixed user name and password as an example, this could be
44409 configured as follows:
44411 <literallayout class="monospaced">
44414 public_name = PLAIN
44416 server_condition = \
44417 ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
44418 server_set_id = $auth2
44421 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
44422 are exactly what we want here, so they need not be specified. Obviously, if the
44423 password contains expansion-significant characters such as dollar, backslash,
44424 or closing brace, they have to be escaped.
44427 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
44428 the end of a string list are ignored). If all the data comes as part of the
44429 AUTH command, as is commonly the case, the prompt is not used. This
44430 authenticator is advertised in the response to EHLO as
44432 <literallayout class="monospaced">
44436 and a client host can authenticate itself by sending the command
44438 <literallayout class="monospaced">
44439 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
44442 As this contains three strings (more than the number of prompts), no further
44443 data is required from the client. Alternatively, the client may just send
44445 <literallayout class="monospaced">
44449 to initiate authentication, in which case the server replies with an empty
44450 prompt. The client must respond with the combined data string.
44453 The data string is base64 encoded, as required by the RFC. This example,
44454 when decoded, is <<emphasis>NUL</emphasis>><literal>username</literal><<emphasis>NUL</emphasis>><literal>mysecret</literal>, where <<emphasis>NUL</emphasis>>
44455 represents a zero byte. This is split up into three strings, the first of which
44456 is empty. The <option>server_condition</option> option in the authenticator checks that the
44457 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
44460 Having just one fixed user name and password, as in this example, is not very
44461 realistic, though for a small organization with only a handful of
44462 authenticating clients it could make sense.
44465 A more sophisticated instance of this authenticator could use the user name in
44466 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
44467 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
44468 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
44469 This is an incorrect example:
44471 <literallayout class="monospaced">
44472 server_condition = \
44473 ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
44476 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
44477 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
44478 incorrect? It works fine for existing users, but consider what happens if a
44479 non-existent user name is given. The lookup fails, but as no success/failure
44480 strings are given for the lookup, it yields an empty string. Thus, to defeat
44481 the authentication, all a client has to do is to supply a non-existent user
44482 name and an empty password. The correct way of writing this test is:
44484 <literallayout class="monospaced">
44485 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
44486 {${if eq{$value}{$auth3}}} {false}}
44489 In this case, if the lookup succeeds, the result is checked; if the lookup
44490 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
44491 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
44492 always fails if its second argument is empty. However, the second way of
44493 writing the test makes the logic clearer.
44497 <title>The LOGIN authentication mechanism</title>
44499 <indexterm role="concept">
44500 <primary>LOGIN authentication mechanism</primary>
44502 <indexterm role="concept">
44503 <primary>authentication</primary>
44504 <secondary>LOGIN mechanism</secondary>
44506 The LOGIN authentication mechanism is not documented in any RFC, but is in use
44507 in a number of programs. No data is sent with the AUTH command. Instead, a
44508 user name and password are supplied separately, in response to prompts. The
44509 plaintext authenticator can be configured to support this as in this example:
44511 <literallayout class="monospaced">
44514 public_name = LOGIN
44515 server_prompts = User Name : Password
44516 server_condition = \
44517 ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
44518 server_set_id = $auth1
44521 Because of the way plaintext operates, this authenticator accepts data supplied
44522 with the AUTH command (in contravention of the specification of LOGIN), but
44523 if the client does not supply it (as is the case for LOGIN clients), the prompt
44524 strings are used to obtain two data items.
44527 Some clients are very particular about the precise text of the prompts. For
44528 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
44529 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
44530 strings. It uses the <option>ldapauth</option> expansion condition to check the user
44531 name and password by binding to an LDAP server:
44533 <literallayout class="monospaced">
44536 public_name = LOGIN
44537 server_prompts = Username:: : Password::
44538 server_condition = ${if ldapauth \
44539 {user="cn=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
44540 pass=${quote:$auth2} \
44541 ldap://ldap.example.org/}}
44542 server_set_id = uid=$auth1,ou=people,o=example.org
44545 Note the use of the <option>quote_ldap_dn</option> operator to correctly quote the DN for
44546 authentication. However, the basic <option>quote</option> operator, rather than any of the
44547 LDAP quoting operators, is the correct one to use for the password, because
44548 quoting is needed only to make the password conform to the Exim syntax. At the
44549 LDAP level, the password is an uninterpreted string.
44553 <title>Support for different kinds of authentication</title>
44555 A number of string expansion features are provided for the purpose of
44556 interfacing to different ways of user authentication. These include checking
44557 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
44558 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
44559 <xref linkend="SECTexpcond"/>.
44563 <title>Using plaintext in a client</title>
44565 <indexterm role="concept">
44566 <primary>options</primary>
44567 <secondary><command>plaintext</command> authenticator (client)</secondary>
44569 The <command>plaintext</command> authenticator has two client options:
44572 <indexterm role="option">
44573 <primary><option>client_ignore_invalid_base64</option></primary>
44576 <informaltable frame="all">
44577 <tgroup cols="4" colsep="0" rowsep="0">
44578 <colspec colwidth="8*" align="left"/>
44579 <colspec colwidth="5*" align="center"/>
44580 <colspec colwidth="5*" align="center"/>
44581 <colspec colwidth="6*" align="right"/>
44584 <entry><option>client_ignore_invalid_base64</option></entry>
44585 <entry>Use: <emphasis>plaintext</emphasis></entry>
44586 <entry>Type: <emphasis>boolean</emphasis></entry>
44587 <entry>Default: <emphasis>false</emphasis></entry>
44593 If the client receives a server prompt that is not a valid base64 string,
44594 authentication is abandoned by default. However, if this option is set true,
44595 the error in the challenge is ignored and the client sends the response as
44599 <indexterm role="option">
44600 <primary><option>client_send</option></primary>
44603 <informaltable frame="all">
44604 <tgroup cols="4" colsep="0" rowsep="0">
44605 <colspec colwidth="8*" align="left"/>
44606 <colspec colwidth="5*" align="center"/>
44607 <colspec colwidth="5*" align="center"/>
44608 <colspec colwidth="6*" align="right"/>
44611 <entry><option>client_send</option></entry>
44612 <entry>Use: <emphasis>plaintext</emphasis></entry>
44613 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44614 <entry>Default: <emphasis>unset</emphasis></entry>
44620 The string is a colon-separated list of authentication data strings. Each
44621 string is independently expanded before being sent to the server. The first
44622 string is sent with the AUTH command; any more strings are sent in response
44623 to prompts from the server. Before each string is expanded, the value of the
44624 most recent prompt is placed in the next <varname>$auth</varname><<emphasis>n</emphasis>> variable, starting
44625 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
44626 way. Thus, the prompt that is received in response to sending the first string
44627 (with the AUTH command) can be used in the expansion of the second string, and
44628 so on. If an invalid base64 string is received when
44629 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
44630 <varname>$auth</varname><<emphasis>n</emphasis>> variable.
44633 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
44634 splitting takes priority and happens first.
44637 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
44638 the data, further processing is applied to each string before it is sent. If
44639 there are any single circumflex characters in the string, they are converted to
44640 NULs. Should an actual circumflex be required as data, it must be doubled in
44644 This is an example of a client configuration that implements the PLAIN
44645 authentication mechanism with a fixed user name and password:
44647 <literallayout class="monospaced">
44650 public_name = PLAIN
44651 client_send = ^username^mysecret
44654 The lack of colons means that the entire text is sent with the AUTH
44655 command, with the circumflex characters converted to NULs. A similar example
44656 that uses the LOGIN mechanism is:
44658 <literallayout class="monospaced">
44661 public_name = LOGIN
44662 client_send = : username : mysecret
44665 The initial colon means that the first string is empty, so no data is sent with
44666 the AUTH command itself. The remaining strings are sent in response to
44668 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
44669 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
44675 <title>The cram_md5 authenticator</title>
44677 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
44678 <primary><command>cram_md5</command> authenticator</primary>
44680 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
44681 <primary>authenticators</primary>
44682 <secondary><command>cram_md5</command></secondary>
44684 <indexterm role="concept">
44685 <primary>CRAM-MD5 authentication mechanism</primary>
44687 <indexterm role="concept">
44688 <primary>authentication</primary>
44689 <secondary>CRAM-MD5 mechanism</secondary>
44691 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
44692 sends a challenge string to the client, and the response consists of a user
44693 name and the CRAM-MD5 digest of the challenge string combined with a secret
44694 string (password) which is known to both server and client. Thus, the secret
44695 is not sent over the network as plain text, which makes this authenticator more
44696 secure than <command>plaintext</command>. However, the downside is that the secret has to be
44697 available in plain text at either end.
44700 <title>Using cram_md5 as a server</title>
44702 <indexterm role="concept">
44703 <primary>options</primary>
44704 <secondary><command>cram_md5</command> authenticator (server)</secondary>
44706 This authenticator has one server option, which must be set to configure the
44707 authenticator as a server:
44710 <indexterm role="option">
44711 <primary><option>server_secret</option></primary>
44714 <informaltable frame="all">
44715 <tgroup cols="4" colsep="0" rowsep="0">
44716 <colspec colwidth="8*" align="left"/>
44717 <colspec colwidth="5*" align="center"/>
44718 <colspec colwidth="5*" align="center"/>
44719 <colspec colwidth="6*" align="right"/>
44722 <entry><option>server_secret</option></entry>
44723 <entry>Use: <emphasis>cram_md5</emphasis></entry>
44724 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44725 <entry>Default: <emphasis>unset</emphasis></entry>
44731 <indexterm role="concept">
44732 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
44733 <secondary>in <command>cram_md5</command> authenticator</secondary>
44735 When the server receives the client’s response, the user name is placed in
44736 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
44737 obtain the password for that user. The server then computes the CRAM-MD5 digest
44738 that the client should have sent, and checks that it received the correct
44739 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
44740 fails. If the expansion fails for some other reason, a temporary error code is
44741 returned to the client.
44744 For compatibility with previous releases of Exim, the user name is also placed
44745 in <varname>$1</varname>. However, the use of this variables for this purpose is now
44746 deprecated, as it can lead to confusion in string expansions that also use
44747 numeric variables for other things.
44750 For example, the following authenticator checks that the user name given by the
44751 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
44752 user name, authentication fails.
44754 <literallayout class="monospaced">
44757 public_name = CRAM-MD5
44758 server_secret = ${if eq{$auth1}{ph10}{secret}fail}
44759 server_set_id = $auth1
44762 <indexterm role="concept">
44763 <primary><varname>$authenticated_id</varname></primary>
44765 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
44766 name in <varname>$authenticated_id</varname>. A more tyical configuration might look up the
44767 secret string in a file, using the user name as the key. For example:
44769 <literallayout class="monospaced">
44772 public_name = CRAM-MD5
44773 server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}{$value}fail}
44774 server_set_id = $auth1
44777 Note that this expansion explicitly forces failure if the lookup fails
44778 because <varname>$1</varname> contains an unknown user name.
44782 <title>Using cram_md5 as a client</title>
44784 <indexterm role="concept">
44785 <primary>options</primary>
44786 <secondary><command>cram_md5</command> authenticator (client)</secondary>
44788 When used as a client, the <command>cram_md5</command> authenticator has two options:
44791 <indexterm role="option">
44792 <primary><option>client_name</option></primary>
44795 <informaltable frame="all">
44796 <tgroup cols="4" colsep="0" rowsep="0">
44797 <colspec colwidth="8*" align="left"/>
44798 <colspec colwidth="5*" align="center"/>
44799 <colspec colwidth="5*" align="center"/>
44800 <colspec colwidth="6*" align="right"/>
44803 <entry><option>client_name</option></entry>
44804 <entry>Use: <emphasis>cram_md5</emphasis></entry>
44805 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44806 <entry>Default: <emphasis>the primary host name</emphasis></entry>
44812 This string is expanded, and the result used as the user name data when
44813 computing the response to the server’s challenge.
44816 <indexterm role="option">
44817 <primary><option>client_secret</option></primary>
44820 <informaltable frame="all">
44821 <tgroup cols="4" colsep="0" rowsep="0">
44822 <colspec colwidth="8*" align="left"/>
44823 <colspec colwidth="5*" align="center"/>
44824 <colspec colwidth="5*" align="center"/>
44825 <colspec colwidth="6*" align="right"/>
44828 <entry><option>client_secret</option></entry>
44829 <entry>Use: <emphasis>cram_md5</emphasis></entry>
44830 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44831 <entry>Default: <emphasis>unset</emphasis></entry>
44837 This option must be set for the authenticator to work as a client. Its value is
44838 expanded and the result used as the secret string when computing the response.
44841 <indexterm role="concept">
44842 <primary><varname>$host</varname></primary>
44844 <indexterm role="concept">
44845 <primary><varname>$host_address</varname></primary>
44847 Different user names and secrets can be used for different servers by referring
44848 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
44849 expansion string is treated as an indication that this authenticator is not
44850 prepared to handle this case. Exim moves on to the next configured client
44851 authenticator. Any other expansion failure causes Exim to give up trying to
44852 send the message to the current server.
44855 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
44858 <literallayout class="monospaced">
44861 public_name = CRAM-MD5
44863 client_secret = secret
44866 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
44867 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
44873 <title>The cyrus_sasl authenticator</title>
44875 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
44876 <primary><command>cyrus_sasl</command> authenticator</primary>
44878 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
44879 <primary>authenticators</primary>
44880 <secondary><command>cyrus_sasl</command></secondary>
44882 <indexterm role="concept">
44883 <primary>Cyrus</primary>
44884 <secondary>SASL library</secondary>
44886 <indexterm role="concept">
44887 <primary>Kerberos</primary>
44889 The code for this authenticator was provided by Matthew Byng-Maddick of A L
44890 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
44893 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
44894 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
44895 Layer</quote>). This library supports a number of authentication mechanisms,
44896 including PLAIN and LOGIN, but also several others that Exim does not support
44897 directly. In particular, there is support for Kerberos authentication.
44900 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
44901 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
44902 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
44903 name of the driver to determine which mechanism to support.
44906 Where access to some kind of secret file is required, for example in GSSAPI
44907 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
44908 user, and that the Cyrus SASL library has no way of escalating privileges
44909 by default. You may also find you need to set environment variables,
44910 depending on the driver you are using.
44912 <para revisionflag="changed">
44913 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
44914 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
44915 Kerberos, note that because of limitations in the GSSAPI interface,
44916 changing the server keytab might need to be communicated down to the Kerberos
44917 layer independently. The mechanism for doing so is dependent upon the Kerberos
44918 implementation. For example, for Heimdal, the environment variable KRB5_KTNAME
44919 may be set to point to an alternative keytab file. Exim will pass this
44920 variable through from its own inherited environment when started as root or the
44921 Exim user. The keytab file needs to be readable by the Exim user.
44924 <title>Using cyrus_sasl as a server</title>
44926 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
44927 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
44928 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
44929 use of this variable for this purpose is now deprecated, as it can lead to
44930 confusion in string expansions that also use numeric variables for other
44934 <indexterm role="option">
44935 <primary><option>server_hostname</option></primary>
44938 <informaltable frame="all">
44939 <tgroup cols="4" colsep="0" rowsep="0">
44940 <colspec colwidth="8*" align="left"/>
44941 <colspec colwidth="5*" align="center"/>
44942 <colspec colwidth="5*" align="center"/>
44943 <colspec colwidth="6*" align="right"/>
44946 <entry><option>server_hostname</option></entry>
44947 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
44948 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44949 <entry>Default: <emphasis><literal>$primary_hostname</literal></emphasis></entry>
44955 This option selects the hostname that is used when communicating with
44956 the library. It is up to the underlying SASL plug-in what it does with
44960 <indexterm role="option">
44961 <primary><option>server_mech</option></primary>
44964 <informaltable frame="all">
44965 <tgroup cols="4" colsep="0" rowsep="0">
44966 <colspec colwidth="8*" align="left"/>
44967 <colspec colwidth="5*" align="center"/>
44968 <colspec colwidth="5*" align="center"/>
44969 <colspec colwidth="6*" align="right"/>
44972 <entry><option>server_mech</option></entry>
44973 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
44974 <entry>Type: <emphasis>string</emphasis></entry>
44975 <entry>Default: <emphasis><literal>public_name</literal></emphasis></entry>
44981 This option selects the authentication mechanism this driver should
44982 use. It allows you to use a different underlying mechanism from the
44983 advertised name. For example:
44985 <literallayout class="monospaced">
44987 driver = cyrus_sasl
44988 public_name = X-ANYTHING
44989 server_mech = CRAM-MD5
44990 server_set_id = $auth1
44993 <indexterm role="option">
44994 <primary><option>server_realm</option></primary>
44997 <informaltable frame="all">
44998 <tgroup cols="4" colsep="0" rowsep="0">
44999 <colspec colwidth="8*" align="left"/>
45000 <colspec colwidth="5*" align="center"/>
45001 <colspec colwidth="5*" align="center"/>
45002 <colspec colwidth="6*" align="right"/>
45005 <entry><option>server_realm</option></entry>
45006 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
45007 <entry>Type: <emphasis>string</emphasis></entry>
45008 <entry>Default: <emphasis>unset</emphasis></entry>
45014 This specifies the SASL realm that the server claims to be in.
45017 <indexterm role="option">
45018 <primary><option>server_service</option></primary>
45021 <informaltable frame="all">
45022 <tgroup cols="4" colsep="0" rowsep="0">
45023 <colspec colwidth="8*" align="left"/>
45024 <colspec colwidth="5*" align="center"/>
45025 <colspec colwidth="5*" align="center"/>
45026 <colspec colwidth="6*" align="right"/>
45029 <entry><option>server_service</option></entry>
45030 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
45031 <entry>Type: <emphasis>string</emphasis></entry>
45032 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
45038 This is the SASL service that the server claims to implement.
45041 For straightforward cases, you do not need to set any of the authenticator’s
45042 private options. All you need to do is to specify an appropriate mechanism as
45043 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
45044 PLAIN, you could have two authenticators as follows:
45046 <literallayout class="monospaced">
45048 driver = cyrus_sasl
45049 public_name = CRAM-MD5
45050 server_set_id = $auth1
45053 driver = cyrus_sasl
45054 public_name = PLAIN
45055 server_set_id = $auth1
45058 Cyrus SASL does implement the LOGIN authentication method, even though it is
45059 not a standard method. It is disabled by default in the source distribution,
45060 but it is present in many binary distributions.
45061 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
45062 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
45067 <chapter id="CHAPdovecot" revisionflag="changed">
45068 <title>The dovecot authenticator</title>
45069 <para revisionflag="changed">
45070 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
45071 <primary><command>dovecot</command> authenticator</primary>
45073 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
45074 <primary>authenticators</primary>
45075 <secondary><command>dovecot</command></secondary>
45077 This authenticator is an interface to the authentication facility of the
45078 Dovecot POP/IMAP server, which can support a number of authentication methods.
45079 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
45080 to use the same mechanisms for SMTP authentication. This is a server
45081 authenticator only. There is only one option:
45083 <para revisionflag="changed">
45084 <indexterm role="option">
45085 <primary><option>server_socket</option></primary>
45088 <informaltable frame="all" revisionflag="changed">
45089 <tgroup cols="4" colsep="0" rowsep="0">
45090 <colspec colwidth="8*" align="left"/>
45091 <colspec colwidth="5*" align="center"/>
45092 <colspec colwidth="5*" align="center"/>
45093 <colspec colwidth="6*" align="right"/>
45096 <entry><option>server_socket</option></entry>
45097 <entry>Use: <emphasis>dovecot</emphasis></entry>
45098 <entry>Type: <emphasis>string</emphasis></entry>
45099 <entry>Default: <emphasis>unset</emphasis></entry>
45104 <para revisionflag="changed">
45105 This option must specify the socket that is the interface to Dovecot
45106 authentication. The <option>public_name</option> option must specify an authentication
45107 mechanism that Dovecot is configured to support. You can have several
45108 authenticators for different mechanisms. For example:
45110 <literallayout class="monospaced" revisionflag="changed">
45113 public_name = PLAIN
45114 server_socket = /var/run/dovecot/auth-client
45115 server_setid = $auth1
45120 server_socket = /var/run/dovecot/auth-client
45121 server_setid = $auth1
45123 <para revisionflag="changed">
45124 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
45125 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
45126 option is passed in the Dovecot authentication command. If, for a TLS
45127 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
45129 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
45130 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
45134 <chapter id="CHAPspa">
45135 <title>The spa authenticator</title>
45137 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
45138 <primary><command>spa</command> authenticator</primary>
45140 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
45141 <primary>authenticators</primary>
45142 <secondary><command>spa</command></secondary>
45144 <indexterm role="concept">
45145 <primary>authentication</primary>
45146 <secondary>Microsoft Secure Password</secondary>
45148 <indexterm role="concept">
45149 <primary>authentication</primary>
45150 <secondary>NTLM</secondary>
45152 <indexterm role="concept">
45153 <primary>Microsoft Secure Password Authentication</primary>
45155 <indexterm role="concept">
45156 <primary>NTLM authentication</primary>
45158 The <command>spa</command> authenticator provides client support for Microsoft’s <emphasis>Secure
45159 Password Authentication</emphasis> mechanism,
45160 which is also sometimes known as NTLM (NT LanMan). The code for client side of
45161 this authenticator was contributed by Marc Prud’hommeaux, and much of it is
45162 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
45163 server side was subsequently contributed by Tom Kistner. The mechanism works as
45169 After the AUTH command has been accepted, the client sends an SPA
45170 authentication request based on the user name and optional domain.
45175 The server sends back a challenge.
45180 The client builds a challenge response which makes use of the user’s password
45181 and sends it to the server, which then accepts or rejects it.
45186 Encryption is used to protect the password in transit.
45189 <title>Using spa as a server</title>
45191 <indexterm role="concept">
45192 <primary>options</primary>
45193 <secondary><command>spa</command> authenticator (server)</secondary>
45195 The <command>spa</command> authenticator has just one server option:
45198 <indexterm role="option">
45199 <primary><option>server_password</option></primary>
45202 <informaltable frame="all">
45203 <tgroup cols="4" colsep="0" rowsep="0">
45204 <colspec colwidth="8*" align="left"/>
45205 <colspec colwidth="5*" align="center"/>
45206 <colspec colwidth="5*" align="center"/>
45207 <colspec colwidth="6*" align="right"/>
45210 <entry><option>server_password</option></entry>
45211 <entry>Use: <emphasis>spa</emphasis></entry>
45212 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45213 <entry>Default: <emphasis>unset</emphasis></entry>
45219 <indexterm role="concept">
45220 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
45221 <secondary>in <command>spa</command> authenticator</secondary>
45223 This option is expanded, and the result must be the cleartext password for the
45224 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
45225 compatibility with previous releases of Exim, the user name is also placed in
45226 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
45227 it can lead to confusion in string expansions that also use numeric variables
45228 for other things. For example:
45230 <literallayout class="monospaced">
45234 server_password = \
45235 ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
45238 If the expansion is forced to fail, authentication fails. Any other expansion
45239 failure causes a temporary error code to be returned.
45243 <title>Using spa as a client</title>
45245 <indexterm role="concept">
45246 <primary>options</primary>
45247 <secondary><command>spa</command> authenticator (client)</secondary>
45249 The <command>spa</command> authenticator has the following client options:
45252 <indexterm role="option">
45253 <primary><option>client_domain</option></primary>
45256 <informaltable frame="all">
45257 <tgroup cols="4" colsep="0" rowsep="0">
45258 <colspec colwidth="8*" align="left"/>
45259 <colspec colwidth="5*" align="center"/>
45260 <colspec colwidth="5*" align="center"/>
45261 <colspec colwidth="6*" align="right"/>
45264 <entry><option>client_domain</option></entry>
45265 <entry>Use: <emphasis>spa</emphasis></entry>
45266 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45267 <entry>Default: <emphasis>unset</emphasis></entry>
45273 This option specifies an optional domain for the authentication.
45276 <indexterm role="option">
45277 <primary><option>client_password</option></primary>
45280 <informaltable frame="all">
45281 <tgroup cols="4" colsep="0" rowsep="0">
45282 <colspec colwidth="8*" align="left"/>
45283 <colspec colwidth="5*" align="center"/>
45284 <colspec colwidth="5*" align="center"/>
45285 <colspec colwidth="6*" align="right"/>
45288 <entry><option>client_password</option></entry>
45289 <entry>Use: <emphasis>spa</emphasis></entry>
45290 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45291 <entry>Default: <emphasis>unset</emphasis></entry>
45297 This option specifies the user’s password, and must be set.
45300 <indexterm role="option">
45301 <primary><option>client_username</option></primary>
45304 <informaltable frame="all">
45305 <tgroup cols="4" colsep="0" rowsep="0">
45306 <colspec colwidth="8*" align="left"/>
45307 <colspec colwidth="5*" align="center"/>
45308 <colspec colwidth="5*" align="center"/>
45309 <colspec colwidth="6*" align="right"/>
45312 <entry><option>client_username</option></entry>
45313 <entry>Use: <emphasis>spa</emphasis></entry>
45314 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45315 <entry>Default: <emphasis>unset</emphasis></entry>
45321 This option specifies the user name, and must be set. Here is an example of a
45322 configuration of this authenticator for use with the mail servers at
45323 <emphasis>msn.com</emphasis>:
45325 <literallayout class="monospaced">
45329 client_username = msn/msn_username
45330 client_password = msn_plaintext_password
45331 client_domain = DOMAIN_OR_UNSET
45334 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
45335 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
45340 <chapter id="CHAPTLS">
45341 <title>Encrypted SMTP connections using TLS/SSL</title>
45342 <titleabbrev>Encrypted SMTP connections</titleabbrev>
45344 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
45345 <primary>encryption</primary>
45346 <secondary>on SMTP connection</secondary>
45348 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
45349 <primary>SMTP</primary>
45350 <secondary>encryption</secondary>
45352 <indexterm role="concept">
45353 <primary>TLS</primary>
45354 <secondary>on SMTP connection</secondary>
45356 <indexterm role="concept">
45357 <primary>OpenSSL</primary>
45359 <indexterm role="concept">
45360 <primary>GnuTLS</primary>
45362 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
45363 Sockets Layer), is implemented by making use of the OpenSSL library or the
45364 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
45365 cryptographic code in the Exim distribution itself for implementing TLS. In
45366 order to use this feature you must install OpenSSL or GnuTLS, and then build a
45367 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
45368 You also need to understand the basic concepts of encryption at a managerial
45369 level, and in particular, the way that public keys, private keys, and
45370 certificates are used.
45373 RFC 3207 defines how SMTP connections can make use of encryption. Once a
45374 connection is established, the client issues a STARTTLS command. If the
45375 server accepts this, the client and the server negotiate an encryption
45376 mechanism. If the negotiation succeeds, the data that subsequently passes
45377 between them is encrypted.
45380 Exim’s ACLs can detect whether the current SMTP session is encrypted or not,
45381 and if so, what cipher suite is in use, whether the client supplied a
45382 certificate, and whether or not that certificate was verified. This makes it
45383 possible for an Exim server to deny or accept certain commands based on the
45387 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
45388 disrupt TLS connections. You need to turn off SMTP scanning for these products
45389 in order to get TLS to work.
45392 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
45394 <indexterm role="concept">
45395 <primary>ssmtp protocol</primary>
45397 <indexterm role="concept">
45398 <primary>smtps protocol</primary>
45400 <indexterm role="concept">
45401 <primary>SMTP</primary>
45402 <secondary>ssmtp protocol</secondary>
45404 <indexterm role="concept">
45405 <primary>SMTP</primary>
45406 <secondary>smtps protocol</secondary>
45408 Early implementations of encrypted SMTP used a different TCP port from normal
45409 SMTP, and expected an encryption negotiation to start immediately, instead of
45410 waiting for a STARTTLS command from the client using the standard SMTP
45411 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
45412 allocated for this purpose.
45415 This approach was abandoned when encrypted SMTP was standardised, but there are
45416 still some legacy clients that use it. Exim supports these clients by means of
45417 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
45418 numbers; the most common use is expected to be:
45420 <literallayout class="monospaced">
45421 tls_on_connect_ports = 465
45424 The port numbers specified by this option apply to all SMTP connections, both
45425 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
45426 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
45427 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
45428 an extra port – rather, it specifies different behaviour on a port that is
45432 There is also a <option>-tls-on-connect</option> command line option. This overrides
45433 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
45436 <section id="SECTopenvsgnu">
45437 <title>OpenSSL vs GnuTLS</title>
45439 <indexterm role="concept">
45440 <primary>TLS</primary>
45441 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
45443 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
45444 followed later, when the first versions of GnuTLS were released. To build Exim
45445 to use GnuTLS, you need to set
45447 <literallayout class="monospaced">
45451 in Local/Makefile, in addition to
45453 <literallayout class="monospaced">
45457 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
45458 include files and libraries for GnuTLS can be found.
45461 There are some differences in usage when using GnuTLS instead of OpenSSL:
45466 The <option>tls_verify_certificates</option> option must contain the name of a file, not the
45467 name of a directory (for OpenSSL it can be either).
45472 The <option>tls_dhparam</option> option is ignored, because early versions of GnuTLS had no
45473 facility for varying its Diffie-Hellman parameters. I understand that this has
45474 changed, but Exim has not been updated to provide this facility.
45479 <indexterm role="concept">
45480 <primary><varname>$tls_peerdn</varname></primary>
45482 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
45483 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
45484 affects the value of the <varname>$tls_peerdn</varname> variable.
45489 OpenSSL identifies cipher suites using hyphens as separators, for example:
45490 DES-CBC3-SHA. GnuTLS uses underscores, for example: RSA_ARCFOUR_SHA. What is
45491 more, OpenSSL complains if underscores are present in a cipher list. To make
45492 life simpler, Exim changes underscores to hyhens for OpenSSL and hyphens to
45493 underscores for GnuTLS when processing lists of cipher suites in the
45494 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
45500 The <option>tls_require_ciphers</option> options operate differently, as described in the
45501 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
45507 <title>GnuTLS parameter computation</title>
45509 GnuTLS uses RSA and D-H parameters that may take a substantial amount of time
45510 to compute. It is unreasonable to re-compute them for every TLS session.
45511 Therefore, Exim keeps this data in a file in its spool directory, called
45512 <filename>gnutls-params</filename>. The file is owned by the Exim user and is readable only by
45513 its owner. Every Exim process that start up GnuTLS reads the RSA and D-H
45514 parameters from this file. If the file does not exist, the first Exim process
45515 that needs it computes the data and writes it to a temporary file which is
45516 renamed once it is complete. It does not matter if several Exim processes do
45517 this simultaneously (apart from wasting a few resources). Once a file is in
45518 place, new Exim processes immediately start using it.
45521 For maximum security, the parameters that are stored in this file should be
45522 recalculated periodically, the frequency depending on your paranoia level.
45523 Arranging this is easy in principle; just delete the file when you want new
45524 values to be computed. However, there may be a problem. The calculation of new
45525 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
45526 If the system is not very active, <filename>/dev/random</filename> may delay returning data
45527 until enough randomness (entropy) is available. This may cause Exim to hang for
45528 a substantial amount of time, causing timeouts on incoming connections.
45531 The solution is to generate the parameters externally to Exim. They are stored
45532 in <filename>gnutls-params</filename> in PEM format, which means that they can be generated
45533 externally using the <command>certtool</command> command that is part of GnuTLS.
45536 To replace the parameters with new ones, instead of deleting the file
45537 and letting Exim re-create it, you can generate new parameters using
45538 <command>certtool</command> and, when this has been done, replace Exim’s cache file by
45539 renaming. The relevant commands are something like this:
45541 <literallayout class="monospaced">
45544 # chown exim:exim new-params
45545 # chmod 0400 new-params
45546 # certtool --generate-privkey --bits 512 >new-params
45547 # echo "" >>new-params
45548 # certtool --generate-dh-params --bits 1024 >> new-params
45549 # mv new-params gnutls-params
45552 If Exim never has to generate the parameters itself, the possibility of
45553 stalling is removed.
45556 <section id="SECTreqciphssl">
45557 <title>Requiring specific ciphers in OpenSSL</title>
45559 <indexterm role="concept">
45560 <primary>TLS</primary>
45561 <secondary>requiring specific ciphers (OpenSSL)</secondary>
45563 <indexterm role="concept">
45564 <primary><option>tls_require_ciphers</option></primary>
45565 <secondary>OpenSSL</secondary>
45567 There is a function in the OpenSSL library that can be passed a list of cipher
45568 suites before the cipher negotiation takes place. This specifies which ciphers
45569 are acceptable. The list is colon separated and may contain names like
45570 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
45571 directly to this function call. The following quotation from the OpenSSL
45572 documentation specifies what forms of item are allowed in the cipher string:
45577 It can consist of a single cipher suite such as RC4-SHA.
45582 It can represent a list of cipher suites containing a certain algorithm,
45583 or cipher suites of a certain type. For example SHA1 represents all
45584 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
45590 Lists of cipher suites can be combined in a single cipher string using
45591 the + character. This is used as a logical and operation. For example
45592 SHA1+DES represents all cipher suites containing the SHA1 and the DES
45598 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
45599 <literal>-</literal> or <literal>+</literal>.
45604 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
45605 ciphers deleted can never reappear in the list even if they are explicitly
45611 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
45612 of the ciphers can be added again by later options.
45617 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
45618 option does not add any new ciphers; it just moves matching existing ones.
45623 If none of these characters is present, the string is interpreted as
45624 a list of ciphers to be appended to the current preference list. If the list
45625 includes any ciphers already present they will be ignored: that is, they will
45626 not be moved to the end of the list.
45629 <section id="SECTreqciphgnu">
45630 <title>Requiring specific ciphers in GnuTLS</title>
45632 <indexterm role="concept">
45633 <primary>TLS</primary>
45634 <secondary>requiring specific ciphers (GnuTLS)</secondary>
45636 <indexterm role="concept">
45637 <primary><option>tls_require_ciphers</option></primary>
45638 <secondary>GnuTLS</secondary>
45640 The GnuTLS library does not have a combined function like OpenSSL. Instead,
45641 it allows the caller to specify separate lists of key-exchange methods,
45642 main cipher algorithms, and MAC algorithms. Unfortunately, these lists are
45643 numerical, and the library does not have a function for turning names into
45644 numbers. Consequently, the list of recognized names has to be built into
45648 At present, Exim permits only the list of main cipher algorithms to be
45649 changed. The <option>tls_require_ciphers</option> option is in the same format as for
45650 OpenSSL. Exim searches each item for the name of available algorithm. For
45651 example, if the list contains RSA_AES_SHA then AES is recognized.
45654 The cipher algorithms list starts out with a default set of algorithms. If
45655 the first item in <option>tls_require_ciphers</option> does <emphasis>not</emphasis> start with an
45656 exclamation mark, all the default items are deleted. Thus, only those specified
45657 can be used. If the first item in <option>tls_require_ciphers</option> <emphasis>does</emphasis> start with
45658 an exclamation mark, the defaults are left on the list.
45661 Then, any item that starts with an exclamation mark causes the relevant
45662 algorithms to be removed from the list, and any item that does not start
45663 with an exclamation mark causes the relevant algorithms to be added to the
45666 <literallayout class="monospaced">
45667 tls_require_ciphers = !RSA_ARCFOUR_SHA
45670 allows all the defaults except those that use ARCFOUR, whereas
45672 <literallayout class="monospaced">
45673 tls_require_ciphers = AES : 3DES
45676 allows only cipher suites that use AES and 3DES. The currently recognized
45677 algorithms are: AES_256, AES_128, AES (both of the preceding), 3DES, and
45678 ARCFOUR_128. Unrecognized algorithms are ignored. In a server, the order of the
45679 list is unimportant; the server will advertise the availability of all the
45680 relevant cipher suites. However, in a client, the order of the list specifies a
45681 preference order for the algorithms. The first one in the client’s list that is
45682 also advertised by the server is tried first. The default order is as listed
45687 <title>Configuring an Exim server to use TLS</title>
45689 <indexterm role="concept">
45690 <primary>TLS</primary>
45691 <secondary>configuring an Exim server</secondary>
45693 When Exim has been built with TLS support, it advertises the availability of
45694 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
45695 but not to any others. The default value of this option is unset, which means
45696 that STARTTLS is not advertised at all. This default is chosen because you
45697 need to set some other options in order to make TLS avaliable, and also it is
45698 sensible for systems that want to use TLS only as a client.
45701 If a client issues a STARTTLS command and there is some configuration
45702 problem in the server, the command is rejected with a 454 error. If the client
45703 persists in trying to issue SMTP commands, all except QUIT are rejected
45706 <literallayout class="monospaced">
45707 554 Security failure
45710 If a STARTTLS command is issued within an existing TLS session, it is
45711 rejected with a 554 error code.
45714 To enable TLS operations on a server, you must set <option>tls_advertise_hosts</option> to
45715 match some hosts. You can, of course, set it to * to match all hosts.
45716 However, this is not all you need to do. TLS sessions to a server won’t work
45717 without some further configuration at the server end.
45720 It is rumoured that all existing clients that support TLS/SSL use RSA
45721 encryption. To make this work you need to set, in the server,
45723 <literallayout class="monospaced">
45724 tls_certificate = /some/file/name
45725 tls_privatekey = /some/file/name
45728 These options are, in fact, expanded strings, so you can make them depend on
45729 the identity of the client that is connected if you wish. The first file
45730 contains the server’s X509 certificate, and the second contains the private key
45731 that goes with it. These files need to be readable by the Exim user, and must
45732 always be given as full path names. They can be the same file if both the
45733 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
45734 set, or if its expansion is forced to fail or results in an empty string, this
45735 is assumed to be the case. The certificate file may also contain intermediate
45736 certificates that need to be sent to the client to enable it to authenticate
45737 the server’s certificate.
45740 If you do not understand about certificates and keys, please try to find a
45741 source of this background information, which is not Exim-specific. (There are a
45742 few comments below in section <xref linkend="SECTcerandall"/>.)
45745 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client –
45746 they apply only in the case of a server. If you need to use a certificate in an
45747 Exim client, you must set the options of the same names in an <command>smtp</command>
45751 With just these options, an Exim server will be able to use TLS. It does not
45752 require the client to have a certificate (but see below for how to insist on
45753 this). There is one other option that may be needed in other situations. If
45755 <literallayout class="monospaced">
45756 tls_dhparam = /some/file/name
45759 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
45760 with the parameters contained in the file. This increases the set of cipher
45761 suites that the server supports. See the command
45763 <literallayout class="monospaced">
45767 for a way of generating this data. At present, <option>tls_dhparam</option> is used only
45768 when Exim is linked with OpenSSL. It is ignored if GnuTLS is being used.
45771 The strings supplied for these three options are expanded every time a client
45772 host connects. It is therefore possible to use different certificates and keys
45773 for different hosts, if you so wish, by making use of the client’s IP address
45774 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
45775 forced to fail, Exim behaves as if the option is not set.
45778 <indexterm role="concept">
45779 <primary>cipher</primary>
45780 <secondary>logging</secondary>
45782 <indexterm role="concept">
45783 <primary>log</primary>
45784 <secondary>TLS cipher</secondary>
45786 <indexterm role="concept">
45787 <primary><varname>$tls_cipher</varname></primary>
45789 The variable <varname>$tls_cipher</varname> is set to the cipher suite that was negotiated for
45790 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
45791 incoming message (by default – you can, of course, change this), and it is
45792 also included in the log line that records a message’s arrival, keyed by
45793 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
45794 condition can be used to test for specific cipher suites in ACLs.
45797 The ACLs that run for subsequent SMTP commands can check the name of the cipher
45798 suite and vary their actions accordingly. The cipher suite names are those used
45799 by OpenSSL. These may differ from the names used elsewhere. For example,
45800 OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other contexts
45801 is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL
45802 documentation for more details.
45806 <title>Requesting and verifying client certificates</title>
45808 <indexterm role="concept">
45809 <primary>certificate</primary>
45810 <secondary>verification of client</secondary>
45812 <indexterm role="concept">
45813 <primary>TLS</primary>
45814 <secondary>client certificate verification</secondary>
45816 If you want an Exim server to request a certificate when negotiating a TLS
45817 session with a client, you must set either <option>tls_verify_hosts</option> or
45818 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
45819 apply to all TLS connections. For any host that matches one of these options,
45820 Exim requests a certificate as part of the setup of the TLS session. The
45821 contents of the certificate are verified by comparing it with a list of
45822 expected certificates. These must be available in a file or,
45823 for OpenSSL only (not GnuTLS), a directory, identified by
45824 <option>tls_verify_certificates</option>.
45827 A file can contain multiple certificates, concatenated end to end. If a
45830 each certificate must be in a separate file, with a name (or a symbolic link)
45831 of the form <<emphasis>hash</emphasis>>.0, where <<emphasis>hash</emphasis>> is a hash value constructed from the
45832 certificate. You can compute the relevant hash by running the command
45834 <literallayout class="monospaced">
45835 openssl x509 -hash -noout -in /cert/file
45838 where <filename>/cert/file</filename> contains a single certificate.
45841 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
45842 what happens if the client does not supply a certificate, or if the certificate
45843 does not match any of the certificates in the collection named by
45844 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
45845 attempt to set up a TLS session is aborted, and the incoming connection is
45846 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
45847 session continues. ACLs that run for subsequent SMTP commands can detect the
45848 fact that no certificate was verified, and vary their actions accordingly. For
45849 example, you can insist on a certificate before accepting a message for
45850 relaying, but not when the message is destined for local delivery.
45853 <indexterm role="concept">
45854 <primary><varname>$tls_peerdn</varname></primary>
45856 When a client supplies a certificate (whether it verifies or not), the value of
45857 the Distinguished Name of the certificate is made available in the variable
45858 <varname>$tls_peerdn</varname> during subsequent processing of the message.
45861 <indexterm role="concept">
45862 <primary>log</primary>
45863 <secondary>distinguished name</secondary>
45865 Because it is often a long text string, it is not included in the log line or
45866 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
45867 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
45868 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
45869 certificate is supplied, <varname>$tls_peerdn</varname> is empty.
45873 <title>Revoked certificates</title>
45875 <indexterm role="concept">
45876 <primary>TLS</primary>
45877 <secondary>revoked certificates</secondary>
45879 <indexterm role="concept">
45880 <primary>revocation list</primary>
45882 <indexterm role="concept">
45883 <primary>certificate</primary>
45884 <secondary>revocation list</secondary>
45886 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
45887 certificates are revoked. If you have such a list, you can pass it to an Exim
45888 server using the global option called <option>tls_crl</option> and to an Exim client using
45889 an identically named option for the <command>smtp</command> transport. In each case, the value
45890 of the option is expanded and must then be the name of a file that contains a
45895 <title>Configuring an Exim client to use TLS</title>
45897 <indexterm role="concept">
45898 <primary>cipher</primary>
45899 <secondary>logging</secondary>
45901 <indexterm role="concept">
45902 <primary>log</primary>
45903 <secondary>TLS cipher</secondary>
45905 <indexterm role="concept">
45906 <primary>log</primary>
45907 <secondary>distinguished name</secondary>
45909 <indexterm role="concept">
45910 <primary>TLS</primary>
45911 <secondary>configuring an Exim client</secondary>
45913 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
45914 deliveries as well as to incoming, the latter one causing logging of the
45915 server certificate’s DN. The remaining client configuration for TLS is all
45916 within the <command>smtp</command> transport.
45919 It is not necessary to set any options to have TLS work in the <command>smtp</command>
45920 transport. If Exim is built with TLS support, and TLS is advertised by a
45921 server, the <command>smtp</command> transport always tries to start a TLS session. However,
45922 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
45923 transport) to a list of server hosts for which TLS should not be used.
45926 If you do not want Exim to attempt to send messages unencrypted when an attempt
45927 to set up an encrypted connection fails in any way, you can set
45928 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
45929 those hosts, delivery is always deferred if an encrypted connection cannot be
45930 set up. If there are any other hosts for the address, they are tried in the
45934 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
45935 the message unencrypted. It always does this if the response to STARTTLS is
45936 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
45937 session after a success response code, what happens is controlled by the
45938 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
45939 delivery to this host is deferred, and other hosts (if available) are tried. If
45940 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
45941 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
45942 negotiation fails, Exim closes the current connection (because it is in an
45943 unknown state), opens a new one to the same host, and then tries the delivery
45947 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
45948 transport provide the client with a certificate, which is passed to the server
45949 if it requests it. If the server is Exim, it will request a certificate only if
45950 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client. <emphasis role="bold">Note</emphasis>:
45951 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
45952 is operating as a client. Exim does not assume that a server certificate (set
45953 by the global options of the same name) should also be used when operating as a
45957 If <option>tls_verify_certificates</option> is set, it must name a file or,
45958 for OpenSSL only (not GnuTLS), a directory, that contains a collection of
45959 expected server certificates. The client verifies the server’s certificate
45960 against this collection, taking into account any revoked certificates that are
45961 in the list defined by <option>tls_crl</option>.
45965 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
45966 list of permitted cipher suites. If either of these checks fails, delivery to
45967 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
45968 alternative hosts, if any.
45971 <indexterm role="concept">
45972 <primary><varname>$host</varname></primary>
45974 <indexterm role="concept">
45975 <primary><varname>$host_address</varname></primary>
45977 All the TLS options in the <command>smtp</command> transport are expanded before use, with
45978 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
45979 which the client is connected. Forced failure of an expansion causes Exim to
45980 behave as if the relevant option were unset.
45983 <section id="SECTmulmessam">
45984 <title>Multiple messages on the same encrypted TCP/IP connection</title>
45986 <indexterm role="concept">
45987 <primary>multiple SMTP deliveries with TLS</primary>
45989 <indexterm role="concept">
45990 <primary>TLS</primary>
45991 <secondary>multiple message deliveries</secondary>
45993 Exim sends multiple messages down the same TCP/IP connection by starting up
45994 an entirely new delivery process for each message, passing the socket from
45995 one process to the next. This implementation does not fit well with the use
45996 of TLS, because there is quite a lot of state information associated with a TLS
45997 connection, not just a socket identification. Passing all the state information
45998 to a new process is not feasible. Consequently, Exim shuts down an existing TLS
45999 session before passing the socket to a new process. The new process may then
46000 try to start a new TLS session, and if successful, may try to re-authenticate
46001 if AUTH is in use, before sending the next message.
46004 The RFC is not clear as to whether or not an SMTP session continues in clear
46005 after TLS has been shut down, or whether TLS may be restarted again later, as
46006 just described. However, if the server is Exim, this shutdown and
46007 reinitialization works. It is not known which (if any) other servers operate
46008 successfully if the client closes a TLS session and continues with unencrypted
46009 SMTP, but there are certainly some that do not work. For such servers, Exim
46010 should not pass the socket to another process, because the failure of the
46011 subsequent attempt to use it would cause Exim to record a temporary host error,
46012 and delay other deliveries to that host.
46015 To test for this case, Exim sends an EHLO command to the server after
46016 closing down the TLS session. If this fails in any way, the connection is
46017 closed instead of being passed to a new delivery process, but no retry
46018 information is recorded.
46021 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
46022 <command>smtp</command> transport to match those hosts for which Exim should not pass
46023 connections to new processes if TLS has been used.
46026 <section id="SECTcerandall">
46027 <title>Certificates and all that</title>
46029 <indexterm role="concept">
46030 <primary>certificate</primary>
46031 <secondary>references to discussion</secondary>
46033 In order to understand fully how TLS works, you need to know about
46034 certificates, certificate signing, and certificate authorities. This is not the
46035 place to give a tutorial, especially as I do not know very much about it
46036 myself. Some helpful introduction can be found in the FAQ for the SSL addition
46037 to Apache, currently at
46040 <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>
46043 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
46044 links to further files.
46045 Eric Rescorla’s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
46046 0-201-61598-3), contains both introductory and more in-depth descriptions.
46047 Some sample programs taken from the book are available from
46050 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
46054 <title>Certificate chains</title>
46056 The file named by <option>tls_certificate</option> may contain more than one
46057 certificate. This is useful in the case where the certificate that is being
46058 sent is validated by an intermediate certificate which the other end does
46059 not have. Multiple certificates must be in the correct order in the file.
46060 First the host’s certificate itself, then the first intermediate
46061 certificate to validate the issuer of the host certificate, then the next
46062 intermediate certificate to validate the issuer of the first intermediate
46063 certificate, and so on, until finally (optionally) the root certificate.
46064 The root certificate must already be trusted by the recipient for
46065 validation to succeed, of course, but if it’s not preinstalled, sending the
46066 root certificate along with the rest makes it available for the user to
46067 install if the receiving end is a client MUA that can interact with a user.
46071 <title>Self-signed certificates</title>
46073 <indexterm role="concept">
46074 <primary>certificate</primary>
46075 <secondary>self-signed</secondary>
46077 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
46078 with OpenSSL, like this:
46080 <literallayout class="monospaced">
46081 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
46085 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
46086 delimited and so can be identified independently. The <option>-days</option> option
46087 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
46088 important: if you do not set it, the key is encrypted with a passphrase
46089 that you are prompted for, and any use that is made of the key causes more
46090 prompting for the passphrase. This is not helpful if you are going to use
46091 this certificate and key in an MTA, where prompting is not possible.
46094 A self-signed certificate made in this way is sufficient for testing, and
46095 may be adequate for all your requirements if you are mainly interested in
46096 encrypting transfers, and not in secure identification.
46099 However, many clients require that the certificate presented by the server be a
46100 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
46101 certificate. In this situation, the self-signed certificate described above
46102 must be installed on the client host as a trusted root <emphasis>certification
46103 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
46104 signed with that self-signed certificate.
46107 For information on creating self-signed CA certificates and using them to sign
46108 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
46109 Open-source PKI book, available online at
46110 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
46111 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
46112 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
46117 <chapter id="CHAPACL">
46118 <title>Access control lists</title>
46120 <indexterm role="concept" id="IIDacl" class="startofrange">
46121 <primary>access control lists (ACLs)</primary>
46122 <secondary>description</secondary>
46124 <indexterm role="concept">
46125 <primary>control of incoming mail</primary>
46127 <indexterm role="concept">
46128 <primary>message</primary>
46129 <secondary>controlling incoming</secondary>
46131 <indexterm role="concept">
46132 <primary>policy control</primary>
46133 <secondary>access control lists</secondary>
46135 Access Control Lists (ACLs) are defined in a separate section of the run time
46136 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
46137 name, terminated by a colon. Here is a complete ACL section that contains just
46138 one very small ACL:
46140 <literallayout class="monospaced">
46144 accept hosts = one.host.only
46147 You can have as many lists as you like in the ACL section, and the order in
46148 which they appear does not matter. The lists are self-terminating.
46151 The majority of ACLs are used to control Exim’s behaviour when it receives
46152 certain SMTP commands. This applies both to incoming TCP/IP connections, and
46153 when a local process submits a message using SMTP by specifying the <option>-bs</option>
46154 option. The most common use is for controlling which recipients are accepted
46155 in incoming messages. In addition, you can define an ACL that is used to check
46156 local non-SMTP messages. The default configuration file contains an example of
46157 a realistic ACL for checking RCPT commands. This is discussed in chapter
46158 <xref linkend="CHAPdefconfil"/>.
46161 <title>Testing ACLs</title>
46163 The <option>-bh</option> command line option provides a way of testing your ACL
46164 configuration locally by running a fake SMTP session with which you interact.
46165 The host <emphasis>relay-test.mail-abuse.org</emphasis> provides a service for checking your
46166 relaying configuration (see section <xref linkend="SECTcheralcon"/> for more details).
46170 <title>Specifying when ACLs are used</title>
46172 <indexterm role="concept">
46173 <primary>access control lists (ACLs)</primary>
46174 <secondary>options for specifying</secondary>
46176 In order to cause an ACL to be used, you have to name it in one of the relevant
46177 options in the main part of the configuration. These options are:
46178 <indexterm role="concept">
46179 <primary>AUTH</primary>
46180 <secondary>ACL for</secondary>
46182 <indexterm role="concept">
46183 <primary>DATA</primary>
46184 <secondary>ACLs for</secondary>
46186 <indexterm role="concept">
46187 <primary>ETRN</primary>
46188 <secondary>ACL for</secondary>
46190 <indexterm role="concept">
46191 <primary>EXPN</primary>
46192 <secondary>ACL for</secondary>
46194 <indexterm role="concept">
46195 <primary>HELO</primary>
46196 <secondary>ACL for</secondary>
46198 <indexterm role="concept">
46199 <primary>EHLO</primary>
46200 <secondary>ACL for</secondary>
46202 <indexterm role="concept">
46203 <primary>MAIL</primary>
46204 <secondary>ACL for</secondary>
46206 <indexterm role="concept">
46207 <primary>QUIT</primary>
46208 <secondary>ACL for</secondary>
46210 <indexterm role="concept">
46211 <primary>RCPT</primary>
46212 <secondary>ACL for</secondary>
46214 <indexterm role="concept">
46215 <primary>STARTTLS</primary>
46216 <secondary>ACL for</secondary>
46218 <indexterm role="concept">
46219 <primary>VRFY</primary>
46220 <secondary>ACL for</secondary>
46222 <indexterm role="concept">
46223 <primary>SMTP connection</primary>
46224 <secondary>ACL for</secondary>
46226 <indexterm role="concept">
46227 <primary>non-smtp message</primary>
46228 <secondary>ACLs for</secondary>
46230 <indexterm role="concept">
46231 <primary>MIME parts</primary>
46232 <secondary>ACL for</secondary>
46235 <informaltable frame="none">
46236 <tgroup cols="2" colsep="0" rowsep="0">
46237 <colspec colwidth="140pt" align="left"/>
46238 <colspec colwidth="254pt" align="left"/>
46241 <entry> <option>acl_not_smtp</option></entry>
46242 <entry>ACL for non-SMTP messages</entry>
46245 <entry> <option>acl_not_smtp_mime</option></entry>
46246 <entry>ACL for non-SMTP MIME parts</entry>
46249 <entry> <option>acl_not_smtp_start</option></entry>
46250 <entry>ACL at start of non-SMTP message</entry>
46253 <entry> <option>acl_smtp_auth</option></entry>
46254 <entry>ACL for AUTH</entry>
46257 <entry> <option>acl_smtp_connect</option></entry>
46258 <entry>ACL for start of SMTP connection</entry>
46261 <entry> <option>acl_smtp_data</option></entry>
46262 <entry>ACL after DATA is complete</entry>
46265 <entry> <option>acl_smtp_etrn</option></entry>
46266 <entry>ACL for ETRN</entry>
46269 <entry> <option>acl_smtp_expn</option></entry>
46270 <entry>ACL for EXPN</entry>
46273 <entry> <option>acl_smtp_helo</option></entry>
46274 <entry>ACL for HELO or EHLO</entry>
46277 <entry> <option>acl_smtp_mail</option></entry>
46278 <entry>ACL for MAIL</entry>
46281 <entry> <option>acl_smtp_mailauth</option></entry>
46282 <entry>ACL for the AUTH parameter of MAIL</entry>
46285 <entry> <option>acl_smtp_mime</option></entry>
46286 <entry>ACL for content-scanning MIME parts</entry>
46289 <entry> <option>acl_smtp_predata</option></entry>
46290 <entry>ACL at start of DATA command</entry>
46293 <entry> <option>acl_smtp_quit</option></entry>
46294 <entry>ACL for QUIT</entry>
46297 <entry> <option>acl_smtp_rcpt</option></entry>
46298 <entry>ACL for RCPT</entry>
46301 <entry> <option>acl_smtp_starttls</option></entry>
46302 <entry>ACL for STARTTLS</entry>
46305 <entry> <option>acl_smtp_vrfy</option></entry>
46306 <entry>ACL for VRFY</entry>
46312 For example, if you set
46314 <literallayout class="monospaced">
46315 acl_smtp_rcpt = small_acl
46318 the little ACL defined above is used whenever Exim receives a RCPT command
46319 in an SMTP dialogue. The majority of policy tests on incoming messages can be
46320 done when RCPT commands arrive. A rejection of RCPT should cause the
46321 sending MTA to give up on the recipient address contained in the RCPT
46322 command, whereas rejection at other times may cause the client MTA to keep on
46323 trying to deliver the message. It is therefore recommended that you do as much
46324 testing as possible at RCPT time.
46328 <title>The non-SMTP ACLs</title>
46330 <indexterm role="concept">
46331 <primary>non-smtp message</primary>
46332 <secondary>ACLs for</secondary>
46334 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
46335 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
46336 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
46337 the state of the SMTP connection such as encryption and authentication) are not
46338 relevant and are forbidden in these ACLs. However, the sender and recipients
46339 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
46340 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
46341 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
46342 in any of these ACLs.
46345 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
46346 non-SMTP message, before any of the message has been read. (This is the
46347 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) The result of this
46348 ACL is ignored; it cannot be used to reject a message. If you really need to,
46349 you could set a value in an ACL variable here and reject based on that in the
46350 <option>acl_not_smtp</option> ACL. However, this ACL can be used to set controls, and in
46351 particular, it can be used to set
46353 <literallayout class="monospaced">
46354 control = suppress_local_fixups
46357 This cannot be used in the other non-SMTP ACLs because by the time they are
46358 run, it is too late.
46361 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
46362 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
46365 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
46366 kind of rejection is treated as permanent, because there is no way of sending a
46367 temporary error for these kinds of message.
46371 <title>The SMTP connect ACL</title>
46372 <para revisionflag="changed">
46373 <indexterm role="concept">
46374 <primary>SMTP connection</primary>
46375 <secondary>ACL for</secondary>
46377 <indexterm role="concept">
46378 <primary><option>smtp_banner</option></primary>
46380 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
46381 session, after the test specified by <option>host_reject_connection</option> (which is now
46382 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
46383 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
46384 the message override the banner message that is otherwise specified by the
46385 <option>smtp_banner</option> option.
46388 <section revisionflag="changed">
46389 <title>The EHLO/HELO ACL</title>
46390 <para revisionflag="changed">
46391 <indexterm role="concept">
46392 <primary>EHLO</primary>
46393 <secondary>ACL for</secondary>
46395 <indexterm role="concept">
46396 <primary>HELO</primary>
46397 <secondary>ACL for</secondary>
46399 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
46400 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
46401 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
46402 Note that a client may issue more than one EHLO or HELO command in an SMTP
46403 session, and indeed is required to issue a new EHLO or HELO after successfully
46404 setting up encryption following a STARTTLS command.
46406 <para revisionflag="changed">
46407 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
46408 modifier, the message may not contain more than one line (it will be truncated
46409 at the first newline and a panic logged if it does). Such a message cannot
46410 affect the EHLO options that are listed on the second and subsequent lines of
46415 <title>The DATA ACLs</title>
46417 <indexterm role="concept">
46418 <primary>DATA</primary>
46419 <secondary>ACLs for</secondary>
46421 Two ACLs are associated with the DATA command, because it is two-stage
46422 command, with two responses being sent to the client.
46423 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
46424 is obeyed. This gives you control after all the RCPT commands, but before
46425 the message itself is received. It offers the opportunity to give a negative
46426 response to the DATA command before the data is transmitted. Header lines
46427 added by MAIL or RCPT ACLs are not visible at this time, but any that
46428 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
46431 You cannot test the contents of the message, for example, to verify addresses
46432 in the headers, at RCPT time or when the DATA command is received. Such
46433 tests have to appear in the ACL that is run after the message itself has been
46434 received, before the final response to the DATA command is sent. This is
46435 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
46436 associated with the DATA command.
46439 For both of these ACLs, it is not possible to reject individual recipients. An
46440 error response rejects the entire message. Unfortunately, it is known that some
46441 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
46442 before or after the data) correctly – they keep the message on their queues
46443 and try again later, but that is their problem, though it does waste some of
46448 <title>The SMTP MIME ACL</title>
46450 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
46451 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
46454 <section id="SECTQUITACL">
46455 <title>The QUIT ACL</title>
46457 <indexterm role="concept">
46458 <primary>QUIT</primary>
46459 <secondary>ACL for</secondary>
46461 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
46462 does not affect the response code to QUIT, which is always 221. Thus, the ACL
46463 does not in fact control any access. For this reason, the only verbs that are
46464 permitted are <option>accept</option> and <option>warn</option>.
46467 This ACL can be used for tasks such as custom logging at the end of an SMTP
46468 session. For example, you can use ACL variables in other ACLs to count
46469 messages, recipients, etc., and log the totals at QUIT time using one or
46470 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
46473 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
46474 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
46477 You do not need to have a final <option>accept</option>, but if you do, you can use a
46478 <option>message</option> modifier to specify custom text that is sent as part of the 221
46482 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
46483 failure (for example, failure to open a log file, or when Exim is bombing out
46484 because it has detected an unrecoverable error), all SMTP commands from the
46485 client are given temporary error responses until QUIT is received or the
46486 connection is closed. In these special cases, the QUIT ACL does not run.
46490 <title>Finding an ACL to use</title>
46492 <indexterm role="concept">
46493 <primary>access control lists (ACLs)</primary>
46494 <secondary>finding which to use</secondary>
46496 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
46497 you can use different ACLs in different circumstances. For example,
46499 <literallayout class="monospaced">
46500 acl_smtp_rcpt = ${if ={25}{$interface_port} \
46501 {acl_check_rcpt} {acl_check_rcpt_submit} }
46504 In the default configuration file there are some example settings for
46505 providing an RFC 4409 message submission service on port 587 and a
46506 non-standard <quote>smtps</quote> service on port 465. You can use a string
46507 expansion like this to choose an ACL for MUAs on these ports which is
46508 more appropriate for this purpose than the default ACL on port 25.
46511 The expanded string does not have to be the name of an ACL in the
46512 configuration file; there are other possibilities. Having expanded the
46513 string, Exim searches for an ACL as follows:
46518 If the string begins with a slash, Exim uses it as a file name, and reads its
46519 contents as an ACL. The lines are processed in the same way as lines in the
46520 Exim configuration file. In particular, continuation lines are supported, blank
46521 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
46522 If the file does not exist or cannot be read, an error occurs (typically
46523 causing a temporary failure of whatever caused the ACL to be run). For example:
46525 <literallayout class="monospaced">
46526 acl_smtp_data = /etc/acls/\
46527 ${lookup{$sender_host_address}lsearch\
46528 {/etc/acllist}{$value}{default}}
46531 This looks up an ACL file to use on the basis of the host’s IP address, falling
46532 back to a default if the lookup fails. If an ACL is successfully read from a
46533 file, it is retained in memory for the duration of the Exim process, so that it
46534 can be re-used without having to re-read the file.
46539 If the string does not start with a slash, and does not contain any spaces,
46540 Exim searches the ACL section of the configuration for an ACL whose name
46541 matches the string.
46546 If no named ACL is found, or if the string contains spaces, Exim parses
46547 the string as an inline ACL. This can save typing in cases where you just
46548 want to have something like
46550 <literallayout class="monospaced">
46551 acl_smtp_vrfy = accept
46554 in order to allow free use of the VRFY command. Such a string may contain
46555 newlines; it is processed in the same way as an ACL that is read from a file.
46561 <title>ACL return codes</title>
46563 <indexterm role="concept">
46564 <primary>access control lists (ACLs)</primary>
46565 <secondary>return codes</secondary>
46567 Except for the QUIT ACL, which does not affect the SMTP return code (see
46568 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
46569 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
46570 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
46571 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
46572 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
46573 This also causes a 4<emphasis>xx</emphasis> return code.
46576 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
46577 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
46578 submitters of non-SMTP messages.
46581 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
46582 has the effect of <quote>accept</quote>, but causes either the entire message or an
46583 individual recipient address to be discarded. In other words, it is a
46584 blackholing facility. Use it with care.
46587 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
46588 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
46589 RCPT ACL is to discard just the one recipient address. If there are no
46590 recipients left when the message’s data is received, the DATA ACL is not
46591 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
46592 remaining recipients. The <quote>discard</quote> return is not permitted for the
46593 <option>acl_smtp_predata</option> ACL.
46596 <indexterm role="concept">
46597 <primary><function>local_scan()</function> function</primary>
46598 <secondary>when all recipients discarded</secondary>
46600 The <function>local_scan()</function> function is always run, even if there are no remaining
46601 recipients; it may create new recipients.
46605 <title>Unset ACL options</title>
46607 <indexterm role="concept">
46608 <primary>access control lists (ACLs)</primary>
46609 <secondary>unset options</secondary>
46611 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
46612 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
46613 not defined at all. For any defined ACL, the default action when control
46614 reaches the end of the ACL statements is <quote>deny</quote>.
46617 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
46618 these two are ACLs that are used only for their side effects. They cannot be
46619 used to accept or reject anything.
46622 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
46623 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
46624 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
46625 when the ACL is not defined is <quote>accept</quote>.
46628 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
46629 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
46630 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
46631 messages over an SMTP connection. For an example, see the ACL in the default
46632 configuration file.
46636 <title>Data for message ACLs</title>
46638 <indexterm role="concept">
46639 <primary>access control lists (ACLs)</primary>
46640 <secondary>data for message ACL</secondary>
46642 <indexterm role="concept">
46643 <primary><varname>$domain</varname></primary>
46645 <indexterm role="concept">
46646 <primary><varname>$local_part</varname></primary>
46648 <indexterm role="concept">
46649 <primary><varname>$sender_address</varname></primary>
46651 <indexterm role="concept">
46652 <primary><varname>$sender_host_address</varname></primary>
46654 <indexterm role="concept">
46655 <primary><varname>$smtp_command</varname></primary>
46657 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
46658 that contain information about the host and the message’s sender (for example,
46659 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
46660 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
46661 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
46662 is available in <varname>$smtp_command</varname>.
46665 When an ACL for the AUTH parameter of MAIL is running, the variables that
46666 contain information about the host are set, but <varname>$sender_address</varname> is not yet
46667 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
46671 <indexterm role="concept">
46672 <primary><varname>$message_size</varname></primary>
46674 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
46675 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
46676 that parameter is not given. The value is updated to the true message size by
46677 the time the final DATA ACL is run (after the message data has been
46681 <indexterm role="concept">
46682 <primary><varname>$rcpt_count</varname></primary>
46684 <indexterm role="concept">
46685 <primary><varname>$recipients_count</varname></primary>
46687 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
46688 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
46689 accepted, so while an ACL for RCPT is being processed, it contains the number
46690 of previously accepted recipients. At DATA time (for both the DATA ACLs),
46691 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
46692 <varname>$recipients_count</varname> contains the total number of accepted recipients.
46695 <section id="SECTdatfornon">
46696 <title>Data for non-message ACLs</title>
46698 <indexterm role="concept">
46699 <primary>access control lists (ACLs)</primary>
46700 <secondary>data for non-message ACL</secondary>
46702 <indexterm role="concept">
46703 <primary><varname>$smtp_command_argument</varname></primary>
46705 <indexterm role="concept">
46706 <primary><varname>$smtp_command</varname></primary>
46708 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
46709 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
46710 and the entire SMTP command is available in <varname>$smtp_command</varname>.
46711 These variables can be tested using a <option>condition</option> condition. For example,
46712 here is an ACL for use with AUTH, which insists that either the session is
46713 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
46714 does not permit authentication methods that use cleartext passwords on
46715 unencrypted connections.
46717 <literallayout class="monospaced">
46719 accept encrypted = *
46720 accept condition = ${if eq{${uc:$smtp_command_argument}}\
46722 deny message = TLS encryption or CRAM-MD5 required
46725 (Another way of applying this restriction is to arrange for the authenticators
46726 that use cleartext passwords not to be advertised when the connection is not
46727 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
46728 option to do this.)
46732 <title>Format of an ACL</title>
46734 <indexterm role="concept">
46735 <primary>access control lists (ACLs)</primary>
46736 <secondary>format of</secondary>
46738 <indexterm role="concept">
46739 <primary>access control lists (ACLs)</primary>
46740 <secondary>verbs; definition of</secondary>
46742 An individual ACL consists of a number of statements. Each statement starts
46743 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
46744 Modifiers can change the way the verb operates, define error and log messages,
46745 set variables, insert delays, and vary the processing of accepted messages.
46748 If all the conditions are met, the verb is obeyed. The same condition may be
46749 used (with different arguments) more than once in the same statement. This
46750 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
46753 <literallayout class="monospaced">
46754 deny dnslists = list1.example
46755 dnslists = list2.example
46758 If there are no conditions, the verb is always obeyed. Exim stops evaluating
46759 the conditions and modifiers when it reaches a condition that fails. What
46760 happens then depends on the verb (and in one case, on a special modifier). Not
46761 all the conditions make sense at every testing point. For example, you cannot
46762 test a sender address in the ACL that is run for a VRFY command.
46766 <title>ACL verbs</title>
46768 The ACL verbs are as follows:
46773 <indexterm role="concept">
46774 <primary><option>accept</option></primary>
46775 <secondary>ACL verb</secondary>
46777 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
46778 of the conditions are not met, what happens depends on whether <option>endpass</option>
46779 appears among the conditions (for syntax see below). If the failing condition
46780 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
46781 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
46782 check a RCPT command:
46784 <literallayout class="monospaced">
46785 accept domains = +local_domains
46790 If the recipient domain does not match the <option>domains</option> condition, control
46791 passes to the next statement. If it does match, the recipient is verified, and
46792 the command is accepted if verification succeeds. However, if verification
46793 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
46794 <option>endpass</option>.
46796 <para revisionflag="changed">
46797 The <option>endpass</option> feature has turned out to be confusing to many people, so its
46798 use is not recommended nowadays. It is always possible to rewrite an ACL so
46799 that <option>endpass</option> is not needed, and it is no longer used in the default
46802 <para revisionflag="changed">
46803 <indexterm role="concept">
46804 <primary><option>message</option></primary>
46805 <secondary>ACL modifier, with <option>accept</option></secondary>
46807 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
46808 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
46809 (when an <option>accept</option> verb either accepts or passes control to the next
46810 statement), <option>message</option> can be used to vary the message that is sent when an
46811 SMTP command is accepted. For example, in a RCPT ACL you could have:
46813 <literallayout revisionflag="changed">
46814 <literal>accept </literal><<emphasis>some conditions</emphasis>>
46815 <literal> message = OK, I'll allow you through today</literal>
46817 <para revisionflag="changed">
46818 You can specify an SMTP response code, optionally followed by an <quote>extended
46819 response code</quote> at the start of the message, but the first digit must be the
46820 same as would be sent by default, which is 2 for an <option>accept</option> verb.
46822 <para revisionflag="changed">
46823 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
46824 an error message that is used when access is denied. This behaviour is retained
46825 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
46826 of <option>endpass</option>.
46831 <indexterm role="concept">
46832 <primary><option>defer</option></primary>
46833 <secondary>ACL verb</secondary>
46835 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
46836 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
46837 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
46838 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
46839 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
46840 be used in any ACL, and even for a recipient it might be a simpler approach.
46845 <indexterm role="concept">
46846 <primary><option>deny</option></primary>
46847 <secondary>ACL verb</secondary>
46849 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
46850 the conditions are not met, control is passed to the next ACL statement. For
46853 <literallayout class="monospaced">
46854 deny dnslists = blackholes.mail-abuse.org
46857 rejects commands from hosts that are on a DNS black list.
46861 <para revisionflag="changed">
46862 <indexterm role="concept">
46863 <primary><option>discard</option></primary>
46864 <secondary>ACL verb</secondary>
46866 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
46867 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
46868 that are concerned with receiving messages. When all the conditions are true,
46869 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
46870 recipients to be discarded. If it is used in an ACL for RCPT, just the one
46871 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
46872 message’s recipients are discarded. Recipients that are discarded before DATA
46873 do not appear in the log line when the <option>log_recipients</option> log selector is set.
46875 <para revisionflag="changed">
46876 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
46877 its contents are added to the line that is automatically written to the log.
46878 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
46883 <indexterm role="concept">
46884 <primary><option>drop</option></primary>
46885 <secondary>ACL verb</secondary>
46887 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
46888 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
46890 <literallayout class="monospaced">
46891 drop message = I don't take more than 20 RCPTs
46892 condition = ${if > {$rcpt_count}{20}}
46895 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
46896 The connection is always dropped after sending a 550 response.
46901 <indexterm role="concept">
46902 <primary><option>require</option></primary>
46903 <secondary>ACL verb</secondary>
46905 <option>require</option>: If all the conditions are met, control is passed to the next ACL
46906 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
46907 example, when checking a RCPT command,
46909 <literallayout class="monospaced">
46910 require verify = sender
46913 passes control to subsequent statements only if the message’s sender can be
46914 verified. Otherwise, it rejects the command.
46919 <indexterm role="concept">
46920 <primary><option>warn</option></primary>
46921 <secondary>ACL verb</secondary>
46923 <option>warn</option>: If all the conditions are true, a line specified by the
46924 <option>log_message</option> modifier is written to Exim’s main log. Control always passes
46925 to the next ACL statement. If any condition is false, the log line is not
46926 written. If an identical log line is requested several times in the same
46927 message, only one copy is actually written to the log. If you want to force
46928 duplicates to be written, use the <option>logwrite</option> modifier instead.
46931 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
46932 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
46933 <option>logwrite</option>, and <option>add_header</option>) that appear before the first failing
46934 condition. There is more about adding header lines in section
46935 <xref linkend="SECTaddheadacl"/>.
46938 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
46939 some sort of defer), the log line specified by <option>log_message</option> is not written.
46940 <phrase revisionflag="changed">This does not include the case of a forced failure from a lookup, which
46941 is considered to be a successful completion. After a defer,</phrase> no further
46942 conditions or modifiers in the <option>warn</option> statement are processed. The incident
46943 is logged, and the ACL continues to be processed, from the next statement
46947 <indexterm role="concept">
46948 <primary><varname>$acl_verify_message</varname></primary>
46950 When one of the <option>warn</option> conditions is an address verification that fails, the
46951 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
46952 want this logged, you must set it up explicitly. For example:
46954 <literallayout class="monospaced">
46955 warn !verify = sender
46956 log_message = sender verify failed: $acl_verify_message
46961 At the end of each ACL there is an implicit unconditional <option>deny</option>.
46964 As you can see from the examples above, the conditions and modifiers are
46965 written one to a line, with the first one on the same line as the verb, and
46966 subsequent ones on following lines. If you have a very long condition, you can
46967 continue it onto several physical lines by the usual backslash continuation
46968 mechanism. It is conventional to align the conditions vertically.
46971 <section id="SECTaclvariables">
46972 <title>ACL variables</title>
46973 <para revisionflag="changed">
46974 <indexterm role="concept">
46975 <primary>access control lists (ACLs)</primary>
46976 <secondary>variables</secondary>
46978 There are some special variables that can be set during ACL processing. They
46979 can be used to pass information between different ACLs, different invocations
46980 of the same ACL in the same SMTP connection, and between ACLs and the routers,
46981 transports, and filters that are used to deliver a message. The names of these
46982 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
46983 an underscore, but the remainder of the name can be any sequence of
46984 alphanumeric characters and underscores that you choose. There is no limit on
46985 the number of ACL variables. The two sets act as follows:
46987 <itemizedlist revisionflag="changed">
46989 <para revisionflag="changed">
46990 The values of those variables whose names begin with <varname>$acl_c</varname> persist
46991 throughout an SMTP connection. They are never reset. Thus, a value that is set
46992 while receiving one message is still available when receiving the next message
46993 on the same SMTP connection.
46997 <para revisionflag="changed">
46998 The values of those variables whose names beging with <varname>$acl_m</varname> persist only
46999 while a message is being received. They are reset afterwards. They are also
47000 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
47004 <para revisionflag="changed">
47005 When a message is accepted, the current values of all the ACL variables are
47006 preserved with the message and are subsequently made available at delivery
47007 time. The ACL variables are set by a modifier called <option>set</option>. For example:
47009 <literallayout class="monospaced" revisionflag="changed">
47010 accept hosts = whatever
47011 set acl_m4 = some value
47012 accept authenticated = *
47013 set acl_c_auth = yes
47015 <para revisionflag="changed">
47016 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
47017 be set. If you want to set a variable without taking any action, you can use a
47018 <option>warn</option> verb without any other modifiers or conditions.
47020 <para revisionflag="changed">
47021 <indexterm role="option">
47022 <primary><option>strict_acl_vars</option></primary>
47024 What happens if a syntactically valid but undefined ACL variable is
47025 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
47026 false (the default), an empty string is substituted; if it is true, an
47027 error is generated.
47029 <para revisionflag="changed">
47030 Versions of Exim before 4.64 have a limited set of numbered variables, but
47031 their names are compatible, so there is no problem with upgrading.
47035 <title>Condition and modifier processing</title>
47037 <indexterm role="concept">
47038 <primary>access control lists (ACLs)</primary>
47039 <secondary>conditions; processing</secondary>
47041 <indexterm role="concept">
47042 <primary>access control lists (ACLs)</primary>
47043 <secondary>modifiers; processing</secondary>
47045 An exclamation mark preceding a condition negates its result. For example:
47047 <literallayout class="monospaced">
47048 deny domains = *.dom.example
47049 !verify = recipient
47052 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
47053 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
47054 negation can be used on the right-hand side of a condition. For example, these
47055 two statements are equivalent:
47057 <literallayout class="monospaced">
47058 deny hosts = !192.168.3.4
47059 deny !hosts = 192.168.3.4
47062 However, for many conditions (<option>verify</option> being a good example), only left-hand
47063 side negation of the whole condition is possible.
47066 The arguments of conditions and modifiers are expanded. A forced failure
47067 of an expansion causes a condition to be ignored, that is, it behaves as if the
47068 condition is true. Consider these two statements:
47070 <literallayout class="monospaced">
47071 accept senders = ${lookup{$host_name}lsearch\
47072 {/some/file}{$value}fail}
47073 accept senders = ${lookup{$host_name}lsearch\
47074 {/some/file}{$value}{}}
47077 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
47078 the returned list is searched, but if the lookup fails the behaviour is
47079 different in the two cases. The <option>fail</option> in the first statement causes the
47080 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
47081 therefore succeeds. The second statement, however, generates an empty list when
47082 the lookup fails. No sender can match an empty list, so the condition fails,
47083 and therefore the <option>accept</option> also fails.
47086 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
47087 specify actions that are taken as the conditions for a statement are checked;
47088 others specify text for messages that are used when access is denied or a
47089 warning is generated. The <option>control</option> modifier affects the way an incoming
47090 message is handled.
47093 The positioning of the modifiers in an ACL statement important, because the
47094 processing of a verb ceases as soon as its outcome is known. Only those
47095 modifiers that have already been encountered will take effect. For example,
47096 consider this use of the <option>message</option> modifier:
47098 <literallayout class="monospaced">
47099 require message = Can't verify sender
47101 message = Can't verify recipient
47103 message = This message cannot be used
47106 If sender verification fails, Exim knows that the result of the statement is
47107 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
47108 so its text is used as the error message. If sender verification succeeds, but
47109 recipient verification fails, the second message is used. If recipient
47110 verification succeeds, the third message becomes <quote>current</quote>, but is never used
47111 because there are no more conditions to cause failure.
47114 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
47115 modifier that is used, because all the conditions must be true for rejection to
47116 happen. Specifying more than one <option>message</option> modifier does not make sense, and
47117 the message can even be specified after all the conditions. For example:
47119 <literallayout class="monospaced">
47121 !senders = *@my.domain.example
47122 message = Invalid sender from client host
47125 The <quote>deny</quote> result does not happen until the end of the statement is reached,
47126 by which time Exim has set up the message.
47129 <section id="SECTACLmodi">
47130 <title>ACL modifiers</title>
47132 <indexterm role="concept">
47133 <primary>access control lists (ACLs)</primary>
47134 <secondary>modifiers; list of</secondary>
47136 The ACL modifiers are as follows:
47140 <term><emphasis role="bold">add_header</emphasis> = <<emphasis>text</emphasis>></term>
47143 This modifier specifies one or more header lines that are to be added to an
47144 incoming message, assuming, of course, that the message is ultimately
47145 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
47147 </listitem></varlistentry>
47149 <term><emphasis role="bold">control</emphasis> = <<emphasis>text</emphasis>></term>
47152 <indexterm role="concept">
47153 <primary><option>control</option></primary>
47154 <secondary>ACL modifier</secondary>
47156 This modifier affects the subsequent processing of the SMTP connection or of an
47157 incoming message that is accepted. The effect of the first type of control
47158 lasts for the duration of the connection, whereas the effect of the second type
47159 lasts only until the current message has been received. The message-specific
47160 controls always apply to the whole message, not to individual recipients,
47161 even if the <option>control</option> modifier appears in a RCPT ACL.
47164 As there are now quite a few controls that can be applied, they are described
47165 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
47166 in several different ways. For example:
47171 It can be at the end of an <option>accept</option> statement:
47173 <literallayout class="monospaced">
47174 accept ...some conditions
47175 control = queue_only
47178 In this case, the control is applied when this statement yields <quote>accept</quote>, in
47179 other words, when the conditions are all true.
47184 It can be in the middle of an <option>accept</option> statement:
47186 <literallayout class="monospaced">
47187 accept ...some conditions...
47188 control = queue_only
47189 ...some more conditions...
47192 If the first set of conditions are true, the control is applied, even if the
47193 statement does not accept because one of the second set of conditions is false.
47194 In this case, some subsequent statement must yield <quote>accept</quote> for the control
47200 It can be used with <option>warn</option> to apply the control, leaving the
47201 decision about accepting or denying to a subsequent verb. For
47204 <literallayout class="monospaced">
47205 warn ...some conditions...
47210 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
47211 <option>logwrite</option>, so it does not add anything to the message and does not write a
47217 If you want to apply a control unconditionally, you can use it with a
47218 <option>require</option> verb. For example:
47220 <literallayout class="monospaced">
47221 require control = no_multiline_response
47225 </listitem></varlistentry>
47227 <term><emphasis role="bold">delay</emphasis> = <<emphasis>time</emphasis>></term>
47230 <indexterm role="concept">
47231 <primary><option>delay</option></primary>
47232 <secondary>ACL modifier</secondary>
47234 <indexterm role="concept">
47235 <primary><option>-bh</option> option</primary>
47237 This modifier causes Exim to wait for the time interval before proceeding. The
47238 time is given in the usual Exim notation. This modifier may appear in any ACL.
47239 The delay happens as soon as the modifier is processed. However, when testing
47240 Exim using the <option>-bh</option> option, the delay is not actually imposed (an
47241 appropriate message is output instead).
47244 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
47247 <literallayout class="monospaced">
47248 deny ...some conditions...
47252 The delay happens if all the conditions are true, before the statement returns
47253 <quote>deny</quote>. Compare this with:
47255 <literallayout class="monospaced">
47257 ...some conditions...
47260 which waits for 30s before processing the conditions. The <option>delay</option> modifier
47261 can also be used with <option>warn</option> and together with <option>control</option>:
47263 <literallayout class="monospaced">
47264 warn ...some conditions...
47269 </listitem></varlistentry>
47270 <varlistentry revisionflag="changed">
47271 <term><emphasis role="bold">endpass</emphasis></term>
47273 <para revisionflag="changed">
47274 <indexterm role="concept">
47275 <primary><option>endpass</option></primary>
47276 <secondary>ACL modifier</secondary>
47278 This modifier, which has no argument, is recognized only in <option>accept</option> and
47279 <option>discard</option> statements. It marks the boundary between the conditions whose
47280 failure causes control to pass to the next statement, and the conditions whose
47281 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
47282 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
47283 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
47285 </listitem></varlistentry>
47287 <term><emphasis role="bold">log_message</emphasis> = <<emphasis>text</emphasis>></term>
47290 <indexterm role="concept">
47291 <primary><option>log_message</option></primary>
47292 <secondary>ACL modifier</secondary>
47294 This modifier sets up a message that is used as part of the log message if the
47295 ACL denies access or a <option>warn</option> statement’s conditions are true. For example:
47297 <literallayout class="monospaced">
47298 require log_message = wrong cipher suite $tls_cipher
47299 encrypted = DES-CBC3-SHA
47301 <para revisionflag="changed">
47302 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
47305 <literallayout revisionflag="changed">
47306 <literal>discard </literal><<emphasis>some conditions</emphasis>>
47307 <literal> log_message = Discarded $local_part@$domain because...</literal>
47309 <para revisionflag="changed">
47310 When access is denied, <option>log_message</option> adds to any underlying error message
47311 that may exist because of a condition failure. For example, while verifying a
47312 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
47315 <para revisionflag="changed">
47316 The message may be defined before the conditions to which it applies, because
47317 the string expansion does not happen until Exim decides that access is to be
47318 denied. This means that any variables that are set by the condition are
47319 available for inclusion in the message. For example, the <varname>$dnslist_</varname><<emphasis>xxx</emphasis>>
47320 variables are set after a DNS black list lookup succeeds. If the expansion of
47321 <option>log_message</option> fails, or if the result is an empty string, the modifier is
47325 <indexterm role="concept">
47326 <primary><varname>$acl_verify_message</varname></primary>
47328 If you want to use a <option>warn</option> statement to log the result of an address
47329 verification, you can use <varname>$acl_verify_message</varname> to include the verification
47333 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
47334 the start of the logged message. If the same warning log message is requested
47335 more than once while receiving a single email message, only one copy is
47336 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
47337 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
47338 is logged for a succesful <option>warn</option> statement.
47341 If <option>log_message</option> is not present and there is no underlying error message (for
47342 example, from the failure of address verification), but <option>message</option> is present,
47343 the <option>message</option> text is used for logging rejections. However, if any text for
47344 logging contains newlines, only the first line is logged. In the absence of
47345 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
47346 logging rejections.
47348 </listitem></varlistentry>
47349 <varlistentry revisionflag="changed">
47350 <term><emphasis role="bold">log_reject_target</emphasis> = <<emphasis>log name list</emphasis>></term>
47352 <para revisionflag="changed">
47353 <indexterm role="concept">
47354 <primary><option>log_reject_target</option></primary>
47355 <secondary>ACL modifier</secondary>
47357 <indexterm role="concept">
47358 <primary>logging in ACL</primary>
47359 <secondary>specifying which log</secondary>
47361 This modifier makes it possible to specify which logs are used for messages
47362 about ACL rejections. Its argument is a colon-separated list of words that can
47363 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
47364 may be empty, in which case a rejection is not logged at all. For example, this
47365 ACL fragment writes no logging information when access is denied:
47367 <literallayout revisionflag="changed">
47368 <literal>deny </literal><<emphasis>some conditions</emphasis>>
47369 <literal> log_reject_target =</literal>
47371 <para revisionflag="changed">
47372 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
47373 permanent and temporary rejections.
47375 </listitem></varlistentry>
47377 <term><emphasis role="bold">logwrite</emphasis> = <<emphasis>text</emphasis>></term>
47380 <indexterm role="concept">
47381 <primary><option>logwrite</option></primary>
47382 <secondary>ACL modifier</secondary>
47384 <indexterm role="concept">
47385 <primary>logging in ACL</primary>
47386 <secondary>immediate</secondary>
47388 This modifier writes a message to a log file as soon as it is encountered when
47389 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
47390 <option>warn</option> <phrase revisionflag="changed">and <option>discard</option></phrase>, is used only if the ACL statement denies
47391 access.) The <option>logwrite</option> modifier can be used to log special incidents in
47395 <literal>accept </literal><<emphasis>some special conditions</emphasis>>
47396 <literal> control = freeze</literal>
47397 <literal> logwrite = froze message because ...</literal>
47400 By default, the message is written to the main log. However, it may begin
47401 with a colon, followed by a comma-separated list of log names, and then
47402 another colon, to specify exactly which logs are to be written. For
47405 <literallayout class="monospaced">
47406 logwrite = :main,reject: text for main and reject logs
47407 logwrite = :panic: text for panic log only
47409 </listitem></varlistentry>
47411 <term><emphasis role="bold">message</emphasis> = <<emphasis>text</emphasis>></term>
47413 <para revisionflag="changed">
47414 <indexterm role="concept">
47415 <primary><option>message</option></primary>
47416 <secondary>ACL modifier</secondary>
47418 This modifier sets up a text string that is expanded and used as a response
47419 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
47420 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
47421 there is some complication if <option>endpass</option> is involved; see the description of
47422 <option>accept</option> for details.)
47424 <para revisionflag="changed">
47425 The expansion of the message happens at the time Exim decides that the ACL is
47426 to end, not at the time it processes <option>message</option>. If the expansion fails, or
47427 generates an empty string, the modifier is ignored. Here is an example where
47428 <option>message</option> must be specified first, because the ACL ends with a rejection if
47429 the <option>hosts</option> condition fails:
47431 <literallayout class="monospaced" revisionflag="changed">
47432 require message = Host not recognized
47435 <para revisionflag="changed">
47436 (Once a condition has failed, no further conditions or modifiers are
47439 <para revisionflag="changed">
47440 <indexterm role="concept">
47441 <primary>SMTP</primary>
47442 <secondary>error codes</secondary>
47444 <indexterm role="concept">
47445 <primary><option>smtp_banner</option></primary>
47447 For ACLs that are triggered by SMTP commands, the message is returned as part
47448 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
47449 is meaningful only for SMTP, as no message is returned when a non-SMTP message
47450 is accepted. In the case of the connect ACL, accepting with a message modifier
47451 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
47452 accept message may not contain more than one line (otherwise it will be
47453 truncated at the first newline and a panic logged), and it cannot affect the
47456 <para revisionflag="changed">
47457 When SMTP is involved, the message may begin with an overriding response code,
47458 consisting of three digits optionally followed by an <quote>extended response code</quote>
47459 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
47461 <literallayout class="monospaced" revisionflag="changed">
47462 deny message = 599 1.2.3 Host not welcome
47463 hosts = 192.168.34.0/24
47465 <para revisionflag="changed">
47466 The first digit of the supplied response code must be the same as would be sent
47467 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
47468 access, but for the predata ACL, note that the default success code is 354, not
47469 2<emphasis>xx</emphasis>.
47471 <para revisionflag="changed">
47472 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
47473 the message modifier cannot override the 221 response code.
47475 <para revisionflag="changed">
47476 The text in a <option>message</option> modifier is literal; any quotes are taken as
47477 literals, but because the string is expanded, backslash escapes are processed
47478 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
47482 <indexterm role="concept">
47483 <primary><varname>$acl_verify_message</varname></primary>
47485 If <option>message</option> is used on a statement that verifies an address, the message
47486 specified overrides any message that is generated by the verification process.
47487 However, the original message is available in the variable
47488 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
47489 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
47490 routers to be passed back as part of the SMTP response, you should either not
47491 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
47494 For compatibility with previous releases of Exim, a <option>message</option> modifier that
47495 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
47496 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
47497 all the conditions are true, wherever it appears in an ACL command, whereas
47498 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
47499 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
47502 </listitem></varlistentry>
47504 <term><emphasis role="bold">set</emphasis> <<emphasis>acl_name</emphasis>> = <<emphasis>value</emphasis>></term>
47507 <indexterm role="concept">
47508 <primary><option>set</option></primary>
47509 <secondary>ACL modifier</secondary>
47511 This modifier puts a value into one of the ACL variables (see section
47512 <xref linkend="SECTaclvariables"/>).
47514 </listitem></varlistentry>
47517 <section id="SECTcontrols">
47518 <title>Use of the control modifier</title>
47520 <indexterm role="concept">
47521 <primary><option>control</option></primary>
47522 <secondary>ACL modifier</secondary>
47524 The <option>control</option> modifier supports the following settings:
47528 <term><emphasis role="bold">control = allow_auth_unadvertised</emphasis></term>
47531 This modifier allows a client host to use the SMTP AUTH command even when it
47532 has not been advertised in response to EHLO. Furthermore, because there are
47533 apparently some really broken clients that do this, Exim will accept AUTH after
47534 HELO (rather than EHLO) when this control is set. It should be used only if you
47535 really need it, and you should limit its use to those broken clients that do
47536 not work without it. For example:
47538 <literallayout class="monospaced">
47539 warn hosts = 192.168.34.25
47540 control = allow_auth_unadvertised
47543 Normally, when an Exim server receives an AUTH command, it checks the name of
47544 the authentication mechanism that is given in the command to ensure that it
47545 matches an advertised mechanism. When this control is set, the check that a
47546 mechanism has been advertised is bypassed. Any configured mechanism can be used
47547 by the client. This control is permitted only in the connection and HELO ACLs.
47549 </listitem></varlistentry>
47551 <term><emphasis role="bold">control = caseful_local_part</emphasis></term>
47556 </listitem></varlistentry>
47558 <term><emphasis role="bold">control = caselower_local_part</emphasis></term>
47561 <indexterm role="concept">
47562 <primary>access control lists (ACLs)</primary>
47563 <secondary>case of local part in</secondary>
47565 <indexterm role="concept">
47566 <primary>case of local parts</primary>
47568 <indexterm role="concept">
47569 <primary><varname>$local_part</varname></primary>
47571 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
47572 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
47573 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
47574 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
47575 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
47579 These controls affect only the current recipient. Moreover, they apply only to
47580 local part handling that takes place directly in the ACL (for example, as a key
47581 in lookups). If a test to verify the recipient is obeyed, the case-related
47582 handling of the local part during the verification is controlled by the router
47583 configuration (see the <option>caseful_local_part</option> generic router option).
47586 This facility could be used, for example, to add a spam score to local parts
47587 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
47590 <literallayout class="monospaced">
47591 warn control = caseful_local_part
47592 set acl_m4 = ${eval:\
47594 ${if match{$local_part}{[A-Z]}{1}{0}}\
47596 control = caselower_local_part
47599 Notice that we put back the lower cased version afterwards, assuming that
47600 is what is wanted for subsequent tests.
47602 </listitem></varlistentry>
47604 <term><emphasis role="bold">control = enforce_sync</emphasis></term>
47609 </listitem></varlistentry>
47611 <term><emphasis role="bold">control = no_enforce_sync</emphasis></term>
47614 <indexterm role="concept">
47615 <primary>SMTP</primary>
47616 <secondary>synchronization checking</secondary>
47618 <indexterm role="concept">
47619 <primary>synchronization checking in SMTP</primary>
47621 These controls make it possible to be selective about when SMTP synchronization
47622 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
47623 state of the switch (it is true by default). See the description of this option
47624 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
47627 The effect of these two controls lasts for the remainder of the SMTP
47628 connection. They can appear in any ACL except the one for the non-SMTP
47629 messages. The most straightforward place to put them is in the ACL defined by
47630 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
47631 before the first synchronization check. The expected use is to turn off the
47632 synchronization checks for badly-behaved hosts that you nevertheless need to
47635 </listitem></varlistentry>
47637 <term><emphasis role="bold">control = fakedefer/</emphasis><<emphasis>message</emphasis>></term>
47640 <indexterm role="concept">
47641 <primary>fake defer</primary>
47643 <indexterm role="concept">
47644 <primary>defer</primary>
47645 <secondary>fake</secondary>
47647 This control works in exactly the same way as <option>fakereject</option> (described below)
47648 except that it causes an SMTP 450 response after the message data instead of a
47649 550 response. You must take care when using <option>fakedefer</option> because it causes the
47650 messages to be duplicated when the sender retries. Therefore, you should not
47651 use <option>fakedefer</option> if the message is to be delivered normally.
47653 </listitem></varlistentry>
47655 <term><emphasis role="bold">control = fakereject/</emphasis><<emphasis>message</emphasis>></term>
47658 <indexterm role="concept">
47659 <primary>fake rejection</primary>
47661 <indexterm role="concept">
47662 <primary>rejection</primary>
47663 <secondary>fake</secondary>
47665 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
47666 words, only when an SMTP message is being received. If Exim accepts the
47667 message, instead the final 250 response, a 550 rejection message is sent.
47668 However, Exim proceeds to deliver the message as normal. The control applies
47669 only to the current message, not to any subsequent ones that may be received in
47670 the same SMTP connection.
47673 The text for the 550 response is taken from the <option>control</option> modifier. If no
47674 message is supplied, the following is used:
47676 <literallayout class="monospaced">
47677 550-Your message has been rejected but is being
47678 550-kept for evaluation.
47679 550-If it was a legitimate message, it may still be
47680 550 delivered to the target recipient(s).
47683 This facilty should be used with extreme caution.
47685 </listitem></varlistentry>
47687 <term><emphasis role="bold">control = freeze</emphasis></term>
47690 <indexterm role="concept">
47691 <primary>frozen messages</primary>
47692 <secondary>forcing in ACL</secondary>
47694 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
47695 other words, only when a message is being received. If the message is accepted,
47696 it is placed on Exim’s queue and frozen. The control applies only to the
47697 current message, not to any subsequent ones that may be received in the same
47701 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
47702 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
47703 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
47704 are obeyed for the current message have the <literal>/no_tell</literal> option.
47706 </listitem></varlistentry>
47708 <term><emphasis role="bold">control = no_mbox_unspool</emphasis></term>
47711 This control is available when Exim is compiled with the content scanning
47712 extension. Content scanning may require a copy of the current message, or parts
47713 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
47714 or spam scanner. Normally, such copies are deleted when they are no longer
47715 needed. If this control is set, the copies are not deleted. The control applies
47716 only to the current message, not to any subsequent ones that may be received in
47717 the same SMTP connection. It is provided for debugging purposes and is unlikely
47718 to be useful in production.
47720 </listitem></varlistentry>
47722 <term><emphasis role="bold">control = no_multiline_response</emphasis></term>
47725 <indexterm role="concept">
47726 <primary>multiline responses</primary>
47727 <secondary>suppressing</secondary>
47729 This control is permitted for any ACL except the one for non-SMTP messages.
47730 It seems that there are broken clients in use that cannot handle multiline
47731 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
47734 If this control is set, multiline SMTP responses from ACL rejections are
47735 suppressed. One way of doing this would have been to put out these responses as
47736 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
47737 (<quote>use multiline responses for more</quote> it says – ha!), and some of the
47738 responses might get close to that. So this facility, which is after all only a
47739 sop to broken clients, is implemented by doing two very easy things:
47744 Extra information that is normally output as part of a rejection caused by
47745 sender verification failure is omitted. Only the final line (typically <quote>sender
47746 verification failed</quote>) is sent.
47751 If a <option>message</option> modifier supplies a multiline response, only the first
47757 The setting of the switch can, of course, be made conditional on the
47758 calling host. Its effect lasts until the end of the SMTP connection.
47760 </listitem></varlistentry>
47762 <term><emphasis role="bold">control = queue_only</emphasis></term>
47765 <indexterm role="concept">
47766 <primary><option>queue_only</option></primary>
47768 <indexterm role="concept">
47769 <primary>queueing incoming messages</primary>
47771 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
47772 other words, only when a message is being received. If the message is accepted,
47773 it is placed on Exim’s queue and left there for delivery by a subsequent queue
47774 runner. No immediate delivery process is started. In other words, it has the
47775 effect as the <option>queue_only</option> global option. However, the control applies only
47776 to the current message, not to any subsequent ones that may be received in the
47777 same SMTP connection.
47779 </listitem></varlistentry>
47781 <term><emphasis role="bold">control = submission/</emphasis><<emphasis>options</emphasis>></term>
47784 <indexterm role="concept">
47785 <primary>message</primary>
47786 <secondary>submission</secondary>
47788 <indexterm role="concept">
47789 <primary>submission mode</primary>
47791 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
47792 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
47793 the current message is a submission from a local MUA. In this case, Exim
47794 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
47795 necessary. For example, it add a <emphasis>Date:</emphasis> header line if one is not present.
47796 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
47797 late (the message has already been created).
47800 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
47801 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
47802 submission mode; the available options for this control are described there.
47803 The control applies only to the current message, not to any subsequent ones
47804 that may be received in the same SMTP connection.
47806 </listitem></varlistentry>
47808 <term><emphasis role="bold">control = suppress_local_fixups</emphasis></term>
47811 <indexterm role="concept">
47812 <primary>submission fixups</primary>
47813 <secondary>suppressing</secondary>
47815 This control applies to locally submitted (non TCP/IP) messages, and is the
47816 complement of <literal>control</literal> <literal>=</literal> <literal>submission</literal>. It disables the fixups that are
47817 normally applied to locally-submitted messages. Specifically:
47822 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
47823 dynamic version of <option>local_sender_retain</option>).
47828 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
47833 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
47838 This control may be useful when a remotely-originated message is accepted,
47839 passed to some scanning program, and then re-submitted for delivery. It can be
47840 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
47841 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message’s
47844 </listitem></varlistentry>
47847 All four possibilities for message fixups can be specified:
47852 Locally submitted, fixups applied: the default.
47857 Locally submitted, no fixups applied: use <literal>control</literal> <literal>=</literal>
47858 <literal>suppress_local_fixups</literal>.
47863 Remotely submitted, no fixups applied: the default.
47868 Remotely submitted, fixups applied: use <literal>control</literal> <literal>=</literal> <literal>submission</literal>.
47873 <section id="SECTaddheadacl">
47874 <title>Adding header lines in ACLs</title>
47876 <indexterm role="concept">
47877 <primary>header lines</primary>
47878 <secondary>adding in an ACL</secondary>
47880 <indexterm role="concept">
47881 <primary>header lines</primary>
47882 <secondary>position of added lines</secondary>
47884 <indexterm role="concept">
47885 <primary><option>message</option></primary>
47886 <secondary>ACL modifier</secondary>
47888 The <option>add_header</option> modifier can be used to add one or more extra header lines
47889 to an incoming message, as in this example:
47891 <literallayout class="monospaced">
47892 warn dnslists = sbl.spamhaus.org : \
47893 dialup.mail-abuse.org
47894 add_header = X-blacklisted-at: $dnslist_domain
47897 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
47898 MIME, and non-SMTP ACLs (in other words, those that are concerned with
47899 receiving a message). The message must ultimately be accepted for
47900 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
47901 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
47905 If the data for the <option>add_header</option> modifier contains one or more newlines that
47906 are not followed by a space or a tab, it is assumed to contain multiple header
47907 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
47908 front of any line that is not a valid header line.
47911 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
47912 They are added to the message before processing the DATA and MIME ACLs.
47913 However, if an identical header line is requested more than once, only one copy
47914 is actually added to the message. Further header lines may be accumulated
47915 during the DATA and MIME ACLs, after which they are added to the message, again
47916 with duplicates suppressed. Thus, it is possible to add two identical header
47917 lines to an SMTP message, but only if one is added before DATA and one after.
47918 In the case of non-SMTP messages, new headers are accumulated during the
47919 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
47920 message is rejected after DATA or by the non-SMTP ACL, all added header lines
47921 are included in the entry that is written to the reject log.
47924 <indexterm role="concept">
47925 <primary>header lines</primary>
47926 <secondary>added; visibility of</secondary>
47928 Header lines are not visible in string expansions until they are added to the
47929 message. It follows that header lines defined in the MAIL, RCPT, and predata
47930 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
47931 header lines that are added by the DATA or MIME ACLs are not visible in those
47932 ACLs. Because of this restriction, you cannot use header lines as a way of
47933 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
47934 this, you can use ACL variables, as described in section
47935 <xref linkend="SECTaclvariables"/>.
47938 The <option>add_header</option> modifier acts immediately it is encountered during the
47939 processing of an ACL. Notice the difference between these two cases:
47942 <literal>accept add_header = ADDED: some text</literal>
47943 <literal> </literal><<emphasis>some condition</emphasis>>
47945 <literal>accept </literal><<emphasis>some condition</emphasis>>
47946 <literal> add_header = ADDED: some text</literal>
47949 In the first case, the header line is always added, whether or not the
47950 condition is true. In the second case, the header line is added only if the
47951 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
47952 ACL statement. All those that are encountered before a condition fails are
47956 <indexterm role="concept">
47957 <primary><option>warn</option></primary>
47958 <secondary>ACL verb</secondary>
47960 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
47961 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
47962 effect only if all the conditions are true, even if it appears before some of
47963 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
47964 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
47965 are present on a <option>warn</option> verb, both are processed according to their
47969 By default, new header lines are added to a message at the end of the existing
47970 header lines. However, you can specify that any particular header line should
47971 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
47972 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
47973 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
47976 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
47977 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
47978 header line, respectively. (Header text cannot start with a colon, as there has
47979 to be a header name first.) For example:
47981 <literallayout class="monospaced">
47982 warn add_header = \
47983 :after_received:X-My-Header: something or other...
47986 If more than one header line is supplied in a single <option>add_header</option> modifier,
47987 each one is treated independently and can therefore be placed differently. If
47988 you add more than one line at the start, or after the Received: block, they end
47989 up in reverse order.
47992 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
47993 added in an ACL. It does NOT work for header lines that are added in a
47994 system filter or in a router or transport.
47997 <section id="SECTaclconditions">
47998 <title>ACL conditions</title>
48000 <indexterm role="concept">
48001 <primary>access control lists (ACLs)</primary>
48002 <secondary>conditions; list of</secondary>
48004 Some of conditions listed in this section are available only when Exim is
48005 compiled with the content-scanning extension. They are included here briefly
48006 for completeness. More detailed descriptions can be found in the discussion on
48007 content scanning in chapter <xref linkend="CHAPexiscan"/>.
48010 Not all conditions are relevant in all circumstances. For example, testing
48011 senders and recipients does not make sense in an ACL that is being run as the
48012 result of the arrival of an ETRN command, and checks on message headers can be
48013 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
48014 can use the same condition (with different parameters) more than once in the
48015 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
48016 The conditions are as follows:
48020 <term><emphasis role="bold">acl = </emphasis><<emphasis>name of acl or ACL string or file name </emphasis>></term>
48023 <indexterm role="concept">
48024 <primary>access control lists (ACLs)</primary>
48025 <secondary>nested</secondary>
48027 <indexterm role="concept">
48028 <primary>access control lists (ACLs)</primary>
48029 <secondary>indirect</secondary>
48031 <indexterm role="concept">
48032 <primary><option>acl</option></primary>
48033 <secondary>ACL condition</secondary>
48035 The possible values of the argument are the same as for the
48036 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
48037 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
48038 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
48039 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
48040 condition false. This means that further processing of the <option>warn</option> verb
48041 ceases, but processing of the ACL continues.
48044 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
48045 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
48046 <option>accept</option> or <option>discard</option>, and the action is taken immediately – no further
48047 conditions are tested.
48050 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
48051 loops. This condition allows you to use different ACLs in different
48052 circumstances. For example, different ACLs can be used to handle RCPT commands
48053 for different local users or different local domains.
48055 </listitem></varlistentry>
48057 <term><emphasis role="bold">authenticated = </emphasis><<emphasis>string list</emphasis>></term>
48060 <indexterm role="concept">
48061 <primary><option>authenticated</option></primary>
48062 <secondary>ACL condition</secondary>
48064 <indexterm role="concept">
48065 <primary>authentication</primary>
48066 <secondary>ACL checking</secondary>
48068 <indexterm role="concept">
48069 <primary>access control lists (ACLs)</primary>
48070 <secondary>testing for authentication</secondary>
48072 If the SMTP connection is not authenticated, the condition is false. Otherwise,
48073 the name of the authenticator is tested against the list. To test for
48074 authentication by any authenticator, you can set
48076 <literallayout class="monospaced">
48079 </listitem></varlistentry>
48081 <term><emphasis role="bold">condition = </emphasis><<emphasis>string</emphasis>></term>
48084 <indexterm role="concept">
48085 <primary><option>condition</option></primary>
48086 <secondary>ACL condition</secondary>
48088 <indexterm role="concept">
48089 <primary>customizing</primary>
48090 <secondary>ACL condition</secondary>
48092 <indexterm role="concept">
48093 <primary>access control lists (ACLs)</primary>
48094 <secondary>customized test</secondary>
48096 <indexterm role="concept">
48097 <primary>access control lists (ACLs)</primary>
48098 <secondary>testing; customized</secondary>
48100 This feature allows you to make up custom conditions. If the result of
48101 expanding the string is an empty string, the number zero, or one of the strings
48102 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
48103 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
48104 any other value, some error is assumed to have occurred, and the ACL returns
48105 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
48106 ignored. The effect is to treat it as true, whether it is positive or
48109 </listitem></varlistentry>
48111 <term><emphasis role="bold">decode = </emphasis><<emphasis>location</emphasis>></term>
48114 <indexterm role="concept">
48115 <primary><option>decode</option></primary>
48116 <secondary>ACL condition</secondary>
48118 This condition is available only when Exim is compiled with the
48119 content-scanning extension, and it is allowed only in the ACL defined by
48120 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
48121 For details, see chapter <xref linkend="CHAPexiscan"/>.
48123 </listitem></varlistentry>
48125 <term><emphasis role="bold">demime = </emphasis><<emphasis>extension list</emphasis>></term>
48128 <indexterm role="concept">
48129 <primary><option>demime</option></primary>
48130 <secondary>ACL condition</secondary>
48132 This condition is available only when Exim is compiled with the
48133 content-scanning extension. Its use is described in section
48134 <xref linkend="SECTdemimecond"/>.
48136 </listitem></varlistentry>
48138 <term><emphasis role="bold">dnslists = </emphasis><<emphasis>list of domain names and other data</emphasis>></term>
48141 <indexterm role="concept">
48142 <primary><option>dnslists</option></primary>
48143 <secondary>ACL condition</secondary>
48145 <indexterm role="concept">
48146 <primary>DNS list</primary>
48147 <secondary>in ACL</secondary>
48149 <indexterm role="concept">
48150 <primary>black list (DNS)</primary>
48152 <indexterm role="concept">
48153 <primary>access control lists (ACLs)</primary>
48154 <secondary>testing a DNS list</secondary>
48156 This condition checks for entries in DNS black lists. These are also known as
48157 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
48158 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
48159 different variants of this condition to describe briefly here. See sections
48160 <xref linkend="SECTmorednslists"/>--<xref linkend="SECTmorednslistslast"/> for details.
48162 </listitem></varlistentry>
48164 <term><emphasis role="bold">domains = </emphasis><<emphasis>domain list</emphasis>></term>
48167 <indexterm role="concept">
48168 <primary><option>domains</option></primary>
48169 <secondary>ACL condition</secondary>
48171 <indexterm role="concept">
48172 <primary>domain</primary>
48173 <secondary>ACL checking</secondary>
48175 <indexterm role="concept">
48176 <primary>access control lists (ACLs)</primary>
48177 <secondary>testing a recipient domain</secondary>
48179 <indexterm role="concept">
48180 <primary><varname>$domain_data</varname></primary>
48182 This condition is relevant only after a RCPT command. It checks that the domain
48183 of the recipient address is in the domain list. If percent-hack processing is
48184 enabled, it is done before this test is done. If the check succeeds with a
48185 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
48186 <option>domains</option> test.
48188 <para revisionflag="changed">
48189 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
48190 use <option>domains</option> in a DATA ACL.
48192 </listitem></varlistentry>
48194 <term><emphasis role="bold">encrypted = </emphasis><<emphasis>string list</emphasis>></term>
48197 <indexterm role="concept">
48198 <primary><option>encrypted</option></primary>
48199 <secondary>ACL condition</secondary>
48201 <indexterm role="concept">
48202 <primary>encryption</primary>
48203 <secondary>checking in an ACL</secondary>
48205 <indexterm role="concept">
48206 <primary>access control lists (ACLs)</primary>
48207 <secondary>testing for encryption</secondary>
48209 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
48210 name of the cipher suite in use is tested against the list. To test for
48211 encryption without testing for any specific cipher suite(s), set
48213 <literallayout class="monospaced">
48216 </listitem></varlistentry>
48218 <term><emphasis role="bold">hosts = </emphasis><<emphasis> host list</emphasis>></term>
48221 <indexterm role="concept">
48222 <primary><option>hosts</option></primary>
48223 <secondary>ACL condition</secondary>
48225 <indexterm role="concept">
48226 <primary>host</primary>
48227 <secondary>ACL checking</secondary>
48229 <indexterm role="concept">
48230 <primary>access control lists (ACLs)</primary>
48231 <secondary>testing the client host</secondary>
48233 This condition tests that the calling host matches the host list. If you have
48234 name lookups or wildcarded host names and IP addresses in the same host list,
48235 you should normally put the IP addresses first. For example, you could have:
48237 <literallayout class="monospaced">
48238 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
48240 <para revisionflag="changed">
48241 The lookup in this example uses the host name for its key. This is implied by
48242 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
48243 and it wouldn’t matter which way round you had these two items.)
48246 The reason for the problem with host names lies in the left-to-right way that
48247 Exim processes lists. It can test IP addresses without doing any DNS lookups,
48248 but when it reaches an item that requires a host name, it fails if it cannot
48249 find a host name to compare with the pattern. If the above list is given in the
48250 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
48251 found, even if its IP address is 10.9.8.7.
48254 If you really do want to do the name check first, and still recognize the IP
48255 address even if the name lookup fails, you can rewrite the ACL like this:
48257 <literallayout class="monospaced">
48258 accept hosts = dbm;/etc/friendly/hosts
48259 accept hosts = 10.9.8.7
48262 The default action on failing to find the host name is to assume that the host
48263 is not in the list, so the first <option>accept</option> statement fails. The second
48264 statement can then check the IP address.
48267 <indexterm role="concept">
48268 <primary><varname>$host_data</varname></primary>
48270 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
48271 of the lookup is made available in the <varname>$host_data</varname> variable. This
48272 allows you, for example, to set up a statement like this:
48274 <literallayout class="monospaced">
48275 deny hosts = net-lsearch;/some/file
48276 message = $host_data
48279 which gives a custom error message for each denied host.
48281 </listitem></varlistentry>
48283 <term><emphasis role="bold">local_parts = </emphasis><<emphasis>local part list</emphasis>></term>
48286 <indexterm role="concept">
48287 <primary><option>local_parts</option></primary>
48288 <secondary>ACL condition</secondary>
48290 <indexterm role="concept">
48291 <primary>local part</primary>
48292 <secondary>ACL checking</secondary>
48294 <indexterm role="concept">
48295 <primary>access control lists (ACLs)</primary>
48296 <secondary>testing a local part</secondary>
48298 <indexterm role="concept">
48299 <primary><varname>$local_part_data</varname></primary>
48301 This condition is relevant only after a RCPT command. It checks that the local
48302 part of the recipient address is in the list. If percent-hack processing is
48303 enabled, it is done before this test. If the check succeeds with a lookup, the
48304 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
48305 the next <option>local_parts</option> test.
48307 </listitem></varlistentry>
48309 <term><emphasis role="bold">malware = </emphasis><<emphasis>option</emphasis>></term>
48312 <indexterm role="concept">
48313 <primary><option>malware</option></primary>
48314 <secondary>ACL condition</secondary>
48316 <indexterm role="concept">
48317 <primary>access control lists (ACLs)</primary>
48318 <secondary>virus scanning</secondary>
48320 <indexterm role="concept">
48321 <primary>access control lists (ACLs)</primary>
48322 <secondary>scanning for viruses</secondary>
48324 This condition is available only when Exim is compiled with the
48325 content-scanning extension. It causes the incoming message to be scanned for
48326 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
48328 </listitem></varlistentry>
48330 <term><emphasis role="bold">mime_regex = </emphasis><<emphasis>list of regular expressions</emphasis>></term>
48333 <indexterm role="concept">
48334 <primary><option>mime_regex</option></primary>
48335 <secondary>ACL condition</secondary>
48337 <indexterm role="concept">
48338 <primary>access control lists (ACLs)</primary>
48339 <secondary>testing by regex matching</secondary>
48341 This condition is available only when Exim is compiled with the
48342 content-scanning extension, and it is allowed only in the ACL defined by
48343 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
48344 with any of the regular expressions. For details, see chapter
48345 <xref linkend="CHAPexiscan"/>.
48347 </listitem></varlistentry>
48349 <term><emphasis role="bold">ratelimit = </emphasis><<emphasis>parameters</emphasis>></term>
48352 <indexterm role="concept">
48353 <primary>rate limiting</primary>
48355 This condition can be used to limit the rate at which a user or host submits
48356 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
48358 </listitem></varlistentry>
48360 <term><emphasis role="bold">recipients = </emphasis><<emphasis>address list</emphasis>></term>
48363 <indexterm role="concept">
48364 <primary><option>recipients</option></primary>
48365 <secondary>ACL condition</secondary>
48367 <indexterm role="concept">
48368 <primary>recipient</primary>
48369 <secondary>ACL checking</secondary>
48371 <indexterm role="concept">
48372 <primary>access control lists (ACLs)</primary>
48373 <secondary>testing a recipient</secondary>
48375 This condition is relevant only after a RCPT command. It checks the entire
48376 recipient address against a list of recipients.
48378 </listitem></varlistentry>
48380 <term><emphasis role="bold">regex = </emphasis><<emphasis>list of regular expressions</emphasis>></term>
48383 <indexterm role="concept">
48384 <primary><option>regex</option></primary>
48385 <secondary>ACL condition</secondary>
48387 <indexterm role="concept">
48388 <primary>access control lists (ACLs)</primary>
48389 <secondary>testing by regex matching</secondary>
48391 This condition is available only when Exim is compiled with the
48392 content-scanning extension, and is available only in the DATA, MIME, and
48393 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
48394 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
48396 </listitem></varlistentry>
48398 <term><emphasis role="bold">sender_domains = </emphasis><<emphasis>domain list</emphasis>></term>
48401 <indexterm role="concept">
48402 <primary><option>sender_domains</option></primary>
48403 <secondary>ACL condition</secondary>
48405 <indexterm role="concept">
48406 <primary>sender</primary>
48407 <secondary>ACL checking</secondary>
48409 <indexterm role="concept">
48410 <primary>access control lists (ACLs)</primary>
48411 <secondary>testing a sender domain</secondary>
48413 <indexterm role="concept">
48414 <primary><varname>$domain</varname></primary>
48416 <indexterm role="concept">
48417 <primary><varname>$sender_address_domain</varname></primary>
48419 This condition tests the domain of the sender of the message against the given
48420 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
48421 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
48422 of this condition. This is an exception to the general rule for testing domain
48423 lists. It is done this way so that, if this condition is used in an ACL for a
48424 RCPT command, the recipient’s domain (which is in <varname>$domain</varname>) can be used to
48425 influence the sender checking.
48428 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
48429 relaying, because sender addresses are easily, and commonly, forged.
48431 </listitem></varlistentry>
48433 <term><emphasis role="bold">senders = </emphasis><<emphasis>address list</emphasis>></term>
48436 <indexterm role="concept">
48437 <primary><option>senders</option></primary>
48438 <secondary>ACL condition</secondary>
48440 <indexterm role="concept">
48441 <primary>sender</primary>
48442 <secondary>ACL checking</secondary>
48444 <indexterm role="concept">
48445 <primary>access control lists (ACLs)</primary>
48446 <secondary>testing a sender</secondary>
48448 This condition tests the sender of the message against the given list. To test
48449 for a bounce message, which has an empty sender, set
48451 <literallayout class="monospaced">
48455 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
48456 relaying, because sender addresses are easily, and commonly, forged.
48458 </listitem></varlistentry>
48460 <term><emphasis role="bold">spam = </emphasis><<emphasis>username</emphasis>></term>
48463 <indexterm role="concept">
48464 <primary><option>spam</option></primary>
48465 <secondary>ACL condition</secondary>
48467 <indexterm role="concept">
48468 <primary>access control lists (ACLs)</primary>
48469 <secondary>scanning for spam</secondary>
48471 This condition is available only when Exim is compiled with the
48472 content-scanning extension. It causes the incoming message to be scanned by
48473 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
48475 </listitem></varlistentry>
48477 <term><emphasis role="bold">verify = certificate</emphasis></term>
48480 <indexterm role="concept">
48481 <primary><option>verify</option></primary>
48482 <secondary>ACL condition</secondary>
48484 <indexterm role="concept">
48485 <primary>TLS</primary>
48486 <secondary>client certificate verification</secondary>
48488 <indexterm role="concept">
48489 <primary>certificate</primary>
48490 <secondary>verification of client</secondary>
48492 <indexterm role="concept">
48493 <primary>access control lists (ACLs)</primary>
48494 <secondary>certificate verification</secondary>
48496 <indexterm role="concept">
48497 <primary>access control lists (ACLs)</primary>
48498 <secondary>testing a TLS certificate</secondary>
48500 This condition is true in an SMTP session if the session is encrypted, and a
48501 certificate was received from the client, and the certificate was verified. The
48502 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
48503 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
48505 </listitem></varlistentry>
48507 <term><emphasis role="bold">verify = csa</emphasis></term>
48510 <indexterm role="concept">
48511 <primary>CSA verification</primary>
48513 This condition checks whether the sending host (the client) is authorized to
48514 send email. Details of how this works are given in section
48515 <xref linkend="SECTverifyCSA"/>.
48517 </listitem></varlistentry>
48519 <term><emphasis role="bold">verify = header_sender/</emphasis><<emphasis>options</emphasis>></term>
48522 <indexterm role="concept">
48523 <primary><option>verify</option></primary>
48524 <secondary>ACL condition</secondary>
48526 <indexterm role="concept">
48527 <primary>access control lists (ACLs)</primary>
48528 <secondary>verifying sender in the header</secondary>
48530 <indexterm role="concept">
48531 <primary>header lines</primary>
48532 <secondary>verifying the sender in</secondary>
48534 <indexterm role="concept">
48535 <primary>sender</primary>
48536 <secondary>verifying in header</secondary>
48538 <indexterm role="concept">
48539 <primary>verifying</primary>
48540 <secondary>sender in header</secondary>
48542 This condition is relevant only in an ACL that is run after a message has been
48543 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
48544 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
48545 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
48546 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
48547 However, an address that appears in one of these headers need not be an address
48548 that accepts bounce messages; only sender addresses in envelopes are required
48549 to accept bounces. Therefore, if you use the callout option on this check, you
48550 might want to arrange for a non-empty address in the MAIL command.
48553 Details of address verification and the options are given later, starting at
48554 section <xref linkend="SECTaddressverification"/> (callouts are described in section
48555 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
48556 condition to restrict it to bounce messages only:
48558 <literallayout class="monospaced">
48560 message = A valid sender header is required for bounces
48561 !verify = header_sender
48563 </listitem></varlistentry>
48565 <term><emphasis role="bold">verify = header_syntax</emphasis></term>
48568 <indexterm role="concept">
48569 <primary><option>verify</option></primary>
48570 <secondary>ACL condition</secondary>
48572 <indexterm role="concept">
48573 <primary>access control lists (ACLs)</primary>
48574 <secondary>verifying header syntax</secondary>
48576 <indexterm role="concept">
48577 <primary>header lines</primary>
48578 <secondary>verifying syntax</secondary>
48580 <indexterm role="concept">
48581 <primary>verifying</primary>
48582 <secondary>header syntax</secondary>
48584 This condition is relevant only in an ACL that is run after a message has been
48585 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
48586 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
48587 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
48588 and <emphasis>Bcc:</emphasis>). Unqualified addresses (local parts without domains) are
48589 permitted only in locally generated messages and from hosts that match
48590 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
48594 Note that this condition is a syntax check only. However, a common spamming
48595 ploy used to be to send syntactically invalid headers such as
48597 <literallayout class="monospaced">
48601 and this condition can be used to reject such messages, though they are not as
48602 common as they used to be.
48604 </listitem></varlistentry>
48606 <term><emphasis role="bold">verify = helo</emphasis></term>
48609 <indexterm role="concept">
48610 <primary><option>verify</option></primary>
48611 <secondary>ACL condition</secondary>
48613 <indexterm role="concept">
48614 <primary>access control lists (ACLs)</primary>
48615 <secondary>verifying HELO/EHLO</secondary>
48617 <indexterm role="concept">
48618 <primary>HELO</primary>
48619 <secondary>verifying</secondary>
48621 <indexterm role="concept">
48622 <primary>EHLO</primary>
48623 <secondary>verifying</secondary>
48625 <indexterm role="concept">
48626 <primary>verifying</primary>
48627 <secondary>EHLO</secondary>
48629 <indexterm role="concept">
48630 <primary>verifying</primary>
48631 <secondary>HELO</secondary>
48633 This condition is true if a HELO or EHLO command has been received from the
48634 client host, and its contents have been verified. If there has been no previous
48635 attempt to verify the HELO/EHLO contents, it is carried out when this
48636 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
48637 <option>helo_try_verify_hosts</option> options for details of how to request verification
48638 independently of this condition.
48640 <para revisionflag="changed">
48641 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
48642 option), this condition is always true.
48644 </listitem></varlistentry>
48646 <term><emphasis role="bold">verify = not_blind</emphasis></term>
48649 <indexterm role="concept">
48650 <primary>verifying</primary>
48651 <secondary>not blind</secondary>
48653 <indexterm role="concept">
48654 <primary>bcc recipients</primary>
48655 <secondary>verifying none</secondary>
48657 This condition checks that there are no blind (bcc) recipients in the message.
48658 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
48659 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
48660 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
48661 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
48662 used only in a DATA or non-SMTP ACL.
48665 There are, of course, many legitimate messages that make use of blind (bcc)
48666 recipients. This check should not be used on its own for blocking messages.
48668 </listitem></varlistentry>
48670 <term><emphasis role="bold">verify = recipient/</emphasis><<emphasis>options</emphasis>></term>
48673 <indexterm role="concept">
48674 <primary><option>verify</option></primary>
48675 <secondary>ACL condition</secondary>
48677 <indexterm role="concept">
48678 <primary>access control lists (ACLs)</primary>
48679 <secondary>verifying recipient</secondary>
48681 <indexterm role="concept">
48682 <primary>recipient</primary>
48683 <secondary>verifying</secondary>
48685 <indexterm role="concept">
48686 <primary>verifying</primary>
48687 <secondary>recipient</secondary>
48689 <indexterm role="concept">
48690 <primary><varname>$address_data</varname></primary>
48692 This condition is relevant only after a RCPT command. It verifies the current
48693 recipient. Details of address verification are given later, starting at section
48694 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
48695 of <varname>$address_data</varname> is the last value that was set while routing the address.
48696 This applies even if the verification fails. When an address that is being
48697 verified is redirected to a single address, verification continues with the new
48698 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
48699 value for the child address.
48701 </listitem></varlistentry>
48703 <term><emphasis role="bold">verify = reverse_host_lookup</emphasis></term>
48706 <indexterm role="concept">
48707 <primary><option>verify</option></primary>
48708 <secondary>ACL condition</secondary>
48710 <indexterm role="concept">
48711 <primary>access control lists (ACLs)</primary>
48712 <secondary>verifying host reverse lookup</secondary>
48714 <indexterm role="concept">
48715 <primary>host</primary>
48716 <secondary>verifying reverse lookup</secondary>
48718 This condition ensures that a verified host name has been looked up from the IP
48719 address of the client host. (This may have happened already if the host name
48720 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
48721 Verification ensures that the host name obtained from a reverse DNS lookup, or
48722 one of its aliases, does, when it is itself looked up in the DNS, yield the
48723 original IP address.
48726 If this condition is used for a locally generated message (that is, when there
48727 is no client host involved), it always succeeds.
48729 </listitem></varlistentry>
48731 <term><emphasis role="bold">verify = sender/</emphasis><<emphasis>options</emphasis>></term>
48734 <indexterm role="concept">
48735 <primary><option>verify</option></primary>
48736 <secondary>ACL condition</secondary>
48738 <indexterm role="concept">
48739 <primary>access control lists (ACLs)</primary>
48740 <secondary>verifying sender</secondary>
48742 <indexterm role="concept">
48743 <primary>sender</primary>
48744 <secondary>verifying</secondary>
48746 <indexterm role="concept">
48747 <primary>verifying</primary>
48748 <secondary>sender</secondary>
48750 This condition is relevant only after a MAIL or RCPT command, or after a
48751 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
48752 the message’s sender is empty (that is, this is a bounce message), the
48753 condition is true. Otherwise, the sender address is verified.
48756 <indexterm role="concept">
48757 <primary><varname>$address_data</varname></primary>
48759 <indexterm role="concept">
48760 <primary><varname>$sender_address_data</varname></primary>
48762 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
48763 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
48764 value can be used in subsequent conditions and modifiers in the same ACL
48765 statement. It does not persist after the end of the current statement. If you
48766 want to preserve the value for longer, you can save it in an ACL variable.
48769 Details of verification are given later, starting at section
48770 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
48771 to avoid doing it more than once per message.
48773 </listitem></varlistentry>
48775 <term><emphasis role="bold">verify = sender=</emphasis><<emphasis>address</emphasis>><emphasis role="bold">/</emphasis><<emphasis>options</emphasis>></term>
48778 <indexterm role="concept">
48779 <primary><option>verify</option></primary>
48780 <secondary>ACL condition</secondary>
48782 This is a variation of the previous option, in which a modified address is
48783 verified as a sender.
48785 </listitem></varlistentry>
48788 <section id="SECTmorednslists">
48789 <title>Using DNS lists</title>
48791 <indexterm role="concept">
48792 <primary>DNS list</primary>
48793 <secondary>in ACL</secondary>
48795 <indexterm role="concept">
48796 <primary>black list (DNS)</primary>
48798 <indexterm role="concept">
48799 <primary>access control lists (ACLs)</primary>
48800 <secondary>testing a DNS list</secondary>
48802 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
48803 is on at least one of a number of DNS lists by looking up the inverted IP
48804 address in one or more DNS domains. For example, if the calling host’s IP
48805 address is 192.168.62.43, and the ACL statement is
48807 <literallayout class="monospaced">
48808 deny dnslists = blackholes.mail-abuse.org : \
48809 dialups.mail-abuse.org
48812 the following records are looked up:
48814 <literallayout class="monospaced">
48815 43.62.168.192.blackholes.mail-abuse.org
48816 43.62.168.192.dialups.mail-abuse.org
48819 As soon as Exim finds an existing DNS record, processing of the list stops.
48820 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
48821 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
48822 use two separate conditions:
48824 <literallayout class="monospaced">
48825 deny dnslists = blackholes.mail-abuse.org
48826 dnslists = dialups.mail-abuse.org
48829 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
48830 behaves as if the host does not match the list item, that is, as if the DNS
48831 record does not exist. If there are further items in the DNS list, they are
48835 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
48836 (which is the most common usage), because it prevents a DNS failure from
48837 blocking mail. However, you can change this behaviour by putting one of the
48838 following special items in the list:
48841 <literal>+include_unknown </literal> behave as if the item is on the list
48842 <literal>+exclude_unknown </literal> behave as if the item is not on the list (default)
48843 <literal>+defer_unknown </literal> give a temporary error
48846 <indexterm role="concept">
48847 <primary><literal>+include_unknown</literal></primary>
48849 <indexterm role="concept">
48850 <primary><literal>+exclude_unknown</literal></primary>
48852 <indexterm role="concept">
48853 <primary><literal>+defer_unknown</literal></primary>
48855 Each of these applies to any subsequent items on the list. For example:
48857 <literallayout class="monospaced">
48858 deny dnslists = +defer_unknown : foo.bar.example
48861 Testing the list of domains stops as soon as a match is found. If you want to
48862 warn for one list and block for another, you can use two different statements:
48864 <literallayout class="monospaced">
48865 deny dnslists = blackholes.mail-abuse.org
48866 warn message = X-Warn: sending host is on dialups list
48867 dnslists = dialups.mail-abuse.org
48870 DNS list lookups are cached by Exim for the duration of the SMTP session,
48871 so a lookup based on the IP address is done at most once for any incoming
48872 connection. Exim does not share information between multiple incoming
48873 connections (but your local name server cache should be active).
48877 <title>Specifying the IP address for a DNS list lookup</title>
48879 <indexterm role="concept">
48880 <primary>DNS list</primary>
48881 <secondary>keyed by explicit IP address</secondary>
48883 By default, the IP address that is used in a DNS list lookup is the IP address
48884 of the calling host. However, you can specify another IP address by listing it
48885 after the domain name, introduced by a slash. For example:
48887 <literallayout class="monospaced">
48888 deny dnslists = black.list.tld/192.168.1.2
48891 This feature is not very helpful with explicit IP addresses; it is intended for
48892 use with IP addresses that are looked up, for example, the IP addresses of the
48893 MX hosts or nameservers of an email sender address. For an example, see section
48894 <xref linkend="SECTmulkeyfor"/> below.
48898 <title>DNS lists keyed on domain names</title>
48900 <indexterm role="concept">
48901 <primary>DNS list</primary>
48902 <secondary>keyed by domain name</secondary>
48904 There are some lists that are keyed on domain names rather than inverted IP
48905 addresses (see for example the <emphasis>domain based zones</emphasis> link at
48906 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
48907 with these lists. You can change the name that is looked up in a DNS list by
48908 listing it after the domain name, introduced by a slash. For example,
48910 <literallayout class="monospaced">
48911 deny message = Sender's domain is listed at $dnslist_domain
48912 dnslists = dsn.rfc-ignorant.org/$sender_address_domain
48915 This particular example is useful only in ACLs that are obeyed after the
48916 RCPT or DATA commands, when a sender address is available. If (for
48917 example) the message’s sender is <emphasis>user@tld.example</emphasis> the name that is looked
48918 up by this example is
48920 <literallayout class="monospaced">
48921 tld.example.dsn.rfc-ignorant.org
48924 A single <option>dnslists</option> condition can contain entries for both names and IP
48925 addresses. For example:
48927 <literallayout class="monospaced">
48928 deny dnslists = sbl.spamhaus.org : \
48929 dsn.rfc-ignorant.org/$sender_address_domain
48932 The first item checks the sending host’s IP address; the second checks a domain
48933 name. The whole condition is true if either of the DNS lookups succeeds.
48936 <section id="SECTmulkeyfor">
48937 <title>Multiple explicit keys for a DNS list</title>
48939 <indexterm role="concept">
48940 <primary>DNS list</primary>
48941 <secondary>multiple keys for</secondary>
48943 The syntax described above for looking up explicitly-defined values (either
48944 names or IP addresses) in a DNS blacklist is a simplification. After the domain
48945 name for the DNS list, what follows the slash can in fact be a list of items.
48946 As with all lists in Exim, the default separator is a colon. However, because
48947 this is a sublist within the list of DNS blacklist domains, it is necessary
48948 either to double the separators like this:
48950 <literallayout class="monospaced">
48951 dnslists = black.list.tld/name.1::name.2
48954 or to change the separator character, like this:
48956 <literallayout class="monospaced">
48957 dnslists = black.list.tld/<;name.1;name.2
48960 If an item in the list is an IP address, it is inverted before the DNS
48961 blacklist domain is appended. If it is not an IP address, no inversion
48962 occurs. Consider this condition:
48964 <literallayout class="monospaced">
48965 dnslists = black.list.tld/<;192.168.1.2;a.domain
48968 The DNS lookups that occur are:
48970 <literallayout class="monospaced">
48971 2.1.168.192.black.list.tld
48972 a.domain.black.list.tld
48975 Once a DNS record has been found (that matches a specific IP return
48976 address, if specified – see section <xref linkend="SECTaddmatcon"/>), no further lookups
48977 are done. If there is a temporary DNS error, the rest of the sublist of domains
48978 or IP addresses is tried. A temporary error for the whole dnslists item occurs
48979 only if no other DNS lookup in this sublist succeeds. In other words, a
48980 successful lookup for any of the items in the sublist overrides a temporary
48981 error for a previous item.
48984 The ability to supply a list of items after the slash is in some sense just a
48985 syntactic convenience. These two examples have the same effect:
48987 <literallayout class="monospaced">
48988 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
48989 dnslists = black.list.tld/a.domain::b.domain
48992 However, when the data for the list is obtained from a lookup, the second form
48993 is usually much more convenient. Consider this example:
48995 <literallayout class="monospaced">
48996 deny message = The mail servers for the domain \
48997 $sender_address_domain \
48998 are listed at $dnslist_domain ($dnslist_value); \
49000 dnslists = sbl.spamhaus.org/<|${lookup dnsdb {>|a=<|\
49001 ${lookup dnsdb {>|mxh=\
49002 $sender_address_domain} }} }
49005 Note the use of <literal>>|</literal> in the dnsdb lookup to specify the separator for
49006 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
49007 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
49008 of expanding the condition might be something like this:
49010 <literallayout class="monospaced">
49011 dnslists = sbl.spahmaus.org/<|192.168.2.3|192.168.5.6|...
49014 Thus, this example checks whether or not the IP addresses of the sender
49015 domain’s mail servers are on the Spamhaus black list.
49019 <title>Data returned by DNS lists</title>
49021 <indexterm role="concept">
49022 <primary>DNS list</primary>
49023 <secondary>data returned from</secondary>
49025 DNS lists are constructed using address records in the DNS. The original RBL
49026 just used the address 127.0.0.1 on the right hand side of each record, but the
49027 RBL+ list and some other lists use a number of values with different meanings.
49028 The values used on the RBL+ list are:
49033 127.1.0.3 DUL and RBL
49035 127.1.0.5 RSS and RBL
49036 127.1.0.6 RSS and DUL
49037 127.1.0.7 RSS and DUL and RBL
49039 <para revisionflag="changed">
49040 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
49041 different values. Some DNS lists may return more than one address record; they
49046 <title>Variables set from DNS lists</title>
49047 <para revisionflag="changed">
49048 <indexterm role="concept">
49049 <primary>DNS list</primary>
49050 <secondary>variables set from</secondary>
49052 <indexterm role="concept">
49053 <primary><varname>$dnslist_domain</varname></primary>
49055 <indexterm role="concept">
49056 <primary><varname>$dnslist_text</varname></primary>
49058 <indexterm role="concept">
49059 <primary><varname>$dnslist_value</varname></primary>
49061 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname>
49062 contains the name of the domain that matched, and <varname>$dnslist_value</varname> contains
49063 the data from the entry. If more than one address record is returned by the DNS
49064 lookup, all the IP addresses are included in <varname>$dnslist_value</varname>, separated by
49065 commas and spaces. The variable <varname>$dnslist_text</varname> contains the contents of any
49066 associated TXT record. For lists such as RBL+ the TXT record for a merged entry
49067 is often not very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of
49068 obtaining more information.
49071 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
49072 – although these appear before the condition in the ACL, they are not
49073 expanded until after it has failed. For example:
49075 <literallayout class="monospaced">
49076 deny hosts = !+local_networks
49077 message = $sender_host_address is listed \
49079 dnslists = rbl-plus.mail-abuse.example
49082 <section id="SECTaddmatcon">
49083 <title>Additional matching conditions for DNS lists</title>
49085 <indexterm role="concept">
49086 <primary>DNS list</primary>
49087 <secondary>matching specific returned data</secondary>
49089 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
49090 in order to restrict its action to DNS records with a matching right hand side.
49093 <literallayout class="monospaced">
49094 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
49097 rejects only those hosts that yield 127.0.0.2. Without this additional data,
49098 any address record is considered to be a match. If more than one address record
49099 is found on the list, they are all checked for a matching right-hand side.
49102 More than one IP address may be given for checking, using a comma as a
49103 separator. These are alternatives – if any one of them matches, the
49104 <option>dnslists</option> condition is true. For example:
49106 <literallayout class="monospaced">
49107 deny dnslists = a.b.c=127.0.0.2,127.0.0.3
49110 If you want to specify a constraining address list and also specify names or IP
49111 addresses to be looked up, the constraining address list must be specified
49112 first. For example:
49114 <literallayout class="monospaced">
49115 deny dnslists = dsn.rfc-ignorant.org\
49116 =127.0.0.2/$sender_address_domain
49119 If the character <literal>&</literal> is used instead of <literal>=</literal>, the comparison for each
49120 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
49121 In other words, the listed addresses are used as bit masks. The comparison is
49122 true if all the bits in the mask are present in the address that is being
49123 tested. For example:
49125 <literallayout class="monospaced">
49126 dnslists = a.b.c&0.0.0.3
49129 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
49130 want to test whether one bit or another bit is present (as opposed to both
49131 being present), you must use multiple values. For example:
49133 <literallayout class="monospaced">
49134 dnslists = a.b.c&0.0.0.1,0.0.0.2
49137 matches if the final component of the address is an odd number or two times
49142 <title>Negated DNS matching conditions</title>
49144 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
49147 <literallayout class="monospaced">
49148 deny dnslists = a.b.c=127.0.0.2,127.0.0.3
49151 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
49152 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
49154 <literallayout class="monospaced">
49155 deny dnslists = a.b.c!=127.0.0.2,127.0.0.3
49158 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
49159 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
49160 words, the result of the test is inverted if an exclamation mark appears before
49161 the <literal>=</literal> (or the <literal>&</literal>) sign.
49164 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
49165 host, or address list (which is why the syntax is different).
49168 If you are using just one list, the negation syntax does not gain you much. The
49169 previous example is precisely equivalent to
49171 <literallayout class="monospaced">
49172 deny dnslists = a.b.c
49173 !dnslists = a.b.c=127.0.0.2,127.0.0.3
49176 However, if you are using multiple lists, the negation syntax is clearer.
49177 Consider this example:
49179 <literallayout class="monospaced">
49180 deny dnslists = sbl.spamhaus.org : \
49182 dnsbl.njabl.org!=127.0.0.3 : \
49186 Using only positive lists, this would have to be:
49188 <literallayout class="monospaced">
49189 deny dnslists = sbl.spamhaus.org : \
49191 deny dnslists = dnsbl.njabl.org
49192 !dnslists = dnsbl.njabl.org=127.0.0.3
49193 deny dnslists = relays.ordb.org
49196 which is less clear, and harder to maintain.
49199 <section id="SECTmordetinf" revisionflag="changed">
49200 <title>Detailed information from merged DNS lists</title>
49201 <para revisionflag="changed">
49202 <indexterm role="concept">
49203 <primary>DNS list</primary>
49204 <secondary>information from merged</secondary>
49206 When the facility for restricting the matching IP values in a DNS list is used,
49207 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
49208 the true reason for rejection. This happens when lists are merged and the IP
49209 address in the A record is used to distinguish them; unfortunately there is
49210 only one TXT record. One way round this is not to use merged lists, but that
49211 can be inefficient because it requires multiple DNS lookups where one would do
49212 in the vast majority of cases when the host of interest is not on any of the
49215 <para revisionflag="changed">
49216 A less inefficient way of solving this problem is available. If
49217 two domain names, comma-separated, are given, the second is used first to
49218 do an initial check, making use of any IP value restrictions that are set.
49219 If there is a match, the first domain is used, without any IP value
49220 restrictions, to get the TXT record. As a byproduct of this, there is also
49221 a check that the IP being tested is indeed on the first list. The first
49222 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
49224 <literallayout class="monospaced" revisionflag="changed">
49226 rejected because $sender_ip_address is blacklisted \
49227 at $dnslist_domain\n$dnslist_text
49229 sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
49230 dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
49232 <para revisionflag="changed">
49233 For the first blacklist item, this starts by doing a lookup in
49234 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
49235 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
49236 value, and as long as something is found, it looks for the corresponding TXT
49237 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
49238 The second blacklist item is processed similarly.
49240 <para revisionflag="changed">
49241 If you are interested in more than one merged list, the same list must be
49242 given several times, but because the results of the DNS lookups are cached,
49243 the DNS calls themselves are not repeated. For example:
49245 <literallayout class="monospaced" revisionflag="changed">
49246 reject dnslists = \
49247 http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
49248 socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
49249 misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
49250 dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
49252 <para revisionflag="changed">
49253 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
49254 values matches (or if no record is found), this is the only lookup that is
49255 done. Only if there is a match is one of the more specific lists consulted.
49258 <section id="SECTmorednslistslast">
49259 <title>DNS lists and IPv6</title>
49261 <indexterm role="concept">
49262 <primary>IPv6</primary>
49263 <secondary>DNS black lists</secondary>
49265 <indexterm role="concept">
49266 <primary>DNS list</primary>
49267 <secondary>IPv6 usage</secondary>
49269 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
49270 nibble by nibble. For example, if the calling host’s IP address is
49271 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
49273 <literallayout class="monospaced">
49274 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
49275 f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
49278 (split over two lines here to fit on the page). Unfortunately, some of the DNS
49279 lists contain wildcard records, intended for IPv4, that interact badly with
49280 IPv6. For example, the DNS entry
49282 <literallayout class="monospaced">
49283 *.3.some.list.example. A 127.0.0.1
49286 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
49287 Unfortunately, it also matches the entire 3::/4 IPv6 network.
49290 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
49291 <option>condition</option> condition, as in this example:
49293 <literallayout class="monospaced">
49294 deny condition = ${if isip4{$sender_host_address}}
49295 dnslists = some.list.example
49298 <section id="SECTratelimiting">
49299 <title>Rate limiting senders</title>
49301 <indexterm role="concept">
49302 <primary>rate limiting</primary>
49303 <secondary>client sending</secondary>
49305 <indexterm role="concept">
49306 <primary>limiting client sending rates</primary>
49308 <indexterm role="option">
49309 <primary><option>smtp_ratelimit_*</option></primary>
49311 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
49312 which clients can send email. This is more powerful than the
49313 <option>smtp_ratelimit_*</option> options, because those options control the rate of
49314 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
49315 works across all connections (concurrent and sequential) from the same client
49316 host. The syntax of the <option>ratelimit</option> condition is:
49319 <literal>ratelimit =</literal> <<emphasis>m</emphasis>> <literal>/</literal> <<emphasis>p</emphasis>> <literal>/</literal> <<emphasis>options</emphasis>> <literal>/</literal> <<emphasis>key</emphasis>>
49322 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
49323 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
49326 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
49327 <varname>$sender_rate</varname> to the client’s computed rate, <varname>$sender_rate_limit</varname> to the
49328 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
49329 of <emphasis>p</emphasis>.
49332 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
49333 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
49334 means that it takes Exim longer to forget a client’s past behaviour. The
49335 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
49336 send in each time interval. It also specifies the number of messages permitted
49337 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
49338 constant, you can allow a client to send more messages in a burst without
49339 changing its overall sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
49340 both small, messages must be sent at an even rate.
49343 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
49344 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
49345 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
49346 instructions when it is run with no arguments.
49349 The key is used to look up the data for calculating the client’s average
49350 sending rate. This data is stored in a database maintained by Exim in its spool
49351 directory, alongside the retry and other hints databases. The default key is
49352 <varname>$sender_host_address</varname>, which applies the limit to each client host IP address.
49353 By changing the key you can change how Exim identifies clients for the purpose
49354 of ratelimiting. For example, to limit the sending rate of each authenticated
49355 user, independent of the computer they are sending from, set the key to
49356 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
49357 example, <varname>$authenticated_id</varname> is only meaningful if the client has
49358 authenticated, and you can check with the <option>authenticated</option> ACL condition.
49361 Internally, Exim includes the smoothing constant <emphasis>p</emphasis> and the options in the
49362 lookup key because they alter the meaning of the stored data. This is not true
49363 for the limit <emphasis>m</emphasis>, so you can alter the configured maximum rate and Exim will
49364 still remember clients’ past behaviour, but if you alter the other ratelimit
49365 parameters Exim forgets past behaviour.
49368 Each <option>ratelimit</option> condition can have up to two options. The first option
49369 specifies what Exim measures the rate of, and the second specifies how Exim
49370 handles excessively fast clients. The options are separated by a slash, like
49371 the other parameters.
49374 The <option>per_conn</option> option limits the client’s connection rate.
49377 The <option>per_mail</option> option limits the client’s rate of sending messages. This is
49378 the default if none of the <option>per_*</option> options is specified.
49381 The <option>per_byte</option> option limits the sender’s email bandwidth. Note that it is
49382 best to use this option in the DATA ACL; if it is used in an earlier ACL it
49383 relies on the SIZE parameter on the MAIL command, which may be inaccurate or
49384 completely missing. You can follow the limit <emphasis>m</emphasis> in the configuration with K,
49385 M, or G to specify limits in kilobytes, megabytes, or gigabytes, respectively.
49388 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
49389 condition is processed. This can be used to limit the SMTP command rate. The
49390 alias <option>per_rcpt</option> is provided for use in the RCPT ACL instead of <option>per_cmd</option>
49391 to make it clear that the effect is to limit the rate at which recipients are
49392 accepted. Note that in this case the rate limiting engine will see a message
49393 with many recipients as a large high-speed burst.
49396 If a client’s average rate is greater than the maximum, the rate limiting
49397 engine can react in two possible ways, depending on the presence of the
49398 <option>strict</option> or <option>leaky</option> options. This is independent of the other
49399 counter-measures (such as rejecting the message) that may be specified by the
49400 rest of the ACL. The default mode is leaky, which avoids a sender’s
49401 over-aggressive retry rate preventing it from getting any email through.
49404 The <option>strict</option> option means that the client’s recorded rate is always updated.
49405 The effect of this is that Exim measures the client’s average rate of attempts
49406 to send email, which can be much higher than the maximum. If the client is over
49407 the limit it will be subjected to counter-measures until it slows down below
49408 the maximum rate. The smoothing period determines the time it takes for a high
49409 sending rate to decay exponentially to 37% of its peak value, which means that
49410 you can work out the time (the number of smoothing periods) that a client is
49411 subjected to counter-measures after an over-limit burst with this formula:
49413 <literallayout class="monospaced">
49414 ln(peakrate/maxrate)
49417 The <option>leaky</option> option means that the client’s recorded rate is not updated if it
49418 is above the limit. The effect of this is that Exim measures the client’s
49419 average rate of successfully sent email, which cannot be greater than the
49420 maximum. If the client is over the limit it <phrase revisionflag="changed">may suffer some
49421 counter-measures (as specified in the ACL)</phrase>, but it will still be able to send
49422 email at the configured maximum rate, whatever the rate of its attempts. This
49423 is generally the better choice if you have clients that retry automatically.
49426 Exim’s other ACL facilities are used to define what counter-measures are taken
49427 when the rate limit is exceeded. This might be anything from logging a warning
49428 (for example, while measuring existing sending rates in order to define
49429 policy), through time delays to slow down fast senders, up to rejecting the
49430 message. For example:
49432 <literallayout class="monospaced">
49433 # Log all senders' rates
49434 warn ratelimit = 0 / 1h / strict
49435 log_message = Sender rate $sender_rate / $sender_rate_period
49437 # Slow down fast senders; note the need to truncate $sender_rate
49438 # at the decimal point.
49439 warn ratelimit = 100 / 1h / per_rcpt / strict
49440 delay = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
49441 $sender_rate_limit }s
49443 # Keep authenticated users under control
49444 deny authenticated = *
49445 ratelimit = 100 / 1d / strict / $authenticated_id
49447 # System-wide rate limit
49448 defer message = Sorry, too busy. Try again later.
49449 ratelimit = 10 / 1s / $primary_hostname
49451 # Restrict incoming rate from each host, with a default
49452 # set using a macro and special cases looked up in a table.
49453 defer message = Sender rate exceeds $sender_rate_limit \
49454 messages per $sender_rate_period
49455 ratelimit = ${lookup {$sender_host_address} \
49456 cdb {DB/ratelimits.cdb} \
49457 {$value} {RATELIMIT} }
49460 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
49461 especially with the <option>per_rcpt</option> option, you may suffer from a performance
49462 bottleneck caused by locking on the ratelimit hints database. Apart from
49463 making your ACLs less complicated, you can reduce the problem by using a
49464 RAM disk for Exim’s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
49465 this means that Exim will lose its hints data after a reboot (including retry
49466 hints, the callout cache, and ratelimit data).
49469 <section id="SECTaddressverification">
49470 <title>Address verification</title>
49472 <indexterm role="concept">
49473 <primary>verifying address</primary>
49474 <secondary>options for</secondary>
49476 <indexterm role="concept">
49477 <primary>policy control</primary>
49478 <secondary>address verification</secondary>
49480 Several of the <option>verify</option> conditions described in section
49481 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
49482 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
49483 The verification conditions can be followed by options that modify the
49484 verification process. The options are separated from the keyword and from each
49485 other by slashes, and some of them contain parameters. For example:
49487 <literallayout class="monospaced">
49488 verify = sender/callout
49489 verify = recipient/defer_ok/callout=10s,defer_ok
49492 The first stage of address verification, which always happens, is to run the
49493 address through the routers, in <quote>verify mode</quote>. Routers can detect the
49494 difference between verification and routing for delivery, and their actions can
49495 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
49496 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
49497 The available options are as follows:
49502 If the <option>callout</option> option is specified, successful routing to one or more
49503 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
49504 check. Callouts and their sub-options are discussed in the next section.
49509 If there is a defer error while doing verification routing, the ACL
49510 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
49511 options, the condition is forced to be true instead. Note that this is a main
49512 verification option as well as a suboption for callouts.
49517 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
49518 discusses the reporting of sender address verification failures.
49523 The <option>success_on_redirect</option> option causes verification always to succeed
49524 immediately after a successful redirection. By default, if a redirection
49525 generates just one address, that address is also verified. See further
49526 discussion in section <xref linkend="SECTredirwhilveri"/>.
49531 <indexterm role="concept">
49532 <primary>verifying address</primary>
49533 <secondary>differentiating failures</secondary>
49535 <indexterm role="concept">
49536 <primary><varname>$recipient_verify_failure</varname></primary>
49538 <indexterm role="concept">
49539 <primary><varname>$sender_verify_failure</varname></primary>
49541 <indexterm role="concept">
49542 <primary><varname>$acl_verify_message</varname></primary>
49544 After an address verification failure, <varname>$acl_verify_message</varname> contains the
49545 error message that is associated with the failure. It can be preserved by
49548 <literallayout class="monospaced">
49549 warn !verify = sender
49550 set acl_m0 = $acl_verify_message
49553 If you are writing your own custom rejection message or log message when
49554 denying access, you can use this variable to include information about the
49555 verification failure.
49558 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
49559 appropriate) contains one of the following words:
49564 <option>qualify</option>: The address was unqualified (no domain), and the message
49565 was neither local nor came from an exempted host.
49570 <option>route</option>: Routing failed.
49575 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
49576 occurred at or before the MAIL command (that is, on initial
49577 connection, HELO, or MAIL).
49582 <option>recipient</option>: The RCPT command in a callout was rejected.
49587 <option>postmaster</option>: The postmaster check in a callout was rejected.
49592 The main use of these variables is expected to be to distinguish between
49593 rejections of MAIL and rejections of RCPT in callouts.
49596 <section id="SECTcallver">
49597 <title>Callout verification</title>
49599 <indexterm role="concept">
49600 <primary>verifying address</primary>
49601 <secondary>by callout</secondary>
49603 <indexterm role="concept">
49604 <primary>callout</primary>
49605 <secondary>verification</secondary>
49607 <indexterm role="concept">
49608 <primary>SMTP</primary>
49609 <secondary>callout verification</secondary>
49611 For non-local addresses, routing verifies the domain, but is unable to do any
49612 checking of the local part. There are situations where some means of verifying
49613 the local part is desirable. One way this can be done is to make an SMTP
49614 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
49615 a subsequent host for a recipient address, to see if the host accepts the
49616 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
49617 sender address, the callback is not to the client host that is trying to
49618 deliver the message, but to one of the hosts that accepts incoming mail for the
49619 sender’s domain.
49622 Exim does not do callouts by default. If you want them to happen, you must
49623 request them by setting appropriate options on the <option>verify</option> condition, as
49624 described below. This facility should be used with care, because it can add a
49625 lot of resource usage to the cost of verifying an address. However, Exim does
49626 cache the results of callouts, which helps to reduce the cost. Details of
49627 caching are in section <xref linkend="SECTcallvercache"/>.
49630 Recipient callouts are usually used only between hosts that are controlled by
49631 the same administration. For example, a corporate gateway host could use
49632 callouts to check for valid recipients on an internal mailserver. A successful
49633 callout does not guarantee that a real delivery to the address would succeed;
49634 on the other hand, a failing callout does guarantee that a delivery would fail.
49637 If the <option>callout</option> option is present on a condition that verifies an address, a
49638 second stage of verification occurs if the address is successfully routed to
49639 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
49640 <command>manualroute</command> router, where the router specifies the hosts. However, if a
49641 router that does not set up hosts routes to an <command>smtp</command> transport with a
49642 <option>hosts</option> setting, the transport’s hosts are used. If an <command>smtp</command> transport has
49643 <option>hosts_override</option> set, its hosts are always used, whether or not the router
49644 supplies a host list.
49646 <para revisionflag="changed">
49647 The port that is used is taken from the transport, if it is specified and is a
49648 remote transport. (For routers that do verification only, no transport need be
49649 specified.) Otherwise, the default SMTP port is used. If a remote transport
49650 specifies an outgoing interface, this is used; otherwise the interface is not
49651 specified. Likewise, the text that is used for the HELO command is taken from
49652 the transport’s <option>helo_data</option> option; if there is no transport, the value of
49653 <varname>$smtp_active_hostname</varname> is used.
49655 <para revisionflag="changed">
49656 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
49657 test whether a bounce message could be delivered to the sender address. The
49658 following SMTP commands are sent:
49660 <literallayout revisionflag="changed">
49661 <literal>HELO </literal><<emphasis>local host name</emphasis>>
49662 <literal>MAIL FROM:<></literal>
49663 <literal>RCPT TO:</literal><<emphasis>the address to be tested</emphasis>>
49664 <literal>QUIT</literal>
49667 LHLO is used instead of HELO if the transport’s <option>protocol</option> option is
49668 set to <quote>lmtp</quote>.
49671 A recipient callout check is similar. By default, it also uses an empty address
49672 for the sender. This default is chosen because most hosts do not make use of
49673 the sender address when verifying a recipient. Using the same address means
49674 that a single cache entry can be used for each recipient. Some sites, however,
49675 do make use of the sender address when verifying. These are catered for by the
49676 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
49679 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
49680 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
49681 Exim tries the next host, if any. If there is a problem with all the remote
49682 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
49683 <option>callout</option> option is given, in which case the condition is forced to succeed.
49686 <section id="CALLaddparcall">
49687 <title>Additional parameters for callouts</title>
49689 <indexterm role="concept">
49690 <primary>callout</primary>
49691 <secondary>additional parameters for</secondary>
49693 The <option>callout</option> option can be followed by an equals sign and a number of
49694 optional parameters, separated by commas. For example:
49696 <literallayout class="monospaced">
49697 verify = recipient/callout=10s,defer_ok
49700 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
49701 separate verify options, is retained for backwards compatibility, but is now
49702 deprecated. The additional parameters for <option>callout</option> are as follows:
49706 <term><<emphasis>a time interval</emphasis>></term>
49709 <indexterm role="concept">
49710 <primary>callout timeout</primary>
49711 <secondary>specifying</secondary>
49713 This specifies the timeout that applies for the callout attempt to each host.
49716 <literallayout class="monospaced">
49717 verify = sender/callout=5s
49720 The default is 30 seconds. The timeout is used for each response from the
49721 remote host. It is also used for the intial connection, unless overridden by
49722 the <option>connect</option> parameter.
49724 </listitem></varlistentry>
49726 <term><emphasis role="bold">connect = </emphasis><<emphasis>time interval</emphasis>></term>
49729 <indexterm role="concept">
49730 <primary>callout connection timeout</primary>
49731 <secondary>specifying</secondary>
49733 This parameter makes it possible to set a different (usually smaller) timeout
49734 for making the SMTP connection. For example:
49736 <literallayout class="monospaced">
49737 verify = sender/callout=5s,connect=1s
49740 If not specified, this timeout defaults to the general timeout value.
49742 </listitem></varlistentry>
49744 <term><emphasis role="bold">defer_ok</emphasis></term>
49747 <indexterm role="concept">
49748 <primary>callout defer</primary>
49749 <secondary>action on</secondary>
49751 When this parameter is present, failure to contact any host, or any other kind
49752 of temporary error, is treated as success by the ACL. However, the cache is not
49753 updated in this circumstance.
49755 </listitem></varlistentry>
49757 <term><emphasis role="bold">fullpostmaster</emphasis></term>
49760 <indexterm role="concept">
49761 <primary>callout</primary>
49762 <secondary>full postmaster check</secondary>
49764 This operates like the <option>postmaster</option> option (see below), but if the check for
49765 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
49766 accordance with the specification in RFC 2821. The RFC states that the
49767 unqualified address <emphasis>postmaster</emphasis> should be accepted.
49769 </listitem></varlistentry>
49771 <term><emphasis role="bold">mailfrom = </emphasis><<emphasis>email address</emphasis>></term>
49774 <indexterm role="concept">
49775 <primary>callout</primary>
49776 <secondary>sender when verifying header</secondary>
49778 When verifying addresses in header lines using the <option>header_sender</option>
49779 verification option, Exim behaves by default as if the addresses are envelope
49780 sender addresses from a message. Callout verification therefore tests to see
49781 whether a bounce message could be delivered, by using an empty address in the
49782 MAIL command. However, it is arguable that these addresses might never be used
49783 as envelope senders, and could therefore justifiably reject bounce messages
49784 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
49785 address to use in the MAIL command. For example:
49787 <literallayout class="monospaced">
49788 require verify = header_sender/callout=mailfrom=abcd@x.y.z
49791 This parameter is available only for the <option>header_sender</option> verification option.
49793 </listitem></varlistentry>
49795 <term><emphasis role="bold">maxwait = </emphasis><<emphasis>time interval</emphasis>></term>
49798 <indexterm role="concept">
49799 <primary>callout overall timeout</primary>
49800 <secondary>specifying</secondary>
49802 This parameter sets an overall timeout for performing a callout verification.
49805 <literallayout class="monospaced">
49806 verify = sender/callout=5s,maxwait=30s
49809 This timeout defaults to four times the callout timeout for individual SMTP
49810 commands. The overall timeout applies when there is more than one host that can
49811 be tried. The timeout is checked before trying the next host. This prevents
49812 very long delays if there are a large number of hosts and all are timing out
49813 (for example, when network connections are timing out).
49815 </listitem></varlistentry>
49817 <term><emphasis role="bold">no_cache</emphasis></term>
49820 <indexterm role="concept">
49821 <primary>callout cache</primary>
49822 <secondary>suppressing</secondary>
49824 <indexterm role="concept">
49825 <primary>caching callout</primary>
49826 <secondary>suppressing</secondary>
49828 When this parameter is given, the callout cache is neither read nor updated.
49830 </listitem></varlistentry>
49832 <term><emphasis role="bold">postmaster</emphasis></term>
49835 <indexterm role="concept">
49836 <primary>callout</primary>
49837 <secondary>postmaster; checking</secondary>
49839 When this parameter is set, a sucessful callout check is followed by a similar
49840 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
49841 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
49842 the postmaster check is recorded in a cache record; if it is a failure, this is
49843 used to fail subsequent callouts for the domain without a connection being
49844 made, until the cache record expires.
49846 </listitem></varlistentry>
49848 <term><emphasis role="bold">postmaster_mailfrom = </emphasis><<emphasis>email address</emphasis>></term>
49851 The postmaster check uses an empty sender in the MAIL command by default.
49852 You can use this parameter to do a postmaster check using a different address.
49855 <literallayout class="monospaced">
49856 require verify = sender/callout=postmaster_mailfrom=abc@x.y.z
49859 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
49860 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
49862 <literallayout class="monospaced">
49863 require verify = sender/callout=postmaster_mailfrom=
49866 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
49867 account of the sender address. It is assumed that either the empty address or
49868 a fixed non-empty address will be used. All that Exim remembers is that the
49869 postmaster check for the domain succeeded or failed.
49871 </listitem></varlistentry>
49873 <term><emphasis role="bold">random</emphasis></term>
49876 <indexterm role="concept">
49877 <primary>callout</primary>
49878 <secondary><quote>random</quote> check</secondary>
49880 When this parameter is set, before doing the normal callout check, Exim does a
49881 check for a <quote>random</quote> local part at the same domain. The local part is not
49882 really random – it is defined by the expansion of the option
49883 <option>callout_random_local_part</option>, which defaults to
49885 <literallayout class="monospaced">
49886 $primary_host_name-$tod_epoch-testing
49889 The idea here is to try to determine whether the remote host accepts all local
49890 parts without checking. If it does, there is no point in doing callouts for
49891 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
49892 a cache record, and used to force the current and subsequent callout checks to
49893 succeed without a connection being made, until the cache record expires.
49895 </listitem></varlistentry>
49897 <term><emphasis role="bold">use_postmaster</emphasis></term>
49900 <indexterm role="concept">
49901 <primary>callout</primary>
49902 <secondary>sender for recipient check</secondary>
49904 This parameter applies to recipient callouts only. For example:
49906 <literallayout class="monospaced">
49907 deny !verify = recipient/callout=use_postmaster
49910 <indexterm role="concept">
49911 <primary><varname>$qualify_domain</varname></primary>
49913 It causes a non-empty postmaster address to be used in the MAIL command when
49914 performing the callout for the recipient, and also for a <quote>random</quote> check if
49915 that is configured. The local part of the address is <literal>postmaster</literal> and the
49916 domain is the contents of <varname>$qualify_domain</varname>.
49918 </listitem></varlistentry>
49920 <term><emphasis role="bold">use_sender</emphasis></term>
49923 This option applies to recipient callouts only. For example:
49925 <literallayout class="monospaced">
49926 require verify = recipient/callout=use_sender
49929 It causes the message’s actual sender address to be used in the MAIL
49930 command when performing the callout, instead of an empty address. There is no
49931 need to use this option unless you know that the called hosts make use of the
49932 sender when checking recipients. If used indiscriminately, it reduces the
49933 usefulness of callout caching.
49935 </listitem></varlistentry>
49938 If you use any of the parameters that set a non-empty sender for the MAIL
49939 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
49940 <option>use_sender</option>), you should think about possible loops. Recipient checking is
49941 usually done between two hosts that are under the same management, and the host
49942 that receives the callouts is not normally configured to do callouts itself.
49943 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
49944 these circumstances.
49947 However, if you use a non-empty sender address for a callout to an arbitrary
49948 host, there is the likelihood that the remote host will itself initiate a
49949 callout check back to your host. As it is checking what appears to be a message
49950 sender, it is likely to use an empty address in MAIL, thus avoiding a
49951 callout loop. However, to be on the safe side it would be best to set up your
49952 own ACLs so that they do not do sender verification checks when the recipient
49953 is the address you use for header sender or postmaster callout checking.
49956 Another issue to think about when using non-empty senders for callouts is
49957 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
49958 by the sender/recipient combination; thus, for any given recipient, many more
49959 actual callouts are performed than when an empty sender or postmaster is used.
49962 <section id="SECTcallvercache">
49963 <title>Callout caching</title>
49965 <indexterm role="concept">
49966 <primary>hints database</primary>
49967 <secondary>callout cache</secondary>
49969 <indexterm role="concept">
49970 <primary>callout</primary>
49971 <secondary>caching</secondary>
49973 <indexterm role="concept">
49974 <primary>caching</primary>
49975 <secondary>callout</secondary>
49977 Exim caches the results of callouts in order to reduce the amount of resources
49978 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
49979 option. A hints database called <quote>callout</quote> is used for the cache. Two
49980 different record types are used: one records the result of a callout check for
49981 a specific address, and the other records information that applies to the
49982 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
49985 When an original callout fails, a detailed SMTP error message is given about
49986 the failure. However, for subsequent failures use the cache data, this message
49990 The expiry times for negative and positive address cache records are
49991 independent, and can be set by the global options <option>callout_negative_expire</option>
49992 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
49995 If a host gives a negative response to an SMTP connection, or rejects any
49996 commands up to and including
49998 <literallayout class="monospaced">
50002 (but not including the MAIL command with a non-empty address),
50003 any callout attempt is bound to fail. Exim remembers such failures in a
50004 domain cache record, which it uses to fail callouts for the domain without
50005 making new connections, until the domain record times out. There are two
50006 separate expiry times for domain cache records:
50007 <option>callout_domain_negative_expire</option> (default 3h) and
50008 <option>callout_domain_positive_expire</option> (default 7d).
50011 Domain records expire when the negative expiry time is reached if callouts
50012 cannot be made for the domain, or if the postmaster check failed.
50013 Otherwise, they expire when the positive expiry time is reached. This
50014 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
50015 will eventually be noticed.
50018 The callout caching mechanism is based on the domain of the address that is
50019 being tested. If the domain routes to several hosts, it is assumed that their
50020 behaviour will be the same.
50023 <section id="SECTsenaddver">
50024 <title>Sender address verification reporting</title>
50026 <indexterm role="concept">
50027 <primary>verifying</primary>
50028 <secondary>suppressing error details</secondary>
50030 See section <xref linkend="SECTaddressverification"/> for a general discussion of
50031 verification. When sender verification fails in an ACL, the details of the
50032 failure are given as additional output lines before the 550 response to the
50033 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
50036 <literallayout class="monospaced">
50037 MAIL FROM:<xyz@abc.example>
50039 RCPT TO:<pqr@def.example>
50040 550-Verification failed for <xyz@abc.example>
50041 550-Called: 192.168.34.43
50042 550-Sent: RCPT TO:<xyz@abc.example>
50043 550-Response: 550 Unknown local part xyz in <xyz@abc.example>
50044 550 Sender verification failed
50047 If more than one RCPT command fails in the same way, the details are given
50048 only for the first of them. However, some administrators do not want to send
50049 out this much information. You can suppress the details by adding
50050 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
50053 <literallayout class="monospaced">
50054 verify = sender/no_details
50057 <section id="SECTredirwhilveri">
50058 <title>Redirection while verifying</title>
50060 <indexterm role="concept">
50061 <primary>verifying</primary>
50062 <secondary>redirection while</secondary>
50064 <indexterm role="concept">
50065 <primary>address redirection</primary>
50066 <secondary>while verifying</secondary>
50068 A dilemma arises when a local address is redirected by aliasing or forwarding
50069 during verification: should the generated addresses themselves be verified,
50070 or should the successful expansion of the original address be enough to verify
50071 it? By default, Exim takes the following pragmatic approach:
50076 When an incoming address is redirected to just one child address, verification
50077 continues with the child address, and if that fails to verify, the original
50078 verification also fails.
50083 When an incoming address is redirected to more than one child address,
50084 verification does not continue. A success result is returned.
50089 This seems the most reasonable behaviour for the common use of aliasing as a
50090 way of redirecting different local parts to the same mailbox. It means, for
50091 example, that a pair of alias entries of the form
50093 <literallayout class="monospaced">
50095 aw123: :fail: Gone away, no forwarding address
50098 work as expected, with both local parts causing verification failure. When a
50099 redirection generates more than one address, the behaviour is more like a
50100 mailing list, where the existence of the alias itself is sufficient for
50101 verification to succeed.
50104 It is possible, however, to change the default behaviour so that all successful
50105 redirections count as successful verifications, however many new addresses are
50106 generated. This is specified by the <option>success_on_redirect</option> verification
50107 option. For example:
50109 <literallayout class="monospaced">
50110 require verify = recipient/success_on_redirect/callout=10s
50113 In this example, verification succeeds if a router generates a new address, and
50114 the callout does not occur, because no address was routed to a remote host.
50116 <para revisionflag="changed">
50117 When verification is being tested via the <option>-bv</option> option, the treatment of
50118 redirections is as just described, unless the <option>-v</option> or any debugging option is
50119 also specified. In that case, full verification is done for every generated
50120 address and a report is output for each of them.
50123 <section id="SECTverifyCSA">
50124 <title>Client SMTP authorization (CSA)</title>
50126 <indexterm role="concept">
50127 <primary>CSA</primary>
50128 <secondary>verifying</secondary>
50130 Client SMTP Authorization is a system that allows a site to advertise
50131 which machines are and are not permitted to send email. This is done by placing
50132 special SRV records in the DNS; these are looked up using the client’s HELO
50133 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
50134 Authorization checks in Exim are performed by the ACL condition:
50136 <literallayout class="monospaced">
50140 This fails if the client is not authorized. If there is a DNS problem, or if no
50141 valid CSA SRV record is found, or if the client is authorized, the condition
50142 succeeds. These three cases can be distinguished using the expansion variable
50143 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
50144 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
50145 be likely to cause problems for legitimate email.
50148 The error messages produced by the CSA code include slightly more
50149 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
50150 looking up the CSA SRV record, or problems looking up the CSA target
50151 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
50156 The client’s host name is explicitly not authorized.
50161 The client’s IP address does not match any of the CSA target IP addresses.
50166 The client’s host name is authorized but it has no valid target IP addresses
50167 (for example, the target’s addresses are IPv6 and the client is using IPv4).
50172 The client’s host name has no CSA SRV record but a parent domain has asserted
50173 that all subdomains must be explicitly authorized.
50178 The <option>csa</option> verification condition can take an argument which is the domain to
50179 use for the DNS query. The default is:
50181 <literallayout class="monospaced">
50182 verify = csa/$sender_helo_name
50185 This implementation includes an extension to CSA. If the query domain
50186 is an address literal such as [192.0.2.95], or if it is a bare IP
50187 address, Exim searches for CSA SRV records in the reverse DNS as if
50188 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
50191 <literallayout class="monospaced">
50192 verify = csa/$sender_host_address
50195 In fact, this is the check that Exim performs if the client does not say HELO.
50196 This extension can be turned off by setting the main configuration option
50197 <option>dns_csa_use_reverse</option> to be false.
50200 If a CSA SRV record is not found for the domain itself, a search
50201 is performed through its parent domains for a record which might be
50202 making assertions about subdomains. The maximum depth of this search is limited
50203 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
50204 default. Exim does not look for CSA SRV records in a top level domain, so the
50205 default settings handle HELO domains as long as seven
50206 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
50207 of legitimate HELO domains.
50210 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
50211 direct SRV lookups, this is not sufficient because of the extra parent domain
50212 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
50213 addresses into lookups in the reverse DNS space. The result of a successful
50216 <literallayout class="monospaced">
50217 ${lookup dnsdb {csa=$sender_helo_name}}
50220 has two space-separated fields: an authorization code and a target host name.
50221 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
50222 authorization required but absent, or <quote>?</quote> for unknown.
50225 <section id="SECTverifyPRVS">
50226 <title>Bounce address tag validation</title>
50228 <indexterm role="concept">
50229 <primary>BATV</primary>
50230 <secondary>verifying</secondary>
50232 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
50233 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
50234 Genuine incoming bounce messages should therefore always be addressed to
50235 recipients that have a valid tag. This scheme is a way of detecting unwanted
50236 bounce messages caused by sender address forgeries (often called <quote>collateral
50237 spam</quote>), because the recipients of such messages do not include valid tags.
50240 There are two expansion items to help with the implementation of the BATV
50241 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
50242 the original envelope sender address by using a simple key to add a hash of the
50243 address and some time-based randomizing information. The <option>prvs</option> expansion
50244 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
50245 The syntax of these expansion items is described in section
50246 <xref linkend="SECTexpansionitems"/>.
50249 As an example, suppose the secret per-address keys are stored in an MySQL
50250 database. A query to look up the key for an address could be defined as a macro
50253 <literallayout class="monospaced">
50254 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
50255 WHERE sender='${quote_mysql:$prvscheck_address}'\
50259 Suppose also that the senders who make use of BATV are defined by an address
50260 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
50263 <literallayout class="monospaced">
50264 # Bounces: drop unsigned addresses for BATV senders
50265 deny message = This address does not send an unsigned reverse path.
50267 recipients = +batv_senders
50269 # Bounces: In case of prvs-signed address, check signature.
50270 deny message = Invalid reverse path signature.
50272 condition = ${prvscheck {$local_part@$domain}\
50273 {PRVSCHECK_SQL}{1}}
50274 !condition = $prvscheck_result
50277 The first statement rejects recipients for bounce messages that are addressed
50278 to plain BATV sender addresses, because it is known that BATV senders do not
50279 send out messages with plain sender addresses. The second statement rejects
50280 recipients that are prvs-signed, but with invalid signatures (either because
50281 the key is wrong, or the signature has timed out).
50284 A non-prvs-signed address is not rejected by the second statement, because the
50285 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
50286 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
50287 the first argument is a syntactically valid prvs-signed address, the yield is
50288 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
50289 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
50290 of the checks (empty for failure, <quote>1</quote> for success).
50293 There are two more issues you must consider when implementing prvs-signing.
50294 Firstly, you need to ensure that prvs-signed addresses are not blocked by your
50295 ACLs. A prvs-signed address contains a slash character, but the default Exim
50296 configuration contains this statement in the RCPT ACL:
50298 <literallayout class="monospaced">
50299 deny message = Restricted characters in address
50300 domains = +local_domains
50301 local_parts = ^[.] : ^.*[@%!/|]
50304 This is a conservative rule that blocks local parts that contain slashes. You
50305 should remove the slash in the last line.
50308 Secondly, you have to ensure that the routers accept prvs-signed addresses and
50309 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
50310 router to remove the signature with a configuration along these lines:
50312 <literallayout class="monospaced">
50315 data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
50318 This works because, if the third argument of <option>prvscheck</option> is empty, the result
50319 of the expansion of a prvs-signed address is the decoded value of the original
50320 address. This router should probably be the first of your routers that handles
50324 To create BATV-signed addresses in the first place, a transport of this form
50327 <literallayout class="monospaced">
50328 external_smtp_batv:
50330 return_path = ${prvs {$return_path} \
50331 {${lookup mysql{SELECT \
50332 secret FROM batv_prvs WHERE \
50333 sender='${quote_mysql:$sender_address}'} \
50337 If no key can be found for the existing return path, no signing takes place.
50340 <section id="SECTrelaycontrol">
50341 <title>Using an ACL to control relaying</title>
50343 <indexterm role="concept">
50344 <primary>access control lists (ACLs)</primary>
50345 <secondary>relay control</secondary>
50347 <indexterm role="concept">
50348 <primary>relaying</primary>
50349 <secondary>control by ACL</secondary>
50351 <indexterm role="concept">
50352 <primary>policy control</primary>
50353 <secondary>relay control</secondary>
50355 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
50356 delivers it directly to another host as a result of a remote address contained
50357 within it. Redirecting a local address via an alias or forward file and then
50358 passing the message on to another host is not relaying,
50359 <indexterm role="concept">
50360 <primary><quote>percent hack</quote></primary>
50362 but a redirection as a result of the <quote>percent hack</quote> is.
50365 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
50366 A host which is acting as a gateway or an MX backup is concerned with incoming
50367 relaying from arbitrary hosts to a specific set of domains. On the other hand,
50368 a host which is acting as a smart host for a number of clients is concerned
50369 with outgoing relaying from those clients to the Internet at large. Often the
50370 same host is fulfilling both functions,
50371 but in principle these two kinds of relaying are entirely independent. What is
50372 not wanted is the transmission of mail from arbitrary remote hosts through your
50373 system to arbitrary domains.
50376 You can implement relay control by means of suitable statements in the ACL that
50377 runs for each RCPT command. For convenience, it is often easiest to use
50378 Exim’s named list facility to define the domains and hosts involved. For
50379 example, suppose you want to do the following:
50384 Deliver a number of domains to mailboxes on the local host (or process them
50385 locally in some other way). Let’s say these are <emphasis>my.dom1.example</emphasis> and
50386 <emphasis>my.dom2.example</emphasis>.
50391 Relay mail for a number of other domains for which you are the secondary MX.
50392 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
50397 Relay mail from the hosts on your local LAN, to whatever domains are involved.
50398 Suppose your LAN is 192.168.45.0/24.
50403 In the main part of the configuration, you put the following definitions:
50405 <literallayout class="monospaced">
50406 domainlist local_domains = my.dom1.example : my.dom2.example
50407 domainlist relay_domains = friend1.example : friend2.example
50408 hostlist relay_hosts = 192.168.45.0/24
50411 Now you can use these definitions in the ACL that is run for every RCPT
50414 <literallayout class="monospaced">
50416 accept domains = +local_domains : +relay_domains
50417 accept hosts = +relay_hosts
50420 The first statement accepts any RCPT command that contains an address in
50421 the local or relay domains. For any other domain, control passes to the second
50422 statement, which accepts the command only if it comes from one of the relay
50423 hosts. In practice, you will probably want to make your ACL more sophisticated
50424 than this, for example, by including sender and recipient verification. The
50425 default configuration includes a more comprehensive example, which is described
50426 in chapter <xref linkend="CHAPdefconfil"/>.
50429 <section id="SECTcheralcon">
50430 <title>Checking a relay configuration</title>
50432 <indexterm role="concept">
50433 <primary>relaying</primary>
50434 <secondary>checking control of</secondary>
50436 You can check the relay characteristics of your configuration in the same way
50437 that you can test any ACL behaviour for an incoming SMTP connection, by using
50438 the <option>-bh</option> option to run a fake SMTP session with which you interact.
50441 For specifically testing for unwanted relaying, the host
50442 <emphasis>relay-test.mail-abuse.org</emphasis> provides a useful service. If you telnet to this
50443 host from the host on which Exim is running, using the normal telnet port, you
50444 will see a normal telnet connection message and then quite a long delay. Be
50445 patient. The remote host is making an SMTP connection back to your host, and
50446 trying a number of common probes to test for open relay vulnerability. The
50447 results of the tests will eventually appear on your terminal.
50448 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
50453 <chapter id="CHAPexiscan">
50454 <title>Content scanning at ACL time</title>
50456 <indexterm role="concept" id="IIDcosca" class="startofrange">
50457 <primary>content scanning</primary>
50458 <secondary>at ACL time</secondary>
50460 The extension of Exim to include content scanning at ACL time, formerly known
50461 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
50462 was integrated into the main source for Exim release 4.50, and Tom continues to
50463 maintain it. Most of the wording of this chapter is taken from Tom’s
50467 It is also possible to scan the content of messages at other times. The
50468 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
50469 scanning after all the ACLs have run. A transport filter can be used to scan
50470 messages at delivery time (see the <option>transport_filter</option> option, described in
50471 chapter <xref linkend="CHAPtransportgeneric"/>).
50474 If you want to include the ACL-time content-scanning features when you compile
50475 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
50476 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
50481 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
50482 for all MIME parts for SMTP and non-SMTP messages, respectively.
50487 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
50488 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
50489 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
50494 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
50495 of messages, or parts of messages, for debugging purposes.
50500 Additional expansion variables that are set in the new ACL and by the new
50506 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
50511 There is another content-scanning configuration option for <filename>Local/Makefile</filename>,
50512 called WITH_OLD_DEMIME. If this is set, the old, deprecated <option>demime</option> ACL
50513 condition is compiled, in addition to all the other content-scanning features.
50516 Content-scanning is continually evolving, and new features are still being
50517 added. While such features are still unstable and liable to incompatible
50518 changes, they are made available in Exim by setting options whose names begin
50519 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
50520 this manual. You can find out about them by reading the file called
50521 <filename>doc/experimental.txt</filename>.
50524 All the content-scanning facilites work on a MBOX copy of the message that is
50525 temporarily created in a file called:
50528 <<emphasis>spool_directory</emphasis>><literal>/scan/</literal><<emphasis>message_id</emphasis>>/<<emphasis>message_id</emphasis>><literal>.eml</literal>
50531 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
50532 expect an MBOX-like structure inside that file. The file is created when the
50533 first content scanning facility is called. Subsequent calls to content
50534 scanning conditions open the same file again. The directory is recursively
50535 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
50537 <literallayout class="monospaced">
50538 control = no_mbox_unspool
50541 has been encountered. When the MIME ACL decodes files, they are put into the
50542 same directory by default.
50544 <section id="SECTscanvirus">
50545 <title>Scanning for viruses</title>
50547 <indexterm role="concept">
50548 <primary>virus scanning</primary>
50550 <indexterm role="concept">
50551 <primary>content scanning</primary>
50552 <secondary>for viruses</secondary>
50554 <indexterm role="concept">
50555 <primary>content scanning</primary>
50556 <secondary>the <option>malware</option> condition</secondary>
50558 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
50559 It supports a <quote>generic</quote> interface to scanners called via the shell, and
50560 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
50561 in memory and thus are much faster.
50564 <indexterm role="concept">
50565 <primary><option>av_scanner</option></primary>
50567 You can set the <option>av_scanner</option> option in first part of the Exim configuration
50568 file to specify which scanner to use, together with any additional options that
50569 are needed. The basic syntax is as follows:
50572 <literal>av_scanner = <</literal><emphasis>scanner-type</emphasis><literal>>:<</literal><emphasis>option1</emphasis><literal>>:<</literal><emphasis>option2</emphasis><literal>>:[...]</literal>
50575 If you do not set <option>av_scanner</option>, it defaults to
50577 <literallayout class="monospaced">
50578 av_scanner = sophie:/var/run/sophie
50581 If the value of <option>av_scanner</option> starts with dollar character, it is expanded
50582 before use. The following scanner types are supported in this release:
50586 <term><option>aveserver</option></term>
50589 <indexterm role="concept">
50590 <primary>virus scanners</primary>
50591 <secondary>Kaspersky</secondary>
50593 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
50594 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
50595 which is the path to the daemon’s UNIX socket. The default is shown in this
50598 <literallayout class="monospaced">
50599 av_scanner = aveserver:/var/run/aveserver
50601 </listitem></varlistentry>
50603 <term><option>clamd</option></term>
50606 <indexterm role="concept">
50607 <primary>virus scanners</primary>
50608 <secondary>clamd</secondary>
50610 This daemon-type scanner is GPL and free. You can get it at
50611 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
50612 unpack MIME containers, so it used to be recommended to unpack MIME attachments
50613 in the MIME ACL. This no longer believed to be necessary. One option is
50614 required: either the path and name of a UNIX socket file, or a hostname or IP
50615 number, and a port, separated by space, as in the second of these examples:
50617 <literallayout class="monospaced">
50618 av_scanner = clamd:/opt/clamd/socket
50619 av_scanner = clamd:192.168.2.100 1234
50622 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
50623 contributing the code for this scanner.
50625 </listitem></varlistentry>
50627 <term><option>cmdline</option></term>
50630 <indexterm role="concept">
50631 <primary>virus scanners</primary>
50632 <secondary>command line interface</secondary>
50634 This is the keyword for the generic command line scanner interface. It can be
50635 used to attach virus scanners that are invoked from the shell. This scanner
50636 type takes 3 mandatory options:
50638 <orderedlist numeration="arabic">
50641 The full path and name of the scanner binary, with all command line options,
50642 and a placeholder (<literal>%s</literal>) for the directory to scan.
50647 A regular expression to match against the STDOUT and STDERR output of the
50648 virus scanner. If the expression matches, a virus was found. You must make
50649 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
50650 the <quote>trigger</quote> expression.
50655 Another regular expression, containing exactly one pair of parentheses, to
50656 match the name of the virus found in the scanners output. This is called the
50657 <quote>name</quote> expression.
50662 For example, Sophos Sweep reports a virus on a line like this:
50664 <literallayout class="monospaced">
50665 Virus 'W32/Magistr-B' found in file ./those.bat
50667 <para revisionflag="changed">
50668 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
50669 name expression, we want to extract the W32/Magistr-B string, so we can match
50670 for the single quotes left and right of it. Altogether, this makes the
50671 configuration setting:
50673 <literallayout class="monospaced" revisionflag="changed">
50674 av_scanner = cmdline:\
50675 /path/to/sweep -ss -all -rec -archive %s:\
50676 found in file:'(.+)'
50678 </listitem></varlistentry>
50679 <varlistentry revisionflag="changed">
50680 <term><option>drweb</option></term>
50682 <para revisionflag="changed">
50683 <indexterm role="concept">
50684 <primary>virus scanners</primary>
50685 <secondary>DrWeb</secondary>
50687 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface takes one
50688 argument, either a full path to a UNIX socket, or an IP address and port
50689 separated by white space, as in these examples:
50691 <literallayout class="monospaced" revisionflag="changed">
50692 av_scanner = drweb:/var/run/drwebd.sock
50693 av_scanner = drweb:192.168.2.20 31337
50695 <para revisionflag="changed">
50696 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
50697 is used. Thanks to Alex Miller for contributing the code for this scanner.
50699 </listitem></varlistentry>
50700 <varlistentry revisionflag="changed">
50701 <term><option>fsecure</option></term>
50703 <para revisionflag="changed">
50704 <indexterm role="concept">
50705 <primary>virus scanners</primary>
50706 <secondary>F-Secure</secondary>
50708 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
50709 argument which is the path to a UNIX socket. For example:
50711 <literallayout class="monospaced" revisionflag="changed">
50712 av_scanner = fsecure:/path/to/.fsav
50714 <para revisionflag="changed">
50715 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
50716 Thelmen for contributing the code for this scanner.
50718 </listitem></varlistentry>
50719 <varlistentry revisionflag="changed">
50720 <term><option>kavdaemon</option></term>
50722 <para revisionflag="changed">
50723 <indexterm role="concept">
50724 <primary>virus scanners</primary>
50725 <secondary>Kaspersky</secondary>
50727 This is the scanner daemon of Kaspersky Version 4. This version of the
50728 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
50729 scanner type takes one option, which is the path to the daemon’s UNIX socket.
50732 <literallayout class="monospaced" revisionflag="changed">
50733 av_scanner = kavdaemon:/opt/AVP/AvpCtl
50735 <para revisionflag="changed">
50736 The default path is <filename>/var/run/AvpCtl</filename>.
50738 </listitem></varlistentry>
50739 <varlistentry revisionflag="changed">
50740 <term><option>mksd</option></term>
50742 <para revisionflag="changed">
50743 <indexterm role="concept">
50744 <primary>virus scanners</primary>
50745 <secondary>mksd</secondary>
50747 This is a daemon type scanner that is aimed mainly at Polish users, though some
50748 parts of documentation are now available in English. You can get it at
50749 <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
50750 the maximum number of processes used simultaneously to scan the attachments,
50751 provided that the demime facility is employed and also provided that mksd has
50752 been run with at least the same number of child processes. For example:
50754 <literallayout class="monospaced" revisionflag="changed">
50755 av_scanner = mksd:2
50757 <para revisionflag="changed">
50758 You can safely omit this option (the default value is 1).
50760 </listitem></varlistentry>
50761 <varlistentry revisionflag="changed">
50762 <term><option>sophie</option></term>
50764 <para revisionflag="changed">
50765 <indexterm role="concept">
50766 <primary>virus scanners</primary>
50767 <secondary>Sophos and Sophie</secondary>
50769 Sophie is a daemon that uses Sophos’ <option>libsavi</option> library to scan for viruses.
50770 You can get Sophie at <emphasis role="bold"><ulink url="http://www.clanfield.info/sophie/">http://www.clanfield.info/sophie/</ulink></emphasis>. The only option
50771 for this scanner type is the path to the UNIX socket that Sophie uses for
50772 client communication. For example:
50774 <literallayout class="monospaced" revisionflag="changed">
50775 av_scanner = sophie:/tmp/sophie
50777 <para revisionflag="changed">
50778 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
50781 </listitem></varlistentry>
50783 <para revisionflag="changed">
50784 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
50785 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
50788 <para revisionflag="changed">
50789 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
50790 makes it possible to use different scanners. See further below for an example.
50791 The <option>malware</option> condition caches its results, so when you use it multiple times
50792 for the same message, the actual scanning process is only carried out once.
50793 However, using expandable items in <option>av_scanner</option> disables this caching, in
50794 which case each use of the <option>malware</option> condition causes a new scan of the
50797 <para revisionflag="changed">
50798 The <option>malware</option> condition takes a right-hand argument that is expanded before
50799 use. It can then be one of
50801 <itemizedlist revisionflag="changed">
50803 <para revisionflag="changed">
50804 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
50805 The condition succeeds if a virus was found, and fail otherwise. This is the
50810 <para revisionflag="changed">
50811 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
50812 the condition fails immediately.
50816 <para revisionflag="changed">
50817 A regular expression, in which case the message is scanned for viruses. The
50818 condition succeeds if a virus is found and its name matches the regular
50819 expression. This allows you to take special actions on certain types of virus.
50823 <para revisionflag="changed">
50824 You can append <literal>/defer_ok</literal> to the <option>malware</option> condition to accept messages
50825 even if there is a problem with the virus scanner. Otherwise, such a problem
50826 causes the ACL to defer.
50828 <para revisionflag="changed">
50829 <indexterm role="concept">
50830 <primary><varname>$malware_name</varname></primary>
50832 When a virus is found, the condition sets up an expansion variable called
50833 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
50834 <option>message</option> modifier that specifies the error returned to the sender, and/or in
50837 <para revisionflag="changed">
50838 If your virus scanner cannot unpack MIME and TNEF containers itself, you should
50839 use the <option>demime</option> condition (see section <xref linkend="SECTdemimecond"/>) before the
50840 <option>malware</option> condition.
50842 <para revisionflag="changed">
50843 Here is a very simple scanning example:
50845 <literallayout class="monospaced" revisionflag="changed">
50846 deny message = This message contains malware ($malware_name)
50850 <para revisionflag="changed">
50851 The next example accepts messages when there is a problem with the scanner:
50853 <literallayout class="monospaced" revisionflag="changed">
50854 deny message = This message contains malware ($malware_name)
50856 malware = */defer_ok
50858 <para revisionflag="changed">
50859 The next example shows how to use an ACL variable to scan with both sophie and
50860 aveserver. It assumes you have set:
50862 <literallayout class="monospaced" revisionflag="changed">
50863 av_scanner = $acl_m0
50865 <para revisionflag="changed">
50866 in the main Exim configuration.
50868 <literallayout class="monospaced" revisionflag="changed">
50869 deny message = This message contains malware ($malware_name)
50870 set acl_m0 = sophie
50873 deny message = This message contains malware ($malware_name)
50874 set acl_m0 = aveserver
50878 <section id="SECTscanspamass" revisionflag="changed">
50879 <title>Scanning with SpamAssassin</title>
50880 <para revisionflag="changed">
50881 <indexterm role="concept">
50882 <primary>content scanning</primary>
50883 <secondary>for spam</secondary>
50885 <indexterm role="concept">
50886 <primary>spam scanning</primary>
50888 <indexterm role="concept">
50889 <primary>SpamAssassin</primary>
50890 <secondary>scanning with</secondary>
50892 The <option>spam</option> ACL condition calls SpamAssassin’s <option>spamd</option> daemon to get a spam
50893 score and a report for the message. You can get SpamAssassin at
50894 <emphasis role="bold"><ulink url="http://www.spamassassin.org">http://www.spamassassin.org</ulink></emphasis>, or, if you have a working Perl
50895 installation, you can use CPAN by running:
50897 <literallayout class="monospaced" revisionflag="changed">
50898 perl -MCPAN -e 'install Mail::SpamAssassin'
50900 <para revisionflag="changed">
50901 SpamAssassin has its own set of configuration files. Please review its
50902 documentation to see how you can tweak it. The default installation should work
50905 <para revisionflag="changed">
50906 <indexterm role="concept">
50907 <primary><option>spamd_address</option></primary>
50909 After having installed and configured SpamAssassin, start the <option>spamd</option> daemon.
50910 By default, it listens on 127.0.0.1, TCP port 783. If you use another host or
50911 port for <option>spamd</option>, you must set the <option>spamd_address</option> option in the global
50912 part of the Exim configuration as follows (example):
50914 <literallayout class="monospaced" revisionflag="changed">
50915 spamd_address = 192.168.99.45 387
50917 <para revisionflag="changed">
50918 You do not need to set this option if you use the default. As of version 2.60,
50919 <option>spamd</option> also supports communication over UNIX sockets. If you want to use
50920 these, supply <option>spamd_address</option> with an absolute file name instead of a
50923 <literallayout class="monospaced" revisionflag="changed">
50924 spamd_address = /var/run/spamd_socket
50926 <para revisionflag="changed">
50927 You can have multiple <option>spamd</option> servers to improve scalability. These can
50928 reside on other hardware reachable over the network. To specify multiple
50929 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
50930 option, separated with colons:
50932 <literallayout class="monospaced" revisionflag="changed">
50933 spamd_address = 192.168.2.10 783 : \
50934 192.168.2.11 783 : \
50937 <para revisionflag="changed">
50938 Up to 32 <option>spamd</option> servers are supported. The servers are queried in a random
50939 fashion. When a server fails to respond to the connection attempt, all other
50940 servers are tried until one succeeds. If no server responds, the <option>spam</option>
50943 <para revisionflag="changed">
50944 <emphasis role="bold">Warning</emphasis>: It is not possible to use the UNIX socket connection method with
50945 multiple <option>spamd</option> servers.
50948 <section revisionflag="changed">
50949 <title>Calling SpamAssassin from an Exim ACL</title>
50950 <para revisionflag="changed">
50951 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
50953 <literallayout class="monospaced" revisionflag="changed">
50954 deny message = This message was classified as SPAM
50957 <para revisionflag="changed">
50958 The right-hand side of the <option>spam</option> condition specifies a name. This is
50959 relevant if you have set up multiple SpamAssassin profiles. If you do not want
50960 to scan using a specific profile, but rather use the SpamAssassin system-wide
50961 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
50962 However, you must put something on the right-hand side.
50964 <para revisionflag="changed">
50965 The name allows you to use per-domain or per-user antispam profiles in
50966 principle, but this is not straightforward in practice, because a message may
50967 have multiple recipients, not necessarily all in the same domain. Because the
50968 <option>spam</option> condition has to be called from a DATA ACL in order to be able to
50969 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
50972 <para revisionflag="changed">
50973 The right-hand side of the <option>spam</option> condition is expanded before being used, so
50974 you can put lookups or conditions there. When the right-hand side evaluates to
50975 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
50978 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
50979 large ones may cause significant performance degredation. As most spam messages
50980 are quite small, it is recommended that you do not scan the big ones. For
50983 <literallayout class="monospaced">
50984 deny message = This message was classified as SPAM
50985 condition = ${if < {$message_size}{10K}}
50989 The <option>spam</option> condition returns true if the threshold specified in the user’s
50990 SpamAssassin profile has been matched or exceeded. If you want to use the
50991 <option>spam</option> condition for its side effects (see the variables below), you can make
50992 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
50995 <indexterm role="concept">
50996 <primary>spam scanning</primary>
50997 <secondary>returned variables</secondary>
50999 When the <option>spam</option> condition is run, it sets up a number of expansion
51000 variables. With the exception of <varname>$spam_score_int</varname>, these are usable only
51001 within ACLs; their values are not retained with the message and so cannot be
51002 used at delivery time.
51006 <term><varname>$spam_score</varname></term>
51009 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
51010 for inclusion in log or reject messages.
51012 </listitem></varlistentry>
51014 <term><varname>$spam_score_int</varname></term>
51017 The spam score of the message, multiplied by ten, as an integer value. For
51018 example <quote>34</quote> or <quote>305</quote>. This is useful for numeric comparisons in
51019 conditions. This variable is special; its value is saved with the message, and
51020 written to Exim’s spool file. This means that it can be used during the whole
51021 life of the message on your Exim system, in particular, in routers or
51022 transports during the later delivery phase.
51024 </listitem></varlistentry>
51026 <term><varname>$spam_bar</varname></term>
51029 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
51030 integer part of the spam score value. A spam score of 4.4 would have a
51031 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
51032 headers, since MUAs can match on such strings.
51034 </listitem></varlistentry>
51036 <term><varname>$spam_report</varname></term>
51039 A multiline text table, containing the full SpamAssassin report for the
51040 message. Useful for inclusion in headers or reject messages.
51042 </listitem></varlistentry>
51045 The <option>spam</option> condition caches its results. If you call it again with the same
51046 user name, it does not scan again, but rather returns the same values as
51050 The <option>spam</option> condition returns DEFER if there is any error while running the
51051 message through SpamAssassin. If you want to treat DEFER as FAIL (to pass on to
51052 the next ACL statement block), append <literal>/defer_ok</literal> to the right-hand side of
51053 the spam condition, like this:
51055 <literallayout class="monospaced">
51056 deny message = This message was classified as SPAM
51057 spam = joe/defer_ok
51060 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
51063 Here is a longer, commented example of the use of the <option>spam</option>
51066 <literallayout class="monospaced">
51067 # put headers in all messages (no matter if spam or not)
51068 warn spam = nobody:true
51069 add_header = X-Spam-Score: $spam_score ($spam_bar)
51070 add_header = X-Spam-Report: $spam_report
51072 # add second subject line with *SPAM* marker when message
51073 # is over threshold
51075 add_header = Subject: *SPAM* $h_Subject:
51077 # reject spam at high scores (> 12)
51078 deny message = This message scored $spam_score spam points.
51080 condition = ${if >{$spam_score_int}{120}{1}{0}}
51083 <section id="SECTscanmimepart">
51084 <title>Scanning MIME parts</title>
51086 <indexterm role="concept">
51087 <primary>content scanning</primary>
51088 <secondary>MIME parts</secondary>
51090 <indexterm role="concept">
51091 <primary>MIME content scanning</primary>
51093 <indexterm role="concept">
51094 <primary><option>acl_smtp_mime</option></primary>
51096 <indexterm role="concept">
51097 <primary><option>acl_not_smtp_mime</option></primary>
51099 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
51100 each MIME part of an SMTP message, including multipart types, in the sequence
51101 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
51102 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
51103 options may both refer to the same ACL if you want the same processing in both
51107 These ACLs are called (possibly many times) just before the
51108 <option>acl_smtp_data</option> ACL in the case of an SMTP message, or just before the
51109 <option>acl_not_smtp</option> ACL in the case of a non-SMTP message. However, a MIME ACL
51110 is called only if the message contains a <emphasis>MIME-Version:</emphasis> header line. When a
51111 call to a MIME ACL does not yield <quote>accept</quote>, ACL processing is aborted and the
51112 appropriate result code is sent to the client. In the case of an SMTP message,
51113 the <option>acl_smtp_data</option> ACL is not called when this happens.
51116 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
51117 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
51118 condition to match against the raw MIME part. You can also use the
51119 <option>mime_regex</option> condition to match against the decoded MIME part (see section
51120 <xref linkend="SECTscanregex"/>).
51123 At the start of a MIME ACL, a number of variables are set from the header
51124 information for the relevant MIME part. These are described below. The contents
51125 of the MIME part are not by default decoded into a disk file except for MIME
51126 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
51127 part into a disk file, you can use the <option>decode</option> modifier. The general syntax
51131 <literal>decode = [/</literal><<emphasis>path</emphasis>><literal>/]</literal><<emphasis>filename</emphasis>>
51134 The right hand side is expanded before use. After expansion,
51137 <orderedlist numeration="arabic">
51140 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
51145 The string <quote>default</quote>. In that case, the file is put in the temporary
51146 <quote>default</quote> directory <<emphasis>spool_directory</emphasis>><filename>/scan/</filename><<emphasis>message_id</emphasis>><filename>/</filename> with
51147 a sequential file name consisting of the message id and a sequence number. The
51148 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
51153 A full path name starting with a slash. If the full name is an existing
51154 directory, it is used as a replacement for the default directory. The filename
51155 is then sequentially assigned. If the path does not exist, it is used as
51156 the full path and file name.
51161 If the string does not start with a slash, it is used as the
51162 filename, and the default path is then used.
51167 You can easily decode a file with its original, proposed filename using
51169 <literallayout class="monospaced">
51170 decode = $mime_filename
51173 However, you should keep in mind that <varname>$mime_filename</varname> might contain
51174 anything. If you place files outside of the default path, they are not
51175 automatically unlinked.
51178 For RFC822 attachments (these are messages attached to messages, with a
51179 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
51180 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
51181 variable is set (see below). Attached messages are always decoded to disk
51182 before being checked, and the files are unlinked once the check is done.
51185 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
51186 used to match regular expressions against raw and decoded MIME parts,
51187 respectively. They are described in section <xref linkend="SECTscanregex"/>.
51190 <indexterm role="concept">
51191 <primary>MIME content scanning</primary>
51192 <secondary>returned variables</secondary>
51194 The following list describes all expansion variables that are
51195 available in the MIME ACL:
51199 <term><varname>$mime_boundary</varname></term>
51202 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
51203 have a boundary string, which is stored in this variable. If the current part
51204 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
51205 contains the empty string.
51207 </listitem></varlistentry>
51209 <term><varname>$mime_charset</varname></term>
51212 This variable contains the character set identifier, if one was found in the
51213 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
51215 <literallayout class="monospaced">
51221 Please note that this value is not normalized, so you should do matches
51222 case-insensitively.
51224 </listitem></varlistentry>
51226 <term><varname>$mime_content_description</varname></term>
51229 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
51230 header. It can contain a human-readable description of the parts content. Some
51231 implementations repeat the filename for attachments here, but they are usually
51232 only used for display purposes.
51234 </listitem></varlistentry>
51236 <term><varname>$mime_content_disposition</varname></term>
51239 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
51240 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
51242 </listitem></varlistentry>
51244 <term><varname>$mime_content_id</varname></term>
51247 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
51248 This is a unique ID that can be used to reference a part from another part.
51250 </listitem></varlistentry>
51252 <term><varname>$mime_content_size</varname></term>
51255 This variable is set only after the <option>decode</option> modifier (see above) has been
51256 successfully run. It contains the size of the decoded part in kilobytes. The
51257 size is always rounded up to full kilobytes, so only a completely empty part
51258 has a <varname>$mime_content_size</varname> of zero.
51260 </listitem></varlistentry>
51262 <term><varname>$mime_content_transfer_encoding</varname></term>
51265 This variable contains the normalized content of the
51266 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
51267 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
51269 </listitem></varlistentry>
51271 <term><varname>$mime_content_type</varname></term>
51274 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
51275 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
51276 are some examples of popular MIME types, as they may appear in this variable:
51278 <literallayout class="monospaced">
51281 application/octet-stream
51286 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
51289 </listitem></varlistentry>
51291 <term><varname>$mime_decoded_filename</varname></term>
51294 This variable is set only after the <option>decode</option> modifier (see above) has been
51295 successfully run. It contains the full path and file name of the file
51296 containing the decoded data.
51298 </listitem></varlistentry>
51301 <indexterm role="concept">
51302 <primary>RFC 2047</primary>
51307 <term><varname>$mime_filename</varname></term>
51310 This is perhaps the most important of the MIME variables. It contains a
51311 proposed filename for an attachment, if one was found in either the
51312 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
51313 RFC2047 decoded, but no additional sanity checks are done. If no filename was
51314 found, this variable contains the empty string.
51316 </listitem></varlistentry>
51318 <term><varname>$mime_is_coverletter</varname></term>
51321 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
51322 attached data. It can be used to clamp down on flashy or unneccessarily encoded
51323 content in the cover letter, while not restricting attachments at all.
51326 The variable contains 1 (true) for a MIME part believed to be part of the
51327 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
51330 <orderedlist numeration="arabic">
51333 The outermost MIME part of a message is always a cover letter.
51338 If a multipart/alternative or multipart/related MIME part is a cover letter,
51339 so are all MIME subparts within that multipart.
51344 If any other multipart is a cover letter, the first subpart is a cover letter,
51345 and the rest are attachments.
51350 All parts contained within an attachment multipart are attachments.
51355 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
51356 alternative plain text), while allowing HTML files to be attached. HTML
51357 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
51359 <literallayout class="monospaced">
51360 deny message = HTML mail is not accepted here
51361 !condition = $mime_is_rfc822
51362 condition = $mime_is_coverletter
51363 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
51365 </listitem></varlistentry>
51367 <term><varname>$mime_is_multipart</varname></term>
51370 This variable has the value 1 (true) when the current part has the main type
51371 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
51372 Since multipart entities only serve as containers for other parts, you may not
51373 want to carry out specific actions on them.
51375 </listitem></varlistentry>
51377 <term><varname>$mime_is_rfc822</varname></term>
51380 This variable has the value 1 (true) if the current part is not a part of the
51381 checked message itself, but part of an attached message. Attached message
51382 decoding is fully recursive.
51384 </listitem></varlistentry>
51386 <term><varname>$mime_part_count</varname></term>
51389 This variable is a counter that is raised for each processed MIME part. It
51390 starts at zero for the very first part (which is usually a multipart). The
51391 counter is per-message, so it is reset when processing RFC822 attachments (see
51392 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
51393 complete, so you can use it in the DATA ACL to determine the number of MIME
51394 parts of a message. For non-MIME messages, this variable contains the value -1.
51396 </listitem></varlistentry>
51399 <section id="SECTscanregex">
51400 <title>Scanning with regular expressions</title>
51402 <indexterm role="concept">
51403 <primary>content scanning</primary>
51404 <secondary>with regular expressions</secondary>
51406 <indexterm role="concept">
51407 <primary>regular expressions</primary>
51408 <secondary>content scanning with</secondary>
51410 You can specify your own custom regular expression matches on the full body of
51411 the message, or on individual MIME parts.
51414 The <option>regex</option> condition takes one or more regular expressions as arguments and
51415 matches them against the full message (when called in the DATA ACL) or a raw
51416 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
51417 linewise, with a maximum line length of 32K characters. That means you cannot
51418 have multiline matches with the <option>regex</option> condition.
51421 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
51422 to 32K of decoded content (the whole content at once, not linewise). If the
51423 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
51424 is decoded automatically when <option>mime_regex</option> is executed (using default path
51425 and filename values). If the decoded data is larger than 32K, only the first
51426 32K characters are checked.
51429 The regular expressions are passed as a colon-separated list. To include a
51430 literal colon, you must double it. Since the whole right-hand side string is
51431 expanded before being used, you must also escape dollar signs and backslashes
51432 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
51433 Here is a simple example that contains two regular expressions:
51435 <literallayout class="monospaced">
51436 deny message = contains blacklisted regex ($regex_match_string)
51437 regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
51440 The conditions returns true if any one of the regular expressions matches. The
51441 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
51442 matching regular expression.
51445 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
51449 <section id="SECTdemimecond">
51450 <title>The demime condition</title>
51452 <indexterm role="concept">
51453 <primary>content scanning</primary>
51454 <secondary>MIME checking</secondary>
51456 <indexterm role="concept">
51457 <primary>MIME content scanning</primary>
51459 The <option>demime</option> ACL condition provides MIME unpacking, sanity checking and file
51460 extension blocking. It is usable only in the DATA and non-SMTP ACLs. The
51461 <option>demime</option> condition uses a simpler interface to MIME decoding than the MIME
51462 ACL functionality, but provides no additional facilities. Please note that this
51463 condition is deprecated and kept only for backward compatibility. You must set
51464 the WITH_OLD_DEMIME option in <filename>Local/Makefile</filename> at build time to be able to
51465 use the <option>demime</option> condition.
51468 The <option>demime</option> condition unpacks MIME containers in the message. It detects
51469 errors in MIME containers and can match file extensions found in the message
51470 against a list. Using this facility produces files containing the unpacked MIME
51471 parts of the message in the temporary scan directory. If you do antivirus
51472 scanning, it is recommened that you use the <option>demime</option> condition before the
51473 antivirus (<option>malware</option>) condition.
51476 On the right-hand side of the <option>demime</option> condition you can pass a
51477 colon-separated list of file extensions that it should match against. For
51480 <literallayout class="monospaced">
51481 deny message = Found blacklisted file attachment
51482 demime = vbs:com:bat:pif:prf:lnk
51485 If one of the file extensions is found, the condition is true, otherwise it is
51486 false. If there is a temporary error while demimeing (for example, <quote>disk
51487 full</quote>), the condition defers, and the message is temporarily rejected (unless
51488 the condition is on a <option>warn</option> verb).
51491 The right-hand side is expanded before being treated as a list, so you can have
51492 conditions and lookups there. If it expands to an empty string, <quote>false</quote>, or
51493 zero (<quote>0</quote>), no demimeing is done and the condition is false.
51496 The <option>demime</option> condition set the following variables:
51500 <term><varname>$demime_errorlevel</varname></term>
51503 <indexterm role="concept">
51504 <primary><varname>$demime_errorlevel</varname></primary>
51506 When an error is detected in a MIME container, this variable contains the
51507 severity of the error, as an integer number. The higher the value, the more
51508 severe the error (the current maximum value is 3). If this variable is unset or
51509 zero, no error occurred.
51511 </listitem></varlistentry>
51513 <term><varname>$demime_reason</varname></term>
51516 <indexterm role="concept">
51517 <primary><varname>$demime_reason</varname></primary>
51519 When <varname>$demime_errorlevel</varname> is greater than zero, this variable contains a
51520 human-readable text string describing the MIME error that occurred.
51522 </listitem></varlistentry>
51526 <term><varname>$found_extension</varname></term>
51529 <indexterm role="concept">
51530 <primary><varname>$found_extension</varname></primary>
51532 When the <option>demime</option> condition is true, this variable contains the file
51533 extension it found.
51535 </listitem></varlistentry>
51538 Both <varname>$demime_errorlevel</varname> and <varname>$demime_reason</varname> are set by the first call of
51539 the <option>demime</option> condition, and are not changed on subsequent calls.
51542 If you do not want to check for file extensions, but rather use the <option>demime</option>
51543 condition for unpacking or error checking purposes, pass <quote>*</quote> as the
51544 right-hand side value. Here is a more elaborate example of how to use this
51547 <literallayout class="monospaced">
51548 # Reject messages with serious MIME container errors
51549 deny message = Found MIME error ($demime_reason).
51551 condition = ${if >{$demime_errorlevel}{2}{1}{0}}
51553 # Reject known virus spreading file extensions.
51554 # Accepting these is pretty much braindead.
51555 deny message = contains $found_extension file (blacklisted).
51556 demime = com:vbs:bat:pif:scr
51558 # Freeze .exe and .doc files. Postmaster can
51559 # examine them and eventually thaw them.
51560 deny log_message = Another $found_extension file.
51565 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
51570 <chapter id="CHAPlocalscan">
51571 <title>Adding a local scan function to Exim</title>
51572 <titleabbrev>Local scan function</titleabbrev>
51574 <indexterm role="concept" id="IIDlosca" class="startofrange">
51575 <primary><function>local_scan()</function> function</primary>
51576 <secondary>description of</secondary>
51578 <indexterm role="concept">
51579 <primary>customizing</primary>
51580 <secondary>input scan using C function</secondary>
51582 <indexterm role="concept">
51583 <primary>policy control</primary>
51584 <secondary>by local scan function</secondary>
51586 In these days of email worms, viruses, and ever-increasing spam, some sites
51587 want to apply a lot of checking to messages before accepting them.
51590 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
51591 passing messages to external virus and spam scanning software. You can also do
51592 a certain amount in Exim itself through string expansions and the <option>condition</option>
51593 condition in the ACL that runs after the SMTP DATA command or the ACL for
51594 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
51597 To allow for further customization to a site’s own requirements, there is the
51598 possibility of linking Exim with a private message scanning function, written
51599 in C. If you want to run code that is written in something other than C, you
51600 can of course use a little C stub to call it.
51603 The local scan function is run once for every incoming message, at the point
51604 when Exim is just about to accept the message.
51605 It can therefore be used to control non-SMTP messages from local processes as
51606 well as messages arriving via SMTP.
51609 Exim applies a timeout to calls of the local scan function, and there is an
51610 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
51611 Zero means <quote>no timeout</quote>.
51612 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
51613 before calling the local scan function, so that the most common types of crash
51614 are caught. If the timeout is exceeded or one of those signals is caught, the
51615 incoming message is rejected with a temporary error if it is an SMTP message.
51616 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
51617 code. The incident is logged on the main and reject logs.
51620 <title>Building Exim to use a local scan function</title>
51622 <indexterm role="concept">
51623 <primary><function>local_scan()</function> function</primary>
51624 <secondary>building Exim to use</secondary>
51626 To make use of the local scan function feature, you must tell Exim where your
51627 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
51628 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
51629 directory, so you might set
51631 <literallayout class="monospaced">
51632 LOCAL_SCAN_SOURCE=Local/local_scan.c
51635 for example. The function must be called <function>local_scan()</function>. It is called by
51636 Exim after it has received a message, when the success return code is about to
51637 be sent. This is after all the ACLs have been run. The return code from your
51638 function controls whether the message is actually accepted or not. There is a
51639 commented template function (that just accepts the message) in the file
51640 _src/local_scan.c_.
51643 If you want to make use of Exim’s run time configuration file to set options
51644 for your <function>local_scan()</function> function, you must also set
51646 <literallayout class="monospaced">
51647 LOCAL_SCAN_HAS_OPTIONS=yes
51650 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
51653 <section id="SECTapiforloc">
51654 <title>API for local_scan()</title>
51656 <indexterm role="concept">
51657 <primary><function>local_scan()</function> function</primary>
51658 <secondary>API description</secondary>
51660 You must include this line near the start of your code:
51662 <literallayout class="monospaced">
51663 #include "local_scan.h"
51666 This header file defines a number of variables and other values, and the
51667 prototype for the function itself. Exim is coded to use unsigned char values
51668 almost exclusively, and one of the things this header defines is a shorthand
51669 for <literal>unsigned char</literal> called <literal>uschar</literal>.
51670 It also contains the following macro definitions, to simplify casting character
51671 strings and pointers to character strings:
51673 <literallayout class="monospaced">
51674 #define CS (char *)
51675 #define CCS (const char *)
51676 #define CSS (char **)
51677 #define US (unsigned char *)
51678 #define CUS (const unsigned char *)
51679 #define USS (unsigned char **)
51682 The function prototype for <function>local_scan()</function> is:
51684 <literallayout class="monospaced">
51685 extern int local_scan(int fd, uschar **return_text);
51688 The arguments are as follows:
51693 <option>fd</option> is a file descriptor for the file that contains the body of the message
51694 (the -D file). The file is open for reading and writing, but updating it is not
51695 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
51698 The descriptor is positioned at character 19 of the file, which is the first
51699 character of the body itself, because the first 19 characters are the message
51700 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
51701 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
51702 case this changes in some future version.
51707 <option>return_text</option> is an address which you can use to return a pointer to a text
51708 string at the end of the function. The value it points to on entry is NULL.
51713 The function must return an <option>int</option> value which is one of the following macros:
51717 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
51720 <indexterm role="concept">
51721 <primary><varname>$local_scan_data</varname></primary>
51723 The message is accepted. If you pass back a string of text, it is saved with
51724 the message, and made available in the variable <varname>$local_scan_data</varname>. No
51725 newlines are permitted (if there are any, they are turned into spaces) and the
51726 maximum length of text is 1000 characters.
51728 </listitem></varlistentry>
51730 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
51733 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
51734 queued without immediate delivery, and is frozen.
51736 </listitem></varlistentry>
51738 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
51741 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
51742 queued without immediate delivery.
51744 </listitem></varlistentry>
51746 <term><literal>LOCAL_SCAN_REJECT</literal></term>
51749 The message is rejected; the returned text is used as an error message which is
51750 passed back to the sender and which is also logged. Newlines are permitted –
51751 they cause a multiline response for SMTP rejections, but are converted to
51752 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
51755 </listitem></varlistentry>
51757 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
51760 The message is temporarily rejected; the returned text is used as an error
51761 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
51762 problem</quote> is used.
51764 </listitem></varlistentry>
51766 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
51769 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
51770 message is not written to the reject log. It has the effect of unsetting the
51771 <option>rejected_header</option> log selector for just this rejection. If
51772 <option>rejected_header</option> is already unset (see the discussion of the
51773 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
51774 same as LOCAL_SCAN_REJECT.
51776 </listitem></varlistentry>
51778 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
51781 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
51782 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
51784 </listitem></varlistentry>
51787 If the message is not being received by interactive SMTP, rejections are
51788 reported by writing to <option>stderr</option> or by sending an email, as configured by the
51789 <option>-oe</option> command line options.
51792 <section id="SECTconoptloc">
51793 <title>Configuration options for local_scan()</title>
51795 <indexterm role="concept">
51796 <primary><function>local_scan()</function> function</primary>
51797 <secondary>configuration options</secondary>
51799 It is possible to have option settings in the main configuration file
51800 that set values in static variables in the <function>local_scan()</function> module. If you
51801 want to do this, you must have the line
51803 <literallayout class="monospaced">
51804 LOCAL_SCAN_HAS_OPTIONS=yes
51807 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
51808 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
51809 file, you must define static variables to hold the option values, and a table
51813 The table must be a vector called <option>local_scan_options</option>, of type
51814 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
51815 and a pointer to the variable that holds the value. The entries must appear in
51816 alphabetical order. Following <option>local_scan_options</option> you must also define a
51817 variable called <option>local_scan_options_count</option> that contains the number of
51818 entries in the table. Here is a short example, showing two kinds of option:
51820 <literallayout class="monospaced">
51821 static int my_integer_option = 42;
51822 static uschar *my_string_option = US"a default string";
51824 optionlist local_scan_options[] = {
51825 { "my_integer", opt_int, &my_integer_option },
51826 { "my_string", opt_stringptr, &my_string_option }
51829 int local_scan_options_count =
51830 sizeof(local_scan_options)/sizeof(optionlist);
51833 The values of the variables can now be changed from Exim’s runtime
51834 configuration file by including a local scan section as in this example:
51836 <literallayout class="monospaced">
51839 my_string = some string of text...
51842 The available types of option data are as follows:
51846 <term><emphasis role="bold">opt_bool</emphasis></term>
51849 This specifies a boolean (true/false) option. The address should point to a
51850 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
51851 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
51852 whether such a variable has been set at all, you can initialize it to
51853 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
51856 </listitem></varlistentry>
51858 <term><emphasis role="bold">opt_fixed</emphasis></term>
51861 This specifies a fixed point number, such as is used for load averages.
51862 The address should point to a variable of type <literal>int</literal>. The value is stored
51863 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
51865 </listitem></varlistentry>
51867 <term><emphasis role="bold">opt_int</emphasis></term>
51870 This specifies an integer; the address should point to a variable of type
51871 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
51874 </listitem></varlistentry>
51876 <term><emphasis role="bold">opt_mkint</emphasis></term>
51879 This is the same as <option>opt_int</option>, except that when such a value is output in a
51880 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
51881 printed with the suffix K or M.
51883 </listitem></varlistentry>
51885 <term><emphasis role="bold">opt_octint</emphasis></term>
51888 This also specifies an integer, but the value is always interpeted as an
51889 octal integer, whether or not it starts with the digit zero, and it is
51890 always output in octal.
51892 </listitem></varlistentry>
51894 <term><emphasis role="bold">opt_stringptr</emphasis></term>
51897 This specifies a string value; the address must be a pointer to a
51898 variable that points to a string (for example, of type <literal>uschar *</literal>).
51900 </listitem></varlistentry>
51902 <term><emphasis role="bold">opt_time</emphasis></term>
51905 This specifies a time interval value. The address must point to a variable of
51906 type <literal>int</literal>. The value that is placed there is a number of seconds.
51908 </listitem></varlistentry>
51911 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
51912 out the values of all the <function>local_scan()</function> options.
51916 <title>Available Exim variables</title>
51918 <indexterm role="concept">
51919 <primary><function>local_scan()</function> function</primary>
51920 <secondary>available Exim variables</secondary>
51922 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
51923 are the only ones that are guaranteed to be maintained from release to release.
51924 Note, however, that you can obtain the value of any Exim variable by calling
51925 <emphasis>expand_string()</emphasis>. The exported variables are as follows:
51929 <term><emphasis role="bold">unsigned int debug_selector</emphasis></term>
51932 This variable is set to zero when no debugging is taking place. Otherwise, it
51933 is a bitmap of debugging selectors. Two bits are identified for use in
51934 <function>local_scan()</function>; they are defined as macros:
51939 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
51940 testing option that is not privileged – any caller may set it. All the
51941 other selector bits can be set only by admin users.
51946 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
51947 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
51953 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
51954 selected, you should use code like this:
51956 <literallayout class="monospaced">
51957 if ((debug_selector & D_local_scan) != 0)
51958 debug_printf("xxx", ...);
51960 </listitem></varlistentry>
51962 <term><emphasis role="bold">uschar *expand_string_message</emphasis></term>
51965 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
51966 variable <option>expand_string_message</option> contains the error message, zero-terminated.
51968 </listitem></varlistentry>
51970 <term><emphasis role="bold">header_line *header_list</emphasis></term>
51973 A pointer to a chain of header lines. The <option>header_line</option> structure is
51976 </listitem></varlistentry>
51978 <term><emphasis role="bold">header_line *header_last</emphasis></term>
51981 A pointer to the last of the header lines.
51983 </listitem></varlistentry>
51985 <term><emphasis role="bold">uschar *headers_charset</emphasis></term>
51988 The value of the <option>headers_charset</option> configuration option.
51990 </listitem></varlistentry>
51992 <term><emphasis role="bold">BOOL host_checking</emphasis></term>
51995 This variable is TRUE during a host checking session that is initiated by the
51996 <option>-bh</option> command line option.
51998 </listitem></varlistentry>
52000 <term><emphasis role="bold">uschar *interface_address</emphasis></term>
52003 The IP address of the interface that received the message, as a string. This
52004 is NULL for locally submitted messages.
52006 </listitem></varlistentry>
52008 <term><emphasis role="bold">int interface_port</emphasis></term>
52010 <para revisionflag="changed">
52011 The port on which this message was received. When testing with the <option>-bh</option>
52012 command line option, the value of this variable is -1 unless a port has been
52013 specified via the <option>-oMi</option> option.
52015 </listitem></varlistentry>
52017 <term><emphasis role="bold">uschar *message_id</emphasis></term>
52020 This variable contains Exim’s message id for the incoming message (the value of
52021 <varname>$message_exim_id</varname>) as a zero-terminated string.
52023 </listitem></varlistentry>
52025 <term><emphasis role="bold">uschar *received_protocol</emphasis></term>
52028 The name of the protocol by which the message was received.
52030 </listitem></varlistentry>
52032 <term><emphasis role="bold">int recipients_count</emphasis></term>
52035 The number of accepted recipients.
52037 </listitem></varlistentry>
52039 <term><emphasis role="bold">recipient_item *recipients_list</emphasis></term>
52042 <indexterm role="concept">
52043 <primary>recipient</primary>
52044 <secondary>adding in local scan</secondary>
52046 <indexterm role="concept">
52047 <primary>recipient</primary>
52048 <secondary>removing in local scan</secondary>
52050 The list of accepted recipients, held in a vector of length
52051 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
52052 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
52053 below). You can delete recipients by removing them from the vector and adusting
52054 the value in <option>recipients_count</option>. In particular, by setting
52055 <option>recipients_count</option> to zero you remove all recipients. If you then return the
52056 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
52057 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
52058 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
52060 </listitem></varlistentry>
52062 <term><emphasis role="bold">uschar *sender_address</emphasis></term>
52065 The envelope sender address. For bounce messages this is the empty string.
52067 </listitem></varlistentry>
52069 <term><emphasis role="bold">uschar *sender_host_address</emphasis></term>
52072 The IP address of the sending host, as a string. This is NULL for
52073 locally-submitted messages.
52075 </listitem></varlistentry>
52077 <term><emphasis role="bold">uschar *sender_host_authenticated</emphasis></term>
52080 The name of the authentication mechanism that was used, or NULL if the message
52081 was not received over an authenticated SMTP connection.
52083 </listitem></varlistentry>
52085 <term><emphasis role="bold">uschar *sender_host_name</emphasis></term>
52088 The name of the sending host, if known.
52090 </listitem></varlistentry>
52092 <term><emphasis role="bold">int sender_host_port</emphasis></term>
52095 The port on the sending host.
52097 </listitem></varlistentry>
52099 <term><emphasis role="bold">BOOL smtp_input</emphasis></term>
52102 This variable is TRUE for all SMTP input, including BSMTP.
52104 </listitem></varlistentry>
52106 <term><emphasis role="bold">BOOL smtp_batched_input</emphasis></term>
52109 This variable is TRUE for BSMTP input.
52111 </listitem></varlistentry>
52113 <term><emphasis role="bold">int store_pool</emphasis></term>
52116 The contents of this variable control which pool of memory is used for new
52117 requests. See section <xref linkend="SECTmemhanloc"/> for details.
52119 </listitem></varlistentry>
52123 <title>Structure of header lines</title>
52125 The <option>header_line</option> structure contains the members listed below.
52126 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
52127 (see below). You can cause header lines to be ignored (deleted) by setting
52132 <term><emphasis role="bold">struct header_line *next</emphasis></term>
52135 A pointer to the next header line, or NULL for the last line.
52137 </listitem></varlistentry>
52139 <term><emphasis role="bold">int type</emphasis></term>
52142 A code identifying certain headers that Exim recognizes. The codes are printing
52143 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
52144 Notice in particular that any header line whose type is * is not transmitted
52145 with the message. This flagging is used for header lines that have been
52146 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
52147 lines.) Effectively, * means <quote>deleted</quote>.
52149 </listitem></varlistentry>
52151 <term><emphasis role="bold">int slen</emphasis></term>
52154 The number of characters in the header line, including the terminating and any
52157 </listitem></varlistentry>
52159 <term><emphasis role="bold">uschar *text</emphasis></term>
52162 A pointer to the text of the header. It always ends with a newline, followed by
52163 a zero byte. Internal newlines are preserved.
52165 </listitem></varlistentry>
52169 <title>Structure of recipient items</title>
52171 The <option>recipient_item</option> structure contains these members:
52175 <term><emphasis role="bold">uschar *address</emphasis></term>
52178 This is a pointer to the recipient address as it was received.
52180 </listitem></varlistentry>
52182 <term><emphasis role="bold">int pno</emphasis></term>
52185 This is used in later Exim processing when top level addresses are created by
52186 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
52187 and must always contain -1 at this stage.
52189 </listitem></varlistentry>
52191 <term><emphasis role="bold">uschar *errors_to</emphasis></term>
52194 If this value is not NULL, bounce messages caused by failing to deliver to the
52195 recipient are sent to the address it contains. In other words, it overrides the
52196 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
52197 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
52198 an unqualified address, Exim qualifies it using the domain from
52199 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
52200 is NULL for all recipients.
52202 </listitem></varlistentry>
52206 <title>Available Exim functions</title>
52208 <indexterm role="concept">
52209 <primary><function>local_scan()</function> function</primary>
52210 <secondary>available Exim functions</secondary>
52212 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
52213 These are the only ones that are guaranteed to be maintained from release to
52218 <term><emphasis role="bold">pid_t child_open(uschar **argv, uschar **envp, int newumask, int *infdptr, int *outfdptr, BOOL make_leader)</emphasis></term>
52221 This function creates a child process that runs the command specified by
52222 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
52223 be NULL if no environment variables are to be passed. A new umask is supplied
52224 for the process in <option>newumask</option>.
52227 Pipes to the standard input and output of the new process are set up
52228 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
52229 standard error is cloned to the standard output. If there are any file
52230 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
52231 argument is TRUE, the new process is made into a process group leader.
52234 The function returns the pid of the new process, or -1 if things go wrong.
52236 </listitem></varlistentry>
52238 <term><emphasis role="bold">int child_close(pid_t pid, int timeout)</emphasis></term>
52241 This function waits for a child process to terminate, or for a timeout (in
52242 seconds) to expire. A timeout value of zero means wait as long as it takes. The
52243 return value is as follows:
52251 The process terminated by a normal exit and the value is the process
52257 < 0 and > –256
52260 The process was terminated by a signal and the value is the negation of the
52269 The process timed out.
52277 The was some other error in wait(); <option>errno</option> is still set.
52281 </listitem></varlistentry>
52283 <term><emphasis role="bold">pid_t child_open_exim(int *fd)</emphasis></term>
52286 This function provide you with a means of submitting a new message to
52287 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
52288 want, but this packages it all up for you.) The function creates a pipe,
52289 forks a subprocess that is running
52291 <literallayout class="monospaced">
52292 exim -t -oem -oi -f <>
52295 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
52296 that is connected to the standard input. The yield of the function is the PID
52297 of the subprocess. You can then write a message to the file descriptor, with
52298 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
52301 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
52302 finish and to collect its ending status. A timeout value of zero is usually
52303 fine in this circumstance. Unless you have made a mistake with the recipient
52304 addresses, you should get a return code of zero.
52306 </listitem></varlistentry>
52308 <term><emphasis role="bold">pid_t child_open_exim2(int *fd, uschar *sender, uschar *sender_authentication)</emphasis></term>
52311 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
52315 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
52318 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
52320 </listitem></varlistentry>
52322 <term><emphasis role="bold">void debug_printf(char *, ...)</emphasis></term>
52325 This is Exim’s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
52326 output is written to the standard error stream. If no debugging is selected,
52327 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
52328 conditional on the <literal>local_scan</literal> debug selector by coding like this:
52330 <literallayout class="monospaced">
52331 if ((debug_selector & D_local_scan) != 0)
52332 debug_printf("xxx", ...);
52334 </listitem></varlistentry>
52336 <term><emphasis role="bold">uschar *expand_string(uschar *string)</emphasis></term>
52339 This is an interface to Exim’s string expansion code. The return value is the
52340 expanded string, or NULL if there was an expansion failure.
52341 The C variable <option>expand_string_message</option> contains an error message after an
52342 expansion failure. If expansion does not change the string, the return value is
52343 the pointer to the input string. Otherwise, the return value points to a new
52344 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
52345 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
52347 </listitem></varlistentry>
52349 <term><emphasis role="bold">void header_add(int type, char *format, ...)</emphasis></term>
52352 This function allows you to an add additional header line at the end of the
52353 existing ones. The first argument is the type, and should normally be a space
52354 character. The second argument is a format string and any number of
52355 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
52356 if you want, and you must ensure that the string ends with a newline.
52358 </listitem></varlistentry>
52360 <term><emphasis role="bold">void header_add_at_position(BOOL after, uschar *name, BOOL topnot, int type, char *format, ...)</emphasis></term>
52363 This function adds a new header line at a specified point in the header
52364 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
52367 If <option>name</option> is NULL, the new header is added at the end of the chain if
52368 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
52369 NULL, the header lines are searched for the first non-deleted header that
52370 matches the name. If one is found, the new header is added before it if
52371 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
52372 found header and any adjacent subsequent ones with the same name (even if
52373 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
52374 option controls where the header is added. If it is true, addition is at the
52375 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
52376 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
52378 <literallayout class="monospaced">
52379 header_add_at_position(TRUE, US"Received", TRUE,
52380 ' ', "X-xxx: ...");
52383 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
52384 there may not be if <option>received_header_text</option> expands to an empty string.
52386 </listitem></varlistentry>
52388 <term><emphasis role="bold">void header_remove(int occurrence, uschar *name)</emphasis></term>
52391 This function removes header lines. If <option>occurrence</option> is zero or negative, all
52392 occurrences of the header are removed. If occurrence is greater than zero, that
52393 particular instance of the header is removed. If no header(s) can be found that
52394 match the specification, the function does nothing.
52396 </listitem></varlistentry>
52398 <term><emphasis role="bold">BOOL header_testname(header_line *hdr, uschar *name, int length, BOOL notdel)</emphasis></term>
52401 This function tests whether the given header has the given name. It is not just
52402 a string comparison, because white space is permitted between the name and the
52403 colon. If the <option>notdel</option> argument is true, a false return is forced for all
52404 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
52406 <literallayout class="monospaced">
52407 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
52409 </listitem></varlistentry>
52411 <term><emphasis role="bold">uschar *lss_b64encode(uschar *cleartext, int length)</emphasis></term>
52414 <indexterm role="concept">
52415 <primary>base64 encoding</primary>
52416 <secondary>functions for <function>local_scan()</function> use</secondary>
52418 This function base64-encodes a string, which is passed by address and length.
52419 The text may contain bytes of any value, including zero. The result is passed
52420 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
52423 </listitem></varlistentry>
52425 <term><emphasis role="bold">int lss_b64decode(uschar *codetext, uschar **cleartext)</emphasis></term>
52428 This function decodes a base64-encoded string. Its arguments are a
52429 zero-terminated base64-encoded string and the address of a variable that is set
52430 to point to the result, which is in dynamic memory. The length of the decoded
52431 string is the yield of the function. If the input is invalid base64 data, the
52432 yield is -1. A zero byte is added to the end of the output string to make it
52433 easy to interpret as a C string (assuming it contains no zeros of its own). The
52434 added zero byte is not included in the returned count.
52436 </listitem></varlistentry>
52438 <term><emphasis role="bold">int lss_match_domain(uschar *domain, uschar *list)</emphasis></term>
52441 This function checks for a match in a domain list. Domains are always
52442 matched caselessly. The return value is one of the following:
52445 <literal>OK </literal> match succeeded
52446 <literal>FAIL </literal> match failed
52447 <literal>DEFER </literal> match deferred
52450 DEFER is usually caused by some kind of lookup defer, such as the
52451 inability to contact a database.
52453 </listitem></varlistentry>
52455 <term><emphasis role="bold">int lss_match_local_part(uschar *localpart, uschar *list, BOOL caseless)</emphasis></term>
52458 This function checks for a match in a local part list. The third argument
52459 controls case-sensitivity. The return values are as for
52460 <emphasis>lss_match_domain()</emphasis>.
52462 </listitem></varlistentry>
52464 <term><emphasis role="bold">int lss_match_address(uschar *address, uschar *list, BOOL caseless)</emphasis></term>
52467 This function checks for a match in an address list. The third argument
52468 controls the case-sensitivity of the local part match. The domain is always
52469 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
52471 </listitem></varlistentry>
52473 <term><emphasis role="bold">int lss_match_host(uschar *host_name, uschar *host_address, uschar *list)</emphasis></term>
52476 This function checks for a match in a host list. The most common usage is
52479 <literallayout class="monospaced">
52480 lss_match_host(sender_host_name, sender_host_address, ...)
52483 <indexterm role="concept">
52484 <primary><varname>$sender_host_address</varname></primary>
52486 An empty address field matches an empty item in the host list. If the host name
52487 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
52488 looked up if a host name is required to match an item in the list. The return
52489 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
52490 returns ERROR in the case when it had to look up a host name, but the lookup
52493 </listitem></varlistentry>
52495 <term><emphasis role="bold">void log_write(unsigned int selector, int which, char *format, ...)</emphasis></term>
52498 This function writes to Exim’s log files. The first argument should be zero (it
52499 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
52500 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
52501 them. It specifies to which log or logs the message is written. The remaining
52502 arguments are a format and relevant insertion arguments. The string should not
52503 contain any newlines, not even at the end.
52505 </listitem></varlistentry>
52507 <term><emphasis role="bold">void receive_add_recipient(uschar *address, int pno)</emphasis></term>
52510 This function adds an additional recipient to the message. The first argument
52511 is the recipient address. If it is unqualified (has no domain), it is qualified
52512 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
52515 This function does not allow you to specify a private <option>errors_to</option> address (as
52516 described with the structure of <option>recipient_item</option> above), because it pre-dates
52517 the addition of that field to the structure. However, it is easy to add such a
52518 value afterwards. For example:
52520 <literallayout class="monospaced">
52521 receive_add_recipient(US"monitor@mydom.example", -1);
52522 recipients_list[recipients_count-1].errors_to =
52523 US"postmaster@mydom.example";
52525 </listitem></varlistentry>
52527 <term><emphasis role="bold">BOOL receive_remove_recipient(uschar *recipient)</emphasis></term>
52530 This is a convenience function to remove a named recipient from the list of
52531 recipients. It returns true if a recipient was removed, and false if no
52532 matching recipient could be found. The argument must be a complete email
52535 </listitem></varlistentry>
52538 <indexterm role="concept">
52539 <primary>RFC 2047</primary>
52544 <term><emphasis role="bold">uschar rfc2047_decode(uschar *string, BOOL lencheck, uschar *target, int zeroval, int *lenptr, uschar **error)</emphasis></term>
52547 This function decodes strings that are encoded according to RFC 2047. Typically
52548 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
52549 from the Q or B encoding into a byte-string. Then, if provided with the name of
52550 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
52551 made to translate the result to the named character set. If this fails, the
52552 binary string is returned with an error message.
52555 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
52556 maximum MIME word length is enforced. The third argument is the target
52557 encoding, or NULL if no translation is wanted.
52560 <indexterm role="concept">
52561 <primary>binary zero</primary>
52562 <secondary>in RFC 2047 decoding</secondary>
52564 <indexterm role="concept">
52565 <primary>RFC 2047</primary>
52566 <secondary>binary zero in</secondary>
52568 If a binary zero is encountered in the decoded string, it is replaced by the
52569 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
52570 not be 0 because header lines are handled as zero-terminated strings.
52573 The function returns the result of processing the string, zero-terminated; if
52574 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
52575 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
52578 If an error is encountered, the function returns NULL and uses the <option>error</option>
52579 argument to return an error message. The variable pointed to by <option>error</option> is
52580 set to NULL if there is no error; it may be set non-NULL even when the function
52581 returns a non-NULL value if decoding was successful, but there was a problem
52584 </listitem></varlistentry>
52586 <term><emphasis role="bold">int smtp_fflush(void)</emphasis></term>
52589 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
52592 </listitem></varlistentry>
52594 <term><emphasis role="bold">void smtp_printf(char *, ...)</emphasis></term>
52597 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
52598 output stream. You should use this function only when there is an SMTP output
52599 stream, that is, when the incoming message is being received via interactive
52600 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
52601 is FALSE. If you want to test for an incoming message from another host (as
52602 opposed to a local process that used the <option>-bs</option> command line option), you can
52603 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
52607 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
52608 output function, so it can be used for all forms of SMTP connection.
52611 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
52612 must start with an appropriate response code: 550 if you are going to return
52613 LOCAL_SCAN_REJECT, 451 if you are going to return
52614 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
52615 initial lines of a multi-line response, the code must be followed by a hyphen
52616 to indicate that the line is not the final response line. You must also ensure
52617 that the lines you write terminate with CRLF. For example:
52619 <literallayout class="monospaced">
52620 smtp_printf("550-this is some extra info\r\n");
52621 return LOCAL_SCAN_REJECT;
52624 Note that you can also create multi-line responses by including newlines in
52625 the data returned via the <option>return_text</option> argument. The added value of using
52626 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
52627 multiple output lines.
52630 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
52631 does not automatically flush pending output, and therefore does not test
52632 the state of the stream. (In the main code of Exim, flushing and error
52633 detection is done when Exim is ready for the next SMTP input command.) If
52634 you want to flush the output and check for an error (for example, the
52635 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
52636 arguments. It flushes the output stream, and returns a non-zero value if there
52639 </listitem></varlistentry>
52641 <term><emphasis role="bold">void *store_get(int)</emphasis></term>
52644 This function accesses Exim’s internal store (memory) manager. It gets a new
52645 chunk of memory whose size is given by the argument. Exim bombs out if it ever
52646 runs out of memory. See the next section for a discussion of memory handling.
52648 </listitem></varlistentry>
52650 <term><emphasis role="bold">void *store_get_perm(int)</emphasis></term>
52653 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
52654 permanent pool. See the next section for a discussion of memory handling.
52656 </listitem></varlistentry>
52658 <term><emphasis role="bold">uschar *string_copy(uschar *string)</emphasis></term>
52663 </listitem></varlistentry>
52665 <term><emphasis role="bold">uschar *string_copyn(uschar *string, int length)</emphasis></term>
52670 </listitem></varlistentry>
52672 <term><emphasis role="bold">uschar *string_sprintf(char *format, ...)</emphasis></term>
52675 These three functions create strings using Exim’s dynamic memory facilities.
52676 The first makes a copy of an entire string. The second copies up to a maximum
52677 number of characters, indicated by the second argument. The third uses a format
52678 and insertion arguments to create a new string. In each case, the result is a
52679 pointer to a new string in the current memory pool. See the next section for
52682 </listitem></varlistentry>
52685 <section id="SECTmemhanloc">
52686 <title>More about Exim’s memory handling</title>
52688 <indexterm role="concept">
52689 <primary><function>local_scan()</function> function</primary>
52690 <secondary>memory handling</secondary>
52692 No function is provided for freeing memory, because that is never needed.
52693 The dynamic memory that Exim uses when receiving a message is automatically
52694 recycled if another message is received by the same process (this applies only
52695 to incoming SMTP connections – other input methods can supply only one
52696 message at a time). After receiving the last message, a reception process
52700 Because it is recycled, the normal dynamic memory cannot be used for holding
52701 data that must be preserved over a number of incoming messages on the same SMTP
52702 connection. However, Exim in fact uses two pools of dynamic memory; the second
52703 one is not recycled, and can be used for this purpose.
52706 If you want to allocate memory that remains available for subsequent messages
52707 in the same SMTP connection, you should set
52709 <literallayout class="monospaced">
52710 store_pool = POOL_PERM
52713 before calling the function that does the allocation. There is no need to
52714 restore the value if you do not need to; however, if you do want to revert to
52715 the normal pool, you can either restore the previous value of <option>store_pool</option> or
52716 set it explicitly to POOL_MAIN.
52719 The pool setting applies to all functions that get dynamic memory, including
52720 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
52721 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
52722 block of memory from the permanent pool while preserving the value of
52723 <option>store_pool</option>.
52724 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
52729 <chapter id="CHAPsystemfilter">
52730 <title>System-wide message filtering</title>
52732 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
52733 <primary>filter</primary>
52734 <secondary>system filter</secondary>
52736 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
52737 <primary>filtering all mail</primary>
52739 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
52740 <primary>system filter</primary>
52742 The previous chapters (on ACLs and the local scan function) describe checks
52743 that can be applied to messages before they are accepted by a host. There is
52744 also a mechanism for checking messages once they have been received, but before
52745 they are delivered. This is called the <emphasis>system filter</emphasis>.
52748 The system filter operates in a similar manner to users’ filter files, but it
52749 is run just once per message (however many recipients the message has).
52750 It should not normally be used as a substitute for routing, because <option>deliver</option>
52751 commands in a system router provide new envelope recipient addresses.
52752 The system filter must be an Exim filter. It cannot be a Sieve filter.
52755 The system filter is run at the start of a delivery attempt, before any routing
52756 is done. If a message fails to be completely delivered at the first attempt,
52757 the system filter is run again at the start of every retry.
52758 If you want your filter to do something only once per message, you can make use
52759 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
52760 prevent it happening on retries.
52763 <indexterm role="concept">
52764 <primary><varname>$domain</varname></primary>
52766 <indexterm role="concept">
52767 <primary><varname>$local_part</varname></primary>
52769 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
52770 specific to individual recipient addresses, such as <varname>$local_part</varname> and
52771 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
52772 you want to run a centrally-specified filter for each recipient address
52773 independently, you can do so by setting up a suitable <command>redirect</command> router, as
52774 described in section <xref linkend="SECTperaddfil"/> below.
52777 <title>Specifying a system filter</title>
52779 <indexterm role="concept">
52780 <primary>uid (user id)</primary>
52781 <secondary>system filter</secondary>
52783 <indexterm role="concept">
52784 <primary>gid (group id)</primary>
52785 <secondary>system filter</secondary>
52787 The name of the file that contains the system filter must be specified by
52788 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
52789 other than root, you must also set <option>system_filter_user</option> and
52790 <option>system_filter_group</option> as appropriate. For example:
52792 <literallayout class="monospaced">
52793 system_filter = /etc/mail/exim.filter
52794 system_filter_user = exim
52797 If a system filter generates any deliveries directly to files or pipes (via the
52798 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
52799 specified by setting <option>system_filter_file_transport</option> and
52800 <option>system_filter_pipe_transport</option>, respectively. Similarly,
52801 <option>system_filter_reply_transport</option> must be set to handle any messages generated
52802 by the <option>reply</option> command.
52806 <title>Testing a system filter</title>
52808 You can run simple tests of a system filter in the same way as for a user
52809 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
52810 are permitted only in system filters are recognized.
52813 If you want to test the combined effect of a system filter and a user filter,
52814 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
52818 <title>Contents of a system filter</title>
52820 The language used to specify system filters is the same as for users’ filter
52821 files. It is described in the separate end-user document <emphasis>Exim’s interface to
52822 mail filtering</emphasis>. However, there are some additional features that are
52823 available only in system filters; these are described in subsequent sections.
52824 If they are encountered in a user’s filter file or when testing with <option>-bf</option>,
52828 <indexterm role="concept">
52829 <primary>frozen messages</primary>
52830 <secondary>manual thaw; testing in filter</secondary>
52832 There are two special conditions which, though available in users’ filter
52833 files, are designed for use in system filters. The condition <option>first_delivery</option>
52834 is true only for the first attempt at delivering a message, and
52835 <option>manually_thawed</option> is true only if the message has been frozen, and
52836 subsequently thawed by an admin user. An explicit forced delivery counts as a
52837 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
52840 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
52841 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
52842 succeed, it will not be tried again.
52843 If you want Exim to retry an unseen delivery until it succeeds, you should
52844 arrange to set it up every time the filter runs.
52847 When a system filter finishes running, the values of the variables <varname>$n0</varname> –
52848 <varname>$n9</varname> are copied into <varname>$sn0</varname> – <varname>$sn9</varname> and are thereby made available to
52849 users’ filter files. Thus a system filter can, for example, set up <quote>scores</quote>
52850 to which users’ filter files can refer.
52854 <title>Additional variable for system filters</title>
52856 <indexterm role="concept">
52857 <primary><varname>$recipients</varname></primary>
52859 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
52860 of the message (separated by commas and white space), is available in system
52861 filters. It is not available in users’ filters for privacy reasons.
52865 <title>Defer, freeze, and fail commands for system filters</title>
52867 <indexterm role="concept">
52868 <primary>freezing messages</primary>
52870 <indexterm role="concept">
52871 <primary>message</primary>
52872 <secondary>freezing</secondary>
52874 <indexterm role="concept">
52875 <primary>message</primary>
52876 <secondary>forced failure</secondary>
52878 <indexterm role="concept">
52879 <primary><option>fail</option></primary>
52880 <secondary>in system filter</secondary>
52882 <indexterm role="concept">
52883 <primary><option>freeze</option> in system filter</primary>
52885 <indexterm role="concept">
52886 <primary><option>defer</option> in system filter</primary>
52888 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
52889 always available in system filters, but are not normally enabled in users’
52890 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
52891 for the <command>redirect</command> router.) These commands can optionally be followed by the
52892 word <option>text</option> and a string containing an error message, for example:
52894 <literallayout class="monospaced">
52895 fail text "this message looks like spam to me"
52898 The keyword <option>text</option> is optional if the next character is a double quote.
52901 The <option>defer</option> command defers delivery of the original recipients of the
52902 message. The <option>fail</option> command causes all the original recipients to be failed,
52903 and a bounce message to be created. The <option>freeze</option> command suspends all
52904 delivery attempts for the original recipients. In all cases, any new deliveries
52905 that are specified by the filter are attempted as normal after the filter has
52909 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
52910 not manually frozen since. This means that automatic freezing by a system
52911 filter can be used as a way of checking out suspicious messages. If a message
52912 is found to be all right, manually unfreezing it allows it to be delivered.
52915 <indexterm role="concept">
52916 <primary>log</primary>
52917 <secondary><option>fail</option> command log line</secondary>
52919 <indexterm role="concept">
52920 <primary><option>fail</option></primary>
52921 <secondary>log line; reducing</secondary>
52923 The text given with a fail command is used as part of the bounce message as
52924 well as being written to the log. If the message is quite long, this can fill
52925 up a lot of log space when such failures are common. To reduce the size of the
52926 log message, Exim interprets the text in a special way if it starts with the
52927 two characters <literal><<</literal> and contains <literal>>></literal> later. The text between these two
52928 strings is written to the log, and the rest of the text is used in the bounce
52929 message. For example:
52931 <literallayout class="monospaced">
52932 fail "<<filter test 1>>Your message is rejected \
52933 because it contains attachments that we are \
52934 not prepared to receive."
52937 <indexterm role="concept">
52938 <primary>loop</primary>
52939 <secondary>caused by <option>fail</option></secondary>
52941 Take great care with the <option>fail</option> command when basing the decision to fail on
52942 the contents of the message, because the bounce message will of course include
52943 the contents of the original message and will therefore trigger the <option>fail</option>
52944 command again (causing a mail loop) unless steps are taken to prevent this.
52945 Testing the <option>error_message</option> condition is one way to prevent this. You could
52948 <literallayout class="monospaced">
52949 if $message_body contains "this is spam" and not error_message
52950 then fail text "spam is not wanted here" endif
52953 though of course that might let through unwanted bounce messages. The
52954 alternative is clever checking of the body and/or headers to detect bounces
52955 generated by the filter.
52958 The interpretation of a system filter file ceases after a
52959 <option>defer</option>,
52960 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
52961 set up earlier in the filter file are honoured, so you can use a sequence such
52964 <literallayout class="monospaced">
52969 to send a specified message when the system filter is freezing (or deferring or
52970 failing) a message. The normal deliveries for the message do not, of course,
52974 <section id="SECTaddremheasys">
52975 <title>Adding and removing headers in a system filter</title>
52977 <indexterm role="concept">
52978 <primary>header lines</primary>
52979 <secondary>adding; in system filter</secondary>
52981 <indexterm role="concept">
52982 <primary>header lines</primary>
52983 <secondary>removing; in system filter</secondary>
52985 <indexterm role="concept">
52986 <primary>filter</primary>
52987 <secondary>header lines; adding/removing</secondary>
52989 Two filter commands that are available only in system filters are:
52991 <literallayout class="monospaced">
52992 headers add <string>
52993 headers remove <string>
52996 The argument for the <option>headers add</option> is a string that is expanded and then
52997 added to the end of the message’s headers. It is the responsibility of the
52998 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
52999 space is ignored, and if the string is otherwise empty, or if the expansion is
53000 forced to fail, the command has no effect.
53003 You can use <quote>\n</quote> within the string, followed by white space, to specify
53004 continued header lines. More than one header may be added in one command by
53005 including <quote>\n</quote> within the string without any following white space. For
53008 <literallayout class="monospaced">
53009 headers add "X-header-1: ....\n \
53010 continuation of X-header-1 ...\n\
53014 Note that the header line continuation white space after the first newline must
53015 be placed before the backslash that continues the input string, because white
53016 space after input continuations is ignored.
53019 The argument for <option>headers remove</option> is a colon-separated list of header names.
53020 This command applies only to those headers that are stored with the message;
53021 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
53022 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
53023 header with the same name, they are all removed.
53026 The <option>headers</option> command in a system filter makes an immediate change to the set
53027 of header lines that was received with the message (with possible additions
53028 from ACL processing). Subsequent commands in the system filter operate on the
53029 modified set, which also forms the basis for subsequent message delivery.
53030 Unless further modified during routing or transporting, this set of headers is
53031 used for all recipients of the message.
53034 During routing and transporting, the variables that refer to the contents of
53035 header lines refer only to those lines that are in this set. Thus, header lines
53036 that are added by a system filter are visible to users’ filter files and to all
53037 routers and transports. This contrasts with the manipulation of header lines by
53038 routers and transports, which is not immediate, but which instead is saved up
53039 until the message is actually being written (see section
53040 <xref linkend="SECTheadersaddrem"/>).
53043 If the message is not delivered at the first attempt, header lines that were
53044 added by the system filter are stored with the message, and so are still
53045 present at the next delivery attempt. Header lines that were removed are still
53046 present, but marked <quote>deleted</quote> so that they are not transported with the
53047 message. For this reason, it is usual to make the <option>headers</option> command
53048 conditional on <option>first_delivery</option> so that the set of header lines is not
53049 modified more than once.
53052 Because header modification in a system filter acts immediately, you have to
53053 use an indirect approach if you want to modify the contents of a header line.
53056 <literallayout class="monospaced">
53057 headers add "Old-Subject: $h_subject:"
53058 headers remove "Subject"
53059 headers add "Subject: new subject (was: $h_old-subject:)"
53060 headers remove "Old-Subject"
53064 <title>Setting an errors address in a system filter</title>
53066 <indexterm role="concept">
53067 <primary>envelope sender</primary>
53069 In a system filter, if a <option>deliver</option> command is followed by
53071 <literallayout class="monospaced">
53072 errors_to <some address>
53075 in order to change the envelope sender (and hence the error reporting) for that
53076 delivery, any address may be specified. (In a user filter, only the current
53077 user’s address can be set.) For example, if some mail is being monitored, you
53080 <literallayout class="monospaced">
53081 unseen deliver monitor@spying.example errors_to root@local.example
53084 to take a copy which would not be sent back to the normal error reporting
53085 address if its delivery failed.
53088 <section id="SECTperaddfil">
53089 <title>Per-address filtering</title>
53091 <indexterm role="concept">
53092 <primary><varname>$domain</varname></primary>
53094 <indexterm role="concept">
53095 <primary><varname>$local_part</varname></primary>
53097 In contrast to the system filter, which is run just once per message for each
53098 delivery attempt, it is also possible to set up a system-wide filtering
53099 operation that runs once for each recipient address. In this case, variables
53100 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
53101 filter file could be made dependent on them. This is an example of a router
53102 which implements such a filter:
53104 <literallayout class="monospaced">
53108 domains = +local_domains
53109 file = /central/filters/$local_part
53115 The filter is run in a separate process under its own uid. Therefore, either
53116 <option>check_local_user</option> must be set (as above), in which case the filter is run as
53117 the local user, or the <option>user</option> option must be used to specify which user to
53118 use. If both are set, <option>user</option> overrides.
53121 Care should be taken to ensure that none of the commands in the filter file
53122 specify a significant delivery if the message is to go on to be delivered to
53123 its intended recipient. The router will not then claim to have dealt with the
53124 address, so it will be passed on to subsequent routers to be delivered in the
53126 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
53127 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
53128 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
53133 <chapter id="CHAPmsgproc">
53134 <title>Message processing</title>
53136 <indexterm role="concept" id="IIDmesproc" class="startofrange">
53137 <primary>message</primary>
53138 <secondary>general processing</secondary>
53140 Exim performs various transformations on the sender and recipient addresses of
53141 all messages that it handles, and also on the messages’ header lines. Some of
53142 these are optional and configurable, while others always take place. All of
53143 this processing, except rewriting as a result of routing, and the addition or
53144 removal of header lines while delivering, happens when a message is received,
53145 before it is placed on Exim’s queue.
53148 Some of the automatic processing takes place by default only for
53149 <quote>locally-originated</quote> messages. This adjective is used to describe messages
53150 that are not received over TCP/IP, but instead are passed to an Exim process on
53151 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
53152 set up by the <option>-bs</option> command line option.
53155 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
53156 or ::1) are not considered to be locally-originated. Exim does not treat the
53157 loopback interface specially in any way.
53160 If you want the loopback interface to be treated specially, you must ensure
53161 that there are appropriate entries in your ACLs.
53163 <section id="SECTsubmodnon">
53164 <title>Submission mode for non-local messages</title>
53166 <indexterm role="concept">
53167 <primary>message</primary>
53168 <secondary>submission</secondary>
53170 <indexterm role="concept">
53171 <primary>submission mode</primary>
53173 Processing that happens automatically for locally-originated messages (unless
53174 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
53175 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
53176 state. Submisssion mode is set by the modifier
53178 <literallayout class="monospaced">
53179 control = submission
53182 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
53183 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
53184 a local submission, and is normally used when the source of the message is
53185 known to be an MUA running on a client host (as opposed to an MTA). For
53186 example, to set submission mode for messages originating on the IPv4 loopback
53187 interface, you could include the following in the MAIL ACL:
53189 <literallayout class="monospaced">
53190 warn hosts = 127.0.0.1
53191 control = submission
53194 <indexterm role="concept">
53195 <primary><option>sender_retain</option></primary>
53197 There are some options that can be used when setting submission mode. A slash
53198 is used to separate options. For example:
53200 <literallayout class="monospaced">
53201 control = submission/sender_retain
53204 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
53205 true and <option>local_from_check</option> false for the current incoming message. The first
53206 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
53207 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
53208 authenticated sender. With this setting, Exim still fixes up messages by adding
53209 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
53210 attempt to check sender authenticity in header lines.
53213 When <option>sender_retain</option> is not set, a submission mode setting may specify a
53214 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
53217 <literallayout class="monospaced">
53218 control = submission/domain=some.domain
53221 The domain may be empty. How this value is used is described in sections
53222 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
53223 that allows you to specify the user’s full name for inclusion in a created
53224 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
53226 <literallayout class="monospaced">
53227 accept authenticated = *
53228 control = submission/domain=wonderland.example/\
53229 name=${lookup {$authenticated_id} \
53230 lsearch {/etc/exim/namelist}}
53233 Because the name may contain any characters, including slashes, the <option>name</option>
53234 option must be given last. The remainder of the string is used as the name. For
53235 the example above, if <filename>/etc/exim/namelist</filename> contains:
53237 <literallayout class="monospaced">
53238 bigegg: Humpty Dumpty
53241 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
53244 <literallayout class="monospaced">
53245 Sender: Humpty Dumpty <bigegg@wonderland.example>
53248 <indexterm role="concept">
53249 <primary>return path</primary>
53250 <secondary>in submission mode</secondary>
53252 By default, submission mode forces the return path to the same address as is
53253 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
53254 specified, the return path is also left unchanged.
53257 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
53258 ACL. This means that any sender checks performed before the fix-ups use the
53259 untrusted sender address specified by the user, not the trusted sender address
53260 specified by submission mode. Although this might be slightly unexpected, it
53261 does mean that you can configure ACL checks to spot that a user is trying to
53262 spoof another’s address.
53265 <section id="SECTlineendings">
53266 <title>Line endings</title>
53268 <indexterm role="concept">
53269 <primary>line endings</primary>
53271 <indexterm role="concept">
53272 <primary>carriage return</primary>
53274 <indexterm role="concept">
53275 <primary>linefeed</primary>
53277 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
53278 linefeed) is the line ending for messages transmitted over the Internet using
53279 SMTP over TCP/IP. However, within individual operating systems, different
53280 conventions are used. For example, Unix-like systems use just LF, but others
53281 use CRLF or just CR.
53284 Exim was designed for Unix-like systems, and internally, it stores messages
53285 using the system’s convention of a single LF as a line terminator. When
53286 receiving a message, all line endings are translated to this standard format.
53287 Originally, it was thought that programs that passed messages directly to an
53288 MTA within an operating system would use that system’s convention. Experience
53289 has shown that this is not the case; for example, there are Unix applications
53290 that use CRLF in this circumstance. For this reason, and for compatibility with
53291 other MTAs, the way Exim handles line endings for all messages is now as
53297 LF not preceded by CR is treated as a line ending.
53302 CR is treated as a line ending; if it is immediately followed by LF, the LF
53308 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
53309 nor a local message in the state where a line containing only a dot is a
53315 If a bare CR is encountered within a header line, an extra space is added after
53316 the line terminator so as not to end the header line. The reasoning behind this
53317 is that bare CRs in header lines are most likely either to be mistakes, or
53318 people trying to play silly games.
53323 If the first header line received in a message ends with CRLF, a subsequent
53324 bare LF in a header line is treated in the same way as a bare CR in a header
53331 <title>Unqualified addresses</title>
53333 <indexterm role="concept">
53334 <primary>unqualified addresses</primary>
53336 <indexterm role="concept">
53337 <primary>address</primary>
53338 <secondary>qualification</secondary>
53340 By default, Exim expects every envelope address it receives from an external
53341 host to be fully qualified. Unqualified addresses cause negative responses to
53342 SMTP commands. However, because SMTP is used as a means of transporting
53343 messages from MUAs running on personal workstations, there is sometimes a
53344 requirement to accept unqualified addresses from specific hosts or IP networks.
53347 Exim has two options that separately control which hosts may send unqualified
53348 sender or receipient addresses in SMTP commands, namely
53349 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
53350 cases, if an unqualified address is accepted, it is qualified by adding the
53351 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
53354 <indexterm role="concept">
53355 <primary><option>qualify_domain</option></primary>
53357 <indexterm role="concept">
53358 <primary><option>qualify_recipient</option></primary>
53360 Unqualified addresses in header lines are automatically qualified for messages
53361 that are locally originated, unless the <option>-bnq</option> option is given on the command
53362 line. For messages received over SMTP, unqualified addresses in header lines
53363 are qualified only if unqualified addresses are permitted in SMTP commands. In
53364 other words, such qualification is also controlled by
53365 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
53369 <title>The UUCP From line</title>
53371 <indexterm role="concept">
53372 <primary><quote>From</quote> line</primary>
53374 <indexterm role="concept">
53375 <primary>UUCP</primary>
53376 <secondary><quote>From</quote> line</secondary>
53378 <indexterm role="concept">
53379 <primary>sender</primary>
53380 <secondary>address</secondary>
53382 <indexterm role="concept">
53383 <primary><option>uucp_from_pattern</option></primary>
53385 <indexterm role="concept">
53386 <primary><option>uucp_from_sender</option></primary>
53388 <indexterm role="concept">
53389 <primary>envelope sender</primary>
53391 <indexterm role="concept">
53392 <primary>Sendmail compatibility</primary>
53393 <secondary><quote>From</quote> line</secondary>
53395 Messages that have come from UUCP (and some other applications) often begin
53396 with a line containing the envelope sender and a timestamp, following the word
53397 <quote>From</quote>. Examples of two common formats are:
53399 <literallayout class="monospaced">
53400 From a.oakley@berlin.mus Fri Jan 5 12:35 GMT 1996
53401 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
53404 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
53405 Exim recognizes such lines at the start of messages that are submitted to it
53406 via the command line (that is, on the standard input). It does not recognize
53407 such lines in incoming SMTP messages, unless the sending host matches
53408 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
53409 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
53410 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
53411 default value matches the two common cases shown above and puts the address
53412 that follows <quote>From</quote> into <varname>$1</varname>.
53415 <indexterm role="concept">
53416 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
53417 <secondary>in <quote>From </quote> line handling</secondary>
53419 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
53420 a trusted user, the message’s sender address is constructed by expanding the
53421 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
53422 then parsed as an RFC 2822 address. If there is no domain, the local part is
53423 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
53424 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
53427 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
53428 sender address is not changed. This is also the case for incoming SMTP messages
53429 that are permitted to contain <quote>From</quote> lines.
53432 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
53433 treated as a data line that starts the body of the message, as it is not valid
53434 as a header line. This also happens if a <quote>From</quote> line is present in an
53435 incoming SMTP message from a source that is not permitted to send them.
53439 <title>Resent- header lines</title>
53441 <indexterm role="concept">
53442 <primary><option>Resent-</option> header lines</primary>
53444 RFC 2822 makes provision for sets of header lines starting with the string
53445 <literal>Resent-</literal> to be added to a message when it is resent by the original
53446 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
53447 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
53448 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
53452 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
53453 processing of replies or other such automatic actions on messages.</emphasis>
53457 This leaves things a bit vague as far as other processing actions such as
53458 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
53464 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
53465 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
53470 If there’s a rewriting rule for a particular header line, it is also applied to
53471 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
53472 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
53477 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
53483 For a locally-submitted message,
53484 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
53485 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
53486 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
53487 included in log lines in this case.
53492 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
53493 <option>Resent-</option> header lines are present.
53499 <title>The Auto-Submitted: header line</title>
53501 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
53502 includes the header line:
53504 <literallayout class="monospaced">
53505 Auto-Submitted: auto-replied
53509 <title>The Bcc: header line</title>
53511 <indexterm role="concept">
53512 <primary><emphasis>Bcc:</emphasis> header line</primary>
53514 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
53515 message’s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
53516 extracting its addresses). If <option>-t</option> is not present on the command line, any
53517 existing <emphasis>Bcc:</emphasis> is not removed.
53521 <title>The Date: header line</title>
53523 <indexterm role="concept">
53524 <primary><emphasis>Date:</emphasis> header line</primary>
53526 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
53527 Exim adds one, using the current date and time, unless the
53528 <option>suppress_local_fixups</option> control has been specified.
53532 <title>The Delivery-date: header line</title>
53534 <indexterm role="concept">
53535 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
53537 <indexterm role="concept">
53538 <primary><option>delivery_date_remove</option></primary>
53540 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
53541 set. Exim can be configured to add them to the final delivery of messages. (See
53542 the generic <option>delivery_date_add</option> transport option.) They should not be present
53543 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
53544 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
53549 <title>The Envelope-to: header line</title>
53551 <indexterm role="concept">
53552 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
53554 <indexterm role="concept">
53555 <primary><option>envelope_to_remove</option></primary>
53557 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
53558 Exim can be configured to add them to the final delivery of messages. (See the
53559 generic <option>envelope_to_add</option> transport option.) They should not be present in
53560 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
53561 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
53565 <section id="SECTthefrohea">
53566 <title>The From: header line</title>
53568 <indexterm role="concept">
53569 <primary><emphasis>From:</emphasis> header line</primary>
53571 <indexterm role="concept">
53572 <primary>Sendmail compatibility</primary>
53573 <secondary><quote>From</quote> line</secondary>
53575 <indexterm role="concept">
53576 <primary>message</primary>
53577 <secondary>submission</secondary>
53579 <indexterm role="concept">
53580 <primary>submission mode</primary>
53582 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
53583 adds one if either of the following conditions is true:
53588 The envelope sender address is not empty (that is, this is not a bounce
53589 message). The added header line copies the envelope sender address.
53594 <indexterm role="concept">
53595 <primary><varname>$authenticated_id</varname></primary>
53597 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
53599 <orderedlist numeration="arabic">
53602 <indexterm role="concept">
53603 <primary><varname>$qualify_domain</varname></primary>
53605 If no domain is specified by the submission control, the local part is
53606 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
53611 If a non-empty domain is specified by the submission control, the local
53612 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
53617 If an empty domain is specified by the submission control,
53618 <varname>$authenticated_id</varname> is assumed to be the complete address.
53625 A non-empty envelope sender takes precedence.
53628 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
53629 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
53630 containing the sender’s address. The calling user’s login name and full name
53631 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
53632 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
53633 <option>unknown_login</option> configuration option). The address is qualified with
53634 <option>qualify_domain</option>.
53637 For compatibility with Sendmail, if an incoming, non-SMTP message has a
53638 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
53639 user, this is replaced by an address containing the user’s login name and full
53640 name as described in section <xref linkend="SECTconstr"/>.
53644 <title>The Message-ID: header line</title>
53646 <indexterm role="concept">
53647 <primary><emphasis>Message-ID:</emphasis> header line</primary>
53649 <indexterm role="concept">
53650 <primary>message</primary>
53651 <secondary>submission</secondary>
53653 <indexterm role="concept">
53654 <primary><option>message_id_header_text</option></primary>
53656 If a locally-generated or submission-mode incoming message does not contain a
53657 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
53658 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
53659 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
53660 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim’s internal
53661 message id, preceded by the letter E to ensure it starts with a letter, and
53662 followed by @ and the primary host name. Additional information can be included
53663 in this header line by setting the <option>message_id_header_text</option> and/or
53664 <option>message_id_header_domain</option> options.
53668 <title>The Received: header line</title>
53670 <indexterm role="concept">
53671 <primary><emphasis>Received:</emphasis> header line</primary>
53673 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
53674 contents are defined by the <option>received_header_text</option> configuration option, and
53675 Exim automatically adds a semicolon and a timestamp to the configured string.
53678 The <emphasis>Received:</emphasis> header is generated as soon as the message’s header lines
53679 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
53680 line is the time that the message started to be received. This is the value
53681 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
53684 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
53685 changed to the time of acceptance, which is (apart from a small delay while the
53686 -H spool file is written) the earliest time at which delivery could start.
53690 <title>The References: header line</title>
53692 <indexterm role="concept">
53693 <primary><emphasis>References:</emphasis> header line</primary>
53695 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
53696 header line. This is constructed according to the rules that are described in
53697 section 3.64 of RFC 2822 (which states that replies should contain such a
53698 header line), and section 3.14 of RFC 3834 (which states that automatic
53699 responses are not different in this respect). However, because some mail
53700 processing software does not cope well with very long header lines, no more
53701 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
53702 incoming message. If there are more than 12, the first one and then the final
53703 11 are copied, before adding the message ID of the incoming message.
53707 <title>The Return-path: header line</title>
53709 <indexterm role="concept">
53710 <primary><emphasis>Return-path:</emphasis> header line</primary>
53712 <indexterm role="concept">
53713 <primary><option>return_path_remove</option></primary>
53715 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
53716 it does the final delivery of messages. (See the generic <option>return_path_add</option>
53717 transport option.) Therefore, they should not be present in messages in
53718 transit. If the <option>return_path_remove</option> configuration option is set (the
53719 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
53722 <section id="SECTthesenhea">
53723 <title>The Sender: header line</title>
53725 <indexterm role="concept">
53726 <primary><emphasis>Sender:</emphasis> header line</primary>
53728 <indexterm role="concept">
53729 <primary>message</primary>
53730 <secondary>submission</secondary>
53732 For a locally-originated message from an untrusted user, Exim may remove an
53733 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
53734 these actions by setting the <option>local_sender_retain</option> option true, the
53735 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
53739 When a local message is received from an untrusted user and
53740 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
53741 control has not been set, a check is made to see if the address given in the
53742 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
53743 that is expected has the login name as the local part and the value of
53744 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
53745 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
53746 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
53747 line is added to the message.
53750 If you set <option>local_from_check</option> false, this checking does not occur. However,
53751 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
53752 <option>local_sender_retain</option> to be true. It is not possible to set both of these
53753 options true at the same time.
53756 <indexterm role="concept">
53757 <primary>submission mode</primary>
53759 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
53760 received over TCP/IP or for messages submitted by trusted users. However, when
53761 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
53762 not specified on the submission control, the following processing takes place:
53765 <indexterm role="concept">
53766 <primary><varname>$authenticated_id</varname></primary>
53768 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
53769 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
53770 created as follows:
53775 <indexterm role="concept">
53776 <primary><varname>$qualify_domain</varname></primary>
53778 If no domain is specified by the submission control, the local part is
53779 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
53784 If a non-empty domain is specified by the submission control, the local part
53785 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
53790 If an empty domain is specified by the submission control,
53791 <varname>$authenticated_id</varname> is assumed to be the complete address.
53796 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
53797 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
53798 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
53799 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
53802 <indexterm role="concept">
53803 <primary>return path</primary>
53804 <secondary>created from <emphasis>Sender:</emphasis></secondary>
53806 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
53807 the message (the envelope sender address) is changed to be the same address,
53808 except in the case of submission mode when <option>sender_retain</option> is specified.
53811 <section id="SECTheadersaddrem">
53812 <title>Adding and removing header lines in routers and transports</title>
53814 <indexterm role="concept">
53815 <primary>header lines</primary>
53816 <secondary>adding; in router or transport</secondary>
53818 <indexterm role="concept">
53819 <primary>header lines</primary>
53820 <secondary>removing; in router or transport</secondary>
53822 When a message is delivered, the addition and removal of header lines can be
53823 specified in a system filter, or on any of the routers and transports that
53824 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
53825 modifying headers in a system filter. Header lines can also be added in an ACL
53826 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
53829 In contrast to what happens in a system filter, header modifications that are
53830 specified on routers and transports apply only to the particular recipient
53831 addresses that are being processed by those routers and transports. These
53832 changes do not actually take place until a copy of the message is being
53833 transported. Therefore, they do not affect the basic set of header lines, and
53834 they do not affect the values of the variables that refer to header lines.
53837 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
53838 the transport cannot refer to the modified header lines, because such
53839 expansions all occur before the message is actually transported.
53842 For both routers and transports, the result of expanding a <option>headers_add</option>
53843 option must be in the form of one or more RFC 2822 header lines, separated by
53844 newlines (coded as <quote>\n</quote>). For example:
53846 <literallayout class="monospaced">
53847 headers_add = X-added-header: added by $primary_hostname\n\
53848 X-added-second: another added header line
53851 Exim does not check the syntax of these added header lines.
53854 The result of expanding <option>headers_remove</option> must consist of a colon-separated
53855 list of header names. This is confusing, because header names themselves are
53856 often terminated by colons. In this case, the colons are the list separators,
53857 not part of the names. For example:
53859 <literallayout class="monospaced">
53860 headers_remove = return-receipt-to:acknowledge-to
53863 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router, its value
53864 is expanded at routing time, and then associated with all addresses that are
53865 accepted by that router, and also with any new addresses that it generates. If
53866 an address passes through several routers as a result of aliasing or
53867 forwarding, the changes are cumulative.
53870 <indexterm role="concept">
53871 <primary><option>unseen</option> option</primary>
53873 However, this does not apply to multiple routers that result from the use of
53874 the <option>unseen</option> option. Any header modifications that were specified by the
53875 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
53878 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
53879 settings cannot be delivered together in a batch, so a transport is always
53880 dealing with a set of addresses that have the same header-processing
53884 The transport starts by writing the original set of header lines that arrived
53885 with the message, possibly modified by the system filter. As it writes out
53886 these lines, it consults the list of header names that were attached to the
53887 recipient address(es) by <option>headers_remove</option> options in routers, and it also
53888 consults the transport’s own <option>headers_remove</option> option. Header lines whose
53889 names are on either of these lists are not written out. If there are multiple
53890 instances of any listed header, they are all skipped.
53893 After the remaining original header lines have been written, new header
53894 lines that were specified by routers’ <option>headers_add</option> options are written, in
53895 the order in which they were attached to the address. These are followed by any
53896 header lines specified by the transport’s <option>headers_add</option> option.
53899 This way of handling header line modifications in routers and transports has
53900 the following consequences:
53905 The original set of header lines, possibly modified by the system filter,
53906 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
53907 to it, at all times.
53912 Header lines that are added by a router’s
53913 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
53914 expansion syntax in subsequent routers or the transport.
53919 Conversely, header lines that are specified for removal by <option>headers_remove</option>
53920 in a router remain visible to subsequent routers and the transport.
53925 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
53926 a later router or by a transport.
53931 An added header can refer to the contents of an original header that is to be
53932 removed, even it has the same name as the added header. For example:
53934 <literallayout class="monospaced">
53935 headers_remove = subject
53936 headers_add = Subject: new subject (was: $h_subject:)
53941 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
53942 for a <command>redirect</command> router that has the <option>one_time</option> option set.
53945 <section id="SECTconstr">
53946 <title>Constructed addresses</title>
53948 <indexterm role="concept">
53949 <primary>address</primary>
53950 <secondary>constructed</secondary>
53952 <indexterm role="concept">
53953 <primary>constructed address</primary>
53955 When Exim constructs a sender address for a locally-generated message, it uses
53959 <<emphasis>user name</emphasis>> <<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>>
53964 <literallayout class="monospaced">
53965 Zaphod Beeblebrox <zaphod@end.univ.example>
53968 The user name is obtained from the <option>-F</option> command line option if set, or
53969 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
53970 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
53971 ampersand character, this is replaced by the login name with the first letter
53972 upper cased, as is conventional in a number of operating systems. See the
53973 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
53974 The <option>unknown_username</option> option can be used to specify user names in cases when
53975 there is no password file entry.
53978 <indexterm role="concept">
53979 <primary>RFC 2047</primary>
53981 In all cases, the user name is made to conform to RFC 2822 by quoting all or
53982 parts of it if necessary. In addition, if it contains any non-printing
53983 characters, it is encoded as described in RFC 2047, which defines a way of
53984 including non-ASCII characters in header lines. The value of the
53985 <option>headers_charset</option> option specifies the name of the encoding that is used (the
53986 characters are assumed to be in this encoding). The setting of
53987 <option>print_topbitchars</option> controls whether characters with the top bit set (that
53988 is, with codes greater than 127) count as printing characters or not.
53992 <title>Case of local parts</title>
53994 <indexterm role="concept">
53995 <primary>case of local parts</primary>
53997 <indexterm role="concept">
53998 <primary>local part</primary>
53999 <secondary>case of</secondary>
54001 RFC 2822 states that the case of letters in the local parts of addresses cannot
54002 be assumed to be non-significant. Exim preserves the case of local parts of
54003 addresses, but by default it uses a lower-cased form when it is routing,
54004 because on most Unix systems, usernames are in lower case and case-insensitive
54005 routing is required. However, any particular router can be made to use the
54006 original case for local parts by setting the <option>caseful_local_part</option> generic
54010 <indexterm role="concept">
54011 <primary>mixed-case login names</primary>
54013 If you must have mixed-case user names on your system, the best way to proceed,
54014 assuming you want case-independent handling of incoming email, is to set up
54015 your first router to convert incoming local parts in your domains to the
54016 correct case by means of a file lookup. For example:
54018 <literallayout class="monospaced">
54021 domains = +local_domains
54022 data = ${lookup{$local_part}cdb\
54023 {/etc/usercased.cdb}{$value}fail}\
54027 For this router, the local part is forced to lower case by the default action
54028 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
54029 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
54030 on any subsequent routers which process your domains, they will operate on
54031 local parts with the correct case in a case-sensitive manner.
54035 <title>Dots in local parts</title>
54037 <indexterm role="concept">
54038 <primary>dot</primary>
54039 <secondary>in local part</secondary>
54041 <indexterm role="concept">
54042 <primary>local part</primary>
54043 <secondary>dots in</secondary>
54045 RFC 2822 forbids empty components in local parts. That is, an unquoted local
54046 part may not begin or end with a dot, nor have two consecutive dots in the
54047 middle. However, it seems that many MTAs do not enforce this, so Exim permits
54048 empty components for compatibility.
54052 <title>Rewriting addresses</title>
54054 <indexterm role="concept">
54055 <primary>rewriting</primary>
54056 <secondary>addresses</secondary>
54058 Rewriting of sender and recipient addresses, and addresses in headers, can
54059 happen automatically, or as the result of configuration options, as described
54060 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
54061 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
54064 Automatic rewriting includes qualification, as mentioned above. The other case
54065 in which it can happen is when an incomplete non-local domain is given. The
54066 routing process may cause this to be expanded into the full domain name. For
54067 example, a header such as
54069 <literallayout class="monospaced">
54073 might get rewritten as
54075 <literallayout class="monospaced">
54076 To: hare@teaparty.wonderland.fict.example
54079 Rewriting as a result of routing is the one kind of message processing that
54080 does not happen at input time, as it cannot be done until the address has
54084 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
54085 addresses have been routed, in case any of the headers get changed as a
54086 result of routing. However, doing this in practice would hold up many
54087 deliveries for unreasonable amounts of time, just because one address could not
54088 immediately be routed. Exim therefore does not delay other deliveries when
54089 routing of one or more addresses is deferred.
54090 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
54095 <chapter id="CHAPSMTP">
54096 <title>SMTP processing</title>
54098 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
54099 <primary>SMTP</primary>
54100 <secondary>processing details</secondary>
54102 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
54103 <primary>LMTP</primary>
54104 <secondary>processing details</secondary>
54106 Exim supports a number of different ways of using the SMTP protocol, and its
54107 LMTP variant, which is an interactive protocol for transferring messages into a
54108 closed mail store application. This chapter contains details of how SMTP is
54109 processed. For incoming mail, the following are available:
54114 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
54119 SMTP over the standard input and output (the <option>-bs</option> option);
54124 Batched SMTP on the standard input (the <option>-bS</option> option).
54129 For mail delivery, the following are available:
54134 SMTP over TCP/IP (the <command>smtp</command> transport);
54139 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
54140 <quote>lmtp</quote>);
54145 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
54151 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
54152 the <option>use_bsmtp</option> option set).
54157 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
54158 stored in or read from files (or pipes), in a format in which SMTP commands are
54159 used to contain the envelope information.
54161 <section id="SECToutSMTPTCP">
54162 <title>Outgoing SMTP and LMTP over TCP/IP</title>
54164 <indexterm role="concept">
54165 <primary>SMTP</primary>
54166 <secondary>outgoing over TCP/IP</secondary>
54168 <indexterm role="concept">
54169 <primary>outgoing SMTP over TCP/IP</primary>
54171 <indexterm role="concept">
54172 <primary>LMTP</primary>
54173 <secondary>over TCP/IP</secondary>
54175 <indexterm role="concept">
54176 <primary>outgoing LMTP over TCP/IP</primary>
54178 <indexterm role="concept">
54179 <primary>EHLO</primary>
54181 <indexterm role="concept">
54182 <primary>HELO</primary>
54184 <indexterm role="concept">
54185 <primary>SIZE option on MAIL command</primary>
54187 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
54188 The <option>protocol</option> option selects which protocol is to be used, but the actual
54189 processing is the same in both cases.
54192 If, in response to its EHLO command, Exim is told that the SIZE
54193 parameter is supported, it adds SIZE=<<emphasis>n</emphasis>> to each subsequent MAIL
54194 command. The value of <<emphasis>n</emphasis>> is the message size plus the value of the
54195 <option>size_addition</option> option (default 1024) to allow for additions to the message
54196 such as per-transport header lines, or changes made in a
54197 <indexterm role="concept">
54198 <primary>transport</primary>
54199 <secondary>filter</secondary>
54201 <indexterm role="concept">
54202 <primary>filter</primary>
54203 <secondary>transport filter</secondary>
54205 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
54209 If the remote server advertises support for PIPELINING, Exim uses the
54210 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
54211 required for the transaction.
54214 If the remote server advertises support for the STARTTLS command, and Exim
54215 was built to support TLS encryption, it tries to start a TLS session unless the
54216 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
54219 If the remote server advertises support for the AUTH command, Exim scans
54220 the authenticators configuration for any suitable client settings, as described
54221 in chapter <xref linkend="CHAPSMTPAUTH"/>.
54224 <indexterm role="concept">
54225 <primary>carriage return</primary>
54227 <indexterm role="concept">
54228 <primary>linefeed</primary>
54230 Responses from the remote host are supposed to be terminated by CR followed by
54231 LF. However, there are known to be hosts that do not send CR characters, so in
54232 order to be able to interwork with such hosts, Exim treats LF on its own as a
54236 If a message contains a number of different addresses, all those with the same
54237 characteristics (for example, the same envelope sender) that resolve to the
54238 same set of hosts, in the same order, are sent in a single SMTP transaction,
54239 even if they are for different domains, unless there are more than the setting
54240 of the <option>max_rcpts</option> option in the <command>smtp</command> transport allows, in which case
54241 they are split into groups containing no more than <option>max_rcpts</option> addresses
54242 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
54243 in parallel sessions. The order of hosts with identical MX values is not
54244 significant when checking whether addresses can be batched in this way.
54247 When the <command>smtp</command> transport suffers a temporary failure that is not
54248 message-related, Exim updates its transport-specific database, which contains
54249 records indexed by host name that remember which messages are waiting for each
54250 particular host. It also updates the retry database with new retry times.
54253 <indexterm role="concept">
54254 <primary>hints database</primary>
54255 <secondary>retry keys</secondary>
54257 Exim’s retry hints are based on host name plus IP address, so if one address of
54258 a multi-homed host is broken, it will soon be skipped most of the time.
54259 See the next section for more detail about error handling.
54262 <indexterm role="concept">
54263 <primary>SMTP</primary>
54264 <secondary>passed connection</secondary>
54266 <indexterm role="concept">
54267 <primary>SMTP</primary>
54268 <secondary>batching over TCP/IP</secondary>
54270 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
54271 looks in the hints database for the transport to see if there are any queued
54272 messages waiting for the host to which it is connected. If it finds one, it
54273 creates a new Exim process using the <option>-MC</option> option (which can only be used by
54274 a process running as root or the Exim user) and passes the TCP/IP socket to it
54275 so that it can deliver another message using the same socket. The new process
54276 does only those deliveries that are routed to the connected host, and may in
54277 turn pass the socket on to a third process, and so on.
54280 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
54281 limit the number of messages sent down a single TCP/IP connection.
54284 <indexterm role="concept">
54285 <primary>asterisk</primary>
54286 <secondary>after IP address</secondary>
54288 The second and subsequent messages delivered down an existing connection are
54289 identified in the main log by the addition of an asterisk after the closing
54290 square bracket of the IP address.
54293 <section id="SECToutSMTPerr">
54294 <title>Errors in outgoing SMTP</title>
54296 <indexterm role="concept">
54297 <primary>error</primary>
54298 <secondary>in outgoing SMTP</secondary>
54300 <indexterm role="concept">
54301 <primary>SMTP</primary>
54302 <secondary>errors in outgoing</secondary>
54304 <indexterm role="concept">
54305 <primary>host</primary>
54306 <secondary>error</secondary>
54308 Three different kinds of error are recognized for outgoing SMTP: host errors,
54309 message errors, and recipient errors.
54313 <term><emphasis role="bold">Host errors</emphasis></term>
54316 A host error is not associated with a particular message or with a
54317 particular recipient of a message. The host errors are:
54322 Connection refused or timed out,
54327 Any error response code on connection,
54332 Any error response code to EHLO or HELO,
54337 Loss of connection at any time, except after <quote>.</quote>,
54342 I/O errors at any time,
54347 Timeouts during the session, other than in response to MAIL, RCPT or
54348 the <quote>.</quote> at the end of the data.
54353 For a host error, a permanent error response on connection, or in response to
54354 EHLO, causes all addresses routed to the host to be failed. Any other host
54355 error causes all addresses to be deferred, and retry data to be created for the
54356 host. It is not tried again, for any message, until its retry time arrives. If
54357 the current set of addresses are not all delivered in this run (to some
54358 alternative host), the message is added to the list of those waiting for this
54359 host, so if it is still undelivered when a subsequent successful delivery is
54360 made to the host, it will be sent down the same SMTP connection.
54362 </listitem></varlistentry>
54364 <term><emphasis role="bold">Message errors</emphasis></term>
54367 <indexterm role="concept">
54368 <primary>message</primary>
54369 <secondary>error</secondary>
54371 A message error is associated with a particular message when sent to a
54372 particular host, but not with a particular recipient of the message. The
54373 message errors are:
54378 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
54384 Timeout after MAIL,
54389 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
54390 timeout after the DATA command itself is treated as a host error, as is loss of
54391 connection at any other time.
54396 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
54397 to be failed, and a delivery error report to be returned to the sender. A
54398 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
54399 addresses to be deferred. Retry data is not created for the host, but instead,
54400 a retry record for the combination of host plus message id is created. The
54401 message is not added to the list of those waiting for this host. This ensures
54402 that the failing message will not be sent to this host again until the retry
54403 time arrives. However, other messages that are routed to the host are not
54404 affected, so if it is some property of the message that is causing the error,
54405 it will not stop the delivery of other mail.
54408 If the remote host specified support for the SIZE parameter in its response
54409 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
54410 over-large message will cause a message error because the error arrives as a
54413 </listitem></varlistentry>
54415 <term><emphasis role="bold">Recipient errors</emphasis></term>
54418 <indexterm role="concept">
54419 <primary>recipient</primary>
54420 <secondary>error</secondary>
54422 A recipient error is associated with a particular recipient of a message. The
54423 recipient errors are:
54428 Any error response to RCPT,
54433 Timeout after RCPT.
54438 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
54439 recipient address to be failed, and a bounce message to be returned to the
54440 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
54441 address to be deferred, and routing retry data to be created for it. This is
54442 used to delay processing of the address in subsequent queue runs, until its
54443 routing retry time arrives. This applies to all messages, but because it
54444 operates only in queue runs, one attempt will be made to deliver a new message
54445 to the failing address before the delay starts to operate. This ensures that,
54446 if the failure is really related to the message rather than the recipient
54447 (<quote>message too big for this recipient</quote> is a possible example), other messages
54448 have a chance of getting delivered. If a delivery to the address does succeed,
54449 the retry information gets cleared, so all stuck messages get tried again, and
54450 the retry clock is reset.
54453 The message is not added to the list of those waiting for this host. Use of the
54454 host for other messages is unaffected, and except in the case of a timeout,
54455 other recipients are processed independently, and may be successfully delivered
54456 in the current SMTP session. After a timeout it is of course impossible to
54457 proceed with the session, so all addresses get deferred. However, those other
54458 than the one that failed do not suffer any subsequent retry delays. Therefore,
54459 if one recipient is causing trouble, the others have a chance of getting
54460 through when a subsequent delivery attempt occurs before the failing
54461 recipient’s retry time.
54463 </listitem></varlistentry>
54466 In all cases, if there are other hosts (or IP addresses) available for the
54467 current set of addresses (for example, from multiple MX records), they are
54468 tried in this run for any undelivered addresses, subject of course to their
54469 own retry data. In other words, recipient error retry data does not take effect
54470 until the next delivery attempt.
54473 Some hosts have been observed to give temporary error responses to every
54474 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
54475 would be nice if such circumstances could be recognized, and defer data for the
54476 host itself created, but this is not possible within the current Exim design.
54477 What actually happens is that retry data for every (host, message) combination
54481 The reason that timeouts after MAIL and RCPT are treated specially is that
54482 these can sometimes arise as a result of the remote host’s verification
54483 procedures. Exim makes this assumption, and treats them as if a temporary error
54484 response had been received. A timeout after <quote>.</quote> is treated specially because
54485 it is known that some broken implementations fail to recognize the end of the
54486 message if the last character of the last line is a binary zero. Thus, it is
54487 helpful to treat this case as a message error.
54490 Timeouts at other times are treated as host errors, assuming a problem with the
54491 host, or the connection to it. If a timeout after MAIL, RCPT,
54492 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
54493 the timeout is likely to occur at some other point in the dialogue, causing it
54494 then to be treated as a host error.
54497 There is experimental evidence that some MTAs drop the connection after the
54498 terminating <quote>.</quote> if they do not like the contents of the message for some
54499 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
54500 should be given. That is why Exim treats this case as a message rather than a
54501 host error, in order not to delay other messages to the same host.
54505 <title>Incoming SMTP messages over TCP/IP</title>
54507 <indexterm role="concept">
54508 <primary>SMTP</primary>
54509 <secondary>incoming over TCP/IP</secondary>
54511 <indexterm role="concept">
54512 <primary>incoming SMTP over TCP/IP</primary>
54514 <indexterm role="concept">
54515 <primary>inetd</primary>
54517 <indexterm role="concept">
54518 <primary>daemon</primary>
54520 Incoming SMTP messages can be accepted in one of two ways: by running a
54521 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
54522 <filename>/etc/inetd.conf</filename> should be like this:
54524 <literallayout class="monospaced">
54525 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
54528 Exim distinguishes between this case and the case of a locally running user
54529 agent using the <option>-bs</option> option by checking whether or not the standard input is
54530 a socket. When it is, either the port must be privileged (less than 1024), or
54531 the caller must be root or the Exim user. If any other user passes a socket
54532 with an unprivileged port number, Exim prints a message on the standard error
54533 stream and exits with an error code.
54536 By default, Exim does not make a log entry when a remote host connects or
54537 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
54538 unexpected. It can be made to write such log entries by setting the
54539 <option>smtp_connection</option> log selector.
54542 <indexterm role="concept">
54543 <primary>carriage return</primary>
54545 <indexterm role="concept">
54546 <primary>linefeed</primary>
54548 Commands from the remote host are supposed to be terminated by CR followed by
54549 LF. However, there are known to be hosts that do not send CR characters. In
54550 order to be able to interwork with such hosts, Exim treats LF on its own as a
54552 Furthermore, because common code is used for receiving messages from all
54553 sources, a CR on its own is also interpreted as a line terminator. However, the
54554 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
54557 <indexterm role="concept">
54558 <primary>EHLO</primary>
54559 <secondary>invalid data</secondary>
54561 <indexterm role="concept">
54562 <primary>HELO</primary>
54563 <secondary>invalid data</secondary>
54565 One area that sometimes gives rise to problems concerns the EHLO or
54566 HELO commands. Some clients send syntactically invalid versions of these
54567 commands, which Exim rejects by default. (This is nothing to do with verifying
54568 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
54569 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
54570 match the broken hosts that send invalid commands.
54573 <indexterm role="concept">
54574 <primary>SIZE option on MAIL command</primary>
54576 <indexterm role="concept">
54577 <primary>MAIL</primary>
54578 <secondary>SIZE option</secondary>
54580 The amount of disk space available is checked whenever SIZE is received on
54581 a MAIL command, independently of whether <option>message_size_limit</option> or
54582 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
54583 false. A temporary error is given if there is not enough space. If
54584 <option>check_spool_space</option> is set, the check is for that amount of space plus the
54585 value given with SIZE, that is, it checks that the addition of the incoming
54586 message will not reduce the space below the threshold.
54589 When a message is successfully received, Exim includes the local message id in
54590 its response to the final <quote>.</quote> that terminates the data. If the remote host
54591 logs this text it can help with tracing what has happened to a message.
54594 The Exim daemon can limit the number of simultaneous incoming connections it is
54595 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
54596 number of simultaneous incoming connections from a single remote host (see the
54597 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
54598 rejected using the SMTP temporary error code 421.
54601 The Exim daemon does not rely on the SIGCHLD signal to detect when a
54602 subprocess has finished, as this can get lost at busy times. Instead, it looks
54603 for completed subprocesses every time it wakes up. Provided there are other
54604 things happening (new incoming calls, starts of queue runs), completed
54605 processes will be noticed and tidied away. On very quiet systems you may
54606 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
54607 it will be noticed when the daemon next wakes up.
54610 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
54611 and can also be set up to reject SMTP calls from non-reserved hosts at times of
54612 high system load – for details see the <option>smtp_accept_reserve</option>,
54613 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
54614 applies in both the daemon and <emphasis>inetd</emphasis> cases.
54617 Exim normally starts a delivery process for each message received, though this
54618 can be varied by means of the <option>-odq</option> command line option and the
54619 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
54620 number of simultaneously running delivery processes started in this way from
54621 SMTP input can be limited by the <option>smtp_accept_queue</option> and
54622 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
54623 subsequently received messages are just put on the input queue without starting
54624 a delivery process.
54627 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
54628 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
54629 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
54630 handled by an entirely independent Exim process. Control by load average is,
54631 however, available with <emphasis>inetd</emphasis>.
54634 Exim can be configured to verify addresses in incoming SMTP commands as they
54635 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
54636 to rewrite addresses at this time – before any syntax checking is done. See
54637 section <xref linkend="SECTrewriteS"/>.
54640 Exim can also be configured to limit the rate at which a client host submits
54641 MAIL and RCPT commands in a single SMTP session. See the
54642 <option>smtp_ratelimit_hosts</option> option.
54646 <title>Unrecognized SMTP commands</title>
54648 <indexterm role="concept">
54649 <primary>SMTP</primary>
54650 <secondary>unrecognized commands</secondary>
54652 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
54653 commands during a single SMTP connection, it drops the connection after sending
54654 the error response to the last command. The default value for
54655 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
54656 abuse that subvert web servers into making connections to SMTP ports; in these
54657 circumstances, a number of non-SMTP lines are sent first.
54661 <title>Syntax and protocol errors in SMTP commands</title>
54663 <indexterm role="concept">
54664 <primary>SMTP</primary>
54665 <secondary>syntax errors</secondary>
54667 <indexterm role="concept">
54668 <primary>SMTP</primary>
54669 <secondary>protocol errors</secondary>
54671 A syntax error is detected if an SMTP command is recognized, but there is
54672 something syntactically wrong with its data, for example, a malformed email
54673 address in a RCPT command. Protocol errors include invalid command
54674 sequencing such as RCPT before MAIL. If Exim receives more than
54675 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
54676 drops the connection after sending the error response to the last command. The
54677 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
54678 broken clients that loop sending bad commands (yes, it has been seen).
54682 <title>Use of non-mail SMTP commands</title>
54684 <indexterm role="concept">
54685 <primary>SMTP</primary>
54686 <secondary>non-mail commands</secondary>
54688 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
54689 DATA. Exim counts such commands, and drops the connection if there are too
54690 many of them in a single SMTP session. This action catches some
54691 denial-of-service attempts and things like repeated failing AUTHs, or a mad
54692 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
54693 defines what <quote>too many</quote> means. Its default value is 10.
54696 When a new message is expected, one occurrence of RSET is not counted. This
54697 allows a client to send one RSET between messages (this is not necessary,
54698 but some clients do it). Exim also allows one uncounted occurence of HELO
54699 or EHLO, and one occurrence of STARTTLS between messages. After
54700 starting up a TLS session, another EHLO is expected, and so it too is not
54704 The first occurrence of AUTH in a connection, or immediately following
54705 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
54706 RCPT, DATA, and QUIT are counted.
54709 You can control which hosts are subject to the limit set by
54710 <option>smtp_accept_max_nonmail</option> by setting
54711 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
54712 the limit apply to all hosts. This option means that you can exclude any
54713 specific badly-behaved hosts that you have to live with.
54717 <title>The VRFY and EXPN commands</title>
54719 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
54720 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
54721 appropriate) in order to decide whether the command should be accepted or not.
54722 If no ACL is defined, the command is rejected.
54725 <indexterm role="concept">
54726 <primary>VRFY</primary>
54727 <secondary>processing</secondary>
54729 When VRFY is accepted, it runs exactly the same code as when Exim is
54730 called with the <option>-bv</option> option.
54733 <indexterm role="concept">
54734 <primary>EXPN</primary>
54735 <secondary>processing</secondary>
54737 When EXPN is accepted, a single-level expansion of the address is done.
54738 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
54739 than a verification (the <option>-bv</option> option). If an unqualified local part is given
54740 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
54741 of VRFY and EXPN commands are logged on the main and reject logs, and
54742 VRFY verification failures are logged on the main log for consistency with
54746 <section id="SECTETRN">
54747 <title>The ETRN command</title>
54749 <indexterm role="concept">
54750 <primary>ETRN</primary>
54751 <secondary>processing</secondary>
54753 RFC 1985 describes an SMTP command called ETRN that is designed to
54754 overcome the security problems of the TURN command (which has fallen into
54755 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
54756 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
54757 should be accepted or not. If no ACL is defined, the command is rejected.
54760 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
54761 delivery to certain hosts. As Exim does not organize its message queue by host,
54762 the only form of ETRN that is supported by default is the one where the
54763 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
54764 specific to the SMTP server. A valid ETRN command causes a run of Exim with
54765 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
54766 argument. For example,
54768 <literallayout class="monospaced">
54774 <literallayout class="monospaced">
54778 which causes a delivery attempt on all messages with undelivered addresses
54779 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
54780 default), Exim prevents the simultaneous execution of more than one queue run
54781 for the same argument string as a result of an ETRN command. This stops
54782 a misbehaving client from starting more than one queue runner at once.
54785 <indexterm role="concept">
54786 <primary>hints database</primary>
54787 <secondary>ETRN serialization</secondary>
54789 Exim implements the serialization by means of a hints database in which a
54790 record is written whenever a process is started by ETRN, and deleted when
54791 the process completes. However, Exim does not keep the SMTP session waiting for
54792 the ETRN process to complete. Once ETRN is accepted, the client is sent
54793 a <quote>success</quote> return code. Obviously there is scope for hints records to get
54794 left lying around if there is a system or program crash. To guard against this,
54795 Exim ignores any records that are more than six hours old.
54798 <indexterm role="concept">
54799 <primary><option>smtp_etrn_command</option></primary>
54801 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
54802 used. This specifies a command that is run whenever ETRN is received,
54803 whatever the form of its argument. For
54806 <literallayout class="monospaced">
54807 smtp_etrn_command = /etc/etrn_command $domain \
54808 $sender_host_address
54811 <indexterm role="concept">
54812 <primary><varname>$domain</varname></primary>
54814 The string is split up into arguments which are independently expanded. The
54815 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
54816 and no syntax checking is done on the contents of this argument. Exim does not
54817 wait for the command to complete, so its status code is not checked. Exim runs
54818 under its own uid and gid when receiving incoming SMTP, so it is not possible
54819 for it to change them before running the command.
54823 <title>Incoming local SMTP</title>
54825 <indexterm role="concept">
54826 <primary>SMTP</primary>
54827 <secondary>local incoming</secondary>
54829 Some user agents use SMTP to pass messages to their local MTA using the
54830 standard input and output, as opposed to passing the envelope on the command
54831 line and writing the message to the standard input. This is supported by the
54832 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
54833 messages over TCP/IP (including the use of ACLs), except that the envelope
54834 sender given in a MAIL command is ignored unless the caller is trusted. In
54835 an ACL you can detect this form of SMTP input by testing for an empty host
54836 identification. It is common to have this as the first line in the ACL that
54837 runs for RCPT commands:
54839 <literallayout class="monospaced">
54843 This accepts SMTP messages from local processes without doing any other tests.
54846 <section id="SECTbatchSMTP">
54847 <title>Outgoing batched SMTP</title>
54849 <indexterm role="concept">
54850 <primary>SMTP</primary>
54851 <secondary>batched outgoing</secondary>
54853 <indexterm role="concept">
54854 <primary>batched SMTP output</primary>
54856 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
54857 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
54858 be output in BSMTP format. No SMTP responses are possible for this form of
54859 delivery. All it is doing is using SMTP commands as a way of transmitting the
54860 envelope along with the message.
54863 The message is written to the file or pipe preceded by the SMTP commands
54864 MAIL and RCPT, and followed by a line containing a single dot. Lines in
54865 the message that start with a dot have an extra dot added. The SMTP command
54866 HELO is not normally used. If it is required, the <option>message_prefix</option> option
54867 can be used to specify it.
54870 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
54871 one recipient address at a time by default. However, you can arrange for them
54872 to handle several addresses at once by setting the <option>batch_max</option> option. When
54873 this is done for BSMTP, messages may contain multiple RCPT commands. See
54874 chapter <xref linkend="CHAPbatching"/> for more details.
54877 <indexterm role="concept">
54878 <primary><varname>$host</varname></primary>
54880 When one or more addresses are routed to a BSMTP transport by a router that
54881 sets up a host list, the name of the first host on the list is available to the
54882 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
54885 <literallayout class="monospaced">
54888 driver = manualroute
54889 transport = smtp_appendfile
54890 route_list = domain.example batch.host.example
54894 driver = appendfile
54895 directory = /var/bsmtp/$host
54901 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
54902 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
54903 message (unless there are more than 1000 recipients).
54906 <section id="SECTincomingbatchedSMTP">
54907 <title>Incoming batched SMTP</title>
54909 <indexterm role="concept">
54910 <primary>SMTP</primary>
54911 <secondary>batched incoming</secondary>
54913 <indexterm role="concept">
54914 <primary>batched SMTP input</primary>
54916 The <option>-bS</option> command line option causes Exim to accept one or more messages by
54917 reading SMTP on the standard input, but to generate no responses. If the caller
54918 is trusted, the senders in the MAIL commands are believed; otherwise the
54919 sender is always the caller of Exim. Unqualified senders and receivers are not
54920 rejected (there seems little point) but instead just get qualified. HELO
54921 and EHLO act as RSET; VRFY, EXPN, ETRN and HELP, act
54922 as NOOP; QUIT quits.
54925 No policy checking is done for BSMTP input. That is, no ACL is run at anytime.
54926 In this respect it is like non-SMTP local input.
54929 If an error is detected while reading a message, including a missing <quote>.</quote> at
54930 the end, Exim gives up immediately. It writes details of the error to the
54931 standard output in a stylized way that the calling program should be able to
54932 make some use of automatically, for example:
54934 <literallayout class="monospaced">
54935 554 Unexpected end of file
54936 Transaction started in line 10
54937 Error detected in line 14
54940 It writes a more verbose version, for human consumption, to the standard error
54943 <literallayout class="monospaced">
54944 An error was detected while processing a file of BSMTP input.
54945 The error message was:
54947 501 '>' missing at end of address
54949 The SMTP transaction started in line 10.
54950 The error was detected in line 12.
54951 The SMTP command at fault was:
54953 rcpt to:<malformed@in.com.plete
54955 1 previous message was successfully processed.
54956 The rest of the batch was abandoned.
54959 The return code from Exim is zero only if there were no errors. It is 1 if some
54960 messages were accepted before an error was detected, and 2 if no messages were
54962 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
54963 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
54968 <chapter id="CHAPemsgcust">
54969 <title>Customizing bounce and warning messages</title>
54970 <titleabbrev>Customizing messages</titleabbrev>
54972 When a message fails to be delivered, or remains on the queue for more than a
54973 configured amount of time, Exim sends a message to the original sender, or
54974 to an alternative configured address. The text of these messages is built into
54975 the code of Exim, but it is possible to change it, either by adding a single
54976 string, or by replacing each of the paragraphs by text supplied in a file.
54979 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
54980 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
54981 option. Exim also adds the line
54983 <literallayout class="monospaced">
54984 Auto-Submitted: auto-generated
54987 to all warning and bounce messages,
54990 <title>Customizing bounce messages</title>
54992 <indexterm role="concept">
54993 <primary>customizing</primary>
54994 <secondary>bounce message</secondary>
54996 <indexterm role="concept">
54997 <primary>bounce message</primary>
54998 <secondary>customizing</secondary>
55000 If <option>bounce_message_text</option> is set, its contents are included in the default
55001 message immediately after <quote>This message was created automatically by mail
55002 delivery software.</quote> The string is not expanded. It is not used if
55003 <option>bounce_message_file</option> is set.
55006 When <option>bounce_message_file</option> is set, it must point to a template file for
55007 constructing error messages. The file consists of a series of text items,
55008 separated by lines consisting of exactly four asterisks. If the file cannot be
55009 opened, default text is used and a message is written to the main and panic
55010 logs. If any text item in the file is empty, default text is used for that
55014 <indexterm role="concept">
55015 <primary><varname>$bounce_recipient</varname></primary>
55017 <indexterm role="concept">
55018 <primary><varname>$bounce_return_size_limit</varname></primary>
55020 Each item of text that is read from the file is expanded, and there are two
55021 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
55022 the recipient of an error message while it is being created, and
55023 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
55024 option, rounded to a whole number.
55027 The items must appear in the file in the following order:
55032 The first item is included in the headers, and should include at least a
55033 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
55038 The second item forms the start of the error message. After it, Exim lists the
55039 failing addresses with their error messages.
55044 The third item is used to introduce any text from pipe transports that is to be
55045 returned to the sender. It is omitted if there is no such text.
55050 The fourth item is used to introduce the copy of the message that is returned
55051 as part of the error report.
55056 The fifth item is added after the fourth one if the returned message is
55057 truncated because it is bigger than <option>return_size_limit</option>.
55062 The sixth item is added after the copy of the original message.
55067 The default state (<option>bounce_message_file</option> unset) is equivalent to the
55068 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
55069 other lines have been split in order to fit them on the page:
55071 <literallayout class="monospaced">
55072 Subject: Mail delivery failed
55073 ${if eq{$sender_address}{$bounce_recipient}
55074 {: returning message to sender}}
55076 This message was created automatically by mail delivery software.
55078 A message ${if eq{$sender_address}{$bounce_recipient}
55079 {that you sent }{sent by
55081 <$sender_address>
55083 }}could not be delivered to all of its recipients.
55084 This is a permanent error. The following address(es) failed:
55086 The following text was generated during the delivery attempt(s):
55088 ------ This is a copy of the message, including all the headers.
55091 ------ The body of the message is $message_size characters long;
55093 ------ $bounce_return_size_limit or so are included here.
55097 <section id="SECTcustwarn">
55098 <title>Customizing warning messages</title>
55100 <indexterm role="concept">
55101 <primary>customizing</primary>
55102 <secondary>warning message</secondary>
55104 <indexterm role="concept">
55105 <primary>warning of delay</primary>
55106 <secondary>customizing the message</secondary>
55108 The option <option>warn_message_file</option> can be pointed at a template file for use when
55109 warnings about message delays are created. In this case there are only three
55115 The first item is included in the headers, and should include at least a
55116 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
55121 The second item forms the start of the warning message. After it, Exim lists
55122 the delayed addresses.
55127 The third item then ends the message.
55132 The default state is equivalent to the following file, except that some lines
55133 have been split here, in order to fit them on the page:
55135 <literallayout class="monospaced">
55136 Subject: Warning: message $message_exim_id delayed
55137 $warn_message_delay
55139 This message was created automatically by mail delivery software.
55141 A message ${if eq{$sender_address}{$warn_message_recipients}
55142 {that you sent }{sent by
55144 <$sender_address>
55146 }}has not been delivered to all of its recipients after
55147 more than $warn_message_delay on the queue on $primary_hostname.
55149 The message identifier is: $message_exim_id
55150 The subject of the message is: $h_subject
55151 The date of the message is: $h_date
55153 The following address(es) have not yet been delivered:
55155 No action is required on your part. Delivery attempts will
55156 continue for some time, and this warning may be repeated at
55157 intervals if the message remains undelivered. Eventually the
55158 mail delivery software will give up, and when that happens,
55159 the message will be returned to you.
55162 <indexterm role="concept">
55163 <primary><varname>$warn_message_delay</varname></primary>
55165 <indexterm role="concept">
55166 <primary><varname>$warn_message_recipients</varname></primary>
55168 However, in the default state the subject and date lines are omitted if no
55169 appropriate headers exist. During the expansion of this file,
55170 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote><<emphasis>n</emphasis>>
55171 minutes</quote> or <quote><<emphasis>n</emphasis>> hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
55172 of recipients for the warning message. There may be more than one if there are
55173 multiple addresses with different <option>errors_to</option> settings on the routers that
55179 <chapter id="CHAPcomconreq">
55180 <title>Some common configuration settings</title>
55182 This chapter discusses some configuration settings that seem to be fairly
55183 common. More examples and discussion can be found in the Exim book.
55186 <title>Sending mail to a smart host</title>
55188 <indexterm role="concept">
55189 <primary>smart host</primary>
55190 <secondary>example router</secondary>
55192 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
55193 should replace the default <command>dnslookup</command> router with a router which does the
55194 routing explicitly:
55196 <literallayout class="monospaced">
55197 send_to_smart_host:
55198 driver = manualroute
55199 route_list = !+local_domains smart.host.name
55200 transport = remote_smtp
55203 You can use the smart host’s IP address instead of the name if you wish.
55204 If you are using Exim only to submit messages to a smart host, and not for
55205 receiving incoming messages, you can arrange for it to do the submission
55206 synchronously by setting the <option>mua_wrapper</option> option (see chapter
55207 <xref linkend="CHAPnonqueueing"/>).
55210 <section id="SECTmailinglists">
55211 <title>Using Exim to handle mailing lists</title>
55213 <indexterm role="concept">
55214 <primary>mailing lists</primary>
55216 Exim can be used to run simple mailing lists, but for large and/or complicated
55217 requirements, the use of additional specialized mailing list software such as
55218 Majordomo or Mailman is recommended.
55221 The <command>redirect</command> router can be used to handle mailing lists where each list
55222 is maintained in a separate file, which can therefore be managed by an
55223 independent manager. The <option>domains</option> router option can be used to run these
55224 lists in a separate domain from normal mail. For example:
55226 <literallayout class="monospaced">
55229 domains = lists.example
55230 file = /usr/lists/$local_part
55233 errors_to = $local_part-request@lists.example
55237 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
55238 in that domain, it looks for a file that matches the local part. If there is no
55239 such file, the router declines, but because <option>no_more</option> is set, no subsequent
55240 routers are tried, and so the whole delivery fails.
55243 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
55244 expanded into a file name or a pipe delivery, which is usually inappropriate in
55248 <indexterm role="concept">
55249 <primary><option>errors_to</option></primary>
55251 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
55252 taken from a mailing list are to be sent to the given address rather than the
55253 original sender of the message. However, before acting on this, Exim verifies
55254 the error address, and ignores it if verification fails.
55257 For example, using the configuration above, mail sent to
55258 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
55259 <filename>/usr/lists/dicts</filename>, with error reports directed to
55260 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
55261 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
55262 the address(es) of this particular list’s manager(s), but other approaches,
55263 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
55264 or <option>local_part_suffix</option> options) to handle addresses of the form
55265 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
55269 <title>Syntax errors in mailing lists</title>
55271 <indexterm role="concept">
55272 <primary>mailing lists</primary>
55273 <secondary>syntax errors in</secondary>
55275 If an entry in redirection data contains a syntax error, Exim normally defers
55276 delivery of the original address. That means that a syntax error in a mailing
55277 list holds up all deliveries to the list. This may not be appropriate when a
55278 list is being maintained automatically from data supplied by users, and the
55279 addresses are not rigorously checked.
55282 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
55283 entries that fail to parse, noting the incident in the log. If in addition
55284 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
55285 whenever a broken address is skipped. It is usually appropriate to set
55286 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
55290 <title>Re-expansion of mailing lists</title>
55292 <indexterm role="concept">
55293 <primary>mailing lists</primary>
55294 <secondary>re-expansion of</secondary>
55296 Exim remembers every individual address to which a message has been delivered,
55297 in order to avoid duplication, but it normally stores only the original
55298 recipient addresses with a message. If all the deliveries to a mailing list
55299 cannot be done at the first attempt, the mailing list is re-expanded when the
55300 delivery is next tried. This means that alterations to the list are taken into
55301 account at each delivery attempt, so addresses that have been added to
55302 the list since the message arrived will therefore receive a copy of the
55303 message, even though it pre-dates their subscription.
55306 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
55307 on the <command>redirect</command> router. If this is done, any addresses generated by the
55308 router that fail to deliver at the first attempt are added to the message as
55309 <quote>top level</quote> addresses, and the parent address that generated them is marked
55310 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
55311 subsequent delivery attempts. The disadvantage of this is that if any of the
55312 failing addresses are incorrect, correcting them in the file has no effect on
55313 pre-existing messages.
55316 The original top-level address is remembered with each of the generated
55317 addresses, and is output in any log messages. However, any intermediate parent
55318 addresses are not recorded. This makes a difference to the log only if the
55319 <option>all_parents</option> selector is set, but for mailing lists there is normally only
55320 one level of expansion anyway.
55324 <title>Closed mailing lists</title>
55326 <indexterm role="concept">
55327 <primary>mailing lists</primary>
55328 <secondary>closed</secondary>
55330 The examples so far have assumed open mailing lists, to which anybody may
55331 send mail. It is also possible to set up closed lists, where mail is accepted
55332 from specified senders only. This is done by making use of the generic
55333 <option>senders</option> option to restrict the router that handles the list.
55336 The following example uses the same file as a list of recipients and as a list
55337 of permitted senders. It requires three routers:
55339 <literallayout class="monospaced">
55342 domains = lists.example
55343 local_part_suffix = -request
55344 file = /usr/lists/$local_part$local_part_suffix
55349 domains = lists.example
55350 senders = ${if exists {/usr/lists/$local_part}\
55351 {lsearch;/usr/lists/$local_part}{*}}
55352 file = /usr/lists/$local_part
55355 errors_to = $local_part-request@lists.example
55360 domains = lists.example
55362 data = :fail: $local_part@lists.example is a closed mailing list
55365 All three routers have the same <option>domains</option> setting, so for any other domains,
55366 they are all skipped. The first router runs only if the local part ends in
55367 <option>-request</option>. It handles messages to the list manager(s) by means of an open
55371 The second router runs only if the <option>senders</option> precondition is satisfied. It
55372 checks for the existence of a list that corresponds to the local part, and then
55373 checks that the sender is on the list by means of a linear search. It is
55374 necessary to check for the existence of the file before trying to search it,
55375 because otherwise Exim thinks there is a configuration error. If the file does
55376 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
55377 means that the router runs, but because there is no list, declines, and
55378 <option>no_more</option> ensures that no further routers are run. The address fails with an
55379 <quote>unrouteable address</quote> error.
55382 The third router runs only if the second router is skipped, which happens when
55383 a mailing list exists, but the sender is not on it. This router forcibly fails
55384 the address, giving a suitable error message.
55387 <section id="SECTverp">
55388 <title>Variable Envelope Return Paths (VERP)</title>
55390 <indexterm role="concept">
55391 <primary>VERP</primary>
55393 <indexterm role="concept">
55394 <primary>Variable Envelope Return Paths</primary>
55396 <indexterm role="concept">
55397 <primary>envelope sender</primary>
55399 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> –
55400 are a way of helping mailing list administrators discover which subscription
55401 address is the cause of a particular delivery failure. The idea is to encode
55402 the original recipient address in the outgoing envelope sender address, so that
55403 if the message is forwarded by another host and then subsequently bounces, the
55404 original recipient can be extracted from the recipient address of the bounce.
55407 <indexterm role="option">
55408 <primary><option>errors_to</option></primary>
55410 <indexterm role="option">
55411 <primary><option>return_path</option></primary>
55413 Envelope sender addresses can be modified by Exim using two different
55414 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
55415 list examples), or the <option>return_path</option> option on a transport. The second of
55416 these is effective only if the message is successfully delivered to another
55417 host; it is not used for errors detected on the local host (see the description
55418 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
55419 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
55421 <literallayout class="monospaced">
55426 ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
55427 {$1-request+$local_part=$domain@your.dom.example}fail}
55430 This has the effect of rewriting the return path (envelope sender) on outgoing
55431 SMTP messages, if the local part of the original return path ends in
55432 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
55433 local part and domain of the recipient into the return path. Suppose, for
55434 example, that a message whose return path has been set to
55435 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
55436 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
55439 <literallayout class="monospaced">
55440 somelist-request+subscriber=other.dom.example@your.dom.example
55443 <indexterm role="concept">
55444 <primary><varname>$local_part</varname></primary>
55446 For this to work, you must tell Exim to send multiple copies of messages that
55447 have more than one recipient, so that each copy has just one recipient. This is
55448 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
55449 might be sent to several different recipients in the same domain, in which case
55450 <varname>$local_part</varname> is not available in the transport, because it is not unique.
55453 Unless your host is doing nothing but mailing list deliveries, you should
55454 probably use a separate transport for the VERP deliveries, so as not to use
55455 extra resources in making one-per-recipient copies for other deliveries. This
55456 can easily be done by expanding the <option>transport</option> option in the router:
55458 <literallayout class="monospaced">
55461 domains = ! +local_domains
55463 ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
55464 {verp_smtp}{remote_smtp}}
55468 If you want to change the return path using <option>errors_to</option> in a router instead
55469 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
55470 routers that handle mailing list addresses. This will ensure that all delivery
55471 errors, including those detected on the local host, are sent to the VERP
55475 On a host that does no local deliveries and has no manual routing, only the
55476 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
55477 SMTP deliveries. Every mailing list recipient has its own return path value,
55478 and so Exim must hand them to the transport one at a time. Here is an example
55479 of a <command>dnslookup</command> router that implements VERP:
55481 <literallayout class="monospaced">
55484 domains = ! +local_domains
55485 transport = remote_smtp
55487 ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
55488 {$1-request+$local_part=$domain@your.dom.example}fail}
55492 Before you start sending out messages with VERPed return paths, you must also
55493 configure Exim to accept the bounce messages that come back to those paths.
55494 Typically this is done by setting a <option>local_part_suffix</option> option for a
55495 router, and using this to route the messages to wherever you want to handle
55499 The overhead incurred in using VERP depends very much on the size of the
55500 message, the number of recipient addresses that resolve to the same remote
55501 host, and the speed of the connection over which the message is being sent. If
55502 a lot of addresses resolve to the same host and the connection is slow, sending
55503 a separate copy of the message for each address may take substantially longer
55504 than sending a single copy with many recipients (for which VERP cannot be
55508 <section id="SECTvirtualdomains">
55509 <title>Virtual domains</title>
55511 <indexterm role="concept">
55512 <primary>virtual domains</primary>
55514 <indexterm role="concept">
55515 <primary>domain</primary>
55516 <secondary>virtual</secondary>
55518 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
55524 A domain for which there are no real mailboxes; all valid local parts are
55525 aliases for other email addresses. Common examples are organizational
55526 top-level domains and <quote>vanity</quote> domains.
55531 One of a number of independent domains that are all handled by the same host,
55532 with mailboxes on that host, but where the mailbox owners do not necessarily
55533 have login accounts on that host.
55538 The first usage is probably more common, and does seem more <quote>virtual</quote> than
55539 the second. This kind of domain can be handled in Exim with a straightforward
55540 aliasing router. One approach is to create a separate alias file for each
55541 virtual domain. Exim can test for the existence of the alias file to determine
55542 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
55543 to a router of this form:
55545 <literallayout class="monospaced">
55548 domains = dsearch;/etc/mail/virtual
55549 data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
55553 The <option>domains</option> option specifies that the router is to be skipped, unless there
55554 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
55555 domain that is being processed. When the router runs, it looks up the local
55556 part in the file to find a new address (or list of addresses). The <option>no_more</option>
55557 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
55558 string), Exim gives up on the address without trying any subsequent routers.
55561 This one router can handle all the virtual domains because the alias file names
55562 follow a fixed pattern. Permissions can be arranged so that appropriate people
55563 can edit the different alias files. A successful aliasing operation results in
55564 a new envelope recipient address, which is then routed from scratch.
55567 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
55568 way. One approach is to create a file for each domain containing a list of
55569 valid local parts, and use it in a router like this:
55571 <literallayout class="monospaced">
55574 domains = dsearch;/etc/mail/domains
55575 local_parts = lsearch;/etc/mail/domains/$domain
55576 transport = my_mailboxes
55579 The address is accepted if there is a file for the domain, and the local part
55580 can be found in the file. The <option>domains</option> option is used to check for the
55581 file’s existence because <option>domains</option> is tested before the <option>local_parts</option>
55582 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
55583 because that option is tested after <option>local_parts</option>. The transport is as
55586 <literallayout class="monospaced">
55588 driver = appendfile
55589 file = /var/mail/$domain/$local_part
55593 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
55594 required, to specify which uid is to be used for writing to the mailboxes.
55597 The configuration shown here is just one example of how you might support this
55598 requirement. There are many other ways this kind of configuration can be set
55599 up, for example, by using a database instead of separate files to hold all the
55600 information about the domains.
55603 <section id="SECTmulbox">
55604 <title>Multiple user mailboxes</title>
55606 <indexterm role="concept">
55607 <primary>multiple mailboxes</primary>
55609 <indexterm role="concept">
55610 <primary>mailbox</primary>
55611 <secondary>multiple</secondary>
55613 <indexterm role="concept">
55614 <primary>local part</primary>
55615 <secondary>prefix</secondary>
55617 <indexterm role="concept">
55618 <primary>local part</primary>
55619 <secondary>suffix</secondary>
55621 Heavy email users often want to operate with multiple mailboxes, into which
55622 incoming mail is automatically sorted. A popular way of handling this is to
55623 allow users to use multiple sender addresses, so that replies can easily be
55624 identified. Users are permitted to add prefixes or suffixes to their local
55625 parts for this purpose. The wildcard facility of the generic router options
55626 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
55627 example, consider this router:
55629 <literallayout class="monospaced">
55633 file = $home/.forward
55634 local_part_suffix = -*
55635 local_part_suffix_optional
55639 <indexterm role="concept">
55640 <primary><varname>$local_part_suffix</varname></primary>
55642 It runs a user’s <filename>.forward</filename> file for all local parts of the form
55643 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
55644 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
55646 <literallayout class="monospaced">
55647 if $local_part_suffix contains -special then
55648 save /home/$local_part/Mail/special
55652 If the filter file does not exist, or does not deal with such addresses, they
55653 fall through to subsequent routers, and, assuming no subsequent use of the
55654 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
55655 control over which suffixes are valid.
55658 Alternatively, a suffix can be used to trigger the use of a different
55659 <filename>.forward</filename> file – which is the way a similar facility is implemented in
55662 <literallayout class="monospaced">
55666 file = $home/.forward$local_part_suffix
55667 local_part_suffix = -*
55668 local_part_suffix_optional
55672 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
55673 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
55674 does not exist, or does not deal with the address, it is passed on to
55675 subsequent routers, which could, if required, look for an unqualified
55676 <filename>.forward</filename> file to use as a default.
55680 <title>Simplified vacation processing</title>
55682 <indexterm role="concept">
55683 <primary>vacation processing</primary>
55685 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
55686 a pipe command in a <filename>.forward</filename> file
55687 (see section <xref linkend="SECTspecitredli"/> for syntax details).
55688 This is prone to error by inexperienced users. There are two features of Exim
55689 that can be used to make this process simpler for users:
55694 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
55695 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
55696 alternatively can use Exim’s <command>autoreply</command> transport. The contents of a user’s
55697 <filename>.forward</filename> file are then much simpler. For example:
55699 <literallayout class="monospaced">
55700 spqr, vacation-spqr
55705 The <option>require_files</option> generic router option can be used to trigger a
55706 vacation delivery by checking for the existence of a certain file in the
55707 user’s home directory. The <option>unseen</option> generic option should also be used, to
55708 ensure that the original delivery also proceeds. In this case, all the user has
55709 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
55715 Another advantage of both these methods is that they both work even when the
55716 use of arbitrary pipes by users is locked out.
55720 <title>Taking copies of mail</title>
55722 <indexterm role="concept">
55723 <primary>message</primary>
55724 <secondary>copying every</secondary>
55726 Some installations have policies that require archive copies of all messages to
55727 be made. A single copy of each message can easily be taken by an appropriate
55728 command in a system filter, which could, for example, use a different file for
55729 each day’s messages.
55732 There is also a shadow transport mechanism that can be used to take copies of
55733 messages that are successfully delivered by local transports, one copy per
55734 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
55735 notification of delivery by sites that insist on doing such things.
55739 <title>Intermittently connected hosts</title>
55741 <indexterm role="concept">
55742 <primary>intermittently connected hosts</primary>
55744 It has become quite common (because it is cheaper) for hosts to connect to the
55745 Internet periodically rather than remain connected all the time. The normal
55746 arrangement is that mail for such hosts accumulates on a system that is
55747 permanently connected.
55750 Exim was designed for use on permanently connected hosts, and so it is not
55751 particularly well-suited to use in an intermittently connected environment.
55752 Nevertheless there are some features that can be used.
55756 <title>Exim on the upstream server host</title>
55758 It is tempting to arrange for incoming mail for the intermittently connected
55759 host to remain on Exim’s queue until the client connects. However, this
55760 approach does not scale very well. Two different kinds of waiting message are
55761 being mixed up in the same queue – those that cannot be delivered because of
55762 some temporary problem, and those that are waiting for their destination host
55763 to connect. This makes it hard to manage the queue, as well as wasting
55764 resources, because each queue runner scans the entire queue.
55767 A better approach is to separate off those messages that are waiting for an
55768 intermittently connected host. This can be done by delivering these messages
55769 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
55770 format, from where they are transmitted by other software when their
55771 destination connects. This makes it easy to collect all the mail for one host
55772 in a single directory, and to apply local timeout rules on a per-message basis
55776 On a very small scale, leaving the mail on Exim’s queue can be made to work. If
55777 you are doing this, you should configure Exim with a long retry period for the
55778 intermittent host. For example:
55780 <literallayout class="monospaced">
55781 cheshire.wonderland.fict.example * F,5d,24h
55784 This stops a lot of failed delivery attempts from occurring, but Exim remembers
55785 which messages it has queued up for that host. Once the intermittent host comes
55786 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
55787 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
55788 causes all the queued up messages to be delivered, often down a single SMTP
55789 connection. While the host remains connected, any new messages get delivered
55793 If the connecting hosts do not have fixed IP addresses, that is, if a host is
55794 issued with a different IP address each time it connects, Exim’s retry
55795 mechanisms on the holding host get confused, because the IP address is normally
55796 used as part of the key string for holding retry information. This can be
55797 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
55798 Since this has disadvantages for permanently connected hosts, it is best to
55799 arrange a separate transport for the intermittently connected ones.
55803 <title>Exim on the intermittently connected client host</title>
55805 The value of <option>smtp_accept_queue_per_connection</option> should probably be
55806 increased, or even set to zero (that is, disabled) on the intermittently
55807 connected host, so that all incoming messages down a single connection get
55808 delivered immediately.
55811 <indexterm role="concept">
55812 <primary>SMTP</primary>
55813 <secondary>passed connection</secondary>
55815 <indexterm role="concept">
55816 <primary>SMTP</primary>
55817 <secondary>multiple deliveries</secondary>
55819 <indexterm role="concept">
55820 <primary>multiple SMTP deliveries</primary>
55822 Mail waiting to be sent from an intermittently connected host will probably
55823 not have been routed, because without a connection DNS lookups are not
55824 possible. This means that if a normal queue run is done at connection time,
55825 each message is likely to be sent in a separate SMTP session. This can be
55826 avoided by starting the queue run with a command line option beginning with
55827 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
55828 first pass, routing is done but no deliveries take place. The second pass is a
55829 normal queue run; since all the messages have been previously routed, those
55830 destined for the same host are likely to get sent as multiple deliveries in a
55831 single SMTP connection.
55836 <chapter id="CHAPnonqueueing">
55837 <title>Using Exim as a non-queueing client</title>
55838 <titleabbrev>Exim as a non-queueing client</titleabbrev>
55840 <indexterm role="concept">
55841 <primary>client</primary>
55842 <secondary>non-queueing</secondary>
55844 <indexterm role="concept">
55845 <primary>smart host</primary>
55846 <secondary>queueing; suppressing</secondary>
55848 On a personal computer, it is a common requirement for all
55849 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
55850 configured to operate that way, for all the popular operating systems.
55851 However, there are some MUAs for Unix-like systems that cannot be so
55852 configured: they submit messages using the command line interface of
55853 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
55857 If the personal computer runs continuously, there is no problem, because it can
55858 run a conventional MTA that handles delivery to the smart host, and deal with
55859 any delays via its queueing mechanism. However, if the computer does not run
55860 continuously or runs different operating systems at different times, queueing
55861 email is not desirable.
55864 There is therefore a requirement for something that can provide the
55865 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
55866 any queueing or retrying facilities. Furthermore, the delivery to the smart
55867 host should be synchronous, so that if it fails, the sending MUA is immediately
55868 informed. In other words, we want something that extends an MUA that submits
55869 to a local MTA via the command line so that it behaves like one that submits
55870 to a remote smart host using TCP/SMTP.
55873 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
55874 that do this job. However, people have found them to be lacking in various
55875 ways. For instance, you might want to allow aliasing and forwarding to be done
55876 before sending a message to the smart host.
55879 Exim already had the necessary infrastructure for doing this job. Just a few
55880 tweaks were needed to make it behave as required, though it is somewhat of an
55881 overkill to use a fully-featured MTA for this purpose.
55884 <indexterm role="concept">
55885 <primary><option>mua_wrapper</option></primary>
55887 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
55888 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
55889 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
55890 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
55891 compatible router and transport configuration. Typically there will be just one
55892 router and one transport, sending everything to a smart host.
55895 When run in MUA wrapping mode, the behaviour of Exim changes in the
55901 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
55902 In other words, the only way to submit messages is via the command line.
55907 Each message is synchonously delivered as soon as it is received (<option>-odi</option> is
55908 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
55909 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
55910 does not finish until the delivery attempt is complete. If the delivery is
55911 successful, a zero return code is given.
55916 Address redirection is permitted, but the final routing for all addresses must
55917 be to the same remote transport, and to the same list of hosts. Furthermore,
55918 the return address (envelope sender) must be the same for all recipients, as
55919 must any added or deleted header lines. In other words, it must be possible to
55920 deliver the message in a single SMTP transaction, however many recipients there
55926 If these conditions are not met, or if routing any address results in a
55927 failure or defer status, or if Exim is unable to deliver all the recipients
55928 successfully to one of the smart hosts, delivery of the entire message fails.
55933 Because no queueing is allowed, all failures are treated as permanent; there
55934 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
55935 smart host. Furthermore, because only a single yes/no response can be given to
55936 the caller, it is not possible to deliver to some recipients and not others. If
55937 there is an error (temporary or permanent) for any recipient, all are failed.
55942 If more than one smart host is listed, Exim will try another host after a
55943 connection failure or a timeout, in the normal way. However, if this kind of
55944 failure happens for all the hosts, the delivery fails.
55949 When delivery fails, an error message is written to the standard error stream
55950 (as well as to Exim’s log), and Exim exits to the caller with a return code
55951 value 1. The message is expunged from Exim’s spool files. No bounce messages
55952 are ever generated.
55957 No retry data is maintained, and any retry rules are ignored.
55962 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
55963 true, <option>max_rcpt</option> in the smtp transport is forced to <quote>unlimited</quote>,
55964 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
55969 The overall effect is that Exim makes a single synchronous attempt to deliver
55970 the message, failing if there is any kind of problem. Because no local
55971 deliveries are done and no daemon can be run, Exim does not need root
55972 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
55973 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
55974 the advantages and disadvantages of running without root privilege.
55978 <chapter id="CHAPlog">
55979 <title>Log files</title>
55981 <indexterm role="concept" id="IIDloggen" class="startofrange">
55982 <primary>log</primary>
55983 <secondary>general description</secondary>
55985 <indexterm role="concept">
55986 <primary>log</primary>
55987 <secondary>types of</secondary>
55989 Exim writes three different logs, referred to as the main log, the reject log,
55995 <indexterm role="concept">
55996 <primary>main log</primary>
55998 The main log records the arrival of each message and each delivery in a single
55999 line in each case. The format is as compact as possible, in an attempt to keep
56000 down the size of log files. Two-character flag sequences make it easy to pick
56001 out these lines. A number of other events are recorded in the main log. Some of
56002 them are optional, in which case the <option>log_selector</option> option controls whether
56003 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
56004 analysis of main log files, is provided in the Exim distribution (see section
56005 <xref linkend="SECTmailstat"/>).
56010 <indexterm role="concept">
56011 <primary>reject log</primary>
56013 The reject log records information from messages that are rejected as a result
56014 of a configuration option (that is, for policy reasons).
56015 The first line of each rejection is a copy of the line that is also written to
56016 the main log. Then, if the message’s header has been read at the time the log
56017 is written, its contents are written to this log. Only the original header
56018 lines are available; header lines added by ACLs are not logged. You can use the
56019 reject log to check that your policy controls are working correctly; on a busy
56020 host this may be easier than scanning the main log for rejection messages. You
56021 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
56027 <indexterm role="concept">
56028 <primary>panic log</primary>
56030 <indexterm role="concept">
56031 <primary>system log</primary>
56033 When certain serious errors occur, Exim writes entries to its panic log. If the
56034 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
56035 are usually written to the main log as well, but can get lost amid the mass of
56036 other entries. The panic log should be empty under normal circumstances. It is
56037 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
56038 regularly, in order to become aware of any problems. When Exim cannot open its
56039 panic log, it tries as a last resort to write to the system log (syslog). This
56040 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
56041 message itself is written at priority LOG_CRIT.
56046 Every log line starts with a timestamp, in the format shown in the following
56047 example. Note that many of the examples shown in this chapter are line-wrapped.
56048 In the log file, this would be all on one line:
56050 <literallayout class="monospaced">
56051 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
56055 By default, the timestamps are in the local timezone. There are two
56056 ways of changing this:
56061 You can set the <option>timezone</option> option to a different time zone; in particular, if
56064 <literallayout class="monospaced">
56068 the timestamps will be in UTC (aka GMT).
56073 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
56076 <literallayout class="monospaced">
56077 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
56081 <section id="SECTwhelogwri">
56082 <title>Where the logs are written</title>
56084 <indexterm role="concept">
56085 <primary>log</primary>
56086 <secondary>destination</secondary>
56088 <indexterm role="concept">
56089 <primary>log</primary>
56090 <secondary>to file</secondary>
56092 <indexterm role="concept">
56093 <primary>log</primary>
56094 <secondary>to syslog</secondary>
56096 <indexterm role="concept">
56097 <primary>syslog</primary>
56099 The logs may be written to local files, or to syslog, or both. However, it
56100 should be noted that many syslog implementations use UDP as a transport, and
56101 are therefore unreliable in the sense that messages are not guaranteed to
56102 arrive at the loghost, nor is the ordering of messages necessarily maintained.
56103 It has also been reported that on large log files (tens of megabytes) you may
56104 need to tweak syslog to prevent it syncing the file with each write – on
56105 Linux this has been seen to make syslog take 90% plus of CPU time.
56108 The destination for Exim’s logs is configured by setting LOG_FILE_PATH in
56109 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
56110 configuration. This latter string is expanded, so it can contain, for example,
56111 references to the host name:
56113 <literallayout class="monospaced">
56114 log_file_path = /var/log/$primary_hostname/exim_%slog
56117 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
56118 rather than at run time, because then the setting is available right from the
56119 start of Exim’s execution. Otherwise, if there’s something it wants to log
56120 before it has read the configuration file (for example, an error in the
56121 configuration file) it will not use the path you want, and may not be able to
56125 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
56126 list, currently limited to at most two items. This is one option where the
56127 facility for changing a list separator may not be used. The list must always be
56128 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
56129 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
56130 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
56131 implying the use of a default path.
56134 When Exim encounters an empty item in the list, it searches the list defined by
56135 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
56136 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
56137 mean <quote>use the path specified at build time</quote>. It no such item exists, log
56138 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
56139 equivalent to the setting:
56141 <literallayout class="monospaced">
56142 log_file_path = $spool_directory/log/%slog
56145 If you do not specify anything at build time or run time, that is where the
56149 A log file path may also contain <literal>%D</literal> if datestamped log file names are in
56150 use – see section <xref linkend="SECTdatlogfil"/> below.
56153 Here are some examples of possible settings:
56156 <literal>LOG_FILE_PATH=syslog </literal> syslog only
56157 <literal>LOG_FILE_PATH=:syslog </literal> syslog and default path
56158 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
56159 <literal>LOG_FILE_PATH=/usr/log/exim_%s </literal> specified path only
56162 If there are more than two paths in the list, the first is used and a panic
56167 <title>Logging to local files that are periodically <quote>cycled</quote></title>
56169 <indexterm role="concept">
56170 <primary>log</primary>
56171 <secondary>cycling local files</secondary>
56173 <indexterm role="concept">
56174 <primary>cycling logs</primary>
56176 <indexterm role="concept">
56177 <primary><emphasis>exicyclog</emphasis></primary>
56179 <indexterm role="concept">
56180 <primary>log</primary>
56181 <secondary>local files; writing to</secondary>
56183 Some operating systems provide centralized and standardised methods for cycling
56184 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
56185 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
56186 main and reject logs each time it is called. The maximum number of old logs to
56187 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
56190 An Exim delivery process opens the main log when it first needs to write to it,
56191 and it keeps the file open in case subsequent entries are required – for
56192 example, if a number of different deliveries are being done for the same
56193 message. However, remote SMTP deliveries can take a long time, and this means
56194 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
56195 something similar is being used to rename log files on a regular basis. To
56196 ensure that a switch of log files is noticed as soon as possible, Exim calls
56197 <function>stat()</function> on the main log’s name before reusing an open file, and if the file
56198 does not exist, or its inode has changed, the old file is closed and Exim
56199 tries to open the main log from scratch. Thus, an old log file may remain open
56200 for quite some time, but no Exim processes should write to it once it has been
56204 <section id="SECTdatlogfil">
56205 <title>Datestamped log files</title>
56207 <indexterm role="concept">
56208 <primary>log</primary>
56209 <secondary>datestamped files</secondary>
56211 Instead of cycling the main and reject log files by renaming them
56212 periodically, some sites like to use files whose names contain a datestamp,
56213 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename>.
56214 Exim has support for this way of working. It is enabled by setting the
56215 <option>log_file_path</option> option to a path that includes <literal>%D</literal> at the point where the
56216 datestamp is required. For example:
56218 <literallayout class="monospaced">
56219 log_file_path = /var/spool/exim/log/%slog-%D
56220 log_file_path = /var/log/exim-%s-%D.log
56221 log_file_path = /var/spool/exim/log/%D-%slog
56224 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
56225 examples of names generated by the above examples:
56227 <literallayout class="monospaced">
56228 /var/spool/exim/log/mainlog-20021225
56229 /var/log/exim-reject-20021225.log
56230 /var/spool/exim/log/20021225-mainlog
56233 When this form of log file is specified, Exim automatically switches to new
56234 files at midnight. It does not make any attempt to compress old logs; you
56235 will need to write your own script if you require this. You should not
56236 run <emphasis>exicyclog</emphasis> with this form of logging.
56239 The location of the panic log is also determined by <option>log_file_path</option>, but it
56240 is not datestamped, because rotation of the panic log does not make sense.
56241 When generating the name of the panic log, <literal>%D</literal> is removed from the string.
56242 In addition, if it immediately follows a slash, a following non-alphanumeric
56243 character is removed; otherwise a preceding non-alphanumeric character is
56244 removed. Thus, the three examples above would give these panic log names:
56246 <literallayout class="monospaced">
56247 /var/spool/exim/log/paniclog
56248 /var/log/exim-panic.log
56249 /var/spool/exim/log/paniclog
56253 <title>Logging to syslog</title>
56255 <indexterm role="concept">
56256 <primary>log</primary>
56257 <secondary>syslog; writing to</secondary>
56259 The use of syslog does not change what Exim logs or the format of its messages,
56260 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
56261 Exim’s log lines are omitted when these lines are sent to syslog. Apart from
56262 that, the same strings are written to syslog as to log files. The syslog
56263 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
56264 by default, but you can change these by setting the <option>syslog_facility</option> and
56265 <option>syslog_processname</option> options, respectively. If Exim was compiled with
56266 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
56267 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
56268 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
56269 the time and host name to each line.
56270 The three log streams are mapped onto syslog priorities as follows:
56275 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
56280 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
56285 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
56290 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
56291 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
56292 these are routed by syslog to the same place. You can suppress this duplication
56293 by setting <option>syslog_duplication</option> false.
56296 Exim’s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
56297 entries contain multiple lines when headers are included. To cope with both
56298 these cases, entries written to syslog are split into separate <function>syslog()</function>
56299 calls at each internal newline, and also after a maximum of
56300 870 data characters. (This allows for a total syslog line length of 1024, when
56301 additions such as timestamps are added.) If you are running a syslog
56302 replacement that can handle lines longer than the 1024 characters allowed by
56303 RFC 3164, you should set
56305 <literallayout class="monospaced">
56306 SYSLOG_LONG_LINES=yes
56309 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
56310 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
56313 To make it easy to re-assemble split lines later, each component of a split
56314 entry starts with a string of the form [<<emphasis>n</emphasis>>/<<emphasis>m</emphasis>>] or [<<emphasis>n</emphasis>>\<<emphasis>m</emphasis>>]
56315 where <<emphasis>n</emphasis>> is the component number and <<emphasis>m</emphasis>> is the total number of
56316 components in the entry. The / delimiter is used when the line was split
56317 because it was too long; if it was split because of an internal newline, the \
56318 delimiter is used. For example, supposing the length limit to be 50 instead of
56319 870, the following would be the result of a typical rejection message to
56320 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
56321 name, and pid as added by syslog:
56323 <literallayout class="monospaced">
56324 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
56325 [2/5] [127.0.0.1] (ph10): syntax error in 'From' header
56326 [3/5] when scanning for sender: missing or malformed lo
56327 [4/5] cal part in "<>" (envelope sender is <ph10@cam.exa
56331 The same error might cause the following lines to be written to <quote>rejectlog</quote>
56334 <literallayout class="monospaced">
56335 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
56336 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
56337 [3/18] er when scanning for sender: missing or malformed
56338 [4/18] local part in "<>" (envelope sender is <ph10@cam
56339 [5\18] .example>)
56340 [6\18] Recipients: ph10@some.domain.cam.example
56341 [7\18] P Received: from [127.0.0.1] (ident=ph10)
56342 [8\18] by xxxxx.cam.example with smtp (Exim 4.00)
56343 [9\18] id 16RdAL-0006pc-00
56344 [10/18] for ph10@cam.example; Mon, 16 Sep 2002 16:
56345 [11\18] 09:43 +0100
56346 [12\18] F From: <>
56347 [13\18] Subject: this is a test header
56348 [18\18] X-something: this is another header
56349 [15/18] I Message-Id: <E16RdAL-0006pc-00@xxxxx.cam.examp
56352 [18/18] Date: Mon, 16 Sep 2002 16:09:43 +0100
56355 Log lines that are neither too long nor contain newlines are written to syslog
56356 without modification.
56359 If only syslog is being used, the Exim monitor is unable to provide a log tail
56360 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
56361 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
56366 <title>Log line flags</title>
56368 One line is written to the main log for each message received, and for each
56369 successful, unsuccessful, and delayed delivery. These lines can readily be
56370 picked out by the distinctive two-character flags that immediately follow the
56371 timestamp. The flags are:
56374 <literal><=</literal> message arrival
56375 <literal>=></literal> normal message delivery
56376 <literal>-></literal> additional address in same delivery
56377 <literal>*></literal> delivery suppressed by <option>-N</option>
56378 <literal>**</literal> delivery failed; address bounced
56379 <literal>==</literal> delivery deferred; temporary problem
56383 <title>Logging message reception</title>
56385 <indexterm role="concept">
56386 <primary>log</primary>
56387 <secondary>reception line</secondary>
56389 The format of the single-line entry in the main log that is written for every
56390 message received is shown in the basic example below, which is split over
56391 several lines in order to fit it on the page:
56393 <literallayout class="monospaced">
56394 2002-10-31 08:57:53 16ZCW1-0005MB-00 <= kryten@dwarf.fict.example
56395 H=mailer.fict.example [192.168.123.123] U=exim
56396 P=smtp S=5678 id=<incoming message id>
56399 The address immediately following <quote><=</quote> is the envelope sender address. A
56400 bounce message is shown with the sender address <quote><></quote>, and if it is locally
56401 generated, this is followed by an item of the form
56403 <literallayout class="monospaced">
56404 R=<message id>
56407 which is a reference to the message that caused the bounce to be sent.
56410 <indexterm role="concept">
56411 <primary>HELO</primary>
56413 <indexterm role="concept">
56414 <primary>EHLO</primary>
56416 For messages from other hosts, the H and U fields identify the remote host and
56417 record the RFC 1413 identity of the user that sent the message, if one was
56418 received. The number given in square brackets is the IP address of the sending
56419 host. If there is a single, unparenthesized host name in the H field, as
56420 above, it has been verified to correspond to the IP address (see the
56421 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
56422 by the remote host in the SMTP HELO or EHLO command, and has not been
56423 verified. If verification yields a different name to that given for HELO or
56424 EHLO, the verified name appears first, followed by the HELO or EHLO
56425 name in parentheses.
56428 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
56429 without brackets, in the HELO or EHLO command, leading to entries in
56430 the log containing text like these examples:
56432 <literallayout class="monospaced">
56433 H=(10.21.32.43) [192.168.8.34]
56434 H=([10.21.32.43]) [192.168.8.34]
56437 This can be confusing. Only the final address in square brackets can be relied
56441 For locally generated messages (that is, messages not received over TCP/IP),
56442 the H field is omitted, and the U field contains the login name of the caller
56446 <indexterm role="concept">
56447 <primary>authentication</primary>
56448 <secondary>logging</secondary>
56450 <indexterm role="concept">
56451 <primary>AUTH</primary>
56452 <secondary>logging</secondary>
56454 For all messages, the P field specifies the protocol used to receive the
56455 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
56456 of incoming SMTP messages, the value indicates whether or not any SMTP
56457 extensions (ESMTP), encryption, or authentication were used. If the SMTP
56458 session was encrypted, there is an additional X field that records the cipher
56459 suite that was used.
56462 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
56463 hosts that have authenticated themselves using the SMTP AUTH command. The first
56464 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
56465 there is an additional item A= followed by the name of the authenticator that
56466 was used. If an authenticated identification was set up by the authenticator’s
56467 <option>server_set_id</option> option, this is logged too, separated by a colon from the
56468 authenticator name.
56471 <indexterm role="concept">
56472 <primary>size</primary>
56473 <secondary>of message</secondary>
56475 The id field records the existing message id, if present. The size of the
56476 received message is given by the S field. When the message is delivered,
56477 headers may be removed or added, so that the size of delivered copies of the
56478 message may not correspond with this value (and indeed may be different to each
56482 The <option>log_selector</option> option can be used to request the logging of additional
56483 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
56487 <title>Logging deliveries</title>
56489 <indexterm role="concept">
56490 <primary>log</primary>
56491 <secondary>delivery line</secondary>
56493 The format of the single-line entry in the main log that is written for every
56494 delivery is shown in one of the examples below, for local and remote
56495 deliveries, respectively. Each example has been split into two lines in order
56496 to fit it on the page:
56498 <literallayout class="monospaced">
56499 2002-10-31 08:59:13 16ZCW1-0005MB-00 => marv
56500 <marv@hitch.fict.example> R=localuser T=local_delivery
56501 2002-10-31 09:00:10 16ZCW1-0005MB-00 =>
56502 monk@holistic.fict.example R=dnslookup T=remote_smtp
56503 H=holistic.fict.example [192.168.234.234]
56506 For ordinary local deliveries, the original address is given in angle brackets
56507 after the final delivery address, which might be a pipe or a file. If
56508 intermediate address(es) exist between the original and the final address, the
56509 last of these is given in parentheses after the final address. The R and T
56510 fields record the router and transport that were used to process the address.
56513 If a shadow transport was run after a successful local delivery, the log line
56514 for the successful delivery has an item added on the end, of the form
56517 <literal>ST=<</literal><emphasis>shadow transport name</emphasis><literal>></literal>
56520 If the shadow transport did not succeed, the error message is put in
56521 parentheses afterwards.
56524 <indexterm role="concept">
56525 <primary>asterisk</primary>
56526 <secondary>after IP address</secondary>
56528 When more than one address is included in a single delivery (for example, two
56529 SMTP RCPT commands in one transaction) the second and subsequent addresses are
56530 flagged with <literal>-></literal> instead of <literal>=></literal>. When two or more messages are delivered
56531 down a single SMTP connection, an asterisk follows the IP address in the log
56532 lines for the second and subsequent messages.
56535 The generation of a reply message by a filter file gets logged as a
56536 <quote>delivery</quote> to the addressee, preceded by <quote>></quote>.
56539 The <option>log_selector</option> option can be used to request the logging of additional
56540 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
56544 <title>Discarded deliveries</title>
56546 <indexterm role="concept">
56547 <primary>discarded messages</primary>
56549 <indexterm role="concept">
56550 <primary>message</primary>
56551 <secondary>discarded</secondary>
56553 <indexterm role="concept">
56554 <primary>delivery</primary>
56555 <secondary>discarded; logging</secondary>
56557 When a message is discarded as a result of the command <quote>seen finish</quote> being
56558 obeyed in a filter file which generates no deliveries, a log entry of the form
56560 <literallayout class="monospaced">
56561 2002-12-10 00:50:49 16auJc-0001UB-00 => discarded
56562 <low.club@bridge.example> R=userforward
56565 is written, to record why no deliveries are logged. When a message is discarded
56566 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
56568 <literallayout class="monospaced">
56569 1999-03-02 09:44:33 10HmaX-0005vi-00 => :blackhole:
56570 <hole@nowhere.example> R=blackhole_router
56574 <title>Deferred deliveries</title>
56576 When a delivery is deferred, a line of the following form is logged:
56578 <literallayout class="monospaced">
56579 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
56580 R=dnslookup T=smtp defer (146): Connection refused
56583 In the case of remote deliveries, the error is the one that was given for the
56584 last IP address that was tried. Details of individual SMTP failures are also
56585 written to the log, so the above line would be preceded by something like
56587 <literallayout class="monospaced">
56588 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
56589 mail1.endrest.example [192.168.239.239]: Connection refused
56592 When a deferred address is skipped because its retry time has not been reached,
56593 a message is written to the log, but this can be suppressed by setting an
56594 appropriate value in <option>log_selector</option>.
56598 <title>Delivery failures</title>
56600 <indexterm role="concept">
56601 <primary>delivery</primary>
56602 <secondary>failure; logging</secondary>
56604 If a delivery fails because an address cannot be routed, a line of the
56605 following form is logged:
56607 <literallayout class="monospaced">
56608 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
56609 <jim@trek99.example>: unknown mail domain
56612 If a delivery fails at transport time, the router and transport are shown, and
56613 the response from the remote host is included, as in this example:
56615 <literallayout class="monospaced">
56616 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
56617 R=dnslookup T=remote_smtp: SMTP error from remote mailer
56618 after pipelined RCPT TO:<ace400@pb.example>: host
56619 pbmail3.py.example [192.168.63.111]: 553 5.3.0
56620 <ace400@pb.example>...Addressee unknown
56623 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
56624 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
56625 disabling PIPELINING. The log lines for all forms of delivery failure are
56626 flagged with <literal>**</literal>.
56630 <title>Fake deliveries</title>
56632 <indexterm role="concept">
56633 <primary>delivery</primary>
56634 <secondary>fake; logging</secondary>
56636 If a delivery does not actually take place because the <option>-N</option> option has been
56637 used to suppress it, a normal delivery line is written to the log, except that
56638 <quote>=></quote> is replaced by <quote>*></quote>.
56642 <title>Completion</title>
56646 <literallayout class="monospaced">
56647 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
56650 is written to the main log when a message is about to be removed from the spool
56651 at the end of its processing.
56655 <title>Summary of Fields in Log Lines</title>
56657 <indexterm role="concept">
56658 <primary>log</primary>
56659 <secondary>summary of fields</secondary>
56661 A summary of the field identifiers that are used in log lines is shown in
56662 the following table:
56665 <literal>A </literal> authenticator name (and optional id)
56666 <literal>C </literal> SMTP confirmation on delivery
56667 <literal>CV </literal> certificate verification status
56668 <literal>DN </literal> distinguished name from peer certificate
56669 <literal>DT </literal> on <literal>=></literal> lines: time taken for a delivery
56670 <literal>F </literal> sender address (on delivery lines)
56671 <literal>H </literal> host name and IP address
56672 <literal>I </literal> local interface used
56673 <literal>id </literal> message id for incoming message
56674 <literal>P </literal> on <literal><=</literal> lines: protocol used
56675 <literal> </literal> on <literal>=></literal> and <literal>**</literal> lines: return path
56676 <literal>QT </literal> on <literal>=></literal> lines: time spent on queue so far
56677 <literal> </literal> on <quote>Completed</quote> lines: time spent on queue
56678 <literal>R </literal> on <literal><=</literal> lines: reference for local bounce
56679 <literal> </literal> on <literal>=></literal> <literal>**</literal> and <literal>==</literal> lines: router name
56680 <literal>S </literal> size of message
56681 <literal>ST </literal> shadow transport name
56682 <literal>T </literal> on <literal><=</literal> lines: message subject (topic)
56683 <literal> </literal> on <literal>=></literal> <literal>**</literal> and <literal>==</literal> lines: transport name
56684 <literal>U </literal> local user or RFC 1413 identity
56685 <literal>X </literal> TLS cipher suite
56689 <title>Other log entries</title>
56691 Various other types of log entry are written from time to time. Most should be
56692 self-explanatory. Among the more common are:
56697 <indexterm role="concept">
56698 <primary>retry</primary>
56699 <secondary>time not reached</secondary>
56701 <emphasis>retry time not reached</emphasis> An address previously suffered a temporary error
56702 during routing or local delivery, and the time to retry has not yet arrived.
56703 This message is not written to an individual message log file unless it happens
56704 during the first delivery attempt.
56709 <emphasis>retry time not reached for any host</emphasis> An address previously suffered
56710 temporary errors during remote delivery, and the retry time has not yet arrived
56711 for any of the hosts to which it is routed.
56716 <indexterm role="concept">
56717 <primary>spool directory</primary>
56718 <secondary>file locked</secondary>
56720 <emphasis>spool file locked</emphasis> An attempt to deliver a message cannot proceed because
56721 some other Exim process is already working on the message. This can be quite
56722 common if queue running processes are started at frequent intervals. The
56723 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
56729 <indexterm role="concept">
56730 <primary>error</primary>
56731 <secondary>ignored</secondary>
56733 <emphasis>error ignored</emphasis> There are several circumstances that give rise to this
56736 <orderedlist numeration="arabic">
56739 Exim failed to deliver a bounce message whose age was greater than
56740 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
56745 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
56746 failed. The delivery was discarded.
56751 A delivery set up by a router configured with
56753 <literallayout class="monospaced">
56754 errors_to = <>
56757 failed. The delivery was discarded.
56764 <section id="SECTlogselector">
56765 <title>Reducing or increasing what is logged</title>
56767 <indexterm role="concept">
56768 <primary>log</primary>
56769 <secondary>selectors</secondary>
56771 By setting the <option>log_selector</option> global option, you can disable some of Exim’s
56772 default logging, or you can request additional logging. The value of
56773 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
56776 <literallayout class="monospaced">
56777 log_selector = +arguments -retry_defer
56780 The list of optional log items is in the following table, with the default
56781 selection marked by asterisks:
56784 <literal>*acl_warn_skipped </literal> skipped <option>warn</option> statement in ACL
56785 <literal> address_rewrite </literal> address rewriting
56786 <literal> all_parents </literal> all parents in => lines
56787 <literal> arguments </literal> command line arguments
56788 <literal>*connection_reject </literal> connection rejections
56789 <literal>*delay_delivery </literal> immediate delivery delayed
56790 <literal> deliver_time </literal> time taken to perform delivery
56791 <literal> delivery_size </literal> add <literal>S=</literal><emphasis>nnn</emphasis> to => lines
56792 <literal>*dnslist_defer </literal> defers of DNS list (aka RBL) lookups
56793 <literal>*etrn </literal> ETRN commands
56794 <literal>*host_lookup_failed </literal> as it says
56795 <literal> ident_timeout </literal> timeout for ident connection
56796 <literal> incoming_interface </literal> incoming interface on <= lines
56797 <literal> incoming_port </literal> incoming port on <= lines
56798 <literal>*lost_incoming_connection </literal> as it says (includes timeouts)
56799 <literal> outgoing_port </literal> add remote port to => lines
56800 <literal>*queue_run </literal> start and end queue runs
56801 <literal> queue_time </literal> time on queue for one recipient
56802 <literal> queue_time_overall </literal> time on queue for whole message
56803 <literal> received_recipients </literal> recipients on <= lines
56804 <literal> received_sender </literal> sender on <= lines
56805 <literal>*rejected_header </literal> header contents on reject log
56806 <literal>*retry_defer </literal> <quote>retry time not reached</quote>
56807 <literal> return_path_on_delivery </literal> put return path on => and ** lines
56808 <literal> sender_on_delivery </literal> add sender to => lines
56809 <literal>*sender_verify_fail </literal> sender verification failures
56810 <literal>*size_reject </literal> rejection because too big
56811 <literal>*skip_delivery </literal> delivery skipped in a queue run
56812 <literal> smtp_confirmation </literal> SMTP confirmation on => lines
56813 <literal> smtp_connection </literal> SMTP connections
56814 <literal> smtp_incomplete_transaction</literal> incomplete SMTP transactions
56815 <literal> smtp_protocol_error </literal> SMTP protocol errors
56816 <literal> smtp_syntax_error </literal> SMTP syntax errors
56817 <literal> subject </literal> contents of <emphasis>Subject:</emphasis> on <= lines
56818 <literal> tls_certificate_verified </literal> certificate verification status
56819 <literal>*tls_cipher </literal> TLS cipher suite on <= and => lines
56820 <literal> tls_peerdn </literal> TLS peer DN on <= and => lines
56821 <literal> unknown_in_list </literal> DNS lookup failed in list match
56823 <literal> all </literal> all of the above
56826 More details on each of these items follows:
56831 <indexterm role="concept">
56832 <primary><option>warn</option> statement</primary>
56833 <secondary>log when skipping</secondary>
56835 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
56836 its conditions cannot be evaluated, a log line to this effect is written if
56837 this log selector is set.
56842 <indexterm role="concept">
56843 <primary>log</primary>
56844 <secondary>rewriting</secondary>
56846 <indexterm role="concept">
56847 <primary>rewriting</primary>
56848 <secondary>logging</secondary>
56850 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
56851 rewrites, but not to rewrites in filters run as an unprivileged user (because
56852 such users cannot access the log).
56857 <indexterm role="concept">
56858 <primary>log</primary>
56859 <secondary>full parentage</secondary>
56861 <option>all_parents</option>: Normally only the original and final addresses are logged on
56862 delivery lines; with this selector, intermediate parents are given in
56863 parentheses between them.
56868 <indexterm role="concept">
56869 <primary>log</primary>
56870 <secondary>Exim arguments</secondary>
56872 <indexterm role="concept">
56873 <primary>Exim arguments</primary>
56874 <secondary>logging</secondary>
56876 <option>arguments</option>: This causes Exim to write the arguments with which it was called
56877 to the main log, preceded by the current working directory. This is a debugging
56878 feature, added to make it easier to find out how certain MUAs call
56879 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
56880 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
56881 that are empty or that contain white space are quoted. Non-printing characters
56882 are shown as escape sequences. This facility cannot log unrecognized arguments,
56883 because the arguments are checked before the configuration file is read. The
56884 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
56885 between the caller and Exim.
56890 <indexterm role="concept">
56891 <primary>log</primary>
56892 <secondary>connection rejections</secondary>
56894 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
56895 connection is rejected, for whatever reason.
56900 <indexterm role="concept">
56901 <primary>log</primary>
56902 <secondary>delayed delivery</secondary>
56904 <indexterm role="concept">
56905 <primary>delayed delivery</primary>
56906 <secondary>logging</secondary>
56908 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
56909 started for an incoming message because the load is too high or too many
56910 messages were received on one connection. Logging does not occur if no delivery
56911 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
56916 <indexterm role="concept">
56917 <primary>log</primary>
56918 <secondary>delivery duration</secondary>
56920 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
56921 perform the actual delivery is logged as DT=<<emphasis>time</emphasis>>, for example, <literal>DT=1s</literal>.
56926 <indexterm role="concept">
56927 <primary>log</primary>
56928 <secondary>message size on delivery</secondary>
56930 <indexterm role="concept">
56931 <primary>size</primary>
56932 <secondary>of message</secondary>
56934 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
56935 the <quote>=></quote> line, tagged with S=.
56940 <indexterm role="concept">
56941 <primary>log</primary>
56942 <secondary>dnslist defer</secondary>
56944 <indexterm role="concept">
56945 <primary>DNS list</primary>
56946 <secondary>logging defer</secondary>
56948 <indexterm role="concept">
56949 <primary>black list (DNS)</primary>
56951 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
56952 DNS black list suffers a temporary error.
56957 <indexterm role="concept">
56958 <primary>log</primary>
56959 <secondary>ETRN commands</secondary>
56961 <indexterm role="concept">
56962 <primary>ETRN</primary>
56963 <secondary>logging</secondary>
56965 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
56966 is run to determine whether or not it is actually accepted. An invalid ETRN
56967 command, or one received within a message transaction is not logged by this
56968 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
56973 <indexterm role="concept">
56974 <primary>log</primary>
56975 <secondary>host lookup failure</secondary>
56977 <option>host_lookup_failed</option>: When a lookup of a host’s IP addresses fails to find
56978 any addresses, or when a lookup of an IP address fails to find a host name, a
56979 log line is written. This logging does not apply to direct DNS lookups when
56980 routing email addresses, but it does apply to <quote>byname</quote> lookups.
56985 <indexterm role="concept">
56986 <primary>log</primary>
56987 <secondary>ident timeout</secondary>
56989 <indexterm role="concept">
56990 <primary>RFC 1413</primary>
56991 <secondary>logging timeout</secondary>
56993 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
56994 client’s ident port times out.
56999 <indexterm role="concept">
57000 <primary>log</primary>
57001 <secondary>incoming interface</secondary>
57003 <indexterm role="concept">
57004 <primary>interface</primary>
57005 <secondary>logging</secondary>
57007 <option>incoming_interface</option>: The interface on which a message was received is added
57008 to the <quote><=</quote> line as an IP address in square brackets, tagged by I= and
57009 followed by a colon and the port number. The local interface and port are also
57010 added to other SMTP log lines, for example <quote>SMTP connection from</quote>, and to
57016 <indexterm role="concept">
57017 <primary>log</primary>
57018 <secondary>incoming remote port</secondary>
57020 <indexterm role="concept">
57021 <primary>port</primary>
57022 <secondary>logging remote</secondary>
57024 <indexterm role="concept">
57025 <primary>TCP/IP</primary>
57026 <secondary>logging incoming remote port</secondary>
57028 <indexterm role="concept">
57029 <primary><varname>$sender_fullhost</varname></primary>
57031 <indexterm role="concept">
57032 <primary><varname>$sender_rcvhost</varname></primary>
57034 <option>incoming_port</option>: The remote port number from which a message was received is
57035 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
57036 in square brackets, and separated from it by a colon. This is implemented by
57037 changing the value that is put in the <varname>$sender_fullhost</varname> and
57038 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
57039 important with the widening use of NAT (see RFC 2505).
57044 <indexterm role="concept">
57045 <primary>log</primary>
57046 <secondary>dropped connection</secondary>
57048 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
57049 connection is unexpectedly dropped.
57054 <indexterm role="concept">
57055 <primary>log</primary>
57056 <secondary>outgoing remote port</secondary>
57058 <indexterm role="concept">
57059 <primary>port</primary>
57060 <secondary>logging outgoint remote</secondary>
57062 <indexterm role="concept">
57063 <primary>TCP/IP</primary>
57064 <secondary>logging ougtoing remote port</secondary>
57066 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
57067 containing => tags) following the IP address. This option is not included in
57068 the default setting, because for most ordinary configurations, the remote port
57069 number is always 25 (the SMTP port).
57074 <indexterm role="concept">
57075 <primary>log</primary>
57076 <secondary>queue run</secondary>
57078 <indexterm role="concept">
57079 <primary>queue runner</primary>
57080 <secondary>logging</secondary>
57082 <option>queue_run</option>: The start and end of every queue run are logged.
57087 <indexterm role="concept">
57088 <primary>log</primary>
57089 <secondary>queue time</secondary>
57091 <option>queue_time</option>: The amount of time the message has been in the queue on the
57092 local host is logged as QT=<<emphasis>time</emphasis>> on delivery (<literal>=></literal>) lines, for example,
57093 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
57094 includes reception time as well as the delivery time for the current address.
57095 This means that it may be longer than the difference between the arrival and
57096 delivery log line times, because the arrival log line is not written until the
57097 message has been successfully received.
57102 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
57103 the local host is logged as QT=<<emphasis>time</emphasis>> on <quote>Completed</quote> lines, for
57104 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
57105 message, so it includes reception time as well as the total delivery time.
57110 <indexterm role="concept">
57111 <primary>log</primary>
57112 <secondary>recipients</secondary>
57114 <option>received_recipients</option>: The recipients of a message are listed in the main log
57115 as soon as the message is received. The list appears at the end of the log line
57116 that is written when a message is received, preceded by the word <quote>for</quote>. The
57117 addresses are listed after they have been qualified, but before any rewriting
57119 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
57125 <indexterm role="concept">
57126 <primary>log</primary>
57127 <secondary>sender reception</secondary>
57129 <option>received_sender</option>: The unrewritten original sender of a message is added to
57130 the end of the log line that records the message’s arrival, after the word
57131 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
57136 <indexterm role="concept">
57137 <primary>log</primary>
57138 <secondary>header lines for rejection</secondary>
57140 <option>rejected_header</option>: If a message’s header has been received at the time a
57141 rejection is written to the reject log, the complete header is added to the
57142 log. Header logging can be turned off individually for messages that are
57143 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
57148 <indexterm role="concept">
57149 <primary>log</primary>
57150 <secondary>retry defer</secondary>
57152 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
57153 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
57154 message is always omitted from individual message logs after the first delivery
57160 <indexterm role="concept">
57161 <primary>log</primary>
57162 <secondary>return path</secondary>
57164 <option>return_path_on_delivery</option>: The return path that is being transmitted with
57165 the message is included in delivery and bounce lines, using the tag P=.
57166 This is omitted if no delivery actually happens, for example, if routing fails,
57167 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
57172 <indexterm role="concept">
57173 <primary>log</primary>
57174 <secondary>sender on delivery</secondary>
57176 <option>sender_on_delivery</option>: The message’s sender address is added to every delivery
57177 and bounce line, tagged by F= (for <quote>from</quote>).
57178 This is the original sender that was received with the message; it is not
57179 necessarily the same as the outgoing return path.
57184 <indexterm role="concept">
57185 <primary>log</primary>
57186 <secondary>sender verify failure</secondary>
57188 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
57189 gives details of a sender verification failure is not written. Log lines for
57190 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
57196 <indexterm role="concept">
57197 <primary>log</primary>
57198 <secondary>size rejection</secondary>
57200 <option>size_reject</option>: A log line is written whenever a message is rejected because
57206 <indexterm role="concept">
57207 <primary>log</primary>
57208 <secondary>frozen messages; skipped</secondary>
57210 <indexterm role="concept">
57211 <primary>frozen messages</primary>
57212 <secondary>logging skipping</secondary>
57214 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
57215 queue run because it is frozen or because another process is already delivering
57217 <indexterm role="concept">
57218 <primary><quote>spool file is locked</quote></primary>
57220 The message that is written is <quote>spool file is locked</quote>.
57225 <indexterm role="concept">
57226 <primary>log</primary>
57227 <secondary>smtp confirmation</secondary>
57229 <indexterm role="concept">
57230 <primary>SMTP</primary>
57231 <secondary>logging confirmation</secondary>
57233 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP dialogue for
57234 outgoing messages is added to delivery log lines in the form <literal>C=</literal><<emphasis>text</emphasis>>.
57235 A number of MTAs (including Exim) return an identifying string in this
57241 <indexterm role="concept">
57242 <primary>log</primary>
57243 <secondary>SMTP connections</secondary>
57245 <indexterm role="concept">
57246 <primary>SMTP</primary>
57247 <secondary>logging connections</secondary>
57249 <option>smtp_connection</option>: A log line is written whenever an SMTP connection is
57250 established or closed, unless the connection is from a host that matches
57251 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
57252 only when the closure is unexpected.) This applies to connections from local
57253 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
57254 dropped in the middle of a message, a log line is always written, whether or
57255 not this selector is set, but otherwise nothing is written at the start and end
57256 of connections unless this selector is enabled.
57259 For TCP/IP connections to an Exim daemon, the current number of connections is
57260 included in the log message for each new connection, but note that the count is
57261 reset if the daemon is restarted.
57262 Also, because connections are closed (and the closure is logged) in
57263 subprocesses, the count may not include connections that have been closed but
57264 whose termination the daemon has not yet noticed. Thus, while it is possible to
57265 match up the opening and closing of connections in the log, the value of the
57266 logged counts may not be entirely accurate.
57271 <indexterm role="concept">
57272 <primary>log</primary>
57273 <secondary>SMTP transaction; incomplete</secondary>
57275 <indexterm role="concept">
57276 <primary>SMTP</primary>
57277 <secondary>logging incomplete transactions</secondary>
57279 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
57280 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
57281 and the message sender plus any accepted recipients are included in the log
57282 line. This can provide evidence of dictionary attacks.
57287 <indexterm role="concept">
57288 <primary>log</primary>
57289 <secondary>SMTP protocol error</secondary>
57291 <indexterm role="concept">
57292 <primary>SMTP</primary>
57293 <secondary>logging protocol error</secondary>
57295 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
57296 encountered. Exim does not have perfect detection of all protocol errors
57297 because of transmission delays and the use of pipelining. If PIPELINING has
57298 been advertised to a client, an Exim server assumes that the client will use
57299 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
57300 received after rejecting MAIL) as protocol errors.
57305 <indexterm role="concept">
57306 <primary>SMTP</primary>
57307 <secondary>logging syntax errors</secondary>
57309 <indexterm role="concept">
57310 <primary>SMTP</primary>
57311 <secondary>syntax errors; logging</secondary>
57313 <indexterm role="concept">
57314 <primary>SMTP</primary>
57315 <secondary>unknown command; logging</secondary>
57317 <indexterm role="concept">
57318 <primary>log</primary>
57319 <secondary>unknown SMTP command</secondary>
57321 <indexterm role="concept">
57322 <primary>log</primary>
57323 <secondary>SMTP syntax error</secondary>
57325 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
57326 encountered. An unrecognized command is treated as a syntax error. For an
57327 external connection, the host identity is given; for an internal connection
57328 using <option>-bs</option> the sender identification (normally the calling user) is given.
57333 <indexterm role="concept">
57334 <primary>log</primary>
57335 <secondary>subject</secondary>
57337 <indexterm role="concept">
57338 <primary>subject</primary>
57339 <secondary>logging</secondary>
57341 <option>subject</option>: The subject of the message is added to the arrival log line,
57342 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
57343 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
57344 specifies whether characters with values greater than 127 should be logged
57345 unchanged, or whether they should be rendered as escape sequences.
57350 <indexterm role="concept">
57351 <primary>log</primary>
57352 <secondary>certificate verification</secondary>
57354 <option>tls_certificate_verified</option>: An extra item is added to <= and => log lines
57355 when TLS is in use. The item is <literal>CV=yes</literal> if the peer’s certificate was
57356 verified, and <literal>CV=no</literal> if not.
57361 <indexterm role="concept">
57362 <primary>log</primary>
57363 <secondary>TLS cipher</secondary>
57365 <indexterm role="concept">
57366 <primary>TLS</primary>
57367 <secondary>logging cipher</secondary>
57369 <option>tls_cipher</option>: When a message is sent or received over an encrypted
57370 connection, the cipher suite used is added to the log line, preceded by X=.
57375 <indexterm role="concept">
57376 <primary>log</primary>
57377 <secondary>TLS peer DN</secondary>
57379 <indexterm role="concept">
57380 <primary>TLS</primary>
57381 <secondary>logging peer DN</secondary>
57383 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
57384 connection, and a certificate is supplied by the remote host, the peer DN is
57385 added to the log line, preceded by DN=.
57390 <indexterm role="concept">
57391 <primary>log</primary>
57392 <secondary>DNS failure in list</secondary>
57394 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
57395 result of a list match is failure because a DNS lookup failed.
57401 <title>Message log</title>
57403 <indexterm role="concept">
57404 <primary>message</primary>
57405 <secondary>log file for</secondary>
57407 <indexterm role="concept">
57408 <primary>log</primary>
57409 <secondary>message log; description of</secondary>
57411 <indexterm role="concept">
57412 <primary><filename>msglog</filename> directory</primary>
57414 <indexterm role="concept">
57415 <primary><option>preserve_message_logs</option></primary>
57417 In addition to the general log files, Exim writes a log file for each message
57418 that it handles. The names of these per-message logs are the message ids, and
57419 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
57420 message log contains copies of the log lines that apply to the message. This
57421 makes it easier to inspect the status of an individual message without having
57422 to search the main log. A message log is deleted when processing of the message
57423 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
57424 only with great care because they can fill up your disk very quickly.
57427 On a heavily loaded system, it may be desirable to disable the use of
57428 per-message logs, in order to reduce disk I/O. This can be done by setting the
57429 <option>message_logs</option> option false.
57430 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
57435 <chapter id="CHAPutils">
57436 <title>Exim utilities</title>
57438 <indexterm role="concept" id="IIDutils" class="startofrange">
57439 <primary>utilities</primary>
57441 A number of utility scripts and programs are supplied with Exim and are
57442 described in this chapter. There is also the Exim Monitor, which is covered in
57443 the next chapter. The utilities described here are:
57445 <informaltable frame="none">
57446 <tgroup cols="4" colsep="0" rowsep="0">
57447 <colspec colwidth="2*" align="left"/>
57448 <colspec colwidth="8*" align="left"/>
57449 <colspec colwidth="30*" align="left"/>
57450 <colspec colwidth="40*" align="left"/>
57454 <entry><xref linkend="SECTfinoutwha"/></entry>
57455 <entry><emphasis>exiwhat</emphasis></entry>
57456 <entry>list what Exim processes are doing</entry>
57460 <entry><xref linkend="SECTgreptheque"/></entry>
57461 <entry><emphasis>exiqgrep</emphasis></entry>
57462 <entry>grep the queue</entry>
57466 <entry><xref linkend="SECTsumtheque"/></entry>
57467 <entry><emphasis>exiqsumm</emphasis></entry>
57468 <entry>summarize the queue</entry>
57472 <entry><xref linkend="SECTextspeinf"/></entry>
57473 <entry><emphasis>exigrep</emphasis></entry>
57474 <entry>search the main log</entry>
57478 <entry><xref linkend="SECTexipick"/></entry>
57479 <entry><emphasis>exipick</emphasis></entry>
57480 <entry>select messages on various criteria</entry>
57484 <entry><xref linkend="SECTcyclogfil"/></entry>
57485 <entry><emphasis>exicyclog</emphasis></entry>
57486 <entry>cycle (rotate) log files</entry>
57490 <entry><xref linkend="SECTmailstat"/></entry>
57491 <entry><emphasis>eximstats</emphasis></entry>
57492 <entry>extract statistics from the log</entry>
57496 <entry><xref linkend="SECTcheckaccess"/></entry>
57497 <entry><emphasis>exim_checkaccess</emphasis></entry>
57498 <entry>check address acceptance from given IP</entry>
57502 <entry><xref linkend="SECTdbmbuild"/></entry>
57503 <entry><emphasis>exim_dbmbuild</emphasis></entry>
57504 <entry>build a DBM file</entry>
57508 <entry><xref linkend="SECTfinindret"/></entry>
57509 <entry><emphasis>exinext</emphasis></entry>
57510 <entry>extract retry information</entry>
57514 <entry><xref linkend="SECThindatmai"/></entry>
57515 <entry><emphasis>exim_dumpdb</emphasis></entry>
57516 <entry>dump a hints database</entry>
57520 <entry><xref linkend="SECThindatmai"/></entry>
57521 <entry><emphasis>exim_tidydb</emphasis></entry>
57522 <entry>clean up a hints database</entry>
57526 <entry><xref linkend="SECThindatmai"/></entry>
57527 <entry><emphasis>exim_fixdb</emphasis></entry>
57528 <entry>patch a hints database</entry>
57532 <entry><xref linkend="SECTmailboxmaint"/></entry>
57533 <entry><emphasis>exim_lock</emphasis></entry>
57534 <entry>lock a mailbox file</entry>
57540 Another utility that might be of use to sites with many MTAs is Tom Kistner’s
57541 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
57542 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
57544 <section id="SECTfinoutwha">
57545 <title>Finding out what Exim processes are doing (exiwhat)</title>
57547 <indexterm role="concept">
57548 <primary><emphasis>exiwhat</emphasis></primary>
57550 <indexterm role="concept">
57551 <primary>process</primary>
57552 <secondary>querying</secondary>
57554 <indexterm role="concept">
57555 <primary>SIGUSR1</primary>
57557 On operating systems that can restart a system call after receiving a signal
57558 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
57559 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
57560 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
57561 processes it can find, having first emptied the file. It then waits for one
57562 second to allow the Exim processes to react before displaying the results. In
57563 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
57564 send the signal to the Exim processes, so it is normally run as root.
57567 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
57568 use by system administrators. It is not sensible, for example, to set up a
57569 script that sends SIGUSR1 signals to Exim processes at short intervals.
57572 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
57573 varies in different operating systems. Not only are different options used,
57574 but the format of the output is different. For this reason, there are some
57575 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
57576 it doesn’t seem to be working for you, check the following compile-time
57580 <literal>EXIWHAT_PS_CMD </literal> the command for running <emphasis>ps</emphasis>
57581 <literal>EXIWHAT_PS_ARG </literal> the argument for <emphasis>ps</emphasis>
57582 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
57583 <literal>EXIWHAT_KILL_ARG </literal> the argument for the <emphasis>kill</emphasis> command
57586 An example of typical output from <emphasis>exiwhat</emphasis> is
57588 <literallayout class="monospaced">
57589 164 daemon: -q1h, listening on port 25
57590 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
57591 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
57592 [10.19.42.42] (editor@ref.example)
57593 10592 handling incoming call from [192.168.243.242]
57594 10628 accepting a local non-SMTP message
57597 The first number in the output line is the process number. The third line has
57598 been split here, in order to fit it on the page.
57601 <section id="SECTgreptheque">
57602 <title>Selective queue listing (exiqgrep)</title>
57604 <indexterm role="concept">
57605 <primary><emphasis>exiqgrep</emphasis></primary>
57607 <indexterm role="concept">
57608 <primary>queue</primary>
57609 <secondary>grepping</secondary>
57611 This utility is a Perl script contributed by Matt Hubbard. It runs
57613 <literallayout class="monospaced">
57617 to obtain a queue listing with undelivered recipients only, and then greps the
57618 output to select messages that match given criteria. The following selection
57619 options are available:
57623 <term><emphasis role="bold">-f</emphasis> <<emphasis>regex</emphasis>></term>
57626 Match the sender address. The field that is tested is enclosed in angle
57627 brackets, so you can test for bounce messages with
57629 <literallayout class="monospaced">
57630 exiqgrep -f '^<>$'
57632 </listitem></varlistentry>
57634 <term><emphasis role="bold">-r</emphasis> <<emphasis>regex</emphasis>></term>
57637 Match a recipient address. The field that is tested is not enclosed in angle
57640 </listitem></varlistentry>
57642 <term><emphasis role="bold">-s</emphasis> <<emphasis>regex</emphasis>></term>
57645 Match against the size field.
57647 </listitem></varlistentry>
57649 <term><emphasis role="bold">-y</emphasis> <<emphasis>seconds</emphasis>></term>
57652 Match messages that are younger than the given time.
57654 </listitem></varlistentry>
57656 <term><emphasis role="bold">-o</emphasis> <<emphasis>seconds</emphasis>></term>
57659 Match messages that are older than the given time.
57661 </listitem></varlistentry>
57663 <term><emphasis role="bold">-z</emphasis></term>
57666 Match only frozen messages.
57668 </listitem></varlistentry>
57670 <term><emphasis role="bold">-x</emphasis></term>
57673 Match only non-frozen messages.
57675 </listitem></varlistentry>
57678 The following options control the format of the output:
57682 <term><emphasis role="bold">-c</emphasis></term>
57685 Display only the count of matching messages.
57687 </listitem></varlistentry>
57689 <term><emphasis role="bold">-l</emphasis></term>
57692 Long format – display the full message information as output by Exim. This is
57695 </listitem></varlistentry>
57697 <term><emphasis role="bold">-i</emphasis></term>
57700 Display message ids only.
57702 </listitem></varlistentry>
57704 <term><emphasis role="bold">-b</emphasis></term>
57707 Brief format – one line per message.
57709 </listitem></varlistentry>
57711 <term><emphasis role="bold">-R</emphasis></term>
57714 Display messages in reverse order.
57716 </listitem></varlistentry>
57719 There is one more option, <option>-h</option>, which outputs a list of options.
57722 <section id="SECTsumtheque">
57723 <title>Summarising the queue (exiqsumm)</title>
57725 <indexterm role="concept">
57726 <primary><emphasis>exiqsumm</emphasis></primary>
57728 <indexterm role="concept">
57729 <primary>queue</primary>
57730 <secondary>summary</secondary>
57732 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
57733 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
57734 running a command such as
57736 <literallayout class="monospaced">
57737 exim -bp | exiqsumm
57740 The output consists of one line for each domain that has messages waiting for
57741 it, as in the following example:
57743 <literallayout class="monospaced">
57744 3 2322 74m 66m msn.com.example
57747 Each line lists the number of pending deliveries for a domain, their total
57748 volume, and the length of time that the oldest and the newest messages have
57749 been waiting. Note that the number of pending deliveries is greater than the
57750 number of messages when messages have more than one recipient.
57752 <para revisionflag="changed">
57753 A summary line is output at the end. By default the output is sorted on the
57754 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
57755 the output to be sorted by oldest message and by count of messages,
57756 respectively. There are also three options that split the messages for each
57757 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
57758 separates frozen messages, and <option>-s</option> separates messages according to their
57762 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
57763 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
57764 generated by aliasing or forwarding are included (unless the <option>one_time</option>
57765 option of the <command>redirect</command> router has been used to convert them into <quote>top
57766 level</quote> addresses).
57769 <section id="SECTextspeinf">
57770 <title>Extracting specific information from the log (exigrep)</title>
57772 <indexterm role="concept">
57773 <primary><emphasis>exigrep</emphasis></primary>
57775 <indexterm role="concept">
57776 <primary>log</primary>
57777 <secondary>extracts; grepping for</secondary>
57779 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
57780 files for entries that match a given pattern. When it finds a match, it
57781 extracts all the log entries for the relevant message, not just those that
57782 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
57783 given message, or all mail for a given user, or for a given host, for example.
57784 The input files can be in Exim log format or syslog format.
57787 If a matching log line is not associated with a specific message, it is always
57788 included in <emphasis>exigrep</emphasis>’s output. The usage is:
57791 <literal>exigrep [-l] [-t<</literal><emphasis>n</emphasis><literal>>] <</literal><emphasis>pattern</emphasis><literal>> [<</literal><emphasis>log file</emphasis><literal>>] ...</literal>
57794 The <option>-t</option> argument specifies a number of seconds. It adds an additional
57795 condition for message selection. Messages that are complete are shown only if
57796 they spent more than <<emphasis>n</emphasis>> seconds on the queue.
57799 The <option>-l</option> flag means <quote>literal</quote>, that is, treat all characters in the
57800 pattern as standing for themselves. Otherwise the pattern must be a Perl
57801 regular expression. The pattern match is case-insensitive. If no file names are
57802 given on the command line, the standard input is read.
57805 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
57806 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
57807 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
57810 <section id="SECTexipick">
57811 <title>Selecting messages by various criteria (exipick)</title>
57813 <indexterm role="concept">
57814 <primary><emphasis>exipick</emphasis></primary>
57816 John Jetmore’s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
57817 lists messages from the queue according to a variety of criteria. For details,
57818 visit <emphasis role="bold"><ulink url="http://www.exim.org/eximwiki/ToolExipickManPage">http://www.exim.org/eximwiki/ToolExipickManPage</ulink></emphasis> or run:
57820 <literallayout class="monospaced">
57824 <section id="SECTcyclogfil">
57825 <title>Cycling log files (exicyclog)</title>
57827 <indexterm role="concept">
57828 <primary>log</primary>
57829 <secondary>cycling local files</secondary>
57831 <indexterm role="concept">
57832 <primary>cycling logs</primary>
57834 <indexterm role="concept">
57835 <primary><emphasis>exicyclog</emphasis></primary>
57837 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
57838 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
57839 you are using log files with datestamps in their names (see section
57840 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
57841 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
57842 There are two command line options for <emphasis>exicyclog</emphasis>:
57847 <option>-k</option> <<emphasis>count</emphasis>> specifies the number of log files to keep, overriding the
57848 default that is set when Exim is built. The default default is 10.
57853 <option>-l</option> <<emphasis>path</emphasis>> specifies the log file path, in the same format as Exim’s
57854 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
57855 overriding the script’s default, which is to find the setting from Exim’s
57861 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
57862 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
57863 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
57864 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
57865 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
57866 logs are handled similarly.
57869 If the limit is greater than 99, the script uses 3-digit numbers such as
57870 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
57871 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
57872 any existing log files.
57875 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
57876 the end are deleted. All files with numbers greater than 01 are compressed,
57877 using a compression command which is configured by the COMPRESS_COMMAND
57878 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
57879 root <option>crontab</option> entry of the form
57881 <literallayout class="monospaced">
57882 1 0 * * * su exim -c /usr/exim/bin/exicyclog
57885 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
57886 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
57889 <section id="SECTmailstat">
57890 <title>Mail statistics (eximstats)</title>
57892 <indexterm role="concept">
57893 <primary>statistics</primary>
57895 <indexterm role="concept">
57896 <primary><emphasis>eximstats</emphasis></primary>
57898 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
57899 information from log files. The output is either plain text, or HTML.
57900 Exim log files are also suported by the <emphasis>Lire</emphasis> system produced by the
57901 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
57904 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
57905 latest version is the result of some extensive revision by Steve Campbell. A
57906 lot of information is given by default, but there are options for suppressing
57907 various parts of it. Following any options, the arguments to the script are a
57908 list of files, which should be main log files. For example:
57910 <literallayout class="monospaced">
57911 eximstats -nr /var/spool/exim/log/mainlog.01
57914 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
57915 messages received from or delivered to various hosts. The information is sorted
57916 both by message count and by volume, and the top fifty hosts in each category
57917 are listed on the standard output. Similar information, based on email
57918 addresses or domains instead of hosts can be requested by means of various
57919 options. For messages delivered and received locally, similar statistics are
57920 also produced per user.
57923 The output also includes total counts and statistics about delivery errors, and
57924 histograms showing the number of messages received and deliveries made in each
57925 hour of the day. A delivery with more than one address in its envelope (for
57926 example, an SMTP transaction with more than one RCPT command) is counted
57927 as a single delivery by <emphasis>eximstats</emphasis>.
57930 Though normally more deliveries than receipts are reported (as messages may
57931 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
57932 messages received than delivered, even though the queue is empty at the start
57933 and end of the period in question. If an incoming message contains no valid
57934 recipients, no deliveries are recorded for it. A bounce message is handled as
57935 an entirely separate message.
57938 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
57939 of messages received and deliveries made, and the number of hosts involved in
57940 each case. It also outputs the number of messages that were delayed (that is,
57941 not completely delivered at the first attempt), and the number that had at
57942 least one address that failed.
57945 The remainder of the output is in sections that can be independently disabled
57946 or modified by various options. It consists of a summary of deliveries by
57947 transport, histograms of messages received and delivered per time interval
57948 (default per hour), information about the time messages spent on the queue,
57949 a list of relayed messages, lists of the top fifty sending hosts, local
57950 senders, destination hosts, and destination local users by count and by volume,
57951 and a list of delivery errors that occurred.
57954 The relay information lists messages that were actually relayed, that is, they
57955 came from a remote host and were directly delivered to some other remote host,
57956 without being processed (for example, for aliasing or forwarding) locally.
57959 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
57960 outputs. These are documented in the Perl script itself, and can be extracted
57961 by running the command <command>perldoc</command> on the script. For example:
57963 <literallayout class="monospaced">
57964 perldoc /usr/exim/bin/eximstats
57967 <section id="SECTcheckaccess">
57968 <title>Checking access policy (exim_checkaccess)</title>
57970 <indexterm role="concept">
57971 <primary><emphasis>exim_checkaccess</emphasis></primary>
57973 <indexterm role="concept">
57974 <primary>policy control</primary>
57975 <secondary>checking access</secondary>
57977 <indexterm role="concept">
57978 <primary>checking access</primary>
57980 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
57981 debugging output, in order to check what Exim is doing when it is applying
57982 policy controls to incoming SMTP mail. However, not everybody is sufficiently
57983 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
57984 sometimes you just want to answer the question <quote>Does this address have
57985 access?</quote> without bothering with any further details.
57988 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
57989 two arguments, an IP address and an email address:
57991 <literallayout class="monospaced">
57992 exim_checkaccess 10.9.8.7 A.User@a.domain.example
57995 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
57996 given email address would be accepted in a RCPT command in a TCP/IP
57997 connection from the host with the given IP address. The output of the utility
57998 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
58000 <literallayout class="monospaced">
58002 550 Relay not permitted
58005 When running this test, the utility uses <literal><></literal> as the envelope sender address
58006 for the MAIL command, but you can change this by providing additional
58007 options. These are passed directly to the Exim command. For example, to specify
58008 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
58011 <literallayout class="monospaced">
58012 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
58013 -f himself@there.example
58016 Note that these additional Exim command line items must be given after the two
58017 mandatory arguments.
58020 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
58021 while running its checks. You can run checks that include callouts by using
58022 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
58025 <section id="SECTdbmbuild">
58026 <title>Making DBM files (exim_dbmbuild)</title>
58028 <indexterm role="concept">
58029 <primary>DBM</primary>
58030 <secondary>building dbm files</secondary>
58032 <indexterm role="concept">
58033 <primary>building DBM files</primary>
58035 <indexterm role="concept">
58036 <primary><emphasis>exim_dbmbuild</emphasis></primary>
58038 <indexterm role="concept">
58039 <primary>lower casing</primary>
58041 <indexterm role="concept">
58042 <primary>binary zero</primary>
58043 <secondary>in lookup key</secondary>
58045 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
58046 the format used by the <command>lsearch</command> lookup (see section
58047 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
58048 names as keys and the remainder of the information as data. The lower-casing
58049 can be prevented by calling the program with the <option>-nolc</option> option.
58052 A terminating zero is included as part of the key string. This is expected by
58053 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
58054 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
58055 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
58059 The program requires two arguments: the name of the input file (which can be a
58060 single hyphen to indicate the standard input), and the name of the output file.
58061 It creates the output under a temporary name, and then renames it if all went
58065 <indexterm role="concept">
58066 <primary>USE_DB</primary>
58068 If the native DB interface is in use (USE_DB is set in a compile-time
58069 configuration file – this is common in free versions of Unix) the two file
58070 names must be different, because in this mode the Berkeley DB functions create
58071 a single output file using exactly the name given. For example,
58073 <literallayout class="monospaced">
58074 exim_dbmbuild /etc/aliases /etc/aliases.db
58077 reads the system alias file and creates a DBM version of it in
58078 <filename>/etc/aliases.db</filename>.
58081 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
58082 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
58083 environment, the suffixes are added to the second argument of
58084 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
58085 when the Berkeley functions are used in compatibility mode (though this is not
58086 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
58089 If a duplicate key is encountered, the program outputs a warning, and when it
58090 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
58091 option is used. By default, only the first of a set of duplicates is used –
58092 this makes it compatible with <command>lsearch</command> lookups. There is an option
58093 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
58094 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
58095 <option>stderr</option>. For other errors, where it doesn’t actually make a new file, the
58099 <section id="SECTfinindret">
58100 <title>Finding individual retry times (exinext)</title>
58102 <indexterm role="concept">
58103 <primary>retry</primary>
58104 <secondary>times</secondary>
58106 <indexterm role="concept">
58107 <primary><emphasis>exinext</emphasis></primary>
58109 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
58110 fish specific information out of the retry database. Given a mail domain (or a
58111 complete address), it looks up the hosts for that domain, and outputs any retry
58112 information for the hosts or for the domain. At present, the retry information
58113 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
58114 output. For example:
58116 <literallayout class="monospaced">
58117 $ exinext piglet@milne.fict.example
58118 kanga.milne.example:192.168.8.1 error 146: Connection refused
58119 first failed: 21-Feb-1996 14:57:34
58120 last tried: 21-Feb-1996 14:57:34
58121 next try at: 21-Feb-1996 15:02:34
58122 roo.milne.example:192.168.8.3 error 146: Connection refused
58123 first failed: 20-Jan-1996 13:12:08
58124 last tried: 21-Feb-1996 11:42:03
58125 next try at: 21-Feb-1996 19:42:03
58126 past final cutoff time
58129 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
58130 will give any retry information for that local part in your default domain.
58131 A message id can be used to obtain retry information pertaining to a specific
58132 message. This exists only when an attempt to deliver a message to a remote host
58133 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
58134 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
58138 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
58139 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
58140 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
58141 configuration file, and the second sets macros for use within the configuration
58142 file. These features are mainly to help in testing, but might also be useful in
58143 environments where more than one configuration file is in use.
58146 <section id="SECThindatmai">
58147 <title>Hints database maintenance</title>
58149 <indexterm role="concept">
58150 <primary>hints database</primary>
58151 <secondary>maintenance</secondary>
58153 <indexterm role="concept">
58154 <primary>maintaining Exim’s hints database</primary>
58156 Three utility programs are provided for maintaining the DBM files that Exim
58157 uses to contain its delivery hint information. Each program requires two
58158 arguments. The first specifies the name of Exim’s spool directory, and the
58159 second is the name of the database it is to operate on. These are as follows:
58164 <emphasis>retry</emphasis>: the database of retry information
58169 <emphasis>wait-</emphasis><<emphasis>transport name</emphasis>>: databases of information about messages waiting
58175 <emphasis>callout</emphasis>: the callout cache
58180 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
58185 <emphasis>misc</emphasis>: other hints data
58190 The <emphasis>misc</emphasis> database is used for
58195 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
58200 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
58201 <command>smtp</command> transport)
58207 <title>exim_dumpdb</title>
58209 <indexterm role="concept">
58210 <primary><emphasis>exim_dumpdb</emphasis></primary>
58212 The entire contents of a database are written to the standard output by the
58213 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
58214 spool and database names. For example, to dump the retry database:
58216 <literallayout class="monospaced">
58217 exim_dumpdb /var/spool/exim retry
58220 Two lines of output are produced for each entry:
58222 <literallayout class="monospaced">
58223 T:mail.ref.example:192.168.242.242 146 77 Connection refused
58224 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
58227 The first item on the first line is the key of the record. It starts with one
58228 of the letters R, or T, depending on whether it refers to a routing or
58229 transport retry. For a local delivery, the next part is the local address; for
58230 a remote delivery it is the name of the remote host, followed by its failing IP
58231 address (unless <option>no_retry_include_ip_address</option> is set on the <command>smtp</command>
58232 transport). If the remote port is not the standard one (port 25), it is added
58233 to the IP address. Then there follows an error code, an additional error code,
58234 and a textual description of the error.
58237 The three times on the second line are the time of first failure, the time of
58238 the last delivery attempt, and the computed time for the next attempt. The line
58239 ends with an asterisk if the cutoff time for the last retry rule has been
58243 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
58244 consists of a host name followed by a list of ids for messages that are or were
58245 waiting to be delivered to that host. If there are a very large number for any
58246 one host, continuation records, with a sequence number added to the host name,
58247 may be seen. The data in these records is often out of date, because a message
58248 may be routed to several alternative hosts, and Exim makes no effort to keep
58253 <title>exim_tidydb</title>
58255 <indexterm role="concept">
58256 <primary><emphasis>exim_tidydb</emphasis></primary>
58258 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
58259 database. If run with no options, it removes all records that are more than 30
58260 days old. The age is calculated from the date and time that the record was last
58261 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
58262 since the first delivery failure. Information about a host that has been down
58263 for more than 30 days will remain in the database, provided that the record is
58264 updated sufficiently often.
58267 The cutoff date can be altered by means of the <option>-t</option> option, which must be
58268 followed by a time. For example, to remove all records older than a week from
58269 the retry database:
58271 <literallayout class="monospaced">
58272 exim_tidydb -t 7d /var/spool/exim retry
58275 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
58276 message ids. In the former these appear as data in records keyed by host –
58277 they were messages that were waiting for that host – and in the latter they
58278 are the keys for retry information for messages that have suffered certain
58279 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
58280 message ids in database records are those of messages that are still on the
58281 queue. Message ids for messages that no longer exist are removed from
58282 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
58283 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
58284 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
58285 whenever it removes information from the database.
58288 Certain records are automatically removed by Exim when they are no longer
58289 needed, but others are not. For example, if all the MX hosts for a domain are
58290 down, a retry record is created for each one. If the primary MX host comes back
58291 first, its record is removed when Exim successfully delivers to it, but the
58292 records for the others remain because Exim has not tried to use those hosts.
58295 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
58296 hints databases. You should do this at a quiet time of day, because it requires
58297 a database to be locked (and therefore inaccessible to Exim) while it does its
58298 work. Removing records from a DBM file does not normally make the file smaller,
58299 but all the common DBM libraries are able to re-use the space that is released.
58300 After an initial phase of increasing in size, the databases normally reach a
58301 point at which they no longer get any bigger, as long as they are regularly
58305 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
58306 databases is likely to keep on increasing.
58310 <title>exim_fixdb</title>
58312 <indexterm role="concept">
58313 <primary><emphasis>exim_fixdb</emphasis></primary>
58315 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
58316 Its main use is for testing Exim, but it might also be occasionally useful for
58317 getting round problems in a live system. It has no options, and its interface
58318 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
58319 key of a database record can then be entered, and the data for that record is
58323 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
58324 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
58325 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
58326 data for individual fields can be changed by typing the field number followed
58327 by new data, for example:
58329 <literallayout class="monospaced">
58333 resets the time of the next delivery attempt. Time values are given as a
58334 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
58335 used as optional separators.
58338 <section id="SECTmailboxmaint">
58339 <title>Mailbox maintenance (exim_lock)</title>
58341 <indexterm role="concept">
58342 <primary>mailbox</primary>
58343 <secondary>maintenance</secondary>
58345 <indexterm role="concept">
58346 <primary><emphasis>exim_lock</emphasis></primary>
58348 <indexterm role="concept">
58349 <primary>locking mailboxes</primary>
58351 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
58352 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
58353 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
58354 a user agent while investigating a problem. The utility requires the name of
58355 the file as its first argument. If the locking is successful, the second
58356 argument is run as a command (using C’s <function>system()</function> function); if there is no
58357 second argument, the value of the SHELL environment variable is used; if this
58358 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
58359 is unlocked and the utility ends. The following options are available:
58363 <term><option>-fcntl</option></term>
58366 Use <function>fcntl()</function> locking on the open mailbox.
58368 </listitem></varlistentry>
58370 <term><option>-flock</option></term>
58373 Use <function>flock()</function> locking on the open mailbox, provided the operating system
58376 </listitem></varlistentry>
58378 <term><option>-interval</option></term>
58381 This must be followed by a number, which is a number of seconds; it sets the
58382 interval to sleep between retries (default 3).
58384 </listitem></varlistentry>
58386 <term><option>-lockfile</option></term>
58389 Create a lock file before opening the mailbox.
58391 </listitem></varlistentry>
58393 <term><option>-mbx</option></term>
58396 Lock the mailbox using MBX rules.
58398 </listitem></varlistentry>
58400 <term><option>-q</option></term>
58403 Suppress verification output.
58405 </listitem></varlistentry>
58407 <term><option>-retries</option></term>
58410 This must be followed by a number; it sets the number of times to try to get
58411 the lock (default 10).
58413 </listitem></varlistentry>
58415 <term><option>-restore_time</option></term>
58418 This option causes <option>exim_lock</option> to restore the modified and read times to the
58419 locked file before exiting. This allows you to access a locked mailbox (for
58420 example, to take a backup copy) without disturbing the times that the user
58423 </listitem></varlistentry>
58425 <term><option>-timeout</option></term>
58428 This must be followed by a number, which is a number of seconds; it sets a
58429 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
58430 default), a non-blocking call is used.
58432 </listitem></varlistentry>
58434 <term><option>-v</option></term>
58437 Generate verbose output.
58439 </listitem></varlistentry>
58442 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
58443 default is to create a lock file and also to use <function>fcntl()</function> locking on the
58444 mailbox, which is the same as Exim’s default. The use of <option>-flock</option> or
58445 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
58446 requires that the directory containing the file be writeable. Locking by lock
58447 file does not last for ever; Exim assumes that a lock file is expired if it is
58448 more than 30 minutes old.
58451 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
58452 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
58453 to be taken out on the open mailbox, and an exclusive lock on the file
58454 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
58455 number of the mailbox file. When the locking is released, if an exclusive lock
58456 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
58459 The default output contains verification of the locking that takes place. The
58460 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
58461 suppresses all output except error messages.
58466 <literallayout class="monospaced">
58467 exim_lock /var/spool/mail/spqr
58470 runs an interactive shell while the file is locked, whereas
58473 <literal>exim_lock -q /var/spool/mail/spqr <<End</literal>
58474 <<emphasis>some commands</emphasis>>
58475 <literal>End</literal>
58478 runs a specific non-interactive sequence of commands while the file is locked,
58479 suppressing all verification output. A single command can be run by a command
58482 <literallayout class="monospaced">
58483 exim_lock -q /var/spool/mail/spqr \
58484 "cp /var/spool/mail/spqr /some/where"
58487 Note that if a command is supplied, it must be entirely contained within the
58488 second argument – hence the quotes.
58489 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
58494 <chapter id="CHAPeximon">
58495 <title>The Exim monitor</title>
58497 <indexterm role="concept" id="IIDeximon" class="startofrange">
58498 <primary>Exim monitor</primary>
58499 <secondary>description</secondary>
58501 <indexterm role="concept">
58502 <primary>X-windows</primary>
58504 <indexterm role="concept">
58505 <primary><emphasis>eximon</emphasis></primary>
58507 <indexterm role="concept">
58508 <primary>Local/eximon.conf</primary>
58510 <indexterm role="concept">
58511 <primary><filename>exim_monitor/EDITME</filename></primary>
58513 The Exim monitor is an application which displays in an X window information
58514 about the state of Exim’s queue and what Exim is doing. An admin user can
58515 perform certain operations on messages from this GUI interface; however all
58516 such facilities are also available from the command line, and indeed, the
58517 monitor itself makes use of the command line to perform any actions requested.
58520 <title>Running the monitor</title>
58522 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
58523 script that sets up a number of environment variables, and then runs the
58524 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
58525 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
58526 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
58527 parameters are for.
58530 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
58531 a particular invocation by setting up environment variables of the same names,
58532 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
58534 <literallayout class="monospaced">
58535 EXIMON_LOG_DEPTH=400 eximon
58538 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
58539 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
58540 overrides the Exim log file configuration. This makes it possible to have
58541 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
58542 syslog messages are routed to a file on the local host.
58545 X resources can be used to change the appearance of the window in the normal
58546 way. For example, a resource setting of the form
58548 <literallayout class="monospaced">
58549 Eximon*background: gray94
58552 changes the colour of the background to light grey rather than white. The
58553 stripcharts are drawn with both the data lines and the reference lines in
58554 black. This means that the reference lines are not visible when on top of the
58555 data. However, their colour can be changed by setting a resource called
58556 <quote>highlight</quote> (an odd name, but that’s what the Athena stripchart widget uses).
58557 For example, if your X server is running Unix, you could set up lighter
58558 reference lines in the stripcharts by obeying
58560 <literallayout class="monospaced">
58561 xrdb -merge <<End
58562 Eximon*highlight: gray
58566 <indexterm role="concept">
58567 <primary>admin user</primary>
58569 In order to see the contents of messages on the queue, and to operate on them,
58570 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
58573 The monitor’s window is divided into three parts. The first contains one or
58574 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
58575 main log file, and the third is a display of the queue of messages awaiting
58576 delivery, with two more action buttons. The following sections describe these
58577 different parts of the display.
58581 <title>The stripcharts</title>
58583 <indexterm role="concept">
58584 <primary>stripchart</primary>
58586 The first stripchart is always a count of messages on the queue. Its name can
58587 be configured by setting QUEUE_STRIPCHART_NAME in the
58588 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
58589 configuration script by regular expression matches on log file entries, making
58590 it possible to display, for example, counts of messages delivered to certain
58591 hosts or using certain transports. The supplied defaults display counts of
58592 received and delivered messages, and of local and SMTP deliveries. The default
58593 period between stripchart updates is one minute; this can be adjusted by a
58594 parameter in the <filename>Local/eximon.conf</filename> file.
58597 The stripchart displays rescale themselves automatically as the value they are
58598 displaying changes. There are always 10 horizontal lines in each chart; the
58599 title string indicates the value of each division when it is greater than one.
58600 For example, <quote>x2</quote> means that each division represents a value of 2.
58603 It is also possible to have a stripchart which shows the percentage fullness of
58604 a particular disk partition, which is useful when local deliveries are confined
58605 to a single partition.
58608 <indexterm role="concept">
58609 <primary><option>statvfs</option> function</primary>
58611 This relies on the availability of the <function>statvfs()</function> function or equivalent in
58612 the operating system. Most, but not all versions of Unix that support Exim have
58613 this. For this particular stripchart, the top of the chart always represents
58614 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
58615 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
58616 <filename>Local/eximon.conf</filename> file.
58620 <title>Main action buttons</title>
58622 <indexterm role="concept">
58623 <primary>size</primary>
58624 <secondary>of monitor window</secondary>
58626 <indexterm role="concept">
58627 <primary>Exim monitor</primary>
58628 <secondary>window size</secondary>
58630 <indexterm role="concept">
58631 <primary>window size</primary>
58633 Below the stripcharts there is an action button for quitting the monitor. Next
58634 to this is another button marked <quote>Size</quote>. They are placed here so that
58635 shrinking the window to its default minimum size leaves just the queue count
58636 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
58637 the window to expand to its maximum size, unless it is already at the maximum,
58638 in which case it is reduced to its minimum.
58641 When expanding to the maximum, if the window cannot be fully seen where it
58642 currently is, it is moved back to where it was the last time it was at full
58643 size. When it is expanding from its minimum size, the old position is
58644 remembered, and next time it is reduced to the minimum it is moved back there.
58647 The idea is that you can keep a reduced window just showing one or two
58648 stripcharts at a convenient place on your screen, easily expand it to show
58649 the full window when required, and just as easily put it back to what it was.
58650 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
58651 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
58652 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
58655 Normally, the monitor starts up with the window at its full size, but it can be
58656 built so that it starts up with the window at its smallest size, by setting
58657 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
58661 <title>The log display</title>
58663 <indexterm role="concept">
58664 <primary>log</primary>
58665 <secondary>tail of; in monitor</secondary>
58667 The second section of the window is an area in which a display of the tail of
58668 the main log is maintained.
58669 To save space on the screen, the timestamp on each log line is shortened by
58670 removing the date and, if <option>log_timezone</option> is set, the timezone.
58671 The log tail is not available when the only destination for logging data is
58672 syslog, unless the syslog lines are routed to a local file whose name is passed
58673 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
58676 The log sub-window has a scroll bar at its lefthand side which can be used to
58677 move back to look at earlier text, and the up and down arrow keys also have a
58678 scrolling effect. The amount of log that is kept depends on the setting of
58679 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
58680 to use. When this is full, the earlier 50% of data is discarded – this is
58681 much more efficient than throwing it away line by line. The sub-window also has
58682 a horizontal scroll bar for accessing the ends of long log lines. This is the
58683 only means of horizontal scrolling; the right and left arrow keys are not
58684 available. Text can be cut from this part of the window using the mouse in the
58685 normal way. The size of this subwindow is controlled by parameters in the
58686 configuration file <filename>Local/eximon.conf</filename>.
58689 Searches of the text in the log window can be carried out by means of the ^R
58690 and ^S keystrokes, which default to a reverse and a forward search,
58691 respectively. The search covers only the text that is displayed in the window.
58692 It cannot go further back up the log.
58695 The point from which the search starts is indicated by a caret marker. This is
58696 normally at the end of the text in the window, but can be positioned explicitly
58697 by pointing and clicking with the left mouse button, and is moved automatically
58698 by a successful search. If new text arrives in the window when it is scrolled
58699 back, the caret remains where it is, but if the window is not scrolled back,
58700 the caret is moved to the end of the new text.
58703 Pressing ^R or ^S pops up a window into which the search text can be typed.
58704 There are buttons for selecting forward or reverse searching, for carrying out
58705 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
58706 happens and the window remains so that further searches can be done. If the
58707 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
58708 ^C is typed the search is cancelled.
58711 The searching facility is implemented using the facilities of the Athena text
58712 widget. By default this pops up a window containing both <quote>search</quote> and
58713 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
58714 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
58715 However, the linkers in BSDI and HP-UX seem unable to handle an externally
58716 provided version of <option>TextPop</option> when the remaining parts of the text widget
58717 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
58718 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
58719 on these systems, at the expense of having unwanted items in the search popup
58724 <title>The queue display</title>
58726 <indexterm role="concept">
58727 <primary>queue</primary>
58728 <secondary>display in monitor</secondary>
58730 The bottom section of the monitor window contains a list of all messages that
58731 are on the queue, which includes those currently being received or delivered,
58732 as well as those awaiting delivery. The size of this subwindow is controlled by
58733 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
58734 at which it is updated is controlled by another parameter in the same file –
58735 the default is 5 minutes, since queue scans can be quite expensive. However,
58736 there is an <quote>Update</quote> action button just above the display which can be used
58737 to force an update of the queue display at any time.
58740 When a host is down for some time, a lot of pending mail can build up for it,
58741 and this can make it hard to deal with other messages on the queue. To help
58742 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
58743 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
58744 type anything in here and press <quote>Return</quote>, the text is added to a chain of
58745 such texts, and if every undelivered address in a message matches at least one
58746 of the texts, the message is not displayed.
58749 If there is an address that does not match any of the texts, all the addresses
58750 are displayed as normal. The matching happens on the ends of addresses so, for
58751 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
58752 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
58753 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
58754 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
58755 a hide request is automatically cancelled after one hour.
58758 While the dialogue box is displayed, you can’t press any buttons or do anything
58759 else to the monitor window. For this reason, if you want to cut text from the
58760 queue display to use in the dialogue box, you have to do the cutting before
58761 pressing the <quote>Hide</quote> button.
58764 The queue display contains, for each unhidden queued message, the length of
58765 time it has been on the queue, the size of the message, the message id, the
58766 message sender, and the first undelivered recipient, all on one line. If it is
58767 a bounce message, the sender is shown as <quote><></quote>. If there is more than one
58768 recipient to which the message has not yet been delivered, subsequent ones are
58769 listed on additional lines, up to a maximum configured number, following which
58770 an ellipsis is displayed. Recipients that have already received the message are
58774 <indexterm role="concept">
58775 <primary>frozen messages</primary>
58776 <secondary>display</secondary>
58778 If a message is frozen, an asterisk is displayed at the left-hand side.
58781 The queue display has a vertical scroll bar, and can also be scrolled by means
58782 of the arrow keys. Text can be cut from it using the mouse in the normal way.
58783 The text searching facilities, as described above for the log window, are also
58784 available, but the caret is always moved to the end of the text when the queue
58785 display is updated.
58789 <title>The queue menu</title>
58791 <indexterm role="concept">
58792 <primary>queue</primary>
58793 <secondary>menu in monitor</secondary>
58795 If the <option>shift</option> key is held down and the left button is clicked when the mouse
58796 pointer is over the text for any message, an action menu pops up, and the first
58797 line of the queue display for the message is highlighted. This does not affect
58801 If you want to use some other event for popping up the menu, you can set the
58802 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
58803 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
58804 value set in this parameter is a standard X event description. For example, to
58805 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
58807 <literallayout class="monospaced">
58808 EXIMON_MENU_EVENT='Ctrl<Btn1Down>' eximon
58811 The title of the menu is the message id, and it contains entries which act as
58817 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
58818 in a new text window.
58823 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
58824 information and headers is displayed in a new text window. See chapter
58825 <xref linkend="CHAPspool"/> for a description of the format of spool files.
58830 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
58831 displayed in a new text window. There is a default limit of 20,000 bytes to the
58832 amount of data displayed. This can be changed by setting the BODY_MAX
58833 option at compile time, or the EXIMON_BODY_MAX option at run time.
58838 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
58839 delivery of the message. This causes an automatic thaw if the message is
58840 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
58841 a new text window. The delivery is run in a separate process, to avoid holding
58842 up the monitor while the delivery proceeds.
58847 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
58848 that the message be frozen.
58853 <indexterm role="concept">
58854 <primary>thawing messages</primary>
58856 <indexterm role="concept">
58857 <primary>unfreezing messages</primary>
58859 <indexterm role="concept">
58860 <primary>frozen messages</primary>
58861 <secondary>thawing</secondary>
58863 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
58864 that the message be thawed.
58869 <indexterm role="concept">
58870 <primary>delivery</primary>
58871 <secondary>forcing failure</secondary>
58873 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
58874 that Exim gives up trying to deliver the message. A bounce message is generated
58875 for any remaining undelivered addresses.
58880 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
58881 that the message be deleted from the system without generating a bounce
58887 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
58888 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
58889 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
58890 Otherwise it must be entered as a fully qualified address. Pressing RETURN
58891 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
58892 additional recipient be added to the message, unless the entry box is empty, in
58893 which case no action is taken.
58898 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
58899 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
58900 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
58901 Otherwise it must be entered as a fully qualified address. Pressing RETURN
58902 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
58903 recipient address as already delivered, unless the entry box is empty, in which
58904 case no action is taken.
58909 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
58910 mark all recipient addresses as already delivered.
58915 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
58916 sender’s address. Pressing RETURN causes a call to Exim to be made using the
58917 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
58918 in which case no action is taken. If you want to set an empty sender (as in
58919 bounce messages), you must specify it as <quote><></quote>. Otherwise, if the address is
58920 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
58921 the address is qualified with that domain.
58926 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
58927 other cases when a call to Exim is made, if there is any output from Exim (in
58928 particular, if the command fails) a window containing the command and the
58929 output is displayed. Otherwise, the results of the action are normally apparent
58930 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
58931 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
58932 if no output is generated.
58935 The queue display is automatically updated for actions such as freezing and
58936 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
58937 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
58938 force an update of the display after one of these actions.
58941 In any text window that is displayed as result of a menu action, the normal
58942 cut-and-paste facility is available, and searching can be carried out using ^R
58943 and ^S, as described above for the log tail window.
58944 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
58949 <chapter id="CHAPsecurity">
58950 <title>Security considerations</title>
58952 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
58953 <primary>security</primary>
58954 <secondary>discussion of</secondary>
58956 This chapter discusses a number of issues concerned with security, some of
58957 which are also covered in other parts of this manual.
58960 For reasons that this author does not understand, some people have promoted
58961 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
58962 existence of this chapter in the documentation. However, the intent of the
58963 chapter is simply to describe the way Exim works in relation to certain
58964 security concerns, not to make any specific claims about the effectiveness of
58965 its security as compared with other MTAs.
58968 What follows is a description of the way Exim is supposed to be. Best efforts
58969 have been made to try to ensure that the code agrees with the theory, but an
58970 absence of bugs can never be guaranteed. Any that are reported will get fixed
58971 as soon as possible.
58974 <title>Building a more <quote>hardened</quote> Exim</title>
58976 <indexterm role="concept">
58977 <primary>security</primary>
58978 <secondary>build-time features</secondary>
58980 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
58981 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
58982 Exim administrator who does not have the root password, or by someone who has
58983 penetrated the Exim (but not the root) account. These options are as follows:
58988 ALT_CONFIG_PREFIX can be set to a string that is required to match the
58989 start of any file names used with the <option>-C</option> option. When it is set, these file
58990 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
58991 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
58992 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
58993 default setting for <option>ALT_CONFIG_PREFIX</option>.
58996 If the permitted configuration files are confined to a directory to
58997 which only root has access, this guards against someone who has broken
58998 into the Exim account from running a privileged Exim with an arbitrary
58999 configuration file, and using it to break into other accounts.
59004 If ALT_CONFIG_ROOT_ONLY is defined, root privilege is retained for <option>-C</option>
59005 and <option>-D</option> only if the caller of Exim is root. Without it, the Exim user may
59006 also use <option>-C</option> and <option>-D</option> and retain privilege. Setting this option locks out
59007 the possibility of testing a configuration using <option>-C</option> right through message
59008 reception and delivery, even if the caller is root. The reception works, but by
59009 that time, Exim is running as the Exim user, so when it re-execs to regain
59010 privilege for the delivery, the use of <option>-C</option> causes privilege to be lost.
59011 However, root can test reception and delivery using two separate commands.
59012 ALT_CONFIG_ROOT_ONLY is not set by default.
59017 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
59023 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
59024 never to be used for any deliveries. This is like the <option>never_users</option> runtime
59025 option, but it cannot be overridden; the runtime option adds additional users
59026 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
59027 is permitted to modify the runtime file from using Exim as a way to get root.
59033 <title>Root privilege</title>
59035 <indexterm role="concept">
59036 <primary>setuid</primary>
59038 <indexterm role="concept">
59039 <primary>root privilege</primary>
59041 The Exim binary is normally setuid to root, which means that it gains root
59042 privilege (runs as root) when it starts execution. In some special cases (for
59043 example, when the daemon is not in use and there are no local deliveries), it
59044 may be possible to run Exim setuid to some user other than root. This is
59045 discussed in the next section. However, in most installations, root privilege
59046 is required for two things:
59051 To set up a socket connected to the standard SMTP port (25) when initialising
59052 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
59058 To be able to change uid and gid in order to read users’ <filename>.forward</filename> files and
59059 perform local deliveries as the receiving user or as specified in the
59065 It is not necessary to be root to do any of the other things Exim does, such as
59066 receiving messages and delivering them externally over SMTP, and it is
59067 obviously more secure if Exim does not run as root except when necessary.
59068 For this reason, a user and group for Exim to use must be defined in
59069 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
59070 group</quote>. Their values can be changed by the run time configuration, though this
59071 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
59072 <emphasis>mail</emphasis> or another user name altogether.
59075 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
59076 abdication; the process cannot regain root afterwards. Prior to release 4.00,
59077 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
59080 After a new Exim process has interpreted its command line options, it changes
59081 uid and gid in the following cases:
59086 <indexterm role="concept">
59087 <primary><option>-C</option> option</primary>
59089 <indexterm role="concept">
59090 <primary><option>-D</option> option</primary>
59092 If the <option>-C</option> option is used to specify an alternate configuration file, or if
59093 the <option>-D</option> option is used to define macro values for the configuration, and the
59094 calling process is not running as root or the Exim user, the uid and gid are
59095 changed to those of the calling process.
59096 However, if ALT_CONFIG_ROOT_ONLY is defined in <filename>Local/Makefile</filename>, only
59097 root callers may use <option>-C</option> and <option>-D</option> without losing privilege, and if
59098 DISABLE_D_OPTION is set, the <option>-D</option> option may not be used at all.
59103 <indexterm role="concept">
59104 <primary><option>-be</option> option</primary>
59106 <indexterm role="concept">
59107 <primary><option>-bf</option> option</primary>
59109 <indexterm role="concept">
59110 <primary><option>-bF</option> option</primary>
59112 If the expansion test option (<option>-be</option>) or one of the filter testing options
59113 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
59119 If the process is not a daemon process or a queue runner process or a delivery
59120 process or a process for testing address routing (started with <option>-bt</option>), the
59121 uid and gid are changed to the Exim user and group. This means that Exim always
59122 runs under its own uid and gid when receiving messages. This also applies when
59123 testing address verification
59124 <indexterm role="concept">
59125 <primary><option>-bv</option> option</primary>
59127 <indexterm role="concept">
59128 <primary><option>-bh</option> option</primary>
59130 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
59136 For a daemon, queue runner, delivery, or address testing process, the uid
59137 remains as root at this stage, but the gid is changed to the Exim group.
59142 The processes that initially retain root privilege behave as follows:
59147 A daemon process changes the gid to the Exim group and the uid to the Exim
59148 user after setting up one or more listening sockets. The <function>initgroups()</function>
59149 function is called, so that if the Exim user is in any additional groups, they
59150 will be used during message reception.
59155 A queue runner process retains root privilege throughout its execution. Its
59156 job is to fork a controlled sequence of delivery processes.
59161 A delivery process retains root privilege throughout most of its execution,
59162 but any actual deliveries (that is, the transports themselves) are run in
59163 subprocesses which always change to a non-root uid and gid. For local
59164 deliveries this is typically the uid and gid of the owner of the mailbox; for
59165 remote deliveries, the Exim uid and gid are used. Once all the delivery
59166 subprocesses have been run, a delivery process changes to the Exim uid and gid
59167 while doing post-delivery tidying up such as updating the retry database and
59168 generating bounce and warning messages.
59171 While the recipient addresses in a message are being routed, the delivery
59172 process runs as root. However, if a user’s filter file has to be processed,
59173 this is done in a subprocess that runs under the individual user’s uid and
59174 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
59179 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
59180 the routing is done in the same environment as a message delivery.
59185 <section id="SECTrunexiwitpri">
59186 <title>Running Exim without privilege</title>
59188 <indexterm role="concept">
59189 <primary>privilege</primary>
59190 <secondary>running without</secondary>
59192 <indexterm role="concept">
59193 <primary>unprivileged running</primary>
59195 <indexterm role="concept">
59196 <primary>root privilege</primary>
59197 <secondary>running without</secondary>
59199 Some installations like to run Exim in an unprivileged state for more of its
59200 operation, for added security. Support for this mode of operation is provided
59201 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
59202 gid are changed to the Exim user and group at the start of a delivery process
59203 (and also queue runner and address testing processes). This means that address
59204 routing is no longer run as root, and the deliveries themselves cannot change
59208 <indexterm role="concept">
59209 <primary>SIGHUP</primary>
59211 <indexterm role="concept">
59212 <primary>daemon</primary>
59213 <secondary>restarting</secondary>
59215 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
59216 that the daemon can still be started in the usual way, and it can respond
59217 correctly to SIGHUP because the re-invocation regains root privilege.
59220 An alternative approach is to make Exim setuid to the Exim user and also setgid
59221 to the Exim group. If you do this, the daemon must be started from a root
59222 process. (Calling Exim from a root process makes it behave in the way it does
59223 when it is setuid root.) However, the daemon cannot restart itself after a
59224 SIGHUP signal because it cannot regain privilege.
59227 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
59228 stops Exim from trying to re-invoke itself to do a delivery after a message has
59229 been received. Such a re-invocation is a waste of resources because it has no
59233 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
59234 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
59235 to the Exim user seems a clean approach, but there is one complication:
59238 In this style of operation, Exim is running with the real uid and gid set to
59239 those of the calling process, and the effective uid/gid set to Exim’s values.
59240 Ideally, any association with the calling process’ uid/gid should be dropped,
59241 that is, the real uid/gid should be reset to the effective values so as to
59242 discard any privileges that the caller may have. While some operating systems
59243 have a function that permits this action for a non-root effective uid, quite a
59244 number of them do not. Because of this lack of standardization, Exim does not
59245 address this problem at this time.
59248 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
59249 is to keep the Exim binary setuid to root, and to set
59250 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
59251 be used in the most straightforward way.
59254 If you configure Exim not to run delivery processes as root, there are a
59255 number of restrictions on what you can do:
59260 You can deliver only as the Exim user/group. You should explicitly use the
59261 <option>user</option> and <option>group</option> options to override routers or local transports that
59262 normally deliver as the recipient. This makes sure that configurations that
59263 work in this mode function the same way in normal mode. Any implicit or
59264 explicit specification of another user causes an error.
59269 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
59270 not worthwhile to include them in the configuration.
59275 Users who wish to use <filename>.forward</filename> would have to make their home directory and
59276 the file itself accessible to the Exim user. Pipe and append-to-file entries,
59277 and their equivalents in Exim filters, cannot be used. While they could be
59278 enabled in the Exim user’s name, that would be insecure and not very useful.
59283 Unless the local user mailboxes are all owned by the Exim user (possible in
59284 some POP3 or IMAP-only environments):
59286 <orderedlist numeration="arabic">
59289 They must be owned by the Exim group and be writable by that group. This
59290 implies you must set <option>mode</option> in the appendfile configuration, as well as the
59291 mode of the mailbox files themselves.
59296 You must set <option>no_check_owner</option>, since most or all of the files will not be
59297 owned by the Exim user.
59302 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
59303 on a newly created mailbox when unprivileged. This also implies that new
59304 mailboxes need to be created manually.
59311 These restrictions severely restrict what can be done in local deliveries.
59312 However, there are no restrictions on remote deliveries. If you are running a
59313 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
59314 gives more security at essentially no cost.
59317 If you are using the <option>mua_wrapper</option> facility (see chapter
59318 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
59322 <title>Delivering to local files</title>
59324 Full details of the checks applied by <command>appendfile</command> before it writes to a file
59325 are given in chapter <xref linkend="CHAPappendfile"/>.
59329 <title>IPv4 source routing</title>
59331 <indexterm role="concept">
59332 <primary>source routing</primary>
59333 <secondary>in IP packets</secondary>
59335 <indexterm role="concept">
59336 <primary>IP source routing</primary>
59338 Many operating systems suppress IP source-routed packets in the kernel, but
59339 some cannot be made to do this, so Exim does its own check. It logs incoming
59340 IPv4 source-routed TCP calls, and then drops them. Things are all different in
59341 IPv6. No special checking is currently done.
59345 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
59347 Support for these SMTP commands is disabled by default. If required, they can
59348 be enabled by defining suitable ACLs.
59352 <title>Privileged users</title>
59354 <indexterm role="concept">
59355 <primary>trusted user</primary>
59357 <indexterm role="concept">
59358 <primary>admin user</primary>
59360 <indexterm role="concept">
59361 <primary>privileged user</primary>
59363 <indexterm role="concept">
59364 <primary>user</primary>
59365 <secondary>trusted</secondary>
59367 <indexterm role="concept">
59368 <primary>user</primary>
59369 <secondary>admin</secondary>
59371 Exim recognises two sets of users with special privileges. Trusted users are
59372 able to submit new messages to Exim locally, but supply their own sender
59373 addresses and information about a sending host. For other users submitting
59374 local messages, Exim sets up the sender address from the uid, and doesn’t
59375 permit a remote host to be specified.
59378 <indexterm role="concept">
59379 <primary><option>-f</option> option</primary>
59381 However, an untrusted user is permitted to use the <option>-f</option> command line option
59382 in the special form <option>-f <></option> to indicate that a delivery failure for the
59383 message should not cause an error report. This affects the message’s envelope,
59384 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
59385 permitted to use specific forms of address with the <option>-f</option> option by setting
59386 the <option>untrusted_set_sender</option> option.
59389 Trusted users are used to run processes that receive mail messages from some
59390 other mail domain and pass them on to Exim for delivery either locally, or over
59391 the Internet. Exim trusts a caller that is running as root, as the Exim user,
59392 as any user listed in the <option>trusted_users</option> configuration option, or under any
59393 group listed in the <option>trusted_groups</option> option.
59396 Admin users are permitted to do things to the messages on Exim’s queue. They
59397 can freeze or thaw messages, cause them to be returned to their senders, remove
59398 them entirely, or modify them in various ways. In addition, admin users can run
59399 the Exim monitor and see all the information it is capable of providing, which
59400 includes the contents of files on the spool.
59403 <indexterm role="concept">
59404 <primary><option>-M</option> option</primary>
59406 <indexterm role="concept">
59407 <primary><option>-q</option> option</primary>
59409 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
59410 delivery of messages on its queue is restricted to admin users. This
59411 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
59412 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
59413 queue is also restricted to admin users. This restriction can be relaxed by
59414 setting <option>no_queue_list_requires_admin</option>.
59417 Exim recognises an admin user if the calling process is running as root or as
59418 the Exim user or if any of the groups associated with the calling process is
59419 the Exim group. It is not necessary actually to be running under the Exim
59420 group. However, if admin users who are not root or the Exim user are to access
59421 the contents of files on the spool via the Exim monitor (which runs
59422 unprivileged), Exim must be built to allow group read access to its spool
59427 <title>Spool files</title>
59429 <indexterm role="concept">
59430 <primary>spool directory</primary>
59431 <secondary>files</secondary>
59433 Exim’s spool directory and everything it contains is owned by the Exim user and
59434 set to the Exim group. The mode for spool files is defined in the
59435 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
59436 any user who is a member of the Exim group can access these files.
59440 <title>Use of argv[0]</title>
59442 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
59443 of specific strings, Exim assumes certain options. For example, calling Exim
59444 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
59445 to calling it with the option <option>-bS</option>. There are no security implications in
59450 <title>Use of %f formatting</title>
59452 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
59453 are actually stored in integer variables as 1000 times the load average.
59454 Consequently, their range is limited and so therefore is the length of the
59459 <title>Embedded Exim path</title>
59461 Exim uses its own path name, which is embedded in the code, only when it needs
59462 to re-exec in order to regain root privilege. Therefore, it is not root when it
59463 does so. If some bug allowed the path to get overwritten, it would lead to an
59464 arbitrary program’s being run as exim, not as root.
59468 <title>Use of sprintf()</title>
59470 <indexterm role="concept">
59471 <primary><function>sprintf()</function></primary>
59473 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
59474 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc’d store.
59475 The intermediate formatting is done into a large fixed buffer by a function
59476 that runs through the format string itself, and checks the length of each
59477 conversion before performing it, thus preventing buffer overruns.
59480 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
59481 the output buffer is known to be sufficiently long to contain the converted
59486 <title>Use of debug_printf() and log_write()</title>
59488 Arbitrary strings are passed to both these functions, but they do their
59489 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
59490 the format string itself, and checks the length of each conversion.
59494 <title>Use of strcat() and strcpy()</title>
59496 These are used only in cases where the output buffer is known to be large
59497 enough to hold the result.
59498 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
59503 <chapter id="CHAPspool">
59504 <title>Format of spool files</title>
59506 <indexterm role="concept" id="IIDforspo1" class="startofrange">
59507 <primary>format</primary>
59508 <secondary>spool files</secondary>
59510 <indexterm role="concept" id="IIDforspo2" class="startofrange">
59511 <primary>spool directory</primary>
59512 <secondary>format of files</secondary>
59514 <indexterm role="concept" id="IIDforspo3" class="startofrange">
59515 <primary>spool files</primary>
59516 <secondary>format of</secondary>
59518 <indexterm role="concept">
59519 <primary>spool files</primary>
59520 <secondary>editing</secondary>
59522 A message on Exim’s queue consists of two files, whose names are the message id
59523 followed by -D and -H, respectively. The data portion of the message is kept in
59524 the -D file on its own. The message’s envelope, status, and headers are all
59525 kept in the -H file, whose format is described in this chapter. Each of these
59526 two files contains the final component of its own name as its first line. This
59527 is insurance against disk crashes where the directory is lost but the files
59528 themselves are recoverable.
59531 Some people are tempted into editing -D files in order to modify messages. You
59532 need to be extremely careful if you do this; it is not recommended and you are
59533 on your own if you do it. Here are some of the pitfalls:
59538 You must ensure that Exim does not try to deliver the message while you are
59539 fiddling with it. The safest way is to take out a write lock on the -D file,
59540 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
59541 place, the lock will be retained. If you write a new file and rename it, the
59542 lock will be lost at the instant of rename.
59547 <indexterm role="concept">
59548 <primary><varname>$body_linecount</varname></primary>
59550 If you change the number of lines in the file, the value of
59551 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect. At
59552 present, this value is not used by Exim, but there is no guarantee that this
59553 will always be the case.
59558 If the message is in MIME format, you must take care not to break it.
59563 If the message is cryptographically signed, any change will invalidate the
59569 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
59570 its subdirectories when <option>split_spool_directory</option> is set). These are journal
59571 files, used to record addresses to which the message has been delivered during
59572 the course of a delivery run. At the end of the run, the -H file is updated,
59573 and the -J file is deleted.
59576 <title>Format of the -H file</title>
59578 <indexterm role="concept">
59579 <primary>uid (user id)</primary>
59580 <secondary>in spool file</secondary>
59582 <indexterm role="concept">
59583 <primary>gid (group id)</primary>
59584 <secondary>in spool file</secondary>
59586 The second line of the -H file contains the login name for the uid of the
59587 process that called Exim to read the message, followed by the numerical uid and
59588 gid. For a locally generated message, this is normally the user who sent the
59589 message. For a message received over TCP/IP, it is normally the Exim user.
59592 The third line of the file contains the address of the message’s sender as
59593 transmitted in the envelope, contained in angle brackets. The sender address is
59594 empty for bounce messages. For incoming SMTP mail, the sender address is given
59595 in the MAIL command. For locally generated mail, the sender address is
59596 created by Exim from the login name of the current user and the configured
59597 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
59598 leading <quote>From </quote> line if the caller is trusted, or if the supplied address is
59599 <quote><></quote> or an address that matches <option>untrusted_set_senders</option>.
59602 The fourth line contains two numbers. The first is the time that the message
59603 was received, in the conventional Unix form – the number of seconds since the
59604 start of the epoch. The second number is a count of the number of messages
59605 warning of delayed delivery that have been sent to the sender.
59608 There follow a number of lines starting with a hyphen. These can appear in any
59609 order, and are omitted when not relevant:
59613 <term><option>-acl</option> <<emphasis>number</emphasis>> <<emphasis>length</emphasis>></term>
59616 This item is obsolete, and is not generated from Exim release 4.61 onwards;
59617 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
59618 recognized, to provide backward compatibility. In the old format, a line of
59619 this form is present for every ACL variable that is not empty. The number
59620 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0–9 and
59621 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10–19. The length is the length of
59622 the data string for the variable. The string itself starts at the beginning of
59623 the next line, and is followed by a newline character. It may contain internal
59626 </listitem></varlistentry>
59627 <varlistentry revisionflag="changed">
59628 <term><option>-aclc</option> <<emphasis>rest-of-name</emphasis>> <<emphasis>length</emphasis>></term>
59630 <para revisionflag="changed">
59631 A line of this form is present for every ACL connection variable that is
59632 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
59633 The length is the length of the data string for the variable. The string itself
59634 starts at the beginning of the next line, and is followed by a newline
59635 character. It may contain internal newlines.
59637 </listitem></varlistentry>
59638 <varlistentry revisionflag="changed">
59639 <term><option>-aclm</option> <<emphasis>rest-of-name</emphasis>> <<emphasis>length</emphasis>></term>
59641 <para revisionflag="changed">
59642 A line of this form is present for every ACL message variable that is defined.
59643 Note that there is a space between <option>-aclm</option> and the rest of the name. The
59644 length is the length of the data string for the variable. The string itself
59645 starts at the beginning of the next line, and is followed by a newline
59646 character. It may contain internal newlines.
59648 </listitem></varlistentry>
59650 <term><option>-active_hostname</option> <<emphasis>hostname</emphasis>></term>
59653 This is present if, when the message was received over SMTP, the value of
59654 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
59656 </listitem></varlistentry>
59658 <term><option>-allow_unqualified_recipient</option></term>
59661 This is present if unqualified recipient addresses are permitted in header
59662 lines (to stop such addresses from being qualified if rewriting occurs at
59663 transport time). Local messages that were input using <option>-bnq</option> and remote
59664 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
59666 </listitem></varlistentry>
59668 <term><option>-allow_unqualified_sender</option></term>
59671 This is present if unqualified sender addresses are permitted in header lines
59672 (to stop such addresses from being qualified if rewriting occurs at transport
59673 time). Local messages that were input using <option>-bnq</option> and remote messages from
59674 hosts that match <option>sender_unqualified_hosts</option> set this flag.
59676 </listitem></varlistentry>
59678 <term><option>-auth_id</option> <<emphasis>text</emphasis>></term>
59681 The id information for a message received on an authenticated SMTP connection
59682 – the value of the <varname>$authenticated_id</varname> variable.
59684 </listitem></varlistentry>
59686 <term><option>-auth_sender</option> <<emphasis>address</emphasis>></term>
59689 The address of an authenticated sender – the value of the
59690 <varname>$authenticated_sender</varname> variable.
59692 </listitem></varlistentry>
59694 <term><option>-body_linecount</option> <<emphasis>number</emphasis>></term>
59697 This records the number of lines in the body of the message, and is always
59700 </listitem></varlistentry>
59702 <term><option>-body_zerocount</option> <<emphasis>number</emphasis>></term>
59705 This records the number of binary zero bytes in the body of the message, and is
59706 present if the number is greater than zero.
59708 </listitem></varlistentry>
59710 <term><option>-deliver_firsttime</option></term>
59713 This is written when a new message is first added to the spool. When the spool
59714 file is updated after a deferral, it is omitted.
59716 </listitem></varlistentry>
59718 <term><option>-frozen</option> <<emphasis>time</emphasis>></term>
59721 <indexterm role="concept">
59722 <primary>frozen messages</primary>
59723 <secondary>spool data</secondary>
59725 The message is frozen, and the freezing happened at <<emphasis>time</emphasis>>.
59727 </listitem></varlistentry>
59729 <term><option>-helo_name</option> <<emphasis>text</emphasis>></term>
59732 This records the host name as specified by a remote host in a HELO or EHLO
59735 </listitem></varlistentry>
59737 <term><option>-host_address</option> <<emphasis>address</emphasis>>.<<emphasis>port</emphasis>></term>
59740 This records the IP address of the host from which the message was received and
59741 the remote port number that was used. It is omitted for locally generated
59744 </listitem></varlistentry>
59746 <term><option>-host_auth</option> <<emphasis>text</emphasis>></term>
59749 If the message was received on an authenticated SMTP connection, this records
59750 the name of the authenticator – the value of the
59751 <varname>$sender_host_authenticated</varname> variable.
59753 </listitem></varlistentry>
59755 <term><option>-host_lookup_failed</option></term>
59758 This is present if an attempt to look up the sending host’s name from its IP
59759 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
59761 </listitem></varlistentry>
59763 <term><option>-host_name</option> <<emphasis>text</emphasis>></term>
59766 <indexterm role="concept">
59767 <primary>reverse DNS lookup</primary>
59769 <indexterm role="concept">
59770 <primary>DNS</primary>
59771 <secondary>reverse lookup</secondary>
59773 This records the name of the remote host from which the message was received,
59774 if the host name was looked up from the IP address when the message was being
59775 received. It is not present if no reverse lookup was done.
59777 </listitem></varlistentry>
59779 <term><option>-ident</option> <<emphasis>text</emphasis>></term>
59782 For locally submitted messages, this records the login of the originating user,
59783 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
59784 ident value. For messages received over TCP/IP, this records the ident string
59785 supplied by the remote host, if any.
59787 </listitem></varlistentry>
59789 <term><option>-interface_address</option> <<emphasis>address</emphasis>>.<<emphasis>port</emphasis>></term>
59792 This records the IP address of the local interface and the port number through
59793 which a message was received from a remote host. It is omitted for locally
59794 generated messages.
59796 </listitem></varlistentry>
59798 <term><option>-local</option></term>
59801 The message is from a local sender.
59803 </listitem></varlistentry>
59805 <term><option>-localerror</option></term>
59808 The message is a locally-generated bounce message.
59810 </listitem></varlistentry>
59812 <term><option>-local_scan</option> <<emphasis>string</emphasis>></term>
59815 This records the data string that was returned by the <function>local_scan()</function> function
59816 when the message was received – the value of the <varname>$local_scan_data</varname>
59817 variable. It is omitted if no data was returned.
59819 </listitem></varlistentry>
59821 <term><option>-manual_thaw</option></term>
59824 The message was frozen but has been thawed manually, that is, by an explicit
59825 Exim command rather than via the auto-thaw process.
59827 </listitem></varlistentry>
59829 <term><option>-N</option></term>
59832 A testing delivery process was started using the <option>-N</option> option to suppress any
59833 actual deliveries, but delivery was deferred. At any further delivery attempts,
59834 <option>-N</option> is assumed.
59836 </listitem></varlistentry>
59838 <term><option>-received_protocol</option></term>
59841 This records the value of the <varname>$received_protocol</varname> variable, which contains
59842 the name of the protocol by which the message was received.
59844 </listitem></varlistentry>
59846 <term><option>-sender_set_untrusted</option></term>
59849 The envelope sender of this message was set by an untrusted local caller (used
59850 to ensure that the caller is displayed in queue listings).
59852 </listitem></varlistentry>
59854 <term><option>-spam_score_int</option> <<emphasis>number</emphasis>></term>
59857 If a message was scanned by SpamAssassin, this is present. It records the value
59858 of <varname>$spam_score_int</varname>.
59860 </listitem></varlistentry>
59862 <term><option>-tls_certificate_verified</option></term>
59865 A TLS certificate was received from the client that sent this message, and the
59866 certificate was verified by the server.
59868 </listitem></varlistentry>
59870 <term><option>-tls_cipher</option> <<emphasis>cipher name</emphasis>></term>
59873 When the message was received over an encrypted connection, this records the
59874 name of the cipher suite that was used.
59876 </listitem></varlistentry>
59878 <term><option>-tls_peerdn</option> <<emphasis>peer DN</emphasis>></term>
59881 When the message was received over an encrypted connection, and a certificate
59882 was received from the client, this records the Distinguished Name from that
59885 </listitem></varlistentry>
59888 Following the options there is a list of those addresses to which the message
59889 is not to be delivered. This set of addresses is initialized from the command
59890 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
59891 is set; otherwise it starts out empty. Whenever a successful delivery is made,
59892 the address is added to this set. The addresses are kept internally as a
59893 balanced binary tree, and it is a representation of that tree which is written
59894 to the spool file. If an address is expanded via an alias or forward file, the
59895 original address is added to the tree when deliveries to all its child
59896 addresses are complete.
59899 If the tree is empty, there is a single line in the spool file containing just
59900 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
59901 Y or N, followed by an address. The address is the value for the node of the
59902 tree, and the letters indicate whether the node has a left branch and/or a
59903 right branch attached to it, respectively. If branches exist, they immediately
59904 follow. Here is an example of a three-node tree:
59906 <literallayout class="monospaced">
59907 YY darcy@austen.fict.example
59908 NN alice@wonderland.fict.example
59909 NN editor@thesaurus.ref.example
59912 After the non-recipients tree, there is a list of the message’s recipients.
59913 This is a simple list, preceded by a count. It includes all the original
59914 recipients of the message, including those to whom the message has already been
59915 delivered. In the simplest case, the list contains one address per line. For
59918 <literallayout class="monospaced">
59920 editor@thesaurus.ref.example
59921 darcy@austen.fict.example
59923 alice@wonderland.fict.example
59926 However, when a child address has been added to the top-level addresses as a
59927 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
59928 line is of the following form:
59931 <<emphasis>top-level address</emphasis>> <<emphasis>errors_to address</emphasis>> <<emphasis>length</emphasis>>,<<emphasis>parent number</emphasis>>#<<emphasis>flag bits</emphasis>>
59934 The 01 flag bit indicates the presence of the three other fields that follow
59935 the top-level address. Other bits may be used in future to support additional
59936 fields. The <<emphasis>parent number</emphasis>> is the offset in the recipients list of the
59937 original parent of the <quote>one time</quote> address. The first two fields are the
59938 envelope sender that is associated with this address and its length. If the
59939 length is zero, there is no special envelope sender (there are then two space
59940 characters in the line). A non-empty field can arise from a <command>redirect</command> router
59941 that has an <option>errors_to</option> setting.
59944 A blank line separates the envelope and status information from the headers
59945 which follow. A header may occupy several lines of the file, and to save effort
59946 when reading it in, each header is preceded by a number and an identifying
59947 character. The number is the number of characters in the header, including any
59948 embedded newlines and the terminating newline. The character is one of the
59951 <informaltable frame="none">
59952 <tgroup cols="2" colsep="0" rowsep="0">
59953 <colspec colwidth="50pt" align="left"/>
59954 <colspec colwidth="254pt" align="left"/>
59957 <entry><<emphasis>blank</emphasis>></entry>
59958 <entry>header in which Exim has no special interest</entry>
59961 <entry><literal>B</literal></entry>
59962 <entry><emphasis>Bcc:</emphasis> header</entry>
59965 <entry><literal>C</literal></entry>
59966 <entry><emphasis>Cc:</emphasis> header</entry>
59969 <entry><literal>F</literal></entry>
59970 <entry><emphasis>From:</emphasis> header</entry>
59973 <entry><literal>I</literal></entry>
59974 <entry><emphasis>Message-id:</emphasis> header</entry>
59977 <entry><literal>P</literal></entry>
59978 <entry><emphasis>Received:</emphasis> header – P for <quote>postmark</quote></entry>
59981 <entry><literal>R</literal></entry>
59982 <entry><emphasis>Reply-To:</emphasis> header</entry>
59985 <entry><literal>S</literal></entry>
59986 <entry><emphasis>Sender:</emphasis> header</entry>
59989 <entry><literal>T</literal></entry>
59990 <entry><emphasis>To:</emphasis> header</entry>
59993 <entry><literal>*</literal></entry>
59994 <entry>replaced or deleted header</entry>
60000 Deleted or replaced (rewritten) headers remain in the spool file for debugging
60001 purposes. They are not transmitted when the message is delivered. Here is a
60002 typical set of headers:
60004 <literallayout class="monospaced">
60005 111P Received: by hobbit.fict.example with local (Exim 4.00)
60006 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
60007 049 Message-Id: <E14y9EI-00026G-00@hobbit.fict.example>
60008 038* X-rewrote-sender: bb@hobbit.fict.example
60009 042* From: Bilbo Baggins <bb@hobbit.fict.example>
60010 049F From: Bilbo Baggins <B.Baggins@hobbit.fict.example>
60011 099* To: alice@wonderland.fict.example, rdo@foundation,
60012 darcy@austen.fict.example, editor@thesaurus.ref.example
60013 104T To: alice@wonderland.fict.example, rdo@foundation.example,
60014 darcy@austen.fict.example, editor@thesaurus.ref.example
60015 038 Date: Fri, 11 May 2001 10:28:59 +0100
60018 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
60019 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
60020 unqualified domain <emphasis>foundation</emphasis>.
60021 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
60022 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
60023 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
60029 <title>Adding new drivers or lookup types</title>
60030 <titleabbrev>Adding drivers or lookups</titleabbrev>
60032 <indexterm role="concept">
60033 <primary>adding drivers</primary>
60035 <indexterm role="concept">
60036 <primary>new drivers</primary>
60037 <secondary>adding</secondary>
60039 <indexterm role="concept">
60040 <primary>drivers</primary>
60041 <secondary>adding new</secondary>
60043 The following actions have to be taken in order to add a new router, transport,
60044 authenticator, or lookup type to Exim:
60046 <orderedlist numeration="arabic">
60049 Choose a name for the driver or lookup type that does not conflict with any
60050 existing name; I will use <quote>newdriver</quote> in what follows.
60055 Add to <filename>src/EDITME</filename> the line:
60058 <<emphasis>type</emphasis>><literal>_NEWDRIVER=yes</literal>
60061 where <<emphasis>type</emphasis>> is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
60062 code is not to be included in the binary by default, comment this line out. You
60063 should also add any relevant comments about the driver or lookup type.
60068 Add to <filename>src/config.h.defaults</filename> the line:
60070 <literallayout class="monospaced">
60071 #define <type>_NEWDRIVER
60076 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
60077 and create a table entry as is done for all the other drivers and lookup types.
60082 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
60083 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
60084 driver or lookup type and add it to the definition of OBJ.
60089 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
60090 <filename>src</filename>.
60095 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
60096 as for other drivers and lookups.
60101 Then all you need to do is write the code! A good way to start is to make a
60102 proforma by copying an existing module of the same type, globally changing all
60103 occurrences of the name, and cutting out most of the code. Note that any
60104 options you create must be listed in alphabetical order, because the tables are
60105 searched using a binary chop procedure.
60108 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
60109 the interface that is expected.
60113 <index role="option">
60114 <title>Option index</title>
60117 <index role="concept">
60118 <title>Concept index</title>